UNPKG

@vertigis/viewer-spec

Version:

VertiGIS Viewer Specification

189 lines (188 loc) 5.24 kB
import type Viewpoint from "@arcgis/core/Viewpoint"; import type Extent from "@arcgis/core/geometry/Extent"; import type SpatialReference from "@arcgis/core/geometry/SpatialReference"; import type { PortalItemLike } from "@vertigis/arcgis-extensions/utilities/portal"; 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 } from "../common.js"; /** * A set of parameters used to run a job. */ export type JobParameters = Record<string, unknown>; /** * The export formats allowed for the layout print. */ export type LayoutExportFormats = "AIX" | "BMP" | "MF" | "EPS" | "GIF" | "JPG" | "PDF" | "PNG" | "PNG32" | "SVG" | "SVGZ" | "TGA" | "TIFF"; /** * The arguments required by the printing.run command when printing with ArcGIS * Pro layouts. */ export interface RunLayoutPrintArgs extends RunPrintArgsBase { /** * The ID of the layout item to be printed. */ layoutId: string; /** * The export format of the layout print. */ exportFormat?: LayoutExportFormats; } /** * The arguments required by the printing.run command when printing with * templates. */ export interface RunPrintArgs extends RunPrintArgsBase { /** * The WKID of the spatial reference used to draw a grid on the map(s). */ grid?: SpatialReference; } /** * The base arguments for the printing.run command. */ interface RunPrintArgsBase { /** * The map(s) to print. */ maps: MapsLike; /** * The ID of the report item. */ id?: string; /** * The title of the report. */ title?: string; /** * The portal item where the report is located. */ portalItem?: PortalItemLike; /** * The DPI with which to print. */ dpi?: number; /** * The scale of the map(s). Defaults to the map's current scale. */ scale?: number; /** * The initial extent of the 2D map(s). Defaults to the map's current * extent. If scale is provided, only the center point is used. */ extent?: Extent; /** * The initial viewpoint of the 3D map(s). Defaults to the scene's current * viewpoint. */ viewpoint?: Viewpoint; /** * The rotation of the map(s). Defaults to the map's current rotation. */ rotation?: number; /** * Additional parameters used in the print template, specified as key-value * pairs. */ parameters?: JobParameters; /** * A unique ID used to track a print job. */ instanceId?: string; } /** * Base for the Print Event Args interfaces. */ export interface PrintEventArgsBase { /** * The ID of the print template being used. */ printTemplateId: string; /** * A unique ID to track the running of this print. */ instanceId: string; } /** * Arguments for the printing.print-error event. */ export interface PrintErrorEventArgs extends PrintEventArgsBase { /** * The error message. */ message: string; /** * The HTTP status code associated with the error, if it's a HTTP error. */ errorCode?: number; } /** * Arguments for the printing.print-finished event. */ export interface PrintFinishedEventArgs extends PrintEventArgsBase { /** * The URL from which to download the print. */ downloadUrl: string; } /** * Arguments for the printing.print-progress event. */ export interface PrintProgressEventArgs extends PrintEventArgsBase { } /** * Arguments for the printing.print-preparing event. */ export interface PrintPreparingEventArgs extends PrintEventArgsBase { } /** * Arguments for the printing.print-prepared event. */ export interface PrintPreparedEventArgs extends PrintEventArgsBase { } /** * Arguments for the printing.print-started event. */ export interface PrintStartedEventArgs extends PrintEventArgsBase { } export declare class PrintCommands extends CommandRegistry { protected readonly _prefix = "printing"; /** * Run a print job with a given map and template/layout. */ get run(): Command<RunPrintArgs | RunLayoutPrintArgs>; } export declare class PrintEvents extends EventRegistry { protected readonly _prefix = "printing"; /** * Raised before a print gets prepared. * * @webOnly */ get printPreparing(): Event<PrintPreparingEventArgs>; /** * Raised when a print was prepared, but not yet started printing. * * @webOnly */ get printPrepared(): Event<PrintPreparedEventArgs>; /** * Raised when a print has started running. */ get printStarted(): Event<PrintStartedEventArgs>; /** * Raised while a print is running to provide updates on its status. */ get printProgress(): Event<PrintProgressEventArgs>; /** * Raised when a print has finished running. Event arguments include the * print download URL. */ get printFinished(): Event<PrintFinishedEventArgs>; /** * Raised when an error occurs with running a print. */ get printError(): Event<PrintErrorEventArgs>; } export {};