/** * Project  : AMDA-NG * Name : PlotAxisObject.js * @class amdaPlotObj.PlotAxisObject * @extends Ext.data.Model * @brief Plot Axis Business Object Definition * @author Benjamin Renard * @version $Id: PlotAxisObject.js benjamin $ ****************************************************************************** * FT Id : Date : Name - Description ****************************************************************************** * : :14/08/2015: BRE - file creation */ Ext.define('amdaPlotObj.PlotAxisObject', { extend: 'Ext.data.Model', idProperty: 'id', requires: [ 'amdaPlotObj.PlotObjectConfig' ], fields : [ {name: 'id', type: 'string'}, //axis-type can be : time, y-left, y-right, x, color, epoch {name: 'axis-type', type: 'string'}, {name: 'axis-reverse', type: 'boolean'}, {name: 'axis-scale', type: 'string'}, {name: 'axis-range-min', type: 'float'}, {name: 'axis-range-max', type: 'float'}, {name: 'axis-range-extend', type: 'boolean'}, {name: 'axis-color', type: 'string'}, {name: 'axis-thickness', type: 'int'}, {name: 'axis-tick-showmarks', type: 'boolean'}, {name: 'axis-grid-specify-ticks-number', type: 'boolean'}, {name: 'axis-grid-specify-ticks-spacing', type: 'boolean'}, {name: 'axis-tick-position', type: 'string'}, {name: 'axis-grid-minor', type: 'boolean'}, {name: 'axis-grid-major', type: 'boolean'}, {name:'axis-grid-minor-number',type:'int'}, {name:'axis-grid-major-number',type:'int'}, {name:'axis-grid-major-space',type:'float'}, {name:'axis-grid-minor-space',type:'float'}, {name: 'axis-legend-activated', type: 'boolean'}, {name: 'axis-legend-text', type: 'string'}, {name: 'axis-legend-color', type: 'string'}, {name: 'axis-legend-font-activated', type: 'boolean'}, {name: 'axis-legend-font-name', type: 'string'}, {name: 'axis-legend-font-size', type: 'int'}, {name: 'axis-legend-font-bold', type: 'boolean'}, {name: 'axis-legend-font-italic', type: 'boolean'}, //only used for time axis {name: 'axis-time-format', type: 'string'}, //only used for epoch axis {name: 'axis-epoch-normalized', type: 'boolean'}, //only used for color axis {name: 'axis-color-map', type: 'string'}, {name: 'axis-color-minval', type: 'string'}, {name: 'axis-color-maxval', type: 'string'} ], associations : [ { type : 'belongsTo', model : 'amdaPlotObj.PlotPanelObject' } ], constructor: function(){ var me = this; me.callParent(arguments); if ((arguments.length > 0) && arguments[0]) { } else { //new object, set default fields values me.setDefaultValues(); } this.dirty = false; }, setDefaultValues: function(type) { this.set('axis-type', type); this.set('axis-reverse', false); this.set('axis-scale', amdaPlotObj.PlotObjectConfig.defaultValues.axis.scale); this.set('axis-range-min', 0); this.set('axis-range-max', 0); this.set('axis-range-extend', true); this.set('axis-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.color); this.set('axis-thickness', amdaPlotObj.PlotObjectConfig.defaultValues.axis.thickness); this.set('axis-tick-showmarks', true); this.set('axis-tick-position', amdaPlotObj.PlotObjectConfig.defaultValues.axis.tickPosition); this.set('axis-grid-minor-number',1); this.set('axis-grid-major-number',1); this.set('axis-grid-minor-space',0); this.set('axis-grid-major-space',0); this.set('axis-grid-minor', false); this.set('axis-grid-specify-ticks-number', false); this.set('axis-grid-specify-ticks-spacing', false); this.set('axis-grid-major', false); this.set('axis-legend-activated', true); this.set('axis-legend-text', ''); this.set('axis-legend-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.color); this.set('axis-legend-font-activated', false); this.set('axis-legend-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.font.name); this.set('axis-legend-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.font.size); this.set('axis-legend-font-bold', false); this.set('axis-legend-font-italic', false); this.set('axis-time-format', amdaPlotObj.PlotObjectConfig.defaultValues.axis.timeFormat); this.set('axis-epoch-normalized', false); this.set('axis-color-map', amdaPlotObj.PlotObjectConfig.defaultValues.axis.colorMap); this.set('axis-color-minval', 'none'); this.set('axis-color-maxval', 'none'); }, isDirty : function() { return this.dirty; }, getJsonValues : function() { var axisValues = new Object(); axisValues['id'] = this.get('id'); axisValues['axis-type'] = this.get('axis-type'); axisValues['axis-reverse'] = this.get('axis-reverse'); axisValues['axis-scale'] = this.get('axis-scale'); axisValues['axis-range-min'] = this.get('axis-range-min'); axisValues['axis-range-max'] = this.get('axis-range-max'); axisValues['axis-range-extend'] = this.get('axis-range-extend'); axisValues['axis-color'] = this.get('axis-color'); axisValues['axis-thickness'] = this.get('axis-thickness'); axisValues['axis-tick-showmarks'] = this.get('axis-tick-showmarks'); axisValues['axis-tick-position'] = this.get('axis-tick-position'); axisValues['axis-grid-minor'] = this.get('axis-grid-minor'); axisValues['axis-grid-major'] = this.get('axis-grid-major'); axisValues['axis-grid-minor-number']=this.get('axis-grid-minor-number'); axisValues['axis-grid-major-number']=this.get('axis-grid-major-number'); axisValues['axis-grid-specify-ticks-number']=this.get('axis-grid-specify-ticks-number'); axisValues['axis-grid-minor-space']=this.get('axis-grid-minor-space'); axisValues['axis-grid-major-space']=this.get('axis-grid-major-space'); axisValues['axis-grid-specify-ticks-spacing']=this.get('axis-grid-specify-ticks-spacing'); axisValues['axis-legend-activated'] = this.get('axis-legend-activated'); axisValues['axis-legend-text'] = this.get('axis-legend-text'); axisValues['axis-legend-color'] = this.get('axis-legend-color'); axisValues['axis-legend-font-activated'] = this.get('axis-legend-font-activated'); axisValues['axis-legend-font-name'] = this.get('axis-legend-font-name'); axisValues['axis-legend-font-size'] = this.get('axis-legend-font-size'); axisValues['axis-legend-font-bold'] = this.get('axis-legend-font-bold'); axisValues['axis-legend-font-italic'] = this.get('axis-legend-font-italic'); if (axisValues['axis-type'] == 'time') axisValues['axis-time-format'] = this.get('axis-time-format'); if (axisValues['axis-type'] == 'epoch') axisValues['axis-epoch-normalized'] = this.get('axis-epoch-normalized'); if (axisValues['axis-type'] == 'color') { axisValues['axis-color-map'] = this.get('axis-color-map'); axisValues['axis-color-minval'] = this.get('axis-color-minval'); axisValues['axis-color-maxval'] = this.get('axis-color-maxval'); } return axisValues; } });