1 | <?php |
||
19 | class GlobeMath { |
||
20 | |||
21 | /** |
||
22 | * @todo Move this constant next to GlobeCoordinateValue::GLOBE_EARTH? |
||
23 | */ |
||
24 | public const GLOBE_MOON = 'http://www.wikidata.org/entity/Q405'; |
||
25 | |||
26 | /** |
||
27 | * @param string|null $globe IRI of a globe. |
||
28 | * |
||
29 | * @return string Normalized IRI, defaults to 'http://www.wikidata.org/entity/Q2'. |
||
30 | */ |
||
31 | 93 | public function normalizeGlobe( ?string $globe ) { |
|
38 | |||
39 | /** |
||
40 | * Normalizes latitude to [-90°..+90°]. Normalizes longitude to [-180°..+180°[ on Earth and |
||
41 | * Moon and to [0°..+360°[ on all other globes. |
||
42 | * @see http://planetarynames.wr.usgs.gov/TargetCoordinates |
||
43 | * |
||
44 | * @param GlobeCoordinateValue $value |
||
45 | * |
||
46 | * @return GlobeCoordinateValue |
||
47 | */ |
||
48 | 45 | public function normalizeGlobeCoordinate( GlobeCoordinateValue $value ): GlobeCoordinateValue { |
|
55 | |||
56 | /** |
||
57 | * @param LatLongValue $value |
||
58 | * @param string|null $globe |
||
59 | * |
||
60 | * @return LatLongValue |
||
61 | */ |
||
62 | 90 | public function normalizeGlobeLatLong( LatLongValue $value, string $globe = null ): LatLongValue { |
|
74 | |||
75 | /** |
||
76 | * @param LatLongValue $value |
||
77 | * @param float $minimumLongitude |
||
78 | * |
||
79 | * @return LatLongValue |
||
80 | */ |
||
81 | 135 | public function normalizeLatLong( LatLongValue $value, float $minimumLongitude = -180.0 ): LatLongValue { |
|
108 | |||
109 | 135 | private function getNormalizedLongitude( float $longitude, float $minimumLongitude ): float { |
|
119 | |||
120 | } |
||
121 |