Changeset 33704 in osm for applications/editors/josm


Ignore:
Timestamp:
2017-10-05T11:21:31+02:00 (7 years ago)
Author:
donvip
Message:

fix #josm15399 - limit use of robust (slow) algorithm to ways of 300 nodes or less

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java

    r33676 r33704  
    273273        }
    274274
    275         boolean useRobust = Main.pref.getBoolean("utilsplugin2.replace-geometry.robustAssignment", true);
     275        int gLen = geometryPool.size();
     276        int nLen = nodePool.size();
     277        int N = Math.max(gLen, nLen);
     278        boolean useRobust = Main.pref.getBoolean("utilsplugin2.replace-geometry.robustAssignment", true)
     279                && N <= Main.pref.getInt("utilsplugin2.replace-geometry.robustAssignment.max-size", 300);
    276280
    277281        // Find new nodes that are closest to the old ones, remove matching old ones from the pool
    278282        // Assign node moves with least overall distance moved
    279283        Map<Node, Node> nodeAssoc = new HashMap<>();
    280         if (geometryPool.size() > 0 && nodePool.size() > 0) {
     284        if (gLen > 0 && nLen > 0) {
    281285            if (useRobust) {  // use robust, but slower assignment
    282                 int gLen = geometryPool.size();
    283                 int nLen = nodePool.size();
    284                 int N = Math.max(gLen, nLen);
    285286                double[][] cost = new double[N][N];
    286287                for (int i = 0; i < N; i++) {
Note: See TracChangeset for help on using the changeset viewer.