@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
106 lines (104 loc) • 5.79 kB
TypeScript
import type Collection from "../../core/Collection.js";
import type BuildingSceneLayer from "../../layers/BuildingSceneLayer.js";
import type BuildingComponentSublayerView from "./BuildingComponentSublayerView.js";
import type LayerView from "./LayerView.js";
import type { ResourceHandle } from "../../core/Handles.js";
import type { HighlightTarget } from "../types.js";
import type { LayerViewHighlightOptions } from "./types.js";
import type { LayerViewProperties } from "./LayerView.js";
export interface BuildingSceneLayerViewProperties extends LayerViewProperties {}
/**
* Represents the [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) of a [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/)
* after it has been added to a [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
* BuildingSceneLayerView is responsible for streaming and rendering a [BuildingSceneLayer's](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/)
* features in the [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
*
* The BuildingSceneLayerView contains a list of [sublayer views](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/)
* for all the [component sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/) of a
* [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/). The BuildingSceneLayerView doesn't have query methods. To query the features
* loaded on the client, use the [query methods](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/#methods-summary)
* on the component [sublayer views](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/):
*
* ```js
* // query all the loaded features
* view.whenLayerView(buildingSceneLayer).then(function(buildingSceneLayerView) {
* buildingSceneLayerView.sublayerViews.forEach(function(sublayerView) {
* const query = sublayerView.createQuery();
* sublayerView.queryFeatures(query).then(function(result) {
* console.log(result.features);
* });
* });
* });
* ```
*
* The BuildingSceneLayerView can be used to highlight features in any of the
* [component sublayers](https://developers.arcgis.com/javascript/latest/references/core/layers/buildingSublayers/BuildingComponentSublayer/). The [highlight method](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingSceneLayerView/#highlight)
* takes as arguments the features that should be highlighted:
*
* ```js
* // on user click, select the first feature in the BuildingSceneLayer
* let highlight = null;
*
* view.on("click", function (event) {
* view.hitTest(event.screenPoint, {include: buildingSceneLayer}).then((hitTestResult) => {
* if (highlight) {
* highlight.remove();
* highlight = null;
* }
* if (hitTestResult.results.length) {
* highlight = bslv.highlight(hitTestResult.results[0].graphic);
* }
* });
* });
* ```
*
* @since 4.17
* @see [BuildingSceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BuildingSceneLayer/)
*/
export default abstract class BuildingSceneLayerView extends LayerView {
/** The layer being viewed. */
get layer(): BuildingSceneLayer;
/**
* Collection of [sublayer views](https://developers.arcgis.com/javascript/latest/references/core/views/layers/BuildingComponentSublayerView/) for all the
* component sublayers of the BuildingSceneLayer.
*
* @example
* view.whenLayerView(buildingSceneLayer).then(function(buildingSceneLayerView) {
* console.log(buildingSceneLayerView.sublayerViews);
* });
*/
get sublayerViews(): Collection<BuildingComponentSublayerView>;
/**
* Highlights the given feature(s).
*
* @param target - The feature(s) to highlight. The graphics that are passed to this function must originate from one
* of the component sublayers of the BuildigSceneLayer.
* @param options - An object with the following properties.
* @returns Returns a highlight handler with a `remove()` method that
* can be called to remove the highlight.
* @example
* // On user click, highlight the first feature selected in the BuildingSceneLayer
*
* // Add a new set of highlight options to the view's highlights collection
* view.highlights.push({name: "selection", color: "red"});
*
* // A handler can be used to remove any previous highlight when applying a new one
* let highlight;
*
* view.on("click", function (event) {
* // Idenitfy the first feature in the BuildingSceneLayer at the clicked location
* view.hitTest(event.screenPoint, {include: buildingSceneLayer}).then((hitTestResult) => {
* if (hitTestResult.results[0]) {
* const graphic = hitTestResult.results[0].graphic;
* view.whenLayerView(graphic.layer).then((layerView) => {
* // Remove any previous highlight, if it exists
* highlight?.remove();
* // Highlight the selected feature with the specified highlight options
* highlight = layerView.highlight(graphic, { name: "selection" } );
* });
* }
* });
* });
*/
highlight(target: HighlightTarget, options?: LayerViewHighlightOptions): ResourceHandle;
}