Changeset 28298 in osm for applications/editors/josm/plugins/utilsplugin2/src/org
- Timestamp:
- 2012-04-14T17:31:42+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java
r28179 r28298 293 293 } 294 294 } 295 AssignmentProblem assignment = new AssignmentProblem(cost); 296 for (int i = 0; i < N; i++) { 297 int nIdx = i; 298 int gIdx = assignment.sol(i); 299 if (cost[nIdx][gIdx] != Double.MAX_VALUE) { 300 nodeAssoc.put(geometryPool.get(gIdx), nodePool.get(nIdx)); 295 AssignmentProblem assignment; 296 try { 297 assignment = new AssignmentProblem(cost); 298 for (int i = 0; i < N; i++) { 299 int nIdx = i; 300 int gIdx = assignment.sol(i); 301 if (cost[nIdx][gIdx] != Double.MAX_VALUE) { 302 nodeAssoc.put(geometryPool.get(gIdx), nodePool.get(nIdx)); 303 } 301 304 } 302 } 303 // node will be moved, remove from pool 304 for (Node n : nodeAssoc.values()) { 305 nodePool.remove(n); 306 } 307 } else { // use simple, faster, but less robust assignment method 305 // node will be moved, remove from pool 306 for (Node n : nodeAssoc.values()) { 307 nodePool.remove(n); 308 } 309 } 310 catch (Exception e) { 311 useRobust = false; 312 JOptionPane.showMessageDialog(Main.parent, 313 tr("Exceeded iteration limit for robust method, using simpler method."), 314 TITLE, JOptionPane.WARNING_MESSAGE); 315 nodeAssoc = new HashMap<Node, Node>(); 316 } 317 } 318 if (!useRobust) { // use simple, faster, but less robust assignment method 308 319 for (Node n : geometryPool) { 309 320 Node nearest = findNearestNode(n, nodePool);
Note:
See TracChangeset
for help on using the changeset viewer.