|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* JPGraph v4.0.3 |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Amenadiel\JpGraph\Plot; |
|
8
|
|
|
|
|
9
|
|
|
use Amenadiel\JpGraph\Graph; |
|
10
|
|
|
use Amenadiel\JpGraph\Image; |
|
11
|
|
|
use Amenadiel\JpGraph\Text; |
|
12
|
|
|
use Amenadiel\JpGraph\Util; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* File: JPGRAPH_PLOTMARK.PHP |
|
16
|
|
|
* // Description: Class file. Handles plotmarks |
|
17
|
|
|
* // Created: 2003-03-21 |
|
18
|
|
|
* // Ver: $Id: jpgraph_plotmark.inc.php 1106 2009-02-22 20:16:35Z ljp $ |
|
19
|
|
|
* // |
|
20
|
|
|
* // Copyright (c) Asial Corporation. All rights reserved. |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @class PlotMark |
|
25
|
|
|
* // Description: Handles the plot marks in graphs |
|
26
|
|
|
*/ |
|
27
|
|
|
class PlotMark |
|
28
|
|
|
{ |
|
29
|
|
|
public $title; |
|
30
|
|
|
public $show = true; |
|
31
|
|
|
public $type; |
|
32
|
|
|
public $weight = 1; |
|
33
|
|
|
public $iFormatCallback = ''; |
|
34
|
|
|
public $iFormatCallback2 = ''; |
|
35
|
|
|
public $fill_color = 'blue'; |
|
36
|
|
|
public $color = 'black'; |
|
37
|
|
|
public $width = 4; |
|
38
|
|
|
private $yvalue; |
|
39
|
|
|
private $xvalue = ''; |
|
40
|
|
|
private $csimtarget; |
|
41
|
|
|
private $csimwintarget = ''; |
|
42
|
|
|
private $csimalt; |
|
43
|
|
|
private $csimareas; |
|
44
|
|
|
private $markimg = ''; |
|
45
|
|
|
private $iScale = 1.0; |
|
46
|
|
|
private $oldfilename = ''; |
|
47
|
|
|
private $iFileName = ''; |
|
48
|
|
|
private $imgdata_balls; |
|
49
|
|
|
private $imgdata_diamonds; |
|
50
|
|
|
private $imgdata_squares; |
|
51
|
|
|
private $imgdata_bevels; |
|
52
|
|
|
private $imgdata_stars; |
|
53
|
|
|
private $imgdata_pushpins; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* CONSTRUCTOR. |
|
57
|
|
|
*/ |
|
58
|
|
|
public function __construct() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->title = new Text\Text(); |
|
61
|
|
|
$this->title->Hide(); |
|
62
|
|
|
$this->csimareas = ''; |
|
63
|
|
|
$this->type = -1; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* PUBLIC METHODS. |
|
68
|
|
|
* |
|
69
|
|
|
* @param mixed $aType |
|
70
|
|
|
* @param mixed $aFileName |
|
71
|
|
|
* @param mixed $aScale |
|
72
|
|
|
*/ |
|
73
|
|
|
public function SetType($aType, $aFileName = '', $aScale = 1.0) |
|
74
|
|
|
{ |
|
75
|
|
|
$this->type = $aType; |
|
76
|
|
|
if ($aType == MARK_IMG && $aFileName == '') { |
|
77
|
|
|
Util\JpGraphError::RaiseL(23003); //('A filename must be specified if you set the mark type to MARK_IMG.'); |
|
78
|
|
|
} |
|
79
|
|
|
$this->iFileName = $aFileName; |
|
80
|
|
|
$this->iScale = $aScale; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function SetCallback($aFunc) |
|
84
|
|
|
{ |
|
85
|
|
|
$this->iFormatCallback = $aFunc; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function SetCallbackYX($aFunc) |
|
89
|
|
|
{ |
|
90
|
|
|
$this->iFormatCallback2 = $aFunc; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function GetType() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->type; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function SetColor($aColor) |
|
99
|
|
|
{ |
|
100
|
|
|
$this->color = $aColor; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function SetFillColor($aFillColor) |
|
104
|
|
|
{ |
|
105
|
|
|
$this->fill_color = $aFillColor; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function SetWeight($aWeight) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->weight = $aWeight; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
// Synonym for SetWidth() |
|
114
|
|
|
public function SetSize($aWidth) |
|
115
|
|
|
{ |
|
116
|
|
|
$this->width = $aWidth; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function SetWidth($aWidth) |
|
120
|
|
|
{ |
|
121
|
|
|
$this->width = $aWidth; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
public function SetDefaultWidth() |
|
125
|
|
|
{ |
|
126
|
|
|
switch ($this->type) { |
|
127
|
|
|
case MARK_CIRCLE: |
|
128
|
|
|
case MARK_FILLEDCIRCLE: |
|
129
|
|
|
$this->width = 4; |
|
130
|
|
|
|
|
131
|
|
|
break; |
|
132
|
|
|
default: |
|
133
|
|
|
$this->width = 7; |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
public function GetWidth() |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->width; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
public function Hide($aHide = true) |
|
143
|
|
|
{ |
|
144
|
|
|
$this->show = !$aHide; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
public function Show($aShow = true) |
|
148
|
|
|
{ |
|
149
|
|
|
$this->show = $aShow; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
public function SetCSIMAltVal($aY, $aX = '') |
|
153
|
|
|
{ |
|
154
|
|
|
$this->yvalue = $aY; |
|
155
|
|
|
$this->xvalue = $aX; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
public function SetCSIMTarget($aTarget, $aWinTarget = '') |
|
159
|
|
|
{ |
|
160
|
|
|
$this->csimtarget = $aTarget; |
|
161
|
|
|
$this->csimwintarget = $aWinTarget; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
public function SetCSIMAlt($aAlt) |
|
165
|
|
|
{ |
|
166
|
|
|
$this->csimalt = $aAlt; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
public function GetCSIMAreas() |
|
170
|
|
|
{ |
|
171
|
|
|
return $this->csimareas; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
public function AddCSIMPoly($aPts) |
|
175
|
|
|
{ |
|
176
|
|
|
$coords = round($aPts[0]) . ', ' . round($aPts[1]); |
|
177
|
|
|
$n = safe_count($aPts) / 2; |
|
178
|
|
|
for ($i = 1; $i < $n; ++$i) { |
|
179
|
|
|
$coords .= ', ' . round($aPts[2 * $i]) . ', ' . round($aPts[2 * $i + 1]); |
|
180
|
|
|
} |
|
181
|
|
|
$this->csimareas = ''; |
|
182
|
|
|
if (!empty($this->csimtarget)) { |
|
183
|
|
|
$this->csimareas .= "<area shape=\"poly\" coords=\"${coords}\" "; |
|
184
|
|
|
$this->csimareas .= 'href="' . htmlentities($this->csimtarget) . '"'; |
|
185
|
|
|
|
|
186
|
|
|
if (!empty($this->csimwintarget)) { |
|
187
|
|
|
$this->csimareas .= ' target="' . $this->csimwintarget . '" '; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
if (!empty($this->csimalt)) { |
|
191
|
|
|
$tmp = sprintf($this->csimalt, $this->yvalue, $this->xvalue); |
|
192
|
|
|
$this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\""; |
|
193
|
|
|
} |
|
194
|
|
|
$this->csimareas .= " />\n"; |
|
195
|
|
|
} |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
public function AddCSIMCircle($x, $y, $r) |
|
199
|
|
|
{ |
|
200
|
|
|
$x = round($x); |
|
201
|
|
|
$y = round($y); |
|
202
|
|
|
$r = round($r); |
|
203
|
|
|
$this->csimareas = ''; |
|
204
|
|
|
if (!empty($this->csimtarget)) { |
|
205
|
|
|
$this->csimareas .= "<area shape=\"circle\" coords=\"${x},${y},${r}\" "; |
|
206
|
|
|
$this->csimareas .= 'href="' . htmlentities($this->csimtarget) . '"'; |
|
207
|
|
|
|
|
208
|
|
|
if (!empty($this->csimwintarget)) { |
|
209
|
|
|
$this->csimareas .= ' target="' . $this->csimwintarget . '" '; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
if (!empty($this->csimalt)) { |
|
213
|
|
|
$tmp = sprintf($this->csimalt, $this->yvalue, $this->xvalue); |
|
214
|
|
|
$this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; |
|
215
|
|
|
} |
|
216
|
|
|
$this->csimareas .= " />\n"; |
|
217
|
|
|
} |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
public function Stroke($img, $x, $y) |
|
221
|
|
|
{ |
|
222
|
|
|
if (!$this->show) { |
|
223
|
|
|
return; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
if ($this->iFormatCallback != '' || $this->iFormatCallback2 != '') { |
|
227
|
|
|
if ($this->iFormatCallback != '') { |
|
228
|
|
|
$f = $this->iFormatCallback; |
|
229
|
|
|
list($width, $color, $fcolor) = call_user_func($f, $this->yvalue); |
|
230
|
|
|
$filename = $this->iFileName; |
|
231
|
|
|
$imgscale = $this->iScale; |
|
232
|
|
|
} else { |
|
233
|
|
|
$f = $this->iFormatCallback2; |
|
234
|
|
|
list($width, $color, $fcolor, $filename, $imgscale) = call_user_func($f, $this->yvalue, $this->xvalue); |
|
235
|
|
|
if ($filename == '') { |
|
236
|
|
|
$filename = $this->iFileName; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
if ($imgscale == '') { |
|
240
|
|
|
$imgscale = $this->iScale; |
|
241
|
|
|
} |
|
242
|
|
|
} |
|
243
|
|
|
|
|
244
|
|
|
if ($width == '') { |
|
245
|
|
|
$width = $this->width; |
|
246
|
|
|
} |
|
247
|
|
|
|
|
248
|
|
|
if ($color == '') { |
|
249
|
|
|
$color = $this->color; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
if ($fcolor == '') { |
|
253
|
|
|
$fcolor = $this->fill_color; |
|
254
|
|
|
} |
|
255
|
|
|
} else { |
|
256
|
|
|
$fcolor = $this->fill_color; |
|
257
|
|
|
$color = $this->color; |
|
258
|
|
|
$width = $this->width; |
|
259
|
|
|
$filename = $this->iFileName; |
|
260
|
|
|
$imgscale = $this->iScale; |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
if ($this->type == MARK_IMG || |
|
264
|
|
|
($this->type >= MARK_FLAG1 && $this->type <= MARK_FLAG4) || |
|
265
|
|
|
$this->type >= MARK_IMG_PUSHPIN) { |
|
266
|
|
|
// Note: For the builtin images we use the "filename" parameter |
|
267
|
|
|
// to denote the color |
|
268
|
|
|
$anchor_x = 0.5; |
|
269
|
|
|
$anchor_y = 0.5; |
|
270
|
|
|
switch ($this->type) { |
|
271
|
|
|
case MARK_FLAG1: |
|
272
|
|
|
case MARK_FLAG2: |
|
273
|
|
|
case MARK_FLAG3: |
|
274
|
|
|
case MARK_FLAG4: |
|
275
|
|
|
$this->markimg = Util\FlagCache::GetFlagImgByName($this->type - MARK_FLAG1 + 1, $filename); |
|
276
|
|
|
|
|
277
|
|
|
break; |
|
278
|
|
|
case MARK_IMG: |
|
279
|
|
|
// Load an image and use that as a marker |
|
280
|
|
|
// Small optimization, if we have already read an image don't |
|
281
|
|
|
// waste time reading it again. |
|
282
|
|
|
if ($this->markimg == '' || !($this->oldfilename === $filename)) { |
|
283
|
|
|
$this->markimg = Graph\Graph::LoadBkgImage('', $filename); |
|
284
|
|
|
$this->oldfilename = $filename; |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
break; |
|
288
|
|
|
case MARK_IMG_PUSHPIN: |
|
289
|
|
|
case MARK_IMG_SPUSHPIN: |
|
290
|
|
|
case MARK_IMG_LPUSHPIN: |
|
291
|
|
|
if ($this->imgdata_pushpins == null) { |
|
292
|
|
|
$this->imgdata_pushpins = new Image\ImgData_PushPins(); |
|
293
|
|
|
} |
|
294
|
|
|
$this->markimg = $this->imgdata_pushpins->GetImg($this->type, $filename); |
|
295
|
|
|
list($anchor_x, $anchor_y) = $this->imgdata_pushpins->GetAnchor(); |
|
296
|
|
|
|
|
297
|
|
|
break; |
|
298
|
|
|
case MARK_IMG_SQUARE: |
|
299
|
|
|
if ($this->imgdata_squares == null) { |
|
300
|
|
|
$this->imgdata_squares = new Image\ImgData_Squares(); |
|
301
|
|
|
} |
|
302
|
|
|
$this->markimg = $this->imgdata_squares->GetImg($this->type, $filename); |
|
303
|
|
|
list($anchor_x, $anchor_y) = $this->imgdata_squares->GetAnchor(); |
|
304
|
|
|
|
|
305
|
|
|
break; |
|
306
|
|
|
case MARK_IMG_STAR: |
|
307
|
|
|
if ($this->imgdata_stars == null) { |
|
308
|
|
|
$this->imgdata_stars = new Image\ImgData_Stars(); |
|
309
|
|
|
} |
|
310
|
|
|
$this->markimg = $this->imgdata_stars->GetImg($this->type, $filename); |
|
311
|
|
|
list($anchor_x, $anchor_y) = $this->imgdata_stars->GetAnchor(); |
|
312
|
|
|
|
|
313
|
|
|
break; |
|
314
|
|
|
case MARK_IMG_BEVEL: |
|
315
|
|
|
if ($this->imgdata_bevels == null) { |
|
316
|
|
|
$this->imgdata_bevels = new Image\ImgData_Bevels(); |
|
317
|
|
|
} |
|
318
|
|
|
$this->markimg = $this->imgdata_bevels->GetImg($this->type, $filename); |
|
319
|
|
|
list($anchor_x, $anchor_y) = $this->imgdata_bevels->GetAnchor(); |
|
320
|
|
|
|
|
321
|
|
|
break; |
|
322
|
|
|
case MARK_IMG_DIAMOND: |
|
323
|
|
|
if ($this->imgdata_diamonds == null) { |
|
324
|
|
|
$this->imgdata_diamonds = new Image\ImgData_Diamonds(); |
|
325
|
|
|
} |
|
326
|
|
|
$this->markimg = $this->imgdata_diamonds->GetImg($this->type, $filename); |
|
327
|
|
|
list($anchor_x, $anchor_y) = $this->imgdata_diamonds->GetAnchor(); |
|
328
|
|
|
|
|
329
|
|
|
break; |
|
330
|
|
|
case MARK_IMG_BALL: |
|
331
|
|
|
case MARK_IMG_SBALL: |
|
332
|
|
|
case MARK_IMG_MBALL: |
|
333
|
|
|
case MARK_IMG_LBALL: |
|
334
|
|
|
if ($this->imgdata_balls == null) { |
|
335
|
|
|
$this->imgdata_balls = new Image\ImgData_Balls(); |
|
336
|
|
|
} |
|
337
|
|
|
$this->markimg = $this->imgdata_balls->GetImg($this->type, $filename); |
|
338
|
|
|
list($anchor_x, $anchor_y) = $this->imgdata_balls->GetAnchor(); |
|
339
|
|
|
|
|
340
|
|
|
break; |
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
$w = $img->GetWidth($this->markimg); |
|
344
|
|
|
$h = $img->GetHeight($this->markimg); |
|
345
|
|
|
|
|
346
|
|
|
$dw = round($imgscale * $w); |
|
347
|
|
|
$dh = round($imgscale * $h); |
|
348
|
|
|
|
|
349
|
|
|
// Do potential rotation |
|
350
|
|
|
list($x, $y) = $img->Rotate($x, $y); |
|
351
|
|
|
|
|
352
|
|
|
$dx = round($x - $dw * $anchor_x); |
|
353
|
|
|
$dy = round($y - $dh * $anchor_y); |
|
354
|
|
|
|
|
355
|
|
|
$this->width = max($dx, $dy); |
|
356
|
|
|
|
|
357
|
|
|
$img->Copy($this->markimg, $dx, $dy, 0, 0, $dw, $dh, $w, $h); |
|
358
|
|
|
if (!empty($this->csimtarget)) { |
|
359
|
|
|
$this->csimareas = '<area shape="rect" coords="' . |
|
360
|
|
|
$dx . ',' . $dy . ',' . round($dx + $dw) . ',' . round($dy + $dh) . '" ' . |
|
361
|
|
|
'href="' . htmlentities($this->csimtarget) . '"'; |
|
362
|
|
|
|
|
363
|
|
|
if (!empty($this->csimwintarget)) { |
|
364
|
|
|
$this->csimareas .= ' target="' . $this->csimwintarget . '" '; |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
if (!empty($this->csimalt)) { |
|
368
|
|
|
$tmp = sprintf($this->csimalt, $this->yvalue, $this->xvalue); |
|
369
|
|
|
$this->csimareas .= " title=\"${tmp}\" alt=\"${tmp}\" "; |
|
370
|
|
|
} |
|
371
|
|
|
$this->csimareas .= " />\n"; |
|
372
|
|
|
} |
|
373
|
|
|
|
|
374
|
|
|
// Stroke title |
|
375
|
|
|
$this->title->Align('center', 'top'); |
|
376
|
|
|
$this->title->Stroke($img, $x, $y + round($dh / 2)); |
|
377
|
|
|
|
|
378
|
|
|
return; |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
$weight = $this->weight; |
|
382
|
|
|
$dx = round($width / 2, 0); |
|
383
|
|
|
$dy = round($width / 2, 0); |
|
384
|
|
|
$pts = 0; |
|
385
|
|
|
|
|
386
|
|
|
switch ($this->type) { |
|
387
|
|
|
case MARK_SQUARE: |
|
388
|
|
|
$c[] = $x - $dx; |
|
|
|
|
|
|
389
|
|
|
$c[] = $y - $dy; |
|
390
|
|
|
$c[] = $x + $dx; |
|
391
|
|
|
$c[] = $y - $dy; |
|
392
|
|
|
$c[] = $x + $dx; |
|
393
|
|
|
$c[] = $y + $dy; |
|
394
|
|
|
$c[] = $x - $dx; |
|
395
|
|
|
$c[] = $y + $dy; |
|
396
|
|
|
$c[] = $x - $dx; |
|
397
|
|
|
$c[] = $y - $dy; |
|
398
|
|
|
$pts = 5; |
|
399
|
|
|
|
|
400
|
|
|
break; |
|
401
|
|
|
case MARK_UTRIANGLE: |
|
402
|
|
|
++$dx; ++$dy; |
|
403
|
|
|
$c[] = $x - $dx; |
|
404
|
|
|
$c[] = $y + 0.87 * $dy; // tan(60)/2*$dx |
|
405
|
|
|
$c[] = $x; |
|
406
|
|
|
$c[] = $y - 0.87 * $dy; |
|
407
|
|
|
$c[] = $x + $dx; |
|
408
|
|
|
$c[] = $y + 0.87 * $dy; |
|
409
|
|
|
$c[] = $x - $dx; |
|
410
|
|
|
$c[] = $y + 0.87 * $dy; // tan(60)/2*$dx |
|
411
|
|
|
$pts = 4; |
|
412
|
|
|
|
|
413
|
|
|
break; |
|
414
|
|
|
case MARK_DTRIANGLE: |
|
415
|
|
|
++$dx; ++$dy; |
|
416
|
|
|
$c[] = $x; |
|
417
|
|
|
$c[] = $y + 0.87 * $dy; // tan(60)/2*$dx |
|
418
|
|
|
$c[] = $x - $dx; |
|
419
|
|
|
$c[] = $y - 0.87 * $dy; |
|
420
|
|
|
$c[] = $x + $dx; |
|
421
|
|
|
$c[] = $y - 0.87 * $dy; |
|
422
|
|
|
$c[] = $x; |
|
423
|
|
|
$c[] = $y + 0.87 * $dy; // tan(60)/2*$dx |
|
424
|
|
|
$pts = 4; |
|
425
|
|
|
|
|
426
|
|
|
break; |
|
427
|
|
|
case MARK_DIAMOND: |
|
428
|
|
|
$c[] = $x; |
|
429
|
|
|
$c[] = $y + $dy; |
|
430
|
|
|
$c[] = $x - $dx; |
|
431
|
|
|
$c[] = $y; |
|
432
|
|
|
$c[] = $x; |
|
433
|
|
|
$c[] = $y - $dy; |
|
434
|
|
|
$c[] = $x + $dx; |
|
435
|
|
|
$c[] = $y; |
|
436
|
|
|
$c[] = $x; |
|
437
|
|
|
$c[] = $y + $dy; |
|
438
|
|
|
$pts = 5; |
|
439
|
|
|
|
|
440
|
|
|
break; |
|
441
|
|
|
case MARK_LEFTTRIANGLE: |
|
442
|
|
|
$c[] = $x; |
|
443
|
|
|
$c[] = $y; |
|
444
|
|
|
$c[] = $x; |
|
445
|
|
|
$c[] = $y + 2 * $dy; |
|
446
|
|
|
$c[] = $x + $dx * 2; |
|
447
|
|
|
$c[] = $y; |
|
448
|
|
|
$c[] = $x; |
|
449
|
|
|
$c[] = $y; |
|
450
|
|
|
$pts = 4; |
|
451
|
|
|
|
|
452
|
|
|
break; |
|
453
|
|
|
case MARK_RIGHTTRIANGLE: |
|
454
|
|
|
$c[] = $x - $dx * 2; |
|
455
|
|
|
$c[] = $y; |
|
456
|
|
|
$c[] = $x; |
|
457
|
|
|
$c[] = $y + 2 * $dy; |
|
458
|
|
|
$c[] = $x; |
|
459
|
|
|
$c[] = $y; |
|
460
|
|
|
$c[] = $x - $dx * 2; |
|
461
|
|
|
$c[] = $y; |
|
462
|
|
|
$pts = 4; |
|
463
|
|
|
|
|
464
|
|
|
break; |
|
465
|
|
|
case MARK_FLASH: |
|
466
|
|
|
$dy *= 2; |
|
467
|
|
|
$c[] = $x + $dx / 2; |
|
468
|
|
|
$c[] = $y - $dy; |
|
469
|
|
|
$c[] = $x - $dx + $dx / 2; |
|
470
|
|
|
$c[] = $y + $dy * 0.7 - $dy; |
|
471
|
|
|
$c[] = $x + $dx / 2; |
|
472
|
|
|
$c[] = $y + $dy * 1.3 - $dy; |
|
473
|
|
|
$c[] = $x - $dx + $dx / 2; |
|
474
|
|
|
$c[] = $y + 2 * $dy - $dy; |
|
475
|
|
|
$img->SetLineWeight($weight); |
|
476
|
|
|
$img->SetColor($color); |
|
477
|
|
|
$img->Polygon($c); |
|
478
|
|
|
$img->SetLineWeight(1); |
|
479
|
|
|
$this->AddCSIMPoly($c); |
|
480
|
|
|
|
|
481
|
|
|
break; |
|
482
|
|
|
} |
|
483
|
|
|
|
|
484
|
|
|
if ($pts > 0) { |
|
485
|
|
|
$this->AddCSIMPoly($c); |
|
|
|
|
|
|
486
|
|
|
$img->SetLineWeight($weight); |
|
487
|
|
|
$img->SetColor($fcolor); |
|
488
|
|
|
$img->FilledPolygon($c); |
|
489
|
|
|
$img->SetColor($color); |
|
490
|
|
|
$img->Polygon($c); |
|
491
|
|
|
$img->SetLineWeight(1); |
|
492
|
|
|
} elseif ($this->type == MARK_CIRCLE) { |
|
493
|
|
|
$img->SetColor($color); |
|
494
|
|
|
$img->Circle($x, $y, $width); |
|
495
|
|
|
$this->AddCSIMCircle($x, $y, $width); |
|
496
|
|
|
} elseif ($this->type == MARK_FILLEDCIRCLE) { |
|
497
|
|
|
$img->SetColor($fcolor); |
|
498
|
|
|
$img->FilledCircle($x, $y, $width); |
|
499
|
|
|
$img->SetColor($color); |
|
500
|
|
|
$img->Circle($x, $y, $width); |
|
501
|
|
|
$this->AddCSIMCircle($x, $y, $width); |
|
502
|
|
|
} elseif ($this->type == MARK_CROSS) { |
|
503
|
|
|
// Oversize by a pixel to match the X |
|
504
|
|
|
$img->SetColor($color); |
|
505
|
|
|
$img->SetLineWeight($weight); |
|
506
|
|
|
$img->Line($x, $y + $dy + 1, $x, $y - $dy - 1); |
|
507
|
|
|
$img->Line($x - $dx - 1, $y, $x + $dx + 1, $y); |
|
508
|
|
|
$this->AddCSIMCircle($x, $y, $dx); |
|
509
|
|
|
} elseif ($this->type == MARK_X) { |
|
510
|
|
|
$img->SetColor($color); |
|
511
|
|
|
$img->SetLineWeight($weight); |
|
512
|
|
|
$img->Line($x + $dx, $y + $dy, $x - $dx, $y - $dy); |
|
513
|
|
|
$img->Line($x - $dx, $y + $dy, $x + $dx, $y - $dy); |
|
514
|
|
|
$this->AddCSIMCircle($x, $y, $dx + $dy); |
|
515
|
|
|
} elseif ($this->type == MARK_STAR) { |
|
516
|
|
|
$img->SetColor($color); |
|
517
|
|
|
$img->SetLineWeight($weight); |
|
518
|
|
|
$img->Line($x + $dx, $y + $dy, $x - $dx, $y - $dy); |
|
519
|
|
|
$img->Line($x - $dx, $y + $dy, $x + $dx, $y - $dy); |
|
520
|
|
|
// Oversize by a pixel to match the X |
|
521
|
|
|
$img->Line($x, $y + $dy + 1, $x, $y - $dy - 1); |
|
522
|
|
|
$img->Line($x - $dx - 1, $y, $x + $dx + 1, $y); |
|
523
|
|
|
$this->AddCSIMCircle($x, $y, $dx + $dy); |
|
524
|
|
|
} |
|
525
|
|
|
|
|
526
|
|
|
// Stroke title |
|
527
|
|
|
$this->title->Align('center', 'center'); |
|
528
|
|
|
$this->title->Stroke($img, $x, $y); |
|
529
|
|
|
} |
|
530
|
|
|
} // @class |
|
531
|
|
|
|