You need to sign in before continuing.

Merged
Merge Request #40 · created by Erdogan Furkan


10312 - Navigation 1/4 d'intervalle dans la fenêtre intéractive de plot


From 10312 into develop

Merged by Benjamin Renard

Source branch has been removed
2 participants

05 Jul, 2022

1 commit


01 Jul, 2022

1 commit


js/app/views/PlotTabResultUI.js
... ... @@ -19,65 +19,65 @@ Ext.define('amdaUI.PlotTabResultUI', {
19 19 'amdaPlotComp.PlotContextManager',
20 20 'amdaPlotComp.PlotResultImage'
21 21 ],
22   -
23   - panelImage : null,
24   - crtContext : null,
25   - interactiveId : '',
26   - navToolBar : null,
27   - isTTNavBar : false,
28   - crtTTFileIndex : 0,
  22 +
  23 + panelImage: null,
  24 + crtContext: null,
  25 + interactiveId: '',
  26 + navToolBar: null,
  27 + isTTNavBar: false,
  28 + crtTTFileIndex: 0,
29 29 disableSynchronize: false,
30 30 multiplot: false,
31 31 plotName: '',
32   -
  32 +
33 33 hiddenForm: null,
34   -
35   - constructor: function(config) {
36   - this.addEvents({'pagesize':true});
37   -
38   - this.init(config);
39   - this.callParent(arguments);
40   - },
41   -
42   - updateConfig : function(name, multiplot) {
43   - this.multiplot = multiplot;
44   - this.plotName = name;
45   - this.findParentByType('window').setTitle(this.plotName + (this.multiplot ? ' - Synchronized to Multiplot' : ''));
46   - },
47   -
48   - getImageSize : function() {
  34 +
  35 + constructor: function (config) {
  36 + this.addEvents({ 'pagesize': true });
  37 +
  38 + this.init(config);
  39 + this.callParent(arguments);
  40 + },
  41 +
  42 + updateConfig: function (name, multiplot) {
  43 + this.multiplot = multiplot;
  44 + this.plotName = name;
  45 + this.findParentByType('window').setTitle(this.plotName + (this.multiplot ? ' - Synchronized to Multiplot' : ''));
  46 + },
  47 +
  48 + getImageSize: function () {
49 49 if (!this.crtContext)
50 50 return {
51   - width : 0,
52   - height : 0
  51 + width: 0,
  52 + height: 0
53 53 };
54   -
55   - return {
56   - width : this.crtContext.page.width * this.sliderPage.getValue()/100.,
57   - height : this.crtContext.page.height * this.sliderPage.getValue()/100.
58   - }
  54 +
  55 + return {
  56 + width: this.crtContext.page.width * this.sliderPage.getValue() / 100.,
  57 + height: this.crtContext.page.height * this.sliderPage.getValue() / 100.
  58 + }
59 59 },
60   -
61   - getImageUrl: function(resultFolder, plotFile) {
62   - return 'data/'+sessionID +'/RES/'+resultFolder+ '/' + plotFile;
  60 +
  61 + getImageUrl: function (resultFolder, plotFile) {
  62 + return 'data/' + sessionID + '/RES/' + resultFolder + '/' + plotFile;
63 63 },
64   -
65   - toPixelOnSourceImage : function(value) {
66   - return value*100/this.sliderPage.getValue();
  64 +
  65 + toPixelOnSourceImage: function (value) {
  66 + return value * 100 / this.sliderPage.getValue();
67 67 },
68   -
69   - toPixelOnResultImage : function(value) {
70   - return value*this.sliderPage.getValue()/100;
  68 +
  69 + toPixelOnResultImage: function (value) {
  70 + return value * this.sliderPage.getValue() / 100;
71 71 },
72   -
73   - createZoomItemsForPanel: function(panelId) {
  72 +
  73 + createZoomItemsForPanel: function (panelId) {
74 74 var zoomPlugin = this.getPlugin('plot-zoom-plugin-id');
75 75 if (zoomPlugin == null)
76 76 return;
77   -
  77 +
78 78 var panelContext = amdaPlotComp.PlotContextManager.getPanelById(this.crtContext, panelId);
79 79 var size = this.getImageSize();
80   -
  80 +
81 81 var me = this;
82 82 var insertIntervalItem = null;
83 83 Ext.each(panelContext.plotArea.axes, function (axis) {
... ... @@ -87,44 +87,44 @@ Ext.define('amdaUI.PlotTabResultUI', {
87 87 var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId);
88 88 var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id);
89 89 var sourceXPos = me.toPixelOnSourceImage(posX);
90   - var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x+panelContext.plotArea.width, sourceXPos);
91   - var crtTime = new Date(crtTimestamp*1000);
  90 + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x + panelContext.plotArea.width, sourceXPos);
  91 + var crtTime = new Date(crtTimestamp * 1000);
92 92 crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset());
93 93 zoomPlugin.setMinValue(crtTime);
94 94 };
95   -
  95 +
96 96 var onMaxTimeSelection = function (posX) {
97 97 //Panel and axis context must be retrieved by using the crtContext
98 98 var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId);
99 99 var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id);
100 100 var sourceXPos = me.toPixelOnSourceImage(posX);
101   - var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x+panelContext.plotArea.width, sourceXPos);
102   - var crtTime = new Date(crtTimestamp*1000);
  101 + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x + panelContext.plotArea.width, sourceXPos);
  102 + var crtTime = new Date(crtTimestamp * 1000);
103 103 crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset());
104 104 zoomPlugin.setMaxValue(crtTime);
105 105 };
106   -
  106 +
