@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
509 lines (508 loc) • 15.1 kB
TypeScript
/// <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 { 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 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 {
}
/**
* Corresponds to `VertiGIS.Mobile.Infrastructure.Offline.CustomOfflineArea` in
* the VertiGIS.Mobile SDK.
*/
export interface CustomOfflineArea {
}
/**
* 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.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<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>;
}