Skip to main content
Version: v5.0

IafViewer

IafViewer overview#

The IafViewer is a React component which enables a user to interact with a digital twin model in 3D space using various tools.

This page describes how to install and import the IafViewer component and describes the range of React data props available.

Note: For a general introduction to the IafViewer, refer to the IafViewer page in the Concepts section.

Install#

npm install @invicara/iaf-viewer

Import#

import { IafViewer } from "@invicara/iaf-viewer";

Props#

Data props#

PropTypeDescriptionDefault valueRequired
toolbarSizeStringSets the size of the toolbar. Pass none, small, medium, or large.mediumNo
showToolTipBooleanEnables or disables the tool tip hover-over descriptions. Pass true or false.trueNo
sidePanelColorStringSets the side panel color. You can pass a hex code, RGB value, or a color name."#1D1D1D"No
onHoverIconColorStringSets the icon color during a mouse hover event. You can pass a hex code, RGB value, or a color name.invert(40%) sepia(86%) saturate(6224%) hue-rotate(311deg) brightness(83%) contrast(101%)No
onActiveIconColorStringSets the color of the active icon. You can pass a hex code, RGB value, or a color name.invert(40%) sepia(86%) saturate(6224%) hue-rotate(311deg) brightness(83%) contrast(101%)No
toolbarColorStringSets the toolbar color. You can pass a hex code, RGB value, or a color name."#333333"No
isShowNavCubeBooleanShows or hides the navigation cube. Pass true or false.trueNo
modelVersionIdStringPass the model's version number as a string.No
showNotificationBooleanShow or hide notificationstrueNo
enableFocusModeBooleanEnable or disable focus modetrueNo
enable2DViewerBooleanToggles the display of the 2D viewertrueNo
enableOptimizedSelectionBooleanEnables a performance-optimized algorithm that improves 2D and 3D node selection speed and prevents unnecessary rerenderingfalseNo
WorkflowStringSupports multiple animations, including animated GIFS, offers properties such as scale, rotation, and opacity to bring dynamic visuals to the interface. Allows you to specify an animation script and set the duration of a looping animation.list: [ { uuid: 1, timeInSeconds: 4.5, loop: true, script: [] } ], active: undefined // change to desired UUIDNo
modelCompositionStringSets default visibility for specific model disciplines, ensuring critical components are consistently displayed. Using a JSON object of Boolean values, this enables you to specify which components are displayed from the building model, from a selection of: structural, architectural, mechanical, electrical, plumbing, fire protection and infrastructure.initial: { Structural: false, Architectural: true, Mechanical: false, Electrical: false, Plumbing: false, FireProtection: false, Infrastructural: false, default: false }No
enablePersistenceBooleanEnables saving the IafViewer's current state to the database server. The IafViewer state could be set to Annotations, GIS data etc.trueNo
gisObjectEnables GIS mode within the IafViewer, sets the Mapbox access token to use, and specifies a callback function which allows the application to interact with the map directly. If enabled, the viewer will overlay 3D models onto a Mapbox-powered GIS map at their configured geo-locations. It supports interactive GIS operations like pan, zoom, tilt, and orbit. Existing non-GIS features in earlier versions of IafViewer will continue to work as expected. For a breakdown of the object's props, see gis.gis: { enabled: true, token: undefined, onIafMapReady: undefined}No
enablePersistenceBooleanEnables autosaving of IafViewer state to a remote database, such as annotations, GIS overlays, user-defined graphics, and view settings. When disabled, the viewer uses local browser session storage.trueNo
view3dObjectPass an object with your view3d configurations. For a breakdown of the object's props, see view3d.{ opacity: 0.5, enable: true, displayMode: EvmUtils.EVMDisplayMode.SPLIT, showToolbar: true, alignment: EvmUtils.EVMWidgetAlignment.LEFT_BOTTOM}No
view2dObjectPass an object with your view2d configurations. For a breakdown of the object's props, see view2d.{ enable: true, fullscreen: false, displayMode: EvmUtils.EVMDisplayMode.DEFAULT, showToolbar: true, alignment: EvmUtils.EVMWidgetAlignment.LEFT_TOP }No
arcgisObjectSets the configuration for the ArcGIS-based viewer inside IafViewer. Enables integration with ArcGIS 3D SceneView for rendering 3D models in geospatial context. Supports camera control, dynamic layers, feature slicing, event handling, and map readiness callbacks. For a breakdown of the object's props, see arcgis and arcgisOverview.No
arcgisOverviewObjectConfigures the ArcGIS Overview or Context View within the IafViewer. This mode is similar to the primary ArcGIS view but is designed as a top-down overview map, providing contextual navigation and control over the main ArcGIS mode. It can serve as a mini-map or secondary view for spatial orientation. When only one ArcGIS view mode is used in the IafViewer instance, either arcgis or arcgisOverview can fulfill the role, depending on use case preference. For a breakdown of the object's props, see arcgis and arcgisOverview.No
ueObjectConfigures the Unreal Engine-based view within the IafViewer. Enables rendering of 3D content using Unreal Engine technology, supporting model interaction, zoom targeting, and event-driven behaviors.No
photosphereObjectConfigures the Photosphere (360° Panoramic) view within the IafViewer. When enabled, this mode renders panoramic imagery or virtual environments, allowing users to explore scenes using rotation and zoom interaction.No
titleStringA unique string label for identifying the viewer instance in logs and debugging.undefinedNo
toolbarSizeStringSets the toolbar size. Enter small, medium, or large.mediumNo

