UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

306 lines (304 loc) • 23 kB
import type Accessor from "../../core/Accessor.js"; import type Extent from "../../geometry/Extent.js"; import type BuildingComponentSublayer from "../../layers/buildingSublayers/BuildingComponentSublayer.js"; import type FeatureFilter from "../../layers/support/FeatureFilter.js"; import type FeatureSet from "../../rest/support/FeatureSet.js"; import type Query from "../../rest/support/Query.js"; import type { ResourceHandle } from "../../core/Handles.js"; import type { AbortOptions } from "../../core/promiseUtils.js"; import type { QueryProperties } from "../../rest/support/Query.js"; import type { HighlightTarget } from "../types.js"; import type { FeatureFilterProperties } from "../../layers/support/FeatureFilter.js"; export interface BuildingComponentSublayerViewProperties { /** * Applies a client-side [FeatureFilter](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureFilter/) to the displayed data. * Only the features that satisfy the filter are displayed. The fields to be used for the filter must be present in the layer view's * [availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#availableFields) list. * * > [!WARNING] * > * > **Known Limitations** * > * > The [FeatureFilter.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureFilter/#timeExtent) property is not supported on a SceneLayerView filter. * > Only spatial filters with [FeatureFilter.spatialRelationship](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureFilter/#spatialRelationship) * > set to `contains`, `intersects` or `disjoint` are supported. * * @since 4.18 */ filter?: FeatureFilterProperties | null; } /** * Represents the sublayer view of a [BuildingComponentSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/). The sublayer view * can be used for queries of features that are loaded in the view. Sublayer views can be accessed via the * [BuildingSceneLayerView.sublayerViews](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingSceneLayerView/#sublayerViews) property on [BuildingSceneLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingSceneLayerView/): * * ```js * // query all sublayers for features that satisfy the sql expression * let query = new Query(); * query.where = "FamilyType = 'Landscape'"; * view.whenLayerView(buildingSceneLayer).then(function(bslv) { * bslv.sublayerViews.forEach(function(componentSublayerView) { * componentSublayerView.queryFeatures(query).then(function(result) { * console.log(result.features); * }); * }); * }); * ``` * * Queries on the BuildingComponentSublayerView is executed against features that have been loaded for the current view. * This means that only visible features are guaranteed to be available once the layer has finished updating. * The query methods on the BuildingComponentSublayerView should not be used when the intention is to query or search * within the whole dataset, instead the query methods on the [BuildingComponentSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/) * should be used. * * The [highlight method](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#highlight) can be called on a specific sublayer view: * * ```js * view.whenLayerView(buildingSceneLayer).then(function(bslv) { * // get the sublayer view of the component sublayer with id 1 * const sublayerView = bslv.sublayerViews.find(function(sublayerView) { * return sublayerView.sublayer.id === 1; * }); * const query = sublayerView.createQuery(); * query.spatialRelationship = "contains"; * query.geometry = polygonGeometry; * // query sublayer view * sublayerView.queryObjectIds(query).then(function(result) { * sublayerView.highlight(result); * }); * }); * * @since 4.17 * @see [BuildingSceneLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingSceneLayerView/) */ export default class BuildingComponentSublayerView extends Accessor { constructor(properties?: BuildingComponentSublayerViewProperties); /** * A list of attribute fields fetched for each feature including fields required for layer * [rendering](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#renderer) and additional fields defined on the * [BuildingComponentSublayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#outFields) or * [BuildingSceneLayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/#outFields). * The availableFields is populated when the layer view is finished [updating](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#updating). Use this list when * querying features on the [client-side](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#queryFeatures). * * @see [BuildingComponentSublayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#outFields) */ get availableFields(): string[]; /** * Applies a client-side [FeatureFilter](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureFilter/) to the displayed data. * Only the features that satisfy the filter are displayed. The fields to be used for the filter must be present in the layer view's * [availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#availableFields) list. * * > [!WARNING] * > * > **Known Limitations** * > * > The [FeatureFilter.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureFilter/#timeExtent) property is not supported on a SceneLayerView filter. * > Only spatial filters with [FeatureFilter.spatialRelationship](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureFilter/#spatialRelationship) * > set to `contains`, `intersects` or `disjoint` are supported. * * @since 4.18 */ get filter(): FeatureFilter | null | undefined; set filter(value: FeatureFilterProperties | null | undefined); /** The sublayer being viewed. */ get sublayer(): BuildingComponentSublayer; /** * Value is `true` if the sublayer is suspended (i.e., sublayer will not redraw or update * itself when the extent changes). */ get suspended(): boolean; /** * Value is `true` when the sublayer is updating; for example, if * it is in the process of fetching data. */ get updating(): boolean; /** * Creates a query parameter object that can be used to fetch features as they are being * displayed. It sets the query parameter's [Query.outFields](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outFields) * property to `["*"]` and [Query.returnGeometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#returnGeometry) to `true`. * The output spatial reference is set to the spatial reference of the view. The * [BuildingComponentSublayer.definitionExpression](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#definitionExpression) that currently * applies to the sublayer view is also incorporated in the returned query object. * * @returns The query object */ createQuery(): Query; /** * Highlights the given feature(s). * * @param target - The feature(s) to highlight. When passing a graphic or array of graphics, each feature must * have a valid `objectID`. You may alternatively pass one or more objectIDs as a single number or * an array. * @returns Returns a highlight handler with a `remove()` method that * can be called to remove the highlight. */ highlight(target: HighlightTarget): ResourceHandle; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against features in the layer view and * returns the 3D [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of features that satisfy the query. If query parameters are * not provided, the extent and count of all loaded features are returned. * * Read more about queries in the Query section of the [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/) class description. * * To query for the extent of features directly from a Scene Service rather than those * loaded for the current view, you must * use the [BuildingComponentSublayer.queryExtent()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#queryExtent) * method. * * For making attribute based queries on a BuildingComponentSublayerView you need to specify the required fields * in the [BuildingComponentSublayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#outFields) property of the BuildingComponentSublayer to ensure that attribute values are * available on the client for querying. You can use [availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#availableFields) * to inspect which fields are available on the client. * * > [!WARNING] * > * > **Known Limitations** * > * > Spatial queries have the same limitations as those listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) * > documentation. * > Spatial queries on BuildingComponentSublayerView use the [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of the feature and * > not the footprint when calculating the spatial relationship with the [query geometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#geometry). * > This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry. * > Currently only `intersects`, `contains`, and `disjoint` [spatialRelationships](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#spatialRelationship) are supported on spatial * > [queries](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/). * > Spatial queries are not currently supported if the BuildingComponentSublayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gsterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @param query - Specifies the attributes and spatial filter of the query. * When no parameters are passed to this method, all features in the client are returned. * @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. */ 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 features in the layer view * and returns the number of features that satisfy the query. If query parameters are not provided, * the count of all loaded features is returned. * * To query for the count of features directly from a Scene Service rather than those * loaded for the current view, you must * use the [BuildingComponentSublayer.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#queryFeatureCount) * method. * * For making attribute based queries on a BuildingSceneLayerView you need to specify the required fields * in the [BuildingComponentSublayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#outFields) property of the BuildingComponentSublayer to ensure that attribute values are * available on the client for querying. You can use [availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#availableFields) * to inspect which fields are available on the client. Read more about queries in the [Query](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/#querying) * section of the [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/) class description. * * > [!WARNING] * > * > **Known Limitations** * > * > Spatial queries have the same limitations as those listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) * > documentation. * > Spatial queries on BuildingComponentSublayerView use the [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of the feature and * > not the footprint when calculating the spatial relationship with the [query geometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#geometry). * > This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry. * > Currently only `intersects`, `contains`, and `disjoint` [spatialRelationships](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#spatialRelationship) are supported on spatial * > [queries](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/). * > Spatial queries are not currently supported if the BuildingSceneLayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gsterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @param query - Specifies the attributes and spatial filter of the query. * When no parameters are passed to this method, all features in the client are returned. To only return features * visible in the view, set the `geometry` parameter in the query object to the view's extent. * @param options - An object with the following properties. * @returns When resolved, returns the number of features satisfying the query. */ queryFeatureCount(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number>; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against features in the layer view * and returns a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/). If query parameters are not provided, * all loaded features are returned. * * To execute a query against all the features in a Scene Service rather than only those loaded for the current view, * you must use the [BuildingComponentSublayer.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#queryFeatures) * method. * * For making attribute based queries on a BuildingComponentSublayerView you need to specify the required fields * in the [BuildingComponentSublayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#outFields) property of the BuildingComponentSublayer * to ensure that attribute values are available on the client for querying. You can use [availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#availableFields) * to inspect which fields are available on the client. * * > [!WARNING] * > * > **Known Limitations** * > * > Spatial queries have the same limitations as those listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) * > documentation. * > Spatial queries on BuildingComponentSublayerView use the [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of the feature and * > not the footprint when calculating the spatial relationship with the [query geometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#geometry). * > This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry. * > Currently only `intersects`, `contains`, and `disjoint` [spatialRelationships](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#spatialRelationship) are supported on spatial * > [queries](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/). * > Spatial queries are not currently supported if the BuildingSceneLayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gsterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @param query - Specifies the attributes and spatial filter of the query. * When no parameters are passed to this method, all features in the client are returned along with their attributes * specified in [availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#availableFields). To only return features * visible in the view, set the `geometry` parameter in the query object to the view's extent. * @param options - An object with the following properties. * @returns When resolved, a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) is returned. * The set will be empty if zero results are found. */ queryFeatures(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<FeatureSet>; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against features in * the layer view and returns an array of the ObjectIDs of features that satisfy the input query. If * query parameters are not provided, the ObjectIDs of all loaded features are returned. * * To query for ObjectIDs of features directly from a Scene Service rather than those * loaded for the current view, you must * use the [BuildingComponentSublayer.queryObjectIds()](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#queryObjectIds) * method. * * For making attribute based queries on a BuildingSceneLayerView you need to specify the required fields * in the [BuildingComponentSublayer.outFields](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/#outFields) property of the BuildingComponentSublayer to ensure that attribute values are * available on the client for querying. You can use [availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#availableFields) * to inspect which fields are available on the client. * * > [!WARNING] * > * > **Known Limitations** * > * > Spatial queries have the limitations listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) * > documentation. * > Spatial queries on BuildingSceneLayerView use the [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of the feature and * > not the footprint when calculating the spatial relationship with the [query geometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#geometry). * > This means that a feature might be returned from the query, even though its footprint is not in a spatial relationship with the geometry. * > Currently only `intersects`, `contains`, and `disjoint` [spatialRelationships](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#spatialRelationship) are supported on spatial * > [queries](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/). * > Spatial queries are not currently supported if the BuildingSceneLayerView has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gsterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @param query - Specifies the attributes of the query. * If query parameters are not provided, all loaded features are returned. * @param options - An object with the following properties. * @returns When resolved, returns an array of numbers representing the ObjectIDs of the features * satisfying the query. */ queryObjectIds(query?: QueryProperties | null | undefined, options?: AbortOptions): Promise<number[]>; }