Commit 6a8015412d162bf2b330ca7b6c42fc8197215cfe

Authored by Benjamin Renard
1 parent c6ac946e

Add possibility to define an instant plot

js/app/models/PlotObjects/PlotInstantSerieObject.js 0 → 100644
... ... @@ -0,0 +1,64 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotInstantSerieObject.js
  4 + * @class amdaPlotObj.PlotInstantSerieObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Instant Serie Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotInstantSerieObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :28/08/2015: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotInstantSerieObject', {
  17 + extend: 'Ext.data.Model',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
  22 +
  23 + fields : [
  24 + {name: 'iserie-tableonx', type: 'boolean'},
  25 + {name: 'iserie-lines-activated', type: 'bool'},
  26 + {name: 'iserie-lines-style', type: 'string'},
  27 + {name: 'iserie-lines-width', type: 'float'},
  28 + {name: 'iserie-lines-color', type: 'string'},
  29 + {name: 'iserie-symbols-activated', type: 'bool'},
  30 + {name: 'iserie-symbols-type', type: 'string'},
  31 + {name: 'iserie-symbols-size', type: 'float'},
  32 + {name: 'iserie-symbols-color', type: 'string'}
  33 + ],
  34 +
  35 + setDefaultValues: function()
  36 + {
  37 + this.set('iserie-tableonx', false);
  38 + this.set('iserie-lines-activated', true);
  39 + this.set('iserie-lines-style', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.style);
  40 + this.set('iserie-lines-width', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.width);
  41 + this.set('iserie-lines-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.color);
  42 + this.set('iserie-symbols-activated', false);
  43 + this.set('iserie-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.type);
  44 + this.set('iserie-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.size);
  45 + this.set('iserie-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.color);
  46 + },
  47 +
  48 + getJsonValues : function()
  49 + {
  50 + var iserieValues = new Object();
  51 +
  52 + iserieValues['iserie-tableonx'] = this.get('iserie-tableonx');
  53 + iserieValues['iserie-lines-activated'] = this.get('iserie-lines-activated');
  54 + iserieValues['iserie-lines-style'] = this.get('iserie-lines-style');
  55 + iserieValues['iserie-lines-width'] = this.get('iserie-lines-width');
  56 + iserieValues['iserie-lines-color'] = this.get('iserie-lines-color');
  57 + iserieValues['iserie-symbols-activated'] = this.get('iserie-symbols-activated');
  58 + iserieValues['iserie-symbols-type'] = this.get('iserie-symbols-type');
  59 + iserieValues['iserie-symbols-size'] = this.get('iserie-symbols-size');
  60 + iserieValues['iserie-symbols-color'] = this.get('iserie-symbols-color');
  61 +
  62 + return iserieValues;
  63 + }
  64 +});
0 65 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotInstantSpectroObject.js 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotInstantSpectroObject.js
  4 + * @class amdaPlotObj.PlotInstantSpectroObject
  5 + * @extends Ext.data.Model
  6 + * @brief Plot Instant Spectro Business Object Definition
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotInstantSpectroObject.js benjamin $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :28/08/2015: BRE - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotInstantSpectroObject', {
  17 + extend: 'Ext.data.Model',
  18 +
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
  22 +
  23 + fields : [
  24 + {name: 'ispectro-dimonxaxis', type: 'int'}
  25 + ],
  26 +
  27 + setDefaultValues: function()
  28 + {
  29 + this.set('ispectro-dimonxaxis', 0);
  30 + },
  31 +
  32 + getJsonValues : function()
  33 + {
  34 + var ispectroValues = new Object();
  35 +
  36 + ispectroValues['ispectro-dimonxaxis'] = this.get('ispectro-dimonxaxis');
  37 +
  38 + return ispectroValues;
  39 + }
  40 +});
0 41 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -240,5 +240,10 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
240 240 availableResamplingModes : [
241 241 {'key' : 'xparam', 'value' : 'X Parameter'},
242 242 {'key' : 'yparam', 'value' : 'Y Parameter'}
  243 + ],
  244 +
  245 + availableDimsOnXAxis : [
  246 + {'key' : '0', 'value' : 'First dimension'},
  247 + {'key' : '1', 'value' : 'Second dimension'}
243 248 ]
244 249 });
245 250 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -60,7 +60,19 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
60 60 //Only used for tickPlot and timePlot
61 61 {name: 'panel-tick-format', type: 'int'},
62 62 //Only used for epochPlot
63   - {name: 'panel-epoch-centertimeid', type: 'string'}
  63 + {name: 'panel-epoch-centertimeid', type: 'string'},
  64 + //Only used for instantPlot
  65 + {name: 'panel-instant-time', type: 'date',
  66 + defaultValue:Ext.Date.add(Ext.Date.clearTime(new Date()),Ext.Date.DAY,-1),
  67 + convert: function(value,rec) {
  68 + if (!Ext.isDate(value)) {
  69 + var valueString = new String(value);
  70 + var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' '));
  71 + return date;
  72 + }
  73 + return value;
  74 + }
  75 + }
