Blame view

src/ParamOutputImpl/Plot/DigitalAxis.hh 1.49 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
/*
 * DigitalAxis.hh
 *
 *  Created on: 22 nov. 2013
 *      Author: CS
 */

#ifndef DIGITALAXIS_HH_
#define DIGITALAXIS_HH_

46ca92d0   Elena.Budnik   add / move header...
11
12
#include <cmath>
#include <ctgmath>
fbe3c2bb   Benjamin Renard   First commit
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#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_ */