- Timestamp:
- 2015-02-15T19:55:12+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java
r8061 r8068 187 187 // Just set the URL and hope everything works out 188 188 if(s.wmsUrl.isEmpty()) { 189 addWMSLayer(s.name + " (" + text + ")", text); 190 break outer; 189 try { 190 addWMSLayer(s.name + " (" + text + ")", text); 191 break outer; 192 } catch (IllegalStateException ex) { 193 Main.error(ex.getMessage()); 194 } 191 195 } 192 196 … … 226 230 * @param title Name of the layer as it will shop up in the layer manager 227 231 * @param url URL to the WMS server 232 * @throws IllegalStateException if imagery time is neither HTML nor WMS 233 * @see WMSLayer#checkGrabberType 228 234 */ 229 235 private void addWMSLayer(String title, String url) { 230 Main.main.addLayer(new WMSLayer(new ImageryInfo(title, url))); 236 WMSLayer layer = new WMSLayer(new ImageryInfo(title, url)); 237 layer.checkGrabberType(); 238 Main.main.addLayer(layer); 231 239 } 232 240 -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r7596 r8068 1021 1021 } 1022 1022 1023 /** 1024 * Checks that WMS layer is a grabber-compatible one (HTML or WMS). 1025 * @throws IllegalStateException if imagery time is neither HTML nor WMS 1026 * @since 8068 1027 */ 1028 public void checkGrabberType() { 1029 ImageryType it = getInfo().getImageryType(); 1030 if (!ImageryType.HTML.equals(it) && !ImageryType.WMS.equals(it)) 1031 throw new IllegalStateException("getGrabber() called for non-WMS layer type"); 1032 } 1033 1023 1034 protected WMSGrabber getGrabber(boolean localOnly) { 1035 checkGrabberType(); 1024 1036 if (getInfo().getImageryType() == ImageryType.HTML) 1025 1037 return new HTMLGrabber(Main.map.mapView, this, localOnly); 1026 else if (getInfo().getImageryType() == ImageryType.WMS)1038 else 1027 1039 return new WMSGrabber(Main.map.mapView, this, localOnly); 1028 else throw new IllegalStateException("getGrabber() called for non-WMS layer type");1029 1040 } 1030 1041
Note:
See TracChangeset
for help on using the changeset viewer.