Class DimensionLayer

java.lang.Object
com.esri.arcgisruntime.layers.Layer
com.esri.arcgisruntime.layers.DimensionLayer
All Implemented Interfaces:
RemoteResource, LayerContent, Loadable

public final class DimensionLayer extends Layer implements RemoteResource
A layer that can visualize dimension features data.

Dimension features are a special kind of annotation feature for showing specific lengths or distances on a map. A dimension may indicate the length of a side of a building or land parcel, or the distance between two features, such as a fire hydrant and the corner of a building. They are described in detail in "Dimension".

Each Dimension feature has specific text and specific locations for its schematic lines and arrows.

Dimension features are not linked to other point, line or polygon features, even if the dimension measurement was created to refer to one or more features.

You can construct a dimension layer using a feature table containing dimension features:

Dimension layers can be taken offline from a feature service hosted on ArcGIS Enterprise 10.9 or later, using the GeodatabaseSyncTask. Dimension layers are also supported in mobile map packages or mobile geodatabases created in ArcGIS Pro 2.9 or later.

Dimension respects the reference scale defined by the map, so dimension will always be presented to the user at the correct size and position, as defined by the dimension author.

You cannot add, change, or delete a dimension feature. Any attempt produces a "Geodatabase table not editable" (3016) error.

The getFeatureTable() associated with this DimensionLayer contains a set of attributes (fields, in other words) that define "dimensions". These attributes, automatically added by ArcGIS Pro, are described in "Dimension fields". The author of the dimension layer may have also added additional fields. You can query and use any of these attributes in a definition expression but you cannot change their value.

You do not have access to, and cannot change, the renderer or the styles used for rendering dimensions.

