1 | <?php |
||
25 | class Line |
||
26 | { |
||
27 | /** |
||
28 | * @var \Location\Coordinate |
||
29 | */ |
||
30 | protected $point1; |
||
31 | |||
32 | /** |
||
33 | * @var \Location\Coordinate |
||
34 | */ |
||
35 | protected $point2; |
||
36 | |||
37 | /** |
||
38 | * @param Coordinate $point1 |
||
39 | * @param Coordinate $point2 |
||
40 | */ |
||
41 | public function __construct(Coordinate $point1, Coordinate $point2) |
||
46 | |||
47 | /** |
||
48 | * @param \Location\Coordinate $point1 |
||
49 | */ |
||
50 | public function setPoint1($point1) |
||
54 | |||
55 | /** |
||
56 | * @return \Location\Coordinate |
||
57 | */ |
||
58 | public function getPoint1() |
||
62 | |||
63 | /** |
||
64 | * @param \Location\Coordinate $point2 |
||
65 | */ |
||
66 | public function setPoint2($point2) |
||
70 | |||
71 | /** |
||
72 | * @return \Location\Coordinate |
||
73 | */ |
||
74 | public function getPoint2() |
||
78 | |||
79 | /** |
||
80 | * Calculates the length of the line (distance between the two |
||
81 | * coordinates). |
||
82 | * |
||
83 | * @param DistanceInterface $calculator instance of distance calculation class |
||
84 | * |
||
85 | * @return float |
||
86 | */ |
||
87 | public function getLength(DistanceInterface $calculator) |
||
91 | |||
92 | /** |
||
93 | * Create a new instance with reversed point order, i. e. reversed direction. |
||
94 | * |
||
95 | * @return Line |
||
96 | */ |
||
97 | public function getReverse() |
||
101 | } |
||
102 |