UNPKG

@vertigis/viewer-spec

Version:

VertiGIS Viewer Specification

374 lines (373 loc) 12.8 kB
import type Graphic from "@arcgis/core/Graphic"; import type Viewpoint from "@arcgis/core/Viewpoint"; import type Layer from "@arcgis/core/layers/Layer"; import type LabelClass from "@arcgis/core/layers/support/LabelClass"; import type EsriFeatureSet from "@arcgis/core/rest/support/FeatureSet"; import type CIMSymbol from "@arcgis/core/symbols/CIMSymbol"; 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 TextSymbol from "@arcgis/core/symbols/TextSymbol"; import type { GeometryUnion, RendererUnion } from "@arcgis/core/unionTypes"; import type { Entity } from "@vertigis/arcgis-extensions/Entity"; import type { Feature, FeatureProperties } from "@vertigis/arcgis-extensions/data/Feature"; import type { FeatureList } from "@vertigis/arcgis-extensions/data/FeatureList"; import type { FeatureSet } from "@vertigis/arcgis-extensions/data/FeatureSet"; import type { FeatureSource } from "@vertigis/arcgis-extensions/data/FeatureSource"; import type { FeatureStream } from "@vertigis/arcgis-extensions/data/FeatureStream"; import type { TableExtension, TableReference as TableReferenceObject } from "@vertigis/arcgis-extensions/data/TableExtension"; import type { LabelingInfoJson } from "@vertigis/arcgis-extensions/json/DrawingInfoJson"; import type { FeatureJson } from "@vertigis/arcgis-extensions/json/FeatureJson"; import type { GeometryJson } from "@vertigis/arcgis-extensions/json/GeometryJson"; import type { RendererJson } from "@vertigis/arcgis-extensions/json/RendererJson"; import type { CIMSymbolReferenceJson, LineSymbol3DJson, PictureFillSymbolJson, PictureMarkerSymbolJson, PointSymbol3DJson, PolygonSymbol3DJson, SimpleFillSymbolJson, SimpleLineSymbolJson, SimpleMarkerSymbolJson, TextSymbolJson } from "@vertigis/arcgis-extensions/json/SymbolJson"; import type { ViewpointJson } from "@vertigis/arcgis-extensions/json/ViewpointJson"; import type { BasemapExtension } from "@vertigis/arcgis-extensions/mapping/BasemapExtension"; import type { Bookmark, BookmarkProperties } from "@vertigis/arcgis-extensions/mapping/Bookmark"; import type { LayerExtension, LayerReference as LayerReferenceObject } from "@vertigis/arcgis-extensions/mapping/LayerExtension"; import type { MapExtension } from "@vertigis/arcgis-extensions/mapping/MapExtension"; import type { SublayerExtension } from "@vertigis/arcgis-extensions/mapping/SublayerExtension"; import type { SublayerLike } from "@vertigis/arcgis-extensions/support/esri"; import type { ItemRef } from "../app-config/common/ItemRef"; import type { TimeSpan } from "./DotNetTypes"; /** * A component's ID in the layout. */ export type ComponentId = string; /** * A model belonging to a component. */ export interface Model extends Entity { } /** * A reference to a model (using its ID or model instance). */ export type ModelRef = ItemRef | Model; /** * Result of the "drawing.create-graphics" and "measurement.create-graphics" * operations. */ export interface CreateGraphicsResult { /** * The resulting graphics. */ graphics: Graphic[]; /** * The map that the graphics were created on. Only available in Web. */ maps: MapsLike; } /** * Represents one or more features. */ export type FeaturesLike = Feature | FeatureSet | FeatureList | FeatureStream | (Feature | FeatureProperties)[]; /** * Represents one or more LabelingInfo. */ export type LabelingInfoLike = LabelingInfoJson | LabelClass | (LabelingInfoJson | LabelClass)[]; /** * One or more LabelingInfos, or an object that has LabelingInfos. */ export type LabelingInfos = LabelingInfoLike | HasLabelingInfo; /** * Feature results from an operation. */ export interface Results extends HasFeatures, HasMaps { } /** * Defines an object that has a `features` property. */ export interface HasFeatures { /** * Features to use for the command/operation. */ features?: FeaturesLike; } /** * Defines an object that has a `labelingInfo` property. */ export interface HasLabelingInfo { /** * LabelingInfos to use for the command/operation. */ labelingInfo?: LabelingInfoLike; } /** * Defines an object that has a `maps` property and a `features` property. */ export interface HasMapsAndFeatures extends HasMaps, HasFeatures { } /** * Event args for any events that contain results that were obtained for from a * map operation. */ export interface MapsFeatureResultArgs extends HasMapsAndFeatures { /** * The type of operation that created these results. */ sourceOperation: SourceOperation; /** * The error associated with these results if there is one. */ error: Error; /** * The original geometry associated with the event. The original geometry * pertains to the original input geometry that was passed into the * operation before the event was generated. */ originalGeometry: GeometryUnion; /** * The geometry associated with the event. This may be an alteration of the * original geometry (eg. Buffered). */ geometry: GeometryUnion; /** * The feature sources that were used to produce the result. */ sources: FeatureSource[]; /** * The amount of time that it took to perform the operation. */ duration: TimeSpan; } /** * Describes the source of results. */ export type SourceOperation = "Unknown" | "Identify" | "Search" | "Add" | "Workflow" | "Geocode"; /** * One or more features, or an object that has features. */ export type Features = FeaturesLike | Results; /** * One or map extensions. */ export type MapsLike = MapExtension | MapExtension[]; /** * Defines an object that has a `maps` property. */ export interface HasMaps { /** * Map(s) to use for the command/operation. */ maps?: MapsLike; } /** * One or more map extensions, or an object that has map extensions. */ export type Maps = MapsLike | HasMaps; /** * A reference to an existing layer, which is the ID or title of the layer (or * both). */ export type LayerReference = string | LayerReferenceObject; /** * A reference to an existing table, which is the ID or title of the table (or * both). */ export type TableReference = string | TableReferenceObject; /** * A (sub)layer extension, or an object that is convertible to one. */ export type LayerLike = Layer | LayerExtension | SublayerLike | SublayerExtension | LayerReference | TableExtension | TableReference; /** * One or more objects that are convertible to layer extensions. */ export type LayersLike = LayerLike | LayerLike[]; /** * An object that has one or more layer extensions. */ export interface HasLayers { /** * Layer(s) to use for the command/operation. */ layers?: LayersLike; } /** * One or more layer extensions, or an object that has one or more layer * extensions. */ export type Layers = LayersLike | HasLayers; /** * One or more basemap extensions. */ export type BasemapsLike = BasemapExtension | BasemapExtension[]; /** * An object that is convertible to basemap extension. */ export type Basemaps = BasemapsLike; /** * An object that is convertible to Esri Graphic or set of graphics. */ export type GraphicsLike = Graphic | FeatureJson | (Graphic | FeatureJson)[] | CreateGraphicsResult | EsriFeatureSet; /** * An object that has a `graphics` property. */ export interface HasGraphics { /** * Graphics to use for the command/operation. */ graphics?: GraphicsLike; } /** * An object with arguments for a command or operation that can display * temporary UI. */ export interface HasUITarget { /** * The layout ID or ItemRef to target for the command/operation. This * component will be the parent of the temporary UI that will be removed * after the command/operation completes. */ parent?: ComponentId | ModelRef; /** * Optional layout XML attributes to be used for the transient UI container. */ attributes?: Record<string, string | number | boolean | undefined>; /** * Optional icon that may be used by the transient UI container. */ icon?: string; } /** * An object that is convertible to Esri Graphic or set of graphics, or an * object that has graphics. */ export type Graphics = GraphicsLike | HasGraphics; /** * An object that is convertible to one or more geometries. */ export type GeometryLike = GeometryJson | GeometryUnion | (GeometryJson | GeometryUnion)[] | FeaturesLike | GraphicsLike; /** * An object that has a `geometry` property. */ export interface HasGeometry { /** * The geometry to use for the command/operation. */ geometry?: GeometryLike; } /** * An object that is convertible to one or more geometries, or an object that * has geometry. */ export type Geometries = GeometryLike | HasGeometry | HasFeatures; /** * An object that is convertible to an Esri Viewpoint. */ export type ViewpointLike = Viewpoint | ViewpointJson | Bookmark | BookmarkProperties; /** * An object that has a `viewpoint` property. */ export interface HasViewPoint { /** * The viewpoint to use for the command/operation. */ viewpoint?: ViewpointLike; } /** * Symbols supported for drawing. */ export type SymbolLike = SimpleMarkerSymbol | SimpleMarkerSymbolJson | PictureMarkerSymbol | PictureMarkerSymbolJson | SimpleLineSymbol | SimpleLineSymbolJson | SimpleFillSymbol | SimpleFillSymbolJson | PictureFillSymbol | PictureFillSymbolJson | PointSymbol3D | PointSymbol3DJson | LineSymbol3D | LineSymbol3DJson | PolygonSymbol3D | PolygonSymbol3DJson | TextSymbol | TextSymbolJson | CIMSymbol | CIMSymbolReferenceJson; /** * An object that has a `symbol` property. */ export interface HasSymbol { /** * The symbol to use for the command/operation. */ symbol?: SymbolLike; } /** * An object that has a `symbols`property. */ export interface HasSymbols { /** * The symbols to use for the command/operation. */ symbols?: SymbolLike | SymbolLike[]; } /** * Renderers supported for styling features. */ export type RendererLike = RendererJson | RendererUnion; /** * An object that has a `renderer` property. */ export interface HasRenderer { /** * The renderer configuration to use for the command/operation. */ renderer?: RendererLike; } /** * An object that is convertible to an Esri Viewpoint, or that has a viewpoint * property. */ export type ViewpointArg = ViewpointLike | HasViewPoint; /** * Represents raw binary data. For more information, see * https://developer.mozilla.org/en-US/docs/Web/API/Blob. */ export interface Blob { /** * The size of the blob, in bytes. */ readonly size: number; /** * The MIME type of the file, e.g. "image/png". */ readonly type: string; /** * Gets the contents of the blob as binary data contained in an ArrayBuffer. */ arrayBuffer(): Promise<ArrayBuffer>; /** * Returns a new Blob object which contains data from a subset of the blob * on which it's called. * * @param start An index into the Blob indicating the first byte to include * in the new Blob. * @param end An index into the Blob indicating the first byte that will * _not_ be included in the new Blob (i.e. the byte exactly at this index * is not included). * @param contentType The content type to assign to the new Blob; this will * be the value of its type property. The default value is an empty * string. */ slice(start?: number, end?: number, contentType?: string): Blob; /** * Returns a ReadableStream object. */ stream(): unknown; /** * Gets a string containing the contents of the blob, interpreted as UTF-8. */ text(): Promise<string>; } /** * A blob representing a file. */ export interface File extends Blob { /** * The name of the file. */ readonly name: string; } /** * A data containing object that may or may not be named. */ export type FileLike = File | Blob; /** * An object that has a `blobs` property containing data files. */ export interface HasFiles { /** * The data files to use for the command/operation. */ blobs?: FileLike[]; }