| 1 | <?php |
||
| 12 | class Ellipsoid |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $name; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The semi-major axis |
||
| 21 | * |
||
| 22 | * @var float |
||
| 23 | */ |
||
| 24 | protected $a; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * The Inverse Flattening (1/f) |
||
| 28 | * |
||
| 29 | * @var float |
||
| 30 | */ |
||
| 31 | protected $f; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Some often used ellipsoids |
||
| 35 | * |
||
| 36 | * @var array |
||
| 37 | */ |
||
| 38 | protected static $configs = [ |
||
| 39 | 'WGS-84' => [ |
||
| 40 | 'name' => 'World Geodetic System 1984', |
||
| 41 | 'a' => 6378137.0, |
||
| 42 | 'f' => 298.257223563, |
||
| 43 | ], |
||
| 44 | 'GRS-80' => [ |
||
| 45 | 'name' => 'Geodetic Reference System 1980', |
||
| 46 | 'a' => 6378137.0, |
||
| 47 | 'f' => 298.257222100, |
||
| 48 | ], |
||
| 49 | ]; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param string $name |
||
| 53 | * @param float $a |
||
| 54 | * @param float $f |
||
| 55 | */ |
||
| 56 | public function __construct(string $name, float $a, float $f) |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param string $name |
||
| 65 | * |
||
| 66 | * @return Ellipsoid |
||
| 67 | */ |
||
| 68 | public static function createDefault($name = 'WGS-84'): Ellipsoid |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @param array $config |
||
| 75 | * |
||
| 76 | * @return Ellipsoid |
||
| 77 | */ |
||
| 78 | public static function createFromArray(array $config): Ellipsoid |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return string |
||
| 85 | */ |
||
| 86 | public function getName(): string |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @return float |
||
| 93 | */ |
||
| 94 | public function getA(): float |
||
| 98 | |||
| 99 | /** |
||
| 100 | * Calculation of the semi-minor axis |
||
| 101 | * |
||
| 102 | * @return float |
||
| 103 | */ |
||
| 104 | public function getB(): float |
||
| 108 | |||
| 109 | /** |
||
| 110 | * @return float |
||
| 111 | */ |
||
| 112 | public function getF(): float |
||
| 116 | |||
| 117 | /** |
||
| 118 | * Calculates the arithmetic mean radius |
||
| 119 | * |
||
| 120 | * @see http://home.online.no/~sigurdhu/WGS84_Eng.html |
||
| 121 | * |
||
| 122 | * @return float |
||
| 123 | */ |
||
| 124 | public function getArithmeticMeanRadius(): float |
||
| 128 | } |
||
| 129 |