FeatureEffect
require(["esri/views/layers/support/FeatureEffect"], function(FeatureEffect) { /* code goes here */ });
esri/views/layers/support/FeatureEffect
FeatureEffect allows you to emphasize or deemphasize features that satisfy a filter in 2D MapView. The includedEffect and excludedEffect properties allow you to apply CSS filters to features that are either included or excluded from the filter. Typically, you use includedEffect
to emphasize features that are included in the filter and excludedEffect
to deemphasize features excluded from the filter.
Known Limitations
- The feature effect cannot be applied to a layer view with a heatmap renderer.
- FeatureEffect is not supported in layers with featureReduction of type
cluster
enabled. - FeatureEffect is not supported in 3D SceneViews.
// apply feature effect to features that do not
// meet the filter requirements
featureFilter = {
// autocasts to FeatureFilter
geometry: filterGeometry,
spatialRelationship: geometryRel,
distance: distance,
units: unit
};
// set effect on excluded features
// make them gray and transparent
if (featureLayerView) {
featureLayerView.effect = {
filter: featureFilter,
excludedEffect: "grayscale(100%) opacity(30%)"
}
}
- See also:
Constructors
- new FeatureEffect(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Example:// Typical usage const effect = new FeatureEffect({ filter:{ where: "magnitude >= 3" } excludedEffect: "grayscale(100%) opacity(30%)" }); layerView.effect = effect;
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String | The name of the class. more details | more details | Accessor | |
String | The graphical css filter operation applied to the features that do not meet the filter requirements. more details | more details | FeatureEffect | |
Boolean | Indicates if labels for features that are excluded from the effect are visible. more details | more details | FeatureEffect | |
FeatureFilter | The filter that drives the effect. more details | more details | FeatureEffect | |
String | The graphical css filter operation applied to the features that meet the filter requirements. more details | more details | FeatureEffect |
Property Details
The name of the class. The declared class name is formatted as
esri.folder.className
.
- excludedEffect String
The graphical css filter operation applied to the features that do not meet the filter requirements. Currently, grayscale, sepia, hue-rotate, invert, opacity, brightness and contrast css filter functions are supported.
Example:const excludedEffect = "grayscale(50%) opacity(30%)"; layerView.effect = { filter: { where: "1=1", geometry: mapPoint, spatialRelationship: "disjoint", distance: searchDistance, units: searchUnit }, excludedEffect: excludedEffect };
- excludedLabelsVisible Boolean
Indicates if labels for features that are excluded from the effect are visible.
- Default Value:false
- filter FeatureFilter
The filter that drives the effect. Features that meet the requirements specified in the filter will have the includedEffect applied while features that do not meet meet the filter requirements will have the excludedEffect applied.
- includedEffect String
The graphical css filter operation applied to the features that meet the filter requirements. Currently, grayscale, sepia, hue-rotate, invert, opacity, brightness and contrast css filter functions are supported.
Example:const includedEffect = "sepia(70%) saturate(1500%) hue-rotate(320deg) opacity(60%)"; layerView.effect = { filter: { where: "1=1", geometry: mapPoint, spatialRelationship: "disjoint", distance: searchDistance, units: searchUnit }, includedEffect: includedEffect, };
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
FeatureEffect | Creates a deep clone of FeatureEffect object. more details | more details | FeatureEffect | |
* | Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. more details | more details | FeatureEffect | |
Object | Converts an instance of this class to its ArcGIS portal JSON representation. more details | more details | FeatureEffect |
Method Details
- clone(){FeatureEffect}
Creates a deep clone of FeatureEffect object.
Returns:Type Description FeatureEffect A new instance of a FeatureEffect
- fromJSON(json){*}static
Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. The object passed into the input
json
parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.Parameter:json ObjectA JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.
Returns:Type Description * Returns a new instance of this class.
- toJSON(){Object}
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() topic in the Guide for more information.
Returns:Type Description Object The ArcGIS portal JSON representation of an instance of this class.