public final class

FeatureLayer

extends Layer
implements TimeAware PopupSource
java.lang.Object
   ↳ com.esri.arcgisruntime.layers.Layer
     ↳ com.esri.arcgisruntime.layers.FeatureLayer

Class Overview

Represents a Layer composed of features; features in a FeatureLayer comprise a geometry and a consistent set of fields. Features in a FeatureLayer can be displayed on a map, queried, edited, and selected (visually highlighted).

Each FeatureLayer corresponds to one FeatureTable, which is passed in to the FeatureLayer constructor.

Summary

Nested Classes
enum FeatureLayer.RenderingMode The different modes of rendering features. 
enum FeatureLayer.SelectionMode Represents the modes used for selecting features. 
Public Constructors
FeatureLayer(FeatureTable featureTable)
Constructs the FeatureLayer with the given FeatureTable.
FeatureLayer(PortalItem portalItem, long layerId)
Creates a new FeatureLayer based on a layer within a feature service PortalItem.
Public Methods
void addFullTimeExtentChangedListener(FullTimeExtentChangedListener listener)
Adds a listener that will fire when there is a change to the full time extent.
void clearSelection()
Clears the selection.
FeatureLayer copy()
Creates a deep copy of this FeatureLayer instance.
String getDefinitionExpression()
Gets the definition expression applied to layer by the developer.
FeatureTable getFeatureTable()
Get the associated FeatureTable for FeatureLayer.
TimeExtent getFullTimeExtent()
Returns the full time extent of the object.
List<LabelDefinition> getLabelDefinitions()
Gets a modifiable list of label definitions of the feature layer.
PopupDefinition getPopupDefinition()
Gets the PopupDefinition defined in the FeatureLayer definition or set via setPopupDefinition(PopupDefinition), or null if one is not defined and one has not been set.
long getRefreshInterval()
Gets the refresh interval in milliseconds.
Renderer getRenderer()
Gets the layer's current renderer.
FeatureLayer.RenderingMode getRenderingMode()
Gets the rendering mode.
LayerSceneProperties getSceneProperties()
Gets a layer scene properties object that can be used to make changes to how features are displayed in a SceneView.
ListenableFuture<FeatureQueryResult> getSelectedFeaturesAsync()
Gets all the features selected.
int getSelectionColor()
This method is deprecated. as of 100.4.0, use getColor() from your GeoView
double getSelectionWidth()
This method is deprecated. as of 100.4.0, will be removed in a future version
TimeValue getTimeInterval()
Returns the suggested time slider step size for this time aware object.
TimeValue getTimeOffset()
Returns the time offset applied to this object.
boolean isLabelsEnabled()
Gets whether labels are enabled.
boolean isPopupEnabled()
Gets a flag indicating whether the PopupDefinition returned from getPopupDefinition() is enabled or disabled.
boolean isTimeFilteringEnabled()
Returns whether or not the object must use the time extent defined on the owning GeoView to filter its data.
boolean isTimeFilteringSupported()
Returns whether or not the object supports filtering its contents by time values with the extent set on the owning GeoView.
boolean removeFullTimeExtentChangedListener(FullTimeExtentChangedListener listener)
Removes a full time extent changed listener.
void resetFeaturesVisible()
Resets all features back to the visible state.
void resetRenderer()
Resets the renderer to the layer's default renderer.
void selectFeature(Feature feature)
Adds the feature to the current selection.
void selectFeatures(Iterable<Feature> features)
Adds features to the current selection.
ListenableFuture<FeatureQueryResult> selectFeaturesAsync(QueryParameters query, FeatureLayer.SelectionMode selectionMode)
Selects features, asynchronously, based on query and selection mode.
void setDefinitionExpression(String expression)
Sets a definition expression which is a SQL statement where clause to filter out the features to be displayed.
void setFeatureVisible(Feature feature, boolean visible)
Makes a feature visible or invisible.
void setFeaturesVisible(Iterable<Feature> features, boolean visible)
Makes multiple features visible or invisible.
void setIsTimeFilteringEnabled(boolean enabled)
Enables or disables whether the object must use the time extent defined on the owning GeoView to filter its data.
void setLabelsEnabled(boolean enabled)
Enables or disables the labeling for the layer.
void setPopupDefinition(PopupDefinition popupDefinition)
Sets the PopupDefinition for the FeatureLayer, overriding the previous one (for example, the one defined in the FeatureLayer definition).
void setPopupEnabled(boolean enabled)
Sets a flag indicating whether the PopupDefinition returned from getPopupDefinition() is enabled or disabled.
void setRefreshInterval(long refreshIntervalMilliseconds)
Sets the refresh interval in milliseconds.
void setRenderer(Renderer renderer)
Sets the layer's renderer
void setRenderingMode(FeatureLayer.RenderingMode renderingMode)
Sets the rendering mode.
void setSelectionColor(int selectionColor)
This method is deprecated. as of 100.4.0, use setColor(int) from your GeoView
void setSelectionWidth(double width)
This method is deprecated. as of 100.4.0, will be removed in a future version
void setTimeOffset(TimeValue timeOffset)
Sets a time offset for this object.
void unselectFeature(Feature feature)
Removes a feature from selection.
void unselectFeatures(Iterable<Feature> features)
Removes multiple features from selection.
[Expand]
Inherited Methods
From class com.esri.arcgisruntime.layers.Layer
From class java.lang.Object
From interface com.esri.arcgisruntime.arcgisservices.TimeAware
From interface com.esri.arcgisruntime.layers.LayerContent
From interface com.esri.arcgisruntime.loadable.Loadable
From interface com.esri.arcgisruntime.mapping.popup.PopupSource

