RequestOutputPlotPageNodeClass.php
3.2 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
require_once("RequestOutputPlotPanelNodeClass.php");
require_once("RequestOutputPlotLayoutNodeClass.php");
define ("REQUESTOUTPUTPLOTPAGE_NAME", "page");
define ("REQUESTOUTPUTPLOTPAGE_TITLE", "title");
define ("REQUESTOUTPUTPLOTPAGE_FORMAT", "format");
define ("REQUESTOUTPUTPLOTPAGE_DIMENSION", "dimension");
define ("REQUESTOUTPUTPLOTPAGE_ORIENTATION", "orientation");
define ("REQUESTOUTPUTPLOTPAGE_MODE", "mode");
abstract class RequestOutputPlotPageFormatEnum
{
const PNG = "png";
const PDF = "pdf";
const PS = "ps";
const SVG = "svg";
}
abstract class RequestOutputPlotPageDimensionEnum
{
const ISO_A4 = "ISO A4";
const US_LETTER = "US letter";
}
abstract class RequestOutputPlotPageOrientationEnum
{
const LANDSCAPE = "landscape";
const PORTRAIT = "portrait";
}
abstract class RequestOutputPlotPageModeEnum
{
const COLOR = "color";
const GRAYSCALE = "grayscale";
}
/**
* @class RequestOutputPlotNodeClass
* @brief Definition of a page for a plot request
* @details
*/
class RequestOutputPlotPageNodeClass extends NodeClass
{
public function __construct()
{
parent::__construct(REQUESTOUTPUTPLOTPAGE_NAME);
//default attributes
$this->setFormat(RequestOutputPlotPageFormatEnum::PNG);
$this->setDimension(RequestOutputPlotPageDimensionEnum::ISO_A4);
$this->setOrientation(RequestOutputPlotPageOrientationEnum::PORTRAIT);
$this->setMode(RequestOutputPlotPageModeEnum::COLOR);
}
public function setTitle($title)
{
$node = $this->getChildInstanceByName(REQUESTOUTPUTPLOTPAGE_TITLE, true);
$node->setValue($title);
}
public function getTitle()
{
$node = $this->getChildInstanceByName(REQUESTOUTPUTPLOTPAGE_TITLE);
return (($node == NULL) ? "" : $node->getValue());
}
/* ToDo margin */
/* ToDo font */
public function getLayout()
{
$node = $this->getFirstChildByName(REQUESTOUTPUTPLOTLAYOUT_NAME);
if (!isset($node))
{
$node = new RequestOutputPlotLayoutNodeClass();
$this->addChild($node);
}
return $node;
}
/* ToDo panelDefaults */
public function addPanel()
{
$node = new RequestOutputPlotPanelNodeClass();
$this->addChild($node);
return $node;
}
public function getPanels()
{
return $this->getChildrenByName(REQUESTOUTPUTPLOTPANEL_NAME);
}
public function setFormat($format)
{
$this->setAttribute(REQUESTOUTPUTPLOTPAGE_FORMAT, $format);
}
public function getFormat()
{
return $this->getAttribute(REQUESTOUTPUTPLOTPAGE_FORMAT);
}
public function setDimension($dimension)
{
$this->setAttribute(REQUESTOUTPUTPLOTPAGE_DIMENSION, $dimension);
}
public function getDimension()
{
return $this->getAttribute(REQUESTOUTPUTPLOTPAGE_DIMENSION);
}
public function setOrientation($orientation)
{
$this->setAttribute(REQUESTOUTPUTPLOTPAGE_ORIENTATION, $orientation);
}
public function getOrientation()
{
return $this->getAttribute(REQUESTOUTPUTPLOTPAGE_ORIENTATION);
}
public function setMode($mode)
{
$this->setAttribute(REQUESTOUTPUTPLOTPAGE_MODE, $mode);
}
public function getMode()
{
return $this->getAttribute(REQUESTOUTPUTPLOTPAGE_MODE);
}
/* ToDo plot size and margins */
}
?>