Changeset 35976 in osm for applications/editors/josm/plugins/imagery-xml-bounds
- Timestamp:
- 2022-06-14T20:11:21+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/actions/ComputeBoundsAction.java
r35723 r35976 23 23 import javax.swing.AbstractAction; 24 24 25 import org.openstreetmap.josm.data.coor.LatLon; 25 import org.openstreetmap.josm.data.coor.ILatLon; 26 26 import org.openstreetmap.josm.data.osm.BBox; 27 27 import org.openstreetmap.josm.data.osm.IPrimitive; … … 342 342 } 343 343 344 protected static finalboolean areNodeListAndBboxEqual(List<Node> nodes, BBox bBox) {344 protected static boolean areNodeListAndBboxEqual(List<Node> nodes, BBox bBox) { 345 345 if (nodes.size() == 5) { 346 346 Map<Double, List<Integer>> latMap = new HashMap<>(); 347 347 Map<Double, List<Integer>> lonMap = new HashMap<>(); 348 348 349 for (int i =0; i<4; i++) {350 LatLon c = nodes.get(i ).getCoor();349 for (int i = 0; i < 4; i++) { 350 ILatLon c = nodes.get(i); 351 351 if (i > 1) { 352 LatLon b = nodes.get(i -1).getCoor();352 ILatLon b = nodes.get(i - 1); 353 353 if (b.lat() != c.lat() && b.lon() != c.lon()) { 354 354 return false; 355 355 } 356 356 } 357 List<Integer> latList = latMap.get(c.lat()); 358 if (latList == null) { 359 latList = new ArrayList<>(); 360 latMap.put(c.lat(), latList); 361 } 357 List<Integer> latList = latMap.computeIfAbsent(c.lat(), lat -> new ArrayList<>(1)); 362 358 latList.add(i); 363 List<Integer> lonList = lonMap.get(c.lon()); 364 if (lonList == null) { 365 lonList = new ArrayList<>(); 366 lonMap.put(c.lon(), lonList); 367 } 359 List<Integer> lonList = lonMap.computeIfAbsent(c.lon(), lon -> new ArrayList<>(1)); 368 360 lonList.add(i); 369 361 } … … 392 384 } 393 385 394 protected static finalString getNodeListShape(List<Node> nodes) {386 protected static String getNodeListShape(List<Node> nodes) { 395 387 StringBuilder result = new StringBuilder(" <shape>\n"); 396 388 int size = nodes.size(); … … 402 394 if (j == size) 403 395 j = 0; 404 LatLon ll = nodes.get(i ).getCoor();396 ILatLon ll = nodes.get(i); 405 397 result.append("<point lat='") 406 398 .append(DF.format(ll.lat())).append("' lon='")
Note:
See TracChangeset
for help on using the changeset viewer.