Public Constructors

public FeatureLayer (FeatureTable featureTable)

Constructs the FeatureLayer with the given FeatureTable.

Parameters
featureTable feature table for this feature layer
Throws
IllegalArgumentException if featureTable is null

public FeatureLayer (PortalItem portalItem, long layerId)

Creates a new FeatureLayer based on a layer within a feature service PortalItem.

If the portal item argument is not in LoadStatus#LOADED state it will be loaded automatically when this FeatureLayer instance is loaded.

Parameters
portalItem a feature service PortalItem
layerId the ID of a layer within the feature service
Throws
IllegalArgumentException if portalItem is null

Public Methods

public void addFullTimeExtentChangedListener (FullTimeExtentChangedListener listener)

Adds a listener that will fire when there is a change to the full time extent.

Parameters
listener the listener to add

public void clearSelection ()

Clears the selection.

public FeatureLayer copy ()

Creates a deep copy of this FeatureLayer instance.

Returns
  • a deep copy of this FeatureLayer instance, which means that copies of all fields of this layer are made including its loading state

public String getDefinitionExpression ()

Gets the definition expression applied to layer by the developer.

Returns
  • the definition expression

public FeatureTable getFeatureTable ()

Get the associated FeatureTable for FeatureLayer.

Returns
  • the feature table

public TimeExtent getFullTimeExtent ()

Returns the full time extent of the object. Will be null if the object is not time aware.

Returns
  • the time extent, or null if the object is not time aware

public List<LabelDefinition> getLabelDefinitions ()

Gets a modifiable list of label definitions of the feature layer.

Returns
  • a modifiable list of label definitions

public PopupDefinition getPopupDefinition ()

Gets the PopupDefinition defined in the FeatureLayer definition or set via setPopupDefinition(PopupDefinition), or null if one is not defined and one has not been set.

Returns
  • the FeatureLayer's PopupDefinition

public long getRefreshInterval ()

Gets the refresh interval in milliseconds. The refresh interval is the time between automatic layer requests. A value of zero means the layer is never refreshed. The default value is zero.

Returns
  • the refresh interval in milliseconds

public Renderer getRenderer ()

Gets the layer's current renderer.

Returns
  • the renderer

public FeatureLayer.RenderingMode getRenderingMode ()

Gets the rendering mode. The default value is AUTOMATIC.

Returns
  • the rendering mode

public LayerSceneProperties getSceneProperties ()

Gets a layer scene properties object that can be used to make changes to how features are displayed in a SceneView.

These settings will have no effect if the layer is displayed in a MapView.

Returns
  • a layer scene properties object

public ListenableFuture<FeatureQueryResult> getSelectedFeaturesAsync ()

Gets all the features selected.

Returns
  • a future that represents the selected features

public int getSelectionColor ()

This method is deprecated.
as of 100.4.0, use getColor() from your GeoView

Returns the color applied to a selected feature.

Returns
  • an integer representing the selection color as 0xAARRGGBB

public double getSelectionWidth ()

This method is deprecated.
as of 100.4.0, will be removed in a future version

Gets the width of the selection highlight.

Returns
  • the width of the selection highlight

public TimeValue getTimeInterval ()

Returns the suggested time slider step size for this time aware object. Can be null if no time interval is suggested for this time aware object.

Returns
  • the time interval, or null if there is no time interval

public TimeValue getTimeOffset ()

Returns the time offset applied to this object. The offset is subtracted from the time extent set on the owning GeoView. This allows for data from different periods of time to be compared.

Returns
  • the time offset, or null if no offset has been set

public boolean isLabelsEnabled ()

Gets whether labels are enabled.

Returns
  • true if labels are enabled, false if not

public boolean isPopupEnabled ()

Gets a flag indicating whether the PopupDefinition returned from getPopupDefinition() is enabled or disabled.

Returns
  • a flag indicating whether the PopupDefinition is enabled or disabled

