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
|
#include "curve.h"
#include <ascend/compiler/plot.h>
#include <stdexcept>
using namespace std;
Curve::Curve(const Instanc &i) : Instanc(i){
cerr << "Created curve";
// may through 'child not found'...
Instanc point_array = getChild(PLOT_POINT);
vector<Instanc> pa = point_array.getChildren();
vector<Instanc>::iterator pai;
for(pai = pa.begin(); pai < pa.end() ; ++pai){
Instanc xinst = pai->getChild(PLOT_XPOINT);
Instanc yinst = pai->getChild(PLOT_YPOINT);
if(xinst.isAssigned() && yinst.isAssigned()){
x.push_back(xinst.getRealValue());
y.push_back(yinst.getRealValue());
}
}
}
Curve::Curve(){
throw runtime_error("not allowed");
}
Curve::Curve(const Curve &old) : Instanc(old.getInternalType()){
x = old.x;
y = old.y;
}
const string
Curve::getLegend() const{
Instanc li = getChild(PLOT_LEGEND);
if(li.isAssigned()){
return li.getSymbolValue().toString();
}
return "";
}
const string
Curve::getFormat() const{
Instanc li = getChild(PLOT_FORMAT);
if(li.isAssigned()){
return li.getSymbolValue().toString();
}
return "";
}
|