~jdpipe/ascend/trunk-old

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
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
77
78
#include "plot.h"
#include "curve.h"

#include <ascend/compiler/plot.h>
#include <stdexcept>
#include <iostream>
using namespace std;

Plot::Plot(const Instanc &i) : Instanc(i){
	cerr << "Creating plot..." << endl;
	// create Curve objects as required:
	
	Instanc curve_array = getChild(PLOT_CURVE);
	vector<Instanc> cc = curve_array.getChildren();
	vector<Instanc>::iterator cci;
	for(cci=cc.begin();cci<cc.end(); ++cci){
		curves.push_back( Curve(*cci) );
	}
}

Plot::Plot(){
	throw runtime_error("Not allowed");
}

Plot::Plot(const Plot &old) : Instanc(old.i), curves(old.curves){
	//nothing
}

const string
Plot::getTitle() const{
	return getChild(PLOT_TITLE).getValueAsString();
}

const string
Plot::getXLabel() const{
	return getChild(PLOT_XLABEL).getValueAsString();
}

const string
Plot::getYLabel() const{
	return getChild(PLOT_YLABEL).getValueAsString();
}

const int
Plot::getLegendPosition() const{
	return getChild(PLOT_LEGENDPOSITION).getIntValue();
}

const bool
Plot::isXLog() const{
	return getChild(PLOT_XLOG).getBoolValue();
}

const bool
Plot::isYLog() const{
	return getChild(PLOT_YLOG).getBoolValue();
}

const double
Plot::getXLow() const{
	return getChild(PLOT_XLO).getRealValue();
}

const double
Plot::getXHigh() const{
	return getChild(PLOT_XHI).getRealValue();
}

const double
Plot::getYLow() const{
	return getChild(PLOT_YLO).getRealValue();
}

const double
Plot::getYHigh() const{
	return getChild(PLOT_YHI).getRealValue();
}