Changeset 11413 in josm


Ignore:
Timestamp:
2016-12-22T20:22:59+01:00 (7 years ago)
Author:
stoecker
Message:

see #12706 - better equals function and better difference description

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/SyncEditorImageryIndex.groovy

    r11412 r11413  
    150150            }
    151151        } else if(options.xhtmlbody || options.xhtml) {
    152             String color = s.startsWith("***") ? "black" : (s.startsWith("+ ") ? "blue" : "red")
     152            String color = s.startsWith("***") ? "black" : ((s.startsWith("+ ") || s.startsWith("+++ EII")) ? "blue" : "red")
    153153            s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")+"</pre>"
    154154        }
     
    344344            for (def shape : s) {
    345345                def p = shape.getPoints()
    346                 if(!p[0].equals(p[p.size()-1])) {
     346                if(!p[0].equals(p[p.size()-1]) && !options.nomissingeii) {
    347347                    myprintln "+++ EII shape $num unclosed: ${getDescription(e)}"
    348348                }
     
    354354            def j = josmUrls.get(url)
    355355            def js = getShapes(j)
    356             if(!s.equals(js)) {
    357                 if(!s.size()) {
    358                     myprintln " No EII shape: ${getDescription(j)}"
    359                 } else if(!js.size()) {
    360                     myprintln " No JOSM shape: ${getDescription(j)}"
     356            if(!s.size() && js.size() && !options.nomissingeii) {
     357                myprintln "+ No EII shape: ${getDescription(j)}"
     358            } else if(!js.size() && s.size()) {
     359                myprintln "- No JOSM shape: ${getDescription(j)}"
     360            } else {
     361                if(s.size() != js.size()) {
     362                    myprintln "* Different number of shapes (${s.size()} != ${js.size()}): ${getDescription(j)}"
    361363                } else {
    362                     myprintln " Different shapes: ${getDescription(j)}"
     364                    for(def nums = 0; nums < s.size(); ++nums) {
     365                        def ep = s[nums].getPoints()
     366                        def jp = js[nums].getPoints()
     367                        if(ep.size() != jp.size()) {
     368                            myprintln "* Different number of points for shape ${nums+1} (${ep.size()} ! = ${jp.size()})): ${getDescription(j)}"
     369                        } else {
     370                            for(def nump = 0; nump < ep.size(); ++nump) {
     371                                def ept = ep[nump]
     372                                def jpt = jp[nump]
     373                                if(Math.abs(ept.getLat()-jpt.getLat()) > 0.000001 || Math.abs(ept.getLon()-jpt.getLon()) > 0.000001) {
     374                                    myprintln "* Different coordinate for point ${nump+1} of shape ${nums+1}: ${getDescription(j)}"
     375                                    nump = ep.size()
     376                                    num = s.size()
     377                                }
     378                            }
     379                        }
     380                    }
    363381                }
    364382            }
Note: See TracChangeset for help on using the changeset viewer.