Changeset 11582 in josm
- Timestamp:
- 2017-02-18T14:14:19+01:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r11569 r11582 692 692 <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/> 693 693 <echo message="Checking editor imagery difference"/> 694 <groovy src="scripts/SyncEditor ImageryIndex.groovy" classpath="${dist.dir}/josm-custom.jar">695 <!--<arg value="-nomissinge ii"/>-->694 <groovy src="scripts/SyncEditorLayerIndex.groovy" classpath="${dist.dir}/josm-custom.jar"> 695 <!--<arg value="-nomissingeli"/>--> 696 696 </groovy> 697 697 </target> -
trunk/scripts/SyncEditorLayerIndex.groovy
r11577 r11582 30 30 31 31 List<ImageryInfo> josmEntries; 32 JsonArray e iiEntries;33 34 def e iiUrls = new HashMap<String, JsonObject>()32 JsonArray eliEntries; 33 34 def eliUrls = new HashMap<String, JsonObject>() 35 35 def josmUrls = new HashMap<String, ImageryInfo>() 36 36 def josmMirrors = new HashMap<String, ImageryInfo>() 37 37 38 static String e iiInputFile = 'imagery.geojson'38 static String eliInputFile = 'imagery.geojson' 39 39 static String josmInputFile = 'maps.xml' 40 40 static String ignoreInputFile = 'maps_ignores.txt' 41 41 static FileWriter outputFile = null 42 42 static BufferedWriter outputStream = null 43 int skipCount = 0; 44 String skipColor = "greenyellow" // should never be visible 45 def skipEntries = [:] 46 def skipColors = [:] 43 def skip = [:] 47 44 48 45 static def options … … 57 54 script.start() 58 55 script.loadJosmEntries() 59 script.loadE IIEntries()56 script.loadELIEntries() 60 57 script.checkInOneButNotTheOther() 61 58 script.checkCommonEntries() … … 75 72 def cli = new CliBuilder(width: 160) 76 73 cli.o(longOpt:'output', args:1, argName: "output", "Output file, - prints to stdout (default: -)") 77 cli.e(longOpt:'e ii_input', args:1, argName:"eii_input", "Input file for the editor imagery index (json). Default is $eiiInputFile (current directory).")74 cli.e(longOpt:'eli_input', args:1, argName:"eli_input", "Input file for the editor imagery index (json). Default is $eliInputFile (current directory).") 78 75 cli.j(longOpt:'josm_input', args:1, argName:"josm_input", "Input file for the JOSM imagery list (xml). Default is $josmInputFile (current directory).") 79 76 cli.i(longOpt:'ignore_input', args:1, argName:"ignore_input", "Input file for the ignore list. Default is $ignoreInputFile (current directory).") … … 82 79 cli.x(longOpt:'xhtmlbody', argName:"xhtmlbody", "create XHTML body for display in a web page") 83 80 cli.X(longOpt:'xhtml', argName:"xhtml", "create XHTML for display in a web page") 84 cli.m(longOpt:'nomissinge ii', argName:"nomissingeii", "don't show missing editor imagery index entries")81 cli.m(longOpt:'nomissingeli', argName:"nomissingeli", "don't show missing editor imagery index entries") 85 82 cli.h(longOpt:'help', "show this help") 86 83 options = cli.parse(args) … … 90 87 System.exit(0) 91 88 } 92 if (options.e ii_input) {93 e iiInputFile = options.eii_input89 if (options.eli_input) { 90 eliInputFile = options.eli_input 94 91 } 95 92 if (options.josm_input) { … … 110 107 111 108 while((line = fr.readLine()) != null) { 112 def res = (line =~ /^\|\| *( \d) *\|\| *(EII|Ignore) *\|\| *\{\{\{(.+)\}\}\} *\|\|/)109 def res = (line =~ /^\|\| *(ELI|Ignore) *\|\| *\{\{\{(.+)\}\}\} *\|\|/) 113 110 if(res.count) 114 111 { 115 skipEntries[res[0][3]] = res[0][1] as int 116 if(res[0][2].equals("Ignore")) { 117 skipColors[res[0][3]] = "green" 112 if(res[0][1].equals("Ignore")) { 113 skip[res[0][2]] = "green" 118 114 } else { 119 skip Colors[res[0][3]] = "darkgoldenrod"115 skip[res[0][2]] = "darkgoldenrod" 120 116 } 121 117 } … … 133 129 134 130 void myprintln(String s) { 135 if(skipEntries.containsKey(s)) { 136 skipCount = skipEntries.get(s) 137 skipEntries.remove(s) 138 if(skipColors.containsKey(s)) { 139 skipColor = skipColors.get(s) 140 } else { 141 skipColor = "greenyellow" 142 } 143 } 144 if(skipCount) { 145 skipCount -= 1; 131 if(skip.containsKey(s)) { 132 String color = skip.get(s) 133 skip.remove(s) 146 134 if(options.xhtmlbody || options.xhtml) { 147 s = "<pre style=\"margin:3px;color:"+ skipColor+"\">"+s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")+"</pre>"135 s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")+"</pre>" 148 136 } 149 137 if (!options.noskip) { … … 151 139 } 152 140 } else if(options.xhtmlbody || options.xhtml) { 153 String color = s.startsWith("***") ? "black" : ((s.startsWith("+ ") || s.startsWith("+++ E II")) ? "blue" : "red")141 String color = s.startsWith("***") ? "black" : ((s.startsWith("+ ") || s.startsWith("+++ ELI")) ? "blue" : "red") 154 142 s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")+"</pre>" 155 143 } … … 160 148 if (options.xhtml) { 161 149 myprintlnfinal "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" 162 myprintlnfinal "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>JOSM - E II differences</title></head><body>\n"150 myprintlnfinal "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>JOSM - ELI differences</title></head><body>\n" 163 151 } 164 152 } 165 153 166 154 void end() { 167 for (def s: skip Entries.keySet()) {155 for (def s: skip.keySet()) { 168 156 myprintln "+++ Obsolete skip entry: " + s 169 157 } … … 173 161 } 174 162 175 void loadE IIEntries() {176 FileReader fr = new FileReader(e iiInputFile)163 void loadELIEntries() { 164 FileReader fr = new FileReader(eliInputFile) 177 165 JsonReader jr = Json.createReader(fr) 178 e iiEntries = jr.readObject().get("features")166 eliEntries = jr.readObject().get("features") 179 167 jr.close() 180 168 181 for (def e : e iiEntries) {169 for (def e : eliEntries) { 182 170 def url = getUrl(e) 183 171 if (url.contains("{z}")) { 184 myprintln "+++ E II-URL uses {z} instead of {zoom}: "+url172 myprintln "+++ ELI-URL uses {z} instead of {zoom}: "+url 185 173 url = url.replace("{z}","{zoom}") 186 174 } 187 if (e iiUrls.containsKey(url)) {188 myprintln "+++ E II-URL is not unique: "+url175 if (eliUrls.containsKey(url)) { 176 myprintln "+++ ELI-URL is not unique: "+url 189 177 } else { 190 e iiUrls.put(url, e)191 } 192 } 193 myprintln "*** Loaded ${e iiEntries.size()} entries (EII). ***"178 eliUrls.put(url, e) 179 } 180 } 181 myprintln "*** Loaded ${eliEntries.size()} entries (ELI). ***" 194 182 } 195 183 … … 235 223 236 224 void checkInOneButNotTheOther() { 237 def l1 = inOneButNotTheOther(e iiUrls, josmUrls)238 myprintln "*** URLs found in E II but not in JOSM (${l1.size()}): ***"225 def l1 = inOneButNotTheOther(eliUrls, josmUrls) 226 myprintln "*** URLs found in ELI but not in JOSM (${l1.size()}): ***" 239 227 if (!l1.isEmpty()) { 240 228 for (def l : l1) { … … 243 231 } 244 232 245 if (options.nomissinge ii)233 if (options.nomissingeli) 246 234 return 247 def l2 = inOneButNotTheOther(josmUrls, e iiUrls)248 myprintln "*** URLs found in JOSM but not in E II (${l2.size()}): ***"235 def l2 = inOneButNotTheOther(josmUrls, eliUrls) 236 myprintln "*** URLs found in JOSM but not in ELI (${l2.size()}): ***" 249 237 if (!l2.isEmpty()) { 250 238 for (def l : l2) { … … 256 244 void checkCommonEntries() { 257 245 myprintln "*** Same URL, but different name: ***" 258 for (def url : e iiUrls.keySet()) {259 def e = e iiUrls.get(url)246 for (def url : eliUrls.keySet()) { 247 def e = eliUrls.get(url) 260 248 if (!josmUrls.containsKey(url)) continue 261 249 def j = josmUrls.get(url) 262 250 if (!getName(e).equals(getName(j))) { 263 myprintln " name differs: $url" 264 myprintln " (EII): ${getName(e)}" 265 myprintln " (JOSM): ${getName(j)}" 251 myprintln "* Name differs ('${getName(e)}' != '${getName(j)}'): $url" 266 252 } 267 253 } 268 254 269 255 myprintln "*** Same URL, but different type: ***" 270 for (def url : e iiUrls.keySet()) {271 def e = e iiUrls.get(url)256 for (def url : eliUrls.keySet()) { 257 def e = eliUrls.get(url) 272 258 if (!josmUrls.containsKey(url)) continue 273 259 def j = josmUrls.get(url) 274 260 if (!getType(e).equals(getType(j))) { 275 myprintln " type differs: ${getName(j)} - $url" 276 myprintln " (EII): ${getType(e)}" 277 myprintln " (JOSM): ${getType(j)}" 261 myprintln "* Type differs (${getType(e)} != ${getType(j)}): ${getName(j)} - $url" 278 262 } 279 263 } 280 264 281 265 myprintln "*** Same URL, but different zoom bounds: ***" 282 for (def url : e iiUrls.keySet()) {283 def e = e iiUrls.get(url)266 for (def url : eliUrls.keySet()) { 267 def e = eliUrls.get(url) 284 268 if (!josmUrls.containsKey(url)) continue 285 269 def j = josmUrls.get(url) … … 288 272 Integer jMinZoom = getMinZoom(j) 289 273 if (eMinZoom != jMinZoom && !(eMinZoom == 0 && jMinZoom == null)) { 290 myprintln " minzoom differs: ${getDescription(j)}" 291 myprintln " (EII): ${eMinZoom}" 292 myprintln " (JOSM): ${jMinZoom}" 274 myprintln "* Minzoom differs (${eMinZoom} != ${jMinZoom}): ${getDescription(j)}" 293 275 } 294 276 Integer eMaxZoom = getMaxZoom(e) 295 277 Integer jMaxZoom = getMaxZoom(j) 296 278 if (eMaxZoom != jMaxZoom) { 297 myprintln " maxzoom differs: ${getDescription(j)}" 298 myprintln " (EII): ${eMaxZoom}" 299 myprintln " (JOSM): ${jMaxZoom}" 279 myprintln "* Maxzoom differs (${eMaxZoom} != ${jMaxZoom}): ${getDescription(j)}" 300 280 } 301 281 } 302 282 303 283 myprintln "*** Same URL, but different country code: ***" 304 for (def url : e iiUrls.keySet()) {305 def e = e iiUrls.get(url)284 for (def url : eliUrls.keySet()) { 285 def e = eliUrls.get(url) 306 286 if (!josmUrls.containsKey(url)) continue 307 287 def j = josmUrls.get(url) 308 288 if (!getCountryCode(e).equals(getCountryCode(j))) { 309 myprintln " country code differs: ${getDescription(j)}" 310 myprintln " (EII): ${getCountryCode(e)}" 311 myprintln " (JOSM): ${getCountryCode(j)}" 289 myprintln "* Country code differs (${getCountryCode(e)} != ${getCountryCode(j)}): ${getDescription(j)}" 312 290 } 313 291 } 314 292 /*myprintln "*** Same URL, but different quality: ***" 315 for (def url : e iiUrls.keySet()) {316 def e = e iiUrls.get(url)293 for (def url : eliUrls.keySet()) { 294 def e = eliUrls.get(url) 317 295 if (!josmUrls.containsKey(url)) { 318 296 def q = getQuality(e) 319 if(" best".equals(q)) {320 myprintln " quality best entry not in JOSM for ${getDescription(e)}"297 if("eli-best".equals(q)) { 298 myprintln "- Quality best entry not in JOSM for ${getDescription(e)}" 321 299 } 322 300 continue … … 324 302 def j = josmUrls.get(url) 325 303 if (!getQuality(e).equals(getQuality(j))) { 326 myprintln " Quality differs (${getQuality(j)} != ${getQuality(e)}): ${getDescription(j)}"304 myprintln "* Quality differs (${getQuality(e)} != ${getQuality(j)}): ${getDescription(j)}" 327 305 } 328 306 }*/ 329 307 /*myprintln "*** Same URL, but different dates: ***" 330 for (def url : e iiUrls.keySet()) {331 def e = e iiUrls.get(url)308 for (def url : eliUrls.keySet()) { 309 def e = eliUrls.get(url) 332 310 if (!josmUrls.containsKey(url)) continue 333 311 def j = josmUrls.get(url) 334 312 if (!getDate(e).equals(getDate(j))) { 335 myprintln " Date differs ('${getDate(j)}' != '${getDate(e)}'): ${getDescription(j)}"313 myprintln "* Date differs ('${getDate(e)}' != '${getDate(j)}'): ${getDescription(j)}" 336 314 } 337 315 }*/ … … 348 326 } 349 327 } 350 for (def url : e iiUrls.keySet()) {351 def e = e iiUrls.get(url)328 for (def url : eliUrls.keySet()) { 329 def e = eliUrls.get(url) 352 330 def num = 1 353 331 def s = getShapes(e) 354 332 for (def shape : s) { 355 333 def p = shape.getPoints() 356 if(!p[0].equals(p[p.size()-1]) && !options.nomissinge ii) {357 myprintln "+++ E II shape $num unclosed: ${getDescription(e)}"334 if(!p[0].equals(p[p.size()-1]) && !options.nomissingeli) { 335 myprintln "+++ ELI shape $num unclosed: ${getDescription(e)}" 358 336 } 359 337 ++num … … 365 343 def js = getShapes(j) 366 344 if(!s.size() && js.size()) { 367 if(!options.nomissinge ii) {368 myprintln "+ No E II shape: ${getDescription(j)}"345 if(!options.nomissingeli) { 346 myprintln "+ No ELI shape: ${getDescription(j)}" 369 347 } 370 348 } else if(!js.size() && s.size()) { … … 396 374 } 397 375 myprintln "*** Mismatching icons: ***" 398 for (def url : e iiUrls.keySet()) {399 def e = e iiUrls.get(url)376 for (def url : eliUrls.keySet()) { 377 def e = eliUrls.get(url) 400 378 if (!josmUrls.containsKey(url)) { 401 379 continue … … 405 383 def ie = getIcon(e) 406 384 if(ij != null && ie == null) { 407 if(!options.nomissinge ii) {408 myprintln "+ No E II icon: ${getDescription(j)}"385 if(!options.nomissingeli) { 386 myprintln "+ No ELI icon: ${getDescription(j)}" 409 387 } 410 388 } else if(ij == null && ie != null) { … … 578 556 if (j != null) cc = getCountryCode(j) 579 557 if (cc == null) { 580 def e = e iiUrls.get(url)558 def e = eliUrls.get(url) 581 559 if (e != null) cc = getCountryCode(e) 582 560 }
Note:
See TracChangeset
for help on using the changeset viewer.