Class JMapServerLayer

All Implemented Interfaces:
LayerConstants, LayerNode, Serializable, Cloneable
Direct Known Subclasses:
JMapServerRasterLayer, JMapServerVectorLayer

public abstract class JMapServerLayer extends JMapObject implements LayerNode, LayerConstants, Serializable, Cloneable
See Also:
  • Field Details

    • OBJECT_VERSION_ID_5_0

      protected static final int OBJECT_VERSION_ID_5_0
      See Also:
    • OBJECT_VERSION_ID_6_0

      protected static final int OBJECT_VERSION_ID_6_0
      See Also:
    • OBJECT_VERSION_ID_6_5

      protected static final int OBJECT_VERSION_ID_6_5
      See Also:
    • OBJECT_VERSION_ID_7_0

      protected static final int OBJECT_VERSION_ID_7_0
      See Also:
    • OBJECT_VERSION_ID_7_0_FUNAFUTI

      protected static final int OBJECT_VERSION_ID_7_0_FUNAFUTI
      See Also:
    • OBJECT_VERSION_ID_7_0_ISTANBUL

      protected static final int OBJECT_VERSION_ID_7_0_ISTANBUL
      See Also:
    • id

      protected int id
      The id of the layer.
    • projectId

      protected int projectId
      The id of the project that owns this layer.
    • name

      protected String name
      The name of the layer.
    • description

      protected String description
      The description of the layer.
    • elementType

      protected int elementType
      The type of elements this layer contains.
    • lastUpdateTime

      protected long lastUpdateTime
    • maximumVisibleScale

      protected double maximumVisibleScale
    • minimumVisibleScale

      protected double minimumVisibleScale
    • styleManager

      protected JMapServerStyleManager styleManager
    • extent

      protected Rectangle extent
    • offset

      protected Point offset
    • readOnlyMask

      protected long readOnlyMask
    • layerProperties

      protected long layerProperties
      Layer properties are stored as bitwise values in this property.
    • geometryType

      protected int geometryType
      The geometry type to extract from the associated spatial data source.
    • dataSourceInfo

      @Deprecated protected SpatialDataSourceInfo dataSourceInfo
      Deprecated.
      Use getDataSourceInfo() instead.
    • dataSourceId

      protected int dataSourceId
    • cacheTimeout

      protected long cacheTimeout
    • status

      protected transient int status
    • lastException

      protected transient Exception lastException
    • layerUpdateStatus

      protected ServerLayerUpdateStatus layerUpdateStatus
    • infoReportConfig

      protected JMapServerInfoReportConfig infoReportConfig
    • acl

      protected Acl acl
    • objectVersionId

      protected int objectVersionId
    • dynamicRefresh

      protected int dynamicRefresh
  • Constructor Details

    • JMapServerLayer

      protected JMapServerLayer()
    • JMapServerLayer

      protected JMapServerLayer(int dataSourceId)
    • JMapServerLayer

      public JMapServerLayer(SpatialDataSourceInfo dataSourceInfo)
  • Method Details

    • getStyle

      public Style getStyle(double scale)
      Returns the style that was set for the specified scale.
      Parameters:
      scale - the scale.
      Returns:
      the style that was set for the specified scale.
    • setStyle

      public void setStyle(double scale, Style style)
      Sets the style that should be used for the specified scale.
      Parameters:
      scale - the scale.
      style - the style to use.
    • getDataSourceInfo

      public SpatialDataSourceInfo getDataSourceInfo()
      Returns the dataSourceInfo for this layer.
      Returns:
      the dataSourceInfo for the layer.
    • getDataSourceId

      public int getDataSourceId()
    • setDataSourceInfo

      public void setDataSourceInfo(SpatialDataSourceInfo dataSourceInfo)
      Parameters:
      dataSourceInfo - The dataSourceInfo to set.
    • isEnabledCaching

      public boolean isEnabledCaching()
    • toLayerInfo

      public abstract LayerInfo toLayerInfo()
    • update

      public abstract void update(Projection projectProjection)
    • getUpdateStatus

      public ServerLayerUpdateStatus getUpdateStatus()
    • clone

      public abstract JMapServerLayer clone()
      Specified by:
      clone in interface LayerNode
      Overrides:
      clone in class Object
    • clone

      protected void clone(JMapServerLayer serverLayer)
      Clones all properties from this server layer into the specified JMapServerLayer instance.
      Parameters:
      serverLayer - the instance that will receive cloned properties.
    • toLayerInfo

      protected void toLayerInfo(LayerInfo layerInfo)
      Copies all properties from this server layer to the specified layer info.
      Parameters:
      layerInfo - the layer info to copy properties into.
    • getInfoReportConfig

      public JMapServerInfoReportConfig getInfoReportConfig()
    • getDescription

      public String getDescription()
      Returns the description of the layer.
      Returns:
      the description of the layer.
    • getDescription

      public String getDescription(Locale locale)
      Returns the description of this layer for a specific locale.
      Returns:
      description.
    • setDescription

      public void setDescription(String description)
      Sets the description of the layer.
      Parameters:
      description - the description of the layer.
    • setDescription

      public void setDescription(String description, Locale locale)
      Sets the description of this layer for the specified Locale.
      Parameters:
      description - the new given description.
      locale - the locale for this description
    • getName

      public String getName()
      Returns the name of the layer.
      Specified by:
      getName in interface LayerNode
      Returns:
      the name of the layer.
    • getName

      public String getName(Locale locale)
      Returns the name of this layer for a specific locale.
      Returns:
      name.
    • setName

      public void setName(String name)
      Sets the name of the layer.
      Parameters:
      name - the name of the layer.
    • setName

      public void setName(String name, Locale locale)
      Sets the name of this layer for the specified Locale.
      Parameters:
      name - the new given name.
      locale - the locale for this name
    • isNamed

      public boolean isNamed(String value)
    • getElementType

      public int getElementType()
      Returns:
      Returns the elementType.
    • setElementType

      public void setElementType(int elementType)
      Parameters:
      elementType - The elementType to set.
    • getId

      public int getId()
      Returns the id of the layer.
      Specified by:
      getId in interface LayerNode
      Returns:
      the id of the layer.
    • setId

      public void setId(int id)
      Sets the id of the layer.
      Parameters:
      id - the id of the layer.
    • getProjectId

      public int getProjectId()
    • setProjectId

      protected void setProjectId(int projectId)
    • isIndex

      public boolean isIndex()
      Returns whether this layer should be drawn in the client overview.
      Returns:
      whether this layer should be drawn in the client overview.
      See Also:
    • setIndex

      public void setIndex(boolean flag)
      Sets whether this layer should be drawn in the client overview.
      Parameters:
      flag - the new state of the property.
      See Also:
    • getLastUpdateTime

      public long getLastUpdateTime()
      Returns:
      Returns the lastUpdateTime.
    • setLastUpdateTime

      public void setLastUpdateTime(long lastUpdateTime)
      Parameters:
      lastUpdateTime - The lastUpdateTime to set.
    • getMaximumVisibleScale

      public double getMaximumVisibleScale()
    • setMaximumVisibleScale

      public void setMaximumVisibleScale(double maximumVisibleScale)
    • getMinimumVisibleScale

      public double getMinimumVisibleScale()
    • setMinimumVisibleScale

      public void setMinimumVisibleScale(double maximumVisibleScale)
    • setSelectable

      public void setSelectable(boolean flag)
      Sets the selectable state of the layer. Selection tools can check this state using the method getSelectable to determine if this layer should be processed.
      Parameters:
      flag - if true, the layer will be selectable otherwise not selectable
    • isSelectable

      public boolean isSelectable()
      Returns the current selectable state of the layer.
      Returns:
      true if the layer is selectable, false otherwise
    • getStyleManager

      public JMapServerStyleManager getStyleManager()
      Returns:
      Returns the styleManager.
    • setStyleManager

      public void setStyleManager(JMapServerStyleManager styleManager)
      Parameters:
      styleManager - the styleManager to set.
    • setListed

      public void setListed(boolean listed)
      Sets the listed state of the layer. This flag can be used to determine if the layer should be hidden to the user in a list of layers.
      Parameters:
      listed - if true, the layer will be a listed layer otherwise a normal layer
    • isListed

      public boolean isListed()
      Returns the current listed state of the layer.
      Returns:
      true if the layer is a listed layer, false otherwise
    • setVisible

      public void setVisible(boolean flag)
      Sets the visibility state of the layer. If a layer is invisible, it is not drawn in a view.
      Specified by:
      setVisible in interface LayerNode
      Parameters:
      flag - if true, the layer will be visible otherwise invisible
    • isVisible

      public boolean isVisible()
      Returns the current visibility state of the layer
      Specified by:
      isVisible in interface LayerNode
      Returns:
      true if the layer is visible, false otherwise
    • isPublished

      public boolean isPublished()
      Returns whether this layer is published.
      Returns:
      true if this layer is published.
    • setPublished

      public void setPublished(boolean published)
      Sets whether this layer is published.
      Parameters:
      published - a boolean which defines if this layer is published.
    • getOffset

      public Point getOffset()
    • setOffset

      public void setOffset(Point offset)
    • setReadOnlyProperty

      public final void setReadOnlyProperty(long property, boolean isReadOnly)
      Sets the read-only state for the specified property.
      Parameters:
      property - the property to set.
      isReadOnly - the read-only state.
    • setProperty

      public final void setProperty(long property, boolean enabled)
      Sets the state for the specified property.
      Parameters:
      property - the property to set.
      enabled - the property state.
    • getReadOnlyMask

      public long getReadOnlyMask()
      Returns the a mask which contains all read-only properties for this layer.
      Returns:
      the mask which defines read-only properties of the layer.
    • setReadOnlyMask

      public void setReadOnlyMask(long value)
      Sets the read-only properties mask.
      Parameters:
      value - the read-only mask.
    • getLayerProperties

      public long getLayerProperties()
      Returns a bitwise value that contains all layer properties.
      Returns:
      a value that contains all layer properties.
    • setLayerProperties

      public void setLayerProperties(long value)
      Sets all layer properties.
      Parameters:
      value - a bitwise value that contains all layer properties.
    • validateObjectImpl

      protected void validateObjectImpl()
    • isDynamic

      public boolean isDynamic()
      Returns:
      true if the layer is dynamic and is automatically refreshed periodically.
      Since:
      6.5
    • getDynamicRefresh

      public int getDynamicRefresh()
      Gets the time at which a layer is automatically refreshed
      Returns:
      the time in seconds
      Since:
      6.5
    • setDynamicRefresh

      public void setDynamicRefresh(int seconds)
      Sets the time at which a layer is automatically refreshed. A zero or negative value indicates that the layer is not dynamic.
      Since:
      6.5
    • isEditable

      public boolean isEditable()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class JMapObject
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class JMapObject
    • removeTranslationsOtherThan

      public void removeTranslationsOtherThan(Locale[] locales)
      Description copied from class: LocalizedObject
      Removes any Locale from this object that are not in the specified locales. locales[0] should be the default language
      Overrides:
      removeTranslationsOtherThan in class LocalizedObject
      Parameters:
      locales -
    • isDataStructureDifferent

      protected boolean isDataStructureDifferent(JMapServerLayer oldLayer)
      Compare with database-persisted layer to determine if some properties have changed. If any data-sensible property has changed, we need to update last update time to notify remote servers that layer data needs to be updated.
      Returns:
      true if we need to update property lastUpdateTime, false otherwise.