UNPKG

@vertigis/viewer-spec

Version:

VertiGIS Viewer Specification

699 lines (698 loc) 20.2 kB
/// <reference types="esri-runtime-sdk" /> /// <reference types="dotnet-bcl" /> import type FeatureLayer from "@arcgis/core/layers/FeatureLayer"; import type Layer from "@arcgis/core/layers/Layer"; import type { GeometryUnion } from "@arcgis/core/unionTypes.js"; import type { MapExtension } from "@vertigis/arcgis-extensions/mapping/MapExtension"; import type IDictionary from "dotnet-bcl/System/Collections/Generic/IDictionary"; import type Exception from "dotnet-bcl/System/Exception"; import type FeatureTable from "esri-runtime-sdk/FeatureTable"; import type OfflineMapSyncLayerResult from "esri-runtime-sdk/OfflineMapSyncLayerResult"; import type { Command } from "../Command.js"; import { CommandRegistry } from "../CommandRegistry.js"; import type { DateTime } from "../DotNetTypes.js"; import type { Event } from "../Event.js"; import { EventRegistry } from "../EventRegistry.js"; import type { Operation } from "../Operation.js"; import { OperationRegistry } from "../OperationRegistry.js"; import type { FeaturesLike, LayersLike, MapsLike } from "../common.js"; /** * Arguments for the "offline.create-area" operation. */ export interface CreateOfflineAreaArgs { /** * The title of the custom offline map area. */ title: string; /** * The map that the custom offline map area is being created for. */ mapExtension: MapExtension; /** * The map area details that will be used to create the offline map area. */ areaDetails: CustomOfflineAreaDetails; } /** * Arguments for the "offline.get-areas" operation. */ export interface GetOfflineAreasArgs { /** * The map to look for areas from. */ mapExtension?: MapExtension; /** * Whether the operation should retrieve cached data (true), or fetch data * over the network (false). Defaults to false (fetch data over the * network). */ getCached?: boolean; } /** * Arguments for various offline commands. */ export interface OfflineCommandArgs { /** * The offline area to use. */ offlineArea: OfflineAreaBase; /** * The associated map for the offline command/operation. */ maps: MapsLike; /** * Whether a preplanned map area should update after download. Defaults to * false. */ updatePreplannedAreaOnDownload: boolean; } /** * Arguments for the "offline.area-activated" event. */ export interface AreaActivatedEventArgs { /** * The area that is now active. */ activeArea: OfflineAreaBase; /** * The area that was previously active. Can be null if there was no * previously active offline area. */ previouslyActiveArea: OfflineAreaBase; } /** * Arguments for the "offline.user-went-online" event. */ export interface UserWentOnlineEventArgs { /** * The area that was previously active. */ previouslyActiveArea: OfflineAreaBase; } /** * Arguments for events that signify the end of an offline area operation. */ export interface AreaOperationEndedEventArgs { /** * The offline area that is related to this event. */ offlineArea: OfflineAreaBase; /** * The status of the offline area related to this event. */ offlineAreaStatus: OfflineAreaStatus; } /** * Arguments for the "offline.area-edits-submit-started" event. */ export interface AreaEditsSubmitStartedEventArgs { /** * The offline area that is related to this event. */ offlineArea: OfflineAreaBase; /** * The number of add edits that are being submitted. */ adds: number; /** * The number of delete edits that are being submitted. */ deletes: number; /** * The number of update edits that are being submitted. */ updates: number; } /** * Corresponds to `VertiGIS.Mobile.Infrastructure.Offline.OfflineAreaBase` in * the VertiGIS.Mobile SDK. */ export interface OfflineAreaBase { /** * The Portal item ID of the online map this map area belongs to. */ onlineMapId: string; /** * The time this map area was last updated. */ updatedOn: DateTime; /** * The last time that this map area was activated. */ lastActivated: DateTime; /** * A text string to display to the user describing this map area's current * status. */ statusText: string; /** * The title of this map area. */ title: string; /** * A value indicating whether this map area can be removed from the list of * available areas. Returns true for custom map areas; false for preplanned * areas. */ removable: boolean; /** * The file size of the map area, in bytes. */ fileSizeInBytes: number; /** * The path to the mobile map package on the device. */ path: string; /** * The name of a sideloaded TPK to use as a basemap. May be null. */ sideloadedTilePackageName: string; /** * Whether the download of this area includes a basemap. */ includesBasemap: boolean; /** * The current OfflineAreaState of this map area. */ currentState: OfflineAreaStates; /** * The number of features which have been added to this map area and are * pending sync. */ numberOfAddedFeatures: number; /** * The number of features which have been removed from this map area and are * pending sync. */ numberOfDeletedFeatures: number; /** * The number of features which have been updated in this map area and are * pending sync. */ numberOfUpdatedFeatures: number; /** * The total number of edits pending sync; the sum of numberOfAddedFeatures, * numberOfDeletedFeatures and numberOfUpdatedFeatures. */ numberOfEditedFeatures: number; /** * A value indicating whether there are any edits pending sync in this map * area; i.e. true if numberOfEditedFeatures is greater than 0. */ hasEdits: boolean; /** * The progress of a download or sync operation in this map area. Value * ranges from 0 to 1. */ progress: number; /** * Whether this map area is currently active. */ isActive: boolean; /** * Whether this map area is currently updating or submitting edits. */ isSyncing: boolean; /** * The map that this map area belongs to. */ map: MapExtension; /** * The geometry defining this map area. */ areaOfInterest: GeometryUnion; /** * The collection of layers that failed being taken offline. */ failedLayers: string[]; /** * The collection of tables that failed being taken offline. */ failedTables: string[]; /** * The list of sources (layers and tables) that failed being taken offline; * i.e. a union of failedLayers and failedTables. */ failedSources: string[]; /** * A value indicating whether there are any of the data sources failed being * taken offline; i.e. true if failedSources count is greater than 0. */ hasFailedSources: boolean; } /** * Corresponds to `VertiGIS.Mobile.Infrastructure.Offline.CustomOfflineArea` in * the VertiGIS.Mobile SDK. */ export interface CustomOfflineArea extends OfflineAreaBase { } /** * Defines the details for the creation of a custom offline map area. */ export interface CustomOfflineAreaDetails { /** * The geometry defining this map area. */ areaOfInterest: GeometryUnion; /** * The minimum scale for the map. */ minScale: number; /** * The maximum scale for the map. */ maxScale: number; /** * Whether to include feature attachments when downloading this map area. * Defaults to false. */ includeAttachments?: boolean; /** * The name of a tile package to use as a basemap. */ basemapTilePackage?: string; /** * Whether feature layer definition expressions are used when taking feature * layers and tables offline. Defaults to false. */ isDefinitionExpressionFilterEnabled?: boolean; } /** * Corresponds to `VertiGIS.Mobile.Infrastructure.Offline.OfflineAreaStatus` in * the VertiGIS.Mobile SDK. */ export interface OfflineAreaStatus { } /** * Corresponds to `VertiGIS.Mobile.Infrastructure.Offline.OfflineAreaStates` in * the VertiGIS.Mobile SDK. This is a [flags * enum](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum#enumeration-types-as-bit-flags). */ export declare enum OfflineAreaStates { /** * Not downloaded. */ AVAILABLE_TO_DOWNLOAD = 0, /** * Downloading. */ DOWNLOADING = 1, /** * Downloaded but not active. */ DOWNLOADED = 2, /** * Active. */ ACTIVE = 4, /** * Currently updating. */ UPDATING = 8, /** * Edits are being submitted. */ SUBMITTING_EDITS = 16, /** * Deletion will begin shortly, for example after the user has confirmed a * prompt. */ DELETION_PENDING = 32, /** * Deletion is in progress. */ DELETION_IN_PROGRESS = 64, /** * Download has been triggered but has not yet started. */ DOWNLOAD_STARTING = 128, /** * Activating. */ ACTIVATING = 256, /** * Deactivating. */ DEACTIVATING = 512, /** * Processing. */ PROCESSING = 1024 } /** * Corresponds to `VertiGIS.Mobile.Infrastructure.Offline.LayerEdits` in the * VertiGIS.Mobile SDK. */ export interface LayerEdits { /** * The layer associated with the pending edits. */ layer: LayersLike; /** * The table associated with the pending edits. */ table: FeatureTable; /** * A list of pending added features. */ adds: FeaturesLike[]; /** * A list of pending deleted features. */ deletes: FeaturesLike[]; /** * A list of pending updated features. */ updates: FeaturesLike[]; } /** * Represents a result from an offline operation. */ export interface OfflineOperationResult { /** * Whether or not the operation was successful. */ success: boolean; /** * The Exception that occurred during the operation, or null if no Exception * occurred. */ error: Exception; /** * An `OfflineErrorCode` value indicating the type of error that occurred, * or null if successful. */ errorCode: OfflineErrorCode; /** * Gets a string representation of the ErrorCode enum; or null if * successful. Useful for consumption in VertiGIS Studio Workflow, instead * of having to deal with an integer value for the ErrorCode. */ errorCodeString: string; /** * A localized, end-user presentable error message, or null if the operation * was successful. */ errorMessage: string; /** * A collection of warnings that occurred during the operation that do not * necessarily mean that the operation was failed. */ warnings: string[]; /** * A collection of layer errors that occurred while downloading a map area. */ downloadLayerErrors: IDictionary<Layer, Exception>; /** * A dictionary of table errors that occurred while downloading a map area. */ downloadTableErrors: IDictionary<FeatureTable, Exception>; /** * A dictionary of layer sync results that occurred while submitting edits * on or updating a map area. */ syncLayerResults: IDictionary<FeatureLayer, OfflineMapSyncLayerResult>; /** * A dictionary of table sync results that occurred while submitting edits * on or updating a map area. */ syncTableResults: IDictionary<FeatureTable, OfflineMapSyncLayerResult>; /** * A dictionary of layer errors that occurred during a sync (submit edits or * update) operation. */ syncLayerErrors: IDictionary<FeatureLayer, Exception>; /** * A dictionary of table errors that occurred during a sync (submit edits or * update) operation. */ syncTableErrors: IDictionary<FeatureTable, Exception>; /** * An OfflineOperationResult. Can be used to capture multiple results from a * chain of offline operations. */ nextResult: OfflineOperationResult; } /** * An error code for a known offline operation error. */ export type OfflineErrorCode = /** * NETWORK_CONNECTION_REQUIRED - The operation requires network * connectivity, but the network is disconnected. */ 100 /** * PORTAL_CONNECTION_FAILURE - Failed to connect to a Portal. */ | 101 /** * ALREADY_STARTED - Job is already in progress. */ | 102 /** * EXCEPTION_THROWN - An exception was thrown. */ | 103 /** * INVALID_MAP_AREA_DATA - The downloaded map area package is invalid. */ | 104 /** * BACKGROUND_TIME_EXPIRED - The amount of allowable time spent with the app * in the background was exceeded. */ | 105 /** * MULTIPLE_ERRORS - Multiple errors occurred. */ | 106 /** * WEBMAP_REQUIRED - A web map is required, but one is not available. */ | 200 /** * WEBMAP_LOAD_FAILURE - The web map failed to load. */ | 201 /** * WEBMAP_NOT_LOADED - The web map must be loaded before the operation can * be completed. */ | 202 /** * WEBMAP_UNAUTHORIZED - Permission denied on the web map. */ | 203; export declare class OfflineCommands extends CommandRegistry { protected readonly _prefix = "offline"; /** * Cancels any create offline map area operation in progress and resets the * form used to create custom offline map areas. Mobile only. * * @mobileOnly */ get cancelCreateArea(): Command; /** * Cancels the download of the specified offline area, if it is currently in * progress. Mobile only. * * @mobileOnly */ get cancelDownload(): Command<OfflineCommandArgs>; /** * Deletes the data stored on the device for the specified offline area. If * a custom offline area is specified, and the area is not downloaded, * deletes the custom area definition instead. Mobile only. * * @mobileOnly */ get deleteArea(): Command<OfflineCommandArgs>; /** * Displays a form that allows for the creation of a custom offline map * area. Mobile only. * * @mobileOnly */ get displayCreateArea(): Command<MapExtension>; } export declare class OfflineEvents extends EventRegistry { protected readonly _prefix = "offline"; /** * Raised when an offline area is activated. Mobile only. * * @mobileOnly */ get areaActivated(): Event<AreaActivatedEventArgs>; /** * Raised when an offline area is about to be activated. Mobile only. * * @mobileOnly */ get areaActivating(): Event<OfflineAreaBase>; /** * Raised when the data for offline map area is deleted. Mobile only. * * @mobileOnly */ get areaDeleted(): Event<OfflineAreaBase>; /** * Raised when an offline area download has started. Mobile only. * * @mobileOnly */ get areaDownloadStarted(): Event<OfflineAreaBase>; /** * Raised when an offline area download is canceled by the user. Mobile * only. * * @mobileOnly */ get areaDownloadCanceled(): Event<AreaOperationEndedEventArgs>; /** * Raised when an offline area download fails. Mobile only. * * @mobileOnly */ get areaDownloadFailed(): Event<AreaOperationEndedEventArgs>; /** * Raised when an offline area download completes. Mobile only. * * @mobileOnly */ get areaDownloaded(): Event<AreaOperationEndedEventArgs>; /** * Raised when an offline area update has started. Mobile only. * * @mobileOnly */ get areaUpdateStarted(): Event<OfflineAreaBase>; /** * Raised when an offline area has been updated. Mobile only. * * @mobileOnly */ get areaUpdated(): Event<AreaOperationEndedEventArgs>; /** * Raised when an any error occurs during an offline map update. Mobile * only. * * @mobileOnly */ get areaUpdateFailed(): Event<AreaOperationEndedEventArgs>; /** * Raised when an operation to submit offline area edits has started. Mobile * only. * * @mobileOnly */ get areaEditsSubmitStarted(): Event<AreaEditsSubmitStartedEventArgs>; /** * Raised when offline area edits have been submitted and this operation is * successfully completed. Mobile only. * * @mobileOnly */ get areaEditsSubmitted(): Event<AreaOperationEndedEventArgs>; /** * Raised when any error occurs during an offline map submit edits. Mobile * only. * * @mobileOnly */ get areaEditsSubmitFailed(): Event<AreaOperationEndedEventArgs>; /** * Raised when a new custom offline map area is created. Mobile only. * * @mobileOnly */ get customAreaCreated(): Event<CustomOfflineArea>; /** * Raised when the definition of a custom map area is deleted. Mobile only. * * @mobileOnly */ get customAreaDeleted(): Event<CustomOfflineArea>; /** * Raised when a map is switched to the online map. Mobile only. * * @mobileOnly */ get userWentOnline(): Event<UserWentOnlineEventArgs>; } export declare class OfflineOperations extends OperationRegistry { protected readonly _prefix = "offline"; /** * Creates a new custom offline map area. Mobile only. * * @mobileOnly */ get createArea(): Operation<CreateOfflineAreaArgs, CustomOfflineArea>; /** * Gets a list of available offline areas for the web map. Mobile only. * * @mobileOnly */ get getAreas(): Operation<GetOfflineAreasArgs, OfflineAreaBase[]>; /** * Gets a list of available custom offline areas for the web map. Mobile * only. * * @mobileOnly */ get getCustomAreas(): Operation<MapExtension, OfflineAreaBase[]>; /** * Gets a list of layer edits for a given map area. Mobile only. * * @mobileOnly */ get getEdits(): Operation<OfflineCommandArgs, LayerEdits[]>; /** * Activates the specified offline area, replacing the map on the MapView * with the offline map associated with the specified offline area. Mobile * only. Note that exceptions during activation will be set in the result * rather than thrown. * * @mobileOnly */ get activateArea(): Operation<OfflineCommandArgs, OfflineOperationResult>; /** * Downloads the data for the specified offline area. Mobile only. Note that * exceptions during the download process will be set in the result rather * than thrown. * * @mobileOnly */ get downloadArea(): Operation<OfflineCommandArgs, OfflineOperationResult>; /** * Switches from an offline map to the online map. Mobile only. Note that * exceptions while switching to the online map will be set in the result * rather than thrown. * * @mobileOnly */ get goOnline(): Operation<OfflineCommandArgs, OfflineOperationResult>; /** * Checks whether a map area is active for the specified map, or for any map * if argument is null. Mobile only. * * @mobileOnly */ get checkForActiveArea(): Operation<MapExtension, boolean>; /** * Pushes any edits to the server that have been done in the indicated * offline map. Mobile only. Note that errors during the upload process will * be set in the result rather than thrown. * * @mobileOnly */ get submitEdits(): Operation<OfflineCommandArgs, OfflineOperationResult>; /** * Pulls down any new map changes from the server to the indicated offline * map. Mobile only. Note that errors during the update process will be set * in the result rather than thrown. * * @mobileOnly */ get updateArea(): Operation<OfflineCommandArgs, OfflineOperationResult>; }