public boolean isTimeFilteringEnabled ()

Returns whether or not the object must use the time extent defined on the owning GeoView to filter its data.

Returns
  • true if time filtering is enabled; otherwise false

public boolean isTimeFilteringSupported ()

Returns whether or not the object supports filtering its contents by time values with the extent set on the owning GeoView.

Returns
  • true if time filtering is supported; otherwise false

public boolean removeFullTimeExtentChangedListener (FullTimeExtentChangedListener listener)

Removes a full time extent changed listener.

Parameters
listener the listener to remove
Returns
  • true if the listener was removed, otherwise false

public void resetFeaturesVisible ()

Resets all features back to the visible state.

public void resetRenderer ()

Resets the renderer to the layer's default renderer.

public void selectFeature (Feature feature)

Adds the feature to the current selection.

Parameters
feature the feature to be added to selection
Throws
IllegalArgumentException if feature is null

public void selectFeatures (Iterable<Feature> features)

Adds features to the current selection.

Parameters
features the features to be added to selection
Throws
IllegalArgumentException if features is null

public ListenableFuture<FeatureQueryResult> selectFeaturesAsync (QueryParameters query, FeatureLayer.SelectionMode selectionMode)

Selects features, asynchronously, based on query and selection mode.

Parameters
query the query to be applied to select features
selectionMode the selection mode to be used
Returns
  • the result as a Future
Throws
IllegalArgumentException if query or selectionMode is null

public void setDefinitionExpression (String expression)

Sets a definition expression which is a SQL statement where clause to filter out the features to be displayed. The definition expression is used to query the feature table related to the feature layer and only features meeting the query criteria will be displayed on the layer.

Parameters
expression the definition expression, it can be null

public void setFeatureVisible (Feature feature, boolean visible)

Makes a feature visible or invisible.

Parameters
feature feature to change visibility of
visible true to show, false to hide
Throws
IllegalArgumentException if feature is null

public void setFeaturesVisible (Iterable<Feature> features, boolean visible)

Makes multiple features visible or invisible.

Parameters
features features to change visibility of
visible true to show, false to hide
Throws
IllegalArgumentException if features is null

public void setIsTimeFilteringEnabled (boolean enabled)

Enables or disables whether the object must use the time extent defined on the owning GeoView to filter its data.

Parameters
enabled true to enable time filtering; otherwise false

public void setLabelsEnabled (boolean enabled)

Enables or disables the labeling for the layer.

Parameters
enabled true to enable, false to disable labels

public void setPopupDefinition (PopupDefinition popupDefinition)

Sets the PopupDefinition for the FeatureLayer, overriding the previous one (for example, the one defined in the FeatureLayer definition).

Parameters
popupDefinition the PopupDefinition to set

public void setPopupEnabled (boolean enabled)

Sets a flag indicating whether the PopupDefinition returned from getPopupDefinition() is enabled or disabled.

Parameters
enabled true to enable the PopupDefinition, otherwise false

public void setRefreshInterval (long refreshIntervalMilliseconds)

Sets the refresh interval in milliseconds. The refresh interval is the time between automatic layer requests. A value of zero means the layer is never refreshed. The default value is zero.

Parameters
refreshIntervalMilliseconds the refresh interval in milliseconds
Throws
IllegalArgumentException if milliseconds is less than zero

public void setRenderer (Renderer renderer)

Sets the layer's renderer

Parameters
renderer the renderer to be used for this layer
Throws
IllegalArgumentException if renderer is null

public void setRenderingMode (FeatureLayer.RenderingMode renderingMode)

Sets the rendering mode.

Parameters
renderingMode the rendering mode
Throws
IllegalArgumentException if renderingMode is null

public void setSelectionColor (int selectionColor)

This method is deprecated.
as of 100.4.0, use setColor(int) from your GeoView

Sets the color that is applied to a selected feature.

Parameters
selectionColor an integer representing the selection color as 0xAARRGGBB

public void setSelectionWidth (double width)

This method is deprecated.
as of 100.4.0, will be removed in a future version

Sets the width of the selection highlight.

Parameters
width the width of the selection highlight
Throws
IllegalArgumentException if width is less than 0

public void setTimeOffset (TimeValue timeOffset)

Sets a time offset for this object. The time offset is subtracted from the time extent set on the owning GeoView. This allows for data from different periods of time to be compared. Can be null if there is no time offset.

Parameters
timeOffset the time offset, or null if there is no time offset

public void unselectFeature (Feature feature)

Removes a feature from selection.

Parameters
feature feature to be unselected
Throws
IllegalArgumentException if feature is null

public void unselectFeatures (Iterable<Feature> features)

Removes multiple features from selection.

Parameters
features features to be unselected
Throws
IllegalArgumentException if features is null