Blame view

js/app/views/PlotComponents/PlotZoomPlug.js 3.25 KB
9f08f4eb   Benjamin Renard   Zoom in interacti...
1
/**
b2481b88   Nathanael Jourdane   fix indent
2
3
4
5
6
7
8
9
10
11
12
13
14
 * Project      :  AMDA-NG
 * Name         : PlotZoomPlug.js
 * @plugin    amdaPlotComp.PlotZoomPlug
 * @extends    Ext.util.Observable
 * @ptype      plotZoomPlugin
 * @brief     Plot Zoom UI (View)
 * @author Benjamin
 * @version $Id: PlotZoomPlug.js
 ********************************************************************************
 *    FT Id     :   Date   : Name - Description
 *******************************************************************************
 *  :
 */
9f08f4eb   Benjamin Renard   Zoom in interacti...
15

9f08f4eb   Benjamin Renard   Zoom in interacti...
16
Ext.define('amdaPlotComp.PlotZoomPlug', {
b2481b88   Nathanael Jourdane   fix indent
17
18
  extend: 'Ext.util.Observable',
  alias: 'plugin.plotZoomPlugin',
a75892d1   Menouard AZIB   Cleaning the Plot...
19
  requires: ['amdaPlotComp.intervalSelection.IntervalSelection'],
b2481b88   Nathanael Jourdane   fix indent
20
  win: null,
b2481b88   Nathanael Jourdane   fix indent
21
  zoomType: '',
b39c9d1d   Benjamin Renard   Fix interactive n...
22
  interactiveId: '',
b2481b88   Nathanael Jourdane   fix indent
23
  panelId: -1,
b2481b88   Nathanael Jourdane   fix indent
24
25
26
27
28
29
30
31
32
33
34
35
36
37

  constructor: function (config) {
    Ext.apply(this, config);
    this.callParent(arguments);
  },

  onDestroy: function () {
    this.win = null;
  },

  init: function (cmp) {
    this.hostCmp = cmp;
  },

b2481b88   Nathanael Jourdane   fix indent
38
  setMinValue: function (min) {
1591d4c2   Menouard AZIB   Basic functionali...
39
    if (!this.win)
b2481b88   Nathanael Jourdane   fix indent
40
      return;
1591d4c2   Menouard AZIB   Basic functionali...
41
    this.win.setField1Value(min);
b2481b88   Nathanael Jourdane   fix indent
42
43
44
  },

  setMaxValue: function (max) {
1591d4c2   Menouard AZIB   Basic functionali...
45
    if (!this.win)
b2481b88   Nathanael Jourdane   fix indent
46
      return;
1591d4c2   Menouard AZIB   Basic functionali...
47
    this.win.setField2Value(max);
b2481b88   Nathanael Jourdane   fix indent
48
49
  },

b2481b88   Nathanael Jourdane   fix indent
50
51
52
53

  /**
   *  creation of the window
   */
1591d4c2   Menouard AZIB   Basic functionali...
54
55
56
57
  show: function (interactiveId, zoomType, panelId) {
    this.zoomType = zoomType;
    this.panelId = panelId;
    this.interactiveId = interactiveId;
2dc9b65a   Menouard AZIB   All refactored cm...
58

1591d4c2   Menouard AZIB   Basic functionali...
59
    let config = {
a75892d1   Menouard AZIB   Cleaning the Plot...
60
      id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(),
1591d4c2   Menouard AZIB   Basic functionali...
61
62
63
64
65
66
67
68
69
      interactiveId: interactiveId,
      panelId: panelId,
      hostCmp: this.hostCmp,
      renderTo: this.hostCmp.ownerCt.body,
      listeners: {
        scope: this,
        beforeclose: function () {
          this.hostCmp.panelImage.hidePanelMarker();
          this.hostCmp.panelImage.stopZoom();
b2481b88   Nathanael Jourdane   fix indent
70
        },
1591d4c2   Menouard AZIB   Basic functionali...
71
72
        show: function (win, eOpts) {
          this.hostCmp.panelImage.showPanelMarker(panelId);
b2481b88   Nathanael Jourdane   fix indent
73
        }
1591d4c2   Menouard AZIB   Basic functionali...
74
75
76
77
78
79
80
81
82
83
84
      },
      getConstrainVector: function (constrainTo) {
        var me = this;
        if (me.constrain || me.constrainHeader) {
          constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent();
          return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo);
        }
      }
    };

    if (this.win) { this.close() };
b2481b88   Nathanael Jourdane   fix indent
85

1591d4c2   Menouard AZIB   Basic functionali...
86
    let winType;
b2481b88   Nathanael Jourdane   fix indent
87

1591d4c2   Menouard AZIB   Basic functionali...
88
89
90
91
92
93
    switch (this.zoomType) {
      case 'timeAxis':
        winType = 'amdaPlotComp.intervalSelection.DateZoomIntervalSelection';
        break;
      case 'y-left':
      case 'y-right':
2dc9b65a   Menouard AZIB   All refactored cm...
94
      case 'xaxis_id':
1591d4c2   Menouard AZIB   Basic functionali...
95
        winType = 'amdaPlotComp.intervalSelection.NumberZoomIntervalSelection';
2dc9b65a   Menouard AZIB   All refactored cm...
96
97
98
99
100
101
102
103
        let title = "";
        if (this.zoomType === 'y-left') {
          title = 'Zoom on Y Left axis';
        } else if (this.zoomType === 'y-right') {
          title = 'Zoom on Y Right axis';
        } else {
          title = 'Zoom on X axis';
        }
1591d4c2   Menouard AZIB   Basic functionali...
104
105
106
        config["type"] = this.zoomType;
        config["title"] = title;
        break;
1591d4c2   Menouard AZIB   Basic functionali...
107
108
109
110
111
112
113
      case 'plotFunction':
        winType = 'amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection';
        break;
    }

    this.win = Ext.create(winType, config);
    this.win.on('destroy', this.onDestroy, this);
b2481b88   Nathanael Jourdane   fix indent
114
    this.win.show();
b2481b88   Nathanael Jourdane   fix indent
115
116
117
118
119
120
121
122
  },

  close: function () {
    if (this.win == null)
      return;
    this.win.close();
  },

b2481b88   Nathanael Jourdane   fix indent
123
  resetMinMaxValue: function () {
a75892d1   Menouard AZIB   Cleaning the Plot...
124
125
    this.win.reset();
  }
8b11b1af   Benjamin Renard   Insert intervals ...
126
});