Re: [OpenMap Users] Adding to LocationMenuItem

From: Don Dietrick <dietrick@bbn.com>
Date: Wed May 21 2003 - 18:58:11 EDT

Hi Luke,

On Wednesday, May 21, 2003, at 05:36 PM, Luke A. Catania ((TEC)) wrote:

> I am plotting data on a map using CSVLocationHandler and when clicking
> on a point, I get the Re-Center Map, Cancel, Always Show Name, and
> Show Details menu. 
>
>  
>
> How can I add to that menu? I want to be able to click on the point
> and have some of my own menus show up in addition to the existing
> menu, so that I can set various attributes individually for each point
> selected or group of points selected. Specifically I am plotting
> Climate Stations that produced Climatology data that will be averaged
> with other data from stations nearby. But I want to give the user the
> option flag any station and remove it from the averaging process. I
> would want the user to click on the station point and be able to
> select a toggle menu option to exclude the station from the averaging
> process and maybe turn it to a different color so they can visually
> see it will not be included. That is just one example of why I want to
> add to the menus.

You can add to the menu presented when a location is pressed by
extending the LocationHandler to respond to the fillLocationPopUpMenu()
method, adding LocationMenuItems that you need. The locMenu object
that gets passed in has information about which Location was pressed,
so you can make pop up menu additions based on that.

> Also, I noticed that no matter if I right click or left click on the
> point the same menu comes up. Can I set it up to come up with a
> different menu depending upon whether I click using the left or right
> mouse.?

Sure, the MouseEvent in the LocationMenu (locMenu) object has that info.

> Would I just extend the classes that create this menu? I searched
> through the code and found that several classes seem to assist in
> implementing the menu: CSVLocationHandler.java, LocationMenuItem.java,
> LocationHandler.java, and Location.java. Would I have to create a
> class to extend each one?

You can probably get away with just extending the CSVLocationHandler,
depending on the extent of modifications you want to make. You might
have to extend LocationLayer to change the showMapPopup (for when no
locations are pressed) or showLocationPopup (when a location is
pressed), depending on how much you want to change the menus.

The LocationHandler you use might create its own Location classes if
you want your Location objects to more than what they do by default.
There are two things to note: The CSVLocationHandler actually creates
subclasses of Location already, and since the Location object is an
OMGraphic, it contains a generic Object member variable that can
contain customized info.

- Don

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[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 Wed May 21 18:59:00 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:35 EDT