1 | <?php |
||
24 | class Vertex extends AbstractGeotools implements VertexInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var integer |
||
28 | */ |
||
29 | protected $gradient; |
||
30 | |||
31 | /** |
||
32 | * @var integer |
||
33 | */ |
||
34 | protected $ordinateIntercept; |
||
35 | |||
36 | /** |
||
37 | * @var integer |
||
38 | */ |
||
39 | private $precision = 8; |
||
40 | |||
41 | /** |
||
42 | * {@inheritDoc} |
||
43 | */ |
||
44 | 51 | public function setFrom(CoordinateInterface $from) |
|
56 | |||
57 | /** |
||
58 | * {@inheritDoc} |
||
59 | */ |
||
60 | 1 | public function getFrom() |
|
64 | |||
65 | /** |
||
66 | * {@inheritDoc} |
||
67 | */ |
||
68 | 42 | public function setTo(CoordinateInterface $to) |
|
82 | |||
83 | /** |
||
84 | * {@inheritDoc} |
||
85 | */ |
||
86 | 1 | public function getTo() |
|
90 | |||
91 | /** |
||
92 | * {@inheritDoc} |
||
93 | */ |
||
94 | 5 | public function getGradient() |
|
98 | |||
99 | /** |
||
100 | * {@inheritDoc} |
||
101 | */ |
||
102 | 2 | public function getOrdinateIntercept() |
|
106 | |||
107 | /** |
||
108 | * @return integer |
||
109 | */ |
||
110 | 5 | public function getPrecision() |
|
114 | |||
115 | /** |
||
116 | * @param integer $precision |
||
117 | * @return $this |
||
118 | */ |
||
119 | public function setPrecision($precision) |
||
125 | |||
126 | /** |
||
127 | * Returns the initial bearing from the origin coordinate |
||
128 | * to the destination coordinate in degrees. |
||
129 | * |
||
130 | * @return float The initial bearing in degrees |
||
131 | */ |
||
132 | 14 | public function initialBearing() |
|
145 | |||
146 | /** |
||
147 | * Returns the final bearing from the origin coordinate |
||
148 | * to the destination coordinate in degrees. |
||
149 | * |
||
150 | * @return float The final bearing in degrees |
||
151 | */ |
||
152 | 14 | public function finalBearing() |
|
165 | |||
166 | /** |
||
167 | * Returns the initial cardinal point / direction from the origin coordinate to |
||
168 | * the destination coordinate. |
||
169 | * @see http://en.wikipedia.org/wiki/Cardinal_direction |
||
170 | * |
||
171 | * @return string The initial cardinal point / direction |
||
172 | */ |
||
173 | 7 | public function initialCardinal() |
|
179 | |||
180 | /** |
||
181 | * Returns the final cardinal point / direction from the origin coordinate to |
||
182 | * the destination coordinate. |
||
183 | * @see http://en.wikipedia.org/wiki/Cardinal_direction |
||
184 | * |
||
185 | * @return string The final cardinal point / direction |
||
186 | */ |
||
187 | 7 | public function finalCardinal() |
|
193 | |||
194 | /** |
||
195 | * Returns the half-way point / coordinate along a great circle |
||
196 | * path between the origin and the destination coordinates. |
||
197 | * |
||
198 | * @return CoordinateInterface |
||
199 | */ |
||
200 | 7 | public function middle() |
|
217 | |||
218 | /** |
||
219 | * Returns the destination point with a given bearing in degrees travelling along a |
||
220 | * (shortest distance) great circle arc and a distance in meters. |
||
221 | * |
||
222 | * @param integer $bearing The bearing of the origin in degrees. |
||
223 | * @param integer $distance The distance from the origin in meters. |
||
224 | * |
||
225 | * @return CoordinateInterface |
||
226 | */ |
||
227 | 9 | public function destination($bearing, $distance) |
|
241 | |||
242 | /** |
||
243 | * Returns true if the vertex passed on argument is on the same line as this object |
||
244 | * |
||
245 | * @param Vertex $vertex The vertex to compare |
||
246 | * @return boolean |
||
247 | */ |
||
248 | 5 | public function isOnSameLine(Vertex $vertex) { |
|
261 | |||
262 | |||
263 | } |
||
264 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.