1 | <?php |
||
24 | class Line implements GeometryInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var \Location\Coordinate |
||
28 | */ |
||
29 | protected $point1; |
||
30 | |||
31 | /** |
||
32 | * @var \Location\Coordinate |
||
33 | */ |
||
34 | protected $point2; |
||
35 | |||
36 | /** |
||
37 | * @param Coordinate $point1 |
||
38 | * @param Coordinate $point2 |
||
39 | */ |
||
40 | public function __construct(Coordinate $point1, Coordinate $point2) |
||
45 | |||
46 | /** |
||
47 | * @param \Location\Coordinate $point1 |
||
48 | */ |
||
49 | public function setPoint1($point1) |
||
53 | |||
54 | /** |
||
55 | * @return \Location\Coordinate |
||
56 | */ |
||
57 | public function getPoint1() |
||
61 | |||
62 | /** |
||
63 | * @param \Location\Coordinate $point2 |
||
64 | */ |
||
65 | public function setPoint2($point2) |
||
69 | |||
70 | /** |
||
71 | * @return \Location\Coordinate |
||
72 | */ |
||
73 | public function getPoint2() |
||
77 | |||
78 | /** |
||
79 | * Returns an array containing the two points. |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | public function getPoints() |
||
87 | |||
88 | /** |
||
89 | * Calculates the length of the line (distance between the two |
||
90 | * coordinates). |
||
91 | * |
||
92 | * @param DistanceInterface $calculator instance of distance calculation class |
||
93 | * |
||
94 | * @return float |
||
95 | */ |
||
96 | public function getLength(DistanceInterface $calculator) |
||
100 | |||
101 | /** |
||
102 | * @param \Location\Bearing\BearingInterface $bearingCalculator |
||
103 | * |
||
104 | * @return float |
||
105 | */ |
||
106 | public function getBearing(BearingInterface $bearingCalculator) |
||
110 | |||
111 | /** |
||
112 | * Create a new instance with reversed point order, i. e. reversed direction. |
||
113 | * |
||
114 | * @return Line |
||
115 | */ |
||
116 | public function getReverse() |
||
120 | } |
||
121 |