64 76 ],
65 77  
66 78 associations : [
... ... @@ -127,7 +139,6 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
127 139 recs[0].setDefaultValues('color');
128 140 break;
129 141 case 'xyPlot' :
130   - case 'instantPlot' :
131 142 //X Axis
132 143 var recs = this.axes().add({id : 'x'});
133 144 recs[0].setDefaultValues('x');
... ... @@ -141,6 +152,17 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
141 152 recs = this.axes().add({id : 'color'});
142 153 recs[0].setDefaultValues('color');
143 154 break;
  155 + case 'instantPlot' :
  156 + //X Axis
  157 + var recs = this.axes().add({id : 'x'});
  158 + recs[0].setDefaultValues('x');
  159 + //Y Left Axis
  160 + recs = this.axes().add({id : 'y-left'});
  161 + recs[0].setDefaultValues('y-left');
  162 + //Color Axis
  163 + recs = this.axes().add({id : 'color'});
  164 + recs[0].setDefaultValues('color');
  165 + break;
144 166 case 'epochPlot' :
145 167 //Epoch Axis
146 168 var recs = this.axes().add({id : 'epoch'});
... ... @@ -297,6 +319,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
297 319 if (this.get('panel-plot-type') == 'epochPlot')
298 320 panelValues['panel-epoch-centertimeid'] = this.get('panel-epoch-centertimeid');
299 321  
  322 + if (this.get('panel-plot-type') == 'instantPlot')
  323 + panelValues['panel-instant-time'] = this.get('panel-instant-time');
  324 +
300 325 panelValues['axes'] = [];
301 326  
302 327 this.axes().each(function (axe, index) {
... ...
js/app/models/PlotObjects/PlotParamObject.js
... ... @@ -21,7 +21,9 @@ Ext.define('amdaPlotObj.PlotParamObject', {
21 21 'amdaPlotObj.PlotSerieObject',
22 22 'amdaPlotObj.PlotSpectroObject',
23 23 'amdaPlotObj.PlotStatusBarObject',
24   - 'amdaPlotObj.PlotTickBarObject'
  24 + 'amdaPlotObj.PlotTickBarObject',
  25 + 'amdaPlotObj.PlotInstantSerieObject',
  26 + 'amdaPlotObj.PlotInstantSpectroObject'
25 27 ],
26 28  
27 29 fields : [
... ... @@ -84,6 +86,12 @@ Ext.define('amdaPlotObj.PlotParamObject', {
84 86 case 'tick-bar' :
85 87 this.set('param-drawing-object', new amdaPlotObj.PlotTickBarObject());
86 88 break;
  89 + case 'iserie' :
  90 + this.set('param-drawing-object', new amdaPlotObj.PlotInstantSerieObject());
  91 + break;
  92 + case 'ispectro' :
  93 + this.set('param-drawing-object', new amdaPlotObj.PlotInstantSpectroObject());
  94 + break;
87 95 default :
88 96 this.set('param-drawing-object', null);
89 97 }
... ... @@ -111,8 +119,8 @@ Ext.define('amdaPlotObj.PlotParamObject', {
111 119 ];
112 120 case 'instantPlot' :
113 121 return [
114   - {'key' : 'serie', 'value' : 'Serie'},
115   - {'key' : 'spectro', 'value' : 'Spectro'}
  122 + {'key' : 'iserie', 'value' : 'Serie'},
  123 + {'key' : 'ispectro', 'value' : 'Spectro'}
116 124 ];
117 125 case 'statusPlot' :
118 126 return [
... ...
js/app/views/PlotComponents/PlotInstantSerieForm.js 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotInstantSerieForm.js
  4 + * @class amdaPlotComp.PlotInstantSerieForm
  5 + * @extends amdaPlotComp.PlotStandardForm
  6 + * @brief Form to define specifics instant serie options
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotInstantSerieForm.js benjamin $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotInstantSerieForm', {
  12 + extend: 'amdaPlotComp.PlotStandardForm',
  13 +
  14 + setObject : function(object) {
  15 + this.object = object.get('param-drawing-object');
  16 + this.loadRecord(this.object);
  17 + },
  18 +
  19 + getFormItems: function() {
  20 + var linesItems = [
  21 + this.addStandardCombo('iserie-lines-style', 'Style', amdaPlotObj.PlotObjectConfig.availableLinesStyles),
  22 + this.addStandardFloat('iserie-lines-width', 'Width', 1, 10),
  23 + this.addStandardColor('iserie-lines-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
  24 + ];
  25 +
  26 + var symbolsItems = [
  27 + this.addStandardCombo('iserie-symbols-type', 'Type', amdaPlotObj.PlotObjectConfig.availableSymbolsTypes),
  28 + this.addStandardFloat('iserie-symbols-size', 'Size', 1, 10),
  29 + this.addStandardColor('iserie-symbols-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
  30 + ];
  31 +
  32 + return [
  33 + this.addStandardCheck('iserie-tableonx', 'Table on X axis'),
  34 + this.addStandardFieldSet('Lines', 'iserie-lines-activated', linesItems),
  35 + this.addStandardFieldSet('Symbols', 'iserie-symbols-activated', symbolsItems)
  36 + ];
  37 + }
  38 +});
0 39 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotInstantSpectroForm.js 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +/**
  2 + * Project  : AMDA-NG
  3 + * Name : PlotInstantSpectroForm.js
  4 + * @class amdaPlotComp.PlotInstantSpectroForm
  5 + * @extends amdaPlotComp.PlotStandardForm
  6 + * @brief Form to define specifics instant spectro options
  7 + * @author Benjamin Renard
  8 + * @version $Id: PlotInstantSpectroForm.js benjamin $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotInstantSpectroForm', {
  12 + extend: 'amdaPlotComp.PlotStandardForm',
  13 +
  14 + setObject : function(object) {
  15 + this.object = object.get('param-drawing-object');
  16 + this.loadRecord(this.object);
  17 + },
  18 +
  19 + getFormItems: function() {
  20 + return [
  21 + this.addStandardCombo('ispectro-dimonxaxis', 'Dim. on X axis', amdaPlotObj.PlotObjectConfig.availableDimsOnXAxis)
  22 + ];
  23 + }
  24 +});
0 25 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotPanelForm.js
... ... @@ -46,6 +46,11 @@ Ext.define('amdaPlotComp.PlotPanelForm', {
46 46  
47 47 centerTimeIdField.setVisible(plotType == 'epochPlot');
48 48  
  49 + //Instant time visibility
  50 + var instantTimeField = this.getForm().findField('panel-instant-time');
  51 +
  52 + instantTimeField.setVisible(plotType == 'instantPlot');
  53 +
49 54 //Options in relation with the layout
50 55 this.updateLayoutOptions(plotType);
51 56 },
... ... @@ -122,6 +127,7 @@ Ext.define('amdaPlotComp.PlotPanelForm', {
122 127 }),
123 128 this.addStandardCheck('panel-scatter-isotropic', 'Isotropic'),
124 129 this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id'),
  130 + this.addStandardDate('panel-instant-time', 'Instant time'),
125 131 this.addStandardColor('panel-background-color', 'Background Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors),
126 132 this.addStandardFieldSet('Manual Bounds', '', boundsItems),
127 133 this.addStandardFieldSet('Manual Margins', '', marginItems),
... ...
js/app/views/PlotComponents/PlotParamForm.js
... ... @@ -15,7 +15,9 @@ Ext.define('amdaPlotComp.PlotParamForm', {
15 15 'amdaPlotComp.PlotSerieForm',
16 16 'amdaPlotComp.PlotSpectroForm',
17 17 'amdaPlotComp.PlotStatusBarForm',
18   - 'amdaPlotComp.PlotTickBarForm'
  18 + 'amdaPlotComp.PlotTickBarForm',
  19 + 'amdaPlotComp.PlotInstantSerieForm',
  20 + 'amdaPlotComp.PlotInstantSpectroForm'
19 21 ],
20 22  
21 23 drawingOptionsContainer: null,
... ... @@ -54,6 +56,12 @@ Ext.define('amdaPlotComp.PlotParamForm', {
54 56 case 'tick-bar' :
55 57 this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotTickBarForm({id : formId}));
56 58 break;
  59 + case 'iserie' :
  60 + this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSerieForm({id : formId}));
  61 + break;
  62 + case 'ispectro' :
  63 + this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotInstantSpectroForm({id : formId}));
  64 + break;
57 65 default :
58 66 this.drawingOptionsFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this drawing type'}));
59 67 }
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -266,6 +266,23 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
266 266 };
267 267 },
268 268  
  269 + addStandardDate: function(name, label) {
  270 + return {
  271 + xtype: 'datefield',
  272 + name: name,
  273 + format: 'Y/m/d H:i:s',
  274 + enforceMaxLength : true,
  275 + maxLength: 19,
  276 + fieldLabel: label,
  277 + listeners: {
  278 + change: function(field, newValue, oldValue, eOpts) {
  279 + this.object.set(name, newValue);
  280 + },
  281 + scope : this
  282 + }
  283 + };
  284 + },
  285 +
269 286 init : function(config) {
270 287 var me = this;
271 288  
... ...