Changeset 15034 in josm for trunk/scripts
- Timestamp:
- 2019-05-02T04:33:57+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/SyncEditorLayerIndex.java
r15033 r15034 1 1 // License: GPL. For details, see LICENSE file. 2 import static java.nio.charset.StandardCharsets.UTF_8; 2 3 import static org.apache.commons.lang3.StringUtils.isBlank; 3 4 import static org.apache.commons.lang3.StringUtils.isNotBlank; 4 5 5 6 import java.io.BufferedReader; 6 import java.io.FileInputStream;7 import java.io.FileNotFoundException;8 import java.io.FileOutputStream;9 7 import java.io.IOException; 10 8 import java.io.InputStreamReader; 9 import java.io.OutputStream; 11 10 import java.io.OutputStreamWriter; 12 import java.io.UnsupportedEncodingException;13 11 import java.lang.reflect.Field; 12 import java.nio.file.Files; 13 import java.nio.file.Paths; 14 14 import java.text.DecimalFormat; 15 15 import java.text.ParseException; … … 50 50 import org.openstreetmap.josm.io.imagery.ImageryReader; 51 51 import org.openstreetmap.josm.spi.preferences.Config; 52 import org.openstreetmap.josm.tools.Logging; 52 53 import org.openstreetmap.josm.tools.OptionParser; 53 54 import org.openstreetmap.josm.tools.OptionParser.OptionCount; … … 74 75 public class SyncEditorLayerIndex { 75 76 77 private static final int MAXLEN = 140; 78 76 79 private List<ImageryInfo> josmEntries; 77 80 private JsonArray eliEntries; 78 81 79 private Map<String, JsonObject> eliUrls = new HashMap<>();80 private Map<String, ImageryInfo> josmUrls = new HashMap<>();81 private Map<String, ImageryInfo> josmMirrors = new HashMap<>();82 private static Map<String, String> oldproj = new HashMap<>();83 private static List<String> ignoreproj = new LinkedList<>();82 private final Map<String, JsonObject> eliUrls = new HashMap<>(); 83 private final Map<String, ImageryInfo> josmUrls = new HashMap<>(); 84 private final Map<String, ImageryInfo> josmMirrors = new HashMap<>(); 85 private static final Map<String, String> oldproj = new HashMap<>(); 86 private static final List<String> ignoreproj = new LinkedList<>(); 84 87 85 88 private static String eliInputFile = "imagery_eli.geojson"; 86 89 private static String josmInputFile = "imagery_josm.imagery.xml"; 87 90 private static String ignoreInputFile = "imagery_josm.ignores.txt"; 88 private static FileOutputStream outputFile = null;89 private static OutputStreamWriter outputStream = null;91 private static OutputStream outputFile; 92 private static OutputStreamWriter outputStream; 90 93 private static String optionOutput; 91 94 private static boolean optionShorten; … … 108 111 public static void main(String[] args) throws IOException, SAXException, ReflectiveOperationException { 109 112 Locale.setDefault(Locale.ROOT); 110 parse _command_line_arguments(args);113 parseCommandLineArguments(args); 111 114 Preferences pref = new Preferences(JosmBaseDirectories.getInstance()); 112 115 Config.setPreferencesInstance(pref); … … 118 121 script.loadJosmEntries(); 119 122 if (optionJosmXml != null) { 120 FileOutputStream file = new FileOutputStream(optionJosmXml); 121 OutputStreamWriter stream = new OutputStreamWriter(file, "UTF-8"); 122 script.printentries(script.josmEntries, stream); 123 stream.close(); 124 file.close(); 123 try (OutputStreamWriter stream = new OutputStreamWriter(Files.newOutputStream(Paths.get(optionJosmXml)), UTF_8)) { 124 script.printentries(script.josmEntries, stream); 125 } 125 126 } 126 127 script.loadELIEntries(); 127 128 if (optionEliXml != null) { 128 FileOutputStream file = new FileOutputStream(optionEliXml); 129 OutputStreamWriter stream = new OutputStreamWriter(file, "UTF-8"); 130 script.printentries(script.eliEntries, stream); 131 stream.close(); 132 file.close(); 129 try (OutputStreamWriter stream = new OutputStreamWriter(Files.newOutputStream(Paths.get(optionEliXml)), UTF_8)) { 130 script.printentries(script.eliEntries, stream); 131 } 133 132 } 134 133 script.checkInOneButNotTheOther(); … … 154 153 return "usage: java -cp build SyncEditorLayerIndex\n" + 155 154 "-c,--encoding <encoding> output encoding (defaults to UTF-8 or cp850 on Windows)\n" + 156 "-e,--eli_input <eli_input> Input file for the editor layer index (geojson). Default is imagery_eli.geojson (current directory).\n" + 155 "-e,--eli_input <eli_input> Input file for the editor layer index (geojson). " + 156 "Default is imagery_eli.geojson (current directory).\n" + 157 157 "-h,--help show this help\n" + 158 158 "-i,--ignore_input <ignore_input> Input file for the ignore list. Default is imagery_josm.ignores.txt (current directory).\n" + 159 "-j,--josm_input <josm_input> Input file for the JOSM imagery list (xml). Default is imagery_josm.imagery.xml (current directory).\n" + 159 "-j,--josm_input <josm_input> Input file for the JOSM imagery list (xml). " + 160 "Default is imagery_josm.imagery.xml (current directory).\n" + 160 161 "-m,--noeli don't show output for ELI problems\n" + 161 162 "-n,--noskip don't skip known entries\n" + … … 171 172 * Parse command line arguments. 172 173 * @param args program arguments 173 * @throws FileNotFoundException if a file can't be found 174 * @throws UnsupportedEncodingException if the given encoding can't be found 174 * @throws IOException in case of I/O error 175 175 */ 176 static void parse _command_line_arguments(String[] args) throws FileNotFoundException, UnsupportedEncodingException {176 static void parseCommandLineArguments(String[] args) throws IOException { 177 177 new OptionParser("JOSM/ELI synchronization script") 178 178 .addFlagParameter("help", SyncEditorLayerIndex::showHelp) … … 204 204 .parseOptionsOrExit(Arrays.asList(args)); 205 205 206 if (optionOutput != null && optionOutput != "-") {207 outputFile = new FileOutputStream(optionOutput);206 if (optionOutput != null && !"-".equals(optionOutput)) { 207 outputFile = Files.newOutputStream(Paths.get(optionOutput)); 208 208 outputStream = new OutputStreamWriter(outputFile, optionEncoding != null ? optionEncoding : "UTF-8"); 209 209 } else if (optionEncoding != null) { … … 233 233 void loadSkip() throws IOException { 234 234 final Pattern pattern = Pattern.compile("^\\|\\| *(ELI|Ignore) *\\|\\| *\\{\\{\\{(.+)\\}\\}\\} *\\|\\|"); 235 try (BufferedReader fr = new BufferedReader(new InputStreamReader( new FileInputStream(ignoreInputFile), "UTF-8"))) {235 try (BufferedReader fr = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get(ignoreInputFile)), UTF_8))) { 236 236 String line; 237 237 … … 262 262 skip.remove(s); 263 263 if (optionXhtmlBody || optionXhtml) { 264 s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")+"</pre>"; 264 s = "<pre style=\"margin:3px;color:"+color+"\">" 265 + s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")+"</pre>"; 265 266 } 266 267 if (!optionNoSkip) { 267 268 return; 268 269 } 269 } else if (optionXhtmlBody || optionXhtml) {270 } else if (optionXhtmlBody || optionXhtml) { 270 271 String color = 271 272 s.startsWith("***") ? "black" : … … 273 274 (s.startsWith("#") ? "indigo" : 274 275 (s.startsWith("!") ? "orange" : "red"))); 275 s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&", "&").replaceAll("<","<").replaceAll(">",">")+"</pre>";276 s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")+"</pre>"; 276 277 } 277 278 if ((s.startsWith("+ ") || s.startsWith("+++ ELI") || s.startsWith("#")) && optionNoEli) { … … 283 284 void start() throws IOException { 284 285 if (optionXhtml) { 285 myprintlnfinal("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"); 286 myprintlnfinal("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>JOSM - ELI differences</title></head><body>\n"); 286 myprintlnfinal( 287 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"); 288 myprintlnfinal( 289 "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>"+ 290 "<title>JOSM - ELI differences</title></head><body>\n"); 287 291 } 288 292 } … … 298 302 299 303 void loadELIEntries() throws IOException { 300 try (JsonReader jr = Json.createReader(new InputStreamReader( new FileInputStream(eliInputFile), "UTF-8"))) {304 try (JsonReader jr = Json.createReader(new InputStreamReader(Files.newInputStream(Paths.get(eliInputFile)), UTF_8))) { 301 305 eliEntries = jr.readObject().getJsonArray("features"); 302 306 } … … 306 310 if (url.contains("{z}")) { 307 311 myprintln("+++ ELI-URL uses {z} instead of {zoom}: "+url); 308 url = url.replace("{z}", "{zoom}");312 url = url.replace("{z}", "{zoom}"); 309 313 } 310 314 if (eliUrls.containsKey(url)) { … … 355 359 if (p != null) { 356 360 res += offset + "<projections>\n"; 357 for (String c : p) 361 for (String c : p) { 358 362 res += offset + " <code>"+c+"</code>\n"; 363 } 359 364 res += offset + "</projections>\n"; 360 365 } … … 370 375 for (Object e : entries) { 371 376 stream.write(" <entry" 372 + ("eli-best".equals(getQuality(e)) ? " eli-best=\"true\"" : "" 373 + (getOverlay(e) ? " overlay=\"true\"" : "" 377 + ("eli-best".equals(getQuality(e)) ? " eli-best=\"true\"" : "") 378 + (getOverlay(e) ? " overlay=\"true\"" : "") 374 379 + ">\n"); 375 380 String t; … … 428 433 if (lat < minlat) minlat = lat; 429 434 if (lon < minlon) minlon = lon; 430 if ((i++ %3) == 0) {435 if ((i++ % 3) == 0) { 431 436 shapes += sep + " "; 432 437 } … … 435 440 shapes += sep + "</shape>\n"; 436 441 } 437 } catch(IllegalArgumentException ignored) { 442 } catch (IllegalArgumentException ignored) { 443 Logging.trace(ignored); 438 444 } 439 445 if (!shapes.isEmpty()) { 440 stream.write(" <bounds min-lat='"+df.format(minlat)+"' min-lon='"+df.format(minlon)+"' max-lat='"+df.format(maxlat)+"' max-lon='"+df.format(maxlon)+"'>\n"); 446 stream.write(" <bounds min-lat='"+df.format(minlat) 447 +"' min-lon='"+df.format(minlon) 448 +"' max-lat='"+df.format(maxlat) 449 +"' max-lon='"+df.format(maxlon)+"'>\n"); 441 450 stream.write(shapes + " </bounds>\n"); 442 451 } … … 464 473 if (url.contains("{z}")) { 465 474 myprintln("+++ JOSM-URL uses {z} instead of {zoom}: "+url); 466 url = url.replace("{z}", "{zoom}");475 url = url.replace("{z}", "{zoom}"); 467 476 } 468 477 if (josmUrls.containsKey(url)) { … … 475 484 Field origNameField = ImageryInfo.class.getDeclaredField("origName"); 476 485 ReflectionUtils.setObjectsAccessible(origNameField); 477 origNameField.set(m, m.getOriginalName().replaceAll(" mirror server( \\d+)?", ""));486 origNameField.set(m, m.getOriginalName().replaceAll(" mirror server( \\d+)?", "")); 478 487 if (josmUrls.containsKey(url)) { 479 488 myprintln("+++ JOSM-Mirror-URL is not unique: "+url); … … 504 513 JsonObject e = eliUrls.get(urle); 505 514 String ide = getId(e); 506 String urlhttps = urle.replace("http:", "https:");515 String urlhttps = urle.replace("http:", "https:"); 507 516 if (lj.contains(urlhttps)) { 508 517 myprintln("+ Missing https: "+getDescription(e)); … … 523 532 // replace key for this entry with JOSM URL 524 533 eliUrls.remove(urle); 525 eliUrls.put(urlj, e);534 eliUrls.put(urlj, e); 526 535 break; 527 536 } … … 548 557 549 558 void checkCommonEntries() throws IOException { 559 doSameUrlButDifferentName(); 560 doSameUrlButDifferentId(); 561 doSameUrlButDifferentType(); 562 doSameUrlButDifferentZoomBounds(); 563 doSameUrlButDifferentCountryCode(); 564 doSameUrlButDifferentQuality(); 565 doSameUrlButDifferentDates(); 566 doSameUrlButDifferentInformation(); 567 doMismatchingShapes(); 568 doMismatchingIcons(); 569 doMiscellaneousChecks(); 570 } 571 572 void doSameUrlButDifferentName() throws IOException { 550 573 myprintln("*** Same URL, but different name: ***"); 551 574 for (String url : eliUrls.keySet()) { … … 553 576 if (!josmUrls.containsKey(url)) continue; 554 577 ImageryInfo j = josmUrls.get(url); 555 String ename = getName(e).replace("'", "\u2019");556 String jname = getName(j).replace("'", "\u2019");578 String ename = getName(e).replace("'", "\u2019"); 579 String jname = getName(j).replace("'", "\u2019"); 557 580 if (!ename.equals(jname)) { 558 581 myprintln("* Name differs ('"+getName(e)+"' != '"+getName(j)+"'): "+getUrl(j)); 559 582 } 560 583 } 561 584 } 585 586 void doSameUrlButDifferentId() throws IOException { 562 587 myprintln("*** Same URL, but different Id: ***"); 563 588 for (String url : eliUrls.keySet()) { … … 571 596 } 572 597 } 573 598 } 599 600 void doSameUrlButDifferentType() throws IOException { 574 601 myprintln("*** Same URL, but different type: ***"); 575 602 for (String url : eliUrls.keySet()) { … … 581 608 } 582 609 } 583 610 } 611 612 void doSameUrlButDifferentZoomBounds() throws IOException { 584 613 myprintln("*** Same URL, but different zoom bounds: ***"); 585 614 for (String url : eliUrls.keySet()) { … … 605 634 } 606 635 } 607 636 } 637 638 void doSameUrlButDifferentCountryCode() throws IOException { 608 639 myprintln("*** Same URL, but different country code: ***"); 609 640 for (String url : eliUrls.keySet()) { … … 619 650 } 620 651 } 652 } 653 654 void doSameUrlButDifferentQuality() throws IOException { 621 655 myprintln("*** Same URL, but different quality: ***"); 622 656 for (String url : eliUrls.keySet()) { … … 634 668 } 635 669 } 670 } 671 672 void doSameUrlButDifferentDates() throws IOException { 636 673 myprintln("*** Same URL, but different dates: ***"); 637 674 Pattern pattern = Pattern.compile("^(.*;)(\\d\\d\\d\\d)(-(\\d\\d)(-(\\d\\d))?)?$"); … … 642 679 String jd = getDate(j); 643 680 // The forms 2015;- or -;2015 or 2015;2015 are handled equal to 2015 644 String ef = ed.replaceAll("\\A-;", "").replaceAll(";-\\z","").replaceAll("\\A([0-9-]+);\\1\\z", "$1");681 String ef = ed.replaceAll("\\A-;", "").replaceAll(";-\\z", "").replaceAll("\\A([0-9-]+);\\1\\z", "$1"); 645 682 // ELI has a strange and inconsistent used end_date definition, so we try again with subtraction by one 646 683 String ed2 = ed; … … 658 695 ed2 += "-" + String.format("%02d", cal.get(Calendar.DAY_OF_MONTH)); 659 696 } 660 String ef2 = ed2.replaceAll("\\A-;", "").replaceAll(";-\\z","").replaceAll("\\A([0-9-]+);\\1\\z", "$1");697 String ef2 = ed2.replaceAll("\\A-;", "").replaceAll(";-\\z", "").replaceAll("\\A([0-9-]+);\\1\\z", "$1"); 661 698 if (!ed.equals(jd) && !ef.equals(jd) && !ed2.equals(jd) && !ef2.equals(jd)) { 662 699 String t = "'"+ed+"'"; … … 673 710 } 674 711 } 712 } 713 714 void doSameUrlButDifferentInformation() throws IOException { 675 715 myprintln("*** Same URL, but different information: ***"); 676 716 for (String url : eliUrls.keySet()) { … … 723 763 myprintln("- Missing JOSM attribution URL ("+et+"): "+getDescription(j)); 724 764 } else if (isNotBlank(et)) { 725 String ethttps = et.replace("http:", "https:");765 String ethttps = et.replace("http:", "https:"); 726 766 if (jt.equals(ethttps) || jt.equals(et+"/") || jt.equals(ethttps+"/")) { 727 767 myprintln("+ Attribution URL differs ('"+et+"' != '"+jt+"'): "+getDescription(j)); … … 786 826 } 787 827 } 828 } 829 830 void doMismatchingShapes() throws IOException { 788 831 myprintln("*** Mismatching shapes: ***"); 789 832 for (String url : josmUrls.keySet()) { … … 792 835 for (Shape shape : getShapes(j)) { 793 836 List<Coordinate> p = shape.getPoints(); 794 if (!p.get(0).equals(p.get(p.size()-1))) {837 if (!p.get(0).equals(p.get(p.size()-1))) { 795 838 myprintln("+++ JOSM shape "+num+" unclosed: "+getDescription(j)); 796 839 } … … 811 854 for (Shape shape : s) { 812 855 List<Coordinate> p = shape.getPoints(); 813 if (!p.get(0).equals(p.get(p.size()-1)) && !optionNoEli) {856 if (!p.get(0).equals(p.get(p.size()-1)) && !optionNoEli) { 814 857 myprintln("+++ ELI shape "+num+" unclosed: "+getDescription(e)); 815 858 } … … 834 877 myprintln("+ No ELI shape: "+getDescription(j)); 835 878 } 836 } else if (js.isEmpty() && !s.isEmpty()) {879 } else if (js.isEmpty() && !s.isEmpty()) { 837 880 // don't report boundary like 5 point shapes as difference 838 881 if (s.size() != 1 || s.get(0).getPoints().size() != 5) { 839 882 myprintln("- No JOSM shape: "+getDescription(j)); 840 883 } 841 } else if (s.size() != js.size()) {884 } else if (s.size() != js.size()) { 842 885 myprintln("* Different number of shapes ("+s.size()+" != "+js.size()+"): "+getDescription(j)); 843 886 } else { … … 850 893 if (ep.size() == jp.size() && !jdone[jnums]) { 851 894 boolean err = false; 852 for (int nump = 0; nump < ep.size() && !err; ++nump) {895 for (int nump = 0; nump < ep.size() && !err; ++nump) { 853 896 Coordinate ept = ep.get(nump); 854 897 Coordinate jpt = jp.get(nump); 855 if (Math.abs(ept.getLat()-jpt.getLat()) > 0.00001 || Math.abs(ept.getLon()-jpt.getLon()) > 0.00001)898 if (Math.abs(ept.getLat()-jpt.getLat()) > 0.00001 || Math.abs(ept.getLon()-jpt.getLon()) > 0.00001) 856 899 err = true; 857 900 } 858 if (!err) {901 if (!err) { 859 902 edone[enums] = true; 860 903 jdone[jnums] = true; … … 897 940 numtxt += '/' + Integer.toString(jnums+1); 898 941 } 899 myprintln("* Different number of points for shape "+numtxt+" ("+ep.size()+" ! = "+jp.size()+")): "+getDescription(j)); 942 myprintln("* Different number of points for shape "+numtxt+" ("+ep.size()+" ! = "+jp.size()+")): " 943 + getDescription(j)); 900 944 edone[enums] = true; 901 945 jdone[jnums] = true; … … 906 950 } 907 951 } 952 } 953 954 void doMismatchingIcons() throws IOException { 908 955 myprintln("*** Mismatching icons: ***"); 909 956 for (String url : eliUrls.keySet()) { … … 927 974 || ie.startsWith("https://raw.githubusercontent.com/osmlab/editor-layer-index/")) && 928 975 ij.startsWith("data:"))) { 929 String iehttps = ie.replace("http:", "https:");976 String iehttps = ie.replace("http:", "https:"); 930 977 if (ij.equals(iehttps)) { 931 978 myprintln("+ Different icons: "+getDescription(j)); … … 935 982 } 936 983 } 984 } 985 986 void doMiscellaneousChecks() throws IOException { 937 987 myprintln("*** Miscellaneous checks: ***"); 938 988 Map<String, ImageryInfo> josmIds = new HashMap<>(); … … 964 1014 } 965 1015 for (String o : old) { 966 myprintln("* Projection "+o+" is an old unsupported code and has been replaced by "+oldproj.get(o)+": "+getDescription(j)); 1016 myprintln("* Projection "+o+" is an old unsupported code and has been replaced by "+oldproj.get(o)+": " 1017 + getDescription(j)); 967 1018 } 968 1019 } … … 995 1046 myprintln("* Strange URL '"+u+"': "+getDescription(j)); 996 1047 } else { 997 String domain = m.group(1).replaceAll("\\{switch:.*\\}", "x");1048 String domain = m.group(1).replaceAll("\\{switch:.*\\}", "x"); 998 1049 String port = m.group(2); 999 1050 if (!(domain.matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$")) && !dv.isValid(domain)) … … 1028 1079 myprintln("* JOSM-Date '"+d+"' is strange (second earlier than first): "+getDescription(j)); 1029 1080 } 1030 } 1031 catch (Exception e) { 1081 } catch (Exception e) { 1032 1082 myprintln("* JOSM-Date '"+d+"' is strange ("+e.getMessage()+"): "+getDescription(j)); 1033 1083 } … … 1053 1103 double lat = p.getLat(); 1054 1104 double lon = p.getLon(); 1055 if (lat > maxlat) maxlat = lat;1056 if (lon > maxlon) maxlon = lon;1057 if (lat < minlat) minlat = lat;1058 if (lon < minlon) minlon = lon;1105 if (lat > maxlat) maxlat = lat; 1106 if (lon > maxlon) maxlon = lon; 1107 if (lat < minlat) minlat = lat; 1108 if (lon < minlon) minlon = lon; 1059 1109 } 1060 1110 } … … 1062 1112 if (b.getMinLat() != minlat || b.getMinLon() != minlon || b.getMaxLat() != maxlat || b.getMaxLon() != maxlon) { 1063 1113 myprintln("* Bounds do not match shape (is "+b.getMinLat()+","+b.getMinLon()+","+b.getMaxLat()+","+b.getMaxLon() 1064 + ", calculated <bounds min-lat='"+minlat+"' min-lon='"+minlon+"' max-lat='"+maxlat+"' max-lon='"+maxlon+"'>): "+getDescription(j)); 1114 + ", calculated <bounds min-lat='"+minlat+"' min-lon='"+minlon+"' max-lat='"+maxlat+"' max-lon='"+maxlon+"'>): " 1115 + getDescription(j)); 1065 1116 } 1066 1117 } … … 1085 1136 1086 1137 static String getUrlStripped(Object e) { 1087 return getUrl(e).replaceAll("\\?(apikey|access_token)=.*", "");1138 return getUrl(e).replaceAll("\\?(apikey|access_token)=.*", ""); 1088 1139 } 1089 1140 … … 1093 1144 String start = p.containsKey("start_date") ? p.getString("start_date") : ""; 1094 1145 String end = p.containsKey("end_date") ? p.getString("end_date") : ""; 1095 if (!start.isEmpty() && !end.isEmpty())1146 if (!start.isEmpty() && !end.isEmpty()) 1096 1147 return start+";"+end; 1097 else if (!start.isEmpty())1148 else if (!start.isEmpty()) 1098 1149 return start+";-"; 1099 else if (!end.isEmpty())1150 else if (!end.isEmpty()) 1100 1151 return "-;"+end; 1101 1152 return ""; … … 1104 1155 static Date verifyDate(String year, String month, String day) throws ParseException { 1105 1156 String date; 1106 if (year == null) {1157 if (year == null) { 1107 1158 date = "3000-01-01"; 1108 1159 } else { … … 1161 1212 if (e instanceof ImageryInfo) { 1162 1213 ImageryBounds bounds = ((ImageryInfo) e).getBounds(); 1163 if (bounds != null) {1214 if (bounds != null) { 1164 1215 return bounds.getShapes(); 1165 1216 } … … 1283 1334 } 1284 1335 1285 static Map<String, String> getDescriptions(Object e) {1286 Map<String, String> res = new HashMap<String, String>();1336 static Map<String, String> getDescriptions(Object e) { 1337 Map<String, String> res = new HashMap<String, String>(); 1287 1338 if (e instanceof ImageryInfo) { 1288 1339 String a = ((ImageryInfo) e).getDescription(); … … 1290 1341 } else { 1291 1342 String a = ((Map<String, JsonObject>) e).get("properties").getString("description", null); 1292 if (a != null) res.put("en", a.replaceAll("''", "'"));1343 if (a != null) res.put("en", a.replaceAll("''", "'")); 1293 1344 } 1294 1345 return res; … … 1323 1374 String d = cc + getName(o) + " - " + getUrl(o); 1324 1375 if (optionShorten) { 1325 final int MAXLEN = 140;1326 1376 if (d.length() > MAXLEN) d = d.substring(0, MAXLEN-1) + "..."; 1327 1377 }
Note:
See TracChangeset
for help on using the changeset viewer.