Commit b36dff33c639a1eefaabe695ce81269333cda1b3
Exists in
master
and in
112 other branches
merge with benj plotMerge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM
Showing
27 changed files
with
1518 additions
and
453 deletions
Show diff stats
js/app/controllers/PlotModule.js
... | ... | @@ -71,7 +71,8 @@ Ext.define('amdaDesktop.PlotModule', { |
71 | 71 | var plotTabConfig = { |
72 | 72 | folder : session.folder, |
73 | 73 | plotFile : tabResult.plot, |
74 | - context : tabResult.context | |
74 | + context : tabResult.context, | |
75 | + tabId : tabResult.id | |
75 | 76 | }; |
76 | 77 | |
77 | 78 | if (winResult == null) { |
... | ... | @@ -123,7 +124,7 @@ Ext.define('amdaDesktop.PlotModule', { |
123 | 124 | }); |
124 | 125 | }, |
125 | 126 | |
126 | - updateInteractiveSession : function() { | |
127 | + updateInteractiveSession : function(interactiveResult) { | |
127 | 128 | |
128 | 129 | }, |
129 | 130 | |
... | ... |
js/app/models/DownloadNode.js
... | ... | @@ -0,0 +1,65 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotFillObject.js | |
4 | + * @class amdaPlotObj.PlotFillObject | |
5 | + * @extends Ext.data.Model | |
6 | + * @brief Plot Fill Business Object Definition | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotFillObject.js benjamin $ | |
9 | + ****************************************************************************** | |
10 | + * FT Id : Date : Name - Description | |
11 | + ****************************************************************************** | |
12 | + * : :04/09/2015: BRE - file creation | |
13 | + */ | |
14 | + | |
15 | + | |
16 | +Ext.define('amdaPlotObj.PlotFillObject', { | |
17 | + extend: 'Ext.data.Model', | |
18 | + idProperty: 'id', | |
19 | + | |
20 | + requires: [ | |
21 | + 'amdaPlotObj.PlotObjectConfig' | |
22 | + ], | |
23 | + | |
24 | + fields : [ | |
25 | + {name: 'id', type: 'int'}, | |
26 | + {name: 'fill-type', type: 'string'}, | |
27 | + {name: 'fill-firstserie-id', type: 'int', useNull:true}, | |
28 | + {name: 'fill-secondserie-id', type: 'int', useNull:true}, | |
29 | + {name: 'fill-constant-id', type: 'int', useNull:true}, | |
30 | + {name: 'fill-greater-color', type: 'string'}, | |
31 | + {name: 'fill-less-color', type: 'string'} | |
32 | + ], | |
33 | + | |
34 | + setDefaultValues: function() | |
35 | + { | |
36 | + this.set('fill-type', amdaPlotObj.PlotObjectConfig.defaultValues.fills.type); | |
37 | + this.set('fill-firstserie-id', null); | |
38 | + this.set('fill-secondserie-id', null); | |
39 | + this.set('fill-constant-id', null); | |
40 | + this.set('fill-greater-color', amdaPlotObj.PlotObjectConfig.defaultValues.fills.greaterColor); | |
41 | + this.set('fill-less-color', amdaPlotObj.PlotObjectConfig.defaultValues.fills.lessColor); | |
42 | + }, | |
43 | + | |
44 | + getShortInfo : function() | |
45 | + { | |
46 | + var type = amdaPlotObj.PlotObjectConfig.getValueByKey(amdaPlotObj.PlotObjectConfig.availableFillTypes, this.get('fill-type')); | |
47 | + return type; | |
48 | + }, | |
49 | + | |
50 | + getJsonValues : function() | |
51 | + { | |
52 | + var fillValues = new Object(); | |
53 | + | |
54 | + fillValues['id'] = this.get('id'); | |
55 | + | |
56 | + fillValues['fill-type'] = this.get('fill-type'); | |
57 | + fillValues['fill-firstserie-id'] = this.get('fill-firstserie-id'); | |
58 | + fillValues['fill-secondserie-id'] = this.get('fill-secondserie-id'); | |
59 | + fillValues['fill-constant-id'] = this.get('fill-constant-id'); | |
60 | + fillValues['fill-greater-color'] = this.get('fill-greater-color'); | |
61 | + fillValues['fill-less-color'] = this.get('fill-less-color'); | |
62 | + | |
63 | + return fillValues; | |
64 | + } | |
65 | +}); | |
0 | 66 | \ No newline at end of file |
... | ... |
js/app/models/PlotObjects/PlotObjectConfig.js
... | ... | @@ -22,6 +22,9 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { |
22 | 22 | output : 'INTERACTIVE', |
23 | 23 | oneFilePerInterval: false |
24 | 24 | }, |
25 | + tree : { | |
26 | + simplifiedView : false | |
27 | + }, | |
25 | 28 | page : { |
26 | 29 | xMargin : 15., |
27 | 30 | yMargin : 20., |
... | ... | @@ -166,6 +169,11 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { |
166 | 169 | width : 1, |
167 | 170 | color : '#000000' |
168 | 171 | } |
172 | + }, | |
173 | + fills : { | |
174 | + type : 'serie-constant', | |
175 | + greaterColor : 'none', | |
176 | + lessColor : 'none' | |
169 | 177 | } |
170 | 178 | }, |
171 | 179 | |
... | ... | @@ -374,5 +382,10 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { |
374 | 382 | {'key' : 'left', 'value' : 'Left'}, |
375 | 383 | {'key' : 'center', 'value' : 'Center'}, |
376 | 384 | {'key' : 'right', 'value' : 'Right'} |
377 | - ] | |
385 | + ], | |
386 | + | |
387 | + availableFillTypes : [ | |
388 | + {'key' : 'serie-constant', 'value' : 'Serie / Constant'}, | |
389 | + {'key' : 'serie-serie', 'value' : 'Serie / Serie'} | |
390 | + ] | |
378 | 391 | }); |
379 | 392 | \ No newline at end of file |
... | ... |
js/app/models/PlotObjects/PlotPanelObject.js
... | ... | @@ -25,7 +25,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
25 | 25 | 'amdaPlotObj.PlotLegendTextObject', |
26 | 26 | 'amdaPlotObj.PlotConstantObject', |
27 | 27 | 'amdaPlotObj.PlotTextObject', |
28 | - 'amdaPlotObj.PlotCurveObject' | |
28 | + 'amdaPlotObj.PlotCurveObject', | |
29 | + 'amdaPlotObj.PlotFillObject' | |
29 | 30 | ], |
30 | 31 | |
31 | 32 | fields : [ |
... | ... | @@ -84,7 +85,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
84 | 85 | {name: 'last-textlegend-id', type: 'int', defaultValue:0}, |
85 | 86 | {name: 'last-constant-id', type: 'int', defaultValue:0}, |
86 | 87 | {name: 'last-textobj-id', type: 'int', defaultValue:0}, |
87 | - {name: 'last-curve-id', type: 'int', defaultValue:0} | |
88 | + {name: 'last-curve-id', type: 'int', defaultValue:0}, | |
89 | + {name: 'last-fill-id', type: 'int', defaultValue:0} | |
88 | 90 | ], |
89 | 91 | |
90 | 92 | associations : [ |
... | ... | @@ -119,6 +121,11 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
119 | 121 | name : 'curves' |
120 | 122 | }, |
121 | 123 | { |
124 | + type : 'hasMany', | |
125 | + model : 'amdaPlotObj.PlotFillObject', | |
126 | + name : 'fills' | |
127 | + }, | |
128 | + { | |
122 | 129 | type : 'belongsTo', |
123 | 130 | model : 'amdaPlotObj.PlotTabObject' |
124 | 131 | } |
... | ... | @@ -141,6 +148,8 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
141 | 148 | me.loadTextObjs(arguments[0].textObjs); |
142 | 149 | if (arguments[0].curves) |
143 | 150 | me.loadCurves(arguments[0].curves); |
151 | + if (arguments[0].fills) | |
152 | + me.loadFills(arguments[0].fills); | |
144 | 153 | } |
145 | 154 | else |
146 | 155 | { |
... | ... | @@ -179,6 +188,11 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
179 | 188 | this.curves().loadData(curves); |
180 | 189 | }, |
181 | 190 | |
191 | + loadFills: function(fills) | |
192 | + { | |
193 | + this.fills().loadData(fills); | |
194 | + }, | |
195 | + | |
182 | 196 | initAxes : function() |
183 | 197 | { |
184 | 198 | this.axes().removeAll(); |
... | ... | @@ -327,6 +341,22 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
327 | 341 | return true; |
328 | 342 | }, |
329 | 343 | |
344 | + createNewFill: function() { | |
345 | + this.set('last-fill-id', this.get('last-fill-id') + 1); | |
346 | + var recs = this.fills().add({id : this.get('last-fill-id')}); | |
347 | + recs[0].setDefaultValues(); | |
348 | + return recs[0]; | |
349 | + }, | |
350 | + | |
351 | + removeFillById: function(fillId) { | |
352 | + //Retrieve fill record | |
353 | + var fillRecord = this.fills().getById(fillId); | |
354 | + if (fillRecord == null) | |
355 | + return false; | |
356 | + this.fills().remove(fillRecord); | |
357 | + return true; | |
358 | + }, | |
359 | + | |
330 | 360 | updatePlotType: function(plotType, forceUpdate) { |
331 | 361 | forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false; |
332 | 362 | |
... | ... | @@ -369,6 +399,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
369 | 399 | this.textObjs().removeAll(); |
370 | 400 | this.constants().removeAll(); |
371 | 401 | this.curves().removeAll(); |
402 | + this.fills().removeAll(); | |
372 | 403 | } |
373 | 404 | else if (plotType != 'xyPlot') |
374 | 405 | this.curves().removeAll(); |
... | ... | @@ -518,6 +549,12 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
518 | 549 | panelValues['curves'][index] = curve.getJsonValues(); |
519 | 550 | }); |
520 | 551 | |
552 | + panelValues['fills'] = []; | |
553 | + | |
554 | + this.fills().each(function (fill, index) { | |
555 | + panelValues['fills'][index] = fill.getJsonValues(); | |
556 | + }); | |
557 | + | |
521 | 558 | panelValues['axes'] = []; |
522 | 559 | |
523 | 560 | this.axes().each(function (axe, index) { |
... | ... | @@ -535,6 +572,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', { |
535 | 572 | panelValues['last-constant-id'] = this.get('last-constant-id'); |
536 | 573 | panelValues['last-textobj-id'] = this.get('last-textobj-id'); |
537 | 574 | panelValues['last-curve-id'] = this.get('last-curve-id'); |
575 | + panelValues['last-fill-id'] = this.get('last-fill-id'); | |
538 | 576 | |
539 | 577 | return panelValues; |
540 | 578 | } |
... | ... |
js/app/models/PlotObjects/PlotTabObject.js
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | * Project : AMDA-NG |
3 | 3 | * Name : PlotTabObject.js |
4 | 4 | * @class amdaPlotObj.PlotTabObject |
5 | - * @extends Ext.data.Model | |
5 | + * @extends amdaModel.AmdaTimeObject | |
6 | 6 | * @brief Plot Tab Business Object Definition |
7 | 7 | * @author Benjamin Renard |
8 | 8 | * @version $Id: PlotTabObject.js benjamin $ |
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | |
15 | 15 | |
16 | 16 | Ext.define('amdaPlotObj.PlotTabObject', { |
17 | - extend: 'Ext.data.Model', | |
17 | + extend: 'amdaModel.AmdaTimeObject', | |
18 | 18 | idProperty: 'id', |
19 | 19 | |
20 | 20 | requires: [ |
... | ... | @@ -27,6 +27,8 @@ Ext.define('amdaPlotObj.PlotTabObject', { |
27 | 27 | |
28 | 28 | fields : [ |
29 | 29 | {name: 'id', type: 'int'}, |
30 | + {name: 'tree-simplified-view', type: 'boolean'}, | |
31 | + {name: 'multi-plot-linked', type: 'boolean'}, | |
30 | 32 | {name: 'page-title-text', type: 'string'}, |
31 | 33 | {name: 'page-title-color', type: 'string'}, |
32 | 34 | {name: 'page-title-position', type: 'string'}, |
... | ... | @@ -146,6 +148,10 @@ Ext.define('amdaPlotObj.PlotTabObject', { |
146 | 148 | |
147 | 149 | setDefaultValues: function() |
148 | 150 | { |
151 | + this.set('tree-simplified-view', amdaPlotObj.PlotObjectConfig.defaultValues.tree.simplifiedView); | |
152 | + | |
153 | + this.set('multi-plot-linked', false); | |
154 | + | |
149 | 155 | this.set('page-title-text', ''); |
150 | 156 | this.set('page-title-color', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.color); |
151 | 157 | this.set('page-title-position', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.position); |
... | ... | @@ -196,6 +202,8 @@ Ext.define('amdaPlotObj.PlotTabObject', { |
196 | 202 | var tabValues = new Object(); |
197 | 203 | |
198 | 204 | tabValues['id'] = this.get('id'); |
205 | + tabValues['tree-simplified-view'] = this.get('tree-simplified-view'); | |
206 | + tabValues['multi-plot-linked'] = this.get('multi-plot-linked'); | |
199 | 207 | tabValues['page-title-text'] = this.get('page-title-text'); |
200 | 208 | tabValues['page-title-color'] = this.get('page-title-color'); |
201 | 209 | tabValues['page-title-position'] = this.get('page-title-position'); |
... | ... | @@ -218,6 +226,32 @@ Ext.define('amdaPlotObj.PlotTabObject', { |
218 | 226 | tabValues['page-font-bold'] = this.get('page-font-bold'); |
219 | 227 | tabValues['page-font-italic'] = this.get('page-font-italic'); |
220 | 228 | |
229 | + tabValues['timesrc'] = this.get('timesrc'); | |
230 | + // if there's at least one timeTable name into 'timeTables' collection | |
231 | + if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){ | |
232 | + // get complete timeTables collection | |
233 | + var timeTables = this.get('timeTables'); | |
234 | + // init an empty array for timeTables | |
235 | + tabValues['timeTables'] = []; | |
236 | + // for each interval record | |
237 | + Ext.Array.each(timeTables, function(item, index, all){ | |
238 | + if (!item.$className) { | |
239 | + tabValues['timeTables'][index] = {timeTableName : item.timeTableName, id : item.id}; | |
240 | + } | |
241 | + // get Json simplified value | |
242 | + else { | |
243 | + tabValues['timeTables'][index] = item.getJsonValues(); | |
244 | + } | |
245 | + }); | |
246 | + } else { | |
247 | + tabValues['startDate'] = this.get('startDate'); | |
248 | + tabValues['stopDate'] = this.get('stopDate'); | |
249 | + tabValues['durationDay'] = this.get('durationDay'); | |
250 | + tabValues['durationHour'] = this.get('durationHour'); | |
251 | + tabValues['durationMin'] = this.get('durationMin'); | |
252 | + tabValues['durationSec'] = this.get('durationSec'); | |
253 | + } | |
254 | + | |
221 | 255 | tabValues['page-layout-type'] = this.get('page-layout-type'); |
222 | 256 | if (this.get('page-layout-object') != null) |
223 | 257 | tabValues['page-layout-object'] = this.get('page-layout-object').getJsonValues(); |
... | ... |
js/app/models/PlotObjects/PlotTreeNode.js
... | ... | @@ -359,3 +359,32 @@ Ext.define('amdaPlotObj.PlotCurveTreeNode', { |
359 | 359 | |
360 | 360 | removable: true |
361 | 361 | }); |
362 | + | |
363 | +Ext.define('amdaPlotObj.PlotFillsTreeNode', { | |
364 | + extend: 'amdaPlotObj.PlotTreeNode', | |
365 | + | |
366 | + iconCls: 'icon-plot-add-fills', | |
367 | + | |
368 | + text: 'Fills', | |
369 | + | |
370 | + type: 'fills' | |
371 | +}); | |
372 | + | |
373 | +Ext.define('amdaPlotObj.PlotFillTreeNode', { | |
374 | + extend: 'amdaPlotObj.PlotTreeNode', | |
375 | + | |
376 | + leaf: true, | |
377 | + | |
378 | + iconCls: 'icon-plot-add-fill', | |
379 | + | |
380 | + text: 'Fill', | |
381 | + | |
382 | + type: 'fill', | |
383 | + | |
384 | + removable: true, | |
385 | + | |
386 | + getAdditionalText: function() | |
387 | + { | |
388 | + return ' ('+this.object.getShortInfo()+')'; | |
389 | + } | |
390 | +}); | |
... | ... |
js/app/views/InteractiveIntervalPlugin.js deleted
... | ... | @@ -1,370 +0,0 @@ |
1 | -/** | |
2 | - * Project : AMDA-NG | |
3 | - * Name : InteractiveIntervalPlug.js | |
4 | - * @plugin amdaUI.InteractiveIntervalPlug | |
5 | - * @extends Ext.util.Observable | |
6 | - * @ptype interactiveIntervalPlugin | |
7 | - * @brief Plot interactive session UI (View) | |
8 | - * @author Myriam | |
9 | - * @version $Id: InteractiveIntervalPlugin.js 2617 2014-10-24 12:06:57Z elena $ | |
10 | - ******************************************************************************** | |
11 | - * FT Id : Date : Name - Description | |
12 | - ******************************************************************************* | |
13 | - * : | |
14 | - */ | |
15 | - | |
16 | - | |
17 | -Ext.define('amdaUI.InteractiveIntervalPlugin', { | |
18 | - extend: 'Ext.util.Observable',//'Ext.AbstractPlugin', | |
19 | - alias: 'plugin.interactiveIntervalPlugin', | |
20 | - | |
21 | - linkedNode : null, | |
22 | - | |
23 | - moduleId : 'timetab-win', | |
24 | - | |
25 | - rootNode : null, | |
26 | - win : null, | |
27 | - | |
28 | - addInterval : false, | |
29 | - | |
30 | - constructor: function(config) { | |
31 | - Ext.apply(this, config); | |
32 | - this.callParent(arguments); | |
33 | - }, | |
34 | - | |
35 | - | |
36 | - init: function(cmp) { | |
37 | - this.hostCmp = cmp; | |
38 | - this.hostCmp.on({ | |
39 | - open: this.onOpen, | |
40 | - startTime: this.setStart, | |
41 | - stopTime: this.setStop, | |
42 | - scope: this | |
43 | - }); | |
44 | - | |
45 | -//Global event | |
46 | - myDesktopApp.EventManager.on({ | |
47 | - refresh : this.insertInterval, | |
48 | - scope: this}); | |
49 | - }, | |
50 | - | |
51 | - onDestroy : function() { | |
52 | - this.win = null; | |
53 | - }, | |
54 | - | |
55 | - setStart: function(a){ | |
56 | - if (this.form) | |
57 | - this.form.getForm().findField('start').setValue(a); | |
58 | - }, | |
59 | - | |
60 | - setStop: function(b){ | |
61 | - var a = new Date(this.form.getForm().findField('start').getValue()); | |
62 | - if (a <= b) { | |
63 | - this.form.getForm().findField('stop').setValue(b); | |
64 | - } else { | |
65 | - this.form.getForm().findField('start').setValue(b); | |
66 | - this.form.getForm().findField('stop').setValue(a); | |
67 | - } | |
68 | - }, | |
69 | - | |
70 | -/** | |
71 | - * add Interval to Time table | |
72 | - **/ | |
73 | - insertInterval: function() { | |
74 | - | |
75 | - if (this.addInterval) { | |
76 | - var targetModule = myDesktopApp.getLoadedModule(this.moduleId); | |
77 | - if (targetModule) | |
78 | - { | |
79 | - var targetModuleUI = targetModule.getUiContent(); | |
80 | - if (targetModuleUI) | |
81 | - targetModuleUI.addInterval(this.start,this.stop); | |
82 | - } | |
83 | - } | |
84 | - this.addInterval = false; | |
85 | - }, | |
86 | - | |
87 | -/** | |
88 | - * creation of the window | |
89 | - */ | |
90 | - onOpen: function() { | |
91 | - if (!this.win) { | |
92 | - this.win = new Ext.Window({ | |
93 | - id: 'interactiveInter-win-' + this.hostCmp.ownerCt.ownerCt.getId(), // Plot window ID | |
94 | - width: 380, | |
95 | - height: 160, | |
96 | - x: 0, y: 0, | |
97 | - baseCls:'x-panel', | |
98 | - title: 'Interactive Interval', | |
99 | - layout: 'fit', | |
100 | - constrain: true, | |
101 | - collapsible: true, | |
102 | - ghost: false, | |
103 | - renderTo: this.hostCmp.ownerCt.getId(), | |
104 | - items: this.getFormConfig(), | |
105 | - listeners: { | |
106 | - scope: this, | |
107 | - beforeclose: function() { | |
108 | - this.hostCmp.ownerCt.destroyMire(); | |
109 | - Ext.PluginManager.unregister(this); | |
110 | - } | |
111 | - }, | |
112 | - getConstrainVector: function(constrainTo){ | |
113 | - var me = this; | |
114 | - if (me.constrain || me.constrainHeader) { | |
115 | - constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent(); | |
116 | - return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo); | |
117 | - } | |
118 | - } | |
119 | - }); | |
120 | - | |
121 | - this.win.on('destroy', this.onDestroy, this); | |
122 | - | |
123 | - this.id = 'interactiveInter-' + this.hostCmp.ownerCt.ownerCt.getId(); | |
124 | - | |
125 | - Ext.PluginManager.register(this); | |
126 | - this.win.show(); | |
127 | - this.win.setPosition(0,0); | |
128 | - var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | |
129 | - this.rootNode = tree.getRootNode().findChild('id','timeTable-treeRootNode',true); | |
130 | - | |
131 | - amdaModel.InteractiveNode.preloadNodes(this.rootNode, | |
132 | - function() | |
133 | - { | |
134 | - }); | |
135 | - } | |
136 | - }, | |
137 | - | |
138 | -/** | |
139 | - * check if multi or individual operation | |
140 | - */ | |
141 | - isMultiZoom: function() { | |
142 | - | |
143 | - var win = myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.interactive_plot.id); | |
144 | - if (!win) return false; | |
145 | - | |
146 | - var multiPlotUI = win.items.getAt(0); | |
147 | - var checked = multiPlotUI.checkBoxGroup.getChecked(); | |
148 | - | |
149 | - if (checked.length == 0) return false; | |
150 | - // check if this Plot is not checked then this is individual zoom | |
151 | - var hostId = this.hostCmp.ownerCt.ownerCt.getId(); | |
152 | - | |
153 | - var isUnique = Ext.Array.every(checked, function(item){ | |
154 | - if (item.name === hostId) | |
155 | - return false; | |
156 | - }); | |
157 | - | |
158 | - return !isUnique; | |
159 | - }, | |
160 | - | |
161 | - resetStartStop: function() { | |
162 | - this.form.getForm().findField('start').setValue(''); | |
163 | - this.form.getForm().findField('stop').setValue(''); | |
164 | - this.hostCmp.ownerCt.resetMire(); | |
165 | - }, | |
166 | - | |
167 | - | |
168 | -/** | |
169 | - * Main form | |
170 | - */ | |
171 | - getFormConfig: function(){ | |
172 | - this.form = new Ext.form.FormPanel( { | |
173 | - frame: true, | |
174 | - width: 380, | |
175 | - height: 160, | |
176 | - layout: 'hbox', | |
177 | - fieldDefaults: { | |
178 | - labelWidth: 100 | |
179 | - }, | |
180 | - items: [ | |
181 | - { | |
182 | - xtype: 'container', | |
183 | - width : 250, | |
184 | - layout : 'vbox', | |
185 | - defaults: { height : 25, width: 250 }, | |
186 | - items: [ | |
187 | - { | |
188 | - xtype:'datefield', name:'start', fieldLabel: 'Start Time', | |
189 | - format : 'Y-m-d\\TH:i:s' | |
190 | - }, | |
191 | - { | |
192 | - xtype:'datefield', name:'stop', fieldLabel: 'Stop Time', | |
193 | - format : 'Y-m-d\\TH:i:s' | |
194 | - }, | |
195 | - { | |
196 | - xtype: 'textfield', | |
197 | - fieldLabel: 'Add in TimeTable', | |
198 | - name: 'timeTableName', | |
199 | - listeners : | |
200 | - { | |
201 | - render : function(o,op) | |
202 | - { | |
203 | - var me = this; | |
204 | - var el = me.el; | |
205 | - var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
206 | - ddGroup: 'explorerTree', | |
207 | - notifyOver : function(ddSource, e, data) | |
208 | - { | |
209 | - if ((data.records[0].data.nodeType == 'timeTable') && (data.records[0].data.leaf)) | |
210 | - { | |
211 | - this.valid = true; | |
212 | - return this.dropAllowed; | |
213 | - } | |
214 | - this.valid = false; | |
215 | - return this.dropNotAllowed; | |
216 | - }, | |
217 | - notifyDrop : function(ddSource, e, data) | |
218 | - { | |
219 | - if (!this.valid) | |
220 | - return false; | |
221 | - me.setValue(data.records[0].get('text')); | |
222 | - return true; | |
223 | - } | |
224 | - }); | |
225 | - } | |
226 | - } | |
227 | - } | |
228 | - ] | |
229 | - }, | |
230 | - { | |
231 | - xtype: 'container', | |
232 | - width : 130, | |
233 | - margin: '0 0 0 15', | |
234 | - layout : 'vbox', | |
235 | - defaults: {height : 25, width: 100}, | |
236 | - items: [ | |
237 | - { | |
238 | - xtype: 'button', | |
239 | - text: 'Reset Start/Stop', | |
240 | - scope: this, | |
241 | - handler: function() { | |
242 | - this.resetStartStop(); | |
243 | - } | |
244 | - }, | |
245 | - { xtype: 'component', height: 34 }, | |
246 | - { | |
247 | - xtype: 'button', | |
248 | - text: 'Insert Interval', | |
249 | - scope: this, | |
250 | - handler: function(){ | |
251 | - // linkedNode.isValidName(value); | |
252 | - this.start = this.form.getForm().findField('start').getValue(); | |
253 | - this.stop = this.form.getForm().findField('stop').getValue(); | |
254 | - // new TimeTable or typed manually | |
255 | - var targetModule = myDesktopApp.getLoadedModule(this.moduleId); | |
256 | - var targetModuleUI = null; | |
257 | - if (targetModule) | |
258 | - targetModuleUI = targetModule.getUiContent(); | |
259 | - var TTname = this.form.getForm().findField('timeTableName').getValue(); | |
260 | -// TT window was closed or TTname was changed | |
261 | - if (!targetModuleUI || !this.linkedNode || TTname !== this.linkedNode.get('text')) { | |
262 | - var nodeWithSameName = this.rootNode.findChild('text', TTname, true); | |
263 | - if (nodeWithSameName !== null) { | |
264 | - this.linkedNode = nodeWithSameName; | |
265 | - this.linkedNode.editLeaf(); | |
266 | - this.addInterval = true; | |
267 | - } | |
268 | - else { | |
269 | - obj = Ext.create('amdaModel.TimeTable', {name : TTname, fromPlugin : true}); | |
270 | - this.linkedNode = Ext.create('amdaModel.TimeTableNode', { | |
271 | - leaf : true, | |
272 | - text : TTname, | |
273 | - nodeType : 'timeTable', | |
274 | - object : obj | |
275 | - }); | |
276 | - // this.linkedNode.set('id',''); | |
277 | - this.linkedNode.editLeaf(); | |
278 | - //TODO generic PRELOAD problem to fix | |
279 | - Ext.Function.defer(function(){ | |
280 | - var targetModule = myDesktopApp.getLoadedModule(this.moduleId); | |
281 | - if (targetModule) | |
282 | - { | |
283 | - targetModuleUI = targetModule.getUiContent(); | |
284 | - targetModuleUI.addInterval(this.start,this.stop); | |
285 | - } | |
286 | - this.resetStartStop(); | |
287 | - }, 1000, this); | |
288 | - } | |
289 | - } | |
290 | - else { | |
291 | - targetModuleUI.addInterval(this.start, this.stop); | |
292 | - this.resetStartStop(); | |
293 | - } | |
294 | - } | |
295 | - } | |
296 | - ] | |
297 | - } | |
298 | - ], | |
299 | - fbar : [ | |
300 | - { | |
301 | - text: 'Zoom In Start/Stop', | |
302 | - width: 100, | |
303 | - scope: this, | |
304 | - handler: function(){ | |
305 | - var startZoom = this.form.getForm().findField('start').getValue(); | |
306 | - var stopZoom = this.form.getForm().findField('stop').getValue(); | |
307 | - if(!startZoom || !stopZoom || !this.form.getForm().isValid()) { | |
308 | - myDesktopApp.warningMsg('StartTime or StopTime is incorrect'); | |
309 | - return; | |
310 | - } | |
311 | - | |
312 | - this.hostCmp.ownerCt.resetMire(); | |
313 | - var multiZoom = this.isMultiZoom(); | |
314 | - | |
315 | - if (multiZoom) { | |
316 | - var win = myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.interactive_plot.id); | |
317 | - var multiPlotUI = win.items.getAt(0); | |
318 | - var checked = multiPlotUI.checkBoxGroup.getChecked(); | |
319 | - | |
320 | - Ext.Array.each(checked,function(item, index, all){ | |
321 | - var id = item.name; | |
322 | - var winRes = myDesktopApp.getDesktop().getWindow(id); | |
323 | - | |
324 | - if (winRes) { | |
325 | - var panelResult = winRes.items.items[0]; | |
326 | - panelResult.setObjectIntoNode(); | |
327 | - panelResult.object.fireEvent('execute', true, 'zoom',startZoom,stopZoom); | |
328 | - } | |
329 | - }); | |
330 | - } | |
331 | - else { | |
332 | - this.hostCmp.ownerCt.setObjectIntoNode(); | |
333 | - this.hostCmp.ownerCt.object.fireEvent('execute', false, 'zoom',startZoom,stopZoom); | |
334 | - } | |
335 | - } | |
336 | - }, | |
337 | - { | |
338 | - text: 'Reset Zoom', | |
339 | - width: 100, | |
340 | - scope : this, | |
341 | - handler: function(){ | |
342 | - this.hostCmp.ownerCt.resetMire(); | |
343 | - var multiZoom = this.isMultiZoom(); | |
344 | - | |
345 | - if (multiZoom) { | |
346 | - var win = myDesktopApp.desktop.getWindow(myDesktopApp.dynamicModules.interactive_plot.id); | |
347 | - var multiPlotUI = win.items.getAt(0); | |
348 | - var checked = multiPlotUI.checkBoxGroup.getChecked(); | |
349 | - | |
350 | - Ext.Array.each(checked,function(item, index, all){ | |
351 | - var id = item.name; | |
352 | - var winRes = myDesktopApp.getDesktop().getWindow(id); | |
353 | - if (winRes) { | |
354 | - var panelResult = winRes.items.items[0]; | |
355 | - panelResult.setObjectIntoNode(); | |
356 | - panelResult.object.fireEvent('execute', true, 'resetzoom'); | |
357 | - } | |
358 | - }); | |
359 | - } | |
360 | - else { | |
361 | - this.hostCmp.ownerCt.object.fireEvent('execute', false, 'resetzoom'); | |
362 | - } | |
363 | - } | |
364 | - } | |
365 | - ] | |
366 | - | |
367 | - }); | |
368 | - return this.form; | |
369 | - } | |
370 | -}); | |
371 | 0 | \ No newline at end of file |
... | ... | @@ -0,0 +1,87 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotContextManager.js | |
4 | + * @class amdaPlotComp.PlotContextManager | |
5 | + * @extends | |
6 | + * @brief Manager to retrieve information about a panel by position on the result image | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotContextManager.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotContextManager', { | |
12 | + singleton: true, | |
13 | + | |
14 | + getPanel : function(context, xPos, yPos) | |
15 | + { | |
16 | + if (!context.success) | |
17 | + return null; | |
18 | + | |
19 | + if (xPos < 0 || xPos > context.page.width) | |
20 | + return null; | |
21 | + | |
22 | + if (yPos < 0 || yPos > context.page.height) | |
23 | + return null; | |
24 | + | |
25 | + var resPanel = null; | |
26 | + Ext.each(context.page.panels, function(panel) { | |
27 | + if ((xPos >= panel.x) && (xPos <= (panel.x+panel.width)) && (yPos >= panel.y) && (yPos <= (panel.y+panel.height))) | |
28 | + { | |
29 | + resPanel = panel; | |
30 | + return; | |
31 | + } | |
32 | + }); | |
33 | + | |
34 | + return resPanel; | |
35 | + }, | |
36 | + | |
37 | + getPanelById : function(context, panelId) | |
38 | + { | |
39 | + if (!context.success) | |
40 | + return null; | |
41 | + | |
42 | + var resPanel = null; | |
43 | + Ext.each(context.page.panels, function(panel) { | |
44 | + if (panel.id == panelId) | |
45 | + { | |
46 | + resPanel = panel; | |
47 | + return; | |
48 | + } | |
49 | + }); | |
50 | + | |
51 | + return resPanel; | |
52 | + }, | |
53 | + | |
54 | + getPanelAxisById : function(panelContext, axisId) | |
55 | + { | |
56 | + if (!panelContext || !panelContext.plotArea) | |
57 | + return null; | |
58 | + | |
59 | + var resAxis = null; | |
60 | + Ext.each(panelContext.plotArea.axes, function(axis) { | |
61 | + if (axis.id == axisId) | |
62 | + { | |
63 | + resAxis = axis; | |
64 | + return; | |
65 | + } | |
66 | + }); | |
67 | + | |
68 | + return resAxis; | |
69 | + }, | |
70 | + | |
71 | + isInPlotArea : function(panelContext, xPos, yPos) | |
72 | + { | |
73 | + if (!panelContext.plotArea) | |
74 | + return false; | |
75 | + | |
76 | + return ((xPos >= panelContext.plotArea.x) && (xPos <= (panelContext.plotArea.x+panelContext.plotArea.width)) && | |
77 | + (yPos >= panelContext.plotArea.y) && (yPos <= (panelContext.plotArea.y+panelContext.plotArea.height))); | |
78 | + }, | |
79 | + | |
80 | + toAxisValue : function(axisContext, pixelMin, pixelMax, pixelValue) | |
81 | + { | |
82 | + if (pixelMax == pixelMin) | |
83 | + return NaN; | |
84 | + | |
85 | + return axisContext.min + (pixelValue - pixelMin)/(pixelMax - pixelMin)*(axisContext.max-axisContext.min); | |
86 | + } | |
87 | +}); | |
0 | 88 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotCurveForm.js
... | ... | @@ -109,8 +109,6 @@ Ext.define('amdaPlotComp.PlotCurveForm', { |
109 | 109 | attachedSerieField.getStore().add({key : paramObject.get('id'), value : paramObject.getShortInfo(panelObject.get('panel-plot-type'))}); |
110 | 110 | } |
111 | 111 | }); |
112 | - | |
113 | - console.log(attachedSerieField.getStore()); | |
114 | 112 | }, |
115 | 113 | |
116 | 114 | getFormItems: function() { |
... | ... |
js/app/views/PlotComponents/PlotElementPanel.js
... | ... | @@ -26,7 +26,9 @@ Ext.define('amdaPlotComp.PlotElementPanel', { |
26 | 26 | 'amdaPlotComp.PlotDrawingObjectForm', |
27 | 27 | 'amdaPlotComp.PlotConstantForm', |
28 | 28 | 'amdaPlotComp.PlotTextForm', |
29 | - 'amdaPlotComp.PlotCurveForm' | |
29 | + 'amdaPlotComp.PlotCurveForm', | |
30 | + 'amdaPlotComp.PlotFillsForm', | |
31 | + 'amdaPlotComp.PlotFillForm' | |
30 | 32 | ], |
31 | 33 | |
32 | 34 | elementFormsManager : new Ext.AbstractManager(), |
... | ... | @@ -182,6 +184,20 @@ Ext.define('amdaPlotComp.PlotElementPanel', { |
182 | 184 | me.getEl().unmask(); |
183 | 185 | }); |
184 | 186 | break; |
187 | + case 'fills' : | |
188 | + this.elementFormsManager.register(new amdaPlotComp.PlotFillsForm({id : formId})); | |
189 | + if (onFormReady != null) | |
190 | + onFormReady(this.elementFormsManager.get(formId)); | |
191 | + if (this.rendered) | |
192 | + this.getEl().unmask(); | |
193 | + break; | |
194 | + case 'fill' : | |
195 | + this.elementFormsManager.register(new amdaPlotComp.PlotFillForm({id : formId})); | |
196 | + if (onFormReady != null) | |
197 | + onFormReady(this.elementFormsManager.get(formId)); | |
198 | + if (this.rendered) | |
199 | + this.getEl().unmask(); | |
200 | + break; | |
185 | 201 | case '' : |
186 | 202 | this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'})); |
187 | 203 | if (onFormReady != null) |
... | ... |
... | ... | @@ -0,0 +1,90 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotFillForm.js | |
4 | + * @class amdaPlotComp.PlotFillForm | |
5 | + * @extends amdaPlotComp.PlotStandardForm | |
6 | + * @brief Form to define specifics fill options | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotFillForm.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotFillForm', { | |
12 | + extend: 'amdaPlotComp.PlotStandardForm', | |
13 | + | |
14 | + requires: [ | |
15 | + 'amdaPlotObj.PlotCurveDef' | |
16 | + ], | |
17 | + | |
18 | + setObject : function(object) { | |
19 | + this.object = object; | |
20 | + if (this.object != null) | |
21 | + { | |
22 | + this.updateSerieIdLists(); | |
23 | + this.updateConstantIdList(); | |
24 | + this.loadRecord(this.object); | |
25 | + } | |
26 | + }, | |
27 | + | |
28 | + updateOptions : function() { | |
29 | + var typeField = this.getForm().findField('fill-type'); | |
30 | + var secondSerieField = this.getForm().findField('fill-secondserie-id'); | |
31 | + var constantField = this.getForm().findField('fill-constant-id'); | |
32 | + | |
33 | + var isSerieSerie = (typeField.getValue() == 'serie-serie'); | |
34 | + | |
35 | + secondSerieField.setVisible(isSerieSerie); | |
36 | + constantField.setVisible(!isSerieSerie); | |
37 | + }, | |
38 | + | |
39 | + updateSerieIdLists: function() { | |
40 | + var firstSerieField = this.getForm().findField('fill-firstserie-id'); | |
41 | + var secondSerieField = this.getForm().findField('fill-secondserie-id'); | |
42 | + | |
43 | + firstSerieField.getStore().removeAll(); | |
44 | + secondSerieField.getStore().removeAll(); | |
45 | + | |
46 | + var panelObject = this.crtTree.getSelectedPanelObject(); | |
47 | + if (panelObject == null) | |
48 | + return; | |
49 | + | |
50 | + panelObject.params().each(function(paramObject) { | |
51 | + var drawingType = paramObject.get('param-drawing-type'); | |
52 | + if ((drawingType == 'serie') || (drawingType == 'orbit-serie')) | |
53 | + { | |
54 | + firstSerieField.getStore().add({key : paramObject.get('id'), value : paramObject.getShortInfo(panelObject.get('panel-plot-type'))}); | |
55 | + secondSerieField.getStore().add({key : paramObject.get('id'), value : paramObject.getShortInfo(panelObject.get('panel-plot-type'))}); | |
56 | + } | |
57 | + }); | |
58 | + }, | |
59 | + | |
60 | + updateConstantIdList: function() { | |
61 | + var constantField = this.getForm().findField('fill-constant-id'); | |
62 | + | |
63 | + constantField.getStore().removeAll(); | |
64 | + | |
65 | + var panelObject = this.crtTree.getSelectedPanelObject(); | |
66 | + if (panelObject == null) | |
67 | + return; | |
68 | + | |
69 | + panelObject.constants().each(function(constantObject) { | |
70 | + constantField.getStore().add({key : constantObject.get('id'), value : constantObject.getShortInfo()}); | |
71 | + }); | |
72 | + }, | |
73 | + | |
74 | + getFormItems: function() { | |
75 | + var me = this; | |
76 | + | |
77 | + return [ | |
78 | + | |
79 | + this.addStandardCombo('fill-type', 'Fill type', amdaPlotObj.PlotObjectConfig.availableFillTypes, function(name, value, oldValue) { | |
80 | + me.updateOptions(); | |
81 | + me.crtTree.getView().refresh(); | |
82 | + }), | |
83 | + this.addStandardCombo('fill-firstserie-id', 'First serie Id', []), | |
84 | + this.addStandardCombo('fill-secondserie-id', 'Second serie Id', []), | |
85 | + this.addStandardCombo('fill-constant-id', 'Constant Id', []), | |
86 | + this.addStandardColor('fill-greater-color', 'Greater Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors), | |
87 | + this.addStandardColor('fill-less-color', 'Less Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors) | |
88 | + ]; | |
89 | + } | |
90 | +}); | |
0 | 91 | \ No newline at end of file |
... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotFillsForm.js | |
4 | + * @class amdaPlotComp.PlotFillsForm | |
5 | + * @extends amdaPlotComp.PlotStandardForm | |
6 | + * @brief Form to define a list of fill | |
7 | + * @author Benjamin Renard | |
8 | + * @version $Id: PlotFillsForm.js benjamin $ | |
9 | + */ | |
10 | + | |
11 | +Ext.define('amdaPlotComp.PlotFillsForm', { | |
12 | + extend: 'amdaPlotComp.PlotStandardForm', | |
13 | + | |
14 | + setObject : function(object) { | |
15 | + this.object = object; | |
16 | + if (this.object != null) | |
17 | + this.loadRecord(this.object); | |
18 | + }, | |
19 | + | |
20 | + getFormItems: function() { | |
21 | + var me = this; | |
22 | + return [ | |
23 | + { | |
24 | + xtype: 'button', | |
25 | + text: 'Add new fill', | |
26 | + iconCls: 'icon-add', | |
27 | + handler : function() { | |
28 | + var fillObject = me.object.createNewFill(); | |
29 | + me.crtTree.buildPanelAdditionalObjectsNode(me.object, fillObject); | |
30 | + } | |
31 | + } | |
32 | + ]; | |
33 | + } | |
34 | +}); | |
0 | 35 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotPanelForm.js
... | ... | @@ -120,7 +120,7 @@ Ext.define('amdaPlotComp.PlotPanelForm', { |
120 | 120 | if (value != oldValue) |
121 | 121 | { |
122 | 122 | me.object.updatePlotType(value, true); |
123 | - if (!me.crtTree.isSimplifiedView) | |
123 | + if (!me.crtTree.tabObject.get('tree-simplified-view')) | |
124 | 124 | { |
125 | 125 | me.crtTree.buildPanelAxesNode(me.object); |
126 | 126 | me.crtTree.buildPanelAdditionalObjectsNode(me.object); |
... | ... |
... | ... | @@ -0,0 +1,226 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotResultImage.js | |
4 | + * @class amdaUI.PlotResultImage | |
5 | + * @extends Ext.Img | |
6 | + * @brief Plot Image Result definition (View) | |
7 | + * @author | |
8 | + * @version $Id: PlotResultImage.js benjamin $ | |
9 | + ******************************************************************************** | |
10 | + * FT Id : Date : Name - Description | |
11 | + ******************************************************************************* | |
12 | + * | |
13 | + */ | |
14 | + | |
15 | +Ext.define('amdaPlotComp.PlotResultImage', { | |
16 | + extend: 'Ext.Img', | |
17 | + | |
18 | + onMouseMove : null, | |
19 | + onClick : null, | |
20 | + | |
21 | + verticalCursor : null, | |
22 | + horizontalCursor : null, | |
23 | + | |
24 | + firstVerticalMarker : null, | |
25 | + secondVerticalMarker : null, | |
26 | + firstVerticalMarker : null, | |
27 | + secondVerticalMarker : null, | |
28 | + | |
29 | + showVerticalCursor : true, | |
30 | + showHorizontalCursor : true, | |
31 | + | |
32 | + constructor: function(config) { | |
33 | + this.init(config); | |
34 | + this.callParent(arguments); | |
35 | + }, | |
36 | + | |
37 | + refreshMe : function(){ | |
38 | + var el; | |
39 | + if(el = this.el){ | |
40 | + el.dom.src = this.src + '?dc=' + new Date().getTime(); | |
41 | + } | |
42 | + }, | |
43 | + | |
44 | + createNewVerticalDiv : function() { | |
45 | + var verticalDiv = new Ext.Element(document.createElement('div')); | |
46 | + verticalDiv.setStyle('position', 'absolute'); | |
47 | + verticalDiv.setStyle('top', '1px'); | |
48 | + verticalDiv.setStyle('height', '1px'); | |
49 | + verticalDiv.setStyle('borderLeft', '1px none rgb(0, 0, 0)'); | |
50 | + verticalDiv.setStyle('pointer-events', 'none'); | |
51 | + this.el.parent().appendChild(verticalDiv); | |
52 | + return verticalDiv; | |
53 | + }, | |
54 | + | |
55 | + createNewHorizontalDiv : function() { | |
56 | + var horizontalDiv = new Ext.Element(document.createElement('div')); | |
57 | + horizontalDiv.setStyle('position', 'absolute'); | |
58 | + horizontalDiv.setStyle('left', '1px'); | |
59 | + horizontalDiv.setStyle('width', '1px'); | |
60 | + horizontalDiv.setStyle('borderTop', "1px none rgb(0, 0, 0)"); | |
61 | + horizontalDiv.setStyle('pointer-events', 'none'); | |
62 | + this.el.parent().appendChild(horizontalDiv); | |
63 | + return horizontalDiv; | |
64 | + }, | |
65 | + | |
66 | + resetCursor : function() { | |
67 | + if (this.horizontalCursor) | |
68 | + this.horizontalCursor.setStyle('borderTopStyle', 'none'); | |
69 | + if (this.verticalCursor) | |
70 | + this.verticalCursor.setStyle('borderLeftStyle', 'none'); | |
71 | + }, | |
72 | + | |
73 | + updateCursor : function(containerX, containerY, containerWidth, containerHeight, xPos, yPos) { | |
74 | + if (this.horizontalCursor && this.showHorizontalCursor) | |
75 | + { | |
76 | + this.horizontalCursor.setStyle('left',containerX+'px'); | |
77 | + this.horizontalCursor.setStyle('top',yPos+'px'); | |
78 | + this.horizontalCursor.setStyle('width',containerWidth+'px'); | |
79 | + this.horizontalCursor.setStyle('borderTopStyle', 'solid'); | |
80 | + } | |
81 | + if (this.verticalCursor && this.showVerticalCursor) | |
82 | + { | |
83 | + this.verticalCursor.setStyle('left',xPos+'px'); | |
84 | + this.verticalCursor.setStyle('top',containerY+'px'); | |
85 | + this.verticalCursor.setStyle('height',containerHeight+'px'); | |
86 | + this.verticalCursor.setStyle('borderLeftStyle', 'solid'); | |
87 | + } | |
88 | + }, | |
89 | + | |
90 | + resetZoom : function() { | |
91 | + //This function is override during a startZoom call | |
92 | + }, | |
93 | + | |
94 | + stopZoom : function() { | |
95 | + this.showVerticalCursor = true; | |
96 | + this.showHorizontalCursor = true; | |
97 | + this.resetZoom(); | |
98 | + this.onClick = null; | |
99 | + this.resetZoom = function() {}; | |
100 | + }, | |
101 | + | |
102 | + startZoom : function(isHorizontal, containerPos, containerSize, onSelectFirst, onSelectSecond) { | |
103 | + this.resetZoom(); | |
104 | + | |
105 | + //this.showVerticalCursor = isHorizontal; | |
106 | + //this.showHorizontalCursor = !isHorizontal; | |
107 | + this.resetCursor(); | |
108 | + | |
109 | + var me = this; | |
110 | + var selectFirst = null; | |
111 | + var selectSecond = null; | |
112 | + | |
113 | + selectSecond = function(x, y) | |
114 | + { | |
115 | + if (isHorizontal) | |
116 | + { | |
117 | + me.secondVerticalMarker.setStyle('left',x+'px'); | |
118 | + me.secondVerticalMarker.setStyle('top',containerPos+'px'); | |
119 | + me.secondVerticalMarker.setStyle('height',containerSize+'px'); | |
120 | + me.secondVerticalMarker.setStyle('borderLeftStyle', 'dotted'); | |
121 | + if (onSelectSecond) | |
122 | + onSelectSecond(x); | |
123 | + } | |
124 | + else | |
125 | + { | |
126 | + me.secondHorizontalMarker.setStyle('left',containerPos+'px'); | |
127 | + me.secondHorizontalMarker.setStyle('top',y+'px'); | |
128 | + me.secondHorizontalMarker.setStyle('width',containerSize+'px'); | |
129 | + me.secondHorizontalMarker.setStyle('borderTopStyle', 'dotted'); | |
130 | + if (onSelectSecond) | |
131 | + onSelectSecond(y); | |
132 | + } | |
133 | + | |
134 | + me.onClick = selectFirst; | |
135 | + }; | |
136 | + | |
137 | + selectFirst = function(x, y) | |
138 | + { | |
139 | + if (isHorizontal) | |
140 | + { | |
141 | + me.secondVerticalMarker.setStyle('borderLeftStyle', 'none'); | |
142 | + me.firstVerticalMarker.setStyle('left',x+'px'); | |
143 | + me.firstVerticalMarker.setStyle('top',containerPos+'px'); | |
144 | + me.firstVerticalMarker.setStyle('height',containerSize+'px'); | |
145 | + me.firstVerticalMarker.setStyle('borderLeftStyle', 'dotted'); | |
146 | + if (onSelectFirst) | |
147 | + onSelectFirst(x); | |
148 | + } | |
149 | + else | |
150 | + { | |
151 | + me.secondHorizontalMarker.setStyle('borderLeftStyle', 'none'); | |
152 | + me.firstHorizontalMarker.setStyle('left',containerPos+'px'); | |
153 | + me.firstHorizontalMarker.setStyle('top',y+'px'); | |
154 | + me.firstHorizontalMarker.setStyle('width',containerSize+'px'); | |
155 | + me.firstHorizontalMarker.setStyle('borderTopStyle', 'dotted'); | |
156 | + if (onSelectFirst) | |
157 | + onSelectFirst(y); | |
158 | + } | |
159 | + | |
160 | + me.onClick = selectSecond; | |
161 | + }; | |
162 | + | |
163 | + this.resetZoom = function() | |
164 | + { | |
165 | + me.firstVerticalMarker.setStyle('borderLeftStyle', 'none'); | |
166 | + me.secondVerticalMarker.setStyle('borderLeftStyle', 'none'); | |
167 | + me.firstHorizontalMarker.setStyle('borderTopStyle', 'none'); | |
168 | + me.secondHorizontalMarker.setStyle('borderTopStyle', 'none'); | |
169 | + | |
170 | + me.resetCursor(); | |
171 | + me.onClick = selectFirst; | |
172 | + }; | |
173 | + | |
174 | + this.onClick = selectFirst; | |
175 | + }, | |
176 | + | |
177 | + init : function(config) { | |
178 | + var me = this; | |
179 | + | |
180 | + var myConf = { | |
181 | + src : config.imageUrl, | |
182 | + width : config.width, | |
183 | + height : config.height, | |
184 | + onMouseMove : config.onMouseMove, | |
185 | + onContextMenu : config.onContextMenu, | |
186 | + listeners : { | |
187 | + render : function(img, eOpts){ | |
188 | + me.refreshMe(); | |
189 | + //Create cursor | |
190 | + me.verticalCursor = me.createNewVerticalDiv(); | |
191 | + me.horizontalCursor = me.createNewHorizontalDiv(); | |
192 | + //Create markers (used for zoom) | |
193 | + me.firstVerticalMarker = me.createNewVerticalDiv(); | |
194 | + me.secondVerticalMarker = me.createNewVerticalDiv(); | |
195 | + me.firstHorizontalMarker = me.createNewHorizontalDiv(); | |
196 | + me.secondHorizontalMarker = me.createNewHorizontalDiv(); | |
197 | + | |
198 | + me.resetCursor(); | |
199 | + }, | |
200 | + el: { | |
201 | + click: function(e, t, eOpts) { | |
202 | + if (me.onClick) | |
203 | + me.onClick(e.getX()-me.getPosition()[0], e.getY()-me.getPosition()[1]); | |
204 | + }, | |
205 | + mousemove: function(e, t, eOpts){ | |
206 | + me.verticalCursor.setStyle('left', (e.getX()-me.getPosition()[0])+"px"); | |
207 | + me.horizontalCursor.setStyle('top', (e.getY()-me.getPosition()[1])+"px"); | |
208 | + if (me.onMouseMove) | |
209 | + me.onMouseMove(e.getX()-me.getPosition()[0], e.getY()-me.getPosition()[1]); | |
210 | + }, | |
211 | + contextmenu : function(event, t, eOpts ) { | |
212 | + event = event || window.event; | |
213 | + if (event.preventDefault) { | |
214 | + event.preventDefault(); | |
215 | + } | |
216 | + if (me.onContextMenu) | |
217 | + me.onContextMenu(event.getX(), event.getY(), event.getX()-me.getPosition()[0], event.getY()-me.getPosition()[1]); | |
218 | + return false; | |
219 | + } | |
220 | + } | |
221 | + } | |
222 | + }; | |
223 | + | |
224 | + Ext.apply (this , Ext.apply (arguments, myConf)); | |
225 | + } | |
226 | +}); | |
0 | 227 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotTabContent.js
... | ... | @@ -21,6 +21,12 @@ Ext.define('amdaPlotComp.PlotTabContent', { |
21 | 21 | //Link to the Plot Element Panel |
22 | 22 | plotElementPanel: null, |
23 | 23 | |
24 | + //linkk to the Plot Tab Panel | |
25 | + plotTabPanel : null, | |
26 | + | |
27 | + //Link to the time selctor | |
28 | + timeSelector : null, | |
29 | + | |
24 | 30 | //Tab Object |
25 | 31 | object: null, |
26 | 32 | |
... | ... | @@ -32,15 +38,31 @@ Ext.define('amdaPlotComp.PlotTabContent', { |
32 | 38 | setTabObject : function(object) { |
33 | 39 | this.object = object; |
34 | 40 | this.treePlot.buildTree(this.object); |
41 | + this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate')); | |
42 | + }, | |
43 | + | |
44 | + updateLinkedToMultiPlotMode : function (isLinkedToMultiPlotMode) { | |
45 | + this.timeSelector.setVisible(!isLinkedToMultiPlotMode); | |
46 | + this.plotTabPanel.updateLinkedToMultiPlotMode(isLinkedToMultiPlotMode); | |
47 | + }, | |
48 | + | |
49 | + updateTimeObject : function() { | |
50 | + var timeSource = this.timeSelector.getActiveTimeSource(); | |
51 | + var tabForm = this.getForm(); | |
52 | + tabForm.updateRecord(this.object); | |
53 | + this.object.set('timesrc', timeSource); | |
54 | + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) | |
55 | + this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); | |
35 | 56 | }, |
36 | 57 | |
37 | 58 | init : function(config) { |
38 | 59 | var me = this; |
39 | 60 | |
40 | 61 | this.plotElementPanel = config.plotElementPanel; |
62 | + this.plotTabPanel = config.plotTabPanel; | |
41 | 63 | |
42 | - //var timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelectorTab' + config.tabObjectId, flex: 2, hidden: true} ); | |
43 | - this.treePlot = new amdaPlotComp.PlotTree({flex: 3, plotElementPanel: this.plotElementPanel}); | |
64 | + this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelectorTab' + config.tabId, flex: 2, hidden: true} ); | |
65 | + this.treePlot = new amdaPlotComp.PlotTree({flex: 3, plotElementPanel: this.plotElementPanel, plotTabContent: this}); | |
44 | 66 | |
45 | 67 | var myConf = { |
46 | 68 | bodyStyle: { background : '#dfe8f6' }, |
... | ... | @@ -53,8 +75,8 @@ Ext.define('amdaPlotComp.PlotTabContent', { |
53 | 75 | align: 'stretch' |
54 | 76 | }, |
55 | 77 | items: [ |
56 | - this.treePlot/*, | |
57 | - timeSelector */ | |
78 | + this.treePlot, | |
79 | + this.timeSelector | |
58 | 80 | ] |
59 | 81 | }; |
60 | 82 | |
... | ... |
js/app/views/PlotComponents/PlotTabPanel.js
... | ... | @@ -17,6 +17,9 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
17 | 17 | |
18 | 18 | //Link to the Plot Element Panel |
19 | 19 | plotElementPanel: null, |
20 | + | |
21 | + //Link to the Plot UI | |
22 | + plotUI : null, | |
20 | 23 | |
21 | 24 | //Request object |
22 | 25 | object: null, |
... | ... | @@ -30,17 +33,19 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
30 | 33 | { |
31 | 34 | this.object = object; |
32 | 35 | this.removeAll(); |
36 | + var isFirstTab = true; | |
33 | 37 | this.object.tabs().each(function (rec) { |
34 | - this.addPlotTab(rec); | |
38 | + this.addPlotTab(rec, isFirstTab); | |
39 | + isFirstTab = false; | |
35 | 40 | }, this); |
36 | 41 | }, |
37 | 42 | |
38 | - addPlotTab: function(tabObject) | |
43 | + addPlotTab: function(tabObject, selectTab) | |
39 | 44 | { |
40 | 45 | var tabNumber = this.getTabBar().items.getCount(); |
41 | - var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel}); | |
46 | + var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel, plotTabPanel : this, tabId : tabObject.get('id')}); | |
42 | 47 | tabContent.setTabObject(tabObject); |
43 | - this.add({ | |
48 | + var tabComp = this.add({ | |
44 | 49 | title: 'Plot '+tabNumber, |
45 | 50 | closable: true, |
46 | 51 | layout: 'fit', |
... | ... | @@ -69,7 +74,10 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
69 | 74 | this.updatePlotTabs(); |
70 | 75 | } |
71 | 76 | } |
72 | - }).show(); | |
77 | + }); | |
78 | + | |
79 | + if (selectTab) | |
80 | + this.setActiveTab(tabComp); | |
73 | 81 | |
74 | 82 | return tabContent; |
75 | 83 | }, |
... | ... | @@ -85,6 +93,17 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
85 | 93 | } |
86 | 94 | }, |
87 | 95 | |
96 | + updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) { | |
97 | + this.plotUI.updateLinkedToMultiPlotMode(isLinkedToMultiPlotMode); | |
98 | + }, | |
99 | + | |
100 | + updateTimeObject : function() { | |
101 | + for (i = 0; i < this.items.getCount(); ++i) | |
102 | + { | |
103 | + this.items.getAt(i).items.getAt(0).updateTimeObject(); | |
104 | + } | |
105 | + }, | |
106 | + | |
88 | 107 | getTreeFromPlotTab: function(plotTab) |
89 | 108 | { |
90 | 109 | return plotTab.child().treePlot; |
... | ... | @@ -94,6 +113,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
94 | 113 | var me = this; |
95 | 114 | |
96 | 115 | this.plotElementPanel = config.plotElementPanel; |
116 | + this.plotUI = config.plotUI; | |
97 | 117 | |
98 | 118 | var myConf = { |
99 | 119 | plain: true, |
... | ... | @@ -108,7 +128,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
108 | 128 | text:'+', |
109 | 129 | closable: false, |
110 | 130 | handler:function(btn,e){ |
111 | - var tabContent = me.addPlotTab(me.object.createNewTab()); | |
131 | + var tabContent = me.addPlotTab(me.object.createNewTab(), true); | |
112 | 132 | } |
113 | 133 | }] |
114 | 134 | }, |
... | ... | @@ -121,6 +141,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
121 | 141 | me.plotElementPanel.resetElement(); |
122 | 142 | else |
123 | 143 | me.plotElementPanel.setElement(selectedNode.type,selectedNode.object, newCardTree); |
144 | + newCardTree.updateLinkedToMultiPlotMode(); | |
124 | 145 | }, |
125 | 146 | scope: me |
126 | 147 | } |
... | ... |
js/app/views/PlotComponents/PlotTree.js
... | ... | @@ -15,11 +15,16 @@ Ext.define('amdaPlotComp.PlotTree', { |
15 | 15 | 'amdaPlotObj.PlotTreeNode' |
16 | 16 | ], |
17 | 17 | |
18 | - // | |
19 | - isSimplifiedView: false, | |
18 | + //Link to the combo box to define the use of the simplified view | |
19 | + simplifiedViewCombo : null, | |
20 | + | |
21 | + //Link to the combo to attach the tab to the multi plot mode | |
20 | 22 | |
21 | 23 | //Link to the Plot Element Panel |
22 | 24 | plotElementPanel: null, |
25 | + | |
26 | + //Link to the Plot Tab Content Panel | |
27 | + plotTabContent : null, | |
23 | 28 | |
24 | 29 | //Tab object |
25 | 30 | tabObject: null, |
... | ... | @@ -32,18 +37,16 @@ Ext.define('amdaPlotComp.PlotTree', { |
32 | 37 | this.callParent(arguments); |
33 | 38 | }, |
34 | 39 | |
35 | - setSimplifiedMode: function(isSimplifiedView) { | |
36 | - this.isSimplifiedView = isSimplifiedView; | |
37 | - this.buildTree(this.tabObject); | |
38 | - }, | |
39 | - | |
40 | 40 | buildTree: function(tabObject) { |
41 | 41 | if (this.store.getRootNode().hasChildNodes()) |
42 | 42 | this.store.getRootNode().removeAll(); |
43 | 43 | |
44 | 44 | this.tabObject = tabObject; |
45 | 45 | |
46 | - if (!this.isSimplifiedView) | |
46 | + this.simplifiedViewCombo.setValue(this.tabObject.get('tree-simplified-view')); | |
47 | + this.linkToMultiPlotCombo.setValue(this.tabObject.get('multi-plot-linked')); | |
48 | + | |
49 | + if (!this.tabObject.get('tree-simplified-view')) | |
47 | 50 | { |
48 | 51 | //Page Node |
49 | 52 | var pageNode = this.store.getRootNode().appendChild(new amdaPlotObj.PlotPageTreeNode({object : tabObject})); |
... | ... | @@ -129,7 +132,7 @@ Ext.define('amdaPlotComp.PlotTree', { |
129 | 132 | //Retrieve corresponding panel node |
130 | 133 | if (panelNode.object == panelObject) |
131 | 134 | { |
132 | - if (!me.isSimplifiedView) | |
135 | + if (!me.tabObject.get('tree-simplified-view')) | |
133 | 136 | { |
134 | 137 | //Retrieve params node |
135 | 138 | paramsNode = panelNode.findChild('type', 'params'); |
... | ... | @@ -194,6 +197,9 @@ Ext.define('amdaPlotComp.PlotTree', { |
194 | 197 | |
195 | 198 | //create drawing objects node |
196 | 199 | this.buildDrawingObjectsNode(panelObject, objectsNode, selectedObject); |
200 | + | |
201 | + //create fills node | |
202 | + this.buildFillsNode(panelObject, objectsNode, selectedObject); | |
197 | 203 | }, |
198 | 204 | |
199 | 205 | buildPanelLegendsNode: function(panelObject, objectsNode, selectedObject) { |
... | ... | @@ -255,9 +261,24 @@ Ext.define('amdaPlotComp.PlotTree', { |
255 | 261 | this.getSelectionModel().select(selectedCurveNode); |
256 | 262 | }, |
257 | 263 | |
264 | + buildFillsNode: function(panelObject, objectsNode, selectedObject) { | |
265 | + var fillsNode = objectsNode.appendChild(new amdaPlotObj.PlotFillsTreeNode({object : panelObject})); | |
266 | + | |
267 | + var selectedFillNode = null; | |
268 | + panelObject.fills().each(function (fillObject) { | |
269 | + var fillNode = fillsNode.appendChild(new amdaPlotObj.PlotFillTreeNode({object : fillObject})); | |
270 | + if (fillObject == selectedObject) | |
271 | + selectedFillNode = fillNode; | |
272 | + }); | |
273 | + | |
274 | + this.getView().refresh(); | |
275 | + if (selectedFillNode) | |
276 | + this.getSelectionModel().select(selectedFillNode); | |
277 | + }, | |
278 | + | |
258 | 279 | addPanelNode: function(panelObject) { |
259 | 280 | var panelNode = this.panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode({object : panelObject})); |
260 | - if (!this.isSimplifiedView) | |
281 | + if (!this.tabObject.get('tree-simplified-view')) | |
261 | 282 | { |
262 | 283 | //Axes node |
263 | 284 | this.buildPanelAxesNode(panelObject); |
... | ... | @@ -361,7 +382,7 @@ Ext.define('amdaPlotComp.PlotTree', { |
361 | 382 | break; |
362 | 383 | case 'param' : |
363 | 384 | var panelObject = null; |
364 | - if (!this.isSimplifiedView) | |
385 | + if (!this.tabObject.get('tree-simplified-view')) | |
365 | 386 | panelObject = record.parentNode.parentNode.object; |
366 | 387 | else |
367 | 388 | panelObject = record.parentNode.object; |
... | ... | @@ -371,14 +392,50 @@ Ext.define('amdaPlotComp.PlotTree', { |
371 | 392 | break; |
372 | 393 | case 'text-legend' : |
373 | 394 | var panelObject = null; |
374 | - if (!this.isSimplifiedView) | |
395 | + if (!this.tabObject.get('tree-simplified-view')) | |
375 | 396 | panelObject = record.parentNode.parentNode.object; |
376 | 397 | else |
377 | 398 | panelObject = record.parentNode.object; |
378 | 399 | if (panelObject.removeTextLegendById(record.object.get('id'))) |
379 | 400 | this.buildPanelAdditionalObjectsNode(panelObject); |
380 | 401 | break; |
381 | - } | |
402 | + case 'constant' : | |
403 | + var panelObject = null; | |
404 | + if (!this.tabObject.get('tree-simplified-view')) | |
405 | + panelObject = record.parentNode.parentNode.object; | |
406 | + else | |
407 | + panelObject = record.parentNode.object; | |
408 | + if (panelObject.removeConstantById(record.object.get('id'))) | |
409 | + this.buildPanelAdditionalObjectsNode(panelObject); | |
410 | + break; | |
411 | + case 'text-obj' : | |
412 | + var panelObject = null; | |
413 | + if (!this.tabObject.get('tree-simplified-view')) | |
414 | + panelObject = record.parentNode.parentNode.object; | |
415 | + else | |
416 | + panelObject = record.parentNode.object; | |
417 | + if (panelObject.removeTextObjectById(record.object.get('id'))) | |
418 | + this.buildPanelAdditionalObjectsNode(panelObject); | |
419 | + break; | |
420 | + case 'curve' : | |
421 | + var panelObject = null; | |
422 | + if (!this.tabObject.get('tree-simplified-view')) | |
423 | + panelObject = record.parentNode.parentNode.object; | |
424 | + else | |
425 | + panelObject = record.parentNode.object; | |
426 | + if (panelObject.removeCurveById(record.object.get('id'))) | |
427 | + this.buildPanelAdditionalObjectsNode(panelObject); | |
428 | + break; | |
429 | + case 'fill' : | |
430 | + var panelObject = null; | |
431 | + if (!this.tabObject.get('tree-simplified-view')) | |
432 | + panelObject = record.parentNode.parentNode.object; | |
433 | + else | |
434 | + panelObject = record.parentNode.object; | |
435 | + if (panelObject.removeFillById(record.object.get('id'))) | |
436 | + this.buildPanelAdditionalObjectsNode(panelObject); | |
437 | + break; | |
438 | + } | |
382 | 439 | } |
383 | 440 | }, |
384 | 441 | |
... | ... | @@ -639,6 +696,10 @@ Ext.define('amdaPlotComp.PlotTree', { |
639 | 696 | } |
640 | 697 | }, |
641 | 698 | |
699 | + updateLinkedToMultiPlotMode : function() { | |
700 | + this.plotTabContent.updateLinkedToMultiPlotMode(this.tabObject.get('multi-plot-linked')); | |
701 | + }, | |
702 | + | |
642 | 703 | init : function(config) { |
643 | 704 | var me = this; |
644 | 705 | |
... | ... | @@ -652,6 +713,35 @@ Ext.define('amdaPlotComp.PlotTree', { |
652 | 713 | |
653 | 714 | this.plotElementPanel = config.plotElementPanel; |
654 | 715 | |
716 | + this.simplifiedViewCombo = Ext.create('Ext.form.field.Checkbox', { | |
717 | + xtype: 'checkbox', | |
718 | + boxLabel: 'Simplified View', | |
719 | + listeners: { | |
720 | + change: function(combo, newValue, oldValue, eOpts) { | |
721 | + if (this.tabObject) | |
722 | + this.tabObject.set('tree-simplified-view', newValue); | |
723 | + if (newValue != oldValue) | |
724 | + this.buildTree(this.tabObject); | |
725 | + }, | |
726 | + scope: this | |
727 | + } | |
728 | + }); | |
729 | + | |
730 | + this.linkToMultiPlotCombo = Ext.create('Ext.form.field.Checkbox', { | |
731 | + xtype: 'checkbox', | |
732 | + boxLabel: 'Link to MultiPlot', | |
733 | + listeners: { | |
734 | + change: function(combo, newValue, oldValue, eOpts) { | |
735 | + if (this.tabObject) | |
736 | + { | |
737 | + this.tabObject.set('multi-plot-linked', newValue); | |
738 | + this.updateLinkedToMultiPlotMode(); | |
739 | + } | |
740 | + }, | |
741 | + scope: this | |
742 | + } | |
743 | + }); | |
744 | + | |
655 | 745 | var myConf = { |
656 | 746 | store: store, |
657 | 747 | rootVisible: false, |
... | ... | @@ -702,16 +792,9 @@ Ext.define('amdaPlotComp.PlotTree', { |
702 | 792 | scope: this |
703 | 793 | }, |
704 | 794 | '->', |
705 | - { | |
706 | - xtype: 'checkbox', | |
707 | - boxLabel: 'Simplified View', | |
708 | - listeners: { | |
709 | - change: function(combo, newValue, oldValue, eOpts) { | |
710 | - this.setSimplifiedMode(newValue); | |
711 | - }, | |
712 | - scope: this | |
713 | - } | |
714 | - } | |
795 | + this.linkToMultiPlotCombo, | |
796 | + ' ', | |
797 | + this.simplifiedViewCombo | |
715 | 798 | ] |
716 | 799 | }; |
717 | 800 | |
... | ... |
... | ... | @@ -0,0 +1,363 @@ |
1 | +/** | |
2 | + * Project : AMDA-NG | |
3 | + * Name : PlotZoomPlug.js | |
4 | + * @plugin amdaPlotComp.PlotZoomPlug | |
5 | + * @extends Ext.util.Observable | |
6 | + * @ptype plotZoomPlugin | |
7 | + * @brief Plot Zoom UI (View) | |
8 | + * @author Benjamin | |
9 | + * @version $Id: PlotZoomPlug.js | |
10 | + ******************************************************************************** | |
11 | + * FT Id : Date : Name - Description | |
12 | + ******************************************************************************* | |
13 | + * : | |
14 | + */ | |
15 | + | |
16 | + | |
17 | +Ext.define('amdaPlotComp.PlotZoomPlug', { | |
18 | + extend: 'Ext.util.Observable', | |
19 | + alias: 'plugin.plotZoomPlugin', | |
20 | + | |
21 | + ttModuleId : 'timetab-win', | |
22 | + | |
23 | + win : null, | |
24 | + form : null, | |
25 | + zoomType : '', | |
26 | + tabId : '', | |
27 | + panelId : -1, | |
28 | + | |
29 | + constructor: function(config) { | |
30 | + Ext.apply(this, config); | |
31 | + this.callParent(arguments); | |
32 | + }, | |
33 | + | |
34 | + onDestroy : function() { | |
35 | + this.win = null; | |
36 | + }, | |
37 | + | |
38 | + init: function(cmp) { | |
39 | + this.hostCmp = cmp; | |
40 | + }, | |
41 | + | |
42 | + setMinValue : function(min) { | |
43 | + if (!this.form) | |
44 | + return; | |
45 | + | |
46 | + if (this.zoomType == 'timeAxis') | |
47 | + this.form.getForm().findField('zoom-min-time').setValue(min); | |
48 | + else | |
49 | + this.form.getForm().findField('zoom-min-float').setValue(min); | |
50 | + }, | |
51 | + | |
52 | + setMaxValue : function(max) { | |
53 | + if (!this.form) | |
54 | + return; | |
55 | + | |
56 | + if (this.zoomType == 'timeAxis') | |
57 | + { | |
58 | + var minValue = this.form.getForm().findField('zoom-min-time').getValue(); | |
59 | + if (minValue <= max) | |
60 | + this.form.getForm().findField('zoom-max-time').setValue(max); | |
61 | + else | |
62 | + { | |
63 | + this.form.getForm().findField('zoom-min-time').setValue(max); | |
64 | + this.form.getForm().findField('zoom-max-time').setValue(minValue); | |
65 | + } | |
66 | + } | |
67 | + else | |
68 | + { | |
69 | + var minValue = this.form.getForm().findField('zoom-min-float').getValue(); | |
70 | + if (minValue <= max) | |
71 | + this.form.getForm().findField('zoom-max-float').setValue(max); | |
72 | + else | |
73 | + { | |
74 | + this.form.getForm().findField('zoom-min-float').setValue(max); | |
75 | + this.form.getForm().findField('zoom-max-float').setValue(minValue); | |
76 | + } | |
77 | + } | |
78 | + }, | |
79 | + | |
80 | +/** | |
81 | + * add Interval to Time table | |
82 | + **/ | |
83 | + insertInterval: function() { | |
84 | + if (this.zoomType != 'timeAxis') | |
85 | + return; | |
86 | + | |
87 | + myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module){ | |
88 | + var targetModuleUI = targetModule.getUiContent(); | |
89 | + //if (targetModuleUI) | |
90 | + // targetModuleUI.addInterval(this.start,this.stop); | |
91 | + }); | |
92 | + }, | |
93 | + | |
94 | +/** | |
95 | + * creation of the window | |
96 | + */ | |
97 | + show : function(tabId, zoomType, panelId) { | |
98 | + if (!this.win) | |
99 | + { | |
100 | + this.win = new Ext.Window({ | |
101 | + id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(), // Plot window ID | |
102 | + width: 250, | |
103 | + height: 250, | |
104 | + x: 0, y: 0, | |
105 | + baseCls:'x-panel', | |
106 | + title: 'Zoom', | |
107 | + layout: 'fit', | |
108 | + constrain: true, | |
109 | + collapsible: true, | |
110 | + resizable: false, | |
111 | + ghost: false, | |
112 | + renderTo: this.hostCmp.ownerCt.body, | |
113 | + items: this.getFormConfig(), | |
114 | + listeners: { | |
115 | + scope: this, | |
116 | + beforeclose: function() { | |
117 | + this.hostCmp.panelImage.stopZoom(); | |
118 | + Ext.PluginManager.unregister(this); | |
119 | + } | |
120 | + }, | |
121 | + getConstrainVector: function(constrainTo){ | |
122 | + var me = this; | |
123 | + if (me.constrain || me.constrainHeader) { | |
124 | + constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent(); | |
125 | + return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo); | |
126 | + } | |
127 | + } | |
128 | + }); | |
129 | + | |
130 | + this.win.on('destroy', this.onDestroy, this); | |
131 | + | |
132 | + Ext.PluginManager.register(this); | |
133 | + } | |
134 | + | |
135 | + this.tabId = tabId; | |
136 | + this.updateWinByType(zoomType, panelId); | |
137 | + this.win.show(); | |
138 | + this.win.setPosition(0,0); | |
139 | + }, | |
140 | + | |
141 | + close : function() { | |
142 | + if (this.win == null) | |
143 | + return; | |
144 | + this.win.close(); | |
145 | + }, | |
146 | + | |
147 | + updateWinByType : function(zoomType, panelId) { | |
148 | + if (this.win == null) | |
149 | + return; | |
150 | + | |
151 | + this.zoomType = zoomType; | |
152 | + this.panelId = panelId; | |
153 | + | |
154 | + switch (zoomType) | |
155 | + { | |
156 | + case 'timeAxis': | |
157 | + this.win.setTitle('Zoom on time axis & Interval selection - Panel Id : '+panelId); | |
158 | + break; | |
159 | + case 'y-left' : | |
160 | + this.win.setTitle('Zoom on Y Left axis - Panel Id : '+panelId); | |
161 | + break; | |
162 | + case 'y-right' : | |
163 | + this.win.setTitle('Zoom on Y Right axis - Panel Id : '+panelId); | |
164 | + break; | |
165 | + case 'xaxis_id' : | |
166 | + this.win.setTitle('Zoom on X axis - Panel Id : '+panelId); | |
167 | + break; | |
168 | + } | |
169 | + | |
170 | + this.form.getForm().findField('zoom-min-time').setVisible(this.zoomType == 'timeAxis'); | |
171 | + this.form.getForm().findField('zoom-max-time').setVisible(this.zoomType == 'timeAxis'); | |
172 | + | |
173 | + this.form.getForm().findField('zoom-min-float').setVisible(this.zoomType != 'timeAxis'); | |
174 | + this.form.getForm().findField('zoom-max-float').setVisible(this.zoomType != 'timeAxis'); | |
175 | + | |
176 | + var ttNameField = this.form.getForm().findField('tt-name'); | |
177 | + if (ttNameField) | |
178 | + ttNameField.findParentByType('fieldset').setVisible(this.zoomType == 'timeAxis'); | |
179 | + | |
180 | + this.win.setHeight((this.zoomType == 'timeAxis') ? 250 : 160); | |
181 | + }, | |
182 | + | |
183 | + resetMinMaxValue: function() { | |
184 | + if (this.zoomType == 'timeAxis') | |
185 | + { | |
186 | + this.form.getForm().findField('zoom-min-time').setValue(''); | |
187 | + this.form.getForm().findField('zoom-max-time').setValue(''); | |
188 | + } | |
189 | + else | |
190 | + { | |
191 | + this.form.getForm().findField('zoom-min-float').setValue(null); | |
192 | + this.form.getForm().findField('zoom-max-float').setValue(null); | |
193 | + } | |
194 | + | |
195 | + this.hostCmp.panelImage.resetZoom(); | |
196 | + }, | |
197 | + | |
198 | +/** | |
199 | + * Main form | |
200 | + */ | |
201 | + getFormConfig: function(){ | |
202 | + | |
203 | + var intervalFieldSet = { | |
204 | + xtype: 'fieldset', | |
205 | + title: 'Interval Selection', | |
206 | + name: 'interval-selection-fieldset', | |
207 | + collapsible: false, | |
208 | + layout: { | |
209 | + type: 'vbox', | |
210 | + pack: 'start', | |
211 | + align: 'stretch' | |
212 | + }, | |
213 | + items : [ | |
214 | + { | |
215 | + xtype:'datefield', name:'zoom-min-time', fieldLabel: 'Start Time', | |
216 | + format : 'Y-m-d\\TH:i:s' | |
217 | + }, | |
218 | + { | |
219 | + xtype:'datefield', name:'zoom-max-time', fieldLabel: 'Stop Time', | |
220 | + format : 'Y-m-d\\TH:i:s' | |
221 | + }, | |
222 | + { | |
223 | + xtype:'numberfield', name:'zoom-min-float', fieldLabel: 'Min Value' | |
224 | + }, | |
225 | + { | |
226 | + xtype:'numberfield', name:'zoom-max-float', fieldLabel: 'Max Value' | |
227 | + }, | |
228 | + { | |
229 | + xtype: 'button', | |
230 | + width: 100, | |
231 | + text: 'Reset interval', | |
232 | + scope: this, | |
233 | + handler: function() { | |
234 | + this.resetMinMaxValue(); | |
235 | + } | |
236 | + } | |
237 | + ] | |
238 | + }; | |
239 | + | |
240 | + var insertTTFieldSet = { | |
241 | + xtype: 'fieldset', | |
242 | + title: 'TimeTable Insertion', | |
243 | + name: 'tt-insertion-fieldset', | |
244 | + collapsible: false, | |
245 | + layout: { | |
246 | + type: 'vbox', | |
247 | + pack: 'start', | |
248 | + align: 'stretch' | |
249 | + }, | |
250 | + items : [ | |
251 | + { | |
252 | + xtype: 'textfield', | |
253 | + fieldLabel: 'TimeTable Name', | |
254 | + name: 'tt-name', | |
255 | + listeners : | |
256 | + { | |
257 | + render : function(o,op) | |
258 | + { | |
259 | + var me = this; | |
260 | + var el = me.el; | |
261 | + var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
262 | + ddGroup: 'explorerTree', | |
263 | + notifyOver : function(ddSource, e, data) | |
264 | + { | |
265 | + if ((data.records[0].data.nodeType == 'timeTable') && (data.records[0].data.leaf)) | |
266 | + { | |
267 | + this.valid = true; | |
268 | + return this.dropAllowed; | |
269 | + } | |
270 | + this.valid = false; | |
271 | + return this.dropNotAllowed; | |
272 | + }, | |
273 | + notifyDrop : function(ddSource, e, data) | |
274 | + { | |
275 | + if (!this.valid) | |
276 | + return false; | |
277 | + me.setValue(data.records[0].get('text')); | |
278 | + return true; | |
279 | + } | |
280 | + }); | |
281 | + } | |
282 | + } | |
283 | + }, | |
284 | + { | |
285 | + xtype: 'button', | |
286 | + width: 100, | |
287 | + text: 'Insert Interval', | |
288 | + scope: this, | |
289 | + handler: function(){ | |
290 | + if (this.zoomType != 'timeAxis') | |
291 | + return; | |
292 | + | |
293 | + this.start = this.form.getForm().findField('zoom-min-time').getValue(); | |
294 | + this.stop = this.form.getForm().findField('zoom-max-time').getValue(); | |
295 | + // new TimeTable or typed manually | |
296 | + var me = this; | |
297 | + var targetModule = myDesktopApp.getLoadedModule(this.ttModuleId, true, function(module) { | |
298 | + var targetModuleUI = module.getUiContent(); | |
299 | + var TTname = me.form.getForm().findField('tt-name').getValue(); | |
300 | + //ToDo | |
301 | + }); | |
302 | + | |
303 | + } | |
304 | + } | |
305 | + ] | |
306 | + }; | |
307 | + | |
308 | + this.form = new Ext.form.FormPanel( { | |
309 | + frame: true, | |
310 | + width: 250, | |
311 | + height: 250, | |
312 | + layout: { | |
313 | + type: 'vbox', | |
314 | + pack: 'start', | |
315 | + align: 'stretch' | |
316 | + }, | |
317 | + fieldDefaults: { | |
318 | + labelWidth: 60 | |
319 | + }, | |
320 | + items: [ | |
321 | + intervalFieldSet, | |
322 | + insertTTFieldSet | |
323 | + ], | |
324 | + fbar : [ | |
325 | + { | |
326 | + text: 'Apply Zoom', | |
327 | + width: 100, | |
328 | + scope: this, | |
329 | + handler: function(){ | |
330 | + if (this.zoomType == 'timeAxis') | |
331 | + { | |
332 | + var minZoom = this.form.getForm().findField('zoom-min-time').getValue(); | |
333 | + var maxZoom = this.form.getForm().findField('zoom-max-time').getValue(); | |
334 | + } | |
335 | + else | |
336 | + { | |
337 | + var minZoom = this.form.getForm().findField('zoom-min-float').getValue(); | |
338 | + var maxZoom = this.form.getForm().findField('zoom-max-float').getValue(); | |
339 | + } | |
340 | + | |
341 | + if(!maxZoom || !minZoom || !this.form.getForm().isValid()) { | |
342 | + myDesktopApp.warningMsg('Error in values definition'); | |
343 | + return; | |
344 | + } | |
345 | + | |
346 | + this.hostCmp.callInteractivePlot({'action' : 'zoom', 'tabId' : this.tabId, 'panelId' : this.panelId, 'axeId' : this.zoomType, 'min' : minZoom, 'max' : maxZoom}); | |
347 | + this.hostCmp.panelImage.resetZoom(); | |
348 | + } | |
349 | + }, | |
350 | + { | |
351 | + text: 'Undo Zoom', | |
352 | + width: 100, | |
353 | + scope : this, | |
354 | + handler: function(){ | |
355 | + this.hostCmp.callInteractivePlot({'action' : 'undozoom', 'tabId' : this.tabId, 'panelId' : this.panelId, 'axeId' : this.zoomType}); | |
356 | + this.hostCmp.panelImage.resetZoom(); | |
357 | + } | |
358 | + } | |
359 | + ] | |
360 | + }); | |
361 | + return this.form; | |
362 | + } | |
363 | +}); | |
0 | 364 | \ No newline at end of file |
... | ... |
js/app/views/PlotTabResultUI.js
... | ... | @@ -18,12 +18,13 @@ Ext.define('amdaUI.PlotTabResultUI', { |
18 | 18 | alias: 'widget.plotTabResult', |
19 | 19 | |
20 | 20 | requires: [ |
21 | - 'amdaUI.InteractiveIntervalPlugin' | |
21 | + 'amdaPlotComp.PlotZoomPlug', | |
22 | + 'amdaPlotComp.PlotContextManager' | |
22 | 23 | ], |
23 | 24 | |
24 | - isPortrait : false, | |
25 | - pageWidth : 0, | |
26 | - pageHeight : 0, | |
25 | + panelImage : null, | |
26 | + crtContext : null, | |
27 | + tabId : '', | |
27 | 28 | |
28 | 29 | constructor: function(config) { |
29 | 30 | this.addEvents({'pagesize':true}); |
... | ... | @@ -33,43 +34,265 @@ Ext.define('amdaUI.PlotTabResultUI', { |
33 | 34 | }, |
34 | 35 | |
35 | 36 | getImageSize : function() { |
36 | - var size = { | |
37 | - width : this.pageWidth * this.sliderPage.getValue()/100., | |
38 | - height : this.pageHeight * this.sliderPage.getValue()/100. | |
37 | + if (!this.crtContext) | |
38 | + return { | |
39 | + width : 0, | |
40 | + height : 0 | |
41 | + }; | |
42 | + | |
43 | + return { | |
44 | + width : this.crtContext.page.width * this.sliderPage.getValue()/100., | |
45 | + height : this.crtContext.page.height * this.sliderPage.getValue()/100. | |
39 | 46 | } |
40 | - return size; | |
41 | 47 | }, |
42 | 48 | |
43 | 49 | getImageUrl: function(resultFolder, plotFile) { |
44 | 50 | return 'data/'+sessionID +'/RES/'+resultFolder+ '/' + plotFile; |
45 | 51 | }, |
46 | 52 | |
47 | - createPlotImage: function(resultFolder, plotFile, context) { | |
53 | + toPixelOnSourceImage : function(value) { | |
54 | + return value*100/this.sliderPage.getValue(); | |
55 | + }, | |
56 | + | |
57 | + toPixelOnResultImage : function(value) { | |
58 | + return value*this.sliderPage.getValue()/100; | |
59 | + }, | |
60 | + | |
61 | + createZoomItemsForPanel: function(panelId) { | |
62 | + var zoomPlugin = this.getPlugin('plot-zoom-plugin-id'); | |
63 | + if (zoomPlugin == null) | |
64 | + return; | |
65 | + | |
66 | + var panelContext = amdaPlotComp.PlotContextManager.getPanelById(this.crtContext, panelId); | |
67 | + | |
68 | + var me = this; | |
69 | + Ext.each(panelContext.plotArea.axes, function (axis) { | |
70 | + //Events for zoom on a time axis | |
71 | + var onMinTimeSelection = function (posX) { | |
72 | + //Panel and axis context must be retrieved by using the crtContext | |
73 | + var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId); | |
74 | + var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id); | |
75 | + var sourceXPos = me.toPixelOnSourceImage(posX); | |
76 | + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x+panelContext.plotArea.width, sourceXPos); | |
77 | + var crtTime = new Date(crtTimestamp*1000); | |
78 | + crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset()); | |
79 | + zoomPlugin.setMinValue(crtTime); | |
80 | + }; | |
81 | + | |
82 | + var onMaxTimeSelection = function (posX) { | |
83 | + //Panel and axis context must be retrieved by using the crtContext | |
84 | + var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId); | |
85 | + var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id); | |
86 | + var sourceXPos = me.toPixelOnSourceImage(posX); | |
87 | + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x+panelContext.plotArea.width, sourceXPos); | |
88 | + var crtTime = new Date(crtTimestamp*1000); | |
89 | + crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset()); | |
90 | + zoomPlugin.setMaxValue(crtTime); | |
91 | + }; | |
92 | + | |
93 | + //Events for zoom on a Y axis | |
94 | + var onMinYValueSelection = function(posY) { | |
95 | + //Panel and axis context must be retrieved by using the crtContext | |
96 | + var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId); | |
97 | + var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id); | |
98 | + var sourceYPos = me.toPixelOnSourceImage(posY); | |
99 | + var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.y+panelContext.plotArea.height, panelContext.plotArea.y, sourceYPos); | |
100 | + zoomPlugin.setMinValue(crtValue); | |
101 | + }; | |
102 | + | |
103 | + var onMaxYValueSelection = function(posY) { | |
104 | + //Panel and axis context must be retrieved by using the crtContext | |
105 | + var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId); | |
106 | + var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id); | |
107 | + var sourceYPos = me.toPixelOnSourceImage(posY); | |
108 | + var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.y+panelContext.plotArea.height, panelContext.plotArea.y, sourceYPos); | |
109 | + zoomPlugin.setMaxValue(crtValue); | |
110 | + }; | |
111 | + | |
112 | + //Events for zoom on X axis | |
113 | + var onMinXValueSelection = function(posX) { | |
114 | + //Panel and axis context must be retrieved by using the crtContext | |
115 | + var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId); | |
116 | + var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id); | |
117 | + var sourceXPos = me.toPixelOnSourceImage(posX); | |
118 | + var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x + panelContext.plotArea.width, sourceXPos); | |
119 | + zoomPlugin.setMinValue(crtValue); | |
120 | + }; | |
121 | + | |
122 | + var onMaxXValueSelection = function(posX) { | |
123 | + //Panel and axis context must be retrieved by using the crtContext | |
124 | + var panelContext = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId); | |
125 | + var axisContext = amdaPlotComp.PlotContextManager.getPanelAxisById(panelContext, axis.id); | |
126 | + var sourceXPos = me.toPixelOnSourceImage(posX); | |
127 | + var crtValue = amdaPlotComp.PlotContextManager.toAxisValue(axisContext, panelContext.plotArea.x, panelContext.plotArea.x + panelContext.plotArea.width, sourceXPos); | |
128 | + zoomPlugin.setMaxValue(crtValue); | |
129 | + }; | |
130 | + | |
131 | + switch (axis.id) | |
132 | + { | |
133 | + case 'timeAxis': | |
134 | + me.contextualMenu.add({ | |
135 | + text:'Zoom on Time Axis', | |
136 | + handler : function(item, e) { | |
137 | + zoomPlugin.show(me.tabId, axis.id, panelContext.id); | |
138 | + zoomPlugin.resetMinMaxValue(); | |
139 | + me.panelImage.startZoom(true, me.toPixelOnResultImage(panelContext.y), me.toPixelOnResultImage(panelContext.height), onMinTimeSelection, onMaxTimeSelection); | |
140 | + }, | |
141 | + scope: this | |
142 | + }); | |
143 | + break; | |
144 | + case 'y-left' : | |
145 | + me.contextualMenu.add({ | |
146 | + text:'Zoom on Y Left Axis', | |
147 | + handler : function(item, e) { | |
148 | + zoomPlugin.show(me.tabId, axis.id, panelContext.id); | |
149 | + zoomPlugin.resetMinMaxValue(); | |
150 | + me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection); | |
151 | + } | |
152 | + }); | |
153 | + break; | |
154 | + case 'y-right' : | |
155 | + me.contextualMenu.add({ | |
156 | + text:'Zoom on Y Right Axis', | |
157 | + handler : function(item, e) { | |
158 | + zoomPlugin.show(me.tabId, axis.id, panelContext.id); | |
159 | + zoomPlugin.resetMinMaxValue(); | |
160 | + me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection); | |
161 | + } | |
162 | + }); | |
163 | + break; | |
164 | + case 'xaxis_id' : | |
165 | + me.contextualMenu.add({ | |
166 | + text:'Zoom on X Axis', | |
167 | + handler : function(item, e) { | |
168 | + zoomPlugin.show(me.tabId, axis.id, panelContext.id); | |
169 | + zoomPlugin.resetMinMaxValue(); | |
170 | + me.panelImage.startZoom(true, me.toPixelOnResultImage(panelContext.y), me.toPixelOnResultImage(panelContext.height), onMinXValueSelection, onMaxXValueSelection); | |
171 | + } | |
172 | + }); | |
173 | + break; | |
174 | + case 'epochAxis' : | |
175 | + //Nothing to add | |
176 | + break; | |
177 | + } | |
178 | + | |
179 | + }); | |
180 | + }, | |
181 | + | |
182 | + createPlotImage: function(resultFolder, plotFile) { | |
183 | + var me = this; | |
48 | 184 | var size = this.getImageSize(); |
49 | - this.panelImage = Ext.create('Ext.Img', { | |
185 | + this.panelImage = Ext.create('amdaPlotComp.PlotResultImage', { | |
50 | 186 | src : this.getImageUrl(resultFolder, plotFile), |
51 | 187 | width : size.width, |
52 | 188 | height : size.height, |
53 | - refreshMe : function(){ | |
54 | - var el; | |
55 | - if(el = this.el){ | |
56 | - el.dom.src = this.src + '?dc=' + new Date().getTime(); | |
57 | - } | |
58 | - }, | |
59 | - listeners : { | |
60 | - render : function(){ | |
61 | - this.refreshMe(); | |
62 | - } | |
63 | - } | |
189 | + onMouseMove : function(x, y) { | |
190 | + if (!me.crtContext) | |
191 | + return; | |
192 | + | |
193 | + var sourceXPos = me.toPixelOnSourceImage(x); | |
194 | + var sourceYPos = me.toPixelOnSourceImage(y); | |
195 | + var panel = amdaPlotComp.PlotContextManager.getPanel(me.crtContext, sourceXPos, sourceYPos); | |
196 | + var text = ''; | |
197 | + if (me.panelImage) | |
198 | + { | |
199 | + if (!panel) | |
200 | + { | |
201 | + me.panelImage.resetCursor(); | |
202 | + text += 'No panel'; | |
203 | + } | |
204 | + else | |
205 | + { | |
206 | + text += 'Panel Id : '; | |
207 | + text += panel.id; | |
208 | + if (amdaPlotComp.PlotContextManager.isInPlotArea(panel, sourceXPos, sourceYPos)) | |
209 | + { | |
210 | + /*me.panelImage.updateCursor( | |
211 | + me.toPixelOnResultImage(panel.plotArea.x), | |
212 | + me.toPixelOnResultImage(panel.plotArea.y), | |
213 | + me.toPixelOnResultImage(panel.plotArea.width), | |
214 | + me.toPixelOnResultImage(panel.plotArea.height), | |
215 | + x, y);*/ | |
216 | + me.panelImage.updateCursor( | |
217 | + me.toPixelOnResultImage(0), | |
218 | + me.toPixelOnResultImage(0), | |
219 | + me.toPixelOnResultImage(me.crtContext.page.width), | |
220 | + me.toPixelOnResultImage(me.crtContext.page.height), | |
221 | + x, y); | |
222 | + | |
223 | + var xText = ''; | |
224 | + var yLeftText = ''; | |
225 | + var yRightText = ''; | |
226 | + Ext.each(panel.plotArea.axes, function (axis) { | |
227 | + switch (axis.id) | |
228 | + { | |
229 | + case 'timeAxis': | |
230 | + var crtTimestamp = amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos); | |
231 | + var crtTime = new Date(crtTimestamp*1000); | |
232 | + xText = crtTime.toJSON(); | |
233 | + break; | |
234 | + case 'y-left' : | |
235 | + yLeftText = parseFloat(amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos).toPrecision(2)); | |
236 | + break; | |
237 | + case 'y-right' : | |
238 | + yRightText = parseFloat(amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.y+panel.plotArea.height, panel.plotArea.y, sourceYPos).toPrecision(2)); | |
239 | + break; | |
240 | + case 'xaxis_id' : | |
241 | + xText = parseFloat(amdaPlotComp.PlotContextManager.toAxisValue(axis, panel.plotArea.x, panel.plotArea.x+panel.plotArea.width, sourceXPos).toPrecision(2)); | |
242 | + break; | |
243 | + case 'epochAxis' : | |
244 | + // | |
245 | + xText = 'ToDo'; | |
246 | + break; | |
247 | + } | |
248 | + | |
249 | + }); | |
250 | + | |
251 | + if (xText != '') | |
252 | + text += (', X : '+xText); | |
253 | + if (yLeftText != '') | |
254 | + text += (', Y Left : '+yLeftText); | |
255 | + if (yRightText != '') | |
256 | + text += (', Y Right : '+yRightText); | |
257 | + } | |
258 | + else | |
259 | + me.panelImage.resetCursor(); | |
260 | + } | |
261 | + } | |
262 | + me.coordinatesField.setText(text); | |
263 | + }, | |
264 | + onContextMenu : function(absoluteX, absoluteY, imageX, imageY) { | |
265 | + if (!me.crtContext) | |
266 | + return; | |
267 | + | |
268 | + me.contextualMenu.removeAll(); | |
269 | + | |
270 | + var sourceXPos = me.toPixelOnSourceImage(imageX); | |
271 | + var sourceYPos = me.toPixelOnSourceImage(imageY); | |
272 | + var panel = amdaPlotComp.PlotContextManager.getPanel(me.crtContext, sourceXPos, sourceYPos); | |
273 | + | |
274 | + if (panel != null) | |
275 | + { | |
276 | + if (amdaPlotComp.PlotContextManager.isInPlotArea(panel, sourceXPos, sourceYPos)) | |
277 | + me.createZoomItemsForPanel(panel.id); | |
278 | + } | |
279 | + | |
280 | + if (me.contextualMenu.items.getCount() > 0) | |
281 | + me.contextualMenu.add('-'); | |
282 | + | |
283 | + me.contextualMenu.add({ | |
284 | + text:'Extend/Shift Time request' | |
285 | + }); | |
286 | + | |
287 | + me.contextualMenu.showAt(absoluteX, absoluteY); | |
288 | + } | |
64 | 289 | }); |
65 | 290 | |
66 | 291 | return this.panelImage; |
67 | 292 | }, |
68 | 293 | |
69 | 294 | updatePlotImage: function(configResult) { |
70 | - this.isPortrait = configResult.context.page.portrait; | |
71 | - this.pageWidth = configResult.context.page.width; | |
72 | - this.pageHeight = configResult.context.page.height; | |
295 | + this.crtContext = configResult.context; | |
73 | 296 | |
74 | 297 | this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile)); |
75 | 298 | |
... | ... | @@ -79,10 +302,43 @@ Ext.define('amdaUI.PlotTabResultUI', { |
79 | 302 | this.panelImage.refreshMe(); |
80 | 303 | }, |
81 | 304 | |
305 | + callInteractivePlot : function(obj) { | |
306 | + loadMask.show(true); | |
307 | + AmdaAction.interactivePlot(obj, function (result, e) { | |
308 | + loadMask.hide(); | |
309 | + var t = e.getTransaction(); | |
310 | + if (e.status) | |
311 | + { | |
312 | + if (result) | |
313 | + { | |
314 | + if (result.success) | |
315 | + { | |
316 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) { | |
317 | + module.startInteractiveSession(result); | |
318 | + }); | |
319 | + } | |
320 | + else | |
321 | + myDesktopApp.errorMsg('Interactive action error - '+result.message); | |
322 | + } | |
323 | + else | |
324 | + myDesktopApp.errorMsg('Cannot execute interactive action'); | |
325 | + } | |
326 | + else | |
327 | + { | |
328 | + // FAILURE | |
329 | + myDesktopApp.errorMsg('Error System - '+e.message); | |
330 | + } | |
331 | + },this); | |
332 | + }, | |
333 | + | |
82 | 334 | init: function(configResult){ |
83 | - this.isPortrait = configResult.context.page.portrait; | |
84 | - this.pageWidth = configResult.context.page.width; | |
85 | - this.pageHeight = configResult.context.page.height; | |
335 | + this.crtContext = configResult.context; | |
336 | + this.tabId = configResult.tabId; | |
337 | + | |
338 | + this.coordinatesField = new Ext.toolbar.TextItem({ | |
339 | + width: 300, | |
340 | + text : '' | |
341 | + }); | |
86 | 342 | |
87 | 343 | this.sliderPage = new Ext.slider.Single({ |
88 | 344 | width: 130, |
... | ... | @@ -96,7 +352,8 @@ Ext.define('amdaUI.PlotTabResultUI', { |
96 | 352 | scope : this, |
97 | 353 | changecomplete: function(s, v) |
98 | 354 | { |
99 | - //ToDo - this.resetMire(); | |
355 | + var zoomPlugin = this.getPlugin('plot-zoom-plugin-id'); | |
356 | + zoomPlugin.close(); | |
100 | 357 | var size = this.getImageSize(); |
101 | 358 | this.panelImage.width = size.width; |
102 | 359 | this.panelImage.height = size.height; |
... | ... | @@ -106,12 +363,36 @@ Ext.define('amdaUI.PlotTabResultUI', { |
106 | 363 | } |
107 | 364 | }); |
108 | 365 | |
366 | + | |
367 | + | |
368 | + var mouseToolbar = { | |
369 | + xtype: 'toolbar', | |
370 | + height: 25, | |
371 | + dock: 'bottom', | |
372 | + items:[ | |
373 | + this.coordinatesField, | |
374 | + '->', | |
375 | + this.sliderPage | |
376 | + ] | |
377 | + }; | |
378 | + | |
379 | + this.contextualMenu = Ext.create('Ext.menu.Menu', { | |
380 | + width: 200, | |
381 | + plain: true, | |
382 | + items: [] | |
383 | + }); | |
384 | + | |
109 | 385 | var plotResultTabPanelConfig = { |
110 | 386 | preventHeader : true, |
111 | 387 | autoScroll: true, |
112 | 388 | items: [ |
113 | - this.createPlotImage(configResult.folder, configResult.plotFile, configResult.context) | |
114 | - ] | |
389 | + this.createPlotImage(configResult.folder, configResult.plotFile) | |
390 | + ], | |
391 | + dockedItems: [mouseToolbar], | |
392 | + plugins: [ { | |
393 | + ptype: 'plotZoomPlugin', | |
394 | + pluginId : 'plot-zoom-plugin-id' | |
395 | + }] | |
115 | 396 | }; |
116 | 397 | |
117 | 398 | Ext.apply(this , plotResultTabPanelConfig); |
... | ... |
js/app/views/PlotUI.js
... | ... | @@ -24,6 +24,8 @@ Ext.define('amdaUI.PlotUI', { |
24 | 24 | |
25 | 25 | formPanel: null, |
26 | 26 | |
27 | + multiPlotIntervalPanel : null, | |
28 | + | |
27 | 29 | plotOutput: null, |
28 | 30 | |
29 | 31 | plotTabs : null, |
... | ... | @@ -49,7 +51,6 @@ Ext.define('amdaUI.PlotUI', { |
49 | 51 | */ |
50 | 52 | saveProcess : function(){ |
51 | 53 | var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); |
52 | - console.log(plotModule.linkedNode); | |
53 | 54 | if (plotModule) |
54 | 55 | plotModule.linkedNode.create(); |
55 | 56 | }, |
... | ... | @@ -77,11 +78,12 @@ Ext.define('amdaUI.PlotUI', { |
77 | 78 | */ |
78 | 79 | doPlot : function(){ |
79 | 80 | var timeSource = this.timeSelector.getActiveTimeSource(); |
80 | - var basicForm = this.formPanel.getForm(); | |
81 | - basicForm.updateRecord(this.object); | |
81 | + var multiPlotForm = this.multiPlotIntervalPanel.getForm(); | |
82 | + multiPlotForm.updateRecord(this.object); | |
82 | 83 | this.object.set('timesrc', timeSource); |
83 | 84 | if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) |
84 | 85 | this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); |
86 | + this.plotTabs.updateTimeObject(); | |
85 | 87 | |
86 | 88 | // fire execution |
87 | 89 | var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); |
... | ... | @@ -123,14 +125,18 @@ Ext.define('amdaUI.PlotUI', { |
123 | 125 | this.timeSelector.intervalSel.updateDuration(); |
124 | 126 | }, |
125 | 127 | |
128 | + updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) { | |
129 | + this.multiPlotIntervalPanel.setVisible(isLinkedToMultiPlotMode); | |
130 | + }, | |
131 | + | |
126 | 132 | init : function(config) { |
127 | - this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelector' + config.id, flex: 1} ); | |
133 | + this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelector' + config.id, flex: 1, title : 'MultiPlot Time Selection'} ); | |
128 | 134 | |
129 | 135 | this.plotOutput = new amdaPlotComp.PlotOutputForm({flex: 2}); |
130 | 136 | |
131 | 137 | this.plotElement = new amdaPlotComp.PlotElementPanel({flex: 3}); |
132 | 138 | |
133 | - this.plotTabs = new amdaPlotComp.PlotTabPanel({flex: 2, plotElementPanel : this.plotElement}); | |
139 | + this.plotTabs = new amdaPlotComp.PlotTabPanel({flex: 2, plotElementPanel : this.plotElement, plotUI : this}); | |
134 | 140 | |
135 | 141 | this.optionsPanel = new Ext.form.Panel({ |
136 | 142 | layout: { |
... | ... | @@ -148,6 +154,18 @@ Ext.define('amdaUI.PlotUI', { |
148 | 154 | ] |
149 | 155 | }); |
150 | 156 | |
157 | + this.multiPlotIntervalPanel = new Ext.form.Panel({ | |
158 | + layout: 'fit', | |
159 | + bodyStyle: { background : '#dfe8f6' }, | |
160 | + visible : false, | |
161 | + defaults: { | |
162 | + border: false | |
163 | + }, | |
164 | + items : [ | |
165 | + this.timeSelector | |
166 | + ] | |
167 | + }); | |
168 | + | |
151 | 169 | this.formPanel = new Ext.form.Panel({ |
152 | 170 | region: 'center', |
153 | 171 | layout: { |
... | ... | @@ -174,7 +192,7 @@ Ext.define('amdaUI.PlotUI', { |
174 | 192 | flex: 1, |
175 | 193 | items: [ |
176 | 194 | this.plotTabs, |
177 | - this.timeSelector | |
195 | + this.multiPlotIntervalPanel | |
178 | 196 | ] |
179 | 197 | }, |
180 | 198 | { |
... | ... |
js/app/views/TimeSelectorUI.js
... | ... | @@ -220,7 +220,7 @@ Ext.define('amdaUI.TimeSelectorUI', |
220 | 220 | |
221 | 221 | var config = |
222 | 222 | { |
223 | - title: 'Time Selection', | |
223 | + title: (!this.title) ? 'Time Selection' : this.title, | |
224 | 224 | layout: 'fit', |
225 | 225 | items: |
226 | 226 | [ |
... | ... | @@ -228,7 +228,7 @@ Ext.define('amdaUI.TimeSelectorUI', |
228 | 228 | ] |
229 | 229 | }; |
230 | 230 | |
231 | - Ext.apply(this, config); | |
231 | + Ext.apply(this, config); | |
232 | 232 | this.callParent(arguments); |
233 | 233 | } |
234 | 234 | }); |
... | ... |
js/resources/css/amda.css
... | ... | @@ -474,6 +474,14 @@ p + p { |
474 | 474 | background-image:url( ../images/16x16/plot_additional_drawing_text.png ) !important; |
475 | 475 | } |
476 | 476 | |
477 | +.icon-plot-add-fills { | |
478 | + background-image:url( ../images/16x16/plot_additional_fills.png ) !important; | |
479 | +} | |
480 | + | |
481 | +.icon-plot-add-fill { | |
482 | + background-image:url( ../images/16x16/plot_additional_fill.png ) !important; | |
483 | +} | |
484 | + | |
477 | 485 | .x-item-disabled .x-form-item-label { |
478 | 486 | filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100) !important; |
479 | 487 | opacity: 1.0 !important; |
... | ... |
180 Bytes
207 Bytes
php/classes/AmdaAction.php
... | ... | @@ -1240,6 +1240,12 @@ class AmdaAction { |
1240 | 1240 | unlink(USERDIR.$name); |
1241 | 1241 | return array('success' => true); |
1242 | 1242 | } |
1243 | + | |
1244 | + public function interactivePlot($obj) | |
1245 | + { | |
1246 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
1247 | + return $this->executeRequest($obj, FunctionTypeEnumClass::ACTION); | |
1248 | + } | |
1243 | 1249 | } |
1244 | 1250 | ?> |
1245 | 1251 | |
... | ... |