@vertigis/viewer-spec
Version:
VertiGIS Viewer Specification
500 lines (499 loc) • 14.6 kB
TypeScript
import type Color from "@arcgis/core/Color";
import type Point from "@arcgis/core/geometry/Point";
import type SimpleLineSymbol from "@arcgis/core/symbols/SimpleLineSymbol.js";
import type { GeometryUnion } from "@arcgis/core/unionTypes.js";
import type { SpatialReferenceJson } from "@vertigis/arcgis-extensions/json/SpatialReferenceJson.js";
import type { ColorJson } from "@vertigis/arcgis-extensions/json/SymbolJson.js";
import type { Command } from "../Command.js";
import { CommandRegistry } from "../CommandRegistry.js";
import type { TimeSpan } 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 { HasMaps, Maps } from "../common.js";
import type { CoordinateTransformation } from "./map.js";
/**
* Arguments for the "geolocation.accuracy-changed" event.
*/
export interface GeolocateAccuracyChangedEventArgs {
/**
* The current geolocation accuracy, in meters.
*/
accuracy: number;
}
/**
* Arguments for the "geolocation.metadata-changed" event.
*/
export interface GeolocateMetadataChangedEventArgs {
/**
* The GNSS position metadata.
*/
nmeaProperties: NmeaProperties;
}
export interface NmeaProperties {
fixTimeUtc?: Date;
latitude?: number;
longitude?: number;
altitude?: number;
horizontalDilutionOfPrecision?: number;
verticalDilutionOfPrecision?: number;
positionDilutionOfPrecision?: number;
estimatedVerticalAccuracy?: number;
preciseVerticalAccuracy?: number;
estimatedHorizontalAccuracy?: number;
preciseHorizontalAccuracy?: number;
satellitesInView?: number;
satellitesInUse?: number;
satelliteIds?: number[];
heightOfGeoid?: number;
correctionAge?: TimeSpan;
stationId?: number;
speed?: number;
course?: number;
magneticVariation?: number;
fixQuality?: FixQuality;
fixMethod?: string;
fixMode?: GnssFixMode;
}
/**
* Current GNSS device settings.
*/
export interface GnssDeviceSettings {
}
/**
* Result for the "geolocation.get-current-state" operation.
*/
export interface GeolocateCurrentState {
/**
* Whether or not a position is actively being reported and received.
*/
isGeolocationAvailable: boolean;
/**
* Whether or not the app has been permitted to use geolocation according to
* the OS level settings.
*/
isGeolocationEnabled: boolean;
/**
* The current accuracy in meters.
*/
accuracy: number;
/**
* The current position.
*/
position: Point;
}
/**
* Arguments for the "geolocation.status-changed" event.
*/
export interface GeolocationStatusChangedEventArgs {
/**
* Indicates whether the geolocation is now enabled.
*/
isEnabled: boolean;
}
/**
* Arguments for the "geolocation.display-mode-changed" event.
*/
export interface LocationDisplayModeChangedEventArgs {
/**
* The location display mode.
*/
locationDisplayMode: GeolocateState;
}
/**
* The geolocation state / mode.
*/
export type GeolocateState = "Disabled" | "Enabled" | "Recentering" | "RecenteringAndReorienting";
/**
* Arguments for geolocation events such as "geolocation.position-acquired" and
* "geolocation.position-lost".
*/
export interface GeolocationEvent {
/**
* The GNSS source associated with the raised geolocation event. Mobile
* only.
*
* @mobileOnly
*/
gnssDeviceConnectionInfo?: GnssDeviceConnectionInfo;
}
/**
* A geolocation source.
*/
export interface GnssDeviceConnectionInfo {
/**
* Name of the GNSS device.
*/
deviceName: string;
/**
* Full name of the GNSS device.
*/
deviceFullName: string;
/**
* The type of the device. Options are Integrated, Bluetooth, USB, and
* Emulator.
*/
deviceType: GnssDeviceType;
/**
* The device settings, including the correction service's spatial
* reference, the desired datum transformation, and the device's antenna
* height.
*/
settings: GnssDeviceSettings;
}
/**
* Arguments for the geolocation.set-location-symbol command.
*/
export interface SetLocationSymbolArgs {
/**
* The color to use for the location marker's fill and the accuracy circle's
* outline.
*/
color?: Color | ColorJson | string;
/**
* The symbol to use for the outline of the location marker.
*/
outline?: SimpleLineSymbol;
/**
* The size to use for the location marker.
*/
size?: number;
/**
* The style to use for the location marker. Valid values are: circle,
* cross, diamond, square, triangle and X.
*/
style?: string;
/**
* If true, all other properties will be ignored and the location symbol
* will be reset to the default symbol.
*/
default?: boolean;
}
type GnssDeviceType = "integrated" | "bluetooth" | "usb" | "emulator";
/**
* Arguments for getting a list of geographic transformations.
*/
export interface GetTransformationArgs {
/**
* The input spatial reference to transform. For example, the spatial
* reference of a GNSS receiver. If unspecified, defaults to WGS84.
*/
inputSpatialReference?: SpatialReferenceJson;
/**
* The desired output spatial reference of the transformations. For example,
* the spatial reference of the map. If unspecified, the spatial reference
* of the first available map will be used.
*/
outputSpatialReference?: SpatialReferenceJson;
/**
* The area of interest. If provided, this will be used to order the list of
* valid transformations in order of best-fit.
*/
area?: GeometryUnion;
}
/**
* Event args for the geolocation.gnss-lock-status-changed event.
*/
export interface GnssLockStateEventArgs {
/**
* The lock status.
*/
lockStatus: GnssLockStatus;
}
/**
* Event args for the geolocation.gnss-transformation-changed event.
*/
export interface GnssDeviceTransformationOverrideEventArgs {
/**
* The WKID of the transformation.
*/
wkid: number;
/**
* The data transformation name.
*/
name: string;
}
/**
* The quality of the GNSS fix.
*/
export type FixQuality = "Invalid" | "GpsFix" | "DgpsFix" | "PpsFix" | "Rtk" | "FloatRtk" | "Estimated" | "ManualInput" | "Simulation";
/**
* The GNSS fix mode.
*/
export interface GnssFixMode {
/**
* The GPGSA fix mode.
*/
mode: GpgsaFixMode;
/**
* The display text.
*/
displayText: string;
}
/**
* Global Positioning Global navigation satellite System Agency fix mode.
*/
export type GpgsaFixMode = "NotAvailable" | "Fix2D" | "Fix3";
/**
* GNSS lock status.
*/
export type GnssLockStatus =
/**
* Good.
*/
0
/**
* UncorrectedPosition.
*/
| 1
/**
* EstimatedAccuracy.
*/
| 2
/**
* LostConnection.
*/
| 4
/**
* NoLocation.
*/
| 16
/**
* Integrated.
*/
| 32;
/**
* Event args for the geolocation.gnss-antenna-height-changed event.
*/
export interface GnssDeviceAntennaHeightEventArgs {
/**
* The antenna height.
*/
height: number;
}
export declare class GeolocationCommands extends CommandRegistry {
protected readonly _prefix = "geolocation";
/**
* Centers the map on the user's current location and keeps the location
* centered as it moves around. The maps parameter is only supported in
* VertiGIS Studio Mobile. In VertiGIS Studio Web, all maps are affected.
*/
get autoRecenter(): Command<Maps | void>;
/**
* Centers the map on the user's current location and updates the
* orientation of the map to face the direction of the device. Keeps the
* location centered as it moves around. Returns whether guiding started
* successfully. Mobile only.
*
* @mobileOnly
*/
get autoRecenterAndReorient(): Command<HasMaps>;
/**
* Show the user's location while the location is in the map's extent.
*/
get displayLocation(): Command;
/**
* Turns off geolocation.
*/
get turnOffGeolocation(): Command;
/**
* Displays the GNSS device settings view. Mobile only.
*
* @mobileOnly
*/
get displayDeviceSettings(): Command<GnssDeviceConnectionInfo>;
/**
* Displays the GNSS device metadata view. Mobile only.
*
* @mobileOnly
*/
get displayDeviceMetadata(): Command;
/**
* Displays the GNSS device selection view. Mobile only.
*
* @mobileOnly
*/
get displayDeviceSelection(): Command;
/**
* Applies a datum transformation to the current GNSS device. Mobile only.
*
* @mobileOnly
*/
get applyDatumTransformation(): Command<CoordinateTransformation | string | number | number[]>;
/**
* Modifies the location display symbol. Mobile only.
*
* @mobileOnly
*/
get setLocationSymbol(): Command<SetLocationSymbolArgs>;
}
export declare class GeolocationOperations extends OperationRegistry {
protected readonly _prefix = "geolocation";
/**
* Updates the currently active GNSS receiver. Mobile only.
*
* @mobileOnly
*/
get changeSource(): Operation<GnssDeviceConnectionInfo, void>;
/**
* Gets the currently active geolocation source. Mobile only.
*
* @mobileOnly
*/
get getActiveSource(): Operation<GnssDeviceConnectionInfo, void>;
/**
* Gets the list of currently available geolocation sources. Includes
* integrated receivers, GNSS devices, and emulators. Mobile only.
*
* @mobileOnly
*/
get getAllSources(): Operation<boolean, GnssDeviceConnectionInfo[]>;
/**
* Gets the current geolocate state.
*/
get getCurrentState(): Operation<void, GeolocateCurrentState>;
/**
* Returns whether integrated location services have been permitted via app
* or browser permissions.
*/
get getLocationPermissionsEnabled(): Operation<void, boolean>;
/**
* Returns the current user position. This Operation can block while the
* user is prompted for permission, as such it is considered best practice
* not to perform this during startup.
*/
get getPosition(): Operation<void, Point>;
/**
* Returns a list of valid coordinate transformations for given input and
* output spatial references. Mobile only.
*
* @mobileOnly
*/
get getCoordinateTransformations(): Operation<GetTransformationArgs, CoordinateTransformation[]>;
}
export declare class GeolocationEvents extends EventRegistry {
protected readonly _prefix = "geolocation";
/**
* Raised when geolocation is activated and the accuracy of geolocation
* changes.
*/
get accuracyChanged(): Event<GeolocateAccuracyChangedEventArgs>;
/**
* Raised when a GNSS receiver is active and metadata about the device or
* location change. Mobile only.
*
* @mobileOnly
*/
get metadataChanged(): Event<GeolocateMetadataChangedEventArgs>;
/**
* Raised when geolocation enters auto recenter mode. For VertiGIS Studio
* Web Viewer, the event will have no parameter (all maps are always
* affected).
*/
get autoRecenterStarted(): Event<HasMaps | void>;
/**
* Raised when the user changes the geolocation mode to
* recenter-and-reorient (updates map orientation to match device
* direction). Mobile only.
*
* @mobileOnly
*/
get autoRecenterAndReorientStarted(): Event<HasMaps>;
/**
* Raised when geolocation leaves auto recenter mode. For VertiGIS Studio
* Web Viewer, the event will have no parameter (all maps are always
* affected).
*/
get autoRecenterStopped(): Event<HasMaps | void>;
/**
* Raised when the user changes the geolocation mode to not
* recenter-and-reorient. Mobile only.
*
* @mobileOnly
*/
get autoRecenterAndReorientStopped(): Event<HasMaps>;
/**
* Raised when detection of connected GNSS receivers begins. Mobile only.
*
* @mobileOnly
*/
get gnssDeviceDetectionStarted(): Event;
/**
* Raised when detection of connected GNSS receivers ends. Mobile only.
*
* @mobileOnly
*/
get gnssDeviceDetectionStopped(): Event;
/**
* Raised when the lock status of an active GNSS device changes. Mobile
* only.
*
* @mobileOnly
*/
get gnssLockStatusChanged(): Event<GnssLockStateEventArgs>;
/**
* Raised when geolocation is activated and the user's heading changes. Web
* only.
*
* @webOnly
*/
get headingChanged(): Event<number>;
/**
* Raised when geolocation is activated and a user position has been
* received.
*/
get positionAcquired(): Event<GeolocationEvent>;
/**
* Raised when geolocation is activated and the user's position changes.
*/
get positionChanged(): Event<Point>;
/**
* Raised when geolocation is disabled, either through signal loss or being
* turned off, and a user position is not available.
*/
get positionLost(): Event<GeolocationEvent>;
/**
* Raised when the source of geolocation data is changed to a different
* source (e.g. a GNSS receiver). Mobile only.
*
* @mobileOnly
*/
get sourceChanged(): Event<GnssDeviceConnectionInfo>;
/**
* Raised when geolocation status (enabled or disabled via app permissions)
* changes.
*/
get statusChanged(): Event<GeolocationStatusChangedEventArgs>;
/**
* Raised when geolocation enters displaying location mode. Web only.
*
* @webOnly
*/
get displayLocationStarted(): Event;
/**
* Raised when geolocation leaves displaying location mode. Web only.
*
* @webOnly
*/
get displayLocationStopped(): Event;
/**
* Raised when the GNSS transformation is changed. Mobile only.
*
* @mobileOnly
*/
get transformationChanged(): Event<GnssDeviceTransformationOverrideEventArgs>;
/**
* Raised when the GNSS antenna height is changed. Mobile only.
*
* @mobileOnly
*/
get antennaHeightChanged(): Event<GnssDeviceAntennaHeightEventArgs>;
/**
* Raised when the location display mode is changed. Mobile only.
*
* @mobileOnly
*/
get locationDisplayModeChanged(): Event<LocationDisplayModeChangedEventArgs>;
}
export {};