Adjusting the Ends
Adjusting the Ends
The terminal points of the overlaps (i.e. start and end) in the segments both have a type field. Depending on the value of type some fine tuning of the routes is made before the segments can be actually split. This to ensure that both existing segments have matching waypoints at the start and end of the overlap
In most instances, the distances involved are small and these actions may not make any visible difference but occasionally they can make a big difference and so are made regardless.
- if type is AB then we have matching points on the two segments so take the relevant point on segB and change it’s location (latitude longitude) to that of the corresponding point on segA
- If type is B then the terminal point is on segB and there is no corresponding waypoint on segA. We insert a copy of ptB into segA at the correct position.
- Conversely, if type is A then the terminal point is on segA and there is no corresponding waypoint on segB. We insert a copy of ptA into segB at the correct position.
If new waypoints have been created then the indices iA and iB in start and end will need to be adjusted ensure the correct waypoints are being referenced when the actual split takes place.