107 107 //Events for zoom on a Y axis
108   - var onMinYValueSelection = function(posY) {
  108 + var onMinYValueSelection = function (posY) {
109 109 //Panel and axis context must be retrieved by using the crtContext
110 110 var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId);
111 111 var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id);
112 112 var sourceYPos = me.toPixelOnSourceImage(posY);
113   - var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.y+panelContext.plotArea.height, panelContext.plotArea.y, sourceYPos);
  113 + var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.y + panelContext.plotArea.height, panelContext.plotArea.y, sourceYPos);
114 114 zoomPlugin.setMinValue(crtValue);
115 115 };
116   -
117   - var onMaxYValueSelection = function(posY) {
  116 +
  117 + var onMaxYValueSelection = function (posY) {
118 118 //Panel and axis context must be retrieved by using the crtContext
119 119 var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId);
120 120 var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id);
121 121 var sourceYPos = me.toPixelOnSourceImage(posY);
122   - var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.y+panelContext.plotArea.height, panelContext.plotArea.y, sourceYPos);
  122 + var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.y + panelContext.plotArea.height, panelContext.plotArea.y, sourceYPos);
123 123 zoomPlugin.setMaxValue(crtValue);
124 124 };
125   -
  125 +
126 126 //Events for zoom on X axis
127   - var onMinXValueSelection = function(posX) {
  127 + var onMinXValueSelection = function (posX) {
128 128 //Panel and axis context must be retrieved by using the crtContext
129 129 var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId);
130 130 var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id);
... ... @@ -132,8 +132,8 @@ Ext.define('amdaUI.PlotTabResultUI', {
132 132 var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x + panelContext.plotArea.width, sourceXPos);
133 133 zoomPlugin.setMinValue(crtValue);
134 134 };
135   -
136   - var onMaxXValueSelection = function(posX) {
  135 +
  136 + var onMaxXValueSelection = function (posX) {
137 137 //Panel and axis context must be retrieved by using the crtContext
138 138 var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId);
139 139 var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id);
... ... @@ -141,64 +141,63 @@ Ext.define('amdaUI.PlotTabResultUI', {
141 141 var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x + panelContext.plotArea.width, sourceXPos);
142 142 zoomPlugin.setMaxValue(crtValue);
143 143 };
144   -
145   - switch (axis.id)
146   - {
147   - case 'timeAxis':
148   - me.contextualMenu.add({
149   - text:'Zoom on Time Axis',
150   - handler : function(item, e) {
151   - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
152   - zoomPlugin.resetMinMaxValue();
153   - me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection);
154   - },
155   - scope: this
156   - });
157   - insertIntervalItem = {
158   - text:'Insert Interval in TimeTable or Catalog',
159   - handler : function(item, e) {
160   - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
161   - zoomPlugin.resetMinMaxValue();
162   - me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection);
163   - },
164   - scope: this
165   - };
166   - break;
167   - case 'y-left' :
168   - me.contextualMenu.add({
169   - text:'Zoom on Y Left Axis',
170   - handler : function(item, e) {
171   - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
172   - zoomPlugin.resetMinMaxValue();
173   - me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection);
174   - }
175   - });
176   - break;
177   - case 'y-right' :
178   - me.contextualMenu.add({
179   - text:'Zoom on Y Right Axis',
180   - handler : function(item, e) {
181   - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
182   - zoomPlugin.resetMinMaxValue();
183   - me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection);
184   - }
185   - });
186   - break;
187   - case 'xaxis_id' :
188   - me.contextualMenu.add({
189   - text:'Zoom on X Axis',
190   - handler : function(item, e) {
191   - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
192   - zoomPlugin.resetMinMaxValue();
193   - me.panelImage.startZoom(true, me.toPixelOnResultImage(panelContext.y), me.toPixelOnResultImage(panelContext.height), onMinXValueSelection, onMaxXValueSelection);
194   - }
195   - });
196   - break;
197   - case 'epochAxis' :
198   - //Nothing to add
199   - break;
  144 +
  145 + switch (axis.id) {
  146 + case 'timeAxis':
  147 + me.contextualMenu.add({
  148 + text: 'Zoom on Time Axis',
  149 + handler: function (item, e) {
  150 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
  151 + zoomPlugin.resetMinMaxValue();
  152 + me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection);
  153 + },
  154 + scope: this
  155 + });
  156 + insertIntervalItem = {
  157 + text: 'Insert Interval in TimeTable or Catalog',
  158 + handler: function (item, e) {
  159 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
  160 + zoomPlugin.resetMinMaxValue();
  161 + me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection);
  162 + },
  163 + scope: this
  164 + };
  165 + break;
  166 + case 'y-left':
  167 + me.contextualMenu.add({
  168 + text: 'Zoom on Y Left Axis',
  169 + handler: function (item, e) {
  170 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
  171 + zoomPlugin.resetMinMaxValue();
  172 + me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection);
  173 + }
  174 + });
  175 + break;
  176 + case 'y-right':
  177 + me.contextualMenu.add({
  178 + text: 'Zoom on Y Right Axis',
  179 + handler: function (item, e) {
  180 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
  181 + zoomPlugin.resetMinMaxValue();
  182 + me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection);
  183 + }
  184 + });
  185 + break;
  186 + case 'xaxis_id':
  187 + me.contextualMenu.add({
  188 + text: 'Zoom on X Axis',
  189 + handler: function (item, e) {
  190 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id);
  191 + zoomPlugin.resetMinMaxValue();
  192 + me.panelImage.startZoom(true, me.toPixelOnResultImage(panelContext.y), me.toPixelOnResultImage(panelContext.height), onMinXValueSelection, onMaxXValueSelection);
  193 + }
  194 + });
  195 + break;
  196 + case 'epochAxis':
  197 + //Nothing to add
  198 + break;
