Ticket #10205: 10205-beta-2.patch

File 10205-beta-2.patch, 60.8 KB (added by GerdP, 5 years ago)
  • src/org/openstreetmap/josm/actions/AlignInCircleAction.java

     
    2929import org.openstreetmap.josm.data.osm.Way;
    3030import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon;
    3131import org.openstreetmap.josm.data.osm.visitor.paint.relations.Multipolygon.JoinedWay;
     32import org.openstreetmap.josm.data.validation.tests.CrossingWays;
    3233import org.openstreetmap.josm.data.validation.tests.SelfIntersectingWay;
    3334import org.openstreetmap.josm.gui.Notification;
    3435import org.openstreetmap.josm.tools.Geometry;
     
    4243 * @author Petr Dlouhý
    4344 * @author Teemu Koskinen
    4445 * @author Alain Delplanque
     46 * @author Gerd Petermann
    4547 *
    4648 * @since 146
    4749 */
     
    146148     */
    147149    public static Command buildCommand(DataSet ds) throws InvalidSelection {
    148150        Collection<OsmPrimitive> sel = ds.getSelected();
    149         List<Node> nodes = new LinkedList<>();
     151        List<Node> selectedNodes = new LinkedList<>();
    150152        // fixNodes: All nodes for which the angle relative to center should not be modified
    151153        Set<Node> fixNodes = new HashSet<>();
    152154        List<Way> ways = new LinkedList<>();
     
    155157
    156158        for (OsmPrimitive osm : sel) {
    157159            if (osm instanceof Node) {
    158                 nodes.add((Node) osm);
     160                selectedNodes.add((Node) osm);
    159161            } else if (osm instanceof Way) {
    160162                ways.add((Way) osm);
    161163            }
    162164        }
    163165
     166        final List<Node> nodes;
    164167        if (ways.size() == 1 && !ways.get(0).isClosed()) {
    165168            // Case 1
    166169            Way w = ways.get(0);
    167             if (SelfIntersectingWay.isSelfIntersecting(w)) {
    168                 throw new InvalidSelection(tr("Self-intersecting way"));
    169             }
    170 
    171170            fixNodes.add(w.firstNode());
    172171            fixNodes.add(w.lastNode());
    173             fixNodes.addAll(nodes);
    174             fixNodes.addAll(collectNodesWithExternReferrers(ways));
     172            fixNodes.addAll(selectedNodes);
    175173            // Temporary closed way used to reorder nodes
    176174            Way closedWay = new Way(w);
    177             closedWay.addNode(w.firstNode());
    178             nodes = collectNodesAnticlockwise(Collections.singletonList(closedWay));
    179             closedWay.setNodes(null); // see #19885
    180         } else if (!ways.isEmpty() && checkWaysArePolygon(ways)) {
     175            try {
     176                closedWay.addNode(w.firstNode());
     177                nodes = collectNodesAnticlockwise(Collections.singletonList(closedWay));
     178            } finally {
     179                closedWay.setNodes(null); // see #19885
     180            }
     181        } else if (Multipolygon.joinWays(ways).size() == 1) {
    181182            // Case 2
     183
     184            // nodes on selected ways
    182185            List<Node> inside = new ArrayList<>();
    183186            List<Node> outside = new ArrayList<>();
    184187
    185             for (Node n: nodes) {
    186                 boolean isInside = ways.stream().anyMatch(w -> w.getNodes().contains(n));
    187                 if (isInside)
     188            for (Node n: selectedNodes) {
     189                if (ways.stream().anyMatch(w -> w.containsNode(n)))
    188190                    inside.add(n);
    189191                else
    190192                    outside.add(n);
    191193            }
     194            if (outside.size() == 1) {
     195                // center is given
     196                center = outside.get(0).getEastNorth();
     197                if (inside.size() == 1) {
     198                    radius = center.distance(inside.get(0).getEastNorth());
     199                }
     200            } else if (outside.size() > 1) {
     201                throw new InvalidSelection();
     202            }
    192203
    193             if (outside.size() == 1 && inside.isEmpty()) {
    194                 center = outside.get(0).getEastNorth();
    195             } else if (outside.size() == 1 && inside.size() == 1) {
    196                 center = outside.get(0).getEastNorth();
    197                 radius = center.distance(inside.get(0).getEastNorth());
    198             } else if (inside.size() == 2 && outside.isEmpty()) {
     204            if (inside.size() == 2) {
    199205                // 2 nodes inside, define diameter
    200206                EastNorth en0 = inside.get(0).getEastNorth();
    201207                EastNorth en1 = inside.get(1).getEastNorth();
    202                 center = new EastNorth((en0.east() + en1.east()) / 2, (en0.north() + en1.north()) / 2);
    203208                radius = en0.distance(en1) / 2;
     209                if (center == null) {
     210                    center= en0.getCenter(en1);
     211                }
    204212            }
    205 
    206213            fixNodes.addAll(inside);
    207             fixNodes.addAll(collectNodesWithExternReferrers(ways));
    208214            nodes = collectNodesAnticlockwise(ways);
    209             if (nodes.size() < 4) {
    210                 throw new InvalidSelection(tr("Not enough nodes in selected ways."));
    211             }
    212         } else if (ways.isEmpty() && nodes.size() > 3) {
    213             // Case 3
    214             fixNodes.addAll(nodes);
    215             // No need to reorder nodes since all are fix
    216215        } else {
    217             if (ways.isEmpty() && nodes.size() <= 3)
    218                 throw new InvalidSelection(tr("Please select at least four nodes."));
    219216            throw new InvalidSelection();
    220217        }
     218        fixNodes.addAll(collectNodesWithExternReferrers(ways));
    221219
     220        if (nodes.size() < 4) {
     221            throw new InvalidSelection(tr("Not enough nodes in selected ways."));
     222        }
    222223        // Check if one or more nodes are outside of download area
    223224        if (nodes.stream().anyMatch(Node::isOutsideDownloadArea))
    224225            throw new InvalidSelection(tr("One or more nodes involved in this action is outside of the downloaded area."));
    225226
     227
    226228        if (center == null) {
    227             // Compute the center of nodes
    228             center = Geometry.getCenter(nodes);
     229            if (validateGeometry(nodes)) {
     230                // Compute the center of nodes
     231                center = Geometry.getCenter(nodes);
     232            }
    229233            if (center == null) {
    230                 throw new InvalidSelection(tr("Cannot determine center of selected nodes."));
     234                throw new InvalidSelection(tr("Cannot determine center of circle for this geometry."));
    231235            }
    232236        }
    233237
     
    285289        return new SequenceCommand(tr("Align Nodes in Circle"), cmds);
    286290    }
    287291
     292    private static boolean validateGeometry(List<Node> nodes) {
     293        Way test = new Way();
     294        test.setNodes(nodes);
     295        if (!test.isClosed()) {
     296            test.addNode(test.firstNode());
     297        }
     298
     299        try {
     300            if (CrossingWays.isSelfCrossing(test))
     301                return false;
     302            return !SelfIntersectingWay.isSelfIntersecting(test);
     303        } finally {
     304            test.setNodes(null); // see #19855
     305        }
     306    }
     307
    288308    /**
    289309     * Collect all nodes with more than one referrer.
    290310     * @param ways Ways from witch nodes are selected
     
    303323    private static List<Node> collectNodesAnticlockwise(List<Way> ways) throws InvalidSelection {
    304324        Collection<JoinedWay> rings = Multipolygon.joinWays(ways);
    305325        if (rings.size() != 1)
    306             throw new InvalidSelection();
     326            throw new InvalidSelection(); // we should never get here
    307327        List<Node> nodes = new ArrayList<>(rings.iterator().next().getNodes());
    308         if (nodes.get(0) != nodes.get(nodes.size()-1))
     328        if (nodes.get(0) != nodes.get(nodes.size() - 1))
    309329            throw new InvalidSelection();
    310330        if (Geometry.isClockwise(nodes))
    311331            Collections.reverse(nodes);
     
    323343    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    324344        updateEnabledStateOnModifiableSelection(selection);
    325345    }
    326 
    327     /**
    328      * Determines if ways can be joined into a single polygon.
    329      * @param ways The ways collection to check
    330      * @return true if all ways can be joined into a single polygon
    331      */
    332     private static boolean checkWaysArePolygon(Collection<Way> ways) {
    333         if (Multipolygon.joinWays(ways).size() != 1)
    334             return false;
    335         // For each way, nodes strictly between first and last should't be reference by an other way
    336         for (Way way: ways) {
    337             for (Node node: way.getNodes()) {
    338                 if (way.isFirstLastNode(node)) continue;
    339                 if (ways.stream().filter(wayOther -> way != wayOther).anyMatch(wayOther -> node.getReferrers().contains(wayOther))) {
    340                     return false;
    341                 }
    342             }
    343         }
    344         return true;
    345     }
    346 
    347346}
  • src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

     
    2626import org.openstreetmap.josm.data.validation.TestError;
    2727import org.openstreetmap.josm.data.validation.util.ValUtil;
    2828import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     29import org.openstreetmap.josm.tools.CheckParameterUtil;
    2930import org.openstreetmap.josm.tools.Logging;
    3031
    3132/**
     
    468469        }
    469470    }
    470471
     472    /**
     473     * Check if the given way is self crossing
     474     * @param way the way to check
     475     * @return {@code true} if one or more segments of the way are crossing
     476     * @see SelfIntersectingWay
     477     * @since xxx
     478     */
     479    public static boolean isSelfCrossing(Way way) {
     480        CheckParameterUtil.ensureParameterNotNull(way, "way");
     481        SelfCrossing test = new SelfCrossing();
     482        test.visit(way);
     483        return !test.getErrors().isEmpty();
     484    }
    471485}
  • test/data/alignCircleCases.osm

     
     1<?xml version='1.0' encoding='UTF-8'?>
     2<osm version='0.6' upload='never' generator='JOSM'>
     3  <node id='-102878' action='modify' lat='37.55691419926' lon='14.46148123867' />
     4  <node id='-102879' action='modify' lat='37.55684485074' lon='14.46155150259' />
     5  <node id='-102880' action='modify' lat='37.55687312689' lon='14.46152268691'>
     6    <tag k='sel' v='1' />
     7  </node>
     8  <node id='-102881' action='modify' lat='37.55686036859' lon='14.4615670012' />
     9  <node id='-102882' action='modify' lat='37.5568796806' lon='14.46157247181' />
     10  <node id='-102883' action='modify' lat='37.55689896179' lon='14.46156683088' />
     11  <node id='-102884' action='modify' lat='37.55691439329' lon='14.46155119569' />
     12  <node id='-102885' action='modify' lat='37.55692291869' lon='14.46152866297' />
     13  <node id='-102886' action='modify' lat='37.55692284944' lon='14.4615036956' />
     14  <node id='-102887' action='modify' lat='37.55689868142' lon='14.46146574006' />
     15  <node id='-102888' action='modify' lat='37.55687936941' lon='14.46146026946' />
     16  <node id='-102889' action='modify' lat='37.55686008821' lon='14.46146591038' />
     17  <node id='-102890' action='modify' lat='37.55684465671' lon='14.46148154557' />
     18  <node id='-102891' action='modify' lat='37.5568361313' lon='14.4615040783' />
     19  <node id='-102892' action='modify' lat='37.55683620055' lon='14.46152904567' />
     20  <node id='-102893' action='modify' lat='37.55691716886' lon='14.46163544625'>
     21    <tag k='sel' v='2' />
     22  </node>
     23  <node id='-102894' action='modify' lat='37.55684048956' lon='14.4617253193' />
     24  <node id='-102895' action='modify' lat='37.55685600743' lon='14.46174081791' />
     25  <node id='-102896' action='modify' lat='37.55687531944' lon='14.46174628852' />
     26  <node id='-102897' action='modify' lat='37.55689460063' lon='14.46174064759' />
     27  <node id='-102898' action='modify' lat='37.55691003212' lon='14.4617250124' />
     28  <node id='-102899' action='modify' lat='37.55691855752' lon='14.46170247968' />
     29  <node id='-102900' action='modify' lat='37.55691848827' lon='14.46167751231' />
     30  <node id='-102901' action='modify' lat='37.5569098381' lon='14.46165505538' />
     31  <node id='-102902' action='modify' lat='37.55689432026' lon='14.46163955677' />
     32  <node id='-102903' action='modify' lat='37.55687500825' lon='14.46163408617' />
     33  <node id='-102904' action='modify' lat='37.55685572705' lon='14.46163972709' />
     34  <node id='-102905' action='modify' lat='37.55684029554' lon='14.46165536228' />
     35  <node id='-102906' action='modify' lat='37.55683177013' lon='14.46167789501' />
     36  <node id='-102907' action='modify' lat='37.55683183938' lon='14.46170286238' />
     37  <node id='-102908' action='modify' lat='37.55674469778' lon='14.46135781442'>
     38    <tag k='sel' v='3' />
     39  </node>
     40  <node id='-102909' action='modify' lat='37.55671642158' lon='14.4613866301' />
     41  <node id='-102910' action='modify' lat='37.55673193945' lon='14.46140212871' />
     42  <node id='-102911' action='modify' lat='37.5567512515' lon='14.46140759931' />
     43  <node id='-102912' action='modify' lat='37.55677053272' lon='14.46140195839' />
     44  <node id='-102913' action='modify' lat='37.55678596424' lon='14.4613863232' />
     45  <node id='-102914' action='modify' lat='37.55679448966' lon='14.46136379047'>
     46    <tag k='sel' v='3' />
     47  </node>
     48  <node id='-102915' action='modify' lat='37.55679442042' lon='14.4613388231' />
     49  <node id='-102916' action='modify' lat='37.55678577022' lon='14.46131636618' />
     50  <node id='-102917' action='modify' lat='37.55677025235' lon='14.46130086757' />
     51  <node id='-102918' action='modify' lat='37.55675094031' lon='14.46129539696' />
     52  <node id='-102919' action='modify' lat='37.55673165908' lon='14.46130103789' />
     53  <node id='-102920' action='modify' lat='37.55671622756' lon='14.46131667308' />
     54  <node id='-102921' action='modify' lat='37.55670770212' lon='14.4613392058' />
     55  <node id='-102922' action='modify' lat='37.55670777137' lon='14.46136417318' />
     56  <node id='-102923' action='modify' lat='37.55653956697' lon='14.46209010402' />
     57  <node id='-102924' action='modify' lat='37.55658630124' lon='14.46210554382' />
     58  <node id='-102925' action='modify' lat='37.55665195171' lon='14.46208519136' />
     59  <node id='-102926' action='modify' lat='37.55675376546' lon='14.46201079963' />
     60  <node id='-102927' action='modify' lat='37.55655681414' lon='14.46216660118' />
     61  <node id='-102928' action='modify' lat='37.55660354841' lon='14.46218204098' />
     62  <node id='-102929' action='modify' lat='37.55666919885' lon='14.46216168852' />
     63  <node id='-102930' action='modify' lat='37.55671148217' lon='14.4621280017' />
     64  <node id='-102931' action='modify' lat='37.55677101258' lon='14.46208729679' />
     65  <node id='-102932' action='modify' lat='37.55683731449' lon='14.46239008267' />
     66  <node id='-102933' action='modify' lat='37.5566402416' lon='14.46279572753' />
     67  <node id='-102934' action='modify' lat='37.55671231689' lon='14.46237870724' />
     68  <node id='-102935' action='modify' lat='37.55671347821' lon='14.46241863738' />
     69  <node id='-102936' action='modify' lat='37.55671081506' lon='14.46245223115' />
     70  <node id='-102937' action='modify' lat='37.55668951053' lon='14.46251269911' />
     71  <node id='-102938' action='modify' lat='37.55666953692' lon='14.46255133196' />
     72  <node id='-102939' action='modify' lat='37.55663624754' lon='14.46258492574' />
     73  <node id='-102940' action='modify' lat='37.5565822772' lon='14.46260879036' />
     74  <node id='-102941' action='modify' lat='37.5568586203' lon='14.46265715236' />
     75  <node id='-102942' action='modify' lat='37.55657189412' lon='14.46236592807' />
     76  <node id='-102943' action='modify' lat='37.55644583135' lon='14.46235648889' />
     77  <node id='-102944' action='modify' lat='37.55644733048' lon='14.46237908049' />
     78  <node id='-102945' action='modify' lat='37.55645381458' lon='14.4624002242' />
     79  <node id='-102946' action='modify' lat='37.55646475836' lon='14.4624182071' />
     80  <node id='-102947' action='modify' lat='37.55647927522' lon='14.4624315723' />
     81  <node id='-102948' action='modify' lat='37.55649618907' lon='14.46243923705' />
     82  <node id='-102949' action='modify' lat='37.55651412967' lon='14.46244058038' />
     83  <node id='-102950' action='modify' lat='37.55652895376' lon='14.46243682061' />
     84  <node id='-102951' action='modify' lat='37.55654731191' lon='14.46242438845' />
     85  <node id='-102952' action='modify' lat='37.55656092621' lon='14.46240612819' />
     86  <node id='-102953' action='modify' lat='37.55656828681' lon='14.46238813732' />
     87  <node id='-102954' action='modify' lat='37.556570395' lon='14.46234333647' />
     88  <node id='-102955' action='modify' lat='37.55656391091' lon='14.46232219276' />
     89  <node id='-102956' action='modify' lat='37.55655296714' lon='14.46230420986' />
     90  <node id='-102957' action='modify' lat='37.5565384503' lon='14.46229084466' />
     91  <node id='-102958' action='modify' lat='37.55652153645' lon='14.46228317991' />
     92  <node id='-102959' action='modify' lat='37.55650359584' lon='14.46228183658' />
     93  <node id='-102960' action='modify' lat='37.55648608194' lon='14.46228692348' />
     94  <node id='-102961' action='modify' lat='37.55647041359' lon='14.46229802851' />
     95  <node id='-102962' action='modify' lat='37.55645786016' lon='14.46231425201' />
     96  <node id='-102963' action='modify' lat='37.55644943867' lon='14.46233427964' />
     97  <node id='-102964' action='modify' lat='37.55677883754' lon='14.46238476096' />
     98  <node id='-102965' action='modify' lat='37.55678338581' lon='14.46246734835' />
     99  <node id='-102966' action='modify' lat='37.55675262917' lon='14.46256661489' />
     100  <node id='-102967' action='modify' lat='37.55671281242' lon='14.46262355942' />
     101  <node id='-102968' action='modify' lat='37.55667952306' lon='14.46265211413' />
     102  <node id='-102969' action='modify' lat='37.55664894294' lon='14.46267308698'>
     103    <tag k='highway' v='turning_circle' />
     104  </node>
     105  <node id='-102970' action='modify' lat='37.5566230771' lon='14.46274037141' />
     106  <node id='-102971' action='modify' lat='37.55644192824' lon='14.46154801513' />
     107  <node id='-102972' action='modify' lat='37.55635456852' lon='14.46128700605' />
     108  <node id='-102973' action='modify' lat='37.55646581605' lon='14.46148487984' />
     109  <node id='-102974' action='modify' lat='37.55648104734' lon='14.46176525798' />
     110  <node id='-102975' action='modify' lat='37.55637416104' lon='14.46139356747' />
     111  <node id='-102976' action='modify' lat='37.55648073615' lon='14.46165305563' />
     112  <node id='-102977' action='modify' lat='37.5565285776' lon='14.46152266506' />
     113  <node id='-102978' action='modify' lat='37.55633528719' lon='14.46129264697' />
     114  <node id='-102979' action='modify' lat='37.55643749781' lon='14.46169686447' />
     115  <node id='-102980' action='modify' lat='37.55631139935' lon='14.46135578226' />
     116  <node id='-102981' action='modify' lat='37.55650032863' lon='14.46175961706' />
     117  <node id='-102982' action='modify' lat='37.55650468982' lon='14.46158580035' />
     118  <node id='-102983' action='modify' lat='37.55647885479' lon='14.46154165637'>
     119    <tag k='sel' v='11' />
     120  </node>
     121  <node id='-102984' action='modify' lat='37.55638959263' lon='14.46137793228' />
     122  <node id='-102985' action='modify' lat='37.55652421641' lon='14.46169648177' />
     123  <node id='-102986' action='modify' lat='37.55638939861' lon='14.46130797526' />
     124  <node id='-102987' action='modify' lat='37.55644621729' lon='14.46174428876' />
     125  <node id='-102988' action='modify' lat='37.556441859' lon='14.46152304776' />
     126  <node id='-102989' action='modify' lat='37.55643756705' lon='14.46172183184' />
     127  <node id='-102990' action='modify' lat='37.55648509734' lon='14.46147923892' />
     128  <node id='-102991' action='modify' lat='37.55633556756' lon='14.46139373779' />
     129  <node id='-102992' action='modify' lat='37.55652864684' lon='14.46154763243' />
     130  <node id='-102993' action='modify' lat='37.55651556618' lon='14.46167402484' />
     131  <node id='-102994' action='modify' lat='37.55637388066' lon='14.46129247665' />
     132  <node id='-102995' action='modify' lat='37.55646173522' lon='14.46175978737' />
     133  <node id='-102996' action='modify' lat='37.55651992737' lon='14.46150020813' />
     134  <node id='-102997' action='modify' lat='37.55646145485' lon='14.46165869655' />
     135  <node id='-102998' action='modify' lat='37.55631985558' lon='14.46130828216' />
     136  <node id='-102999' action='modify' lat='37.55648540853' lon='14.46159144127' />
     137  <node id='-103000' action='modify' lat='37.55635487971' lon='14.4613992084' />
     138  <node id='-103001' action='modify' lat='37.55651576021' lon='14.46174398186' />
     139  <node id='-103002' action='modify' lat='37.5563981181' lon='14.46135539956'>
     140    <tag k='sel' v='13' />
     141  </node>
     142  <node id='-103003' action='modify' lat='37.55634832596' lon='14.4613494235'>
     143    <tag k='sel' v='13' />
     144  </node>
     145  <node id='-103004' action='modify' lat='37.55645057848' lon='14.46157047206' />
     146  <node id='-103005' action='modify' lat='37.55645038446' lon='14.46150051503' />
     147  <node id='-103006' action='modify' lat='37.55644602327' lon='14.46167433174' />
     148  <node id='-103007' action='modify' lat='37.55650440945' lon='14.46148470952' />
     149  <node id='-103008' action='modify' lat='37.5563113301' lon='14.46133081489' />
     150  <node id='-103009' action='modify' lat='37.55652428566' lon='14.46172144914' />
     151  <node id='-103010' action='modify' lat='37.55652012139' lon='14.46157016515' />
     152  <node id='-103011' action='modify' lat='37.55639804885' lon='14.46133043219' />
     153  <node id='-103012' action='modify' lat='37.55650004826' lon='14.46165852623' />
     154  <node id='-103013' action='modify' lat='37.55652289699' lon='14.46165441572'>
     155    <tag k='sel' v='12' />
     156  </node>
     157  <node id='-103014' action='modify' lat='37.55646609642' lon='14.46158597066' />
     158  <node id='-103015' action='modify' lat='37.5563200496' lon='14.46137823918' />
     159  <node id='-103016' action='modify' lat='37.5558815644' lon='14.46196208882' />
     160  <node id='-103017' action='modify' lat='37.55599395013' lon='14.46195717616' />
     161  <node id='-103018' action='modify' lat='37.55609576478' lon='14.46188278442' />
     162  <node id='-103019' action='modify' lat='37.55601820525' lon='14.46153058085' />
     163  <node id='-103021' action='modify' lat='37.55603372327' lon='14.46154607946' />
     164  <node id='-103022' action='modify' lat='37.55601801123' lon='14.46146062383' />
     165  <node id='-103023' action='modify' lat='37.5560530355' lon='14.46155155006' />
     166  <node id='-103024' action='modify' lat='37.55608755454' lon='14.46146031692' />
     167  <node id='-103025' action='modify' lat='37.55605272431' lon='14.46143934771' />
     168  <node id='-103026' action='modify' lat='37.5560723169' lon='14.46154590914' />
     169  <node id='-103027' action='modify' lat='37.5560334429' lon='14.46144498863' />
     170  <node id='-103028' action='modify' lat='37.55609620482' lon='14.46148277385' />
     171  <node id='-103029' action='modify' lat='37.55600955497' lon='14.46150812392' />
     172  <node id='-103030' action='modify' lat='37.55607203653' lon='14.46144481831' />
     173  <node id='-103032' action='modify' lat='37.55600948572' lon='14.46148315655' />
     174  <node id='-103076' action='modify' lat='37.5568426502' lon='14.46139296031' />
     175  <node id='-103077' action='modify' lat='37.55685816805' lon='14.46140845892' />
     176  <node id='-103078' action='modify' lat='37.55687748006' lon='14.46141392953' />
     177  <node id='-103079' action='modify' lat='37.55689676126' lon='14.4614082886' />
     178  <node id='-103080' action='modify' lat='37.55691219275' lon='14.46139265341' />
     179  <node id='-103081' action='modify' lat='37.55692071815' lon='14.46137012069' />
     180  <node id='-103082' action='modify' lat='37.55691474499' lon='14.46134763579' />
     181  <node id='-103083' action='modify' lat='37.55691199872' lon='14.46132269639' />
     182  <node id='-103084' action='modify' lat='37.55689648089' lon='14.46130719778' />
     183  <node id='-103085' action='modify' lat='37.55687716887' lon='14.46130172718' />
     184  <node id='-103086' action='modify' lat='37.55685788768' lon='14.4613073681' />
     185  <node id='-103087' action='modify' lat='37.55684245617' lon='14.46132300329' />
     186  <node id='-103088' action='modify' lat='37.55683393076' lon='14.46134553602' />
     187  <node id='-103089' action='modify' lat='37.55683400001' lon='14.46137050339' />
     188  <node id='-103119' action='modify' lat='37.55587222611' lon='14.46211553776' />
     189  <node id='-103120' action='modify' lat='37.555954882' lon='14.46205099363' />
     190  <node id='-103121' action='modify' lat='37.55604737777' lon='14.46209319556' />
     191  <node id='-103122' action='modify' lat='37.55611035355' lon='14.4620013443' />
     192  <node id='-103130' action='modify' lat='37.55611232154' lon='14.46220242409' />
     193  <node id='-103131' action='modify' lat='37.55591158607' lon='14.46251769735' />
     194  <node id='-103132' action='modify' lat='37.55589190609' lon='14.46220490656' />
     195  <node id='-103133' action='modify' lat='37.55613987343' lon='14.46239853895' />
     196  <node id='-103138' action='modify' lat='37.55613003347' lon='14.46261327231' />
     197  <node id='-103139' action='modify' lat='37.55592929804' lon='14.46292854557' />
     198  <node id='-103140' action='modify' lat='37.55590961807' lon='14.46261575478' />
     199  <node id='-103141' action='modify' lat='37.55615758535' lon='14.46280938717' />
     200  <node id='-103150' action='modify' lat='37.55605578204' lon='14.46272989105' />
     201  <node id='-103156' action='modify' lat='37.55582893013' lon='14.46268029891' />
     202  <node id='-103157' action='modify' lat='37.55575467839' lon='14.46279691764' />
     203  <node id='-103158' action='modify' lat='37.55562819389' lon='14.46299557217' />
     204  <node id='-103159' action='modify' lat='37.55560851384' lon='14.46268278138' />
     205  <node id='-103160' action='modify' lat='37.55585648212' lon='14.46287641377' />
     206  <node id='-103187' action='modify' lat='37.55578760212' lon='14.46224090232' />
     207  <node id='-103188' action='modify' lat='37.55558686577' lon='14.46255617558' />
     208  <node id='-103189' action='modify' lat='37.55556718571' lon='14.46224338479' />
     209  <node id='-103190' action='modify' lat='37.55581515413' lon='14.46243701719' />
     210  <node id='-103243' action='modify' lat='37.55644611869' lon='14.46138381242' />
     211  <node id='-103244' action='modify' lat='37.55646163663' lon='14.46139931103' />
     212  <node id='-103245' action='modify' lat='37.55648094875' lon='14.46140478164' />
     213  <node id='-103246' action='modify' lat='37.55650023004' lon='14.46139914071' />
     214  <node id='-103247' action='modify' lat='37.55651566162' lon='14.46138350552' />
     215  <node id='-103248' action='modify' lat='37.55652418706' lon='14.4613609728' />
     216  <node id='-103249' action='modify' lat='37.55651821387' lon='14.46133848789' />
     217  <node id='-103250' action='modify' lat='37.55651546759' lon='14.4613135485' />
     218  <node id='-103251' action='modify' lat='37.55649994967' lon='14.46129804989' />
     219  <node id='-103252' action='modify' lat='37.55648063755' lon='14.46129257929' />
     220  <node id='-103253' action='modify' lat='37.55646135625' lon='14.46129822021' />
     221  <node id='-103254' action='modify' lat='37.55644592466' lon='14.4613138554' />
     222  <node id='-103255' action='modify' lat='37.55643739921' lon='14.46133638813' />
     223  <node id='-103256' action='modify' lat='37.55643746846' lon='14.4613613555' />
     224  <node id='-103272' action='modify' lat='37.556716745' lon='14.46156434474' />
     225  <node id='-103273' action='modify' lat='37.55673226287' lon='14.46157984335' />
     226  <node id='-103274' action='modify' lat='37.55675157492' lon='14.46158531395' />
     227  <node id='-103275' action='modify' lat='37.55677085614' lon='14.46157967303' />
     228  <node id='-103276' action='modify' lat='37.55678628766' lon='14.46156403784' />
     229  <node id='-103277' action='modify' lat='37.55679481308' lon='14.46154150511'>
     230    <tag k='sel' v='4' />
     231  </node>
     232  <node id='-103278' action='modify' lat='37.55679474384' lon='14.46151653774' />
     233  <node id='-103279' action='modify' lat='37.55678012633' lon='14.46150160818' />
     234  <node id='-103280' action='modify' lat='37.55677057577' lon='14.46147858221' />
     235  <node id='-103281' action='modify' lat='37.55675126373' lon='14.4614731116' />
     236  <node id='-103282' action='modify' lat='37.5567319825' lon='14.46147875253' />
     237  <node id='-103283' action='modify' lat='37.55671655098' lon='14.46149438772' />
     238  <node id='-103284' action='modify' lat='37.55670802555' lon='14.46151692044'>
     239    <tag k='sel' v='4' />
     240  </node>
     241  <node id='-103285' action='modify' lat='37.5567080948' lon='14.46154188782' />
     242  <node id='-103349' action='modify' lat='37.55640207453' lon='14.46151110796' />
     243  <node id='-103350' action='modify' lat='37.5563867939' lon='14.46149617839' />
     244  <node id='-103351' action='modify' lat='37.55637790634' lon='14.46147315242' />
     245  <node id='-103352' action='modify' lat='37.55635859419' lon='14.46146768182' />
     246  <node id='-103353' action='modify' lat='37.55633931287' lon='14.46147332274' />
     247  <node id='-103354' action='modify' lat='37.55632388126' lon='14.46148895793' />
     248  <node id='-103355' action='modify' lat='37.55631535579' lon='14.46151149066'>
     249    <tag k='sel' v='14' />
     250  </node>
     251  <node id='-103356' action='modify' lat='37.55637818671' lon='14.46157424325' />
     252  <node id='-103357' action='modify' lat='37.55639361831' lon='14.46155860805' />
     253  <node id='-103358' action='modify' lat='37.55640214377' lon='14.46153607533'>
     254    <tag k='sel' v='14' />
     255  </node>
     256  <node id='-103359' action='modify' lat='37.55631542503' lon='14.46153645803' />
     257  <node id='-103360' action='modify' lat='37.55632407528' lon='14.46155891496' />
     258  <node id='-103361' action='modify' lat='37.55633959324' lon='14.46157441356' />
     259  <node id='-103362' action='modify' lat='37.55635890538' lon='14.46157988417' />
     260  <node id='-103378' action='modify' lat='37.55605448327' lon='14.4613042381'>
     261    <tag k='invalid-selection' v='yes' />
     262    <tag k='sel' v='20' />
     263  </node>
     264  <node id='-103409' action='modify' lat='37.5558489401' lon='14.46128918337' />
     265  <node id='-103410' action='modify' lat='37.55584363576' lon='14.46140293022' />
     266  <node id='-103411' action='modify' lat='37.55578130964' lon='14.4614129667' />
     267  <node id='-103412' action='modify' lat='37.55577335312' lon='14.46129420161' />
     268  <node id='-103497' action='modify' lat='37.55571746794' lon='14.46144177661' />
     269  <node id='-103498' action='modify' lat='37.5555167314' lon='14.46175704987' />
     270  <node id='-103499' action='modify' lat='37.55549705132' lon='14.46144425908' />
     271  <node id='-103500' action='modify' lat='37.55574501997' lon='14.46163789148' />
     272  <node id='-103501' action='modify' lat='37.55575879599' lon='14.4618811732' />
     273  <node id='-103502' action='modify' lat='37.55568454418' lon='14.46199779193' />
     274  <node id='-103503' action='modify' lat='37.55555805956' lon='14.46219644646' />
     275  <node id='-103504' action='modify' lat='37.55553837949' lon='14.46188365567' />
     276  <node id='-103505' action='modify' lat='37.555786348' lon='14.46207728806' />
     277  <node id='-103638' action='modify' lat='37.55675310861' lon='14.46175472442' />
     278  <node id='-103639' action='modify' lat='37.55671827868' lon='14.46173375521' />
     279  <node id='-103640' action='modify' lat='37.55673379656' lon='14.46174925382' />
     280  <node id='-103641' action='modify' lat='37.55678782135' lon='14.46173344831' />
     281  <node id='-103642' action='modify' lat='37.55677238983' lon='14.4617490835' />
     282  <node id='-103643' action='modify' lat='37.55670962848' lon='14.46171129829' />
     283  <node id='-103644' action='modify' lat='37.55679627752' lon='14.46168594821'>
     284    <tag k='sel' v='5' />
     285  </node>
     286  <node id='-103645' action='modify' lat='37.55673351619' lon='14.461648163' />
     287  <node id='-103646' action='modify' lat='37.55679634676' lon='14.46171091558'>
     288    <tag k='sel' v='5' />
     289  </node>
     290  <node id='-103647' action='modify' lat='37.55675279742' lon='14.46164252207' />
     291  <node id='-103648' action='modify' lat='37.55677210946' lon='14.46164799268'>
     292    <tag k='sel' v='5' />
     293  </node>
     294  <node id='-103649' action='modify' lat='37.55670955923' lon='14.46168633091'>
     295    <tag k='sel' v='5' />
     296  </node>
     297  <node id='-103650' action='modify' lat='37.55678166001' lon='14.46167101866' />
     298  <node id='-103651' action='modify' lat='37.55671808466' lon='14.46166379819' />
     299  <node id='-103724' action='modify' lat='37.55635782999' lon='14.46164914107' />
     300  <node id='-103725' action='modify' lat='37.55632311706' lon='14.46167041719' />
     301  <node id='-103726' action='modify' lat='37.55637742251' lon='14.4617557025' />
     302  <node id='-103727' action='modify' lat='37.55633882903' lon='14.46175587282' />
     303  <node id='-103728' action='modify' lat='37.55639285411' lon='14.46174006731' />
     304  <node id='-103729' action='modify' lat='37.55632331108' lon='14.46174037421' />
     305  <node id='-103730' action='modify' lat='37.55640131033' lon='14.46169256721'>
     306    <tag k='sel' v='15' />
     307  </node>
     308  <node id='-103731' action='modify' lat='37.55631466083' lon='14.46171791729' />
     309  <node id='-103732' action='modify' lat='37.55640137957' lon='14.46171753458'>
     310    <tag k='sel' v='15' />
     311  </node>
     312  <node id='-103733' action='modify' lat='37.55638669274' lon='14.46167763766' />
     313  <node id='-103734' action='modify' lat='37.55633854866' lon='14.461654782' />
     314  <node id='-103735' action='modify' lat='37.55631459158' lon='14.46169294991'>
     315    <tag k='sel' v='15' />
     316  </node>
     317  <node id='-103736' action='modify' lat='37.55637714213' lon='14.46165461168'>
     318    <tag k='sel' v='15' />
     319  </node>
     320  <node id='-103737' action='modify' lat='37.55635814118' lon='14.46176134342' />
     321  <node id='-103819' action='modify' lat='37.55660656928' lon='14.46128015712' />
     322  <node id='-103820' action='modify' lat='37.55657229559' lon='14.46130125895' />
     323  <node id='-103821' action='modify' lat='37.55662591633' lon='14.4613853016' />
     324  <node id='-103822' action='modify' lat='37.55658790494' lon='14.4613854776' />
     325  <node id='-103823' action='modify' lat='37.55664112636' lon='14.4613699233' />
     326  <node id='-103824' action='modify' lat='37.55657260581' lon='14.46137024057' />
     327  <node id='-103825' action='modify' lat='37.55664952202' lon='14.46132307658' />
     328  <node id='-103826' action='modify' lat='37.5565640487' lon='14.4613481477' />
     329  <node id='-103827' action='modify' lat='37.55665273282' lon='14.46135042447'>
     330    <tag k='sel' v='7' />
     331  </node>
     332  <node id='-103828' action='modify' lat='37.55664099118' lon='14.46130087148' />
     333  <node id='-103829' action='modify' lat='37.55658751983' lon='14.46128576501' />
     334  <node id='-103830' action='modify' lat='37.55655624194' lon='14.46133124339'>
     335    <tag k='sel' v='7' />
     336  </node>
     337  <node id='-103831' action='modify' lat='37.55662565772' lon='14.46128554989' />
     338  <node id='-103832' action='modify' lat='37.55660692653' lon='14.46139085149' />
     339  <node id='-103856' action='modify' lat='37.55660676548' lon='14.46133550421'>
     340    <tag k='sel' v='7' />
     341  </node>
     342  <node id='-103930' action='modify' lat='37.55590697927' lon='14.46138712673' />
     343  <node id='-103931' action='modify' lat='37.55597507195' lon='14.46131728109' />
     344  <node id='-103932' action='modify' lat='37.55597559287' lon='14.46138630275' />
     345  <node id='-103933' action='modify' lat='37.55598389844' lon='14.46136400694' />
     346  <node id='-103934' action='modify' lat='37.55590645835' lon='14.46131810506' />
     347  <node id='-103935' action='modify' lat='37.55589815277' lon='14.46134040087' />
     348  <node id='-103936' action='modify' lat='37.55594060788' lon='14.46129685283' />
     349  <node id='-103937' action='modify' lat='37.5559216104' lon='14.46130256294' />
     350  <node id='-103938' action='modify' lat='37.55594144336' lon='14.46140755499' />
     351  <node id='-103939' action='modify' lat='37.55595968808' lon='14.46130210567' />
     352  <node id='-103940' action='modify' lat='37.55592236315' lon='14.46140230214' />
     353  <node id='-103941' action='modify' lat='37.55589833868' lon='14.46136503442' />
     354  <node id='-103942' action='modify' lat='37.5559282237' lon='14.46134925932'>
     355    <tag k='invalid-selection' v='yes' />
     356    <tag k='sel' v='28' />
     357  </node>
     358  <node id='-103943' action='modify' lat='37.55596044083' lon='14.46140184487' />
     359  <node id='-103944' action='modify' lat='37.55598371253' lon='14.46133937339' />
     360  <node id='-103949' action='modify' lat='37.55595147095' lon='14.46137426998'>
     361    <tag k='sel' v='28' />
     362  </node>
     363  <node id='-104045' action='modify' lat='37.55599573207' lon='14.46172257931' />
     364  <node id='-104046' action='modify' lat='37.55601125009' lon='14.46173807792' />
     365  <node id='-104047' action='modify' lat='37.55603056233' lon='14.46174354852' />
     366  <node id='-104048' action='modify' lat='37.55604984374' lon='14.4617379076' />
     367  <node id='-104049' action='modify' lat='37.55606527541' lon='14.46172227241' />
     368  <node id='-104050' action='modify' lat='37.5560738009' lon='14.46169973968' />
     369  <node id='-104051' action='modify' lat='37.55607373166' lon='14.46167477231' />
     370  <node id='-104052' action='modify' lat='37.55605911401' lon='14.46165984275' />
     371  <node id='-104053' action='modify' lat='37.55604956336' lon='14.46163681678' />
     372  <node id='-104054' action='modify' lat='37.55603025114' lon='14.46163134617' />
     373  <node id='-104055' action='modify' lat='37.55601096972' lon='14.4616369871' />
     374  <node id='-104056' action='modify' lat='37.55599553805' lon='14.46165262229' />
     375  <node id='-104057' action='modify' lat='37.55598701253' lon='14.46167515501' />
     376  <node id='-104058' action='modify' lat='37.55598708178' lon='14.46170012239' />
     377  <node id='-104059' action='modify' lat='37.55601928253' lon='14.46166005296' />
     378  <node id='-104060' action='modify' lat='37.55605106444' lon='14.46168343898' />
     379  <node id='-104061' action='modify' lat='37.55603305469' lon='14.46171551124' />
     380  <node id='-104062' action='modify' lat='37.55601398554' lon='14.46171751576' />
     381  <way id='-102697' action='modify'>
     382    <nd ref='-102879' />
     383    <nd ref='-102881' />
     384    <nd ref='-102882' />
     385    <nd ref='-102883' />
     386    <nd ref='-102884' />
     387    <nd ref='-102885' />
     388    <nd ref='-102886' />
     389    <nd ref='-102878' />
     390    <nd ref='-102887' />
     391    <nd ref='-102888' />
     392    <nd ref='-102889' />
     393    <nd ref='-102890' />
     394    <nd ref='-102891' />
     395    <nd ref='-102892' />
     396    <nd ref='-102879' />
     397    <tag k='highway' v='unclassified' />
     398    <tag k='sel' v='1' />
     399  </way>
     400  <way id='-102698' action='modify'>
     401    <nd ref='-102894' />
     402    <nd ref='-102895' />
     403    <nd ref='-102896' />
     404    <nd ref='-102897' />
     405    <nd ref='-102898' />
     406    <nd ref='-102899' />
     407    <nd ref='-102900' />
     408    <nd ref='-102901' />
     409    <nd ref='-102902' />
     410    <nd ref='-102903' />
     411    <nd ref='-102904' />
     412    <nd ref='-102905' />
     413    <nd ref='-102906' />
     414    <nd ref='-102907' />
     415    <nd ref='-102894' />
     416    <tag k='highway' v='unclassified' />
     417    <tag k='sel' v='2' />
     418  </way>
     419  <way id='-102699' action='modify'>
     420    <nd ref='-102909' />
     421    <nd ref='-102910' />
     422    <nd ref='-102911' />
     423    <nd ref='-102912' />
     424    <nd ref='-102913' />
     425    <nd ref='-102914' />
     426    <nd ref='-102915' />
     427    <nd ref='-102916' />
     428    <nd ref='-102917' />
     429    <nd ref='-102918' />
     430    <nd ref='-102919' />
     431    <nd ref='-102920' />
     432    <nd ref='-102921' />
     433    <nd ref='-102922' />
     434    <nd ref='-102909' />
     435    <tag k='highway' v='unclassified' />
     436    <tag k='sel' v='3' />
     437  </way>
     438  <way id='-102700' action='modify'>
     439    <nd ref='-102923' />
     440    <nd ref='-102924' />
     441    <nd ref='-102925' />
     442    <nd ref='-102926' />
     443    <tag k='highway' v='unclassified' />
     444    <tag k='sel' v='40' />
     445  </way>
     446  <way id='-102701' action='modify'>
     447    <nd ref='-102927' />
     448    <nd ref='-102928' />
     449    <nd ref='-102929' />
     450    <nd ref='-102930' />
     451    <nd ref='-102931' />
     452    <tag k='highway' v='unclassified' />
     453    <tag k='sel' v='41' />
     454  </way>
     455  <way id='-102702' action='modify'>
     456    <nd ref='-102933' />
     457    <nd ref='-102970' />
     458    <nd ref='-102940' />
     459    <nd ref='-102950' />
     460    <tag k='highway' v='unclassified' />
     461  </way>
     462  <way id='-102703' action='modify'>
     463    <nd ref='-102934' />
     464    <nd ref='-102935' />
     465    <nd ref='-102936' />
     466    <nd ref='-102937' />
     467    <nd ref='-102938' />
     468    <nd ref='-102939' />
     469    <nd ref='-102940' />
     470    <tag k='highway' v='unclassified' />
     471    <tag k='name' v='case1' />
     472    <tag k='sel' v='42' />
     473  </way>
     474  <way id='-102704' action='modify'>
     475    <nd ref='-102952' />
     476    <nd ref='-102937' />
     477    <nd ref='-102966' />
     478    <nd ref='-102941' />
     479    <tag k='highway' v='unclassified' />
     480  </way>
     481  <way id='-102705' action='modify'>
     482    <nd ref='-102943' />
     483    <nd ref='-102944' />
     484    <nd ref='-102945' />
     485    <nd ref='-102946' />
     486    <nd ref='-102947' />
     487    <nd ref='-102948' />
     488    <nd ref='-102949' />
     489    <nd ref='-102950' />
     490    <nd ref='-102951' />
     491    <nd ref='-102952' />
     492    <nd ref='-102953' />
     493    <nd ref='-102942' />
     494    <nd ref='-102954' />
     495    <nd ref='-102955' />
     496    <nd ref='-102956' />
     497    <nd ref='-102957' />
     498    <nd ref='-102958' />
     499    <nd ref='-102959' />
     500    <nd ref='-102960' />
     501    <nd ref='-102961' />
     502    <nd ref='-102962' />
     503    <nd ref='-102963' />
     504    <nd ref='-102943' />
     505    <tag k='highway' v='unclassified' />
     506  </way>
     507  <way id='-102706' action='modify'>
     508    <nd ref='-102942' />
     509    <nd ref='-102934' />
     510    <nd ref='-102964' />
     511    <nd ref='-102932' />
     512    <tag k='highway' v='unclassified' />
     513  </way>
     514  <way id='-102707' action='modify'>
     515    <nd ref='-102964' />
     516    <nd ref='-102965' />
     517    <nd ref='-102966' />
     518    <nd ref='-102967' />
     519    <nd ref='-102968' />
     520    <nd ref='-102969' />
     521    <tag k='highway' v='unclassified' />
     522    <tag k='sel' v='43' />
     523  </way>
     524  <way id='-102708' action='modify'>
     525    <nd ref='-102979' />
     526    <nd ref='-102989' />
     527    <nd ref='-102987' />
     528    <nd ref='-102995' />
     529    <nd ref='-102974' />
     530    <nd ref='-102981' />
     531    <tag k='highway' v='unclassified' />
     532    <tag k='sel' v='12' />
     533  </way>
     534  <way id='-102709' action='modify'>
     535    <nd ref='-102988' />
     536    <nd ref='-102971' />
     537    <nd ref='-103004' />
     538    <nd ref='-103014' />
     539    <nd ref='-102999' />
     540    <nd ref='-102982' />
     541    <tag k='highway' v='unclassified' />
     542    <tag k='sel' v='11' />
     543  </way>
     544  <way id='-102710' action='modify'>
     545    <nd ref='-103008' />
     546    <nd ref='-102980' />
     547    <nd ref='-103015' />
     548    <nd ref='-102991' />
     549    <nd ref='-103000' />
     550    <nd ref='-102975' />
     551    <tag k='highway' v='unclassified' />
     552    <tag k='sel' v='13' />
     553  </way>
     554  <way id='-102711' action='modify'>
     555    <nd ref='-102977' />
     556    <nd ref='-102996' />
     557    <nd ref='-103007' />
     558    <nd ref='-102990' />
     559    <nd ref='-102973' />
     560    <nd ref='-103005' />
     561    <nd ref='-102988' />
     562    <tag k='highway' v='unclassified' />
     563    <tag k='sel' v='11' />
     564  </way>
     565  <way id='-102712' action='modify'>
     566    <nd ref='-102985' />
     567    <nd ref='-102993' />
     568    <nd ref='-103012' />
     569    <nd ref='-102976' />
     570    <nd ref='-102997' />
     571    <nd ref='-103006' />
     572    <nd ref='-102979' />
     573    <tag k='highway' v='unclassified' />
     574    <tag k='sel' v='12' />
     575  </way>
     576  <way id='-102713' action='modify'>
     577    <nd ref='-103011' />
     578    <nd ref='-102986' />
     579    <nd ref='-102994' />
     580    <nd ref='-102972' />
     581    <nd ref='-102978' />
     582    <nd ref='-102998' />
     583    <nd ref='-103008' />
     584    <tag k='highway' v='unclassified' />
     585    <tag k='sel' v='13' />
     586  </way>
     587  <way id='-102714' action='modify'>
     588    <nd ref='-103016' />
     589    <nd ref='-103017' />
     590    <nd ref='-103018' />
     591    <tag k='highway' v='unclassified' />
     592    <tag k='invalid-selection' v='yes' />
     593    <tag k='sel' v='25' />
     594  </way>
     595  <way id='-102715' action='modify'>
     596    <nd ref='-102975' />
     597    <nd ref='-102984' />
     598    <nd ref='-103002' />
     599    <nd ref='-103011' />
     600    <tag k='highway' v='unclassified' />
     601    <tag k='sel' v='13' />
     602  </way>
     603  <way id='-102716' action='modify'>
     604    <nd ref='-102982' />
     605    <nd ref='-103010' />
     606    <nd ref='-102992' />
     607    <nd ref='-102977' />
     608    <tag k='highway' v='unclassified' />
     609    <tag k='sel' v='11' />
     610  </way>
     611  <way id='-102717' action='modify'>
     612    <nd ref='-102981' />
     613    <nd ref='-103001' />
     614    <nd ref='-103009' />
     615    <nd ref='-102985' />
     616    <tag k='highway' v='unclassified' />
     617    <tag k='sel' v='12' />
     618  </way>
     619  <way id='-102718' action='modify'>
     620    <nd ref='-103032' />
     621    <nd ref='-103029' />
     622    <nd ref='-103019' />
     623    <nd ref='-103021' />
     624    <nd ref='-103023' />
     625    <nd ref='-103026' />
     626    <tag k='highway' v='unclassified' />
     627    <tag k='invalid-selection' v='yes' />
     628    <tag k='sel' v='21' />
     629  </way>
     630  <way id='-102720' action='modify'>
     631    <nd ref='-103028' />
     632    <nd ref='-103024' />
     633    <nd ref='-103030' />
     634    <nd ref='-103025' />
     635    <nd ref='-103027' />
     636    <nd ref='-103022' />
     637    <nd ref='-103032' />
     638    <tag k='highway' v='unclassified' />
     639    <tag k='invalid-selection' v='yes' />
     640    <tag k='sel' v='21' />
     641  </way>
     642  <way id='-102730' action='modify'>
     643    <nd ref='-103076' />
     644    <nd ref='-103089' />
     645    <nd ref='-103088' />
     646    <nd ref='-103087' />
     647    <nd ref='-103086' />
     648    <nd ref='-103085' />
     649    <nd ref='-103084' />
     650    <nd ref='-103083' />
     651    <nd ref='-103082' />
     652    <nd ref='-103081' />
     653    <nd ref='-103080' />
     654    <nd ref='-103079' />
     655    <nd ref='-103078' />
     656    <nd ref='-103077' />
     657    <nd ref='-103076' />
     658    <tag k='highway' v='unclassified' />
     659    <tag k='sel' v='0' />
     660  </way>
     661  <way id='-102764' action='modify'>
     662    <nd ref='-103119' />
     663    <nd ref='-103120' />
     664    <nd ref='-103121' />
     665    <nd ref='-103122' />
     666    <tag k='highway' v='unclassified' />
     667    <tag k='invalid-selection' v='yes' />
     668    <tag k='sel' v='31' />
     669  </way>
     670  <way id='-102786' action='modify'>
     671    <nd ref='-103130' />
     672    <nd ref='-103131' />
     673    <nd ref='-103132' />
     674    <nd ref='-103133' />
     675    <tag k='highway' v='unclassified' />
     676    <tag k='invalid-selection' v='yes' />
     677    <tag k='sel' v='32' />
     678  </way>
     679  <way id='-102802' action='modify'>
     680    <nd ref='-103138' />
     681    <nd ref='-103150' />
     682    <nd ref='-103139' />
     683    <nd ref='-103140' />
     684    <nd ref='-103150' />
     685    <nd ref='-103141' />
     686    <tag k='highway' v='unclassified' />
     687    <tag k='invalid-selection' v='yes' />
     688    <tag k='sel' v='33' />
     689  </way>
     690  <way id='-102814' action='modify'>
     691    <nd ref='-103156' />
     692    <nd ref='-103157' />
     693    <nd ref='-103158' />
     694    <nd ref='-103159' />
     695    <nd ref='-103157' />
     696    <nd ref='-103160' />
     697    <nd ref='-103156' />
     698    <tag k='highway' v='unclassified' />
     699    <tag k='invalid-selection' v='yes' />
     700    <tag k='sel' v='35' />
     701  </way>
     702  <way id='-102848' action='modify'>
     703    <nd ref='-103187' />
     704    <nd ref='-103188' />
     705    <nd ref='-103189' />
     706    <nd ref='-103190' />
     707    <nd ref='-103187' />
     708    <tag k='highway' v='unclassified' />
     709    <tag k='invalid-selection' v='yes' />
     710    <tag k='sel' v='34' />
     711  </way>
     712  <way id='-102898' action='modify'>
     713    <nd ref='-103255' />
     714    <nd ref='-103254' />
     715    <nd ref='-103253' />
     716    <nd ref='-103252' />
     717    <nd ref='-103251' />
     718    <nd ref='-103250' />
     719    <nd ref='-103249' />
     720    <tag k='highway' v='unclassified' />
     721    <tag k='sel' v='10' />
     722  </way>
     723  <way id='-102899' action='modify'>
     724    <nd ref='-103246' />
     725    <nd ref='-103245' />
     726    <nd ref='-103244' />
     727    <nd ref='-103243' />
     728    <nd ref='-103256' />
     729    <nd ref='-103255' />
     730    <tag k='highway' v='unclassified' />
     731    <tag k='sel' v='10' />
     732  </way>
     733  <way id='-102900' action='modify'>
     734    <nd ref='-103249' />
     735    <nd ref='-103248' />
     736    <nd ref='-103247' />
     737    <nd ref='-103246' />
     738    <tag k='highway' v='unclassified' />
     739    <tag k='sel' v='10' />
     740  </way>
     741  <way id='-102903' action='modify'>
     742    <nd ref='-103272' />
     743    <nd ref='-103273' />
     744    <nd ref='-103274' />
     745    <nd ref='-103275' />
     746    <nd ref='-103276' />
     747    <nd ref='-103277' />
     748    <nd ref='-103278' />
     749    <nd ref='-103279' />
     750    <nd ref='-103280' />
     751    <nd ref='-103281' />
     752    <nd ref='-103282' />
     753    <nd ref='-103283' />
     754    <nd ref='-103284' />
     755    <nd ref='-103285' />
     756    <nd ref='-103272' />
     757    <tag k='highway' v='unclassified' />
     758    <tag k='sel' v='4' />
     759  </way>
     760  <way id='-102982' action='modify'>
     761    <nd ref='-103349' />
     762    <nd ref='-103350' />
     763    <nd ref='-103351' />
     764    <nd ref='-103352' />
     765    <nd ref='-103353' />
     766    <nd ref='-103354' />
     767    <nd ref='-103355' />
     768    <tag k='highway' v='unclassified' />
     769    <tag k='sel' v='14' />
     770  </way>
     771  <way id='-102983' action='modify'>
     772    <nd ref='-103356' />
     773    <nd ref='-103357' />
     774    <nd ref='-103358' />
     775    <nd ref='-103349' />
     776    <tag k='highway' v='unclassified' />
     777    <tag k='sel' v='14' />
     778  </way>
     779  <way id='-102984' action='modify'>
     780    <nd ref='-103355' />
     781    <nd ref='-103359' />
     782    <nd ref='-103360' />
     783    <nd ref='-103361' />
     784    <nd ref='-103362' />
     785    <nd ref='-103356' />
     786    <tag k='highway' v='unclassified' />
     787    <tag k='sel' v='14' />
     788  </way>
     789  <way id='-103005' action='modify'>
     790    <nd ref='-103409' />
     791    <nd ref='-103410' />
     792    <nd ref='-103411' />
     793    <nd ref='-103412' />
     794    <nd ref='-103409' />
     795  </way>
     796  <way id='-103211' action='modify'>
     797    <nd ref='-103500' />
     798    <nd ref='-103497' />
     799    <nd ref='-103498' />
     800    <tag k='highway' v='unclassified' />
     801    <tag k='invalid-selection' v='yes' />
     802    <tag k='sel' v='36' />
     803  </way>
     804  <way id='-103212' action='modify'>
     805    <nd ref='-103505' />
     806    <nd ref='-103501' />
     807    <nd ref='-103502' />
     808    <nd ref='-103503' />
     809    <tag k='highway' v='unclassified' />
     810    <tag k='invalid-selection' v='yes' />
     811    <tag k='sel' v='37' />
     812  </way>
     813  <way id='-103214' action='modify'>
     814    <nd ref='-103498' />
     815    <nd ref='-103499' />
     816    <nd ref='-103500' />
     817    <tag k='highway' v='unclassified' />
     818    <tag k='invalid-selection' v='yes' />
     819    <tag k='sel' v='36' />
     820  </way>
     821  <way id='-103217' action='modify'>
     822    <nd ref='-103503' />
     823    <nd ref='-103504' />
     824    <nd ref='-103502' />
     825    <nd ref='-103505' />
     826    <tag k='highway' v='unclassified' />
     827    <tag k='invalid-selection' v='yes' />
     828    <tag k='sel' v='37' />
     829  </way>
     830  <way id='-103327' action='modify'>
     831    <nd ref='-103639' />
     832    <nd ref='-103640' />
     833    <nd ref='-103638' />
     834    <nd ref='-103642' />
     835    <nd ref='-103641' />
     836    <nd ref='-103646' />
     837    <nd ref='-103644' />
     838    <nd ref='-103650' />
     839    <nd ref='-103648' />
     840    <nd ref='-103647' />
     841    <nd ref='-103645' />
     842    <nd ref='-103651' />
     843    <nd ref='-103649' />
     844    <nd ref='-103643' />
     845    <nd ref='-103639' />
     846    <tag k='highway' v='unclassified' />
     847    <tag k='sel' v='5' />
     848  </way>
     849  <way id='-103364' action='modify'>
     850    <nd ref='-103729' />
     851    <nd ref='-103727' />
     852    <nd ref='-103737' />
     853    <nd ref='-103726' />
     854    <nd ref='-103728' />
     855    <nd ref='-103732' />
     856    <nd ref='-103730' />
     857    <nd ref='-103733' />
     858    <nd ref='-103736' />
     859    <nd ref='-103724' />
     860    <nd ref='-103734' />
     861    <nd ref='-103725' />
     862    <nd ref='-103735' />
     863    <nd ref='-103731' />
     864    <nd ref='-103729' />
     865    <tag k='highway' v='unclassified' />
     866    <tag k='sel' v='15' />
     867  </way>
     868  <way id='-103383' action='modify'>
     869    <nd ref='-103824' />
     870    <nd ref='-103822' />
     871    <nd ref='-103832' />
     872    <nd ref='-103821' />
     873    <nd ref='-103823' />
     874    <nd ref='-103827' />
     875    <nd ref='-103825' />
     876    <nd ref='-103828' />
     877    <nd ref='-103831' />
     878    <nd ref='-103819' />
     879    <nd ref='-103829' />
     880    <nd ref='-103820' />
     881    <nd ref='-103830' />
     882    <nd ref='-103826' />
     883    <nd ref='-103824' />
     884    <tag k='highway' v='unclassified' />
     885    <tag k='sel' v='7' />
     886  </way>
     887  <way id='-103411' action='modify'>
     888    <nd ref='-103930' />
     889    <nd ref='-103940' />
     890    <nd ref='-103938' />
     891    <nd ref='-103943' />
     892    <nd ref='-103932' />
     893    <nd ref='-103933' />
     894    <nd ref='-103944' />
     895    <nd ref='-103931' />
     896    <nd ref='-103939' />
     897    <nd ref='-103936' />
     898    <nd ref='-103937' />
     899    <nd ref='-103934' />
     900    <nd ref='-103935' />
     901    <nd ref='-103941' />
     902    <nd ref='-103930' />
     903    <tag k='highway' v='unclassified' />
     904    <tag k='invalid-selection' v='yes' />
     905    <tag k='sel' v='28' />
     906  </way>
     907  <way id='-103467' action='modify'>
     908    <nd ref='-104058' />
     909    <nd ref='-104045' />
     910    <nd ref='-104046' />
     911    <nd ref='-104047' />
     912    <nd ref='-104048' />
     913    <nd ref='-104049' />
     914    <nd ref='-104050' />
     915    <nd ref='-104051' />
     916    <tag k='highway' v='unclassified' />
     917    <tag k='invalid-selection' v='yes' />
     918    <tag k='sel' v='29' />
     919  </way>
     920  <way id='-103468' action='modify'>
     921    <nd ref='-104059' />
     922    <nd ref='-104060' />
     923    <nd ref='-104061' />
     924    <nd ref='-104062' />
     925    <tag k='highway' v='unclassified' />
     926    <tag k='invalid-selection' v='yes' />
     927    <tag k='sel' v='29' />
     928  </way>
     929  <way id='-103471' action='modify'>
     930    <nd ref='-104059' />
     931    <nd ref='-104062' />
     932    <tag k='highway' v='unclassified' />
     933    <tag k='invalid-selection' v='yes' />
     934    <tag k='sel' v='29' />
     935  </way>
     936  <way id='-103494' action='modify'>
     937    <nd ref='-104051' />
     938    <nd ref='-104052' />
     939    <nd ref='-104053' />
     940    <nd ref='-104054' />
     941    <nd ref='-104055' />
     942    <nd ref='-104056' />
     943    <nd ref='-104057' />
     944    <nd ref='-104058' />
     945    <tag k='highway' v='unclassified' />
     946    <tag k='invalid-selection' v='yes' />
     947    <tag k='sel' v='29' />
     948  </way>
     949  <relation id='-99748' action='modify'>
     950    <member type='way' ref='-103005' role='outer' />
     951    <tag k='invalid-selection' v='yes' />
     952    <tag k='natural' v='water' />
     953    <tag k='sel' v='50' />
     954    <tag k='type' v='multipolygon' />
     955  </relation>
     956</osm>
  • test/data/regress/20041/circle-action.osm

     
     1<?xml version='1.0' encoding='UTF-8'?>
     2<osm version='0.6' generator='JOSM'>
     3  <node id='3353142168' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90029704945' lon='8.44321406009' />
     4  <node id='3353142170' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90031807489' lon='8.44326193915' />
     5  <node id='3353142171' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90030468523' lon='8.44306677855' />
     6  <node id='3353142174' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90033729149' lon='8.44301884234' />
     7  <node id='3353142175' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90034976283' lon='8.44329321571' />
     8  <node id='3353142183' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90040118461' lon='8.44329685665' />
     9  <node id='3353142184' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.9004078959' lon='8.44300955386' />
     10  <node id='3353142189' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90046511808' lon='8.44319779138' />
     11  <node id='3353142190' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90044790476' lon='8.44305434646' />
     12  <node id='3353142192' action='modify' timestamp='2015-02-15T23:33:27Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323' lat='52.90046284581' lon='8.44309505092' />
     13  <way id='-104527' action='modify' visible='true'>
     14    <nd ref='3353142171' />
     15    <nd ref='3353142168' />
     16    <nd ref='3353142170' />
     17    <nd ref='3353142175' />
     18    <nd ref='3353142183' />
     19    <nd ref='3353142189' />
     20    <nd ref='3353142192' />
     21    <nd ref='3353142190' />
     22    <nd ref='3353142184' />
     23    <nd ref='3353142174' />
     24    <nd ref='3353142171' />
     25    <tag k='barrier' v='fence' />
     26  </way>
     27  <way id='328483730' timestamp='2015-02-15T23:33:35Z' uid='715371' user='715371' visible='true' version='1' changeset='28875323'>
     28    <nd ref='3353142174' />
     29    <nd ref='3353142184' />
     30    <nd ref='3353142190' />
     31    <nd ref='3353142192' />
     32    <nd ref='3353142189' />
     33    <nd ref='3353142183' />
     34    <nd ref='3353142175' />
     35    <nd ref='3353142170' />
     36    <nd ref='3353142168' />
     37    <nd ref='3353142171' />
     38    <nd ref='3353142174' />
     39    <tag k='natural' v='water' />
     40  </way>
     41</osm>
  • test/unit/org/openstreetmap/josm/actions/AlignInCircleActionTest.java

     
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertNotNull;
    66import static org.junit.jupiter.api.Assertions.assertThrows;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    78
    89import java.nio.file.Files;
    910import java.nio.file.Paths;
     
    1314import org.junit.jupiter.api.Test;
    1415import org.junit.jupiter.api.extension.RegisterExtension;
    1516import org.openstreetmap.josm.TestUtils;
     17import org.openstreetmap.josm.actions.AlignInCircleAction.InvalidSelection;
    1618import org.openstreetmap.josm.command.Command;
    1719import org.openstreetmap.josm.data.osm.DataSet;
    1820import org.openstreetmap.josm.data.osm.Node;
     21import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1922import org.openstreetmap.josm.data.osm.Way;
    2023import org.openstreetmap.josm.io.OsmReader;
    2124import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    9295    }
    9396
    9497    /**
    95      * Test case: way with several nodes selected
    96      * @throws Exception if an error occurs
    97      */
    98     @Test
    99     void testNodesSelected() throws Exception {
    100         DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "alignCircleBefore.osm")), null);
    101         DataSet ds2 = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "alignCircleAfter2.osm")), null);
    102 
    103         Way circularWay = null;
    104         for (Way w : ds.getWays()) {
    105             if ("roundabout".equals(w.get("junction"))) {
    106                 circularWay = w;
    107                 break;
    108             }
    109         }
    110         assertNotNull(circularWay);
    111         if (circularWay != null) {
    112             ds.setSelected(circularWay.getNodes());
    113             Command c = AlignInCircleAction.buildCommand(ds);
    114             assertNotNull(c);
    115             c.executeCommand();
    116             Way expected = (Way) ds2.getPrimitiveById(circularWay);
    117             assertNotNull(expected);
    118             assertEquals(expected, circularWay);
    119             assertEquals(expected.getNodesCount(), circularWay.getNodesCount());
    120             for (Node n1 : circularWay.getNodes()) {
    121                 Node n2 = (Node) ds2.getPrimitiveById(n1);
    122                 assertEquals(n1.lat(), n2.lat(), 1e-5);
    123                 assertEquals(n1.lon(), n2.lon(), 1e-5);
    124             }
    125         }
    126     }
    127 
    128     /**
    12998     * Test case: original roundabout was split, two ways selected, they build a closed ring
    13099     * @throws Exception if an error occurs
    131100     */
     
    149118        }
    150119    }
    151120
     121    /**
     122     * Various cases of selections in file
     123     * @throws Exception if an error occurs
     124     */
     125    @Test
     126    void testSelectionEvaluation() throws Exception {
     127        DataSet ds = OsmReader.parseDataSet(
     128                Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "alignCircleCases.osm")), null);
     129
     130        for (int i = 0; i < 60; i++) {
     131            final String selVal = Integer.toString(i);
     132            Set<OsmPrimitive> sel = ds.allPrimitives().stream().filter(p -> p.hasTag("sel", selVal))
     133                    .collect(Collectors.toSet());
     134            if (sel.isEmpty())
     135                continue;
     136            ds.setSelected(sel);
     137            boolean selValid = sel.stream().noneMatch(p -> p.hasKey("invalid-selection"));
     138            try {
     139                assertNotNull(AlignInCircleAction.buildCommand(ds), "sel=" + selVal);
     140                assertTrue (selValid, "sel=" + selVal + " should be valid ");
     141            } catch (InvalidSelection e) {
     142                assertTrue (!selValid, "sel=" + selVal + " should be invalid ");
     143            }
     144        }
     145    }
    152146}