import BuildingFilter from "@arcgis/core/layers/support/BuildingFilter.js";const BuildingFilter = await $arcgis.import("@arcgis/core/layers/support/BuildingFilter.js");- Inheritance
- BuildingFilter→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.12
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.
- Example
- // define a floor filterconst buildingFilter = new BuildingFilter({filterBlocks: [{// an SQL expression that filters using the BldgLevel fieldfilterExpression: "BldgLevel = 3",filterMode: {type: "wire-frame",edges: {type: "solid",color: [0, 0, 0, 0.8]}}}]});// set the filter in the filters array on the layerbuildingLayer.filters = [buildingFilter];// specify which filter is the one that should be appliedbuildingLayer.activeFilterId = buildingFilter.id;
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| readonly inherited | ||
| | ||
| | ||
| readonly | | |
| |
filterBlocks
- Type
- Collection<BuildingFilterBlock> | null | undefined
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 a solid filter block in the collection, elements that match either filter block will be drawn as wireframe.
id
- Type
- string
Unique filter id. Assign this id to BuildingSceneLayer.activeFilterId to activate the filter.
Methods
| Method | Signature | Class |
|---|---|---|
| inherited static | fromJSON(json: any): any | |
| inherited | toJSON(): any |
fromJSON
- Signature
-
fromJSON (json: any): any
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.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | A 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
- any
Returns a new instance of this class.
toJSON
- Signature
-
toJSON (): any
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
- Returns
- any
The ArcGIS portal JSON representation of an instance of this class.