On 28 Apr 2009, at 02:47, Graham Cox wrote:

Because of the cyclic nature of the network though, there isn't a way I can see to simply sort the objects into the right order.

I snipped most of the above; anyone who cares to read it should refer to the original message.

I think the crux of the problem here is that a road can be both child and parent in the same relationship, or child and grandparent and so on. This happens because you're allowing arbitrary interconnection, and the child-parent relationship is important because of the colouring issue that you mention (i.e. the parent road's colour should dominate at junctions).

So the question is what to do about all of this.

I *think* the answer might be as follows:

1. Draw *all* the casements (I'm assuming they're the same colour here; if not, you might need to do step 2 first to break the casements up as well).

2. For each road, break it into segments such that each segment has no more than one junction with other roads. So e.g.

          (C)
           |
      (A)==+================(B)
           |
    (E)====+=====(F)
           |
          (D)

you would break road CD between the AB-CD junction and the EF-CD junction.

   You might have fun handling more complex junctions...

3. Now each road segment only has one junction, so you can sort the segments into the correct rendering order using a topographic sort routine, then simply draw their strokes in that order.

Kind regards,

Alastair.

--
http://alastairs-place.net




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to