200 199 }
201   -
  200 +
202 201 });
203 202  
204 203 if (insertIntervalItem != null) {
... ... @@ -207,39 +206,35 @@ Ext.define('amdaUI.PlotTabResultUI', {
207 206 }
208 207 },
209 208  
210   - getAxisValue: function(axis, pixelMin, pixelMax, pixelVal) {
211   - var val = amdaPlotComp.PlotContextManager.toAxisValue(axis, pixelMin, pixelMax, pixelVal);
212   - return parseFloat(val).toPrecision(5);
213   - },
214   -
215   - createPlotImage: function(resultFolder, plotFile) {
216   - var me = this;
217   - var size = this.getImageSize();
218   - this.panelImage = Ext.create('amdaPlotComp.PlotResultImage', {
219   - src : this.getImageUrl(resultFolder, plotFile),
220   - width : size.width,
221   - height : size.height,
222   - onMouseMove : function(x, y) {
  209 + getAxisValue: function (axis, pixelMin, pixelMax, pixelVal) {
  210 + var val = amdaPlotComp.PlotContextManager.toAxisValue(axis, pixelMin, pixelMax, pixelVal);
  211 + return parseFloat(val).toPrecision(5);
  212 + },
  213 +
  214 + createPlotImage: function (resultFolder, plotFile) {
  215 + var me = this;
  216 + var size = this.getImageSize();
  217 + this.panelImage = Ext.create('amdaPlotComp.PlotResultImage', {
  218 + src: this.getImageUrl(resultFolder, plotFile),
  219 + width: size.width,
  220 + height: size.height,
  221 + onMouseMove: function (x, y) {
223 222 if (!me.crtContext)
224 223 return;
225   -
  224 +
226 225 var sourceXPos = me.toPixelOnSourceImage(x);
227 226 var sourceYPos = me.toPixelOnSourceImage(y);
228 227 var panel = amdaPlotComp.PlotContextManager.getPanel(me.crtContext, sourceXPos, sourceYPos);
229 228 var text = '';
230   - if (me.panelImage)
231   - {
232   - if (!panel)
233   - {
  229 + if (me.panelImage) {
  230 + if (!panel) {
234 231 me.panelImage.resetCursor();
235 232 text += 'No panel';
236 233 }
237   - else
238   - {
  234 + else {
239 235 text += 'Panel Id : ';
240 236 text += panel.id;
241   - if (amdaPlotComp.PlotContextManager.isInPlotArea(panel, sourceXPos, sourceYPos))
242   - {
  237 + if (amdaPlotComp.PlotContextManager.isInPlotArea(panel, sourceXPos, sourceYPos)) {
243 238 /*me.panelImage.updateCursor(
244 239 me.toPixelOnResultImage(panel.plotArea.x),
245 240 me.toPixelOnResultImage(panel.plotArea.y),
... ... @@ -247,45 +242,44 @@ Ext.define('amdaUI.PlotTabResultUI', {
247 242 me.toPixelOnResultImage(panel.plotArea.height),
248 243 x, y);*/
249 244 me.panelImage.updateCursor(
250   - me.toPixelOnResultImage(0),
251   - me.toPixelOnResultImage(0),
252   - me.toPixelOnResultImage(me.crtContext.page.width),
253   - me.toPixelOnResultImage(me.crtContext.page.height),
254   - x, y);
255   -
  245 + me.toPixelOnResultImage(0),
  246 + me.toPixelOnResultImage(0),
  247 + me.toPixelOnResultImage(me.crtContext.page.width),
  248 + me.toPixelOnResultImage(me.crtContext.page.height),
  249 + x, y);
  250 +
256 251 var xText = '';
257 252 var yLeftText = '';
258 253 var yRightText = '';
259 254 Ext.each(panel.plotArea.axes, function (axis) {
260   - switch (axis.id)
261   - {
262   - case 'timeAxis':
263   - var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos);
264   - var crtTime = new Date(crtTimestamp*1000);
265   - xText = crtTime.toJSON();
266   - break;
267   - case 'y-left' :
268   - yLeftText = me.getAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos);
269   - break;
270   - case 'y-right' :
271   - yRightText = me.getAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos);
272   - break;
273   - case 'xaxis_id' :
274   - xText = me.getAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos);
275   - break;
276   - case 'epochAxis' :
277   - xText = me.getAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos);
278   - break;
  255 + switch (axis.id) {
  256 + case 'timeAxis':
  257 + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.x, panel.plotArea.x + panel.plotArea.width, sourceXPos);
  258 + var crtTime = new Date(crtTimestamp * 1000);
  259 + xText = crtTime.toJSON();
  260 + break;
  261 + case 'y-left':
  262 + yLeftText = me.getAxisValue(axis, panel.plotArea.y + panel.plotArea.height, panel.plotArea.y, sourceYPos);
  263 + break;
  264 + case 'y-right':
  265 + yRightText = me.getAxisValue(axis, panel.plotArea.y + panel.plotArea.height, panel.plotArea.y, sourceYPos);
  266 + break;
  267 + case 'xaxis_id':
  268 + xText = me.getAxisValue(axis, panel.plotArea.x, panel.plotArea.x + panel.plotArea.width, sourceXPos);
  269 + break;
  270 + case 'epochAxis':
  271 + xText = me.getAxisValue(axis, panel.plotArea.x, panel.plotArea.x + panel.plotArea.width, sourceXPos);
  272 + break;
279 273 }
280   -
  274 +
281 275 });
282   -
  276 +
283 277 if (xText != '')
284   - text += (', X : '+xText);
  278 + text += (', X : ' + xText);
285 279 if (yLeftText != '')
286   - text += (', Y Left : '+yLeftText);
  280 + text += (', Y Left : ' + yLeftText);
287 281 if (yRightText != '')
288   - text += (', Y Right : '+yRightText);
  282 + text += (', Y Right : ' + yRightText);
289 283 }
290 284 else
291 285 me.panelImage.resetCursor();
... ... @@ -293,36 +287,33 @@ Ext.define('amdaUI.PlotTabResultUI', {
293 287 }
294 288 me.coordinatesField.setText(text);
295 289 },
296   - onContextMenu : function(absoluteX, absoluteY, imageX, imageY) {
  290 + onContextMenu: function (absoluteX, absoluteY, imageX, imageY) {
297 291 if (!me.crtContext)
298 292 return;
299   -
  293 +
300 294 me.contextualMenu.removeAll(true);
301   -
  295 +
302 296 var sourceXPos = me.toPixelOnSourceImage(imageX);
303 297 var sourceYPos = me.toPixelOnSourceImage(imageY);
304 298 var panel = amdaPlotComp.PlotContextManager.getPanel(me.crtContext, sourceXPos, sourceYPos);
305   -
306   - if (panel != null)
307   - {
308   - if (panel.plotArea.hasSpectro)
309   - {
  299 +
  300 + if (panel != null) {
  301 + if (panel.plotArea.hasSpectro) {
310 302 me.contextualMenu.add([
311 303 {
312   - text:'Instant cut at this position',
313   - handler : function ()
314   - {
  304 + text: 'Instant cut at this position',
  305 + handler: function () {
315 306 var timeAxisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panel, 'timeAxis');
316 307 if (timeAxisContext == null)
317 308 return;
318   - var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(timeAxisContext, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos);
319   - var crtTime = new Date(crtTimestamp*1000);
  309 + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(timeAxisContext, panel.plotArea.x, panel.plotArea.x + panel.plotArea.width, sourceXPos);
  310 + var crtTime = new Date(crtTimestamp * 1000);
320 311 crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset());
321   - me.callInteractivePlot({'action' : 'instant', 'interactiveId' : this.interactiveId, 'panelId' : panel.id, 'time' : crtTime});
  312 + me.callInteractivePlot({ 'action': 'instant', 'interactiveId': this.interactiveId, 'panelId': panel.id, 'time': crtTime });
322 313 },
323 314 scope: me
324 315 },
325   - '-'
  316 + '-'
326 317 ]);
327 318 }
328 319 if (amdaPlotComp.PlotContextManager.isInPlotArea(panel, sourceXPos, sourceYPos))
... ... @@ -331,13 +322,12 @@ Ext.define('amdaUI.PlotTabResultUI', {
331 322  
332 323 if (me.contextualMenu.items.getCount() > 0)
333 324 me.contextualMenu.add('-');
334   -
  325 +
335 326 me.contextualMenu.add([
336 327 {
337   - text:'Extend/Shift Time interval',
338   - disabled : me.isTTNavBar,
339   - handler : function ()
340   - {
  328 + text: 'Extend/Shift Time interval',
  329 + disabled: me.isTTNavBar,
  330 + handler: function () {
341 331 var extendShiftPlugin = this.getPlugin('plot-extendshift-plugin-id');
342 332 extendShiftPlugin.show(me.interactiveId);
343 333 },
... ... @@ -346,181 +336,173 @@ Ext.define('amdaUI.PlotTabResultUI', {
346 336 '-',
347 337 {
348 338 text: 'Save Plot',
349   - handler : function ()
350   - {
  339 + handler: function () {
351 340 if (me.hiddenForm == null)
352 341 me.hiddenForm = Ext.create('Ext.form.Panel', {
353   - title:'hiddenForm',
  342 + title: 'hiddenForm',
354 343 renderTo: Ext.getBody(),
355 344 standardSubmit: true,
356 345 url: 'php/downloadPlot.php',
357 346 timeout: 120000,
358   - height:100,
  347 + height: 100,
359 348 width: 100,
360   - hidden:true,
361   - items:[]
  349 + hidden: true,
  350 + items: []
362 351 });
363 352  
364 353 me.hiddenForm.getForm().submit({
365 354 params: {
366 355 sessionId: sessionID,
367   - interactiveId : me.interactiveId
  356 + interactiveId: me.interactiveId
368 357 },
369   - success: function(form, action) {},
370   - failure: function(form, action) {}
  358 + success: function (form, action) { },
  359 + failure: function (form, action) { }
371 360 });
372 361 }
373 362 }
374 363 ]);
375   -
  364 +
376 365 me.contextualMenu.showAt(absoluteX, absoluteY);
377 366 }
378 367 });
379 368  
380 369 return this.panelImage;
381 370 },
382   -
383   - updatePlotImage: function(configResult, newPlot) {
  371 +
  372 + updatePlotImage: function (configResult, newPlot) {
384 373 this.crtContext = configResult.context;
385   -
386   -
  374 +
  375 +
387 376 this.crtTTFileIndex = configResult.ttFileIndex;
388   -
389   - if (this.isTTNavBar != (!configResult.isInterval) || (this.isSuperposeMode != this.crtContext.page.superposeMode))
390   - {
  377 +
  378 + if (this.isTTNavBar != (!configResult.isInterval) || (this.isSuperposeMode != this.crtContext.page.superposeMode)) {
391 379 //Update navigation bar
392 380 this.updateNavToolBar(!configResult.isInterval, this.crtContext.page.superposeMode);
393 381 }
394   -
  382 +
395 383 this.updateTimeTableInfo();
396   -
  384 +
397 385 this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile));
398   -
  386 +
399 387 var size = this.getImageSize();
400 388 this.panelImage.setSize(size.width, size.height);
401   -
  389 +
402 390 this.panelImage.refreshMe();
403 391 },
404   -
405   - updateTimeTableInfo: function()
406   - {
  392 +
  393 + updateTimeTableInfo: function () {
407 394 if (!this.navToolBar)
408 395 return;
409   -
410   - var ttNameField = this.navToolBar.items.get('tt-table-'+this.interactiveId);
  396 +
  397 + var ttNameField = this.navToolBar.items.get('tt-table-' + this.interactiveId);
411 398 if (ttNameField)
412 399 ttNameField.setValue(this.crtContext.page.ttName);
413   -
414   - var ttNumberField = this.navToolBar.items.get('tt-number-'+this.interactiveId);
  400 +
  401 + var ttNumberField = this.navToolBar.items.get('tt-number-' + this.interactiveId);
415 402 if (ttNumberField)
416 403 ttNumberField.setValue(this.crtContext.page.ttIndex + 1);
417   -
418   - var ttTotalField = this.navToolBar.items.get('tt-total-'+this.interactiveId);
  404 +
  405 + var ttTotalField = this.navToolBar.items.get('tt-total-' + this.interactiveId);
419 406 if (ttTotalField)
420 407 ttTotalField.setValue(this.crtContext.page.ttNbIntervals);
421 408 },
422   -
423   - callInteractivePlot : function(obj) {
  409 +
  410 + callInteractivePlot: function (obj) {
424 411 loadMask.show(true);
425   -
  412 +
426 413 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
427 414 obj['multiplot'] = this.multiplot;
428   -
  415 +
429 416 AmdaAction.interactivePlot(obj, function (result, e) {
430 417 loadMask.hide();
431 418 var t = e.getTransaction();
432   - if (e.status)
433   - {
434   - if (result)
435   - {
436   - if (result.success)
437   - {
  419 + if (e.status) {
  420 + if (result) {
  421 + if (result.success) {
438 422 plotModule.updateInteractiveSession(result, false);
439 423 }
440 424 else
441   - myDesktopApp.errorMsg('Interactive action error - '+result.message);
  425 + myDesktopApp.errorMsg('Interactive action error - ' + result.message);
442 426 }
443 427 else
444 428 myDesktopApp.errorMsg('Cannot execute interactive action');
445 429 }
446   - else
447   - {
  430 + else {
448 431 // FAILURE
449   - myDesktopApp.errorMsg('Error System - '+e.message);
450   - }
451   - },this);
  432 + myDesktopApp.errorMsg('Error System - ' + e.message);
  433 + }
  434 + }, this);
452 435 },
453   -
454   - updateNavToolBar : function(isTimeTable, isSuperposeMode) {
  436 +
  437 + updateNavToolBar: function (isTimeTable, isSuperposeMode) {
455 438 if (this.navToolBar)
456 439 this.navToolBar.removeAll(true);
457   -
  440 +
458 441 var commonItemsCfg = [
459   - '-',
460   - {
461   - xtype: 'tbspacer',
462   - width: 20
463   - },
464   - '->',
465   - {
466   - text: 'Get HST Data',
467   - scope: this,
468   - menu: [
  442 + '-',
469 443 {
470   - text: 'Giant Planet Auroral Emissions',
  444 + xtype: 'tbspacer',
  445 + width: 20
  446 + },
  447 + '->',
  448 + {
  449 + text: 'Get HST Data',
471 450 scope: this,
472   - handler: function()
473   - {
474   - var me = this;
475   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.astro.id, true, function (module) {
476   - var startTime = new Date(me.crtContext.page.startTime*1000);
477   - startTime = Ext.Date.add(startTime, Ext.Date.MINUTE, startTime.getTimezoneOffset());
478   -
479   - var stopTime = new Date(me.crtContext.page.stopTime*1000);
480   - stopTime = Ext.Date.add(stopTime, Ext.Date.MINUTE, stopTime.getTimezoneOffset());
481   -
482   - module.createWindow(startTime,stopTime);
483   - });
484   - }
485   - }]
486   - }];
487   -
488   - if (isTimeTable){
  451 + menu: [
  452 + {
  453 + text: 'Giant Planet Auroral Emissions',
  454 + scope: this,
  455 + handler: function () {
  456 + var me = this;
  457 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.astro.id, true, function (module) {
  458 + var startTime = new Date(me.crtContext.page.startTime * 1000);
  459 + startTime = Ext.Date.add(startTime, Ext.Date.MINUTE, startTime.getTimezoneOffset());
  460 +
  461 + var stopTime = new Date(me.crtContext.page.stopTime * 1000);
  462 + stopTime = Ext.Date.add(stopTime, Ext.Date.MINUTE, stopTime.getTimezoneOffset());
  463 +
  464 + module.createWindow(startTime, stopTime);
  465 + });
  466 + }
  467 + }]
  468 + }];
  469 +
  470 + if (isTimeTable) {
489 471 var navigationItemsCfg = [{
490 472 text: 'Previous',
491 473 scope: this,
492   - handler: function(){
  474 + handler: function () {
493 475 var ttFileIndex = this.crtTTFileIndex;
494 476 var ttintervalIndex = this.crtContext.page.ttIndex;
495   -
496   - if (ttintervalIndex <= 0 && ttFileIndex>0){
497   - --ttFileIndex;
  477 +
  478 + if (ttintervalIndex <= 0 && ttFileIndex > 0) {
  479 + --ttFileIndex;
498 480 }
499 481 else
500 482 --ttintervalIndex;
501   - this.callInteractivePlot({'action' : 'goto', 'interactiveId' : this.interactiveId, 'ttFileIndex' : ttFileIndex, 'intIndex' : ttintervalIndex});
502   - }
  483 + this.callInteractivePlot({ 'action': 'goto', 'interactiveId': this.interactiveId, 'ttFileIndex': ttFileIndex, 'intIndex': ttintervalIndex });
  484 + }
503 485 },
504   - '-',
  486 + '-',
505 487 {
506 488 text: 'Next',
507 489 scope: this,
508   - handler: function(){
  490 + handler: function () {
509 491 var ttFileIndex = this.crtTTFileIndex;
510 492 var ttintervalIndex = this.crtContext.page.ttIndex;
511   -
512   - if (ttintervalIndex >= this.crtContext.page.ttNbIntervals-1){
513   -
  493 +
  494 + if (ttintervalIndex >= this.crtContext.page.ttNbIntervals - 1) {
  495 +
514 496 ++ttFileIndex;
515 497 ttintervalIndex = 0;
516 498 }
517 499 else
518 500 ++ttintervalIndex;
519 501  
520   - this.callInteractivePlot({'action' : 'goto', 'interactiveId' : this.interactiveId, 'ttFileIndex' : ttFileIndex, 'intIndex' : ttintervalIndex});
  502 + this.callInteractivePlot({ 'action': 'goto', 'interactiveId': this.interactiveId, 'ttFileIndex': ttFileIndex, 'intIndex': ttintervalIndex });
521 503 }
522 504 },
523   - '-',
  505 + '-',
524 506 {
525 507 text: 'Use This Time Inteval',
526 508 scope: this,
... ... @@ -540,102 +522,116 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
540 522 {
541 523 text: 'Go to Interval #',
542 524 scope: this,
543   - handler: function(bt){
544   - var ttGotoNumberField = this.navToolBar.items.get('tt-goto-number-'+this.interactiveId);
  525 + handler: function (bt) {
  526 + var ttGotoNumberField = this.navToolBar.items.get('tt-goto-number-' + this.interactiveId);
545 527 var goToIndex = ttGotoNumberField.getValue() - 1;
546 528 if ((goToIndex < 0) || (goToIndex >= this.crtContext.page.ttNbIntervals))
547 529 myDesktopApp.errorMsg('This interval number is outside of the current timeTable');
548 530 else
549   - this.callInteractivePlot({'action' : 'goto', 'interactiveId' : this.interactiveId, 'ttFileIndex' : this.crtTTFileIndex, 'intIndex' : goToIndex});
  531 + this.callInteractivePlot({ 'action': 'goto', 'interactiveId': this.interactiveId, 'ttFileIndex': this.crtTTFileIndex, 'intIndex': goToIndex });
550 532 }
551 533 },
552 534 {
553 535 xtype: 'numberfield',
554   - id : 'tt-goto-number-'+this.interactiveId,
555   - hideTrigger: true,
556   - width: 50,
  536 + id: 'tt-goto-number-' + this.interactiveId,
  537 + hideTrigger: true,
  538 + width: 50,
557 539 minValue: 1
558 540 },
559   - ' ',
560   - ' ',
561   - ' ',
562   - {
  541 + ' ',
  542 + ' ',
  543 + ' ',
  544 + {
563 545 xtype: 'textfield',
564   - id: 'tt-table-'+this.interactiveId,
  546 + id: 'tt-table-' + this.interactiveId,
565 547 labelAlign: 'right',
566 548 labelWidth: 30,
567 549 fieldLabel: 'Table',
568 550 width: 130,
569   - disabled : true
  551 + disabled: true
570 552 },
571   - {
  553 + {
572 554 xtype: 'textfield',
573   - id: 'tt-number-'+this.interactiveId,
  555 + id: 'tt-number-' + this.interactiveId,
574 556 labelAlign: 'right',
575 557 labelWidth: 30,
576 558 fieldLabel: 'Int #',
577 559 width: 90,
578   - disabled : true
  560 + disabled: true
579 561 },
580   - {
581   - xtype: 'textfield',
582   - id: 'tt-total-'+this.interactiveId,
  562 + {
  563 + xtype: 'textfield',
  564 + id: 'tt-total-' + this.interactiveId,
583 565 labelAlign: 'right',
584 566 labelWidth: 30,
585 567 fieldLabel: 'Total',
586 568 width: 90,
587   - disabled : true
  569 + disabled: true
588 570 }];
589 571 }
590   - else
591   - {
  572 + else {
592 573 var navigationItemsCfg = [
593   - {
594   - text: 'Backward',
595   - scope: this,
596   - handler: function(){
597   - this.callInteractivePlot({'action' : 'backward', 'interactiveId' : this.interactiveId});
598   - }
599   - },
600   - '-',
601   - {
602   - text: '1/2 Backward',
603   - scope: this,
604   - handler: function(){
605   - this.callInteractivePlot({'action' : 'halfbackward', 'interactiveId' : this.interactiveId});
606   - }
607   - },
608   - '-',
609   - {
610   - text: '1/2 Forward',
611   - scope: this,
612   - handler: function(){
613   - this.callInteractivePlot({'action' : 'halfforward', 'interactiveId' : this.interactiveId});
614   - }
615   - },
616   - '-',
617   - {
618   - text: 'Forward',
619   - scope: this,
620   - handler: function(){
621   - this.callInteractivePlot({'action' : 'forward', 'interactiveId' : this.interactiveId});
622   - }
623   - }];
  574 + {
  575 + text: 'Backward',
  576 + scope: this,
  577 + handler: function () {
  578 + this.callInteractivePlot({ 'action': 'backward', 'interactiveId': this.interactiveId });
  579 + }
  580 + },
  581 + '-',
  582 + {
  583 + text: '1/2 Backward',
  584 + scope: this,
  585 + handler: function () {
  586 + this.callInteractivePlot({ 'action': 'halfbackward', 'interactiveId': this.interactiveId });
  587 + }
  588 + },
  589 + '-',
  590 + {
  591 + text: '1/4 Backward',
  592 + scope: this,
  593 + handler: function () {
  594 + this.callInteractivePlot({ 'action': 'quarterbackward', 'interactiveId': this.interactiveId });
  595 + }
  596 + },
  597 + '-',
  598 + {
  599 + text: '1/4 Forward',
  600 + scope: this,
  601 + handler: function () {
  602 + this.callInteractivePlot({ 'action': 'quarterforward', 'interactiveId': this.interactiveId });
  603 + }
  604 + },
  605 + '-',
  606 + {
  607 + text: '1/2 Forward',
  608 + scope: this,
  609 + handler: function () {
  610 + this.callInteractivePlot({ 'action': 'halfforward', 'interactiveId': this.interactiveId });
  611 + }
  612 + },
  613 + '-',
  614 + {
  615 + text: 'Forward',
  616 + scope: this,
  617 + handler: function () {
  618 + this.callInteractivePlot({ 'action': 'forward', 'interactiveId': this.interactiveId });
  619 + }
  620 + }];
624 621 }
625 622  
626 623 var toolItemsCfg = navigationItemsCfg;
627   - Ext.each(commonItemsCfg, function(item){
  624 + Ext.each(commonItemsCfg, function (item) {
628 625 toolItemsCfg.push(item);
629 626 });
630   -
631   - if (!this.navToolBar)
632   - {
  627 +
  628 + if (!this.navToolBar) {
633 629 var toolConfig = {
634 630 dock: 'top',
635   - items: toolItemsCfg
  631 + items: toolItemsCfg
636 632 };
637 633  
638   - this.navToolBar = Ext.create('Ext.toolbar.Toolbar', toolConfig);
  634 + this.navToolBar = Ext.create('Ext.toolbar.Toolbar', toolConfig);
639 635 }
640 636 else
641 637 this.navToolBar.add(toolItemsCfg);
... ... @@ -644,52 +640,51 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
644 640  
645 641 this.isTTNavBar = isTimeTable;
646 642 this.isSuperposeMode = isSuperposeMode;
647   - },
648   -
649   - init: function(configResult){
  643 + },
  644 +
  645 + init: function (configResult) {
650 646 this.crtContext = configResult.context;
651 647 this.interactiveId = configResult.interactiveId;
652 648 this.multiplot = (configResult.multiplot == true);
653 649  
654 650 this.coordinatesField = new Ext.toolbar.TextItem({
655 651 width: 300,
656   - text : ''
  652 + text: ''
657 653 });
658 654  
659 655 this.sliderPage = new Ext.slider.Single({
660   - width: 130,
661   - value: 75,
662   - increment: 5,
663   - minValue: 50,
664   - maxValue: 100,
665   - fieldLabel : 'Resize',
666   - labelWidth : 40,
667   - listeners: {
668   - scope : this,
669   - changecomplete: function(s, v)
670   - {
671   - var zoomPlugin = this.getPlugin('plot-zoom-plugin-id');
672   - zoomPlugin.close();
673   - var size = this.getImageSize();
674   - this.panelImage.width = size.width;
  656 + width: 130,
  657 + value: 75,
  658 + increment: 5,
  659 + minValue: 50,
  660 + maxValue: 100,
  661 + fieldLabel: 'Resize',
  662 + labelWidth: 40,
  663 + listeners: {
  664 + scope: this,
  665 + changecomplete: function (s, v) {
  666 + var zoomPlugin = this.getPlugin('plot-zoom-plugin-id');
  667 + zoomPlugin.close();
  668 + var size = this.getImageSize();
  669 + this.panelImage.width = size.width;
675 670 this.panelImage.height = size.height;
676 671 this.panelImage.doComponentLayout();
677   - this.fireEvent('pagesize',this,v);
678   - }
  672 + this.fireEvent('pagesize', this, v);
679 673 }
680   - });
681   -
  674 + }
  675 + });
  676 +
682 677 var mouseToolbar = {
683 678 xtype: 'toolbar',
684 679 height: 25,
685 680 dock: 'bottom',
686   - items:[
  681 + items: [
687 682 this.coordinatesField,
688 683 '->',
689 684 this.sliderPage
690 685 ]
691 686 };
692   -
  687 +
693 688 this.contextualMenu = Ext.create('Ext.menu.Menu', {
694 689 width: 200,
695 690 plain: true,
... ... @@ -701,22 +696,22 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
701 696 this.updateTimeTableInfo();
702 697  
703 698 var plotResultTabPanelConfig = {
704   - preventHeader : true,
705   - autoScroll: true,
706   - items: [ this.createPlotImage(configResult.folder, configResult.plotFile)],
  699 + preventHeader: true,
  700 + autoScroll: true,
  701 + items: [this.createPlotImage(configResult.folder, configResult.plotFile)],
707 702 dockedItems: [this.navToolBar, mouseToolbar],
708 703 plugins: [
709   - {
710   - ptype: 'plotZoomPlugin',
711   - pluginId : 'plot-zoom-plugin-id'
712   - },
713   - {
714   - ptype: 'plotExtendShiftPlugin',
715   - pluginId : 'plot-extendshift-plugin-id'
716   - }],
  704 + {
  705 + ptype: 'plotZoomPlugin',
  706 + pluginId: 'plot-zoom-plugin-id'
  707 + },
  708 + {
  709 + ptype: 'plotExtendShiftPlugin',
  710 + pluginId: 'plot-extendshift-plugin-id'
  711 + }],
717 712 listeners: {
718   - scope : this,
719   - destroy : function () {
  713 + scope: this,
  714 + destroy: function () {
720 715 var zoomPlugin = this.getPlugin('plot-zoom-plugin-id');
721 716 if (zoomPlugin)
722 717 zoomPlugin.close();
... ... @@ -726,7 +721,7 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
726 721 }
727 722 }
728 723 };
729   -
730   - Ext.apply(this , plotResultTabPanelConfig);
  724 +
  725 + Ext.apply(this, plotResultTabPanelConfig);
731 726 }
732 727 });
... ...