1 | <?php |
||
14 | class Polyline implements GeometryInterface |
||
15 | { |
||
16 | use GetBoundsTrait; |
||
17 | |||
18 | /** |
||
19 | * @var Coordinate[] |
||
20 | */ |
||
21 | protected $points = []; |
||
22 | |||
23 | /** |
||
24 | * @param Coordinate $point |
||
25 | * |
||
26 | * @return void |
||
27 | */ |
||
28 | public function addPoint(Coordinate $point) |
||
32 | |||
33 | /** |
||
34 | * Add unique point |
||
35 | * |
||
36 | * @param Coordinate $pointToAdd |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | public function addUniquePoint(Coordinate $pointToAdd) |
||
51 | |||
52 | /** |
||
53 | * @return Coordinate[] |
||
54 | */ |
||
55 | public function getPoints(): array |
||
59 | |||
60 | /** |
||
61 | * @return int |
||
62 | */ |
||
63 | public function getNumberOfPoints(): int |
||
67 | |||
68 | /** |
||
69 | * @param FormatterInterface $formatter |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | public function format(FormatterInterface $formatter): string |
||
77 | |||
78 | /** |
||
79 | * @return Line[] |
||
80 | */ |
||
81 | public function getSegments(): array |
||
96 | |||
97 | /** |
||
98 | * Calculates the length of the polyline. |
||
99 | * |
||
100 | * @param DistanceInterface $calculator instance of distance calculation class |
||
101 | * |
||
102 | * @return float |
||
103 | */ |
||
104 | public function getLength(DistanceInterface $calculator): float |
||
118 | |||
119 | /** |
||
120 | * Create a new polyline with reversed order of points, i. e. reversed |
||
121 | * polyline direction. |
||
122 | * |
||
123 | * @return Polyline |
||
124 | */ |
||
125 | public function getReverse(): Polyline |
||
135 | |||
136 | /** |
||
137 | * @return Coordinate|null |
||
138 | */ |
||
139 | public function getMiddlePoint(): ?Coordinate |
||
160 | } |
||
161 |