/* * ParameterAxes.hh * * Created on: 21 nov. 2013 * Author: guillaume */ #ifndef PARAMETERAXES_HH_ #define PARAMETERAXES_HH_ #include #include #include #include #include "SeriesProperties.hh" #include "XSeriesProperties.hh" #include "DrawingProperties.hh" #include "SpectroProperties.hh" #include "ColorSeriesProperties.hh" #include "Parameter.hh" #include "ParameterData.hh" namespace plot { /** * holds all properties related to a parameter. * series properties field is hidden in this class, because we have to check * for inclusion of the same serie (same index) twice. */ class ParameterAxes { public: friend std::ostream& operator<<(std::ostream& out_, const ParameterAxes& prop_); /* * Dumps properties for test. */ void dump(std::ostream& out_, std::string& prefix_); ParameterAxes() : _originalParamId(""), _defaultProperties(), _ySeriesProperties(), _spectroPropertiesPtr(nullptr), _colorSeriesProperties() { } ParameterAxes(const std::string& _originalParamId) : _originalParamId(_originalParamId), _defaultProperties(), _ySeriesProperties(), _spectroPropertiesPtr(nullptr), _colorSeriesProperties() { } ParameterAxes(const ParameterAxes& pParamAxes) : _originalParamId(pParamAxes._originalParamId), _defaultProperties(pParamAxes._defaultProperties), _ySeriesProperties(pParamAxes._ySeriesProperties), _xSeriesProperties(pParamAxes._xSeriesProperties), _spectroPropertiesPtr(pParamAxes._spectroPropertiesPtr), _colorSeriesProperties(pParamAxes._colorSeriesProperties) { } ParameterAxes& operator=(const ParameterAxes& pParamAxes_) { _originalParamId = pParamAxes_._originalParamId; _defaultProperties = pParamAxes_._defaultProperties; _ySeriesProperties = pParamAxes_._ySeriesProperties; _xSeriesProperties = pParamAxes_._xSeriesProperties; _spectroPropertiesPtr = pParamAxes_._spectroPropertiesPtr; _colorSeriesProperties = pParamAxes_._colorSeriesProperties; return *this; } virtual ~ParameterAxes() { } /** * add a new series properties. If a series with the same index * already exist, it will be overridden. * _index field of SerieProperties must have been properly set * before calling this method. * @param series properties to add. */ void addYSerieProperties(const SeriesProperties&); /** * adds a new X series. * already exist, it will be overridden. * _index field of SerieProperties must have been properly set * before calling this method. * @param series properties to add, with no drawing settings, just index and xAxis */ void addXSerieProperties(const XSeriesProperties&); /** * add a new spectro */ void addSpectroProperties(std::shared_ptr pSPectroProperties); /** * add a new color serie */ void addColorSerieProperties(const ColorSeriesProperties&); /** * retrieve the series properties for the given 'index' key. Index is the * value defined by the 'index' element in xml definition. * If an entry with index=-1 exists and the required index is not found, then * the serie at index==-1 is returned. Otherwise, an out_of_range exception is raised. * * @param index of the serie. * @return the serie. * @throw out_of_range exception if not found. */ SeriesProperties& getYSeriePropertiesAt(AMDA::Common::ParameterIndexComponent index); std::map& getYSeriePropertiesMap() { return _ySeriesProperties; } /** * Get x serie properties by id */ XSeriesProperties& getXSeriePropertiesById(int id_); std::vector& getXSeriePropertiesList() { return _xSeriesProperties; } std::shared_ptr getSpectroProperties() { return _spectroPropertiesPtr; } std::vector& getColorSeriePropertiesList() { return _colorSeriesProperties; } /** * Get the list of indexes used for a parameter */ std::vector getParamUsedIndexes(std::string paramId_); /** * Gets all real index for y series. */ std::vector getYSerieIndexList(std::map *pParameterValues); /** * Get color serie properties by id */ ColorSeriesProperties& getColorSeriePropertiesById(int id_); DrawingProperties& getDefaultProperties() { return _defaultProperties; } void setDefaultProperties(const DrawingProperties& default_) { _defaultProperties = default_; } /** * Original parameter Id */ std::string _originalParamId; private: /** * Common drawing properties */ DrawingProperties _defaultProperties; /** * Y Series */ std::map _ySeriesProperties; /** * X Series */ std::vector _xSeriesProperties; /** * Spectro */ std::shared_ptr _spectroPropertiesPtr; /** * Color Series */ std::vector _colorSeriesProperties; }; typedef std::vector ParameterAxesList; } /* namespace plot */ #endif /* PARAMETERAXES_HH_ */