[OpenMap Users] MapBean setCenter and OMGraphic select

From: Graham, John <j.graham_at_ngc.com>
Date: Thu, 10 Jan 2008 22:25:32 -0600

Calling select() on an OMGraphic doesn't seem to work after calling mapBean.setCenter. Let me elaborate.
 
I wrote a find utility to hilight a specific shape in an esri shapefile (the user picks which shape by name from a tree). This works fine, but to improve things, I want to center the map on the item that is found.
 
Here is a simplified version of my find method:
 
    public void findObject(String shapeName, Point2D shapeCenter)
    {
      // this is the line that causes difficulty
      //getMapBean().setCenter((float)shapeCenter.getX(), (float)shapeCenter.getY());
      OMGraphicList omgraphics = (OMGraphicList) getList();

      Color c = new Color(255, 255, 0);
      BasicStroke thickStroke = new BasicStroke(5.0f);
      BasicStroke normalStroke = new BasicStroke();
      
      if (omgraphics != null)
      {
        // turn off any previous border highlighting
        omgraphics.deselectAll();
        omgraphics.setTextureMask(null);
        omgraphics.setStroke(normalStroke);
  
         Iterator iter = omgraphics.iterator();
      
        while (iter.hasNext())
       {
         OMGraphic graphic = (OMGraphic)iter.next();
         
         Object obj = graphic.getAppObject();
         
         if (obj.toString().equals(shapeName))
         {
            graphic.setSelectPaint(c);
            graphic.setStroke(thickStroke);
            graphic.select();
            break;
         }
       }
      }
      repaint();
    }
 
 
In this example, the found shape borders are hilighted by a thick yellow-gold line. But if I uncomment the call to setCenter, the map gets centered properly, but the shape does not get hilighted. MapBean::setCenter is just a convienence for Proj::setCenter, so I don't know why this would affect the abiloty to hilight the OMGraphic.
 
Any ideas?
 
Thanks,
John Graham
j.graham_at_ngc.com

--
[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 Thu Jan 10 2008 - 23:27:28 EST

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