[OpenMap Users] moving polygons

From: Robert Najlis <rnajlis_at_cs.indiana.edu>
Date: Sat, 25 Sep 2004 23:01:43 -0400


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);

// 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
// 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);


[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 Sat Sep 25 2004 - 23:09:26 EDT

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