PeekAndPoke /
slumber
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * File was created 11.03.2016 07:27 |
||
| 4 | */ |
||
| 5 | |||
| 6 | namespace PeekAndPoke\Component\GeoJson; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @author Karsten J. Gerber <[email protected]> |
||
| 10 | */ |
||
| 11 | class LineString |
||
| 12 | { |
||
| 13 | public const TYPE = 'LineString'; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var float[][] |
||
| 17 | */ |
||
| 18 | private $coordinates; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Create a LineString object from coordinates |
||
| 22 | * |
||
| 23 | * The coordinates must be in Long-Lat order. Example: |
||
| 24 | * |
||
| 25 | * <code> |
||
| 26 | * |
||
| 27 | * LineString::from([10.1, 20.2, 10.2, 20.3]) |
||
| 28 | * |
||
| 29 | * </code> |
||
| 30 | * |
||
| 31 | * @param array $coordinates The coordinates as pairs of Long-Lat |
||
| 32 | * |
||
| 33 | * @return LineString |
||
| 34 | */ |
||
| 35 | 4 | public static function fromLngLats(array $coordinates) |
|
| 36 | { |
||
| 37 | 4 | $ret = new self; |
|
| 38 | |||
| 39 | 4 | $ret->coordinates = $coordinates; |
|
| 40 | |||
| 41 | 4 | return $ret; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | */ |
||
| 46 | 4 | protected function __construct() |
|
| 47 | { |
||
| 48 | 4 | } |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @return \float[][] |
||
| 52 | */ |
||
| 53 | 2 | public function getCoordinates() |
|
| 54 | { |
||
| 55 | 2 | return $this->coordinates; |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 56 | } |
||
| 57 | } |
||
| 58 |