Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | abstract class AbstractCylindricalEqualAreaProjection implements Projection |
||
9 | { |
||
10 | abstract public function getWidthToHeightAspectRatio(): float; |
||
11 | |||
12 | 1 | public function getX(Position $position): float |
|
13 | { |
||
14 | 1 | return ($position->longitude - Position::MIN_LONGITUDE) * $this->getWidthToHeightAspectRatio() / 2; |
|
15 | } |
||
16 | |||
17 | 1 | public function getY(Position $position): float |
|
18 | { |
||
19 | 1 | return (-sin(deg2rad($position->latitude)) + 1) * .5 * Position::TOTAL_LATITUDE; |
|
20 | } |
||
21 | |||
22 | 1 | public function getMaxX(): float |
|
23 | { |
||
24 | 1 | return $this->getMaxY() * $this->getWidthToHeightAspectRatio(); |
|
25 | } |
||
26 | |||
27 | 1 | public function getMaxY(): float |
|
28 | { |
||
29 | 1 | return Position::TOTAL_LATITUDE; |
|
30 | } |
||
31 | |||
32 | 1 | public function getMaxLatitude(): float |
|
35 | } |
||
36 | } |
||
37 |