Let's say we have a few lines and polylines connected to each others start- and endpoints. These objects form one continuous line, but are not a single polyline.
I would like to find the distance between two points on these objects. These points are intersections with other objects. So I would like to know the distance from one intersection to the next intersection, but only via those connected objects.
The connected objects are on the same layer.
I'm thinking of implementing this algorithm, but I'm wondering if anybody has a better idea.
At first I need one of the connecting objects, this is coming from a different function, which gives the intersectionpoints.
I would make a selectionset on one intersectionpoint -> this is probably an object in the middle of the connecting lines.
Then the start and endpoints of this object will be asked (vlax-get-property object 'StartPoint). Of course polylines do not have this property, so there is some extra coding to be done there.
On the startpoint and endpoint I would make a similar selectionset, on one point. The previous object will be removed from the selectionset.
If there are no objects found this previous object is the beginning or the end of the connecting lines.
If there are multiple objects found we check if they have their startpoint or endpoint on the same point as the point where we made the selectionset. (which is the start-/endpoint of the previous object). We have to check if there are multiple objects returned with a startpoint, because then something is amiss.
Meanwhile, we have written the first object to a list. Objects that are connected to the startpoint get placed in front of the list, and objects that are connected to the endpoint are placed on the end of the list. Thus we will have a list with vla-objects in the correct order.
All the objects in the list will be checked if they have a intersection. Objects between the two intersections will be asked for their length.
The intersectionobjects then will need to be asked their getDistAtPoint.... and I somehow have to find out if the distance needed is the one from the endpoint or from the startpoint.
Then I can add all these lengths and finally have the result that I need.
This all seems a bit difficult. So I'm hoping someone has a better idea!