Hi Rudiger,
Here is what I did in my custom layer to display holes within OMPolys:
Note: In my case, a "hole" is defined just like other areas, except that
it happens to lie completely within the bounds of another area.
Step 1: Create an OMPoly for each area. As each poly is created, you
may have to call setDoShapes(true) on the OMPoly , depending on the
version of OpenMap that you're using.
Step 2: Generate the OMPolys for the current projection.
Step 3: Call getShape() on each OMPoly. This method returns a
java.awt.geom.GeneralPath object.
Step 4: Create a new java.awt.geom.Area object from each GeneralPath object.
Step 5: Use the Area.exclusiveOr() method to create a single compound
Area that is the union of all Areas minus any intersection. Holes are
the intersection of two Areas. Be aware that the exclusiveOr() is an
expensive operation - you may want to do some pre-processing of each
Area using bounding boxes to determine when it's actually necessary.
Step 6: Use the Graphics2D.fill(Shape) method to render the resulting
compound Area. Arbitrarily complex background layers will show through
the holes as expected.
Note that there are other ways to deal with holes - this way happens to
be relatively easy to code, but it can be slow depending on the number
of areas you have.
Hope this helps,
George
Gubler, Rüdiger wrote:
>Hi all,
>
>in which way can I handle areas with holes?
>Does OpenMap can handle it in feature versions ?
>
>
>Yours
>Ruediger Gubler
>--
>[To unsubscribe to this list send an email to "majdart@bbn.com"
>with the following text in the BODY of the message "unsubscribe openmap-users"]
>
>.
>
-- George Uecker george.uecker@dot21rts.com Software Engineer (410) 480-7236 Dot21 Real-Time Systems Inc. (410) 313-7515 fax -- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Mon Apr 28 11:32:54 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:35 EDT