@@ 95-108 (lines=14) @@ | ||
92 | * |
|
93 | * @return float |
|
94 | */ |
|
95 | public function getLength(DistanceInterface $calculator) |
|
96 | { |
|
97 | $distance = 0.0; |
|
98 | ||
99 | if (count($this->points) <= 1) { |
|
100 | return $distance; |
|
101 | } |
|
102 | ||
103 | foreach ($this->getSegments() as $segment) { |
|
104 | $distance += $segment->getLength($calculator); |
|
105 | } |
|
106 | ||
107 | return $distance; |
|
108 | } |
|
109 | ||
110 | /** |
|
111 | * Create a new polyline with reversed order of points, i. e. reversed |
@@ 196-209 (lines=14) @@ | ||
193 | * |
|
194 | * @return float |
|
195 | */ |
|
196 | public function getPerimeter(DistanceInterface $calculator) |
|
197 | { |
|
198 | $perimeter = 0.0; |
|
199 | ||
200 | if (count($this->points) < 2) { |
|
201 | return $perimeter; |
|
202 | } |
|
203 | ||
204 | foreach ($this->getSegments() as $segment) { |
|
205 | $perimeter += $segment->getLength($calculator); |
|
206 | } |
|
207 | ||
208 | return $perimeter; |
|
209 | } |
|
210 | ||
211 | /** |
|
212 | * Calculates the polygon area. |