import type ViewshedAnalysis from "../analysis/ViewshedAnalysis.js";
import type Extent from "../geometry/Extent.js";
import type SpatialReference from "../geometry/SpatialReference.js";
import type Layer from "./Layer.js";
import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js";
import type { ViewshedAnalysisProperties } from "../analysis/ViewshedAnalysis.js";
import type { LayerProperties } from "./Layer.js";

export interface ViewshedLayerProperties extends LayerProperties, OperationalLayerProperties {
  /**
   * The [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) associated with the layer that stores the viewsheds.
   * Assigning a null value will create a new empty analysis.
   */
  source?: ViewshedAnalysisProperties;
  /**
   * The title of the layer used to identify it in places such as the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget
   * or [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component.
   *
   * If a layer is loaded as part of a webscene, then the title of the layer as stored in the webscene will be used.
   */
  title?: string | null;
}

/**
 * The viewshed layer enables the creation and display of viewshed and view dome type of visibility analysis in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
 *
 * It can be grouped with other layers, and when a [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget
 * or [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component is used,
 * the viewshed layer appears in the list. It can be persisted in a [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/).
 *
 * The viewsheds can be created interactively or added programmatically to a [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/)
 * object, which is then set as the layer's [source](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/#source).
 *
 * ```js
 * // create analysis with viewshed
 * const viewshedAnalysis = new ViewshedAnalysis({
 *    viewsheds: [
 *      new Viewshed({
 *        observer: new Point({ }),
 *        farDistance: 900,
 *        heading: 64,
 *        tilt: 84,
 *        horizontalFieldOfView: 85,
 *        verticalFieldOfView: 52
 *      })
 *    ]
 * });
 *
 * // add analysis to the layer
 * const viewshedLayer = new ViewshedLayer({
 *    source: viewshedAnalysis,
 * });
 *
 * // add layer to the map
 * view.map.add(viewshedLayer);
 * ```
 *
 * To start creating or editing viewsheds interactively, use the
 * [ViewshedLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/).
 *
 * ```js
 * // retrieve layer view for the layer
 * const layerView = await view.whenLayerView(viewshedLayer);
 *
 * // allow existing viewsheds in the layer to be selected and edited
 * // select a viewshed by hovering and clicking on their field-of-view manipulators
 * layerView.interactive = true;
 *
 * // start placing new viewsheds interactively
 * const abortController = new AbortController();
 *
 * try {
 *   await layerView.place({ signal: abortController.signal });
 * } catch (error) {
 *   if (error.name === "AbortError") {
 *     console.log("Placement operation was cancelled.");
 *   }
 * }
 *
 * // cancel the placement operation at some later point
 * abortController.abort();
 * ```
 *
 * > [!WARNING]
 * >
 * > **Known Limitations**
 * >
 * > This layer is only supported in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
 * > The results of the tool vary depending on the zoom level, as changes in zoom level affect the level of detail (LOD) of the scene geometry.
 *
 * @since 4.31
 * @see [ViewshedLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/)
 * @see [Viewshed](https://developers.arcgis.com/javascript/latest/references/core/analysis/Viewshed/)
 * @see [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/)
 * @see [ViewshedAnalysisView3D](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ViewshedAnalysisView3D/)
 * @see [Sample - ViewshedLayer in slides](https://developers.arcgis.com/javascript/latest/sample-code/layers-viewshed/)
 */
export default class ViewshedLayer extends ViewshedLayerSuperclass {
  /** @example const viewshedLayer = new ViewshedLayer(); */
  constructor(properties?: ViewshedLayerProperties);
  /**
   * The full extent of the layer which contains all viewsheds referenced by the layer.
   *
   * @example
   * // Once the layer loads, set the view's extent to the layer's full extent
   * layer.when(function(){
   *   view.extent = layer.fullExtent;
   * });
   */
  get fullExtent(): Extent | null | undefined;
  /**
   * The opacity of the layer. This value can range between `1` and `0`, where `0` is 100 percent
   * transparent and `1` is completely opaque.
   *
   * > [!WARNING]
   * >
   * > **Known Limitations**
   * >
   * > In a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/), modifying opacity is not supported for
   * > [DimensionLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionLayer/),
   * > [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/),
   * > [IntegratedMesh3DTilesLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMesh3DTilesLayer/),
   * > [IntegratedMeshLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/IntegratedMeshLayer/),
   * > [LineOfSightLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/LineOfSightLayer/), [PointCloudLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/PointCloudLayer/),
   * > [ViewshedLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/), and [VoxelLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VoxelLayer/).
   *
   * @default 1
   * @example
   * // Makes the layer 50% transparent
   * layer.opacity = 0.5;
   */
  get opacity(): number;
  /**
   * The [ViewshedAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/ViewshedAnalysis/) associated with the layer that stores the viewsheds.
   * Assigning a null value will create a new empty analysis.
   */
  get source(): ViewshedAnalysis;
  set source(value: ViewshedAnalysisProperties);
  /** The spatial reference of the layer. The spatial reference is derived from the [source](https://developers.arcgis.com/javascript/latest/references/core/layers/ViewshedLayer/#source). */
  get spatialReference(): SpatialReference;
  /**
   * The title of the layer used to identify it in places such as the [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/) widget
   * or [Layer List](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list/) component.
   *
   * If a layer is loaded as part of a webscene, then the title of the layer as stored in the webscene will be used.
   */
  accessor title: string | null | undefined;
  /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
  get type(): "viewshed";
}
declare const ViewshedLayerSuperclass: typeof Layer & typeof MultiOriginJSONSupportMixin & typeof OperationalLayer