UNPKG

@vertigis/viewer-spec

Version:

VertiGIS Viewer Specification

201 lines (200 loc) 6.54 kB
import type { AppConfig } from "../../app-config"; import type { SharedProject } from "../../app-config/web/SharedProjectsModelProperties"; import type { Command } from "../Command"; import { CommandRegistry } from "../CommandRegistry.js"; import type { Event } from "../Event"; import { EventRegistry } from "../EventRegistry.js"; import type { Operation } from "../Operation"; import { OperationRegistry } from "../OperationRegistry.js"; import type { Blob } from "../common"; /** * An object that has a `appConfig` property. */ export interface HasAppConfig { /** * The AppConfig for the command or operation. */ appConfig?: AppConfig; } /** * Arguments for the project.delete-shared command. Only available in VertiGIS * Studio Web. */ export interface DeleteSharedProjectArgs extends Partial<SharedProject> { /** * Whether to show a confirm prompt, when overwriting a shared project. * Defaults to 'true'. */ showConfirm?: boolean; } /** * Arguments for the project.show-settings command. Only available in VertiGIS * Studio Web. */ export interface ShowSharedProjectArgs extends Partial<SharedProject>, HasAppConfig { /** * Whether to create a new project. If a project is provided it will be used * as the starting point for configuration. */ createNewProject?: boolean; } /** * Arguments for the project.save-shared operation. Only available in VertiGIS * Studio Web. */ export interface SaveSharedProjectArgs extends Partial<SharedProject>, HasAppConfig { /** * Whether to show a confirm prompt, when overwriting a shared project. * Defaults to 'true'. */ showConfirm?: boolean; } export declare class ProjectCommands extends CommandRegistry { protected readonly _prefix = "project"; /** * Loads a project's app config and updates the application's current state, * accordingly. If more than one file is provided, only the first will be * loaded. Web only. * * **Example:** Add some default markup to the map and set the viewpoint by * applying `AppConfig` JSON. * * ``` * { * "schemaVersion": "1.0", * "items": [ * { * "id": "default", * "markupGraphics": [ * { * "geometry": { * "spatialReference": { * "latestWkid": 3857, * "wkid": 102100 * }, * "x": -13733817.770910433, * "y": 6177913.346701053 * }, * "symbol": { * "type": "esriSMS", * "color": [251, 43, 17, 85], * "size": 12, * "style": "esriSMSCircle", * "outline": { * "type": "esriSLS", * "color": [251, 43, 17, 255], * "width": 1.5, * "style": "esriSLSSolid" * } * }, * "attributes": { * "markupLevel": 36, * "isContrastGraphic": true, * "collection": "default", * "graphic-visible": true * } * } * ], * "viewpoint": { * "rotation": 45, * "scale": 10000, * "targetGeometry": { * "spatialReference": { * "wkid": 102100 * }, * "x": -13733546.804885864, * "y": 6177341.583529942 * } * }, * "$type": "map-extension" * } * ] * } * ``` * * @webOnly */ get load(): Command<AppConfig | HasAppConfig | SharedProject | Blob | Blob[]>; /** * Create or updates a shared project with the specified shared project * details and project config. Web only. * * @webOnly */ get saveShared(): Command<SaveSharedProjectArgs>; /** * Guard command for enabling the project.save-shared command. Web only. * * @webOnly */ get ensureCanSaveShared(): Command<SaveSharedProjectArgs>; /** * Shows a shared projects settings. Requires a shared-projects component to * be in the layout. Web only. * * @webOnly */ get showSettings(): Command<ShowSharedProjectArgs>; /** * Shows a shared projects share link. Requires a shared-projects component * to be in the layout. Web only. * * @webOnly */ get showShareLink(): Command<SharedProject>; /** * Deletes a shared project and its associated project config. Web only. * * @webOnly */ get deleteShared(): Command<DeleteSharedProjectArgs>; } export declare class ProjectOperations extends OperationRegistry { protected readonly _prefix = "project"; /** * Creates app config for a project, based on the current state of the * application. Web only. * * @webOnly */ get create(): Operation<unknown, AppConfig | HasAppConfig>; /** * Returns a Shared Project Content. Web only. * * @webOnly */ get getSharedContent(): Operation<SharedProject, HasAppConfig>; /** * Returns a url share link for the provided Shared Project. Web only. * * @webOnly */ get getShareLink(): Operation<SharedProject, string>; /** * Returns a list of Shared Projects. Web only. * * @webOnly */ get getShared(): Operation<void, SharedProject[]>; } export declare class ProjectEvents extends EventRegistry { protected readonly _prefix = "project"; /** * Raised when a project is loaded. Web only. * * @webOnly */ get loaded(): Event<SharedProject>; /** * Raised when a shared project is added. Web only. * * @webOnly */ get shareAdded(): Event<SharedProject>; /** * Raised when a shared project is removed. Web only. * * @webOnly */ get shareRemoved(): Event<SharedProject>; }