@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
167 lines (166 loc) • 6.97 kB
TypeScript
import type Geometry from "@arcgis/core/geometry/Geometry.js";
import type LineSymbol3D from "@arcgis/core/symbols/LineSymbol3D";
import type PictureFillSymbol from "@arcgis/core/symbols/PictureFillSymbol";
import type PictureMarkerSymbol from "@arcgis/core/symbols/PictureMarkerSymbol";
import type PointSymbol3D from "@arcgis/core/symbols/PointSymbol3D";
import type PolygonSymbol3D from "@arcgis/core/symbols/PolygonSymbol3D";
import type SimpleFillSymbol from "@arcgis/core/symbols/SimpleFillSymbol";
import type SimpleLineSymbol from "@arcgis/core/symbols/SimpleLineSymbol";
import type SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol";
import type { SymbolUnion } from "@arcgis/core/unionTypes.js";
import type { LineSymbol3DJson, PictureFillSymbolJson, PictureMarkerSymbolJson, PointSymbol3DJson, PolygonSymbol3DJson, SimpleFillSymbolJson, SimpleLineSymbolJson, SimpleMarkerSymbolJson } from "@vertigis/arcgis-extensions/json/SymbolJson.js";
import type { GeometryType } from "@vertigis/arcgis-extensions/support/esri";
import type { SymbolPresetProperties } from "../../app-config/web/DrawModelProperties.js";
import type { Command } from "../Command.js";
import { CommandRegistry } from "../CommandRegistry.js";
import type { Operation } from "../Operation.js";
import { OperationRegistry } from "../OperationRegistry.js";
import type { CreateGraphicsResult, FeaturesLike, GeometryLike, HasFeatures, HasGraphics, HasLayers, HasMaps, HasRenderer, HasSymbol, HasSymbols, HasUITarget, SymbolLike } from "../common.js";
import type { CaptureGeometryArgs } from "./sketching.js";
/**
* Symbols supported for drawing.
*/
export type DrawingSymbolConfig = SimpleMarkerSymbol | SimpleMarkerSymbolJson | PictureMarkerSymbol | PictureMarkerSymbolJson | SimpleLineSymbol | SimpleLineSymbolJson | SimpleFillSymbol | SimpleFillSymbolJson | PictureFillSymbol | PictureFillSymbolJson | PointSymbol3D | PointSymbol3DJson | LineSymbol3D | LineSymbol3DJson | PolygonSymbol3D | PolygonSymbol3DJson;
/**
* Arguments for the drawing.get-symbol operation. Only available in VertiGIS
* Studio Web.
*/
export interface GetDefaultSymbolArgs {
/**
* The geometry type for the default symbol to retrieve.
*/
geometryType?: GeometryType;
}
/**
* Arguments for the drawing.edit-symbol operation. Only available in VertiGIS
* Studio Web.
*/
export interface EditSymbolArgs extends HasSymbol, HasSymbols, HasMaps, HasLayers, HasGraphics, HasFeatures, HasUITarget {
/**
* The geometry type for the symbol to create.
*/
geometryType?: GeometryType;
/**
* Symbol presets that can be assigned to a graphic. If defined, these
* presets will override any that are configured in the DrawService.
*/
symbolPresets?: SymbolPresetProperties[];
/**
* If the fine-grain controls should be hidden and only the symbol presets
* should be shown. If no valid symbol presets are configured, this property
* will be ignored. Default is false. If defined, this will override the
* value of the DrawService's 'showOnlySymbolPresets' property.
*/
showOnlySymbolPresets?: boolean;
}
/**
* Arguments for the drawing.edit-symbol operation. Only available in VertiGIS
* Studio Web.
*/
export interface EditSymbolResult extends HasMaps, HasLayers, HasGraphics, HasFeatures, HasSymbols, HasSymbol, HasRenderer {
}
/**
* Arguments for the "drawing.create-graphics" operation. `GeometryLike`,
* `FeaturesLike` and `SymbolLike` are only available in Web.
*/
export interface CreateGraphicsArgs extends HasMaps {
/**
* The geometry that was captured.
*/
geometry: Geometry | GeometryLike;
/**
* Features containing geometry to create graphics from. Web only.
*/
features?: FeaturesLike;
/**
* The symbol that should be used to create the graphic. If null, a default
* is provided.
*/
symbol?: SymbolUnion | SymbolLike;
}
export declare class DrawingCommands extends CommandRegistry {
protected readonly _prefix = "drawing";
/**
* Allows the user to draw on the map by capturing geometry, creating a
* graphic, and persisting the graphic on the map. This is a shortcut for
* the command chain ["sketching.capture-geometry",
* "drawing.create-graphics", "map.add-markup"]. Some default
* geometryEditorSettings are also applied. Mobile only.
*
* @mobileOnly
*/
get draw(): Command<CaptureGeometryArgs>;
/**
* Sets a value that determines whether drawings will be synced
* automatically across maps.
*/
get setSync(): Command<boolean>;
/**
* Sets the value of the default point, line, or polygon symbol. The symbol
* can be configured with an instance of the Esri symbol or with the Esri
* WebMap JSON. Web only.
*
* **Example:** Set the default point symbol to a square.
*
* ```
* {
* "type": "esriSMS",
* "color": [251, 43, 17, 85],
* "size": 12,
* "style": "esriSMSSquare",
* "outline": {
* "type": "esriSLS",
* "color": [251, 43, 17, 255],
* "width": 1.5,
* "style": "esriSLSSolid"
* }
* }
* ```
*
* @webOnly
*/
get setDefaultSymbol(): Command<SymbolLike | HasSymbol>;
/**
* Sets the symbol on a collection of Graphics. The symbol can be configured
* with an instance of the Esri symbol or with the Esri WebMap JSON. Web
* only.
*
* @webOnly
*/
get setSymbol(): Command<HasSymbol & HasGraphics>;
}
export declare class DrawingOperations extends OperationRegistry {
protected readonly _prefix = "drawing";
/**
* Creates graphics.
*
* In Web, creates graphics out of GeometryLike or CreateGraphicsArgs, with
* the current symbols that are set on the DrawManager.
*
* In Mobile, creates graphics from the given CreateGraphicsArgs or
* CreateGraphicsArgs[] (or some GeometryLike args). Any provided symbol
* parameter is used, otherwise a default symbol is used.
*/
get createGraphics(): Operation<CreateGraphicsArgs | CreateGraphicsArgs[] | GeometryLike, CreateGraphicsResult>;
/**
* Gets the value of the default point, line, or polygon symbol for the
* provided geometry type. Web only.
*
* @webOnly
*/
get getDefaultSymbol(): Operation<GetDefaultSymbolArgs | GeometryType, DrawingSymbolConfig>;
/**
* Gets the value of the default 3D point, line, or polygon symbol for the
* provided geometry type. Web only.
*
* @webOnly
*/
get getDefaultSymbol3D(): Operation<GetDefaultSymbolArgs | GeometryType, DrawingSymbolConfig>;
/**
* Opens the symbol editor toolbox for the specified geometry or type. Web
* only.
*
* @webOnly
*/
get editSymbol(): Operation<EditSymbolArgs | Symbol, EditSymbolResult>;
}