Hello all,
I cannot use OMGraphicsHandlerLayer since I have to use an old version of
OpenMap. I am using v 3.7 since I need to stick to Java 1.2.2 and Swing 1.1.1
(because of device limitations (PDA)). I tried to run the code of 4.x on it
but failed. (MapBean problem).
In 3.7 I only have the Layer class. I wrote my own layer to which I print my
OMGraphic objects directly. Do you have a solution in mind which would also
work without that OMGraphicsHandlerLayer?
Cheers,
Ralf
> Hi Denis, Karl, Brian,
>
> If you are using a derivation of the OMGraphicHandlerLayer, this is now
> pretty simple.
>
> First, you have to set the mouse mode IDs that your layer should
> receive events from. You can do this programmatically, like Brian
> suggests, by calling setMouseModeServiceList(String[] modeIDs), or you
> can set the 'mouseModes' property in the layer's properties. I suggest
> doing this:
>
> layer.mouseModes=Gestures
>
> for the SelectMouseMode. You can substitute/add other modes ids in the
> properties as needed.
>
> isHighlightable() is called when a mouse is moved over an object. If
> you want to react to mouse movements for a particular object, you can
> return true, which is the default. If you want to limit which of your
> OMGraphics should be reacted to, you can return what you want.
>
> If you return true from isHighlightable(), three methods will be
> called: hightlight(OMGraphic), getToolTipTextFor(OMGraphic), and
> getInfoText(OMGraphic).
>
> - hightlight(OMGraphic): override if you want to change the appearance
> of the OMGraphic, call generate()/repaint() as necessary.
>
> - getToolTipTextFor(OMGraphic): return a string you want to appear as a
> tooltip. Return null for no action.
>
> - getInfoText(OMGraphic): return a string you want to appear in the
> info line at the bottom of the map. Return null for no action.
>
> unhighlight(OMGraphic) will be called to let you know the mouse is no
> longer over the OMGraphic.
>
> For clicking, the isSelectable(OMGraphic) method is called to let you
> filter what OMGraphics can be selected.
> If you return true, select(OMGraphic) gets called when the mouse is
> clicked on the OMGraphic. deselect(OMGraphic) gets called when
> something else is then clicked on after that.
>
> select(OMGraphic) is, for instance, where you would call for the
> DrawingTool to edit the OMGraphic.
>
> Hope this helps,
>
> Don
>
>
> On Mar 26, 2004, at 12:46 PM, Denis Balazuc wrote:
>
> > Hello Karl, hello all.
> >
> > I have the exact same problem - I want to react on a selection and
> > also highlight items when the mouse hovers on them.
> > I was in the hope that OMGraphic would have some settable listeners
> > somehow so I haven't really found a workaround apart from
> > using the
> >
> > OMGraphicList.selectClosest(int x, int y).
> >
> > method.
> >
> > The trouble is that this assumes you have only one OMGraphic located
> > at the specified point,
> > so I am suspecting that there is a better way to achieve this...
> >
> >
> > Hope this helps
> >
> >
> > Karl Koch wrote:
> >
> >> Hi,
> >>
> >> I hope my direct questions are not annoying anybody. I just have a
> >> few days
> >> to solve something and I cannot spend long time in finding out things
> >> by
> >> myself. This is the main reasion why I ask here.
> >>
> >> is there a way to catch if a OMGraphics Object was clicked by the user
> >> without doing any position calculation on the layer (in order to find
> >> out which
> >> OMGraphics Object is was) ? I did that once for another GIS API and
> >> needed a
> >> kind of algorithm which caluculated a scare around any object to make
> >> a
> >> decision if the user clicked inside or outside this invisible square.
> >>
> >> Can I directly attach a listener to a OMGraphics object or is there a
> >> way to
> >> do that in a very easy way?
> >> Who has a piece of sourcecode to which I could have a look.
> >> Ralf
> >>
> >>
> > --
> > [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"]
> >
>
-- +++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++ 100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz -- [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 Sat Mar 27 06:46:58 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT