Okay, there's a function in the old mapsonus parse routine that looks like this:
Code:
# create a route as a combination of 'shape' and 'turn' information
# make sure we discard duplicate records.
waypoints = []
for i in range(-1, len(coords)):
if route.has_key(i):
if len(waypoints) and waypoints[-1].coord == coords[i]:
del waypoints[-1]
waypoints.append(route[i])
else:
if waypoints[-1].coord != coords[i]:
waypoints.append(Wpoint(coords[i]))
return waypoints
The matching code in the new routine seems to be
Code:
h.segments[len(h.coords)-1] = h.destination
wpoints = []
for i in range(len(h.coords)):
wpoints.append(Wpoint(h.coords[i], h.segments.get(i)))
return wpoints
But I don't think a direct replacement will work because objects like "route" don't exist in the new code. Or am I reading that wrong?