DigitalAxis.hh 1.46 KB
/*
 * DigitalAxis.hh
 *
 *  Created on: 22 nov. 2013
 *      Author: CS
 */

#ifndef DIGITALAXIS_HH_
#define DIGITALAXIS_HH_

#include "Axis.hh"

namespace plot {

void generateDigitalLabel(PLINT axis, PLFLT value, char *label, PLINT length, PLPointer data);
void generateNoDigitalLabel(PLINT axis, PLFLT value, char *label, PLINT length,	PLPointer data);

class DigitalAxis: public plot::Axis {

public:
	static const int MAX_DIGIT_NUMBER;
	static const int SCIENTIFIC_FORMAT_PRECISION;
	static const int STANDARD_FORMAT_PRECISION;
	/**
	 * Constant used to reinterpret log10(0).
	 */
	static const int LOG_CONSTANT;

	enum Format {
		STANDARD, SCIENTIFIC
	};

	DigitalAxis() :
			Axis() {
		if (_showTickMark == true)
			_labelGenerator->_function = generateDigitalLabel;
		else
			_labelGenerator->_function = generateNoDigitalLabel;
	}

	DigitalAxis(const DigitalAxis& axis) :
			Axis(axis) {
		if (_showTickMark == true)
			_labelGenerator->_function = generateDigitalLabel;
		else
			_labelGenerator->_function = generateNoDigitalLabel;
	}

	virtual ~DigitalAxis() {
	}

	void dump(std::ostream& out) {
		Axis::dump(out);
		out << std::endl;
	}

	virtual std::string getPlotOpt();

	virtual Range getRange();

	virtual Format getFormat();

	virtual std::pair<int, int> getTickMarkSize();

	/**
	 * @overrides Axis::getComputedValues
	 */
	virtual double* getComputedValues(double* values_, int size_, double min, double max);

};

} /* namespace plot */

#endif /* DIGITALAXIS_HH_ */