|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Maps\Elements; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @since 2.0 |
|
7
|
|
|
* |
|
8
|
|
|
* @licence GNU GPL v2+ |
|
9
|
|
|
* @author Kim Eik < [email protected] > |
|
10
|
|
|
*/ |
|
11
|
|
|
class BaseStrokableElement extends BaseElement { |
|
12
|
|
|
|
|
13
|
|
|
protected $strokeColor; |
|
14
|
|
|
protected $strokeOpacity; |
|
15
|
|
|
protected $strokeWeight; |
|
16
|
|
|
|
|
17
|
|
|
public function getJSONObject( string $defText = '', string $defTitle = '' ): array { |
|
18
|
|
|
$parentArray = parent::getJSONObject( $defText, $defTitle ); |
|
|
|
|
|
|
19
|
|
|
$array = [ |
|
20
|
|
|
'strokeColor' => $this->hasStrokeColor() ? $this->getStrokeColor() : '#FF0000', |
|
21
|
|
|
'strokeOpacity' => $this->hasStrokeOpacity() ? $this->getStrokeOpacity() : '1', |
|
22
|
|
|
'strokeWeight' => $this->hasStrokeWeight() ? $this->getStrokeWeight() : '2' |
|
23
|
|
|
]; |
|
24
|
|
|
return array_merge( $parentArray, $array ); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function hasStrokeColor() { |
|
28
|
|
|
return !is_null( $this->strokeColor ) && $this->strokeColor !== ''; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function getStrokeColor() { |
|
32
|
|
|
return $this->strokeColor; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function setStrokeColor( $strokeColor ) { |
|
36
|
|
|
$this->strokeColor = trim( $strokeColor ); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function hasStrokeOpacity() { |
|
40
|
|
|
return !is_null( $this->strokeOpacity ) && $this->strokeOpacity !== ''; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getStrokeOpacity() { |
|
44
|
|
|
return $this->strokeOpacity; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function setStrokeOpacity( $strokeOpacity ) { |
|
48
|
|
|
$this->strokeOpacity = trim( $strokeOpacity ); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function hasStrokeWeight() { |
|
52
|
|
|
return !is_null( $this->strokeWeight ) && $this->strokeWeight !== ''; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getStrokeWeight() { |
|
56
|
|
|
return $this->strokeWeight; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function setStrokeWeight( $strokeWeight ) { |
|
60
|
|
|
$this->strokeWeight = trim( $strokeWeight ); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
This method has been deprecated.