📄 wmsplugin.java
字号:
wmsServer = setList.getProperty(prefix + WMSServerProperty); if (wmsServer == null) { Debug.error("WMSPlugIn needs a WMS server."); } queryHeader = wmsServer; imageFormat = setList.getProperty(prefix + ImageFormatProperty); setTransparent(setList.getProperty(prefix + TransparentProperty)); backgroundColor = setList.getProperty(prefix + BackgroundColorProperty); setWmsVersion(setList.getProperty(prefix + WMSVersionProperty)); layers = setList.getProperty(prefix + LayersProperty); styles = setList.getProperty(prefix + StylesProperty); /** * Include for vendor specific parameters */ vendorSpecificNames = setList.getProperty(prefix + VendorSpecificNamesProperty); vendorSpecificValues = setList.getProperty(prefix + VendorSpecificValuesProperty); } // end setProperties public Properties getProperties(Properties props) { props = super.getProperties(props); String prefix = PropUtils.getScopedPropertyPrefix(this); props.put(prefix + WMSServerProperty, PropUtils.unnull(wmsServer)); props.put(prefix + ImageFormatProperty, PropUtils.unnull(imageFormat)); props.put(prefix + TransparentProperty, PropUtils.unnull(transparent)); props.put(prefix + BackgroundColorProperty, PropUtils.unnull(backgroundColor)); props.put(prefix + WMSVersionProperty, PropUtils.unnull(wmsVersion)); props.put(prefix + LayersProperty, PropUtils.unnull(layers)); props.put(prefix + StylesProperty, PropUtils.unnull(styles)); props.put(prefix + VendorSpecificNamesProperty, PropUtils.unnull(vendorSpecificNames)); props.put(prefix + VendorSpecificValuesProperty, PropUtils.unnull(vendorSpecificValues)); return props; } public Properties getPropertyInfo(Properties props) { props = super.getPropertyInfo(props); props.put(initPropertiesProperty, WMSServerProperty + " " + WMSVersionProperty + " " + LayersProperty + " " + StylesProperty + " " + VendorSpecificNamesProperty + " " + VendorSpecificValuesProperty + " " + ImageFormatProperty + " " + TransparentProperty + " " + BackgroundColorProperty); props.put(WMSServerProperty, "URL to the server script that responds to WMS map requests"); props.put(ImageFormatProperty, "Image format (GIF, PNG, JPEG)"); props.put(TransparentProperty, "Flag to indicate that background of image should be tranparent"); props.put(TransparentProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor"); props.put(BackgroundColorProperty, "The Background color for the image"); props.put(BackgroundColorProperty + ScopedEditorProperty, "com.bbn.openmap.util.propertyEditor.ColorPropertyEditor"); props.put(WMSVersionProperty, "The WMS specification version"); props.put(LayersProperty, "A list of layers to use in the query"); props.put(StylesProperty, "A list of layer styles to use inthe query"); props.put(VendorSpecificNamesProperty, "Vendor-specific capability names to use in the query"); props.put(VendorSpecificValuesProperty, "Vendor-specific capability values for the names"); return props; } public String getImageFormat() { return imageFormat; } public void setImageFormat(String newImageFormat) { // check without a potential heading 'image/' String checkImageFormat = newImageFormat; if (newImageFormat.indexOf('/') > 0) checkImageFormat = newImageFormat.substring(newImageFormat.indexOf('/')); if (checkImageFormat.equals(WMTConstants.IMAGEFORMAT_GIF) || checkImageFormat.equals(WMTConstants.IMAGEFORMAT_JPEG) || checkImageFormat.equals(WMTConstants.IMAGEFORMAT_PNG)) { imageFormat = newImageFormat; } } public void setImageQuality(int newImageQuality) { if (newImageQuality == WMSPlugIn.LOSSY_IMAGE_QUALITY_HIGH) imageQuality = "HIGH"; else if (newImageQuality == WMSPlugIn.LOSSY_IMAGE_QUALITY_MEDIUM) imageQuality = "MEDIUM"; else if (newImageQuality == WMSPlugIn.LOSSY_IMAGE_QUALITY_LOW) imageQuality = "LOW"; } public String getImageQuality() { return imageQuality; } public void setImageQuality(String imageQuality) { this.imageQuality = imageQuality; } public String getTransparent() { return transparent; } public void setTransparent(String transparent) { if (transparent != null) { transparent = Boolean.valueOf(transparent).toString().toUpperCase(); } this.transparent = transparent; } public String getBackgroundColor() { return backgroundColor; } public void setBackgroundColor(String backgroundColor) { this.backgroundColor = backgroundColor; } public String getErrorHandling() { return errorHandling; } public void setErrorHandling(String errorHandling) { this.errorHandling = errorHandling; } public String getLayers() { return layers; } public void setLayers(String layers) { this.layers = layers; } public String getMapRequestName() { return mapRequestName; } public void setMapRequestName(String mapRequestName) { this.mapRequestName = mapRequestName; } public String getQueryHeader() { return queryHeader; } public void setQueryHeader(String queryHeader) { this.queryHeader = queryHeader; } public String getStyles() { return styles; } public void setStyles(String styles) { this.styles = styles; } public String getVendorSpecificNames() { return vendorSpecificNames; } public void setVendorSpecificNames(String vendorSpecificNames) { this.vendorSpecificNames = vendorSpecificNames; } public String getVendorSpecificValues() { return vendorSpecificValues; } public void setVendorSpecificValues(String vendorSpecificValues) { this.vendorSpecificValues = vendorSpecificValues; } public String getWmsServer() { return wmsServer; } public void setWmsServer(String wmsServer) { this.wmsServer = wmsServer; } // make this better! public String getServerName() { return wmsServer; } public String getWmsVersion() { return wmsVersion; } /** * Does more than just set the version, it also adjusts other parameters * based on version. Be careful calling this without knowing what it does * and how it affects other settings. * * @param wmsVer */ public void setWmsVersion(String wmsVer) { if (wmsVer == null) { wmsVer = "1.1.0"; Debug.output("WMSPlugin: wmsVersion was null, now set to 1.1.0"); } if (Debug.debugging("wms")) { Debug.output("WMSPlugIn: set up with header \"" + queryHeader + "\""); } java.util.StringTokenizer st = new java.util.StringTokenizer(wmsVer, "."); int majorVersion = Integer.parseInt(st.nextToken()); int midVersion = Integer.parseInt(st.nextToken()); int minorVersion = Integer.parseInt(st.nextToken()); // set the REQUEST parameter if (majorVersion == 1 && midVersion == 0 && minorVersion < 3) { mapRequestName = WMTConstants.MAP; } // set the image type parameter if (majorVersion == 1 && minorVersion > 7 && !imageFormat.startsWith("image/")) { imageFormat = "image/" + imageFormat; } // set the error handling parameter if (majorVersion == 1 && midVersion == 0) { errorHandling = "INIMAGE"; } else if (majorVersion == 1 && midVersion >= 1 && minorVersion > 1) { errorHandling = "application/vnd.ogc.se+inimage"; } else if (majorVersion > 1) { errorHandling = "application/vnd.ogc.se+inimage"; } this.wmsVersion = wmsVer; }} // end WMSPlugin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -