require(["esri/layers/support/BuildingFilter"], (BuildingFilter) => { /* code goes here */ });
import BuildingFilter from "@arcgis/core/layers/support/BuildingFilter.js";
esri/layers/support/BuildingFilter
The BuildingFilter
class defines a set of conditions that can be used to show or hide specific features of
a BuildingSceneLayer in the SceneView.
For example, if you want to see parts of a building that are on the second floor, you can set a filter to only show the second floor.
The filter can be activated on a layer by adding it to the BuildingSceneLayer.filters collection
and assigning id to BuildingSceneLayer.activeFilterId.
Once the filter is activated, only the features that satisfy the conditions defined by filterBlocks
are displayed in the SceneView.
// define a floor filter
const buildingFilter = new BuildingFilter({
filterBlocks: [{
// an SQL expression that filters using the BldgLevel field
filterExpression: "BldgLevel = 3",
filterMode: {
type: "wire-frame",
edges: {
type: "solid",
color: [0, 0, 0, 0.8]
}
}
}]
});
// set the filter in the filters array on the layer
buildingLayer.filters = [buildingFilter];
// specify which filter is the one that should be applied
buildingLayer.activeFilterId = buildingFilter.id;
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The name of the class. | Accessor | ||
Description of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro. | BuildingFilter | ||
Filter blocks define which features should be visible in the affected BuildingSceneLayer and how the filtered features are drawn. | BuildingFilter | ||
Unique filter id. | BuildingFilter | ||
Name of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro. | BuildingFilter |
Property Details
-
description
description String
-
Description of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro.
-
filterBlocks
filterBlocks Collection<BuildingFilterBlock>
-
Filter blocks define which features should be visible in the affected BuildingSceneLayer and how the filtered features are drawn. A filter should contain at least one filter block.
The order of filter blocks influences the order in which the filter blocks are applied. For example, if a filter block using a
wire-frame
mode precedes asolid
filter block in the collection, elements that match either filter block will be drawn as wireframe.
-
id
id Stringreadonly
-
Unique filter id. Assign this id to BuildingSceneLayer.activeFilterId to activate the filter.
-
name
name String
-
Name of the filter for display in UIs, for example when the filter is edited in ArcGIS Pro.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
* | Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. | BuildingFilter | |
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor | ||
Converts an instance of this class to its ArcGIS portal JSON representation. | BuildingFilter |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 4.25. -
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. 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.Parameterjson 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.
ReturnsType Description * Returns a new instance of this class.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
toJSON
toJSON(){Object}
-
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
ReturnsType Description Object The ArcGIS portal JSON representation of an instance of this class.
Type Definitions
-
BuildingFilterBlock
BuildingFilterBlock Object
-
Object contained in the filterBlocks collection:
- Properties
-
The SQL where clause used to match features to this filter block. Only the features that satisfy the filter expression are displayed in the SceneView. This property is evaluated on the client using the cached attributes and it only supports standardized SQL.
filterMode ObjectThis object contains information about the filter mode of the filter block.
- Specification
-
type StringDefault Value:solid
Defines how features are drawn while the filter is active.
solid
mode renders the features with the original texture. Withwire-frame
mode, only the edges of the features are shown.x-ray
renders elements semi-transparent with white color. To ensure performance on client applications, it is not recommended to declare multiple filter blocks with the same filter mode.Possible Values:"solid"|"wire-frame"|"x-ray"
edges SolidEdges3D|SketchEdges3D|nullDefines the type of edges used to display a BuildingSceneLayer filtered in
wire-frame
mode. This property can only be used withfilterMode
of typewire-frame
.
title StringTitle of the filter for display in UIs, for example when the filter block is edited in ArcGIS Pro.