Changeset 3934 in josm for trunk/src/org/openstreetmap/josm/io/OsmApi.java
- Timestamp:
- 2011-02-26T00:35:10+01:00 (15 years ago)
- File:
-
- 1 edited
-
trunk/src/org/openstreetmap/josm/io/OsmApi.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r3566 r3934 32 32 import org.openstreetmap.josm.data.osm.OsmPrimitive; 33 33 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 34 import org.openstreetmap.josm.gui.layer.Layer; 35 import org.openstreetmap.josm.gui.layer.ImageryLayer; 34 36 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 35 37 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 157 159 cancel = false; 158 160 try { 159 String s = sendRequest("GET", "capabilities", null,monitor, false); 161 String s = sendRequest("GET", "capabilities", null, monitor, false); 160 162 InputSource inputSource = new InputSource(new StringReader(s)); 161 163 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new CapabilitiesParser()); … … 173 175 osmWriter.setVersion(version); 174 176 initialized = true; 177 178 /* This is an interim solution for openstreetmap.org not currently 179 * transmitting their imagery blacklist in the capabilities call. 180 * remove this as soon as openstreetmap.org adds blacklists. */ 181 if (this.serverUrl.matches(".*openstreetmap.org/api.*") && capabilities.getImageryBlacklist().isEmpty()) 182 { 183 capabilities.put("blacklist", "regex", ".*\\.google\\.com/.*"); 184 capabilities.put("blacklist", "regex", ".*209\\.85\\.2\\d\\d.*"); 185 capabilities.put("blacklist", "regex", ".*209\\.85\\.1[3-9]\\d.*"); 186 capabilities.put("blacklist", "regex", ".*209\\.85\\.12[89].*"); 187 } 188 189 /* This checks if there are any layers currently displayed that 190 * are now on the blacklist, and removes them. This is a rare 191 * situaton - probably only occurs if the user changes the API URL 192 * in the preferences menu. Otherwise they would not have been able 193 * to load the layers in the first place becuase they would have 194 * been disabled! */ 195 if (Main.main.isDisplayingMapView()) { 196 for (Layer l : Main.map.mapView.getLayersOfType(ImageryLayer.class)) { 197 if (((ImageryLayer) l).getInfo().isBlacklisted()) { 198 System.out.println(tr("Removed layer {0} because it is not allowed by the configured API.", l.getName())); 199 Main.main.removeLayer(l); 200 } 201 } 202 } 203 175 204 } catch(IOException e) { 176 205 initialized = false;
Note:
See TracChangeset
for help on using the changeset viewer.
