ArcGIS and IafViewer
Overview#
ArcGIS is a technology which connects locations and data using interactive maps. For more information, refer to the ArcGIS web page. This page describes how the ArcGIS Viewer is implemented in the IafViewer.
Terminology#
Is is important to understand the following terms in relation to how the IafViewer supports ArcGIS.
| Terminology | Description |
|---|---|
| Application | Your application code which consumes the IafViewer |
| IafViewer | The viewer component (IafViewer) which wraps the ArcGIS Viewer. This is the primary interface your application interacts with, via props and callbacks. |
| EVM UI Widgets | The UI components of IafViewer (viewer widgets, toolbar, controls, etc.). IafViewer props interface and UI interface drive the IafViewer state. |
| ArcGIS Viewer | The ArcGIS SceneView instance (internal to IafViewer, not directly accessed by applications). |
| ArcGIS SceneView | The ArcGIS SceneViewer renders 3D geospatial content. It is internal to the IafViewer and is accessed via the onIafMapReady callback |
Overall Architecture#
The IafViewer wraps the ArcGIS Viewer and ArcGIS SceneView. Your application then interfacts with the IafViewer via React props and callbacks.
Communication between application and IafViewer as ArcGIS#
The visibility of IafViewer's EVM UI Widgets toolbar is controlled via showToolbar.
Note the following:
- When
showToolbaris set totrue: Shows IafViewer's EVM UI Widgets toolbar (buttons for maximize, minimize, split, zoom in/out, close) - Toolbar button clicks: When EVM UI Widgets toolbar buttons are clicked, The IafViewer updates its internal state (for example,
displayMode), which is passed as props to control the ArcGIS Viewer. - 3D scene interfactions: 3D scene interactions (clicks on 3D elements, camera movements) within the ArcGIS SceneView send events from IafViewer to your application's eventHandler callback. However, ArcGIS SceneView UI widget interactions (basemap gallery, search widget, etc.) are handled internally by IafViewer and are not forwarded to the application.
- Command flow: Commands flow from your application to IafViewer when the command prop is updated.
Event handling and callbacks#
The eventHandler callback signature is:
(event: EventObject) => voidEvent object structure#
Note the event object structure below.
{ eventSourceGuid: string, // Container ID or EVM ID of the event source eventName: string, // Event name (see EvmUtils.EVM_EVENTS) payload: { // Event-specific data action?: string, // Action type (e.g., "click", "doubleclick", "mousemove") elements?: Array<{ // Array of elements involved in the event id: string, // Element identifier elementType: string, // Type of element (gis_building, district, etc.) position: { // 3D position with multiple coordinate systems x: number, y: number, z: number, latitude?: number, longitude?: number, altitude?: number }, extra?: object // Additional element-specific data }>, modifiers?: { // Keyboard modifiers shift: boolean, ctrl: boolean, alt: boolean }, screen?: { // Screen coordinates x: number, y: number, all?: { screenX: number, screenY: number, scaledScreenX: number, scaledScreenY: number, viewPortWidth: number, viewPortHeight: number } }, position?: { // Camera position (for CAMERA_UPDATE events) x: number, y: number, z: number, latitude?: number, longitude?: number, altitude?: number }, rotation?: { // Camera rotation (for CAMERA_UPDATE events) pitch: number, yaw: number, roll: number }, ready?: boolean, // For VIEWER_READY events scene?: object, // Scene instance (for VIEWER_READY events) sceneView?: object, // SceneView instance (for VIEWER_READY events) command?: object, // For COMMAND_RECEIVED events commandRefs?: string[], // Array of command reference UUIDs [key: string]: any // Additional event-specific properties }}
Available Event Names#
The available event names from EvmUtils.EVM_EVENTS are:
CAMERA_UPDATE: Camera position or rotation changedSELECTION_UPDATE: Element selection changed (click, doubleclick)POINTER_MOVE: Mouse pointer movedPOINTER_EXIT: Mouse pointer exited viewerPOINTER_ENTER: Mouse pointer entered viewerVIEWER_READY: Viewer is ready and initialized (payload.ready: true/false, payload.scene, payload.sceneView)VIEWER_BUSY: Viewer is busy processingVIEWER_ERROR: Viewer encountered an errorCOMMAND_RECEIVED: A command was received and processedLAYERS_UPDATE: Layer visibility or configuration changedGRAPHIC_ADDED: A graphic element was addedGRAPHIC_DELETED: A graphic element was deletedGRAPHIC_UPDATED: A graphic element was updated