UNPKG

@arcgis/map-components

Version:
244 lines (242 loc) • 13 kB
/// <reference types="@arcgis/core/interfaces.d.ts" /> /// <reference types="../../index.d.ts" /> import { Use } from '@arcgis/lumina/controllers'; import { default as GraphicsLayer } from '@arcgis/core/layers/GraphicsLayer.js'; import { default as Sketch } from '@arcgis/core/widgets/Sketch.js'; import { PublicLitElement as LitElement, ToElement, TargetedEvent } from '@arcgis/lumina'; import { ArcgisReferenceElement } from '../../utils/component-utils'; declare const useSketchWidget: (component: LitElement & Pick<Sketch, "icon" | "label" | "viewModel" | "scale" | "layout" | "layer" | "availableCreateTools" | "creationMode" | "defaultCreateOptions" | "defaultUpdateOptions" | "labelOptions" | "toolbarKind" | "snappingOptions" | "tooltipOptions"> & { state?: "ready" | "disabled" | "active" | undefined; viewModel?: __esri.SketchViewModel | undefined; closed?: boolean; icon: import('@arcgis/components-utils').Nil | string; label: import('@arcgis/components-utils').Nil | string; referenceElement?: ArcgisReferenceElement | string; position: __esri.UIPosition; arcgisReady: import('@arcgis/lumina').EventEmitter; arcgisPropertyChange: import('@arcgis/lumina').EventEmitter<{ name: string; }> | undefined; el: HTMLElement & { childElem?: HTMLElement & { ownedBy?: HTMLElement; }; view?: __esri.LinkChartView | __esri.MapView | __esri.SceneView; }; autoDestroyDisabled: boolean; destroy: () => Promise<void>; }) => Sketch; /** * The Sketch component provides a simple UI for creating and updating graphics on a [MapView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html) or a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html). * * [Read more...](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-sketch/) */ export declare class ArcgisSketch extends LitElement { /** * When creating new graphics (for example after [create()](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#create) has been called), * this property reflects the create tool being used. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#activeTool) */ readonly activeTool: nullish | "rectangle" | "polygon" | "point" | "move" | "circle" | "reshape" | "multipoint" | "polyline" | "mesh" | "transform" | "freehandPolyline" | "freehandPolygon" | "rectangle-selection" | "lasso-selection" | "custom-selection"; /** * If true, the component will not be destroyed automatically when it is * disconnected from the document. This is useful when you want to move the * component to a different place on the page, or temporarily hide it. If this * is set, make sure to call the [destroy](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-sketch/#destroy) method when you are done to * prevent memory leaks. * * @default false */ autoDestroyDisabled: boolean; /** * Property controlling the visibility and order of create tool buttons. * * @default ["point", "polyline", "polygon", "rectangle", "circle"] */ availableCreateTools: nullish | ("rectangle" | "polygon" | "point" | "circle" | "multipoint" | "polyline" | "mesh" | "freehandPolyline" | "freehandPolygon")[]; /** * The graphic that is being created. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#createGraphic) */ readonly createGraphic: nullish | __esri.Graphic; /** * Defines the default behavior once the [create](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#create) operation is completed. * * @default "continuous" */ creationMode: "update" | "single" | "continuous"; /** * Default create options set for the Sketch widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#defaultCreateOptions) */ defaultCreateOptions: __esri.SketchDefaultCreateOptions; /** * By default, sketch will auto-create a new graphics layer if none was * provided. Set this prop to true to disable this behavior. * * @default false */ defaultGraphicsLayerDisabled: boolean; /** * Default update options set for the Sketch widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#defaultUpdateOptions) */ defaultUpdateOptions: __esri.SketchDefaultUpdateOptions; /** @default false */ hideCreateToolsCircle: boolean; /** @default false */ hideCreateToolsPoint: boolean; /** @default false */ hideCreateToolsPolygon: boolean; /** @default false */ hideCreateToolsPolyline: boolean; /** @default false */ hideCreateToolsRectangle: boolean; /** @default false */ hideDuplicateButton: boolean; /** @default false */ hideDeleteButton: boolean; /** @default false */ hideSelectionCountLabel: boolean; /** @default false */ hideLabelsToggle: boolean; /** @default false */ hideSelectionToolsLassoSelection: boolean; /** @default false */ hideSelectionToolsRectangleSelection: boolean; /** @default false */ hideSettingsMenu: boolean; /** @default false */ hideSnappingControls: boolean; /** @default false */ hideSnappingControlsElementsEnabledToggle: boolean; /** @default false */ hideSnappingControlsElementsFeatureEnabledToggle: boolean; /** @default false */ hideSnappingControlsElementsLayerList: boolean; /** @default false */ hideSnappingControlsElementsSelfEnabledToggle: boolean; /** @default false */ hideTooltipsToggle: boolean; /** @default false */ hideUndoRedoMenu: boolean; /** * Icon which represents the component. * Typically used when the component is controlled by another component (e.g. by the Expand component). * * @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/) * @default "pencil" */ icon: string; /** * The Sketch widget's default label. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#label) */ label: string; /** * Options to configure the sketch labels shown next to each segment of the geometry being created or updated. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#labelOptions) */ labelOptions: __esri.SketchLabelOptions; /** * The [GraphicsLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html) associated with the Sketch widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#layer) */ layer: GraphicsLayer; /** * Determines the layout/orientation of the Sketch widget. * * @default "horizontal" */ layout: "vertical" | "horizontal"; /** * A [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleMarkerSymbol.html), [PointSymbol3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PointSymbol3D.html), [TextSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol.html), [CIMSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-CIMSymbol.html), or [WebStyleSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-WebStyleSymbol.html) used for representing the point geometry that is being drawn. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#pointSymbol) */ pointSymbol: __esri.SimpleMarkerSymbol | __esri.PictureMarkerSymbol | __esri.PointSymbol3D | __esri.TextSymbol | __esri.CIMSymbol | __esri.WebStyleSymbol; /** * A [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html), [PolygonSymbol3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-PolygonSymbol3D.html), or [CIMSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-CIMSymbol.html) used for representing the polygon geometry that is being drawn. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#polygonSymbol) */ polygonSymbol: __esri.CIMSymbol | __esri.SimpleFillSymbol | __esri.PolygonSymbol3D; /** * A [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html), [LineSymbol3D](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-LineSymbol3D.html), or [CIMSymbol](https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-CIMSymbol.html) used for representing the polyline geometry that is being drawn. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#polylineSymbol) */ polylineSymbol: __esri.SimpleLineSymbol | __esri.CIMSymbol | __esri.LineSymbol3D; /** @default "bottom-left" */ position: __esri.UIPosition; /** * By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene. * * @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component) */ referenceElement?: ArcgisReferenceElement | string; /** * Determines the size of widget elements. * * @default "m" */ scale: "s" | "m" | "l"; /** * Controls the appearance of the sketch widget, allowing * the toolbar to adapt its appearance appropriately based on context. * * @default "floating" */ toolbarKind: "floating" | "docked"; /** @default false */ showSnappingControlsElementsHeader: boolean; /** * The [SnappingOptions](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html) for sketching. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#snappingOptions) */ snappingOptions: __esri.SnappingOptions; /** The current state of the component. */ readonly state: "ready" | "disabled" | "active"; /** * Options to configure the tooltip shown next to the cursor when creating or updating graphics. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#tooltipOptions) */ tooltipOptions: __esri.SketchTooltipOptions; /** * An array of [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html) that are being updated by the Sketch widget. * * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch.html#updateGraphics) */ readonly updateGraphics: __esri.Collection<__esri.Graphic>; cancel(): Promise<void>; complete(): Promise<void>; create(tool: "circle" | "point" | "polygon" | "polyline" | "rectangle", createOptions?: __esri.SketchViewModelCreateCreateOptions): Promise<void>; delete(): Promise<void>; /** Permanently destroy the component. */ destroy(): Promise<void>; duplicate(): Promise<void>; redo(): Promise<void>; triggerUpdate(graphic: __esri.Graphic | __esri.Graphic[], updateOptions?: __esri.SketchViewModelUpdateUpdateOptions): Promise<void>; undo(): Promise<void>; readonly arcgisCreate: TargetedEvent<this, __esri.SketchCreateEvent>; readonly arcgisDelete: TargetedEvent<this, __esri.SketchDeleteEvent>; /** Emitted when the value of a property is changed. Use this to listen to changes to properties. */ readonly arcgisPropertyChange: TargetedEvent<this, { name: "state"; }>; /** Emitted when the component associated with a map or scene view is is ready to be interacted with. */ readonly arcgisReady: TargetedEvent<this, void>; readonly arcgisRedo: TargetedEvent<this, __esri.SketchRedoEvent>; readonly arcgisUndo: TargetedEvent<this, __esri.SketchUndoEvent>; readonly arcgisUpdate: TargetedEvent<this, __esri.SketchUpdateEvent>; } export {};