Class AnnotationSublayer

  • All Implemented Interfaces:
    LayerContent

    public final class AnnotationSublayer
    extends java.lang.Object
    implements LayerContent
    Allows you to interrogate the properties of a sublayer within an annotation layer and to change the visibility of the sublayer.

    You can get a list of AnnotationSublayer from AnnotationLayer using LayerContent.getSubLayerContents(). AnnotationSublayer objects only exist as part of an AnnotationLayer object, populated when the AnnotationLayer is loaded. They cannot exist separately. Annotation sublayers offer finer control over your annotation, allowing the author to set different visual properties from the parent annotation layer. These visual properties include font, size, color, or different minimum and maximum scale ranges.

    Since:
    100.6.0
    See Also:
    AnnotationLayer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canChangeVisibility()
      Checks whether we can change the visibility of this layer.
      boolean canShowInLegend()
      Checks if this layer will be listed in the legend.
      ListenableFuture<java.util.List<LegendInfo>> fetchLegendInfosAsync()
      Asynchronously fetches a list of legend information for this layer, if any.
      java.lang.String getDefinitionExpression()
      Gets the where-clause of the SQL expression that defines which annotation features from the feature table are selected into this sublayer.
      double getMaxScale()
      Gets the maximum scale at which to display the sublayer.
      double getMinScale()
      Gets the minimum scale at which to display the sublayer.
      java.lang.String getName()
      Gets the name of this layer.
      float getOpacity()
      Gets the opacity with which to display the annotation text associated with this sublayer.
      ListenableList<LayerContent> getSubLayerContents()
      Returns a list of sub layers, if any.
      long getSublayerId()
      Gets the ID number of this sublayer within its AnnotationLayer.
      boolean isScaleSymbols()
      This is always true, indicating that the annotation text always scales with the MapView.
      boolean isVisible()
      Checks if this layer is visible or not.
      boolean isVisibleAtScale​(double scale)
      Checks if this layer has effective visibility at the given scale.
      void setCanShowInLegend​(boolean canShowInLegend)
      Setting this property is not supported on AnnotationSublayer.
      void setVisible​(boolean visible)
      Sets the layer's visibility if LayerContent.canChangeVisibility() returns true.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getDefinitionExpression

        public java.lang.String getDefinitionExpression()
        Gets the where-clause of the SQL expression that defines which annotation features from the feature table are selected into this sublayer.

        The definition expression string uses the SQL-92 where clause syntax (https://en.wikipedia.org/wiki/SQL-92). Be sure to escape special characters in the expression string as required for your platform. The DATE keyword expects the date format yyyy-mm-dd and the TIMESTAMP keyword expects the time stamp format yyyy-mm-dd hh:mm:ss. See the ArcGIS Blog article entitled "Querying Feature Services Date-Time Queries" ( https://www.esri.com/arcgis-blog/products/api-rest/data-management/querying-feature-services-date-time-queries/) for more information.

        Returns:
        the definition expression
        Since:
        100.6.0
      • getMaxScale

        public double getMaxScale()
        Gets the maximum scale at which to display the sublayer.
        Returns:
        the maximum scale at which to display the sublayer
        Since:
        100.6.0
      • getMinScale

        public double getMinScale()
        Gets the minimum scale at which to display the sublayer. Zero indicates that the annotation will be visible no matter how far the user zooms out.
        Returns:
        the minimum scale at which to display the sublayer
        Since:
        100.6.0
      • getOpacity

        public float getOpacity()
        Gets the opacity with which to display the annotation text associated with this sublayer.

        Opacity is a value between 0.0 and 1.0, with 0.0 indicating that the annotation will be completely transparent, and 1.0 indicating that the annotation will be completely opaque.

        Returns:
        the opacity with which to display the annotation text
        Since:
        100.6.0
      • getSublayerId

        public long getSublayerId()
        Gets the ID number of this sublayer within its AnnotationLayer.
        Returns:
        the sublayer ID, a non-negative integer
        Since:
        100.6.0
        See Also:
        AnnotationLayer
      • isScaleSymbols

        public boolean isScaleSymbols()
        This is always true, indicating that the annotation text always scales with the MapView.
        Returns:
        always true
        Since:
        100.6.0
        See Also:
        MapView
      • canChangeVisibility

        public boolean canChangeVisibility()
        Description copied from interface: LayerContent
        Checks whether we can change the visibility of this layer.
        Specified by:
        canChangeVisibility in interface LayerContent
        Returns:
        true if we can change this layer's visibility; false otherwise
      • isVisibleAtScale

        public boolean isVisibleAtScale​(double scale)
        Description copied from interface: LayerContent
        Checks if this layer has effective visibility at the given scale. This effective visibility takes care of the effective visibility of the parents at the specified scale.
        Specified by:
        isVisibleAtScale in interface LayerContent
        Parameters:
        scale - the scale the visibility has to be calculated for
        Returns:
        true if the layer will be visible at the given scale; false otherwise
      • getName

        public java.lang.String getName()
        Description copied from interface: LayerContent
        Gets the name of this layer.
        Specified by:
        getName in interface LayerContent
        Returns:
        name of this layer
      • canShowInLegend

        public boolean canShowInLegend()
        Description copied from interface: LayerContent
        Checks if this layer will be listed in the legend.
        Specified by:
        canShowInLegend in interface LayerContent
        Returns:
        true if this layer will be visible in the legend; false otherwise
      • setCanShowInLegend

        public void setCanShowInLegend​(boolean canShowInLegend)
        Setting this property is not supported on AnnotationSublayer.
        Specified by:
        setCanShowInLegend in interface LayerContent
        Parameters:
        canShowInLegend - true to show in the legend, false to omit it from the legend
        Throws:
        java.lang.UnsupportedOperationException - always throws this exception
        Since:
        100.6.0
      • getSubLayerContents

        public ListenableList<LayerContent> getSubLayerContents()
        Description copied from interface: LayerContent
        Returns a list of sub layers, if any. If there are no sub-layers, an empty list will be returned. This list cannot be used to add or remove sub-layers.
        Specified by:
        getSubLayerContents in interface LayerContent
        Returns:
        a read only list of sub-layers, if any
      • fetchLegendInfosAsync

        public ListenableFuture<java.util.List<LegendInfo>> fetchLegendInfosAsync()
        Description copied from interface: LayerContent
        Asynchronously fetches a list of legend information for this layer, if any.
        Specified by:
        fetchLegendInfosAsync in interface LayerContent
        Returns:
        a listenable future that can be used to get the legend information. Null is returned if an error occurs.