RE: [OpenMap Users] MapBean setCenter and OMGraphic select (UNCLASSIFIED)

From: Lackey, Michael B. (SED/BTI) <"Lackey,>
Date: Fri, 11 Jan 2008 08:20:15 -0600

Classification: UNCLASSIFIED
Caveats: NONE

In the call to setCenter(), are you passing x/y values? If so, that's
the problem, becaue the setCenter() method needs lat/lon values. The
projection provides a method for converting an x/y coord into a lat/lon
coord:

        LatLonPoint llp = projection.inverse (x, y);
        getMapBean.setCenter (llp.getLat(), llp.getLon());

Mike


-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
On Behalf Of Graham, John
Sent: Thursday, January 10, 2008 10:26 PM
To: openmap-users_at_bbn.com
Subject: [OpenMap Users] MapBean setCenter and OMGraphic select

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"]
Classification:  UNCLASSIFIED 
Caveats: NONE
--
[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 Fri Jan 11 2008 - 09:34:21 EST

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