> [mailto:[EMAIL PROTECTED]]On Behalf Of Chris Stephen
> Sent: March 16, 1999 4:05 AM
> Subject: MI MB: Multi Section Polylines.
> ...
> Say I have a polyline with 3 sections.
> I can get the number of nodes on the polyline.
> I can get the number of sections on the polyline.
> I can get the number of nodes in each section.
> But, when building an array of node coordinates by looping from section 1
to
> section 3, the node coordinates may not be in the correct order because
> maybe section 2 starts and is connected to section 3 which runs the other
> way and then is connected to section 1.
>
Simple question, obvious (!??**!) answer

You assume that all the sections are connected, which might be a little
audacious as a start.

But as you should protect you against faulty data in every occasion, a way
to solve the problem is to start registering the x,y of the end points of
all the segments and find if there were "unconnecting" points (x,y found as
end points of another segment)
        if =0, the polyline is all connected and loops on itself, in which case
any end point can be the start of the combined polyline
        if =1, the polyline looks like a 6 or worse, but has a "tail" for sure (not
a nice feature, for a polyline, at least),
        if =2, "regular" polyline, all connected, choose either one as the start if
        if >2, your polyline is "unconnected" somewhere and may loop on itself
locally.

But 0 or 2 unconnecting points is necessary but not sufficient as a
topological check because there might also be some local loops. Record also
for each end point how many times it is "used"
        if =1 it is a real end point
        if =2 it is a connecting point
        if >2 it is a looping point

When satisfied of the topological quality, and having chosen a start point,
register the nodes in the order (forward/backward depending if point is
first/last) for the first segment, jump to the next connecting segment and
continue with the node next to the connecting one and in the proper order,
then to next segment ...

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to