1 | <?php |
||
22 | class SimplifyBearing implements SimplifyInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var float |
||
26 | */ |
||
27 | private $bearingAngle; |
||
28 | |||
29 | /** |
||
30 | * SimplifyBearing constructor. |
||
31 | * |
||
32 | * @param float $bearingAngle |
||
33 | */ |
||
34 | public function __construct($bearingAngle) |
||
38 | |||
39 | /** |
||
40 | * Simplifies the given polyline |
||
41 | * |
||
42 | * 1. calculate the bearing angle between the first two points p1 and p2: b1 |
||
43 | * 2. calculate the bearing angle between the next two points p2 and p3: b2 |
||
44 | * 3. calculate the difference between b1 and b2: deltaB; if deltaB is |
||
45 | * smaller than the threshold angle, remove the middle point p2 |
||
46 | * 4. start again at (1.) as long as the polyline contains more points |
||
47 | * |
||
48 | * @param Polyline $polyline |
||
49 | * |
||
50 | * @return Polyline |
||
51 | */ |
||
52 | public function simplify(Polyline $polyline) |
||
94 | } |
||
95 |