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
|
<?php
class GRAPHAxes implements Iterator {
var $req;
var $default_axis; // Default axis
var $axes; // Already created axes
var $aids; // Sequence of axis ids
var $cur; // Iterator
var $axis_info; // Configured axes
const PRIVATE_AXES = 0x0001;
const EXTRA_ONLY = 0x0002;
function __construct(REQUEST $props = NULL, $flags = 0) {
global $ADEI_AXES;
if ($props) $this->req = $props;
else $this->req = new REQUEST();
$this->default_axis = false;
$this->axes = array();
$this->aids = array();
if ($flags&GRAPHAxes::EXTRA_ONLY)
$this->axis_info = array();
else
$this->axis_info = $ADEI_AXES;
}
function Add(GRAPHAxes $axes) {
// This is right order to overwrite similar extra axes with main ones
$this->axis_info = array_merge($axes->axis_info, $this->axis_info);
}
function GetAxesInfo() {
return $this->axis_info;
}
function GetAxis($aid = false) {
//echo "Axis: $aid\n";
if ((!$aid)&&($aid !== 0)) {
if (!$this->default_axis) {
$this->default_axis = new GRAPHAxis($this->axis_info[0], $this->req->props);
}
return $this->default_axis;
} else {
if (isset($this->axes[$aid])) {
return $this->axes[$aid];
} else {
$axis = new GRAPHAxis($this->axis_info[$aid], $this->req->props, $aid);
$this->aids[] = $aid;
$this->axes[$aid] = $axis;
}
}
return $axis;
}
function GetAxisByPosition($i = 0) {
if ($this->default_axis) {
if ($i) $i--;
else return $this->default_axis;
}
if (!isset($this->aids[$i])) {
throw new ADEIException(translate("Access to axis number %d is failed, only %d axis is registered", $i, $this->GetAxesNumber()));
}
return $this->axes[$this->aids[$i]];
}
function ListAxes() {
if ($this->default_axis) return array_merge(false, $this->aids);
return $this->aids;
}
function ListCustomAxes() {
return $this->aids;
}
function GetAxesNumber() {
if ($this->default_axis) return sizeof($this->aids) + 1;
return sizeof($this->aids);
}
function rewind() {
if ($this->default_axis) $this->cur = 0;
else $this->cur = 1;
}
function valid() {
return ((!$this->cur)||(isset($this->aids[$this->cur-1])));
}
function current() {
if ($this->cur > 0) {
return $this->axes[$this->aids[$this->cur - 1]];
} else {
return $this->default_axis;
}
}
function key() {
if ($this->default_axis) return $this->cur;
else return $this->cur - 1;
}
function next() {
++$this->cur;
}
function Enumerate() {
if ($this->default_axis) {
$num = sizeof($this->aids) + 1;
} else {
$num = sizeof($this->aids);
}
$i = 0;
foreach ($this as $axis) {
$axis->SetPosition($i++, $num);
}
}
function Normalize() {
/* DS: We could like to split default axis in order to prevent overfill
of the screen */
foreach ($this as $axis) {
$axis->Normalize();
}
}
}
?>
|