Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm evaluation Geomajas. Apparently, there's very little info on this framework across the Internet. I've managed to create a context menu for the map (the menu that appears when you right click on the map).

I want to do the same for a map point marker (I may need to extend this to other geometry types, i.e., Polygons, Multipolygons, Lines, etc). Anyone with an idea on how to do this, please assist.

Additionally, when I add context menu, the "About Geomajas" menu item hides my first menu item. Is there a way that I can add menu items from below this menu, or make it the last item in the menu?

I'm adding context menu by adding the line:

map.getContextMenu().addChild(MyMenus.getMyContextMenu());
share|improve this question

1 Answer 1

up vote 0 down vote accepted

I think you should just create your own context menu instead of adding to the existing one (in general you have to know the type of an object in SmartGWT to know which method to use to add items.

For example (from MeasureDistanceController):

    menu = new Menu();
    menu.addItem(new CancelMeasuringAction(this));
    Layer selectedLayer = mapWidget.getMapModel().getSelectedLayer();
    if (selectedLayer instanceof VectorLayer) {
        menu.addItem(new ToggleSnappingAction((VectorLayer) selectedLayer, this));
    }
    mapWidget.setContextMenu(menu);
share|improve this answer
    
Thanks. I'll try this out. –  okello Jun 29 '12 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.