@@ -68,7 +68,7 @@ |
||
| 68 | 68 | public function read(string $gpx, array $allowedElements = []): Geometry |
| 69 | 69 | { |
| 70 | 70 | // Converts XML tags to lower-case (DOMDocument functions are case sensitive) |
| 71 | - $gpx = preg_replace_callback("/(<\/?\w+)(.*?>)/", function ($m) { |
|
| 71 | + $gpx = preg_replace_callback("/(<\/?\w+)(.*?>)/", function($m) { |
|
| 72 | 72 | return strtolower($m[1]) . $m[2]; |
| 73 | 73 | }, $gpx); |
| 74 | 74 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $length = 0.0; |
| 88 | 88 | $points = $this->getPoints(); |
| 89 | 89 | $numPoints = count($points) - 1; |
| 90 | - for ($i=0; $i < $numPoints; ++$i) { |
|
| 90 | + for ($i = 0; $i < $numPoints; ++$i) { |
|
| 91 | 91 | $currX = $points[$i]->getX(); |
| 92 | 92 | $currY = $points[$i]->getY(); |
| 93 | 93 | $nextX = $points[$i + 1]->getX(); |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $length = 0.0; |
| 124 | 124 | $points = $this->getPoints(); |
| 125 | - $numPoints = count($points)-1; |
|
| 126 | - for ($i=0; $i<$numPoints; ++$i) { |
|
| 125 | + $numPoints = count($points) - 1; |
|
| 126 | + for ($i = 0; $i < $numPoints; ++$i) { |
|
| 127 | 127 | $length += sqrt( |
| 128 | - pow(($points[$i]->getX() - $points[$i+1]->getX()), 2) + |
|
| 129 | - pow(($points[$i]->getY() - $points[$i+1]->getY()), 2) |
|
| 128 | + pow(($points[$i]->getX() - $points[$i + 1]->getX()), 2) + |
|
| 129 | + pow(($points[$i]->getY() - $points[$i + 1]->getY()), 2) |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -277,14 +277,14 @@ discard block |
||
| 277 | 277 | $C = $f / 16 * $cosSqAlpha * (4 + $f * (4 - 3 * $cosSqAlpha)); |
| 278 | 278 | $lambdaP = $lambda; |
| 279 | 279 | $lambda = $L + (1 - $C) * $f * $sinAlpha * |
| 280 | - ($sigma + $C * $sinSigma * ($cos2SigmaM + $C * $cosSigma * (- 1 + 2 * $cos2SigmaM * $cos2SigmaM))); |
|
| 280 | + ($sigma + $C * $sinSigma * ($cos2SigmaM + $C * $cosSigma * (-1 + 2 * $cos2SigmaM * $cos2SigmaM))); |
|
| 281 | 281 | } while (abs($lambda - $lambdaP) > 1e-12 && --$iterationLimit > 0); |
| 282 | 282 | if ($iterationLimit == 0) { |
| 283 | 283 | return 0.0; // not converging |
| 284 | 284 | } |
| 285 | 285 | $uSq = $cosSqAlpha * ($a * $a - $b * $b) / ($b * $b); |
| 286 | - $A = 1 + $uSq / 16384 * (4096 + $uSq * (- 768 + $uSq * (320 - 175 * $uSq))); |
|
| 287 | - $B = $uSq / 1024 * (256 + $uSq * (- 128 + $uSq * (74 - 47 * $uSq))); |
|
| 286 | + $A = 1 + $uSq / 16384 * (4096 + $uSq * (-768 + $uSq * (320 - 175 * $uSq))); |
|
| 287 | + $B = $uSq / 1024 * (256 + $uSq * (-128 + $uSq * (74 - 47 * $uSq))); |
|
| 288 | 288 | $deltaSigma = $B * $sinSigma * ($cos2SigmaM + $B / 4 * |
| 289 | 289 | ($cosSigma * (-1 + 2 * $cos2SigmaM * $cos2SigmaM) - $B / 6 |
| 290 | 290 | * $cos2SigmaM * (-3 + 4 * $sinSigma * $sinSigma) |