Skip to content
import BuildingComponentSublayer from "@arcgis/core/layers/buildingSublayers/BuildingComponentSublayer.js";
Inheritance:
BuildingComponentSublayerBuildingSublayerAccessor
Since
ArcGIS Maps SDK for JavaScript 4.10

BuildingComponentSublayers contain 3D Object features representing building components like doors, pipes or AC units. They are sublayers in a BuildingSceneLayer either directly or as part of a BuildingGroupSublayer. This sublayer is similar to a 3D Object SceneLayer, it can be visualized with a specific renderer, popups can be customized using popupTemplate and SQL filters can be applied by setting a definitionExpression.

Starting with version 4.17, BuildingComponentSublayers support attribute or spatial queries if the the BuildingSceneLayer has an associated feature layer.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
declaredClass
readonly inherited
fields
readonly
Field[]
globalIdField
readonly
id
readonly inherited
isEmpty
readonly inherited
"hide" | "show"
loadError
readonly inherited
loadStatus
readonly inherited
"not-loaded" | "loading" | "failed" | "loaded"
loadWarnings
readonly inherited
any[]
modelName
readonly inherited
objectIdField
readonly
opacity
inherited
title
inherited
type
readonly
"building-component"
uid
readonly inherited
visible
inherited

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

definitionExpression

Property
Type
string | null | undefined

The SQL where clause used to filter features on the client. Only the features that satisfy the definition expression are displayed in the View. Setting a definition expression is useful when only a subset of the data in the layer should be displayed.

Setting the definition expression of a layer automatically updates all layer views.

If the definition expression is set after the layer has been added to the map, the view will automatically refresh itself to display the features that satisfy the new definition expression.

Note that the initial loading time of the features remains unchanged, even if they are filtered. This happens because, as opposed to Feature Layers, feature filtering is done client-side. This means that all features need to be downloaded for filter evaluation.

This property is evaluated on the client using the cached attributes and it only supports standardized SQL.

fields

readonly Property
Type
Field[]
Since
ArcGIS Maps SDK for JavaScript 4.33

An array of fields in the layer. Each field represents an attribute that may contain a value for each feature in the layer.

globalIdField

readonly Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 4.33

The name of a global-id field containing a globally unique identifier for each feature in the layer.

id

readonlyinherited Property
Type
number
Inherited from: BuildingSublayer

The sublayer's layer id as defined by the Scene Service.

Default value
-1

isEmpty

readonlyinherited Property
Type
boolean | null | undefined
Inherited from: BuildingSublayer

Indicates if this sublayer is empty. This property is only read from the service. Empty sublayers are not loaded for rendering and applications can choose to hide them in their UI.

listMode

Property
Type
"hide" | "show"
Since
ArcGIS Maps SDK for JavaScript 4.11

Indicates how the layer should display in the LayerList widget. The possible values are listed below.

ValueDescription
showThe layer is visible in the table of contents.
hideThe layer is hidden in the table of contents.
Default value
"show"

loadError

readonlyinherited Property
Type
EsriError | null | undefined
Inherited from: LoadableMixin

The Error object returned if an error occurred while loading.

loadStatus

readonlyinherited Property
Type
"not-loaded" | "loading" | "failed" | "loaded"
Inherited from: LoadableMixin

Represents the status of a load() operation.

ValueDescription
not-loadedThe object's resources have not loaded.
loadingThe object's resources are currently loading.
loadedThe object's resources have loaded without errors.
failedThe object's resources failed to load. See loadError for more details.
Default value
"not-loaded"

loadWarnings

readonlyinherited Property
Type
any[]
Inherited from: LoadableMixin

A list of warnings which occurred while loading.

modelName

readonlyinherited Property
Type
string | null | undefined
Inherited from: BuildingSublayer

The modelName is a standard name for each sublayer. For example the sublayer containing the doors in a building has the modelName "Doors". Use this property to retrieve sublayers in a BuildingSceneLayer.

