- Timestamp:
- 2016-12-21T19:34:36+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/SyncEditorImageryIndex.groovy
r11260 r11410 23 23 24 24 import org.openstreetmap.josm.data.imagery.ImageryInfo 25 import org.openstreetmap.josm.data.imagery.Shape 25 26 import org.openstreetmap.josm.io.imagery.ImageryReader 26 27 … … 322 323 } 323 324 }*/ 325 myprintln "*** Mismatching shapes: ***" 326 for (def url : josmUrls.keySet()) { 327 def j = josmUrls.get(url) 328 def num = 1 329 for (def shape : getShapes(j)) { 330 def p = shape.getPoints() 331 if(!p[0].equals(p[p.size()-1])) { 332 myprintln "+++ JOSM shape $num unclosed: ${getDescription(j)}" 333 } 334 ++num 335 } 336 } 337 for (def url : eiiUrls.keySet()) { 338 def e = eiiUrls.get(url) 339 def num = 1 340 def s = getShapes(e) 341 for (def shape : s) { 342 def p = shape.getPoints() 343 if(!p[0].equals(p[p.size()-1])) { 344 myprintln "+++ EII shape $num unclosed: ${getDescription(e)}" 345 } 346 ++num 347 } 348 if (!josmUrls.containsKey(url)) { 349 continue 350 } 351 def j = josmUrls.get(url) 352 if(!s.equals(getShapes(j))) { 353 myprintln " Different shapes: ${getDescription(j)}" 354 } 355 } 324 356 } 325 357 … … 334 366 if (e instanceof ImageryInfo) return e.getOriginalName() 335 367 return e.getString("name") 368 } 369 static List<Shape> getShapes(Object e) { 370 if (e instanceof ImageryInfo) { 371 def bounds = e.getBounds(); 372 if(bounds != null) { 373 return bounds.getShapes(); 374 } 375 return [] 376 } 377 def ex = e.get("extent") 378 if(ex != null) { 379 def poly = ex.get("polygon") 380 if(poly != null) { 381 List<Shape> l = [] 382 for(def shapes: poly) { 383 def s = new Shape() 384 for(def point: shapes) { 385 def lon = point[0].toString() 386 def lat = point[1].toString() 387 s.addPoint(lat, lon) 388 } 389 l.add(s) 390 } 391 return l 392 } 393 } 394 return [] 336 395 } 337 396 static String getType(Object e) {
Note:
See TracChangeset
for help on using the changeset viewer.