Class Layer

  • All Implemented Interfaces:
    Comparable<Layer>
    Direct Known Subclasses:
    WMTSLayer

    public class Layer
    extends Object
    implements Comparable<Layer>
    Nested list of zero or more map Layers offered by this server. It contains only fields for information that we currently find interesting. Feel free to add your own.
    Author:
    rgould
    • Field Detail

      • srs

        protected Set<String> srs
        A set of Strings representing SRSs. These are the SRSs contributed by this layer. For the complete list you need to consider these values and those defined by its parent.
    • Constructor Detail

      • Layer

        public Layer()
        Crate a layer with no human readable title.

        These layers are simply for organization and storage of common settings (like SRS or style settings). These settings will be valid for all children.

      • Layer

        public Layer​(String title)
        Create a layer with an optional title
    • Method Detail

      • clearCache

        public void clearCache()
        Called to clear the internal cache of this layer; and any children.
      • getLayerBoundingBoxes

        public List<CRSEnvelope> getLayerBoundingBoxes()
        Get the BoundingBoxes associated with this layer.

        If you modify the contents of this List please call clearCache() so that the getBoundingBoxes() method can return the correct combination of this list and the parent bounding boxes.

      • getBoundingBoxes

        public Map<String,​CRSEnvelope> getBoundingBoxes()
        Returns every BoundingBox associated with this layer. The HashMap returned has each bounding box's SRS Name (usually an EPSG code) value as the key, and the value is the BoundingBox object itself.

        Implements inheritance: if this layer's bounding box is null, query ancestors until the first bounding box is found or no more ancestors

        Returns:
        a HashMap of all of this layer's bounding boxes or null if no bounding boxes found
      • setBoundingBoxes

        public void setBoundingBoxes​(CRSEnvelope boundingBox)
      • setBoundingBoxes

        public void setBoundingBoxes​(Map<String,​CRSEnvelope> boundingBoxes)
        Sets this layer's bounding boxes. The HashMap must have each BoundingBox's CRS/SRS value as its key, and the BoundingBox object as its value.
        Parameters:
        boundingBoxes - a HashMap containing bounding boxes
      • getLayerDimensions

        public List<Dimension> getLayerDimensions()
        Direct access to the dimensions contributed by this Layer. For the complete list of Dimensions applicable to the layer this value must be combined with any Dimensions supplied by the parent - this work is done for you using the getDimensions() method.
        Returns:
        List of Dimensions contributed by this Layer definition
        See Also:
        getDimensions()
      • getDimensions

        public Map<String,​Dimension> getDimensions()
        The dimensions valid for this layer. Includes both getLauerDimensions() and all Dimensions contributed by parent layers. The result is an unmodifiable map indexed by Dimension name.
        Returns:
        Map of valid dimensions for this layer indexed by Dimension name.
      • setDimensions

        public void setDimensions​(Map<String,​Dimension> dimensionMap)
      • setDimensions

        public void setDimensions​(Collection<Dimension> dimensionList)
      • setDimensions

        public void setDimensions​(Dimension dimension)
      • getDimension

        public Dimension getDimension​(String name)
        Look up a Dimension; note this looks up any parent supplied definitions as well
      • getLayerExtents

        public List<Extent> getLayerExtents()
        The Extents contributed by this Layer.

        Please note that for the complete list of Extents valid for this layer you should use the getExtents() method which will consider extents defined as part of a Dimension and all those contributed by Parent layers.

        This is an accessor; if you modify the provided list please call clearCache().

        Returns:
        Extents directly defined by this layer
      • getExtents

        public Map<String,​Extent> getExtents()
        The Extents valid for this layer; this includes both extents defined by this layer and all extents contributed by parent layers.

        In keeping with the WMS 1.3.0 specification some extents may be defined as part of a Dimension definition.

        Returns:
        All extents valid for this layer.
      • getExtent

        public Extent getExtent​(String name)
        Look up an extent by name; search includes all parent extent definitions.
        Returns:
        Extent or null if not found
      • setExtents

        public void setExtents​(Map<String,​Extent> extentMap)
      • setExtents

        public void setExtents​(Collection<Extent> extentList)
      • setExtents

        public void setExtents​(Extent extent)
      • getName

        public String getName()
        Gets the name of the Layer. It is designed to be machine readable, and if it is present, this layer is determined to be drawable and is a valid candidate for use in a GetMap or GetFeatureInfo request.
        Returns:
        the machine-readable name of the layer
      • setName

        public void setName​(String name)
        Sets the name of this layer. Giving the layer name indicates that it can be drawn during a GetMap or GetFeatureInfo request.
        Parameters:
        name - the layer's new name
      • getSrs

        public Set<String> getSrs()
        Accumulates all of the srs/crs specified for this layer and all srs/crs inherited from its ancestors. No duplicates are returned.
        Returns:
        Set of all srs/crs for this layer and its ancestors
      • setSrs

        public void setSrs​(Set<String> srs)
      • getStyles

        public List<StyleImpl> getStyles()
        Accumulates all of the styles specified for this layer and all styles inherited from its ancestors. No duplicates are returned.

        The List that is returned is of type List. Before 2.2-RC0 it was of type List.

        Returns:
        List of all styles for this layer and its ancestors
      • setStyles

        public void setStyles​(List<StyleImpl> styles)
      • getTitle

        public String getTitle()
      • setTitle

        public void setTitle​(String title)
      • isQueryable

        public boolean isQueryable()
        Determines if this layer is queryable. Implements inheritance: if this layer's Queryable attribute is null, check ancestors until the first Queryable attribute is found or no more ancestors. If a Queryable attribute is not found for this layer, it will return the default value of false.
        Returns:
        true is this layer is Queryable
      • setQueryable

        public void setQueryable​(boolean queryable)
      • compareTo

        public int compareTo​(Layer layer)
        Specified by:
        compareTo in interface Comparable<Layer>
      • getParent

        public Layer getParent()
        Returns:
        Returns the parent.
      • setParent

        public void setParent​(Layer parentLayer)
        Set the parent; child will be added to the parents list of children (if it is not already).
        Parameters:
        parentLayer - The parent to set.
      • getLatLonBoundingBox

        public CRSEnvelope getLatLonBoundingBox()
        Returns the LatLonBoundingBox for this layer. Implements inheritance: if this layer's bounding box is null, query ancestors until the first bounding box is found or no more ancestors.
        Returns:
        the LatLonBoundingBox for this layer or null if no lat/lon bounding box is found
      • setLatLonBoundingBox

        public void setLatLonBoundingBox​(CRSEnvelope latLonBoundingBox)
      • getLayerChildren

        public List<Layer> getLayerChildren()
        List of children.
        Returns:
        list of children
      • getChildren

        public Layer[] getChildren()
      • setChildren

        public void setChildren​(Layer[] childrenArray)
      • addChildren

        public void addChildren​(Layer child)
      • get_abstract

        public String get_abstract()
        The abstract contains human-readable information about this layer
        Returns:
        Returns the _abstract.
      • set_abstract

        public void set_abstract​(String _abstract)
        Parameters:
        _abstract - The _abstract to set.
      • getKeywords

        public String[] getKeywords()
        Keywords are Strings to be used in searches
        Returns:
        Returns the keywords.
      • setKeywords

        public void setKeywords​(String[] keywords)
        Parameters:
        keywords - The keywords to set.
      • setScaleDenominatorMax

        public void setScaleDenominatorMax​(double scaleDenominatorMax)
        Max scale denominator for which it is appropriate to draw this layer.

        Scale denominator is calculated based on the bounding box of the central pixel in a request (ie not a scale based on real world size of the entire layer).

        Parameters:
        scaleDenominatorMax - scale denominator for which it is approprirate to draw this layer
      • getScaleDenominatorMax

        public double getScaleDenominatorMax()
        Max scale denominator for which it is appropriate to draw this layer.

        Scale denominator is calculated based on the bounding box of the central pixel in a request (ie not a scale based on real world size of the entire layer).

        Some web map servers will refuse to render images at a scale greater than the value provided here.

        return Max scale denominator for which it is appropriate to draw this layer.

      • setScaleDenominatorMin

        public void setScaleDenominatorMin​(double scaleDenominatorMin)
        Min scale denominator for which it is appropriate to draw this layer.

        Scale denominator is calculated based on the bounding box of the central pixel in a request (ie not a scale based on real world size of the entire layer).

        Parameters:
        scaleDenominatorMin - scale denominator for which it is appropriate to draw this layer
      • getScaleDenominatorMin

        public double getScaleDenominatorMin()
        Min scale denominator for which it is appropriate to draw this layer.

        Scale denominator is calculated based on the bounding box of the central pixel in a request (ie not a scale based on real world size of the entire layer).

        Some web map servers will refuse to render images at a scale less than the value provided here.

        return Min scale denominator for which it is appropriate to draw this layer

      • getEnvelope

        public GeneralBounds getEnvelope​(CoordinateReferenceSystem crs)
        Look up an envelope for the provided CoordinateReferenceSystem.

        Please note that the lookup is performed based on the SRS Name of the provided CRS which is assumed to be one of its identifiers. This method returns the first envelope found; this may not be valid for sparse data sets that indicate data location using multiple envelopes for a provided CRS.

        Returns:
        GeneralEnvelope matching the provided crs; or null if unavailable.
      • getCascaded

        public int getCascaded()
        Returns:
        0 if the layer is not cascaded, the number of times it has been cascaded otherwise.
      • setCascaded

        public void setCascaded​(int cascadedValue)
        Parameters:
        cascadedValue - 0 if the layer is not cascaded, the number of times it has been cascaded otherwise.
      • getMetadataURL

        public List<MetadataURL> getMetadataURL()
      • setMetadataURL

        public void setMetadataURL​(List<MetadataURL> metadataURL)
      • setAttribution

        public void setAttribution​(Attribution attribution)
      • toString

        public String toString()
        Overrides:
        toString in class Object