Example
// use modelName to identify a sublayer
const doorslayer = buildingSceneLayer.allSublayers.find(function(sublayer) {
return sublayer.modelName === "Doors";
});

objectIdField

readonly Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 4.33

The name of an oid field containing a unique value or identifier for each feature in the layer.

opacity

inherited Property
Type
number
Inherited from: BuildingSublayer

Opacity of the sublayer.

Default value
1

outFields

Property
Type
string[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.12

An array of field names from the service to include with each feature. To fetch the values from all fields in the layer, use ["*"]. Fields specified in outFields will be requested alongside with required fields for rendering.

To include fields in all sublayers, use the BuildingSceneLayer.outFields property of the parent layer.

popupEnabled

Property
Type
boolean

Indicates whether to display popups when features in the layer are clicked. The layer needs to have a popupTemplate to define what information should be displayed in the popup. Alternatively, a default popup template may be automatically used if Popup.defaultPopupTemplateEnabled is set to true.

See also
Default value
true

popupTemplate

autocast Property
Type
PopupTemplate | null | undefined

The popup template for the sublayer. When set, the popupTemplate allows users to access attributes and display their values in the view's Popup when a feature is selected using text and/or charts. See the PopupTemplate sample for an example of how PopupTemplate interacts with a FeatureLayer. Setting a PopupTemplate on this layer type is done in the same way as a FeatureLayer.

A default popup template is automatically used if no popupTemplate has been defined when Popup.defaultPopupTemplateEnabled is set to true.

See also

renderer

autocast Property
Type
RendererUnion | null | undefined

The renderer assigned to the sublayer. The renderer defines how to visualize each feature in the sublayer. Depending on the renderer type, features may be visualized with the same symbol, or with varying symbols based on the values of provided attribute fields or functions.

Example
// all features in the layer will be visualized with
// a blue color
sublayer.renderer = {
type: "simple", // autocasts as new SimpleRenderer()
symbol: {
type: "mesh-3d", // autocasts as new MeshSymbol3D()
symbolLayers: [{
type: "fill", // autocasts as new FillSymbol3DLayer()
material: { color: "blue" }
}]
}
};

title

inherited Property
Type
string | null | undefined
Inherited from: BuildingSublayer

The title of the sublayer used to identify it in places such as the LayerList and Legend.

Default value
""

type

readonly Property
Type
"building-component"

uid

readonlyinherited Property
Type
string
Inherited from: IdentifiableMixin
Since
ArcGIS Maps SDK for JavaScript 4.33

An automatically generated unique identifier assigned to the instance. The unique id is generated each time the application is loaded.

visible

inherited Property
Type
boolean
Inherited from: BuildingSublayer

Indicates if the sublayer is visible in the view.

Default value
true

Methods

MethodSignatureClass
cancelLoad
inherited
cancelLoad(): this
createPopupTemplate(options?: CreatePopupTemplateOptions): PopupTemplate | null | undefined
createQuery(): Query
getField(fieldName: string): Field | null | undefined
getFieldDomain(fieldName: string, options?: FieldDomainOptions): DomainUnion | null | undefined
getFieldUsageInfo(fieldName: string): object
isFulfilled
inherited
isFulfilled(): boolean
isRejected
inherited
isRejected(): boolean
isResolved
inherited
isResolved(): boolean
load
inherited
load(options?: AbortOptions | null | undefined): Promise<this>
queryExtent(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<{ count: number; extent: Extent | null; }>
queryFeatureCount(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number>
queryFeatures(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<FeatureSet>
queryObjectIds(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number[]>
when
inherited
when<TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>

cancelLoad

inherited Method
Signature
cancelLoad (): this
Inherited from: LoadableMixin

Cancels a load() operation if it is already in progress.

Returns
this

createPopupTemplate

Method
Signature
createPopupTemplate (options?: CreatePopupTemplateOptions): PopupTemplate | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.11

Creates a default popup template for the layer, populated with all the fields of the layer.

Parameters
ParameterTypeDescriptionRequired
options

Options for creating the popup template.

Returns
PopupTemplate | null | undefined

The popup template, or null if the layer does not have any fields.

createQuery

Method
Signature
createQuery (): Query
Since
ArcGIS Maps SDK for JavaScript 4.17

Creates a query object that can be used to fetch features that satisfy the component sublayer's current definition expression. The query should only be used on the layer and not on the layer view.

Returns
Query

The query object representing the layer's definition expression.

getField

Method
Signature
getField (fieldName: string): Field | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.12

Returns the Field instance for a field name (case-insensitive).

Parameters
ParameterTypeDescriptionRequired
fieldName

Name of the field.

Returns
Field | null | undefined

the matching field or undefined

getFieldDomain

Method
Signature
getFieldDomain (fieldName: string, options?: FieldDomainOptions): DomainUnion | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.12

Returns the Domain associated with the given field name. The domain can be either a CodedValueDomain or RangeDomain.

Parameters
ParameterTypeDescriptionRequired
fieldName

Name of the field.

options

An object specifying additional options. See the object specification table below for the required properties of this object.

Returns
DomainUnion | null | undefined

The Domain object associated with the given field name for the given feature.

getFieldUsageInfo

Method
Signature
getFieldUsageInfo (fieldName: string): object
Since
ArcGIS Maps SDK for JavaScript 4.17.

Gets field usage information. On building component sub layers, fields can always be used for rendering and popups. Fields can only be used for querying if an associated feature service is available.

The returned object contains the following usage information:

PropertyTypeDescription
supportsRendererbooleanIndicates that a field can be used in a renderer (e.g. in visual variables), see renderer.
supportsLabelingInfobooleanThis is always false, labeling is not supported on BuildingSceneLayer.
supportsPopupTemplatebooleanIndicates that a field can be used in a popup template, see popupTemplate.
supportsLayerQuerybooleanIndicates that a field can be used in layer queries, see queryFeatures().
Parameters
ParameterTypeDescriptionRequired
fieldName

The name of the field to get usage info for.

Returns
object

the field usage

isFulfilled

inherited Method
Signature
isFulfilled (): boolean
Inherited from: EsriPromiseMixin

isFulfilled() may be used to verify if creating an instance of the class is fulfilled (either resolved or rejected). If it is fulfilled, true will be returned.

Returns
boolean

Indicates whether creating an instance of the class has been fulfilled (either resolved or rejected).

isRejected

inherited Method
Signature
isRejected (): boolean
Inherited from: EsriPromiseMixin

isRejected() may be used to verify if creating an instance of the class is rejected. If it is rejected, true will be returned.

Returns
boolean

Indicates whether creating an instance of the class has been rejected.

isResolved

inherited Method
Signature
isResolved (): boolean
Inherited from: EsriPromiseMixin

isResolved() may be used to verify if creating an instance of the class is resolved. If it is resolved, true will be returned.

Returns
boolean

Indicates whether creating an instance of the class has been resolved.

load

inherited Method
Signature
load (options?: AbortOptions | null | undefined): Promise<this>
Inherited from: LoadableMixin

Loads the resources referenced by this class. This method automatically executes for a View and all of the resources it references in Map if the view is constructed with a map instance.

This method must be called by the developer when accessing a resource that will not be loaded in a View.

The load() method only triggers the loading of the resource the first time it is called. The subsequent calls return the same promise.

It's possible to provide a signal to stop being interested into a Loadable instance load status. When the signal is aborted, the instance does not stop its loading process, only cancelLoad() can abort it.

Parameters
ParameterTypeDescriptionRequired
options

Additional options.

Returns
Promise<this>

Resolves when the resources have loaded.

queryExtent

Method
Signature
queryExtent (query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<{ count: number; extent: Extent | null; }>
Since
ArcGIS Maps SDK for JavaScript 4.17

Executes a Query against the associated feature service and returns the 2D Extent of features that satisfy the query. At the moment the 3D Extent can be returned by using BuildingComponentSublayerView.queryExtent(), but this will return the 3D extent only for features currently in the view. The query succeeds only if the BuildingSceneLayer has an associated feature layer. If an associated feature layer is not available, then an error with the name buildingscenelayer:query-not-available is thrown. Read more about queries in the Querying section of the BuildingSceneLayer class description.

Parameters
ParameterTypeDescriptionRequired
query

Specifies the query parameters.

options

An object with the following properties.

Returns
Promise<{ count: number; extent: Extent | null; }>

When resolved, returns the extent and count of the features that satisfy the input query. See the object specification table below for details.

PropertyTypeDescription
countNumberThe number of features that satisfy the input query.
extentExtentThe extent of the features that satisfy the query.

queryFeatureCount

Method
Signature
queryFeatureCount (query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number>
Since
ArcGIS Maps SDK for JavaScript 4.17

Executes a Query against the associated feature service and returns the number of features that satisfy the query. The query succeeds only if the layer's supportsLayerQuery capability is enabled. Use the getFieldUsageInfo() method to check if the layer supports queries. If querying is not enabled, then an error with the name buildingscenelayer:query-not-available is thrown. Read more about queries in the Querying section of the BuildingSceneLayer class description.

Parameters
ParameterTypeDescriptionRequired
query

Specifies the query parameters.

options

An object with the following properties.

Returns
Promise<number>

Resolves to the count of the features satisfying the query.

queryFeatures

Method
Signature
queryFeatures (query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<FeatureSet>
Since
ArcGIS Maps SDK for JavaScript 4.17

Executes a Query against the associated feature service and returns a FeatureSet. The query succeeds only if the layer's supportsLayerQuery capability is enabled. Use the getFieldUsageInfo() method to check if the layer supports queries. If querying is not enabled, then an error with the name buildingscenelayer:query-not-available is thrown. Read more about queries in the Querying section of the BuildingSceneLayer class description.

Parameters
ParameterTypeDescriptionRequired
query

Specifies the query parameters.

options

An object with the following properties.

Returns
Promise<FeatureSet>

Resolves to a FeatureSet which contains the features satisfying the query.

queryObjectIds

Method
Signature
queryObjectIds (query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number[]>
Since
ArcGIS Maps SDK for JavaScript 4.17

Executes a Query against the associated feature service and returns an array of ObjectIDs of the features that satisfy the input query. The query succeeds only if the layer's supportsLayerQuery capability is enabled. Use the getFieldUsageInfo() method to check if the layer supports queries. If querying is not enabled, then an error with the name buildingscenelayer:query-not-available is thrown. Read more about queries in the Querying section of the SceneLayer class description.

See also
Parameters
ParameterTypeDescriptionRequired
query

Specifies the query parameters.

options

An object with the following properties.

Returns
Promise<number[]>

Resolves to an array of numbers representing the object IDs of the features satisfying the query.

when

inherited Method
Signature
when <TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>
Type parameters
<TResult1 = this, TResult2 = never>
Inherited from: EsriPromiseMixin

when() may be leveraged once an instance of the class is created. This method takes two input parameters: an onFulfilled function and an onRejected function. The onFulfilled executes when the instance of the class loads. The onRejected executes if the instance of the class fails to load.

Parameters
ParameterTypeDescriptionRequired
onFulfilled

The function to call when the promise resolves.

onRejected

The function to execute when the promise fails.

Returns
Promise<TResult1 | TResult2>

Returns a new promise for the result of onFulfilled that may be used to chain additional functions.

Example
// Although this example uses MapView, any class instance that is a promise may use when() in the same way
let view = new MapView();
view.when(function(){
// This function will execute once the promise is resolved
}, function(error){
// This function will execute if the promise is rejected due to an error
});