@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
334 lines (332 loc) • 23.1 kB
TypeScript
import type PopupTemplate from "../../PopupTemplate.js";
import type Extent from "../../geometry/Extent.js";
import type BuildingSublayer from "./BuildingSublayer.js";
import type Field from "../support/Field.js";
import type FeatureSet from "../../rest/support/FeatureSet.js";
import type Query from "../../rest/support/Query.js";
import type { LoadableMixin, LoadableMixinProperties } from "../../core/Loadable.js";
import type { EsriPromiseMixin } from "../../core/Promise.js";
import type { AbortOptions } from "../../core/promiseUtils.js";
import type { FieldDomainOptions } from "../types.js";
import type { DomainUnion } from "../support/types.js";
import type { RendererUnion } from "../../renderers/types.js";
import type { QueryProperties } from "../../rest/support/Query.js";
import type { CreatePopupTemplateOptions } from "../../support/popupUtils.js";
import type { HeatmapRendererProperties } from "../../renderers/HeatmapRenderer.js";
import type { PieChartRendererProperties } from "../../renderers/PieChartRenderer.js";
import type { DictionaryRendererProperties } from "../../renderers/DictionaryRenderer.js";
import type { DotDensityRendererProperties } from "../../renderers/DotDensityRenderer.js";
import type { UniqueValueRendererProperties } from "../../renderers/UniqueValueRenderer.js";
import type { ClassBreaksRendererProperties } from "../../renderers/ClassBreaksRenderer.js";
import type { SimpleRendererProperties } from "../../renderers/SimpleRenderer.js";
import type { PopupTemplateProperties } from "../../PopupTemplate.js";
import type { BuildingSublayerProperties } from "./BuildingSublayer.js";
export interface BuildingComponentSublayerProperties extends BuildingSublayerProperties, LoadableMixinProperties, Partial<Pick<BuildingComponentSublayer, "definitionExpression" | "listMode" | "outFields" | "popupEnabled">> {
/**
* 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](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/)
* for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with a
* [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/). Setting a [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/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](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled)
* is set to `true`.
*
* @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#createPopupTemplate)
* @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
* @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
*/
popupTemplate?: PopupTemplateProperties | null;
/**
* 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" }
* }]
* }
* };
*/
renderer?: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null;
}
/**
* BuildingComponentSublayers contain 3D Object features representing building components
* like doors, pipes or AC units. They are sublayers in a [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/)
* either directly or as part of a [BuildingGroupSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingGroupSublayer/).
* This sublayer is similar to a 3D Object [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/), it can be visualized with a
* specific [renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#renderer), popups can be customized using [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#popupTemplate)
* and SQL filters can be applied by setting a [definitionExpression](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#definitionExpression).
*
* Starting with version 4.17, BuildingComponentSublayers support attribute or spatial queries if the
* the [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/) has an associated feature layer.
*
* @since 4.10
* @see [Sample - BuildingSceneLayer with Slice widget](https://developers.arcgis.com/javascript/latest/sample-code/building-scene-layer-slice/)
* @see [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/)
* @see [BuildingComponentSublayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/)
* @see [BuildingGroupSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingGroupSublayer/)
* @see [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/)
*/
export default class BuildingComponentSublayer extends BuildingComponentSublayerSuperclass {
constructor(properties?: BuildingComponentSublayerProperties);
/**
* The SQL where clause used to filter features on the client. Only the features that satisfy the definition
* expression are displayed in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/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](https://doc.arcgis.com/en/arcgis-online/reference/sql-agol.htm).
*/
accessor definitionExpression: string | null | undefined;
/**
* An array of fields in the layer. Each field represents an attribute
* that may contain a value for each feature in the layer.
*
* @since 4.33
*/
get fields(): Field[];
/**
* The name of a `global-id` [field](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#fields) containing
* a globally unique identifier for each feature in the layer.
*
* @since 4.33
*/
get globalIdField(): string;
/**
* Indicates how the layer should display in the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget.
* The possible values are listed below.
*
* Value | Description
* ------|------------
* show | The layer is visible in the table of contents.
* hide | The layer is hidden in the table of contents.
*
* @default "show"
* @since 4.11
*/
accessor listMode: "hide" | "show";
/**
* The name of an `oid` [field](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#fields) containing
* a unique value or identifier for each feature in the layer.
*
* @since 4.33
*/
get objectIdField(): string;
/**
* 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](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#renderer).
*
* To include fields in all sublayers, use the
* [BuildingSceneLayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/#outFields)
* property of the parent layer.
*
* @since 4.12
*/
accessor outFields: string[] | null | undefined;
/**
* Indicates whether to display popups when features in the layer are clicked. The layer needs to have a [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#popupTemplate) to define what
* information should be displayed in the popup. Alternatively, a default popup template may be automatically used if
* [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`.
*
* @default true
* @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#createPopupTemplate)
* @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
* @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
*/
accessor popupEnabled: boolean;
/**
* 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](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/)
* for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with a
* [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/). Setting a [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/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](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled)
* is set to `true`.
*
* @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#createPopupTemplate)
* @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup)
* @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup)
*/
get popupTemplate(): PopupTemplate | null | undefined;
set popupTemplate(value: PopupTemplateProperties | 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" }
* }]
* }
* };
*/
get renderer(): RendererUnion | null | undefined;
set renderer(value: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null | undefined);
readonly type: "building-component";
/**
* Creates a default popup template for the layer, populated with all the fields of the layer.
*
* @param options - Options for creating the popup template.
* @returns The popup template, or `null` if the layer does not
* have any fields.
* @since 4.11
*/
createPopupTemplate(options?: CreatePopupTemplateOptions): PopupTemplate | null | undefined;
/**
* Creates a query object that can be used to fetch features that
* satisfy the component sublayer's current [definition expression](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#definitionExpression).
* The query should only be used on the layer and not on the layer view.
*
* @returns The query object representing the layer's
* definition expression.
* @since 4.17
*/
createQuery(): Query;
/**
* Returns the [Field](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/) instance for a field name (case-insensitive).
*
* @param fieldName - Name of the field.
* @returns the matching field or `undefined`
* @since 4.12
*/
getField(fieldName: string): Field | null | undefined;
/**
* Returns the [Domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Domain/) associated with the given field name. The domain can be either a
* [CodedValueDomain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/CodedValueDomain/) or [RangeDomain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/RangeDomain/).
*
* @param fieldName - Name of the field.
* @param options - An object specifying additional options. See the
* object specification table below for the required properties of this object.
* @returns The Domain object associated with the given field name for the given feature.
* @since 4.12
*/
getFieldDomain(fieldName: string, options?: FieldDomainOptions): DomainUnion | null | undefined;
/**
* 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:
*
* Property | Type | Description
* ----------------------|---------|------------
* supportsRenderer | boolean | Indicates that a field can be used in a renderer (e.g. in visual variables), [see renderer](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#renderer).
* supportsLabelingInfo | boolean | This is always `false`, labeling is not supported on [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/).
* supportsPopupTemplate | boolean | Indicates that a field can be used in a popup template, [see popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#popupTemplate).
* supportsLayerQuery | boolean | Indicates that a field can be used in layer queries, [see queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#queryFeatures).
*
* @param fieldName - The name of the field to get usage info for.
* @returns the field usage
* @since 4.17.
*/
getFieldUsageInfo(fieldName: string): object;
/**
* Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the associated feature service and returns the 2D
* [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of features that satisfy the query.
* At the moment the 3D Extent can be returned by using
* [BuildingComponentSublayerView.queryExtent()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/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](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/#querying) section of the BuildingSceneLayer class description.
*
* @param query - Specifies the query parameters.
* @param options - An object with the following properties.
* @returns When resolved, returns the extent and count of the features
* that satisfy the input query. See the object specification table below for details.
* Property | Type | Description
* ---------|------|-------------
* count | Number | The number of features that satisfy the input query.
* extent | [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) | The extent of the features that satisfy the query.
* @since 4.17
*/
queryExtent(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<{
count: number;
extent: Extent | null;
}>;
/**
* Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/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()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#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](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/#querying) section of the BuildingSceneLayer class description.
*
* @param query - Specifies the query parameters.
* @param options - An object with the following properties.
* @returns Resolves to the count of the features satisfying the query.
* @since 4.17
*/
queryFeatureCount(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number>;
/**
* Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the associated feature service and returns a
* [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/). The query succeeds only if
* the layer's `supportsLayerQuery` capability is enabled. Use the
* [getFieldUsageInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#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](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/#querying) section of the BuildingSceneLayer class description.
*
* @param query - Specifies the query parameters.
* @param options - An object with the following properties.
* @returns Resolves to a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/)
* which contains the features satisfying the query.
* @since 4.17
*/
queryFeatures(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<FeatureSet>;
/**
* Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/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()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#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](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/#querying) section of the SceneLayer class description.
*
* @param query - Specifies the query parameters.
* @param options - An object with the following properties.
* @returns Resolves to an array of numbers representing the object IDs
* of the features satisfying the query.
* @since 4.17
* @see [FeatureLayer.queryObjectIds()](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#queryObjectIds)
*/
queryObjectIds(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number[]>;
}
declare const BuildingComponentSublayerSuperclass: typeof BuildingSublayer & typeof EsriPromiseMixin & typeof LoadableMixin