[josm-dev] [PATCH] - OrthogonalizeAction

Harald Kucharek harald.kucharek at gmx.net
Tue Nov 18 16:46:27 GMT 2008


Hello Hermann,

just found your mail from yesterday in my Spam folder...

I'm currently too bit deep in other work to check out points other than #2.
On point 2, a few remarks:
As you may have thought, the behavior was so by design. Idea was, to 
"average out" orientation errors of several buildings, which are often 
aligned some regular grid.
Your behavior can be accomplished by applying the orthogonalization on 
each building one by one.
Now, this was all done before I added the "use orientation of two nodes 
to align all to"-capability. With this, your modification has a point 
because now I can achieve it in maybe a better way by selecting two 
fitting nodes and plenty of buildings.

So, if your patch introduces this behavior and fixes some odds, I'm fine 
with it.

Regards,

Harald


Hermann Schwaerzler schrieb:
> hello
> 
> I am mapping a lot of buildings recently and used the "Align in
> Rectangle" a lot. I was glad to hear and use the replacement
> "Orthogonalize", but I found some issues.
> (I sent Frederik Ramm and Harald Kucharek private mails about this but I
> do not want to bother them any more as I think it's probably better to
> discuss this on this list.)
> 
> I found two "problems" with the code:
> 
> 1. if a building has sides that are (almost) heading to -PI/4 or +PI/4
> it may happen that the function calculates a totally wrong new heading
> of the building. this is due to the fact that the normalization of the
> headings maps adjacent sides to different "edges" of the
> normalization-range which in turn makes the calculation of the average
> fail.
> 
> 2. when more than one building is selected all buildings get the _same_
> averaged heading. I changed the algorithm to do the following (which
> seems to me to be more intuitive):
> * if two additional nodes are selected _all_ ways are aligned to the
> heading of the two nodes
> * if only ways (no nodes) are selected every way get its own heading.
> 
> 
> the attached patch adresses/solves these issues and does also the following:
> 
> * cosmetics: the OrthogonalizeAction.java in SVN does not use
> solely tabs for indentation but those mixed with spaces. the patch
> replaces all those spaces with tabs.
> 
> * in the current code the normalizations of the headings is done the
> first two times to [ 0 , PI/2 ] but the second two times to
> [ -PI/4 , PI/4 ]. IMO the latter one is the better way to go and the
> patch changes this.
> 
> * it introduces a normalization helper-function.
> 
> hopefully the code i wrote reaches your design- and quality-criteria. :-)
> 
> hermann
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> josm-dev mailing list
> josm-dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/josm-dev




More information about the josm-dev mailing list