Re: [OpenMap Users] Combining polygons

From: Don Dietrick <>
Date: Tue, 31 Aug 2004 23:24:02 -0400

You could get the Shapes from each OMGraphic, create Area objects and
add them together. Working with Areas can be expensive, though, and
this method might be more trouble than it's worth.

If all of the polygons are going to be rendered the same way, with the
same colors, there is a way to speed the rendering up, which I'm
planning on implementing in a future version of OpenMap. Right now,
each OMGraphic sets the fill color in the java.awt.Graphics object,
fills the shape, sets the line color and draws the shape. There's some
optimization for deciding whether it can skip the fill color for clear
OMGraphics, or skipping the line color when the fill color matches the
line color.

I've recently discovered that for OMGraphics that have different fill
and line colors, setting and resetting the Graphics color pretty much
eliminates any chance of hardware-optimized rendering from taking
place. If all of the OMGraphics with the same fill color were filled,
and then all those OMGraphics with the same line color were drawn, the
hardware can help out to speed up rendering, supposedly. Something to
think about.

You might also want to try using the BufferedImageRenderPolicy in your
layer, or backgrounding other layers that are not changing for your
animation. That really helps, too. Set the background flag for those
layers in the properties file, or you can set the flag
programmatically. You can put the layers in the buffer by moving them
down in the LayersPanel.

Hope this helps,


On Aug 31, 2004, at 9:34 AM, <> wrote:

> Is there any way to easily combine polygons into one larger polygon.
> The small polygons may be on top of each other, but I don't want the
> XOR effect of OMAreaList. At best I would add one new polygon to the
> ever larger growing resulting polygon every second. To keep all
> polygons in an OMGraphicList and repaint them every second gets to
> heavy after a short while. Thus, is there an algorithm or a method
> available that can combine two polygons? Do you see any other ways
> this polygon-drawing problem could be solved?
> Thanks a lot
> Erlend

Don Dietrick,
BBN Technologies, Cambridge, MA

[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Aug 31 2004 - 23:24:18 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:05 EDT