UNPKG

@vertigis/viewer-spec

Version:

VertiGIS Viewer Specification

197 lines (196 loc) 5.76 kB
import type Color from "@arcgis/core/Color"; import type PictureMarkerSymbol from "@arcgis/core/symbols/PictureMarkerSymbol"; import type SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol"; import type TextSymbol from "@arcgis/core/symbols/TextSymbol"; import type { GeometryUnion } from "@arcgis/core/unionTypes.js"; import type { ColorJson, PictureMarkerSymbolJson, SimpleMarkerSymbolJson, TextSymbolJson } from "@vertigis/arcgis-extensions/json/SymbolJson.js"; import type { Action } from "@vertigis/arcgis-extensions/support/Action"; import type { Command } from "../Command.js"; import { CommandRegistry } from "../CommandRegistry.js"; import type { Event } from "../Event.js"; import { EventRegistry } from "../EventRegistry.js"; import type { MapsLike, ModelRef } from "../common.js"; /** * An object that has a `maps property. */ export interface HasMapsRef { /** * The map(s) to use for the command/operation. */ maps?: MapsRef; } /** * References to one or more maps. */ export type MapsRef = MapsLike | ModelRef | ModelRef[]; /** * Symbols that can be used for location markers. */ export type MarkerSymbolConfig = SimpleMarkerSymbol | SimpleMarkerSymbolJson | PictureMarkerSymbol | PictureMarkerSymbolJson | TextSymbol | TextSymbolJson; /** * Arguments for the various location marker events. */ export interface LocationMarkerEvent { /** * The ID of the Marker. */ id: string; /** * The map for the Marker. */ maps: MapsLike; /** * The location of the Marker. */ geometry: GeometryUnion; /** * Indicates the color for the Marker. This property is only used if the * symbol is a well-known ID. */ color: Color | ColorJson; /** * Indicates the horizontal field of view in degrees for the marker. Ranges * from 0 to 360. This property is currently only supported by the "dot" * symbol. */ fov: number; /** * The clockwise rotation of the symbol in the horizontal plane in degrees. */ heading: number; /** * In 3D, the tilt angle of the location marker symbol. Ranges from 0 * (straight down) to 180 (straight up) degrees. Defaults to 90 (straight * ahead). */ tilt?: number; /** * The scale of the Marker, defaults to 1. */ scale: number; /** * Sets whether the Marker should be user draggable. */ userDraggable: boolean; /** * The symbol used to display the marker. The symbol can be an array of * Symbols or one of the following well-known IDs: "dot", "callout", or * "exclamation". Defaults to "dot". */ symbol: string | MarkerSymbolConfig[]; } /** * Arguments for the "location-marker.create" command. */ export type CreateLocationMarkerArgs = Partial<LocationMarkerEvent> & Required<Pick<LocationMarkerEvent, "geometry">> & { /** * Optional Action to perform when a Marker is updated. */ onUpdate?: Action; /** * The map(s) for the Marker. If maps are undefined, all maps will be * targeted. */ maps?: MapsRef; }; /** * Arguments for the "location-marker.update" command. */ export type UpdateLocationMarkerArgs = Partial<LocationMarkerEvent> & Required<Pick<LocationMarkerEvent, "id">> & { /** * Optional Action to perform when a Marker is updated. */ onUpdate?: Action; /** * The map(s) for the Marker. If maps are undefined, all maps will be * targeted. */ maps?: MapsRef; }; /** * Arguments for the "location-marker.remove" command. */ export interface RemoveLocationMarkerArgs { /** * The ID of the Marker to be removed. */ id?: string; /** * The map(s) for the Marker. If maps are undefined, all maps will be * targeted. */ maps?: MapsRef; } export declare class LocationMarkerEvents extends EventRegistry { protected readonly _prefix = "location-marker"; /** * Raised when a Marker is created. Web only. * * @webOnly */ get created(): Event<LocationMarkerEvent>; /** * Raised when a Marker is removed. Web only. * * @webOnly */ get removed(): Event<LocationMarkerEvent>; /** * Raised when a Marker is updated. Web only. * * @webOnly */ get updated(): Event<LocationMarkerEvent>; /** * Raised when a Marker is updating. Web only. * * @webOnly */ get updating(): Event<LocationMarkerEvent>; } export declare class LocationMarkerCommands extends CommandRegistry { protected readonly _prefix = "location-marker"; /** * Removes all Markers. Web only. * * @webOnly */ get clear(): Command<MapsRef | HasMapsRef | void>; /** * Create a new Marker. Web only. * * **Example:** Create a user draggable location marker with a heading and * fov. * * _Note:_ The geometry here must be a Geometry object rather than a JSON * representation. You can use the Workflow task 'Get Geometry From JSON' or * be passed one from another step in the command chain. * * ``` * { * "color": [24, 128, 255, 255], * "fov": 120, * "geometry": $geometry1.geometry, * "heading": 60, * "id": "custom-marker-1", * "symbol": "dot", * "userDraggable": true * } * ``` * * @webOnly */ get create(): Command<CreateLocationMarkerArgs>; /** * Remove a Marker. Web only. * * @webOnly */ get remove(): Command<RemoveLocationMarkerArgs>; /** * Update an existing Marker. Web only. * * @webOnly */ get update(): Command<UpdateLocationMarkerArgs>; }