Changeset 13540 in josm


Ignore:
Timestamp:
2018-03-18T15:22:47+01:00 (6 months ago)
Author:
Don-vip
Message:

see #16102 - SimplifyWayAction performance improvements (patch by GerdP)

File:
1 edited

Legend:

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

    r13434 r13540  
    141141     */
    142142    protected static boolean isRequiredNode(Way way, Node node) {
    143         int frequency = Collections.frequency(way.getNodes(), node);
    144         if ((way.getNode(0) == node) && (way.getNode(way.getNodesCount()-1) == node)) {
    145             frequency = frequency - 1; // closed way closing node counted only once
    146         }
    147         boolean isRequired = frequency > 1;
     143        boolean isRequired = node.isTagged();
     144        if (!isRequired) {
     145            int frequency = Collections.frequency(way.getNodes(), node);
     146            if ((way.getNode(0) == node) && (way.getNode(way.getNodesCount()-1) == node)) {
     147                frequency = frequency - 1; // closed way closing node counted only once
     148            }
     149            isRequired = frequency > 1;
     150        }
    148151        if (!isRequired) {
    149152            List<OsmPrimitive> parents = new LinkedList<>();
     
    151154            parents.remove(way);
    152155            isRequired = !parents.isEmpty();
    153         }
    154         if (!isRequired) {
    155             isRequired = node.isTagged();
    156156        }
    157157        return isRequired;
     
    210210            }
    211211        }
     212
     213        if (newNodes.size() == w.getNodesCount()) return null;
    212214
    213215        Set<Node> delNodes = new HashSet<>();
Note: See TracChangeset for help on using the changeset viewer.