[josm-dev] PicLayer - modification

Paul Hartmann phaaurlt at googlemail.com
Mon Nov 14 17:21:49 GMT 2011


On 11/14/2011 11:41 AM, Valeriy Pekarskyy wrote:
> Hi All!
> 
> Not sure about subject of the thread. I recently posted to my diary
> and #osm-ru about my refactoring of PicLayer plugin, and now posting
> here to get any opinions/suggestions/comments.
> 
> At least everyone who tried to use PicLayer hated scale, move, rotate
> actions that should allow any affine transformation of the picture,
> but take a lot of time to place it correctly. 

The current controls are cumbersome to use, but at least it is clear and
straightforward. I think this UI is has its use cases and should not be
removed just like that.

Behind the scenes, all you have is an affine transformation. Your
changes offer another way to enter this set of parameters. So I think it
would be most useful to have both GUIs side by side in one plugin.

> As affine
> transformations are natively supported by Java2D, there is a way to
> place picture on the map with referencing 3 points at the picture and
> at the map. My PicLayer modification allows it.
> 
> http://dl.dropbox.com/u/11265861/piclayer.7z - here is archive with
> source code and compiled plugin.
> 
> Short how-to:
> 1. Install plugin (you should install piclayer from josm plugins
> preferences, then replace jar file with from archive one)
> 2. Download some map area.
> 3. PicLayer menu->New Picture Layer from...
> 4. Picture is shown with red dot at the center. (That point may be
> removed in any time, was put only as an example)
> 5. Add new red dots at the key points.
> 6. Select red points (green oval is drawn) and click on new place
> where this point should be on the map - piclayer will transform.
> 7. You can also move red points - click on new place with Ctrl pressed
> - no transformation will be applied.
> 
> Not implemented:
> - Perspective transformations - they are not implemented at Java2D
> - loadWorldfile not works yet, but I can implement that if you have
> any examples of world files.

I sent you an example file via pm.

> So... The question is - is that worth to be put to SVN? Any comments
> are appreciated.

Even with this how-to I had a hard time figuring out, how it works. Some
suggestions for improvements:

* The pins (circles) shouldn't be transformed, but have the same size
and shape no matter how far you zoom in or out.
* Make the pins draggable, so the image gets transformed while you move
the mouse.
* Maybe 3 mapmodes: "add pin", "move pin" and "remove pin". When there
is one pin, the user could move the image; with two pins you could
scale, move and rotate the image and with three pins you'd have a full
affine transformation.

Maybe have a look at the alignways plugin for how the dragging stuff can
be done.

Paul



More information about the josm-dev mailing list