capabilities.java

来自「world wind java sdk 源码」· Java 代码 · 共 1,229 行 · 第 1/3 页

JAVA
1,229
字号
    public Double[] getLayerExtremeElevations(Capabilities caps, String[] layerNames)    {        if (caps == null)        {            String message = Logging.getMessage("nullValue.WMSCapabilities");            Logging.logger().severe(message);            throw new IllegalArgumentException(message);        }        if (layerNames == null)        {            String message = Logging.getMessage("nullValue.WMSLayerNames");            Logging.logger().severe(message);            throw new IllegalArgumentException(message);        }        String extremeMin = null;        String extremeMax = null;        for (String name : layerNames)        {            Element layer = caps.getLayerByName(name);            if (layer == null)                continue;            String min = caps.getLayerExtremeElevationsMin(layer);            if (min != null && (extremeMin == null || min.compareTo(min) > 0))                extremeMin =  min;            String max = caps.getLayerExtremeElevationsMax(layer);            if (max != null && (extremeMax == null || max.compareTo(max) > 0))                extremeMax =  max;        }        if (extremeMin != null || extremeMax != null)        {            try            {                Double[] extremes = new Double[] {null, null};                if (extremeMin != null)                    extremes[0] = Double.parseDouble(extremeMin);                if (extremeMax != null)                    extremes[1] = Double.parseDouble(extremeMax);                return extremes;            }            catch (NumberFormatException e)            {                String message = Logging.getMessage("generic.ConversionError",                    extremeMin != null ? extremeMin : "" + extremeMax != null ? extremeMax : "");                Logging.logger().severe(message);            }        }        return null;    }    // ********* Document Items ********* //    public String getVersion()    {        return this.getText("*/@wms:version");    }    public String getUpdateSequence()    {        return this.getText("*/@wms:updateSequence");    }    // ********* Service Items ********* //    public String getAbstract()    {        return this.getText(this.service, "wms:Abstract");    }    public String getAccessConstraints()    {        return this.getText(this.service, "wms:AccessConstraints");    }    public String getContactOrganization()    {        return this.getText(            this.service, "wms:ContactInformation/wms:ContactPersonPrimary/wms:ContactOrganization");    }    public String getContactPerson()    {        return this.getText(            this.service, "wms:ContactInformation/wms:ContactPersonPrimary/wms:ContactPerson");    }    public String getFees()    {        return this.getText(this.service, "wms:Fees");    }    public String[] getKeywordList()    {        return this.getTextArray(this.service, "wms:KeywordList/wms:Keyword");    }    public String getLayerLimit()    {        return this.getText(this.service, "wms:LayerLimit");    }    public String getMaxWidth()    {        return this.getText(this.service, "wms:MaxWidth");    }    public String getMaxHeight()    {        return this.getText(this.service, "wms:MaxHeight");    }    public String getServiceName()    {        return this.getText(this.service, "wms:Name");    }    public String getTitle()    {        return this.getText(this.service, "wms:Title");    }    // ********* Capability Items ********* //    public String getOnlineResource()    {        return this.getText(this.capability, "wms:OnlineResource/@xlink:href");    }    public String[] getGetCapabilitiesFormats()    {        return this.getTextArray(this.capability,            "wms:Request/wms:GetCapabilities/wms:Format");    }    public String getGetCapabilitiesRequestGetURL()    {        return this.getText(this.capability,            "wms:Request/wms:GetCapabilities/wms:DCPType/wms:HTTP/wms:Get/wms:OnlineResource/@xlink:href");    }    public String getGetCapabilitiesRequestPostURL()    {        return this.getText(this.capability,            "wms:Request/wms:GetCapabilities/wms:DCPType/wms:HTTP/wms:Post/wms:OnlineResource/@xlink:href");    }    public String[] getExceptionFormats()    {        return this.getTextArray(this.capability, "wms:Exception/wms:Format");    }    public String getFeatureInfoRequestGetURL()    {        return this.getText(this.capability,            "wms:Request/wms:GetFeatureInfo/wms:DCPType/wms:HTTP/wms:Get/wms:OnlineResource/@xlink:href");    }    public String getFeatureInfoRequestPostURL()    {        return this.getText(this.capability,            "wms:Request/wms:GetFeatureInfo/wms:DCPType/wms:HTTP/wms:Post/wms:OnlineResource/@xlink:href");    }    public String[] getGetMapFormats()    {        return this.getTextArray(this.capability,            "wms:Request/wms:GetMap/wms:Format");    }    public String getGetMapRequestGetURL()    {        return this.getText(this.capability,            "wms:Request/wms:GetMap/wms:DCPType/wms:HTTP/wms:Get/wms:OnlineResource/@xlink:href");    }    public String getGetMapRequestPostURL()    {        return this.getText(this.capability,            "wms:Request/wms:GetMap/wms:DCPType/wms:HTTP/wms:Post/wms:OnlineResource/@xlink:href");    }    public String getVendorSpecificCapabilities()    {        return this.getText(this.capability, "wms:VendorSpecificCapabilities");    }    public Element getLayer()    {        return this.getElement(this.capability, "wms:Layer");    }    // ********* Layer Items ********* //    protected static class Layer    {        protected HashMap<Element, Style> styleElements = new HashMap<Element, Style>();        protected final Element element;        protected Layer layer;        protected String name;        protected String title;        public Layer(Element element)        {            this.element = element;        }    }    public String getLayerAbstract(Element layer)    {        return this.getText(layer, "wms:Abstract");    }    public String getLayerAttributionTitle(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/wms:Attribution/wms:Title");    }    public String getLayerAttributionURL(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/wms:Attribution/wms:OnlineResource/@xlink:href");    }    public String getLayerAttributionLogoFormat(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/wms:Attribution/wms:LogoURL/wms:Format");    }    public String getLayerAttributionLogoHeight(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/wms:Attribution/wms:LogoURL/@wms:height");    }    public String getLayerAttributionLogoURL(Element layer)    {        return this.getText(layer,            "ancestor-or-self::wms:Layer/wms:Attribution/wms:LogoURL/wms:OnlineResource/@xlink:href");    }    public String getLayerAttributionLogoWidth(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/wms:Attribution/wms:LogoURL/@wms:width");    }    public Element[] getLayerAuthorityURLs(Element layer)    {        return this.getUniqueElements(layer, "ancestor-or-self::wms:Layer/wms:AuthorityURL", "@wms:type");    }    public abstract BoundingBox[] getLayerBoundingBoxes(Element layer);    public String getLayerCascaded(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/@cascaded");    }    public String[] getLayerCRS(Element layer)    {        return this.getUniqueText(layer, "ancestor-or-self::wms:Layer/wms:CRS");    }    public String getLayerDataURLFormat(Element layer)    {        return this.getText(layer, "wms:DataURL/wms:Format");    }    public String getLayerDataURL(Element layer)    {        return this.getText(layer, "wms:DataURL/wms:OnlineResource/@xlink:href");    }    public Element[] getLayerDimensions(Element layer)    {        Element[] dims = this.getElements(layer, "ancestor-or-self::wms:Layer/wms:Dimension");        if (dims == null || dims.length == 0)            return null;        ArrayList<Element> uniqueDims = new ArrayList<Element>();        ArrayList<String> dimNames = new ArrayList<String>();        for (Element e : dims)        {            // Filter out dimensions with same name.            // Keep all those with a null name, even though wms says they're invalid. Let the app decide.            String name = this.getDimensionName(e);            if (name != null && dimNames.contains(name))                continue;            uniqueDims.add(e);            dimNames.add(name);        }        return uniqueDims.toArray(new Element[uniqueDims.size()]);    }    public Element[] getLayerExtents(Element layer)    {        Element[] extents = this.getElements(layer, "ancestor-or-self::wms:Layer/wms:Extent");        if (extents == null || extents.length == 0)            return null;        ArrayList<Element> uniqueExtents = new ArrayList<Element>();        ArrayList<String> extentNames = new ArrayList<String>();        for (Element e : extents)        {            // Filter out dimensions with same name.            // Keep all those with a null name, even though wms says they're invalid. Let the app decide.            String name = this.getDimensionName(e);            if (name != null && extentNames.contains(name))                continue;            uniqueExtents.add(e);            extentNames.add(name);        }        return uniqueExtents.toArray(new Element[uniqueExtents.size()]);    }    public abstract BoundingBox getLayerGeographicBoundingBox(Element layer);    public String getLayerFeatureListFormat(Element layer)    {        return this.getText(layer, "wms:FeatureListURL/wms:Format");    }    public String getLayerFeatureListURL(Element layer)    {        return this.getText(layer, "wms:FeatureListURL/wms:OnlineResource/@xlink:href");    }    public String getLayerFixedHeight(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/@fixedHeight");    }    public String getLayerFixedWidth(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/@fixedWidth");    }    public Element[] getLayerIdentifiers(Element layer)    {        return this.getUniqueElements(layer, "wms:Identifier", "wms:authority");    }    public String[] getLayerKeywordList(Element layer)    {        return this.getTextArray(layer, "wms:KeywordList/wms:Keyword");    }    public abstract String getLayerMaxScaleDenominator(Element layer);    public Element[] getLayerMetadataURLs(Element layer)    {        return this.getElements(layer, "wms:MetadataURL");    }    public abstract String getLayerMinScaleDenominator(Element layer);    public String getLayerName(Element layerElement)    {        Layer layer = this.namedLayerElements.get(layerElement);        return layer != null && layer.name != null ? layer.name : this.getText(layerElement, "wms:Name");    }    public String getLayerNoSubsets(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/@noSubsets");    }    public String getLayerOpaque(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/@opaque");    }    public String getLayerQueryable(Element layer)    {        return this.getText(layer, "ancestor-or-self::wms:Layer/@queryable");    }    public String[] getLayerSRS(Element layer)    {        return this.getUniqueText(layer, "ancestor-or-self::wms:Layer/wms:SRS");    }    public Element[] getLayerStyles(Element layerElement)    {        Layer layer = this.namedLayerElements.get(layerElement);        if (layer == null)            return null;        if (layer.styleElements != null && layer.styleElements.size() != 0)            return layer.styleElements.keySet().toArray(new Element[1]);        Element[] styleElements = this.getUniqueElements(layerElement, "ancestor-or-self::wms:Layer/wms:Style", "Name");        if (styleElements == null)            return null;        layer.styleElements = new HashMap<Element, Style>();        for (Element se : styleElements)        {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?