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

Holger Mappt holgerosm at gmx.net
Fri Sep 20 17:48:21 UTC 2013


Hi,

So a MapMode is one of the modes that I usually use to modify the OSM 
data.  Makes sense.  That means I could implement a MapMode to move the 
photos.  So far I was just thinking to enable my addition if the 
GeoImageLayer is active.

I started with a plug-in (the first I did was an option to toggle 
between thumbnails and icons for the photos) and will continue with it. 
  A plug-in has the advantage that others can improve it or fork it to 
implement other or better concepts.  E.g. the plug-in photo_geotagging 
is related to what I do.  Once everything is mature it could be added to 
the core.

Thanks,
Holger

Am 16.09.2013 23:36, schrieb Paul Hartmann:
> 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