ParameterAxes.hh 5.67 KB
/*
 * ParameterAxes.hh
 *
 *  Created on: 21 nov. 2013
 *      Author: guillaume
 */

#ifndef PARAMETERAXES_HH_
#define PARAMETERAXES_HH_

#include <iostream>
#include <iterator>
#include <string>
#include <vector>

#include "SeriesProperties.hh"
#include "XSeriesProperties.hh"
#include "DrawingProperties.hh"
#include "SpectroProperties.hh"
#include "SauvaudProperties.hh"
#include "IntervalsProperties.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),
                                                            _sauvaudPropertiesPtr(nullptr),
			_intervalsPropertiesPtr(nullptr),
			_colorSeriesProperties()
	{

	}

	ParameterAxes(const std::string& _originalParamId) :
			_originalParamId(_originalParamId),
			_defaultProperties(),
			_ySeriesProperties(),
			_spectroPropertiesPtr(nullptr),
                                                            _sauvaudPropertiesPtr(nullptr),
			_intervalsPropertiesPtr(nullptr),
			_colorSeriesProperties()
	{

	}

	ParameterAxes(const ParameterAxes& pParamAxes) :
			_originalParamId(pParamAxes._originalParamId),
			_defaultProperties(pParamAxes._defaultProperties),
			_ySeriesProperties(pParamAxes._ySeriesProperties),
			_xSeriesProperties(pParamAxes._xSeriesProperties),
			_spectroPropertiesPtr(pParamAxes._spectroPropertiesPtr),
                                                            _sauvaudPropertiesPtr(pParamAxes._sauvaudPropertiesPtr),
			_intervalsPropertiesPtr(pParamAxes._intervalsPropertiesPtr),
			_colorSeriesProperties(pParamAxes._colorSeriesProperties) {

	}

	ParameterAxes& operator=(const ParameterAxes& pParamAxes_) {
		_originalParamId = pParamAxes_._originalParamId;
		_defaultProperties = pParamAxes_._defaultProperties;
		_ySeriesProperties = pParamAxes_._ySeriesProperties;
		_xSeriesProperties = pParamAxes_._xSeriesProperties;
		_spectroPropertiesPtr = pParamAxes_._spectroPropertiesPtr;
                                        _sauvaudPropertiesPtr = pParamAxes_._sauvaudPropertiesPtr;
		_intervalsPropertiesPtr = pParamAxes_._intervalsPropertiesPtr;
		_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.
	 */
	SeriesProperties* 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<SpectroProperties> pSPectroProperties);
        
                    /**
	 * add a new SauvaudPlot
	 */
	void addSauvaudProperties(std::shared_ptr<SauvaudProperties> pSauvaudProperties);

	/**
	 * add a new intervals
	 */
	void addIntervalsProperties(std::shared_ptr<IntervalsProperties> pIntervalsProperties);

	/**
	 * add a new color serie
	 */
	void addColorSerieProperties(const ColorSeriesProperties&);

	std::vector<SeriesProperties>& getYSeriePropertiesList() {
		return _ySeriesProperties;
	}

	/**
	 * Get x serie properties by id
	 */
	XSeriesProperties& getXSeriePropertiesById(int id_);

	std::vector<XSeriesProperties>& getXSeriePropertiesList() {
		return _xSeriesProperties;
	}

	std::shared_ptr<SpectroProperties> getSpectroProperties() {
		return _spectroPropertiesPtr;
	}
        
                    std::shared_ptr<SauvaudProperties> getSauvaudProperties() {
		return _sauvaudPropertiesPtr;
	}

	std::shared_ptr<IntervalsProperties> getIntervalsProperties() {
		return _intervalsPropertiesPtr;
	}

	std::vector<ColorSeriesProperties>& getColorSeriePropertiesList() {
		return _colorSeriesProperties;
	}

	/**
	 * Get the list of indexes used for a parameter
	 */
	std::vector<AMDA::Common::ParameterIndexComponent> getParamUsedIndexes(std::string paramId_);

	/**
     * 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::vector<SeriesProperties> _ySeriesProperties;

	/**
	 * X Series
	 */
	std::vector<XSeriesProperties> _xSeriesProperties;

	/**
	 * Spectro
	 */
	std::shared_ptr<SpectroProperties> _spectroPropertiesPtr;
        
                    /**
	 * Sauvaud
	 */
	std::shared_ptr<SauvaudProperties> _sauvaudPropertiesPtr;

	/**
	 * Intervals
	 */
	std::shared_ptr<IntervalsProperties> _intervalsPropertiesPtr;

	/**
	 * Color Series
	 */
	std::vector<ColorSeriesProperties> _colorSeriesProperties;
};

typedef std::vector<ParameterAxes> ParameterAxesList;

} /* namespace plot */
#endif /* PARAMETERAXES_HH_ */