Donald,
I actually have a Location, composed of OMText and an OMGraphic (an
OMCircle to be exact), that needs to be dragged around the map. I looked
and did not see an EditableOMLocation class, so I wrote one that
extended EditableOMCircle. I also added an EditToolLoader specifically
for my locations, and then used the OMDrawingTool.
Getting both the circle and the text to move was a little challenging. I
may be doing this wrong, but in my drawingComplete(omgraphic, omaction)
method, I had to do the following in order for the moved circle and the
associated text to show up in the new location:
/**
* Specified by the DrawingToolRequestor interface. This method is
called after
* the edit has been performed on a given location
* @param omg the OMGraphic object, which should be a MapEntity
* @param oma the OMAction
*/
public void drawingComplete(OMGraphic omg, OMAction oma) {
Debug.message("entitylocationlayer","EntityLocationLayer: called
drawingComplete");
// reset the text label based on the circles coordinates
// i'm not sure i understand it, but all of these calls are
necessary
LatLonPoint l =
((OMCircle)((MapEntity)omg).getLocationMarker()).getLatLon();
((OMCircle)((MapEntity)omg).getLocationMarker()).setVisible(true);
((MapEntity)omg).setLocation(l.getLatitude(), l.getLongitude());
((MapEntity)omg).generate(map.getProjection());
((MapEntity)omg).render(map.getGraphics());
repaint();
}
I'm not sure why I had to set the circle to be visible. I think I
understand why I needed to call both generate and render, and then
certainly repaint at the end.
Could you comment on 5 method calls after defining the LatLonPoint? This
may again be much more of a Swing issue than OpenMap
thanks,
jeff
Donald Dietrick wrote:
>
> Hi Jeff,
>
> All of the EditableOMGraphics are really meant to be used with the
> OMDrawingTool, although I suppose you could manage them through the
> layer. I've never tried it, though.
>
> You can use the DrawingTool from a layer, though. See the DemoLayer on
> how it uses it to create and edit graphics. By default, when the
> drawing tool is activated, a palette appears that provides other
> parameters for changing the attributes of the graphics. There is also a
> way to call it so that a GUI doesn't show up to allow the user to change
> all the other features of a graphic (other than position and size), if
> you want those attributes preserved.
>
> - Don
>
> On Thursday, August 23, 2001, at 11:26 AM, Jeff Mathis wrote:
>
> > hello again,
> >
> > I have a layer which has a locationhandler. the locationhandler
> > currently deals with a series of OMCircles to mark my locations of
> > interest. I now need to be able to click on one of these locations and
> > drag it to a new part of the map.
> >
> > I see there is an EditableOMCircle class, which I'm hoping has some of
> > the functionality I need. Is this correct? If so, any hints on the best
> > way to use it?
> >
> > If this is a class I want to use, I know I'll have to change my
> > locationhandler to deal with an EditableOMGraphic instead of an
> > OMGraphic.
> >
> > thanks
> >
> > jeff
> > --
> > Jeffrey Mathis, PhD FAX: 505-988-2229
> > Senior Scientist email: jeff.mathis@biosgroup.com
> > Bios Group, Inc. phone 505-992-6737
> > 317 Paseo de Peralta http://www.biosgroup.com
> > Santa Fe, NM 87501
> >
> > --
> > [To unsubscribe to this list send an email to "majdart@bbn.com"
> > with the following text in the BODY of the message "unsubscribe
> > openmap-users"]
> >
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Donald F. Dietrick, dietrick@bbn.com
> BBN Technologies, 10 Moulton Street, Cambridge, MA 02138
> 617.873.3031 FAX 2794
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- Jeffrey Mathis, PhD FAX: 505-988-2229 Senior Scientist email: jeff.mathis@biosgroup.com Bios Group, Inc. phone 505-992-6737 317 Paseo de Peralta http://www.biosgroup.com Santa Fe, NM 87501 -- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Fri Aug 24 19:39:41 2001
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT