Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Viewer3DM defines the main interface to the 3DMapping Viewer SDK. See the developer documentation at https://orbitgt.com/kb/3dmapping_sdk

Hierarchy

  • Viewer3DM

Index

Constructors

  • new Viewer3DM(applicationName: string, options: AMap<Object>): Viewer3DM
  • Create a new instance of the viewer.

    Parameters

    • applicationName: string

      the name of the application that is using the SDK.

    • options: AMap<Object>

      the map of startup options. See the various STARTUP_ values in the Constants for available startup options.

    Returns Viewer3DM

Properties

isReady: Promise<Viewer3DM>

Promise that resolves when all javascript code has been loaded and the viewer is ready for use.
Wait for this promise to resolve before calling any other methods. Polling is possible by calling the isResolved() method (with boolean result) of the promise.

onAppStateChanged: Signal<string>

Signal that is dispatched after the application state has changed.
The new state is passed as an argument. Save this state to disk and later pass it as the Constants.STARTUP_APP_STATE option in the startup options of the viewer to enable auto-login at the next start.

onFieldOfViewsChanged: Signal<string>

Signal that is dispatched after the field-of-views have changed.
A optional message is passed as an argument. Call the getFieldOfViews2D() method to fetch new map objects to display on the host reference map.

onFocusPositionChanged: Signal<Coordinate>

Signal that is dispatched after the focus position has been changed.
The new spatial position is passed as an argument (can be null if the focus has been cleared). Center (move) the host reference map to this position if it falls outside the current visible extent of the host reference map.

onFootprintsChanged: Signal<string>

Signal that is dispatched after the footprints have changed.
A optional message is passed as an argument. Call the getFootprints2D() method to fetch new map objects to display on the host reference map.

onGlobalsChanged: Signal<string>

Signal that is dispatched after the globals have changed.
A optional message is passed as an argument. Call the getGlobals() method to fetch new map objects to display on the host reference map.

onMeasureStateChanged: Signal<string>

Signal that is dispatched after the measurement has changed.
A optional message is passed as an argument. Call the getMeasureState() method to fetch new map objects (inside the measure state) to display on the host reference map.

onOverlayObjectChanged: Signal<MapObject>

Signal that is dispatched when the viewer has edited an existing overlay map object.
The updated map object is passed as an argument.

onOverlayObjectCreated: Signal<MapObject>

Signal that is dispatched when the viewer has created a new overlay map object.
The new map object is passed as an argument and it only contains geometry, in the spatialPoint or spatialLine or spatialArea property of the map object. Make sure to call the addOverlayObjects method after initializing the objectId and graphic properties like color.

onOverlayObjectDeleted: Signal<MapObject>

Signal that is dispatched when the viewer has deleted an existing overlay map object.
The deleted map object is passed as an argument.

onOverlayObjectSelected: Signal<MapObject>

Signal that is dispatched when the viewer has selected an existing overlay map object.
The selected map object is passed as an argument.

onPickPositionCancelled: Signal<string>

Signal that is dispatched when the viewer does not need the user to pick a location anymore.
A optional message is passed as an argument. Cancel any active pick function and return the host reference map to its default (pan) function.

onPickPositionRequested: Signal<string>

Signal that is dispatched when the viewer needs a location to be picked on the host reference map by the user.
A optional message is passed as an argument. When a location has been picked by the user, use the setPickPosition() method to pass it to the viewer.

onSettingChanged: Signal<string>

Signal that is dispatched when a setting changes to a new value. The changed setting is passed as an argument.

onViewVectorChanged: Signal<CoordinatePart>

Signal that is dispatched when the view position and/or direction of the view changes.
The view vector as returned by getViewVector() is passed as an argument.

onWorkspaceClosed: Signal<string>

Signal that is dispatched when the workspace is closed.

onWorkspaceOpened: Signal<string>

Signal that is dispatched when the workspace (and all resources in it) are open and ready for use.
Wait for this signal if you want to invoke actions.

onWorkspaceTimeFilterChanged: Signal<TimeSpan>

Signal that is dispatched when the workspace time filter has changed (was set or disabled). If the time filter was cleared, a null value is dispatched.

onZoomToExtent: Signal<Bounds>

Signal that is dispatched after the user requested an overview to the extent of a resource.
The spatial extent of that resource is passed as an argument. Zoom the host reference map to the given spatial extent.

Methods

  • Adds a list of objects as overlays on the viewer. A resource for holding these map objects will be added to the workspace of the viewer if it does not exist yet.

    Parameters

    Returns void

  • addView(position: Coordinate, renderMode: string, closeExistingViews: boolean): Promise<string>
  • Add a new view.

    Parameters

    • position: Coordinate

      The position we want to bring in focus. Adding a photo view will try to open the best photo to bring focus in view.

    • renderMode: string

      The render mode of the view to open. Have a look at the various RENDER_MODE_ values in the Constants class. Use RENDER_MODE_3D or RENDER_MODE_PHOTO_SPHERICAL for example.

    • closeExistingViews: boolean

      Should all existing views be closed?

    Returns Promise<string>

    Returns a promise that resolves with the viewId of the new view. The promise may fail with an Error. See the various ADD_VIEW_ERROR_ error code values in the Constants class.

  • addViewWithOptions(position: Coordinate, renderMode: string, closeExistingViews: boolean, options: AMap<Object>): Promise<string>
  • Add a new view with extra options, affecting how the view is opened.
    Examples on how to use this function are available here : https://kb.orbitgt.com/3dm_viewer_sdk:examples_js.

    Parameters

    • position: Coordinate

      The position to focus on (either 2D or 3D).

    • renderMode: string

      The render mode of the view to open. Have a look at the various RENDER_MODE_ values in the Constants class. Use RENDER_MODE_3D or RENDER_MODE_PHOTO_SPHERICAL for example.

    • closeExistingViews: boolean

      Should all existing views be closed?

    • options: AMap<Object>

      A map with options for the newly opened photo. Look at constants starting with Constants.STARTUP_.

    Returns Promise<string>

    Returns a promise that resolves with the viewId of the new view. The promise may fail with an Error. See the various ADD_VIEW_ERROR_ error code values in the Constants class.

  • clearOverlayObjects(): void
  • Clear the list of overlay objects from the viewer.

    Returns void

  • close(): void
  • Close the viewer. Closes the workspace and removes the viewer itself if possible. After calling this method, this viewer instance will not be usable anymore.

    Returns void

  • Close the session (freeing it for other users).
    Note that the workspace and its resources are not closed and an option is offered to the user to
    re-activate the session and continue interacting with the workspace if he so chooses.

    Returns Promise<string>

    returns the sessionId of the closed session or null in case the session was already closed.

  • doAction(action: string, argumentList: AList<Object>): Object
  • Perform an action. Note: This function is only for internal SDK use, application builders do not have to call it.

    Some actions are documented in the ViewerActions class.

    Parameters

    • action: string

      The action to perform.

    • argumentList: AList<Object>

      The arguments.

    Returns Object

    Returns the result.

  • Get the field-of-view map objects to display on the host reference map.
    This method should be called after the onFieldOfViewsChanged signal has been received.

    Returns AList<MapObject>

    Returns the field-of-view map objects.

  • Get the current focus position.

    Returns Coordinate

    Returns the current focus position (can be null).

  • Get the footprint map objects to display on the 2D host reference map.
    This method should be called after the onFootprintsChanged signal has been received.
    If more than 10000 photo positions are in scope of the requested bounds, photo positions won't be returned.
    If more than 10000 simplified trajectories are in scope of the requested bounds, simplified trajectories won't be returned.

    Parameters

    • viewbounds: Bounds

      the spatial bounds of the 2D host reference map.

    • scaleDenominator: number

      the scale denominator of the 2D host reference map (like 1500.0 for example).

    Returns Promise<AList<MapObject>>

    Returns a promise to the footprint objects.

  • Get the global map objects to display on the host reference map. This method should be called after the onGlobalsChanged signal has been received.

    Returns AList<MapObject>

    Returns the global map objects.

  • Get the state of the measurement and the map objects to display it on the host reference map. This method should be called after the onMeasureStateChanged signal has been received.

    Returns MeasureState

    Returns the current measure state (with embedded map objects) or null in case the measure function is not active.

  • getProperty(propertyName: string): Object
  • Get a property. Note: This function is only for internal SDK use, application builders do not have to call it.

    Parameters

    • propertyName: string

      The name of the property.

    Returns Object

    Returns the property value.

  • getResourceMetadata(resourceId: string): AMap<string>
  • Get resource metadata.</br/>

    There are 4 possible metadata fields : collection_start, collection_stop, copyright, copyright_url.

    The Collection timestamps are formatted as : 'YYYY-MM-DD hh:mm:ss' (GMT).

    Parameters

    • resourceId: string

      the resource identifier.

    Returns AMap<string>

    returns a map of metadata information.

  • getSetting(name: string): string
  • Get a viewer setting.
    See the various SETTING_ values in the Constants for available setting names.

    Parameters

    • name: string

      the name of the setting.

    Returns string

    returns the value of the setting encoded as a string.

  • Get the active view position vector.

    • First coordinate: view position
    • Second coordinate: defines the forward position (combine with view position to get forward vector).
    • Third coordinate: defines the up position (combine with view position to get up vector).
    • Fourth coordinate: defines a view position adjusted for a 90° fov view.

    All positions are returned in the SDK Communication CRS.

    Returns CoordinatePart

    Returns a CoordinatePart with 3 positions.

  • Get the workspace time filter, if set.

    Returns TimeSpan

  • Set the focus position of all Views.

    Parameters

    • position: Coordinate

      The position to focus on (either 2D or 3D).

    Returns Promise<string[]>

    Returns a promise that resolves to the list of View identifiers on success.
    On failure the Error of the first View that failed to focus is provided.
    See the various SET_FOCUS_ERROR_ error code values in the Constants class.

  • Set the focus position of all Views.
    Extra options can be provided that affect specific view types.

    Parameters

    • position: Coordinate

      The position to focus on (either 2D or 3D).

    • options: AMap<Object>

      A map with startup options to apply to all views. Supported startup options are : Constants.STARTUP_PAN, Constants.STARTUP_TILT and Constants.STARTUP_FOV.

    Returns Promise<string[]>

    Returns a promise that resolves to the list of View identifiers on success.
    On failure the Error of the first View that failed to focus is provided.
    See the various SET_FOCUS_ERROR_ error code values in the Constants class.

  • Communicate a position that was picked by the user on the host reference map to the viewer. Calling this function only has effect when it is called after the onPickPositionRequested signal has been received.

    Parameters

    • position: Coordinate

      The user-chosen position on the host reference map.

    Returns void

  • setProperty(propertyName: string, propertyValue: Object): void
  • Set a property. Note: This function is only for internal SDK use, application builders do not have to call it.

    Parameters

    • propertyName: string

      The name of the property.

    • propertyValue: Object

      The value of the property.

    Returns void

  • setSetting(name: string, value: string): void
  • Set a viewer setting.
    See the various SETTING_ values in the Constants for available setting names.

    Parameters

    • name: string

      the name of the setting.

    • value: string

      the value encoded as a string.

    Returns void

  • setSize(width: number, height: number): void
  • Update the size of the viewer when the host window has resized.

    Parameters

    • width: number

      The new width (pixels).

    • height: number

      The new height (pixels).

    Returns void

  • setWorkspaceTimeFilter(value: TimeSpan): void
  • Set the workspace time filter. Note that when calling this function, the time filter mode is also set to 'workspace'.

    Parameters

    • value: TimeSpan

      the new workspace time filter to set.

    Returns void

  • Transform a coordinate to a different CRS.

    Parameters

    • coordinate: Coordinate

      The source coordinate to transform.

    • targetCRS: string

      The target EPSG code.

    Returns Coordinate

    Coordinate The coordinate expressed in the target CRS.