Changeset 5686 in josm for trunk


Ignore:
Timestamp:
2013-01-28T23:07:30+01:00 (11 years ago)
Author:
bastiK
Message:

fixed #7889 - Error making a way rectangular while two nodes should keep their positions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r4982 r5686  
    342342                    }
    343343                }
     344                for (Node n : cs) {
     345                    s.remove(n);
     346                }
    344347
    345348                final HashMap<Node, Double> nC = (orientation == HORIZONTAL) ? nY : nX;
     
    358361                }
    359362
     363                // At this point, the two heading nodes (if any) are horizontally aligned, i.e. they
     364                // have the same y coordinate. So in general we shouldn't find them in a vertical string
     365                // of segments. This can still happen in some pathological cases (see #7889). To avoid
     366                // both heading nodes collapsing to one point, we simply skip this segment string and
     367                // don't touch the node coordinates.
     368                if (orientation == VERTICAL && headingNodes.size() == 2 && cs.containsAll(headingNodes)) {
     369                    continue;
     370                }
     371
    360372                for (Node n : cs) {
    361373                    nC.put(n, average);
    362                 }
    363 
    364                 for (Node n : cs) {
    365                     s.remove(n);
    366374                }
    367375            }
Note: See TracChangeset for help on using the changeset viewer.