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