Since:
100.13.0
  • Constructor Details

    • DimensionLayer

      public DimensionLayer(ArcGISFeatureTable featureTable)
      Creates a dimension layer from a feature table containing dimension features.

      If the feature table does not contain dimension data then the DimensionLayer will fail to load. ArcGISFeatureTable.getLayerInfo() and ArcGISFeatureLayerInfo.getServiceType() can be checked, to verify the feature type, before attempting to create a Layer.

      Parameters:
      featureTable - the feature table, containing dimension features, used as the source of the dimension layer
      Throws:
      IllegalArgumentException - if featureTable is null
      Since:
      100.13.0
    • DimensionLayer

      public DimensionLayer(PortalItem item, long layerId)
      Creates a new dimension layer object from a feature service portal item.
      Parameters:
      item - a feature service PortalItem
      layerId - the layer ID for which to create the layer
      Throws:
      IllegalArgumentException - if item is null
      Since:
      100.13.0
      See Also:
    • DimensionLayer

      public DimensionLayer(String uri)
      Creates a new dimension layer from a feature service URI.

      If the specified URI is not a valid Feature Service endpoint, then it will fail to load.

      Parameters:
      uri - the URI to the feature service layer
      Throws:
      IllegalArgumentException - if uri is null or empty
      Since:
      100.13.0
  • Method Details

    • getUri

      public String getUri()
      Gets the URI of a feature service to define the layer.
      Specified by:
      getUri in interface RemoteResource
      Returns:
      the URI of a feature service to define the layer, or null if none
      Since:
      100.13.0
    • getBarrierWeight

      public LabelBarrierWeight getBarrierWeight()
      Gets the weight of dimension features when considered as barriers to labeling.

      The default is LabelBarrierWeight.HIGH.

      Returns:
      the weight of dimension features when considered as barriers to labeling
      Since:
      100.14.0
    • setBarrierWeight

      public void setBarrierWeight(LabelBarrierWeight barrierWeight)
      Sets the weight of dimension features when considered as barriers to labeling.

      The default is LabelBarrierWeight.HIGH.

      Parameters:
      barrierWeight - the weight of dimension features when considered as barriers to labeling
      Throws:
      IllegalArgumentException - if barrierWeight is null
      Since:
      100.14.0
    • getDefinitionExpression

      public String getDefinitionExpression()
      Gets a SQL statement where clause that stipulates a subset of features to be displayed.

      The definition expression string uses the SQL-92 where clause syntax The default value is an empty string, which will allow all dimension features in the data source to be used by the DimensionLayer.

      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. For more information, see the ArcGIS Blog article Querying Feature Services Date-Time Queries.

      Returns:
      an expression which is a SQL statement where clause to specify the subset of features to be displayed
      Since:
      100.13.0
    • setDefinitionExpression

      public void setDefinitionExpression(String definitionExpression)
      Sets a SQL statement where clause that stipulates a subset of features to be displayed.

      The definition expression string uses the SQL-92 where clause syntax The default value is an empty string, which will allow all dimension features in the data source to be used by the DimensionLayer.

      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" for more information.

      Parameters:
      definitionExpression - an expression which is a SQL statement where clause to specify the subset of features to be displayed
      Throws:
      IllegalArgumentException - if definitionExpression is null
      Since:
      100.13.0
    • getFeatureTable

      public ArcGISFeatureTable getFeatureTable()
      Gets the feature table associated with this layer.
      Returns:
      the feature table associated with this layer, or null if none
      Since:
      100.13.0
    • getLayerId

      public long getLayerId()
      Gets the layer ID that defines the layer within the feature service portal item.
      Returns:
      the layer ID that defines the layer within the feature service portal item
      Since:
      100.13.0
      See Also:
    • 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 layer for the schematic lines and text to appear at its authored size.

      If the client changes the viewing scale, then schematic lines and text will grow or shrink to keep a consistent size on the map (not the screen).

      For a valid layer, the reference scale will always be a finite value, greater than zero. Until the layer is loaded, the reference scale will be zero.

      Returns:
      the reference scale for the layer
      Since:
      100.13.0
    • clearSelection

      public void clearSelection()
      Updates any selected features in the layer back to the un-selected state.
      Since:
      100.13.0
    • getSelectedFeaturesAsync

      public ListenableFuture<FeatureQueryResult> getSelectedFeaturesAsync()
      Returns a list of the currently selected features.
      Returns:
      a ListenableFuture that returns a FeatureQueryResult
      Since:
      100.13.0
    • resetFeaturesVisible

      public void resetFeaturesVisible()
      Resets the visibility of the layer's features back to the original visibility when loaded from the data source.
      Since:
      100.13.0
    • selectFeature

      public void selectFeature(Feature feature)
      Selects the given feature and adds it to the current list of selected features.
      Parameters:
      feature - the feature
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.13.0
    • selectFeatures

      public void selectFeatures(Iterable<Feature> features)
      Selects the features in the list and adds them to the current list of selected features.
      Parameters:
      features - a Iterable of Feature. Contents of the Iterable are copied.
      Throws:
      IllegalArgumentException - if features is null
      Since:
      100.13.0
    • selectFeaturesAsync

      public ListenableFuture<FeatureQueryResult> selectFeaturesAsync(QueryParameters parameters, FeatureLayer.SelectionMode mode)
      Selects the features that match the criteria in the QueryParameters object and adds them to the current list of selected features.
      Parameters:
      parameters - the definition of the query to submit to the feature table
      mode - defines how the list of currently selected features will be updated with the features returned from the query.
      Returns:
      a ListenableFuture that returns a FeatureQueryResult
      Throws:
      IllegalArgumentException - if parameters is null
      IllegalArgumentException - if mode is null
      Since:
      100.13.0
    • setFeatureVisible

      public void setFeatureVisible(Feature feature, boolean visible)
      Sets the visibility of the given feature.
      Parameters:
      feature - the feature
      visible - true to show, false to hide
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.13.0
    • setFeaturesVisible

      public void setFeaturesVisible(Iterable<Feature> features, boolean visible)
      Sets the visibility of the given features.
      Parameters:
      features - a Iterable of Feature. Contents of the Iterable are copied.
      visible - true to show, false to hide
      Throws:
      IllegalArgumentException - if features is null
      Since:
      100.13.0
    • unselectFeature

      public void unselectFeature(Feature feature)
      Unselects the given feature and removes it from the current list of selected features.
      Parameters:
      feature - the feature
      Throws:
      IllegalArgumentException - if feature is null
      Since:
      100.13.0
    • unselectFeatures

      public void unselectFeatures(Iterable<Feature> features)
      Unselects the features in the given list and removes them from the current list of selected features.
      Parameters:
      features - a Iterable of Feature. Contents of the Iterable are copied.
      Throws:
      IllegalArgumentException - if features is null
      Since:
      100.13.0
    • copy

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

      public Credential getCredential()
      Description copied from interface: RemoteResource
      Gets the Credential that is set on the network-enabled resource.

      Only applicable if the resource is secured.

      Specified by:
      getCredential in interface RemoteResource
      Returns:
      the Credential, or null if there is none
    • setCredential

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

      Only applicable if the resource is secured.

      Specified by:
      setCredential in interface RemoteResource
      Parameters:
      credential - the Credential to be used for authentication
    • setRequestConfiguration

      public void setRequestConfiguration(RequestConfiguration requestConfiguration)
      Description copied from interface: RemoteResource
      Sets the RequestConfiguration used to modify the parameters of network requests made by this RemoteResource. If not set, the global RequestConfiguration will be used (see RequestConfiguration.getGlobalRequestConfiguration()).
      Specified by:
      setRequestConfiguration in interface RemoteResource
      Parameters:
      requestConfiguration - the RequestConfiguration used to modify network requests
    • 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