Callback props#

PropEvent that triggers callback functionReturns
OnIsolateElementChangeCallbackThe user isolates an element in the graphics viewer when they right-click the element, then click IsolateThe ID of the isolated element
OnSelectedElementChangeCallbackThe user selects one or more elements in the graphics viewerAn updated array of the selected elements' IDs
OnResetCallbackThe user clicks the Reset buttontrue
OnHiddenElementChangeCallbackThe user hides one or more elements in the graphics viewerAn updated array of the hidden elements' IDs
saveSettingsThe user clicks the Save & Close button in the Settings pane.The IafViewer settings as a JSON object for your function to store in local storage.
OnNotificationCallbackAn info, warning or error notification event occurs.The notification as a JSON object
OnViewerReadyCallbackCallback function that triggers when the model's structure is successfully loaded and ready. This is called separately for 3D and 2D viewers. Pass '2d' or '3d' as the parameter.

Example#

import React, {useEffect} from "react";import { IafViewer } from "@invicara/iaf-viewer";
const ViewerPage = () => {
  const mySaveSettingsFunction = (settings) => {    //your function here  }
  return (    <PageTemplate>      <IafViewer         toolbarSize={"large"}        saveSettings={mySaveSettingsFunction}      />    </PageTemplate>  )}
export default ViewerPage;

Object prop breakdowns#

View3d#

PropTypeDescriptionDefault valueRequired
view3d.opacityNumberSet the 3D model's opacity between fully transparent at 0.0 to fully opaque at 1.0.1.0No
view3d.enableBooleanEnables or disables the 3D model rendering.trueNo
view3d.displayModeSystem variableDefines how the 3D viewer is displayed within the application layout using one of the following options from EvmUtils.EVMDisplayMode:
  • DEFAULT: Standard embedded mode in the layout
  • SPLIT: Viewer shares space side-by-side with another panel
  • FULLSCREEN: Viewer takes up the entire available viewport
  • FIXED: Viewer is placed in a fixed area of the screen.
EvmUtils.EVMDisplayMode.FULLSCREENNo
view3d.showToolbarBooleanShows or hides the 3D viewer toolbarfalseNo
view3d.alignmentSystem variableSpecify the viewer alignment within its container or fixed space using one of the following options from EvmUtils.EVMWidgetAlignment: LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM.EvmUtils.EVMWidgetAlignment.RIGHT_TOPNo

View2d#

PropTypeDescriptionDefault valueRequired
enableBooleanEnables or disables the 2D viewer.trueNo
fullscreenBooleanSets to true to make the 2D viewer occupy the full screen.trueNo
displayModeSystem variableDefines how the 2D viewer is displayed within the application layout using one of the following options from EvmUtils.EVMDisplayMode:
  • DEFAULT: Standard embedded mode in the layout
  • SPLIT: Viewer shares space side-by-side with another panel
  • FULLSCREEN: Viewer takes up the entire available viewport
  • FIXED: Viewer is placed in a fixed area of the screen.
EvmUtils.EVMDisplayMode.DEFAULTNo
showToolbarBooleanDisplay or hide the 2D viewer's toolbar.trueNo
alignmentSystem variableDetermines the alignment of the viewer when using display modes like SPLIT or FIXED using one of the following options from EvmUtils.EVMWidgetAlignment: LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM.EvmUtils.EVMWidgetAlignment.LEFT_TOPNo

GIS#

GIS features rely on external GIS services like Mapbox. Applications integrating GIS must:

  • Supply a valid Mapbox token (token)
  • Handle token lifecycle (generation, refresh, expiration)
  • Ensure compliance with Mapbox’s licensing, usage limits, and terms of service.
PropTypeDescriptionDefault valueRequired
enableBooleanEnables or disables GIS mode.falseNo
tokenStringThe Mapbox access token to use for GIS map initialization. This token must be a valid temporary or permanent token generated by the hosting application using its own Mapbox account and license. The viewer does not handle token generation or renewal internally. Token expiry, scope, and lifecycle must be managed by the application.undefinedNo
opacityBooleanSet the GIS map layer's opacity between fully transparent at 0.0 to fully opaque at 1.0.1.0No
onIafMapReadyBooleanA callback function triggered when the GIS map (Mapbox instance) is fully initialized. It provides a monitored proxy to the underlying Mapbox GL JS instance, allowing the application to interact with the map directly and customize GIS behavior. Typical operations within this callback:
  • Add custom map layers
  • Modify map style
  • Add navigation controls
  • Attach GIS-specific event handlers
undefinedNo
displayModeSystem variableDefines how the GIS viewer is displayed within the application layout using one of the following options from EvmUtils.EVMDisplayMode:
  • DEFAULT: Standard embedded mode in the layout
  • SPLIT: Viewer shares space side-by-side with another panel
  • FULLSCREEN: Viewer takes up the entire available viewport
  • FIXED: Viewer is placed in a fixed area of the screen.
EvmUtils.EVMDisplayMode.FULLSCREENNo
showToolbarBooleanControls the toolbar visibility in GIS mode.falseNo
alignmentSystem variableDetermines the alignment of the GIS viewer panel when using display modes like SPLIT or FIXED using one of the following options from EvmUtils.EVMWidgetAlignment: LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM.EvmUtils.EVMWidgetAlignment.RIGHT_TOPNo

Arcgis and arcgis overview#

PropTypeDescriptionDefault valueRequired
enableBooleanEnables or disables the ArcGIS view.falseNo
slicedElementsArrayList of model elements to slice or clip within the scene.falseNo
themeElementsArrayElements with visual themes or highlighting applied.[]No
layersArrayArcGIS layers to render in the viewer for example basemaps, terrain, overlays.[]No
graphicsArrayArray of graphic overlays, for example points, lines, polygons.[]No
zoomElementsArrayList of element IDs or references to zoom into on initialization.[]No
cameraObjectInitial or current camera configuration such as position, tilt, and heading.{}No
configObjectAdditional ArcGIS viewer configuration for example API keys, options.falseNo
portalUrlStringArcGIS portal URL for example, "https://gis.hlplanning.com/arcgis".undefinedNo
apiKeyStringArcGIS portal API keyundefinedNo
modelStringWeb scene ID to load for example, "6745f5a0f1df4812a26925c19fdab6f8".undefinedNo
sceneWKIDStringSpatial reference WKID for the scene for example, 102100.undefinedNo
commandArrayLegacy property for compatibility with earlier command-based configurations.[]No
eventHandlerFunctionCallback for handling interaction and system events from the ArcGIS viewer.undefinedNo
onIafMapReadyFunction (mapInstance: __ArcGISMapView__) => voidCallback invoked when the ArcGIS map instance is fully initialized. Provides access to the MapView or SceneView instance.undefinedNo
displayModeSystem variableDefines how the ArcGIS viewer is displayed within the application layout using one of the following options from EvmUtils.EVMDisplayMode:
  • DEFAULT: Standard embedded mode in the layout
  • SPLIT: Viewer shares space side-by-side with another panel
  • FULLSCREEN: Viewer takes up the entire available viewport
  • FIXED: Viewer is placed in a fixed area of the screen.
arcgis: EvmUtils.EVMDisplayMode.FULLSCREEN, arcgisOverview: EvmUtils.EVMDisplayMode.DEFAULTNo
showToolbarBooleanControls the ArcGIS toolbar visibility.trueNo
alignmentSystem variableDetermines the alignment of the GIS viewer panel when using display modes like SPLIT or FIXED using one of the following options from EvmUtils.EVMWidgetAlignment: LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM.arcgis: EvmUtils.EVMWidgetAlignment.LEFT_TOP, arcgisOverview: EvmUtils.EVMWidgetAlignment.LEFT_BOTTOMNo
  arcgis={{    enable: true,    slicedElements: ['zone-12'],    themeElements: ['sensor-critical'],    layers: ['base-terrain', 'heatmap-layer'],    graphics: [customLine, customPoint],    zoomElements: ['facility-23'],    camera: { heading: 45, tilt: 30 },    config: {       // required...      portalUrl: "https://gis.hlplanning.com/arcgis", // gis server      apiKey:    `AAPK6c81d14b0cea426f81fa5b6abb9aa0dfGZFEkccrQXsiqRmnLr1Lpk6Khj1H4cNisCMVfDH_x313UuFSGDinndbc3hr7fqVu`, // api key for above server      model:     "6745f5a0f1df4812a26925c19fdab6f8", // web scene id      sceneWKID: 102100,      // optional...      shadows: false,      groundOpacity: 1,      popUpEnabled: false,           // use GIS built in popups?      highlightOnClick: false,       // use GIS built in highlighting of elements?      highlightTheme: {        color: [255, 255, 0, 1],        haloColor: "white",        haloOpacity: 0.9,        fillOpacity: 0.2,        shadowColor: "black",        shadowOpacity: 0.5      },      // Camera position coordinates (and coordinates sent to the MMV command) are dependent on the model's coord system      // It is up to the controlling app (this app) to convert between model coordinate systems      initialCameraPosition: INITIAL_POSITION_CAMERA,      hiddenLayers: [        GIS_LAYER_NAMES.BUILDINGS_LABEL_POINTS,        GIS_LAYER_NAMES.DISTRICTS_LABEL_POINTS      ],      layerInfo: GIS_LAYERS                    },    command: [],    displayMode: EvmUtils.EVMDisplayMode.SPLIT,    showToolbar: true,    alignment: EvmUtils.EVMWidgetAlignment.RIGHT_BOTTOM,    eventHandler: (event) => {      console.log('ArcGIS event:', event);    },    onIafMapReady: (mapInstance) => {      mapInstance.setMapStyle("arcgis/light-gray");    }  }}

UE#

PropTypeDescriptionDefault valueRequired
enableBooleanEnables or disables the Unreal Engine viewer.falseNo
configObjectConfiguration object passed to the Unreal Engine runtime.Used for setting rendering options, feature toggles, or initialization parameters.falseNo
zoomElementsArrayList of element IDs or references to focus on when initializing the view.[]No
commandArrayLegacy property for compatibility with command-driven configurations.falseNo
eventHandlerFunctionCallback function to handle Unreal Engine viewer events. Used to react to user actions or system events such as selecting an object or changing a view.undefinedNo
displayModeSystem variableDefines how the Unreal Engine viewer is displayed within the application layout using one of the following options from EvmUtils.EVMDisplayMode:
  • DEFAULT: Standard embedded mode in the layout
  • SPLIT: Viewer shares space side-by-side with another panel
  • FULLSCREEN: Viewer takes up the entire available viewport
  • FIXED: Viewer is placed in a fixed area of the screen.
arcgis: EvmUtils.EVMDisplayMode.FULLSCREEN, arcgisOverview: EvmUtils.EVMDisplayMode.DEFAULTNo
showToolbarBooleanControls the Unreal Engine toolbar visibility.trueNo
alignmentSystem variableDetermines the alignment of the GIS viewer panel when using display modes like SPLIT or FIXED using one of the following options from EvmUtils.EVMWidgetAlignment: LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM.arcgis: EvmUtils.EVMWidgetAlignment.RIGHT_BOTTOM, arcgisOverview: EvmUtils.EVMWidgetAlignment.LEFT_BOTTOMNo
  ue={{    enable: true,    config: {      environment: 'industrial',      quality: 'ultra'    },    zoomElements: ['machine-42'],    command: [],    displayMode: EvmUtils.EVMDisplayMode.FULLSCREEN,    showToolbar: false,    alignment: EvmUtils.EVMWidgetAlignment.LEFT_TOP,    eventHandler: (event) => {      console.log('Unreal Engine event:', event);    }  }}

Photosphere#

PropTypeDescriptionDefault valueRequired
enableBooleanEnables or disables the Photosphere view.falseNo
configObjectConfiguration object for the Photosphere renderer, such as the image URL, viewer parameters, and initial orientation.{}No
displayModeSystem variableDefines how the Photosphere viewer is displayed within the application layout using one of the following options from EvmUtils.EVMDisplayMode:
  • DEFAULT: Standard embedded mode in the layout
  • SPLIT: Viewer shares space side-by-side with another panel
  • FULLSCREEN: Viewer takes up the entire available viewport
  • FIXED: Viewer is placed in a fixed area of the screen.
arcgis: EvmUtils.EVMDisplayMode.FULLSCREEN, arcgisOverview: EvmUtils.EVMDisplayMode.DEFAULTNo
showToolbarBooleanControls the Photosphere toolbar visibility.trueNo
alignmentSystem variableDetermines the alignment of the Photosphere viewer's panel when using display modes like SPLIT or FIXED using one of the following options from EvmUtils.EVMWidgetAlignment: LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM.arcgis: EvmUtils.EVMWidgetAlignment.RIGHT_BOTTOM, arcgisOverview: EvmUtils.EVMWidgetAlignment.RIGHT_TOPNo
photosphere={{  enable: true,  config: {    imageUrl: 'https://example.com/panorama.jpg',    initialYaw: 180  },  displayMode: EvmUtils.EVMDisplayMode.FULLSCREEN,  showToolbar: true,  alignment: EvmUtils.EVMWidgetAlignment.LEFT_BOTTOM}}