Changeset 22942 in osm for applications/editors/josm/plugins/wmsplugin
- Timestamp:
- 2010-09-02T14:10:35+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/AddWMSLayerPanel.java
r22941 r22942 214 214 serviceUrl = null; 215 215 try { 216 if (serviceUrlStr.endsWith("?")) { 217 // It's the root of the URL. We need to append the GetCapabilities 218 // query parameters 216 if (!serviceUrlStr.trim().contains("capabilities")) { 217 // If the url doesn't already have GetCapabilities, add it in 219 218 serviceUrl = new URL(serviceUrlStr + "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities"); 220 } else if (serviceUrlStr.toLowerCase().contains("getcapabilities")) { 221 // The URL already contains the GetCapabilities query parameters 219 } else { 220 // Otherwise assume it's a good URL and let the subsequent error 221 // handling systems deal with problems 222 222 serviceUrl = new URL(serviceUrlStr); 223 } else {224 JOptionPane.showMessageDialog(this, tr("Invalid service URL."),225 tr("WMS Error"), JOptionPane.ERROR_MESSAGE);226 return;227 223 } 228 224 } catch (HeadlessException e) { … … 233 229 return; 234 230 } 231 232 System.out.println("Connecting to: " + serviceUrl); 235 233 236 234 String incomingData; … … 252 250 } 253 251 252 System.out.println(incomingData); 253 254 254 Document document; 255 255 try { … … 272 272 } 273 273 274 treeRootNode.setUserObject(serviceUrl.getHost()); 275 Element capabilityElem = getChild(document.getDocumentElement(), "Capability"); 276 List<Element> children = getChildren(capabilityElem, "Layer"); 277 List<LayerDetails> layers = parseLayers(children, new HashSet<String>()); 278 279 updateTreeList(layers); 274 try { 275 treeRootNode.setUserObject(serviceUrl.getHost()); 276 Element capabilityElem = getChild(document.getDocumentElement(), "Capability"); 277 List<Element> children = getChildren(capabilityElem, "Layer"); 278 List<LayerDetails> layers = parseLayers(children, new HashSet<String>()); 279 updateTreeList(layers); 280 } catch(Exception e) { 281 JOptionPane.showMessageDialog(this, tr("Could not parse WMS layer list."), 282 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 283 e.printStackTrace(); 284 return; 285 } 280 286 } 281 287 … … 358 364 for (Projection proj : Projection.allProjections) { 359 365 if (proj instanceof ProjectionSubPrefs) { 360 return ((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null; 366 if (((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null) { 367 return true; 368 } 361 369 } else { 362 return proj.toCode().equals(crs); 370 if (proj.toCode().equals(crs)) { 371 return true; 372 } 363 373 } 364 374 }
Note:
See TracChangeset
for help on using the changeset viewer.