Changeset 28298 in osm for applications/editors
- Timestamp:
- 2012-04-14T17:31:42+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/DijkstraSP.java
r28116 r28298 48 48 pq = new IndexMinPQ<Double>(G.V()); 49 49 pq.insert(s, distTo[s]); 50 int count = 0; 50 51 while (!pq.isEmpty()) { 51 52 int v = pq.delMin(); 52 53 for (DirectedEdge e : G.adj(v)) 53 54 relax(e); 55 count++; 56 if (count > G.V()) 57 throw new RuntimeException("Exceeded limit"); 54 58 } 55 59 -
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.