A composite viewer built on top of the engine, integrating 3D Viewer, Panorama Viewer, and 2D Map (OpenLayers Map) into a unified interface, enabling seamless coordination between multiple views through mode switching.
| Property | Type | Description |
|---|---|---|
id |
EntityId |
Unique entity identifier, defaults to UUID v7 auto-generation |
eventDispatcher |
EventDispatcher<CompositeViewerEventMap> |
Event dispatcher for event listening and dispatching |
componentManager |
ComponentManager<CompositeViewer> |
Component manager for managing components mounted on the Viewer |
app |
ViewerApp |
The ViewerApp instance this belongs to |
isPanoLoaded |
boolean |
Whether panorama is loaded |
gameMode |
{ type: string; model: GLTFModel | null } |
Game mode configuration (default { type: "fly", model: null }) |
currentPano |
PanoPoint | null |
Currently open panorama point (getter/setter) |
mode |
CompositeViewerMode |
Current Viewer mode (read-only) |
viewer |
Viewer | null |
3D Viewer instance (read-only) |
panoViewer |
PanoramaViewer | null |
Panorama viewer instance (read-only) |
map2d |
Map | null |
2D Map instance (read-only) |
| Parameter | Type | Required | Description |
|---|---|---|---|
app |
ViewerApp |
Yes | The ViewerApp instance this belongs to |
options.id |
EntityId |
No | Custom entity ID, auto-generates UUID v7 if not provided |
options.mode |
CompositeViewerMode |
Yes | Initial view mode |
The constructor automatically mounts the following built-in components:
BaseMapComponentLayerComponentDrawingComponentFlyThroughComponentIdentifyComponentDestroys the current CompositeViewer and removes itself from the ViewerApp.compositeViewers list.
Switches the view mode. Dispatches modeChange event during switching; if exiting from panorama mode (PANO / PANO_3D → other modes), also dispatches exitPano event and resets currentPano.
| Parameter | Type | Description |
|---|---|---|
mode |
CompositeViewerMode |
Target mode |
Adds an existing 3D Viewer instance. If one already exists, prints a warning and returns the existing instance. After adding, automatically binds the following native events and forwards them to eventDispatcher:
click → viewerClickmove → viewerMouseMoveidentify → viewerIdentify / viewerIdentifyMap / viewerIdentifyPointCloud / viewerIdentifyBimcameramoveprecise → viewerCameramoveprecisebimFeatureTypeLoad → bimFeatureTypeLoad| Parameter | Type | Description |
|---|---|---|
viewer |
Viewer |
3D Viewer instance |
Returns: Viewer — The added Viewer instance.
Creates and adds a 3D Viewer instance.
| Parameter | Type | Description |
|---|---|---|
containerId |
string |
Container element ID |
options |
ViewerOptions |
Viewer configuration options |
Returns: Viewer — The newly created Viewer instance.
Adds an existing panorama viewer instance. If one already exists, prints a warning and returns the existing instance. After adding, automatically binds the following native events and forwards them to eventDispatcher:
render → panoViewerRenderpanoLoad → panoLoadpanoClick → panoClickidentify → panoViewerIdentifypinpointStart → panoPinpointStartpinpointStop → panoPinpointStop| Parameter | Type | Description |
|---|---|---|
panoViewer |
PanoramaViewer |
Panorama viewer instance |
Returns: PanoramaViewer — The added panorama viewer instance.
Creates and adds a panorama viewer instance.
| Parameter | Type | Required | Description |
|---|---|---|---|
containerId |
string |
Yes | Container element ID |
options |
PanoViewerOptions |
No | Panorama viewer configuration options |
Returns: PanoramaViewer — The newly created panorama viewer instance.
Creates a 2D map (based on OpenLayers). Defaults to Hong Kong Lands Department basemap with EPSG:2326 projection support. Automatically monitors container size changes and updates map dimensions.
| Parameter | Type | Required | Description |
|---|---|---|---|
containerId |
string |
Yes | Container element ID |
mapUrl |
string |
No | Tile map URL template, uses default basemap if not provided |
Returns: Map | null — The created OpenLayers Map instance.
Gets the current opacity value of the panorama viewer.
Returns: number | undefined — Opacity value (0-1), returns undefined if no panorama viewer exists.
Sets the opacity of the panorama viewer. Dispatches panoOpacityChange event on success.
| Parameter | Type | Description |
|---|---|---|
opacity |
number |
Opacity value, range 0 - 1 |
Navigates to the specified panorama point. Calls loadPano on first load, switchPano on subsequent switches. Dispatches switchPano event after navigation and automatically switches to PANO mode if not already in panorama mode.
| Parameter | Type | Required | Description |
|---|---|---|---|
targetPano |
PanoPoint |
Yes | Target panorama point |
nearbyPanoList |
PanoPoint[] |
Yes | List of nearby panorama points |
config |
{ heading?: number; pitch?: number } |
No | Initial view angle configuration (only effective on first load) |
Listen via eventDispatcher.addEventListener(type, callback).
| Event Name | Trigger Condition | data Type |
|---|---|---|
modeChange |
View mode switch | CompositeViewerMode |
exitPano |
Exit panorama mode | {} |
viewerClick |
3D Viewer click | { position, obj, event } |
viewerMouseMove |
3D Viewer mouse move | { position, obj, event } |
viewerIdentify |
Feature identification (general) | { identifyData: IdentifyData } |
viewerIdentifyMap |
Map feature identification | { identifyData: IdentifyMapData } |
viewerIdentifyPointCloud |
Point cloud feature identification | { identifyData: IdentifyPointCloudData } |
viewerIdentifyBim |
BIM feature identification | { identifyData: IdentifyBimData } |
viewerCameramoveprecise |
Camera precise movement | { pos: { x, y, z, heading, pitch } } |
bimFeatureTypeLoad |
BIM feature type load | { json, id } |
panoViewerRender |
Panorama viewer render | { pos: { x, y, z, heading, pitch, fov } } |
panoLoad |
Panorama load complete | {} |
panoClick |
Panorama click | { panoId, panoViewer } |
switchPano |
Panorama switch | { panoPoint: PanoPoint } |
panoViewerIdentify |
Panorama feature identification | { featureInfo: IdentifyData } |
panoPinpointStart |
Panorama pinpoint start | {} |
panoPinpointStop |
Panorama pinpoint stop | {} |
panoOpacityChange |
Panorama opacity change | { opacity: number } |