Re: [OpenMap Users] Could anyone help me to paint a rectangle on the layer?

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 12 Feb 2008 16:42:44 -0500

Hi Ruben,

You'll want to define a Layer object to handle the things you want to
draw on the map, instead of rendering directly on the MapBean. You
can find some layer examples in the com.bbn.openmap.layer.examples
package, or take a look at the com.bbn.openmap.layer.DemoLayer class.

You'll want to use the OMGraphics in your layer to represent your
object (not EditableOMGraphics, those are for the drawing tool). Your
layer gets added to the application, and your objects will appear on
the map. You can use the default OpenMap application and add your
layer in the openmap.properties file (look for openmap.layers
property). Or, you can look in that examples directory and follow the
simple2 example.

Hope this helps,

Don

On Feb 12, 2008, at 10:49 AM, Ruben DF wrote:

> Hi to everybody,
>
> I'm a newbie with openmap. I would like to paint a
> simple rectangle from openmap.java (from main method)
> given the latitude and longitude. My code is:
>
> static public void main(String args[]) {
>
> ArgParser ap = new ArgParser("OpenMap");
> String propArgs = null;
> ap.add("properties",
> "A resource, file path or URL to
> properties file\n Ex: http://myhost.com/xyz.props or
> file:/myhome/abc.pro\n See Java Documentation for
> java.net.URL class for more details",
> 1);
>
> ap.parse(args);
>
> String[] arg = ap.getArgValues("properties");
> if (arg != null) {
> propArgs = arg[0];
> }
>
> OpenMap.create(propArgs);
>
> //paint rectangle
>
> float latPointUL = 59.06484f;
> float longPointUL = -100.47563f;
> float latPointBR = -28.030712f;
> float longPointBR = -37.12247f;
>
> OMRect omRect = new
> OMRect(latPointUL,longPointUL,latPointBR,longPointBR,
> com.bbn.openmap.omGraphics.OMGraphic.LINETYPE_STRAIGHT);
>
> EditableOMRect erect = new EditableOMRect(omRect);
>
> erect.generate(mapPanel.getMapBean().getProjection());
>
> erect.render(mapPanel.getMapBean().getGraphics());
>
> }
>
> mapPanel had to be changed as a static var and so working ok.
> however, the rectangle is not painted on the screen
> and I dont know if I'm doing right or not. Any idea? Could anyone
> tell me what steps I have to follow to be able to paint the rectangle?
>
> Thanks and best regards,
> Ruben
>
>
> ¿Con Mascota por primera vez? - Sé un mejor Amigo
> Entra en Yahoo! Respuestas.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Feb 12 2008 - 16:42:55 EST

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