Re: [OpenMap Users] moving polygons

From: Don Dietrick <dietrick_at_bbn.com>
Date: Mon, 27 Sep 2004 10:33:08 -0400

I'd use the OMDrawingTool to handle this, the DemoLayer demonstrates...

- Don

On Sep 25, 2004, at 11:01 PM, Robert Najlis wrote:

> Hi,
>
> I am trying to move OMGraphics by clicking on them, and then clicking
> on another point on the screen. I can do this fine with OMPoints and
> OMArcs, but I am having a lot of troubles with OMPoly. On occasion I
> can get the OMPoly to dissapear, but not reappear.
>
> below is code that works for OMPoint (OMArc is similar) I have tried
> everything I can think of for OMPoly. I tried getting the lists of Xs
> and Ys, these turned out to be null. I tried to get the GeneralPath
> as well, this turned out to be null too. The closest thing was
> getting the list of latlons. Sometimes this would make the OMPoly
> dissapear, but I could not get it to reappear. Sometimes I could not
> grab the OMPoly at all. The OMPolys were made from a shapefile, thus
> they were actually EsriPolygon.
>
> Thanks a lot.
>
> -- Robert
>
>
>
> code snippet for moving OMPoint
>
> public void moveAgent(int x, int y) {
> GisAgent agent = this.getAgentToMove();
> Class clazz = agent.getClass();
> Method method;
> try {
> method = clazz.getMethod("getOMGraphic", null);
> OMGraphic omg = (OMGraphic) method.invoke(agent, null);
>
> if (omg instanceof OMPoint) {
> System.out.println("== left clcik - move Point");
> LatLonPoint llp = this.omDisplay.xyToLatLon(x,y);
> ((OMPoint)omg).setLat(llp.getLatitude());
> ((OMPoint)omg).setLon(llp.getLongitude());
>
> // don't woory about this code. but know that it sets the OMGraphic
> in an object
> // which the layer type I am using knows about, and the layer gets its
> OMGraphics
> // these objects -- this code works just fine
> Object [] params = new Object[1];
> params[0] = omg;
> Class [] classParams = new Class[1];
> classParams[0] = OMGraphic.class;
> method = clazz.getMethod("setOMGraphic",
> classParams);//, (Class[]) params);
> method.invoke(agent, params);
> //------------------
>
> this.doPrepare();
> }
>
> --
> [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"]
>
>


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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 Mon Sep 27 2004 - 10:33:30 EDT

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