1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the geo-api-library package. |
5
|
|
|
* |
6
|
|
|
* (c) 2020 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Library\GeoAPI\Model; |
13
|
|
|
|
14
|
|
|
use WBW\Library\GeoAPI\Model\Attribute\FloatScoreTrait; |
15
|
|
|
use WBW\Library\GeoAPI\Model\Attribute\StringCodeDepartementTrait; |
16
|
|
|
use WBW\Library\GeoAPI\Model\Attribute\StringCodeRegionTrait; |
17
|
|
|
use WBW\Library\GeoAPI\Model\Attribute\StringCodeTrait; |
18
|
|
|
use WBW\Library\GeoAPI\Model\Attribute\StringNomTrait; |
19
|
|
|
use WBW\Library\GeoJSON\Model\Geometry\Point; |
20
|
|
|
use WBW\Library\GeoJSON\Model\Geometry\Polygon; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Commune. |
24
|
|
|
* |
25
|
|
|
* @author webeweb <https://github.com/webeweb/> |
26
|
|
|
* @package WBW\Library\GeoAPI\Model |
27
|
|
|
*/ |
28
|
1 |
|
class Commune { |
29
|
1 |
|
|
30
|
1 |
|
use FloatScoreTrait; |
31
|
1 |
|
use StringCodeDepartementTrait; |
32
|
1 |
|
use StringCodeRegionTrait; |
33
|
|
|
use StringCodeTrait; |
34
|
|
|
use StringNomTrait; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Centre. |
38
|
|
|
* |
39
|
|
|
* @var Point|null |
40
|
|
|
*/ |
41
|
|
|
private $centre; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Codes postaux. |
45
|
|
|
* |
46
|
|
|
* @var string[] |
47
|
|
|
*/ |
48
|
|
|
private $codesPostaux; |
49
|
|
|
|
50
|
|
|
/** |
51
|
35 |
|
* Contour. |
52
|
|
|
* |
53
|
35 |
|
* @var Polygon|null |
54
|
|
|
*/ |
55
|
|
|
private $contour; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Département. |
59
|
|
|
* |
60
|
10 |
|
* @var Departement|null |
61
|
10 |
|
*/ |
62
|
|
|
private $departement; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Population. |
66
|
|
|
* |
67
|
|
|
* @var int|null |
68
|
|
|
*/ |
69
|
15 |
|
private $population; |
70
|
15 |
|
|
71
|
|
|
/** |
72
|
|
|
* Région. |
73
|
|
|
* |
74
|
|
|
* @var Region|null |
75
|
|
|
*/ |
76
|
|
|
private $region; |
77
|
|
|
|
78
|
|
|
/** |
79
|
20 |
|
* Surface. |
80
|
20 |
|
* |
81
|
20 |
|
* @var float|null |
82
|
|
|
*/ |
83
|
|
|
private $surface; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Constructor. |
87
|
|
|
*/ |
88
|
|
|
public function __construct() { |
89
|
|
|
// NOTHING TO TO |
90
|
20 |
|
} |
91
|
20 |
|
|
92
|
20 |
|
/** |
93
|
|
|
* Get the centre. |
94
|
3 |
|
* |
95
|
|
|
* @return Point|null Returns the centre. |
96
|
|
|
*/ |
97
|
|
|
public function getCentre(): ?Point { |
98
|
|
|
return $this->centre; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Get the codes postaux. |
103
|
|
|
* |
104
|
|
|
* @return string[] Returns the codes postaux. |
105
|
|
|
*/ |
106
|
|
|
public function getCodesPostaux(): ?array { |
107
|
|
|
return $this->codesPostaux; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Get the contour. |
112
|
|
|
* |
113
|
|
|
* @return Polygon|null Returns the contour. |
114
|
|
|
*/ |
115
|
|
|
public function getContour(): ?Polygon { |
116
|
|
|
return $this->contour; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Get the département. |
121
|
|
|
* |
122
|
|
|
* @return Departement|null The département. |
123
|
|
|
*/ |
124
|
|
|
public function getDepartement(): ?Departement { |
125
|
|
|
return $this->departement; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Get the population. |
130
|
|
|
* |
131
|
|
|
* @return int|null Returns the population. |
132
|
|
|
*/ |
133
|
|
|
public function getPopulation(): ?int { |
134
|
|
|
return $this->population; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Get the région. |
139
|
|
|
* |
140
|
|
|
* @return Region|null Returns the région. |
141
|
|
|
*/ |
142
|
|
|
public function getRegion(): ?Region { |
143
|
|
|
return $this->region; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Get the surface. |
148
|
|
|
* |
149
|
|
|
* @return float|null Returns the surface. |
150
|
|
|
*/ |
151
|
|
|
public function getSurface(): ?float { |
152
|
|
|
return $this->surface; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Set the centre. |
157
|
|
|
* |
158
|
|
|
* @param Point|null $centre The centre. |
159
|
|
|
* @return Commune Returns this commune. |
160
|
|
|
*/ |
161
|
|
|
public function setCentre(?Point $centre): Commune { |
162
|
|
|
$this->centre = $centre; |
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Set the codes postaux. |
168
|
|
|
* |
169
|
|
|
* @param string[] $codesPostaux The codes postaux. |
170
|
|
|
* @return Commune Returns this commune. |
171
|
|
|
*/ |
172
|
|
|
public function setCodesPostaux(array $codesPostaux): Commune { |
173
|
|
|
$this->codesPostaux = $codesPostaux; |
174
|
|
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Set the contour. |
179
|
|
|
* |
180
|
|
|
* @param Polygon|null $contour The contour. |
181
|
|
|
* @return Commune Returns this commune. |
182
|
|
|
*/ |
183
|
|
|
public function setContour(?Polygon $contour): Commune { |
184
|
|
|
$this->contour = $contour; |
185
|
|
|
return $this; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Set the département. |
190
|
|
|
* |
191
|
|
|
* @param Departement|null $departement The département. |
192
|
|
|
* @return Commune Returns this commune. |
193
|
|
|
*/ |
194
|
|
|
public function setDepartement(?Departement $departement): Commune { |
195
|
|
|
$this->departement = $departement; |
196
|
|
|
return $this; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* Set the population. |
201
|
|
|
* |
202
|
|
|
* @param int|null $population The population. |
203
|
|
|
* @return Commune Returns this commune. |
204
|
|
|
*/ |
205
|
|
|
public function setPopulation(?int $population): Commune { |
206
|
|
|
$this->population = $population; |
207
|
|
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Set the région. |
212
|
|
|
* |
213
|
|
|
* @param Region|null $region The région. |
214
|
|
|
* @return Commune Returns this commune. |
215
|
|
|
*/ |
216
|
|
|
public function setRegion(?Region $region): Commune { |
217
|
|
|
$this->region = $region; |
218
|
|
|
return $this; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Set the surface. |
223
|
|
|
* |
224
|
|
|
* @param float|null $surface The surface. |
225
|
|
|
* @return Commune Returns this commune. |
226
|
|
|
*/ |
227
|
|
|
public function setSurface(?float $surface): Commune { |
228
|
|
|
$this->surface = $surface; |
229
|
|
|
return $this; |
230
|
|
|
} |
231
|
|
|
} |