Blame view

src/ParamOutputImpl/Plot/ColorAxis.cc 1.48 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
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
/*
 * ColorAxis.cc
 *
 *  Created on: 30 jun. 2014
 *      Author: AKKA
 */

#include "ColorAxis.hh"

using namespace plot;

std::string ColorAxis::getPlotOpt()
{
	std::string options = DigitalAxis::getPlotOpt();

	//b & c : Draws edge of frame
	//options += "bc";

	//v: Write numeric labels for vertical axis parallel to the base of the graph,
	//    rather than parallel to the axis.
	options += "v";

	/*//Use custom labelling function to generate axis label text.
	options += "o";

	if (_scale == Scale::LOGARITHMIC)
		//l: Labels axis logarithmically
		options += "l";*/

	return options;
}

ColorAxis::Format ColorAxis::getFormat()
{
	//always used scientific format for color axis
	return DigitalAxis::Format::SCIENTIFIC;
}

ee9a5027   Erdogan Furkan   Kernel part to ge...
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
void ColorAxis::writeContext(ContextFileWriter& writer) {
	writer.startElement("axis");

	writer.addAttribute("id", _id.c_str());

	writer.addAttribute("logarithmic", (_scale == Scale::LOGARITHMIC) ? "true" : "false");

	std::ostringstream outMin;
	outMin << std::setprecision(12) << getRange().getMin();
	std::ostringstream outMax;
	outMax << std::setprecision(12) << getRange().getMax();

	writer.addAttribute("min", outMin.str().c_str());
	writer.addAttribute("max", outMax.str().c_str());
	std::ostringstream colorListStr;
	
	for (unsigned int i(0); i < _colorsList.size(); ++i){
		colorListStr << "[" <<  _colorsList[i][0] << "," <<  _colorsList[i][1] << "," << _colorsList[i][2] << "]|";
	}
	writer.addAttribute("colorsList",colorListStr.str().c_str());

	writer.endElement();
}