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