|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\Map; |
|
4
|
|
|
|
|
5
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ChartOptionsInterface; |
|
6
|
|
|
use CMEN\GoogleChartsBundle\GoogleCharts\Options\LineWidthTrait; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @author Christophe Meneses |
|
10
|
|
|
*/ |
|
11
|
|
|
class MapOptions implements ChartOptionsInterface |
|
12
|
|
|
{ |
|
13
|
|
|
use LineWidthTrait; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* If set to true, enables zooming in and out using the mouse scroll wheel. |
|
17
|
|
|
* |
|
18
|
|
|
* @var bool |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $enableScrollWheel; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Holds set(s) of custom markers. Each marker set can specify a normal and selected marker image. Can set a |
|
24
|
|
|
* default set by setting the default option, or custom marker sets by setting a unique marker ID. |
|
25
|
|
|
* |
|
26
|
|
|
* ['default' => ['normal' => '/path/to/marker/image', 'selected' => '/path/to/marker/image'], |
|
27
|
|
|
* 'customMarker' => ['normal' => '/path/to/other/marker/image', 'selected' => '/path/to/other/marker/image']] |
|
28
|
|
|
* |
|
29
|
|
|
* @var array<mixed> |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $icons; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* If showLine is true, defines the line color. For example: '#800000'. |
|
35
|
|
|
* |
|
36
|
|
|
* @var bool |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $lineColor; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* An object containing properties of a custom map type. This custom map type will be accessed by the mapTypeId |
|
42
|
|
|
* you specify for the custom map type. A new mapTypeId must be given for each custom map type created. Each custom |
|
43
|
|
|
* map type should contain two properties : |
|
44
|
|
|
* name: The display name for the styled map type |
|
45
|
|
|
* styles: An array containing the style objects for the styled map type. |
|
46
|
|
|
* |
|
47
|
|
|
* @var array<mixed> |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $maps; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* The type of map to show. Possible values are 'normal', 'terrain', 'satellite', 'hybrid', or the ID of a custom |
|
53
|
|
|
* map type, if any were created. |
|
54
|
|
|
* |
|
55
|
|
|
* @var string |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $mapType; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* If using the map type control (useMapTypeControl: true), the IDs specified in this array will be the only map |
|
61
|
|
|
* types displayed in the map type control. If this option is not set, the map type control will default to the |
|
62
|
|
|
* standard Google Maps map type control options plus any custom map types that may be available. |
|
63
|
|
|
* |
|
64
|
|
|
* @var array<mixed> |
|
65
|
|
|
*/ |
|
66
|
|
|
protected $mapTypeIds; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* If set to true, shows a Google Maps polyline through all the points. |
|
70
|
|
|
* |
|
71
|
|
|
* @var bool |
|
72
|
|
|
*/ |
|
73
|
|
|
protected $showLine; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* If set to true, shows the location description as a tooltip when the mouse is positioned above a point marker. |
|
77
|
|
|
* |
|
78
|
|
|
* @var bool |
|
79
|
|
|
*/ |
|
80
|
|
|
protected $showTip; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Show a map type selector that enables the viewer to switch between [map, satellite, hybrid, terrain]. When |
|
84
|
|
|
* useMapTypeControl is false (default) no selector is presented and the type is determined by the mapType option. |
|
85
|
|
|
* |
|
86
|
|
|
* @var bool |
|
87
|
|
|
*/ |
|
88
|
|
|
protected $useMapTypeControl; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* An integer indicating the initial zoom level of the map, where 0 is completely zoomed out (whole world) and 19 |
|
92
|
|
|
* is the maximum zoom level. |
|
93
|
|
|
* |
|
94
|
|
|
* @var int |
|
95
|
|
|
*/ |
|
96
|
|
|
protected $zoomLevel; |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return $this |
|
100
|
|
|
*/ |
|
101
|
|
|
public function setEnableScrollWheel(bool $enableScrollWheel) |
|
102
|
|
|
{ |
|
103
|
|
|
$this->enableScrollWheel = $enableScrollWheel; |
|
104
|
|
|
|
|
105
|
|
|
return $this; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @param array<mixed> $icons |
|
110
|
|
|
* |
|
111
|
|
|
* @return $this |
|
112
|
|
|
*/ |
|
113
|
|
|
public function setIcons(array $icons) |
|
114
|
|
|
{ |
|
115
|
|
|
$this->icons = $icons; |
|
116
|
|
|
|
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @return $this |
|
122
|
|
|
*/ |
|
123
|
|
|
public function setLineColor(bool $lineColor) |
|
124
|
|
|
{ |
|
125
|
|
|
$this->lineColor = $lineColor; |
|
126
|
|
|
|
|
127
|
|
|
return $this; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* @param array<mixed> $maps |
|
132
|
|
|
* |
|
133
|
|
|
* @return $this |
|
134
|
|
|
*/ |
|
135
|
|
|
public function setMaps(array $maps) |
|
136
|
|
|
{ |
|
137
|
|
|
$this->maps = $maps; |
|
138
|
|
|
|
|
139
|
|
|
return $this; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @return $this |
|
144
|
|
|
*/ |
|
145
|
|
|
public function setMapType(string $mapType) |
|
146
|
|
|
{ |
|
147
|
|
|
$this->mapType = $mapType; |
|
148
|
|
|
|
|
149
|
|
|
return $this; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param array<mixed> $mapTypeIds |
|
154
|
|
|
* |
|
155
|
|
|
* @return $this |
|
156
|
|
|
*/ |
|
157
|
|
|
public function setMapTypeIds(array $mapTypeIds) |
|
158
|
|
|
{ |
|
159
|
|
|
$this->mapTypeIds = $mapTypeIds; |
|
160
|
|
|
|
|
161
|
|
|
return $this; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @return $this |
|
166
|
|
|
*/ |
|
167
|
|
|
public function setShowLine(bool $showLine) |
|
168
|
|
|
{ |
|
169
|
|
|
$this->showLine = $showLine; |
|
170
|
|
|
|
|
171
|
|
|
return $this; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* @return $this |
|
176
|
|
|
*/ |
|
177
|
|
|
public function setShowTip(bool $showTip) |
|
178
|
|
|
{ |
|
179
|
|
|
$this->showTip = $showTip; |
|
180
|
|
|
|
|
181
|
|
|
return $this; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @return $this |
|
186
|
|
|
*/ |
|
187
|
|
|
public function setUseMapTypeControl(bool $useMapTypeControl) |
|
188
|
|
|
{ |
|
189
|
|
|
$this->useMapTypeControl = $useMapTypeControl; |
|
190
|
|
|
|
|
191
|
|
|
return $this; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @return $this |
|
196
|
|
|
*/ |
|
197
|
|
|
public function setZoomLevel(int $zoomLevel) |
|
198
|
|
|
{ |
|
199
|
|
|
$this->zoomLevel = $zoomLevel; |
|
200
|
|
|
|
|
201
|
|
|
return $this; |
|
202
|
|
|
} |
|
203
|
|
|
} |
|
204
|
|
|
|