Re: [OpenMap Users] Displaying OMGraphic objects

From: Don Dietrick <dietrick@bbn.com>
Date: Wed Feb 18 2004 - 16:56:49 EST

Hi Michael,

On Feb 18, 2004, at 4:26 PM, Michael Harrison wrote:

> Hello,
>  
> Our OpenMap application uses VMAP data to display maps and to write
> VMAP data to a different format. I am trying to add OMGraphic objects
> for displaying on top of the map.
>  
> I thought this procedure was fairly straightforward but I have not
> been able to get it to work. As an example of displaying a rectangle
> on top of the map I am using the following code:
>     
>           
> OMRect tileBoundary = new OMRect(
>     Float.parseFloat( north ),
>     Float.parseFloat( west  ),
>     Float.parseFloat( south ),
>     Float.parseFloat( east  ),
>     OMGraphic.RENDERTYPE_LATLON );

Actually, you want the last argument to be
OMGraphic.LINETYPE_GREATCIRCLE. The RENDERTYPE is implied since you
are using floats.

> tileBoundary.setLinePaint( new Color( 0, 0, 0 ));
> tileBoundary.setVisible( true );
> tileBoundary.generate( mapBean.getProjection() );

generate() will be called by the layer with the projection it will
receive from the MapBean when it gets added to it, but no harm.

> OMGraphicHandlerLayer handler = new OMGraphicHandlerLayer();
>  
> handler.doAction(
>     tileBoundary,
>     new OMAction( OMAction.RAISE_TO_TOP_GRAPHIC_MASK ) );

OK, I hadn't thought of doing it this way, but cool. I would have
thought to do:

handler.getList().add(tileBoundary);

but there is more meaning/control your way.

>  
> mapBean.add( handler );
>  

Looks ok, I'd check to see of your layer is on the bottom, under
something that would cover it. First added goes on top.

If you use a LayerHandler to control the MapBean's layers, you can have
more control over position. You would just add LayerHandler and
MapBean (and the layer for that matter) to a MapHandler, and they would
hook up.

- Don

> north, west, south, and east are floats representing the boundaries of
> the rectangle that I would like to display.
>  
> Any idea on how to correct this code?
>
>  Thanks and regards,
>  Mike Harrison
> ===============================
> |  Mike Harrison  
> |  MIT Lincoln Lab     
> |  244 Wood St.  S2-256
> |  Lexington MA  02420-9185
> |  mhh@ll.mit.edu              
> |  (781) 981-3513              
> |  (781) 981-5255 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 Wed Feb 18 16:57:00 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:37 EDT