PlotBaseSerieObject.js 11.7 KB
/**
 * Project      : AMDA-NG
 * Name         : PlotBaseSerieObject.js
 * @class   amdaPlotObj.PlotBaseSerieObject
 * @extends Ext.data.Model
 * @brief   Plot Base Serie Business Object Definition 
 * @author  Benjamin Renard
 * @version $Id: PlotBaseSerieObject.js benjamin $
 ******************************************************************************
 *    FT Id     :   Date   : Name - Description
 ******************************************************************************
 *	:           :14/09/2015: BRE  - file creation
 */


Ext.define('amdaPlotObj.PlotBaseSerieObject', {
    extend: 'Ext.data.Model',

    requires: [
        'amdaPlotObj.PlotObjectConfig'
    ],

    fields: [
        {name: 'serie-yaxis', type: 'string'},
        {name: 'serie-resolution', type: 'int'},
        {name: 'serie-lines-activated', type: 'boolean'},
        {name: 'serie-lines-style', type: 'string'},
        {name: 'serie-lines-width', type: 'float'},
        {name: 'serie-lines-color', type: 'string'},
        {name: 'serie-symbols-activated', type: 'boolean'},
        {name: 'serie-symbols-type', type: 'string'},
        {name: 'serie-symbols-size', type: 'float'},
        {name: 'serie-symbols-color', type: 'string'},
        {name: 'serie-colored-param', type: 'string'},
        {name: 'serie-value-min', type: 'float', useNull: true},
        {name: 'serie-value-max', type: 'float', useNull: true},

        //Time tick
        {name: 'serie-timetick-activated', type: 'boolean'},
        {name: 'serie-timetick-type', type: 'string'},
        {name: 'serie-timetick-step', type: 'float'},
        {name: 'serie-timetick-nbmajor', type: 'int'},
        {name: 'serie-timetick-nbminor', type: 'int'},
        {name: 'serie-timetick-color', type: 'string'},
        {name: 'serie-timetick-symbols-type', type: 'string'},
        {name: 'serie-timetick-symbols-size', type: 'float'},
        {name: 'serie-timetick-symbols-color', type: 'string'},
        {name: 'serie-timetick-firstsymbols-activated', type: 'boolean'},
        {name: 'serie-timetick-firstsymbols-type', type: 'string'},
        {name: 'serie-timetick-firstsymbols-size', type: 'float'},
        {name: 'serie-timetick-firstsymbols-color', type: 'string'},
        {name: 'serie-timetick-font-activated', type: 'boolean'},
        {name: 'serie-timetick-font-name', type: 'string'},
        {name: 'serie-timetick-font-size', type: 'int'},
        {name: 'serie-timetick-font-bold', type: 'boolean'},
        {name: 'serie-timetick-font-italic', type: 'boolean'},

        //Interval tick
        {name: 'serie-intervaltick-activated', type: 'boolean'},
        {name: 'serie-intervaltick-mode', type: 'string'},
        {name: 'serie-intervaltick-color', type: 'string'},
        {name: 'serie-intervaltick-symbols-type', type: 'string'},
        {name: 'serie-intervaltick-symbols-size', type: 'float'},
        {name: 'serie-intervaltick-symbols-color', type: 'string'},
        {name: 'serie-intervaltick-font-activated', type: 'boolean'},
        {name: 'serie-intervaltick-font-name', type: 'string'},
        {name: 'serie-intervaltick-font-size', type: 'int'},
        {name: 'serie-intervaltick-font-bold', type: 'boolean'},
        {name: 'serie-intervaltick-font-italic', type: 'boolean'},
        //Filtering
         {name: 'filtering-activated', type: 'boolean'},
         {name:'filtering-level', type:'int'}
    ],

    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 ()
    {
        this.set('serie-yaxis', amdaPlotObj.PlotObjectConfig.defaultValues.serie.yAxis);
        this.set('serie-resolution', amdaPlotObj.PlotObjectConfig.defaultValues.serie.resolution);
        this.set('serie-lines-activated', true);
        this.set('serie-lines-style', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.style);
        this.set('serie-lines-width', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.width);
        this.set('serie-lines-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.lines.color);
        this.set('serie-symbols-activated', false);
        this.set('serie-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.type);
        this.set('serie-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.size);
        this.set('serie-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.color);
        this.set('serie-colored-param', '');

        this.set('serie-timetick-activated', false);
        this.set('serie-timetick-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.type);
        this.set('serie-timetick-step', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.step);
        this.set('serie-timetick-nbmajor', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.nbmajor);
        this.set('serie-timetick-nbminor', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.nbminor);
        this.set('serie-timetick-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.color);
        this.set('serie-timetick-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.type);
        this.set('serie-timetick-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.size);
        this.set('serie-timetick-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.symbols.color);
        this.set('serie-timetick-firstsymbols-activated', true);
        this.set('serie-timetick-firstsymbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.type);
        this.set('serie-timetick-firstsymbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.size);
        this.set('serie-timetick-firstsymbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.firstsymbols.color);
        this.set('serie-timetick-font-activated', false);
        this.set('serie-timetick-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.font.name);
        this.set('serie-timetick-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.timetick.font.size);
        this.set('serie-timetick-font-bold', false);
        this.set('serie-timetick-font-italic', false);

        this.set('serie-intervaltick-activated', false);
        this.set('serie-intervaltick-mode', amdaPlotObj.PlotObjectConfig.defaultValues.serie.intervaltick.mode);
        this.set('serie-intervaltick-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.intervaltick.color);
        this.set('serie-intervaltick-symbols-type', amdaPlotObj.PlotObjectConfig.defaultValues.serie.intervaltick.symbols.type);
        this.set('serie-intervaltick-symbols-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.intervaltick.symbols.size);
        this.set('serie-intervaltick-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.intervaltick.symbols.color);
        this.set('serie-intervaltick-font-activated', false);
        this.set('serie-intervaltick-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.serie.intervaltick.font.name);
        this.set('serie-intervaltick-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.serie.intervaltick.font.size);
        this.set('serie-intervaltick-font-bold', false);
        this.set('serie-intervaltick-font-italic', false);
        
        // filtering 
          this.set( 'filtering-activated', false);
         this.set('filtering-level', amdaPlotObj.PlotObjectConfig.defaultValues.filtering.level);
    },

    loadFromData: function (drawData)
    {
        Ext.Object.each(drawData, function (key, value) {
            if (key == 'type')
                return;
            this.set(key, value);
        }, this);
    },

    getJsonValues: function ()
    {
        var serieValues = new Object();

        serieValues['serie-yaxis'] = this.get('serie-yaxis');
        serieValues['serie-resolution'] = this.get('serie-resolution');
        serieValues['serie-lines-activated'] = this.get('serie-lines-activated');
        serieValues['serie-lines-style'] = this.get('serie-lines-style');
        serieValues['serie-lines-width'] = this.get('serie-lines-width');
        serieValues['serie-lines-color'] = this.get('serie-lines-color');
        serieValues['serie-symbols-activated'] = this.get('serie-symbols-activated');
        serieValues['serie-symbols-type'] = this.get('serie-symbols-type');
        serieValues['serie-symbols-size'] = this.get('serie-symbols-size');
        serieValues['serie-symbols-color'] = this.get('serie-symbols-color');
        serieValues['serie-colored-param'] = this.get('serie-colored-param');
        serieValues['serie-value-min'] = this.get('serie-value-min');
        serieValues['serie-value-max'] = this.get('serie-value-max');

        serieValues['serie-timetick-activated'] = this.get('serie-timetick-activated');
        serieValues['serie-timetick-type'] = this.get('serie-timetick-type');
        serieValues['serie-timetick-step'] = this.get('serie-timetick-step');
        serieValues['serie-timetick-nbmajor'] = this.get('serie-timetick-nbmajor');
        serieValues['serie-timetick-nbminor'] = this.get('serie-timetick-nbminor');
        serieValues['serie-timetick-color'] = this.get('serie-timetick-color');
        serieValues['serie-timetick-symbols-type'] = this.get('serie-timetick-symbols-type');
        serieValues['serie-timetick-symbols-size'] = this.get('serie-timetick-symbols-size');
        serieValues['serie-timetick-symbols-color'] = this.get('serie-timetick-symbols-color');
        serieValues['serie-timetick-firstsymbols-activated'] = this.get('serie-timetick-firstsymbols-activated');
        serieValues['serie-timetick-firstsymbols-type'] = this.get('serie-timetick-firstsymbols-type');
        serieValues['serie-timetick-firstsymbols-size'] = this.get('serie-timetick-firstsymbols-size');
        serieValues['serie-timetick-firstsymbols-color'] = this.get('serie-timetick-firstsymbols-color');
        serieValues['serie-timetick-font-activated'] = this.get('serie-timetick-font-activated');
        serieValues['serie-timetick-font-name'] = this.get('serie-timetick-font-name');
        serieValues['serie-timetick-font-size'] = this.get('serie-timetick-font-size');
        serieValues['serie-timetick-font-bold'] = this.get('serie-timetick-font-bold');
        serieValues['serie-timetick-font-italic'] = this.get('serie-timetick-font-italic');

        serieValues['serie-intervaltick-activated'] = this.get('serie-intervaltick-activated');
        serieValues['serie-intervaltick-mode'] = this.get('serie-intervaltick-mode');
        serieValues['serie-intervaltick-color'] = this.get('serie-intervaltick-color');
        serieValues['serie-intervaltick-symbols-type'] = this.get('serie-intervaltick-symbols-type');
        serieValues['serie-intervaltick-symbols-size'] = this.get('serie-intervaltick-symbols-size');
        serieValues['serie-intervaltick-symbols-color'] = this.get('serie-intervaltick-symbols-color');
        serieValues['serie-intervaltick-font-activated'] = this.get('serie-intervaltick-font-activated');
        serieValues['serie-intervaltick-font-name'] = this.get('serie-intervaltick-font-name');
        serieValues['serie-intervaltick-font-size'] = this.get('serie-intervaltick-font-size');
        serieValues['serie-intervaltick-font-bold'] = this.get('serie-intervaltick-font-bold');
        serieValues['serie-intervaltick-font-italic'] = this.get('serie-intervaltick-font-italic');
        
         serieValues['filtering-activated'] = this.get('filtering-activated');
         serieValues['filtering-level'] = this.get('filtering-level');

        return serieValues;
    }
});