Changeset 16740 in josm for trunk/scripts
- Timestamp:
- 2020-07-09T17:42:41+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/SyncEditorLayerIndex.java
r16650 r16740 1346 1346 } 1347 1347 1348 static void addJsonShapes(List<Shape> l, JsonArray a) { 1349 if (a.get(0).asJsonArray().get(0) instanceof JsonArray) { 1350 for (JsonValue sub: a.asJsonArray()) { 1351 addJsonShapes(l, sub.asJsonArray()); 1352 } 1353 } else { 1354 Shape s = new Shape(); 1355 for (JsonValue point: a.asJsonArray()) { 1356 JsonArray ar = point.asJsonArray(); 1357 String lon = ar.getJsonNumber(0).toString(); 1358 String lat = ar.getJsonNumber(1).toString(); 1359 s.addPoint(lat, lon); 1360 } 1361 l.add(s); 1362 } 1363 } 1348 1364 static List<Shape> getShapes(Object e) { 1349 1365 if (e instanceof ImageryInfo) { … … 1359 1375 List<Shape> l = new ArrayList<>(); 1360 1376 for (JsonValue shapes: poly) { 1361 Shape s = new Shape(); 1362 for (JsonValue point: shapes.asJsonArray()) { 1363 String lon = point.asJsonArray().getJsonNumber(0).toString(); 1364 String lat = point.asJsonArray().getJsonNumber(1).toString(); 1365 s.addPoint(lat, lon); 1366 } 1367 l.add(s); 1377 addJsonShapes(l, shapes.asJsonArray()); 1368 1378 } 1369 1379 return l;
Note:
See TracChangeset
for help on using the changeset viewer.