SpectroProperties.hh 5.87 KB
/*
 * SeriesProperties.hh
 *
 *  Created on: Jul 1, 2014
 *      Author: AKKA
 */

#ifndef SPECTROPROPERTIES_HH_
#define SPECTROPROPERTIES_HH_

#define BACKGROUND_SUB_TYPE "background_sub_type"
#define BACKGROUND_SUB_VALUE "background_sub_value"
#define BACKGROUND_SUB_DIM "background_sub_dim"
#define BACKGROUND_SUB_TYPE_BY_CHANNEL "bychannel"
#define BACKGROUND_SUB_TYPE_BY_FIXED_VALUE "fixedvalue"

#include <cmath>
#include <iostream>
#include <string>

#include "DrawingProperties.hh"

namespace plot
{

	/**
 * Drawing properties for a parameter spectro.
 */
	class SpectroProperties : public DrawingProperties
	{
	public:
		friend std::ostream &operator<<(std::ostream &out_,
										const SpectroProperties &lprop_);

		/*
	 * @brief Dumps properties for test.
	 */
		void dump(std::ostream &out_, std::string &prefix_);

		SpectroProperties() : DrawingProperties(), _paramId(""), _tableParamsId(),
							  _hasXAxis(true), _hasYAxis(true), _hasZAxis(true), _indexDef(""),
							  _relatedDim(0), _useLog0AsMin(false)
		{
		}

		SpectroProperties(const DrawingProperties &ref_) : DrawingProperties(ref_), _paramId(""), _tableParamsId(),
														   _hasXAxis(true), _hasYAxis(true), _hasZAxis(true), _indexDef(""),
														   _relatedDim(0), _useLog0AsMin(false)
		{
		}

		SpectroProperties(const SpectroProperties &pParamDrawingProperties_) : DrawingProperties(pParamDrawingProperties_), _paramId(""), _tableParamsId(), _hasXAxis(
																																								pParamDrawingProperties_._hasXAxis),
																			   _hasYAxis(
																				   pParamDrawingProperties_._hasYAxis),
																			   _hasZAxis(
																				   pParamDrawingProperties_._hasZAxis),
																			   _indexDef(
																				   pParamDrawingProperties_._indexDef),
																			   _indexList(
																				   pParamDrawingProperties_._indexList),
																			   _relatedDim(
																				   pParamDrawingProperties_._relatedDim),
																			   _useLog0AsMin(
																				   pParamDrawingProperties_._useLog0AsMin)
		{
		}

		SpectroProperties &operator=(const SpectroProperties &ref_)
		{
			DrawingProperties::operator=(ref_);
			_paramId = ref_._paramId;
			_tableParamsId = ref_._tableParamsId;
			_hasYAxis = ref_._hasYAxis;
			_hasXAxis = ref_._hasXAxis;
			_hasZAxis = ref_._hasZAxis;
			_indexDef = ref_._indexDef;
			_indexList = ref_._indexList;
			_relatedDim = ref_._relatedDim;
			_useLog0AsMin = ref_._useLog0AsMin;
			return *this;
		}

		virtual ~SpectroProperties()
		{
		}

		/**
		 * @brief the type of the background subtraction : By channel, Fixed value
		 * 
		 */
		std::string backgroundSubType;
		/**
		 * @brief the value of the background subtraction
		 * 
		 */
		double backgroundSubValue;
		/**
		 * @brief the selected dimension of background subtraction : dim1 or dim2
		 * 
		 */
		int backgroundSubDim;

		std::string getParamId()
		{
			return _paramId;
		}

		void setParamId(std::string paramId_)
		{
			_paramId = paramId_;
		}

		std::string getTableParamIdByName(std::string paramName)
		{
			return _tableParamsId[paramName];
		}

		std::map<std::string, std::string> &getTableParams()
		{
			return _tableParamsId;
		}

		void addTableParam(std::string paramName, std::string paramId)
		{
			_tableParamsId[paramName] = paramId;
		}

		bool hasXAxis() const
		{
			return _hasXAxis;
		}

		void setXAxis(bool hasXAxis)
		{
			_hasXAxis = hasXAxis;
		}

		bool hasYAxis() const
		{
			return _hasYAxis;
		}

		void setYAxis(bool hasYAxis)
		{
			_hasYAxis = hasYAxis;
		}

		bool hasZAxis() const
		{
			return _hasZAxis;
		}

		void setZAxis(bool hasZAxis)
		{
			_hasZAxis = hasZAxis;
		}

		std::string getIndexDef() const
		{
			return _indexDef;
		}

		void setIndexDef(std::string indexDef)
		{
			_indexDef = indexDef;
		}

		AMDA::Common::ParameterIndexComponentList &getIndexes()
		{
			return _indexList;
		}

		void setIndexes(AMDA::Common::ParameterIndexComponentList indexList)
		{
			_indexList = indexList;
		}

		int getRelatedDim() const
		{
			return _relatedDim;
		}

		void setRelatedDim(int relatedDim)
		{
			_relatedDim = relatedDim;
		}

		bool getUseLog0AsMin() const
		{
			return _useLog0AsMin;
		}

		void setUseLog0AsMin(bool useLog0AsMin)
		{
			_useLog0AsMin = useLog0AsMin;
		}

		std::string getNormalization()
		{
			return _normalization;
		}

		void setNormalization(std::string normalization)
		{
			_normalization = normalization;
		}

		void setBackgroundSubType(std::string backgroundSubType1)
		{
			backgroundSubType = backgroundSubType1;
		}

		std::string getBackgroundSubType()
		{
			return backgroundSubType;
		}

		void setBackgroundSubValue(double backgroundSubValue1)
		{
			backgroundSubValue = backgroundSubValue1;
		}

		double getBackgroundSubValue()
		{
			return backgroundSubValue;
		}

		void setBackgroundSubDim(int backgroundSubDim1)
		{
			backgroundSubDim = backgroundSubDim1;
		}

		int getBackgroundSubDim()
		{
			return backgroundSubDim;
		}

	private:
		/**
	 * @brief Calculated paramId (from resolution).
	 */
		std::string _paramId;

		/**
	 * @brief Calculated tableParamsId (from resolution).
	 */
		std::map<std::string, std::string> _tableParamsId;

		/**
	 * @brief Flag that indicates the serie has X Axis
	 */
		bool _hasXAxis;

		/**
	 * @brief Flag that indicates the serie has Y Axis (tickplot has no Y axis)
	 */
		bool _hasYAxis;

		/**
	 * @brief Flag that indicates the spectro has Z Axis (= colorAxis)
	 */
		bool _hasZAxis;

		/**
	 * @brief Index definition (give by the request)
	 */
		std::string _indexDef;

		/*
	 * @brief List of components used by the spectro
	 */
		AMDA::Common::ParameterIndexComponentList _indexList;

		/*
	 * @brief Related dimension
	 */
		int _relatedDim;

		/*
	 * @brief Flag to know if 0 values must shown as Min Values in log. scale
	 */
		bool _useLog0AsMin;

		std::string _normalization;
	};

} /* namespace plot */

#endif /* SPECTROPROPERTIES_HH_ */