capabilities.java
来自「world wind java sdk 源码」· Java 代码 · 共 1,229 行 · 第 1/3 页
JAVA
1,229 行
Style style = new Style(se, layer); layer.styleElements.put(se, style); this.styleElements.put(se, style); } return layer.styleElements.keySet().toArray(new Element[1]); } public Element[] getLayerSubLayers(Element layer) { return this.getElements(layer, "wms:Layer"); } public String getLayerTitle(Element layerElement) { Layer layer = this.namedLayerElements.get(layerElement); if (layer == null) return null; return layer.title != null ? layer.title : (layer.title = this.getText(layerElement, "wms:Title")); } public Element getLayerStyleByName(Element layerElement, String styleName) { Layer layer = this.namedLayerElements.get(layerElement); if (layer == null) return null; if (layer.styleElements == null || layer.styleElements.size() == 0) { // Initialize the layer's style list. this.getLayerStyles(layerElement); if (layer.styleElements == null || layer.styleElements.size() == 0) return null; } Collection<Style> styles = layer.styleElements.values(); for (Style s : styles) { if (s != null && s.name != null && s.name.equals(styleName)) return s.element; } return null; } public String getLayerLastUpdate(Element layer) { return this.getText(layer, "ancestor-or-self::wms:Layer/wms:LastUpdate"); } public String getLayerExtremeElevationsMin(Element layer) { return this.getText(layer, "ancestor-or-self::wms:Layer/wms:ExtremeElevations/@min"); } public String getLayerExtremeElevationsMax(Element layer) { return this.getText(layer, "ancestor-or-self::wms:Layer/wms:ExtremeElevations/@max"); } // ********* Style Items ********* // protected HashMap<Element, Style> styleElements = new HashMap<Element, Style>(); protected static class Style { protected final Layer layer; protected final Element element; protected String name; protected String title; public Style(Element element, Layer layer) { this.element = element; this.layer = layer; } } public String getStyleAbstract(Element styleElement) { return this.getText(styleElement, "wms:Abstract"); } public String getStyleLegendFormat(Element styleElement) { return this.getText(styleElement, "wms:LegendURL/wms:Format"); } public String getStyleLegendHeight(Element styleElement) { return this.getText(styleElement, "wms:LegendURL/@height"); } public String getStyleLegendURL(Element styleElement) { return this.getText(styleElement, "wms:LegendURL/wms:OnlineResource/@xlink:href"); } public String getStyleLegendWidth(Element styleElement) { return this.getText(styleElement, "wms:LegendURL/@width"); } public String getStyleName(Element styleElement) { Style style = this.styleElements.get(styleElement); return style != null && style.title != null ? style.title : this.getText(styleElement, "wms:Name"); } public String getStyleName(Element layerElement, Element styleElement) { Layer layer = this.namedLayerElements.get(layerElement); if (layer == null || layer.styleElements == null) return this.getStyleName(layerElement, styleElement); Style style = layer.styleElements.get(styleElement); return style != null && style.name != null ? style.title : this.getText(styleElement, "wms:Name"); } public String getStyleSheetURLFormat(Element styleElement) { return this.getText(styleElement, "wms:StyleSheetURL/wms:Format"); } public String getStyleSheetURL(Element styleElement) { return this.getText(styleElement, "wms:StyleSheetURL/wms:OnlineResource/@xlink:href"); } public String getStyleTitle(Element styleElement) { Style style = this.styleElements.get(styleElement); return style != null && style.title != null ? style.title : this.getText(styleElement, "wms:Title"); } public String getStyleTitle(Element layerElement, Element styleElement) { Layer layer = this.namedLayerElements.get(layerElement); if (layer == null || layer.styleElements == null) return this.getStyleTitle(styleElement); Style style = this.styleElements.get(styleElement); return style != null && style.title != null ? style.title : this.getText(styleElement, "wms:Title"); } public String getStyleURL(Element styleElement) { return this.getText(styleElement, "wms:StyleURL/wms:OnlineResource/@xlink:href"); } public String getStyleURLFormat(Element styleElement) { return this.getText(styleElement, "wms:StyleURL/wms:Format"); } // ********* Authority Items ********* // public String getAuthorityName(Element authority) { return this.getText(authority, "@wms:name"); } public String getAuthorityURL(Element authority) { return this.getText(authority, "wms:OnlineResource/@xlink:href"); } // ********* Identifier Items ********* // public String getIdentifier(Element identifier) { return this.getText(identifier, "."); } public String getIdentifierAuthority(Element identifier) { return this.getText(identifier, "@wms:authority"); } // ********* Metadata Items ********* // public String getMetadataFormat(Element metadata) { return this.getText(metadata, "wms:Format"); } public String getMetadataURL(Element metadata) { return this.getText(metadata, "wms:OnlineResource/@xlink:href"); } public String getMetadataType(Element metadata) { return this.getText(metadata, "@wms:type"); } // ********* EX_GeographicBoundingBox Items ********* // public String getWestBoundLongitude(Element bbox) { return this.getText(bbox, "wms:westBoundLongitude"); } public String getEastBoundLongitude(Element bbox) { return this.getText(bbox, "wms:eastBoundLongitude"); } public String getSouthBoundLatitude(Element bbox) { return this.getText(bbox, "wms:southBoundLatitude"); } public String getNorthBoundLatitude(Element bbox) { return this.getText(bbox, "wms:northBoundLatitude"); } // ********* BoundingBox Items ********* // public String getBoundingBoxCRS(Element bbox) { return this.getText(bbox, "@wms:CRS"); } public String getBoundingBoxMinx(Element bbox) { return this.getText(bbox, "@wms:minx"); } public String getBoundingBoxMiny(Element bbox) { return this.getText(bbox, "@wms:miny"); } public String getBoundingBoxMaxx(Element bbox) { return this.getText(bbox, "@wms:maxx"); } public String getBoundingBoxMaxy(Element bbox) { return this.getText(bbox, "@wms:maxy"); } public String getBoundingBoxResx(Element bbox) { return this.getText(bbox, "@wms:resx"); } public String getBoundingBoxResy(Element bbox) { return this.getText(bbox, "@wms:resy"); } public String getBoundingBoxSRS(Element bbox) { return this.getText(bbox, "@wms:SRS"); } // ********* Dimension Items ********* // public String getDimensionName(Element dimension) { return this.getText(dimension, "@wms:name"); } public String getDimensionUnits(Element dimension) { return this.getText(dimension, "@wms:units"); } public String getDimensionUnitSymbol(Element dimension) { return this.getText(dimension, "@wms:unitSymbol"); } public String getDimensionDefault(Element dimension) { return this.getText(dimension, "@wms:default"); } public String getDimensionMultipleValues(Element dimension) { return this.getText(dimension, "@wms:multipleValues"); } public String getDimensionNearestValue(Element dimension) { return this.getText(dimension, "@wms:nearestValue"); } public String getDimensionCurrent(Element dimension) { return this.getText(dimension, "@wms:current"); } public String getDimensionExtent(Element dimension) { return this.getText(dimension, "."); } // ********* Extent Items, wms 1.1 only ********* // public String getExtentName(Element dimension) { return this.getText(dimension, "@wms:name"); } public String getExtentDefault(Element dimension) { return this.getText(dimension, "@wms:default"); } public String getExtentMultipleValues(Element dimension) { return this.getText(dimension, "@wms:multipleValues"); } public String getExtentNearestValue(Element dimension) { return this.getText(dimension, "@wms:nearestValue"); } public String getExtentCurrent(Element dimension) { return this.getText(dimension, "@wms:current"); } public String getExtentText(Element dimension) { return this.getText(dimension, "."); }//// public static void main(String[] args)// {// try// {// String server = "http://localhost:8080";// URI serverURI = new URI(server.trim());//// DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();// docBuilderFactory.setNamespaceAware(true);//// if( Configuration.getJavaVersion() >= 1.6 )// {// try// {// docBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);// }// catch (ParserConfigurationException e)// { // Note it and continue on. Some Java5 parsers don't support the feature.// String message = Logging.getMessage("XML.NonvalidatingNotSupported");// Logging.logger().finest(message);// }// }//// DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();// Document doc;//// // Request the capabilities document from the server.// CapabilitiesRequest req = new CapabilitiesRequest(serverURI);// doc = docBuilder.parse(req.toString());//// // Parse the DOM as a capabilities document.// Capabilities caps = Capabilities.parse(doc);//// final Element[] namedLayerCaps = caps.getNamedLayers();// if (namedLayerCaps == null)// return;//// for (Element layerCaps : namedLayerCaps)// {// String layerName = caps.getLayerName(layerCaps);// System.out.println("Layer name: " + (layerName != null ? layerName : "none"));// Element[] styles = caps.getLayerStyles(layerCaps);// if (styles != null)// {// for (Element style : styles)// {// String styleName = caps.getStyleName(layerCaps, style);// System.out.println("\tStyle name: " + (styleName != null ? styleName : "none"));// String legendURL = caps.getStyleLegendURL(style);// System.out.println("\tLegend URL: " + (legendURL != null ? legendURL : "none"));// }// }// }// }// catch (URISyntaxException e)// {// e.printStackTrace();// }// catch (ParserConfigurationException e)// {// e.printStackTrace();// }// catch (SAXException e)// {// e.printStackTrace();// }// catch (IOException e)// {// e.printStackTrace();// }// }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?