Re: [OpenMap Users] OMGraphic 2 ImageIcon

From: Don Dietrick <>
Date: Fri, 16 Sep 2005 12:18:51 -0400

Hi Tom,

It's easier than it might look.

1. Create a Bufferedimage the size you want your icon to be, with an
applicable image type. I generally use INT_ARGB. Get the
java.awt.Graphics object from the BufferedImage.
2. Create your OMGraphic with a constructor that will make it a
RENDERTYPE_XY OMGraphic, and choose coordinates that make sense for
the size of the icon, and hence the size of the BufferedImage.
3. Create any old projection, and call generate(Projection) on the
OMGraphic. Since it's a RENDERTYPE_XY, it doesn't matter. (This
step is something I'm going to change for OMGraphics sometime in the
future, so that XY OMGraphic don't have to be generated before they
will render)
4. Call OMGraphic.render(java.awt.Graphics) with the
java.awt.Graphics object you got from the BufferedImage.
5. Create the ImageIcon using the BufferedImage.

Hope this helps,

- Don

On Sep 16, 2005, at 10:23 AM, Lepkowski, Thomas M., CTR, OSD-PA&E wrote:

> Classification: UNCLASSIFIED
> Hello all,
> We'd like to take an OMGraphic and display it in a JLabel that is
> used in a GUI editing utility for a given point.
> Anybody out there have experience making an ImageIcon from an
> OMGraphic? We know that an OMGraphics are raster and vector
> graphic, but I'm seeing no above-the-hood way to access the lower
> level guts of the OMGraphic - or any straightforward way to wrought
> an icon from the OMGraphic.
> Any ideas?
> Thanks in advance.
> -Tom

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 Fri Sep 16 2005 - 12:19:10 EDT

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