Class AnnotationLayer

  • All Implemented Interfaces:
    RemoteResource, LayerContent, Loadable

    public final class AnnotationLayer
    extends Layer
    implements RemoteResource
    Represents a layer used to visualize annotations, similar to the way a FeatureLayer visualizes features.

    An annotation is a type of feature that consists of text with position, layout and style. Annotation layers differ from feature layers in that they have:

    • a dedicated text symbol renderer (that is the renderer cannot be chosen or changed by a user)
    • a reference scale for the layer (rather than using the map's reference scale)
    Since:
    100.5.0
    • Constructor Detail

      • AnnotationLayer

        public AnnotationLayer​(PortalItem portalItem,
                               long layerId)
        Creates an annotation layer for a layer within a feature service portal item.
        Parameters:
        portalItem - a feature service PortalItem
        layerId - the layer ID for which to create the layer
        Throws:
        IllegalArgumentException - if portalItem is null
        Since:
        100.5.0
      • AnnotationLayer

        public AnnotationLayer​(String url)
        Creates an annotation layer from a feature service URL.

        To use a credential, call setCredential(Credential) after this constructor and before loading or using this layer.

        Parameters:
        url - the URL of the feature service
        Throws:
        IllegalArgumentException - if the URL is null or empty
        Since:
        100.5.0
    • Method Detail

      • setCredential

        public void setCredential​(Credential credential)
        Description copied from interface: RemoteResource
        Sets a Credential to be used by the network resource in the event of an authentication challenge. The default credential is null.
        Specified by:
        setCredential in interface RemoteResource
        Parameters:
        credential - the Credential to be used for authentication
      • getCredential

        public Credential getCredential()
        Description copied from interface: RemoteResource
        Gets the Credential that is set on the network resource.
        Specified by:
        getCredential in interface RemoteResource
        Returns:
        the Credential, or null if there is none
      • getRequestConfiguration

        public RequestConfiguration getRequestConfiguration()
        Description copied from interface: RemoteResource
        Gets the RequestConfiguration used to modify the parameters of network requests made by this RemoteResource.
        Specified by:
        getRequestConfiguration in interface RemoteResource
        Returns:
        the RequestConfiguration used to modify network requests
      • getUri

        public String getUri()
        Gets the URL of the feature service associated with this layer.
        Specified by:
        getUri in interface RemoteResource
        Returns:
        the URL of the feature service
        Since:
        100.5.0
      • getLayerId

        public long getLayerId()
        Gets the layer ID for the layer.
        Returns:
        the layer ID
        Since:
        100.5.0
      • getReferenceScale

        public double getReferenceScale()
        Gets the reference scale for the layer.

        The reference scale of the layer is the scale at which a client should view the map for the feature symbols and text to appear at their authored size. If the client changes the viewing scale, then feature symbols and text will grow or shrink to keep a consistent size on the map (not the screen). The reference scale will be zero if the layer is not loaded or if there is no reference scale and the symbols and text should appear at default size regardless of the viewing scale.

        Returns:
        the reference scale
        Since:
        100.5.0
      • copy

        public AnnotationLayer copy()
        Creates a deep copy of this AnnotationLayer instance. This means that copies of all fields of this layer are made including its load state.
        Returns:
        a deep copy of this AnnotationLayer instance
        Since:
        100.5.0