[josm-dev] How to select objects in an own Layer class?

Sebastian Klein bastikln at googlemail.com
Fri Jan 21 13:32:40 GMT 2011


Stefan Breitling wrote:
> Hi there!
> 
> I am trying to develop a plugin for JOSM to represent own datastructures in an 
> own layer (inherited from Layer). This works well but now I want to select 
> objects in my layer with the mouse. Can anybody short explain how this works? In 
> 
> my layer there is no dataset-object and I think I should use the 
> SelectionManager to get the selected rectangle with the coordinates. But how I 
> get the SelectionManager? And there are listener I need to use?

There are several options: If a simple click is enough, you could look 
how it is done in GeoImageLayer.java. If you prefer a rectangle 
selection, easiest would be to add your own mapmode, like it is done in 
editgpx plugin.

If you really want to hook into normal rectangle selection in select 
mode, i guess you have to patch JOSM core a little. I don't think there 
is already a ready-to-use solution, but it should be possible to get there.

Sebastian



More information about the josm-dev mailing list