- Timestamp:
- 2016-09-17T15:19:44+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r11002 r11009 445 445 switch(column) { 446 446 case 0: 447 setText(sr. name);447 setText(sr.getName()); 448 448 break; 449 449 case 1: 450 setText(sr. info);450 setText(sr.getInfo()); 451 451 break; 452 452 case 2: 453 setText(sr. nearestPlace);453 setText(sr.getNearestPlace()); 454 454 break; 455 455 case 3: 456 if (sr. bounds!= null) {457 setText(sr. bounds.toShortString(new DecimalFormat("0.000")));456 if (sr.getBounds() != null) { 457 setText(sr.getBounds().toShortString(new DecimalFormat("0.000"))); 458 458 } else { 459 setText(sr. zoom != 0 ? Integer.toString(sr.zoom) : tr("unknown"));459 setText(sr.getZoom() != 0 ? Integer.toString(sr.getZoom()) : tr("unknown")); 460 460 } 461 461 break; 462 462 default: // Do nothing 463 463 } 464 setToolTipText(lineWrapDescription(sr. description));464 setToolTipText(lineWrapDescription(sr.getDescription())); 465 465 return this; 466 466 } -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r10993 r11009 528 528 /** 529 529 * Clears the cached file 530 * @throws IOException 530 * @throws IOException if any I/O error occurs 531 531 * @since 10993 532 532 */ -
trunk/src/org/openstreetmap/josm/io/NameFinder.java
r11003 r11009 30 30 * @since 11002 31 31 */ 32 public class NameFinder { 33 32 public final class NameFinder { 33 34 /** 35 * Nominatim URL. 36 */ 34 37 public static final String NOMINATIM_URL = "https://nominatim.openstreetmap.org/search?format=xml&q="; 35 38 … … 62 65 */ 63 66 public static class SearchResult { 64 public String name; 65 public String info; 66 public String nearestPlace; 67 public String description; 68 public double lat; 69 public double lon; 70 public int zoom; 71 public Bounds bounds; 72 public PrimitiveId osmId; 73 67 private String name; 68 private String info; 69 private String nearestPlace; 70 private String description; 71 private double lat; 72 private double lon; 73 private int zoom; 74 private Bounds bounds; 75 private PrimitiveId osmId; 76 77 /** 78 * Returns the name. 79 * @return the name 80 */ 81 public final String getName() { 82 return name; 83 } 84 85 /** 86 * Returns the info. 87 * @return the info 88 */ 89 public final String getInfo() { 90 return info; 91 } 92 93 /** 94 * Returns the nearest place. 95 * @return the nearest place 96 */ 97 public final String getNearestPlace() { 98 return nearestPlace; 99 } 100 101 /** 102 * Returns the description. 103 * @return the description 104 */ 105 public final String getDescription() { 106 return description; 107 } 108 109 /** 110 * Returns the latitude. 111 * @return the latitude 112 */ 113 public final double getLat() { 114 return lat; 115 } 116 117 /** 118 * Returns the longitude. 119 * @return the longitude 120 */ 121 public final double getLon() { 122 return lon; 123 } 124 125 /** 126 * Returns the zoom. 127 * @return the zoom 128 */ 129 public final int getZoom() { 130 return zoom; 131 } 132 133 /** 134 * Returns the bounds. 135 * @return the bounds 136 */ 137 public final Bounds getBounds() { 138 return bounds; 139 } 140 141 /** 142 * Returns the OSM id. 143 * @return the OSM id 144 */ 145 public final PrimitiveId getOsmId() { 146 return osmId; 147 } 148 149 /** 150 * Returns the download area. 151 * @return the download area 152 */ 74 153 public Bounds getDownloadArea() { 75 154 return bounds != null ? bounds : OsmUrlToBounds.positionToBounds(lat, lon, zoom); -
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r11003 r11009 8 8 import java.util.EnumMap; 9 9 import java.util.List; 10 import java.util.NoSuchElementException; 10 11 import java.util.regex.Matcher; 11 12 import java.util.regex.Pattern; … … 58 59 return super.getRequestForBbox(lon1, lat1, lon2, lat2); 59 60 else { 60 final String overpassQuery = this.overpassQuery.replace("{{bbox}}", lat1 + "," + lon1 + "," + lat2 + "," + lon2);61 final String expandedOverpassQuery = expandExtendedQueries( overpassQuery);61 final String query = this.overpassQuery.replace("{{bbox}}", lat1 + "," + lon1 + "," + lat2 + "," + lon2); 62 final String expandedOverpassQuery = expandExtendedQueries(query); 62 63 return "interpreter?data=" + Utils.encodeUrl(expandedOverpassQuery); 63 64 } … … 67 68 * Evaluates some features of overpass turbo extended query syntax. 68 69 * See https://wiki.openstreetmap.org/wiki/Overpass_turbo/Extended_Overpass_Turbo_Queries 70 * @param query unexpanded query 71 * @return expanded query 69 72 */ 70 73 static String expandExtendedQueries(String query) { … … 77 80 matcher.appendReplacement(sb, geocodeArea(matcher.group(2))); 78 81 } 79 } catch ( Exception ex) {82 } catch (UncheckedParseException ex) { 80 83 final String msg = tr("Failed to evaluate {0}", matcher.group()); 81 84 Main.warn(ex, msg); … … 91 94 final EnumMap<OsmPrimitiveType, Long> idOffset = new EnumMap<>(OsmPrimitiveType.class); 92 95 idOffset.put(OsmPrimitiveType.NODE, 0L); 93 idOffset.put(OsmPrimitiveType.WAY, 2 400000000L);94 idOffset.put(OsmPrimitiveType.RELATION, 3 600000000L);96 idOffset.put(OsmPrimitiveType.WAY, 2_400_000_000L); 97 idOffset.put(OsmPrimitiveType.RELATION, 3_600_000_000L); 95 98 try { 96 99 final List<NameFinder.SearchResult> results = NameFinder.queryNominatim(area); 97 final PrimitiveId osmId = results.iterator().next(). osmId;100 final PrimitiveId osmId = results.iterator().next().getOsmId(); 98 101 return String.format("area(%d)", osmId.getUniqueId() + idOffset.get(osmId.getType())); 99 } catch (IOException ex) {102 } catch (IOException | NoSuchElementException ex) { 100 103 throw new UncheckedParseException(ex); 101 104 } … … 144 147 @Override 145 148 protected void parseUnknown(boolean printWarning) throws XMLStreamException { 146 if ("remark".equals(parser.getLocalName())) { 147 if (parser.getEventType() == XMLStreamConstants.START_ELEMENT) { 148 final String text = parser.getElementText(); 149 if (text.contains("runtime error")) { 150 throw new XMLStreamException(text); 151 } 149 if ("remark".equals(parser.getLocalName()) && parser.getEventType() == XMLStreamConstants.START_ELEMENT) { 150 final String text = parser.getElementText(); 151 if (text.contains("runtime error")) { 152 throw new XMLStreamException(text); 152 153 } 153 154 }
Note:
See TracChangeset
for help on using the changeset viewer.