[josm-dev] MapMode, GeoImageLayer, mouseAdapter, Flags, Undo

Paul Hartmann phaaurlt at googlemail.com
Mon Sep 16 21:36:23 UTC 2013


On 09/16/2013 10:31 PM, Holger Mappt wrote:
> Hi,
>
> I have a proof of concept for my ticket 7712.  Until now I changed the
> GeoImageLayer directly to keeps things simple.  Now I want to move the
> additional code into a plug-in.  That raises a few questions.
>
> The GeoImageLayer uses a MouseAdapter that is added and removed by a
> MapModeChangeListener.  But what exactly is a MapMode?

Select, Draw, Zoom, ... (The buttons on the upper left)

>  I can click on a
> photo whenever it is displayed.  How is that related to the MapMode?

In certain MapModes (e.g. Draw) the mouse click is deactivated.

> I want to be able to move photos of the active GeoImageLayer.  Can I use
> a LayerChangeListener to register my MouseMotionAdapter or do I need a
> MapModeChangeListener too?

You probably also want to turn this off in Draw mode, so yes.

> Right now I do the same what the
> GeoImageLayer does, i.e. use the MapModeChangeListener.
>
> What is the best way to add a MouseMotionAdapter to the active
> GeoImageLayer from a plug-in?  Do I just implement the right
> ChangeListener and use it to add/remove the MouseMotionAdapter?  Or
> would I register the MouseMotionAdapter in the GeoImageLayer?  Or
> something else?  What plug-in would be a good example?
> I want to mark an image as moved to be able to save the new coordinates
> afterwards.  What is the recommended way to implement such a flag?  Is
> there a type for flags, how do I name the set/get methods?

It seems somewhat cumbersome to implement this as a plugin. Why not 
continue your work as a core enhancement? If it integrates well, we 
could apply the patch directly. I think this would be a nice new feature 
for the JOSM's geotagging support!

> The undo/redo seems to work with OSM data only.  Is there a way to have
> a separate undo buffer for the GeoImageLayer?  How would it work?

Sorry, no idea.

Paul




More information about the josm-dev mailing list