@cognite/reveal 4.0.0-dev.20221124 → 4.0.0-dev.20221128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-entry-points/core.d.ts +1 -1
- package/dist/index.js +156 -156
- package/dist/index.js.map +1 -1
- package/dist/packages/360-images/index.d.ts +1 -0
- package/dist/packages/360-images/src/Image360Entity.d.ts +15 -14
- package/dist/packages/360-images/src/Image360Icon.d.ts +4 -1
- package/dist/packages/360-images/src/Image360LoadingCache.d.ts +2 -1
- package/dist/packages/360-images/src/Image360Visualization.d.ts +22 -0
- package/dist/packages/360-images/src/Image360VisualizationBox.d.ts +21 -0
- package/dist/packages/api/src/api-helpers/Image360ApiHelper.d.ts +5 -0
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +7 -3
- package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +12 -0
- package/dist/packages/camera-manager/src/CameraManager.d.ts +17 -2
- package/dist/packages/camera-manager/src/DefaultCameraManager.d.ts +4 -14
- package/dist/packages/camera-manager/src/ProxyCameraManager.d.ts +3 -2
- package/dist/packages/camera-manager/src/StationaryCameraManager.d.ts +6 -4
- package/dist/packages/sector-parser/src/GltfSectorParser.d.ts +0 -1
- package/package.json +4 -4
- package/dist/packages/sector-parser/src/DracoDecoderHelper.d.ts +0 -32
- package/dist/packages/sector-parser/src/lib/draco_decoder_gltf.d.ts +0 -5
|
@@ -5,16 +5,15 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { SceneHandler } from '../../utilities';
|
|
6
6
|
import { Image360Descriptor, Image360FileProvider } from '../../data-providers';
|
|
7
7
|
import { Image360Icon } from './Image360Icon';
|
|
8
|
+
import { Image360Visualization } from './Image360Visualization';
|
|
8
9
|
export declare class Image360Entity {
|
|
9
10
|
private readonly _imageProvider;
|
|
10
11
|
private readonly _image360Metadata;
|
|
11
|
-
private readonly _sceneHandler;
|
|
12
12
|
private readonly _transform;
|
|
13
13
|
private readonly _image360Icon;
|
|
14
|
-
private
|
|
15
|
-
private _imageContainer;
|
|
14
|
+
private readonly _image360VisualzationBox;
|
|
16
15
|
/**
|
|
17
|
-
* Get the model-to-world transformation matrix
|
|
16
|
+
* Get a copy of the model-to-world transformation matrix
|
|
18
17
|
* of the given 360 image.
|
|
19
18
|
* @returns model-to-world transform of the 360 Image
|
|
20
19
|
*/
|
|
@@ -26,21 +25,23 @@ export declare class Image360Entity {
|
|
|
26
25
|
*/
|
|
27
26
|
get icon(): Image360Icon;
|
|
28
27
|
/**
|
|
29
|
-
*
|
|
28
|
+
* The object containing the unit cube with the 360 images.
|
|
29
|
+
* @returns Image360Visualization
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
get image360Visualization(): Image360Visualization;
|
|
32
32
|
constructor(image360Metadata: Image360Descriptor, sceneHandler: SceneHandler, imageProvider: Image360FileProvider, postTransform: THREE.Matrix4, preComputedRotation: boolean);
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Loads the 360 image (6 faces) into the visualization object.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
load360Image(): Promise<void>;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Drops the GPU resources for the 360 image
|
|
39
|
+
* the icon will be preserved.
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
unload360Image(): void;
|
|
42
|
+
/**
|
|
43
|
+
* @obvious
|
|
44
|
+
*/
|
|
45
|
+
dispose(): void;
|
|
45
46
|
private computeTransform;
|
|
46
47
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
+
import { SceneHandler } from '../../utilities';
|
|
4
5
|
import * as THREE from 'three';
|
|
5
6
|
export declare class Image360Icon extends THREE.Group {
|
|
6
7
|
private readonly MIN_PIXEL_SIZE;
|
|
7
8
|
private readonly MAX_PIXEL_SIZE;
|
|
8
9
|
private readonly _hoverSprite;
|
|
9
10
|
private readonly _outerSprite;
|
|
10
|
-
|
|
11
|
+
private readonly _sceneHandler;
|
|
12
|
+
constructor(modelToWorldTransform: THREE.Matrix4, sceneHandler: SceneHandler);
|
|
11
13
|
set hoverSpriteVisible(visible: boolean);
|
|
12
14
|
raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection<THREE.Object3D<THREE.Event>>[]): void;
|
|
15
|
+
dispose(): void;
|
|
13
16
|
private setupAdaptiveScaling;
|
|
14
17
|
private createOuterRingsSprite;
|
|
15
18
|
private createHoverSprite;
|
|
@@ -7,7 +7,8 @@ export declare class Image360LoadingCache {
|
|
|
7
7
|
private readonly _loaded360Images;
|
|
8
8
|
private readonly _inFlightEntities;
|
|
9
9
|
get cachedEntities(): Image360Entity[];
|
|
10
|
-
get currentlyLoadingEntities():
|
|
10
|
+
get currentlyLoadingEntities(): Map<Image360Entity, Promise<void>>;
|
|
11
11
|
constructor(_cacheSize?: number);
|
|
12
12
|
cachedPreload(entity: Image360Entity): Promise<void>;
|
|
13
|
+
purge(entity: Image360Entity): Promise<void>;
|
|
13
14
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
export interface Image360Visualization {
|
|
6
|
+
/**
|
|
7
|
+
* Opaqueness of the 360 image
|
|
8
|
+
*/
|
|
9
|
+
opacity: number;
|
|
10
|
+
/**
|
|
11
|
+
* Visibility of the 360 image
|
|
12
|
+
*/
|
|
13
|
+
visible: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Scale of the box containing the 360 image
|
|
16
|
+
*/
|
|
17
|
+
scale: THREE.Vector3;
|
|
18
|
+
/**
|
|
19
|
+
* Render order of the mesh containing the 360 image
|
|
20
|
+
*/
|
|
21
|
+
renderOrder: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { SceneHandler } from '../../utilities';
|
|
6
|
+
import { Image360Face } from '../../data-providers';
|
|
7
|
+
import { Image360Visualization } from './Image360Visualization';
|
|
8
|
+
export declare class Image360VisualizationBox implements Image360Visualization {
|
|
9
|
+
private readonly _worldTransform;
|
|
10
|
+
private _visualizationMesh;
|
|
11
|
+
private _faceMaterials;
|
|
12
|
+
private readonly _sceneHandler;
|
|
13
|
+
private readonly _visualizationState;
|
|
14
|
+
set opacity(alpha: number);
|
|
15
|
+
set visible(isVisible: boolean);
|
|
16
|
+
set scale(newScale: THREE.Vector3);
|
|
17
|
+
set renderOrder(newRenderOrder: number);
|
|
18
|
+
constructor(worldTransform: THREE.Matrix4, sceneHandler: SceneHandler);
|
|
19
|
+
loadImages(faces: Image360Face[]): Promise<void>;
|
|
20
|
+
unloadImages(): void;
|
|
21
|
+
}
|
|
@@ -9,6 +9,7 @@ import { ProxyCameraManager } from '../../../camera-manager';
|
|
|
9
9
|
export declare class Image360ApiHelper {
|
|
10
10
|
private readonly _image360Facade;
|
|
11
11
|
private readonly _domElement;
|
|
12
|
+
private _transitionInProgress;
|
|
12
13
|
private readonly _interactionState;
|
|
13
14
|
private readonly _domEventHandlers;
|
|
14
15
|
private readonly _requestRedraw;
|
|
@@ -19,7 +20,11 @@ export declare class Image360ApiHelper {
|
|
|
19
20
|
add360ImageSet(eventFilter: {
|
|
20
21
|
[key: string]: string;
|
|
21
22
|
}, collectionTransform: THREE.Matrix4, preMultipliedRotation: boolean): Promise<Image360Entity[]>;
|
|
23
|
+
remove360Images(entities: Image360Entity[]): Promise<void>;
|
|
22
24
|
enter360Image(image360Entity: Image360Entity): Promise<void>;
|
|
25
|
+
private transition;
|
|
26
|
+
private tweenVisualizationAlpha;
|
|
27
|
+
private set360CameraManager;
|
|
23
28
|
exit360Image(): void;
|
|
24
29
|
dispose(): void;
|
|
25
30
|
private enter360ImageOnIntersect;
|
|
@@ -178,9 +178,8 @@ export declare class Cognite3DViewer {
|
|
|
178
178
|
/**
|
|
179
179
|
* Sets the active camera manager instance for current Cognite3Dviewer.
|
|
180
180
|
* @param cameraManager Camera manager instance.
|
|
181
|
-
* @param preserveCameraState Whether to set current camera state to new camera manager.
|
|
182
181
|
*/
|
|
183
|
-
setCameraManager(cameraManager: CameraManager
|
|
182
|
+
setCameraManager(cameraManager: CameraManager): void;
|
|
184
183
|
/**
|
|
185
184
|
* Gets the current viewer state which includes the camera pose as well as applied styling.
|
|
186
185
|
* @returns JSON object containing viewer state.
|
|
@@ -248,12 +247,17 @@ export declare class Cognite3DViewer {
|
|
|
248
247
|
* @example
|
|
249
248
|
* ```js
|
|
250
249
|
* const eventFilter = { site_id: "12345" };
|
|
251
|
-
* await viewer.add360ImageSet(eventFilter);
|
|
250
|
+
* await viewer.add360ImageSet('events', eventFilter);
|
|
252
251
|
* ```
|
|
253
252
|
*/
|
|
254
253
|
add360ImageSet(datasource: 'events', eventFilter: {
|
|
255
254
|
[key: string]: string;
|
|
256
255
|
}, add360ImageOptions?: AddImage360Options): Promise<Image360Entity[]>;
|
|
256
|
+
/**
|
|
257
|
+
* Remove a set of 360 images.
|
|
258
|
+
* @param image360Entities
|
|
259
|
+
*/
|
|
260
|
+
remove360Images(...image360Entities: Image360Entity[]): Promise<void>;
|
|
257
261
|
/**
|
|
258
262
|
* Enter visualization of a 360 image.
|
|
259
263
|
* @param image360
|
|
@@ -25,6 +25,18 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
|
|
|
25
25
|
* return undefined if the model has been stored in an unsupported unit.
|
|
26
26
|
*/
|
|
27
27
|
get modelUnitToMetersFactor(): number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Sets the model visibility.
|
|
30
|
+
* @example
|
|
31
|
+
* ```js
|
|
32
|
+
* model.visible = false
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
set visible(value: boolean);
|
|
36
|
+
/**
|
|
37
|
+
* Returns the model visibility.
|
|
38
|
+
*/
|
|
39
|
+
get visible(): boolean;
|
|
28
40
|
/**
|
|
29
41
|
* The CDF model ID of the model.
|
|
30
42
|
*/
|
|
@@ -40,6 +40,21 @@ export interface CameraManager {
|
|
|
40
40
|
* @returns Camera state: position, target and rotation.
|
|
41
41
|
*/
|
|
42
42
|
getCameraState(): Required<CameraState>;
|
|
43
|
+
/**
|
|
44
|
+
* Set this manager as active and enable controls.
|
|
45
|
+
*
|
|
46
|
+
* Should update {@link CameraManager.enabled} to reflect the state of the manager.
|
|
47
|
+
* Note that this is called automatically when a new CameraManager is set on the {@link Cognite3DViewer}.
|
|
48
|
+
* @param cameraManager Previously used camera manager.
|
|
49
|
+
*/
|
|
50
|
+
activate(cameraManager?: CameraManager): void;
|
|
51
|
+
/**
|
|
52
|
+
* Deactivate this manager and disable controls.
|
|
53
|
+
*
|
|
54
|
+
* Should update {@link CameraManager.enabled} to reflect the state of the manager.
|
|
55
|
+
* Note that this is called automatically when a new CameraManager is set on the {@link Cognite3DViewer}.
|
|
56
|
+
*/
|
|
57
|
+
deactivate(): void;
|
|
43
58
|
/**
|
|
44
59
|
* Subscribes to changes of the camera event. This is used by Reveal to react on changes of the camera.
|
|
45
60
|
* @param event Name of the event.
|
|
@@ -72,7 +87,7 @@ export interface CameraManager {
|
|
|
72
87
|
*/
|
|
73
88
|
dispose(): void;
|
|
74
89
|
/**
|
|
75
|
-
*
|
|
90
|
+
* Enabled is true if this camera manager is active. When disabled, the camera manager shouldn't consume or react to any DOM events.
|
|
76
91
|
*/
|
|
77
|
-
enabled
|
|
92
|
+
enabled: boolean;
|
|
78
93
|
}
|
|
@@ -19,7 +19,7 @@ export declare class DefaultCameraManager implements CameraManager {
|
|
|
19
19
|
private readonly _raycaster;
|
|
20
20
|
private isDisposed;
|
|
21
21
|
private _nearAndFarNeedsUpdate;
|
|
22
|
-
private
|
|
22
|
+
private isEnabled;
|
|
23
23
|
private readonly _modelRaycastCallback;
|
|
24
24
|
private _onClick;
|
|
25
25
|
private _onWheel;
|
|
@@ -69,23 +69,11 @@ export declare class DefaultCameraManager implements CameraManager {
|
|
|
69
69
|
/**
|
|
70
70
|
* Sets whether camera controls through mouse, touch and keyboard are enabled.
|
|
71
71
|
*/
|
|
72
|
-
set enabled(
|
|
72
|
+
private set enabled(value);
|
|
73
73
|
/**
|
|
74
74
|
* Gets whether camera controls through mouse, touch and keyboard are enabled.
|
|
75
75
|
*/
|
|
76
76
|
get enabled(): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Sets whether camera controls through mouse, touch and keyboard are enabled.
|
|
79
|
-
* This can be useful to e.g. temporarily disable navigation when manipulating other
|
|
80
|
-
* objects in the scene or when implementing a "cinematic" viewer.
|
|
81
|
-
* @deprecated Will be removed in 4.0.0. Use {@link DefaultCameraManager.enabled} instead.
|
|
82
|
-
*/
|
|
83
|
-
set cameraControlsEnabled(enabled: boolean);
|
|
84
|
-
/**
|
|
85
|
-
* Gets whether camera controls through mouse, touch and keyboard are enabled.
|
|
86
|
-
* @deprecated Will be removed in 4.0.0. Use {@link DefaultCameraManager.enabled} instead.
|
|
87
|
-
*/
|
|
88
|
-
get cameraControlsEnabled(): boolean;
|
|
89
77
|
/**
|
|
90
78
|
* Sets whether keyboard control of the camera is enabled/disabled.
|
|
91
79
|
*/
|
|
@@ -103,6 +91,8 @@ export declare class DefaultCameraManager implements CameraManager {
|
|
|
103
91
|
* **/
|
|
104
92
|
setCameraState(state: CameraState): void;
|
|
105
93
|
getCameraState(): Required<CameraState>;
|
|
94
|
+
activate(cameraManager?: CameraManager): void;
|
|
95
|
+
deactivate(): void;
|
|
106
96
|
/**
|
|
107
97
|
* Gets current camera controls options.
|
|
108
98
|
*/
|
|
@@ -8,14 +8,15 @@ export declare class ProxyCameraManager implements CameraManager {
|
|
|
8
8
|
private readonly _cameraChangedListeners;
|
|
9
9
|
private _activeCameraManager;
|
|
10
10
|
private readonly _activeCameraEventHandler;
|
|
11
|
-
set enabled(value: boolean);
|
|
12
11
|
get enabled(): boolean;
|
|
13
12
|
get innerCameraManager(): CameraManager;
|
|
14
13
|
constructor(initialActiveCamera: CameraManager);
|
|
15
|
-
setActiveCameraManager(cameraManager: CameraManager
|
|
14
|
+
setActiveCameraManager(cameraManager: CameraManager): void;
|
|
16
15
|
getCamera(): THREE.PerspectiveCamera;
|
|
17
16
|
setCameraState(state: CameraState): void;
|
|
18
17
|
getCameraState(): Required<CameraState>;
|
|
18
|
+
activate(cameraManager?: CameraManager): void;
|
|
19
|
+
deactivate(): void;
|
|
19
20
|
on(_: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
20
21
|
off(_: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
21
22
|
fitCameraToBoundingBox(boundingBox: THREE.Box3, duration?: number | undefined, radiusFactor?: number | undefined): void;
|
|
@@ -11,17 +11,19 @@ export declare class StationaryCameraManager implements CameraManager {
|
|
|
11
11
|
private _isEnabled;
|
|
12
12
|
private _isDragging;
|
|
13
13
|
constructor(domElement: HTMLElement, camera: THREE.PerspectiveCamera);
|
|
14
|
-
set enabled(value: boolean);
|
|
15
14
|
get enabled(): boolean;
|
|
16
15
|
getCamera(): THREE.PerspectiveCamera;
|
|
17
16
|
setCameraState(state: CameraState): void;
|
|
18
17
|
getCameraState(): Required<CameraState>;
|
|
18
|
+
activate(): void;
|
|
19
|
+
deactivate(): void;
|
|
19
20
|
on(_: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
20
21
|
off(_: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
21
22
|
fitCameraToBoundingBox(boundingBox: THREE.Box3, _?: number, radiusFactor?: number): void;
|
|
23
|
+
moveTo(targetPosition: THREE.Vector3, duration?: number): Promise<void>;
|
|
22
24
|
update(_: number, boundingBox: THREE.Box3): void;
|
|
23
25
|
dispose(): void;
|
|
24
|
-
private enableDragging;
|
|
25
|
-
private disableDragging;
|
|
26
|
-
private rotateCamera;
|
|
26
|
+
private readonly enableDragging;
|
|
27
|
+
private readonly disableDragging;
|
|
28
|
+
private readonly rotateCamera;
|
|
27
29
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ParsedGeometry } from './types';
|
|
2
2
|
export declare class GltfSectorParser {
|
|
3
3
|
private readonly _glbMetadataParser;
|
|
4
|
-
private readonly _dracoDecoderHelper;
|
|
5
4
|
constructor();
|
|
6
5
|
parseSector(data: ArrayBuffer): Promise<ParsedGeometry[]>;
|
|
7
6
|
private traverseDefaultSceneNodes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.20221128",
|
|
4
4
|
"description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
|
|
5
5
|
"homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
|
|
6
6
|
"repository": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"proj4": "2.8.0",
|
|
82
82
|
"rxjs": "7.5.7",
|
|
83
83
|
"skmeans": "0.11.3",
|
|
84
|
-
"three-stdlib": "2.
|
|
84
|
+
"three-stdlib": "2.19.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@azure/msal-browser": "2.31.0",
|
|
@@ -124,9 +124,9 @@
|
|
|
124
124
|
"jest-canvas-mock": "2.4.0",
|
|
125
125
|
"jest-environment-jsdom": "29.3.1",
|
|
126
126
|
"jest-extended": "3.1.0",
|
|
127
|
-
"jest-image-snapshot": "
|
|
127
|
+
"jest-image-snapshot": "6.0.0",
|
|
128
128
|
"jest-puppeteer": "6.1.1",
|
|
129
|
-
"jsdom": "20.0.
|
|
129
|
+
"jsdom": "20.0.3",
|
|
130
130
|
"moq.ts": "9.0.2",
|
|
131
131
|
"nock": "13.2.9",
|
|
132
132
|
"prettier": "2.7.1",
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright 2022 Cognite AS
|
|
3
|
-
*/
|
|
4
|
-
import type { Mesh } from 'draco3dgltf';
|
|
5
|
-
import { GltfJson } from './types';
|
|
6
|
-
export type VertexBufferDescriptor = {
|
|
7
|
-
[key: string]: {
|
|
8
|
-
byteStride: number;
|
|
9
|
-
byteOffset: number;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export type MeshGeometryBufferDescriptor = {
|
|
13
|
-
indexBufferView: Uint16Array | Uint32Array;
|
|
14
|
-
vertexBufferView: Uint8Array;
|
|
15
|
-
vertexBufferDescriptor: VertexBufferDescriptor;
|
|
16
|
-
};
|
|
17
|
-
export declare class DracoDecoderHelper {
|
|
18
|
-
private readonly _dracoDecoderModule;
|
|
19
|
-
private readonly _dracoDataTypes;
|
|
20
|
-
constructor();
|
|
21
|
-
decodeDracoBufferToDracoMesh(dracoMeshBufferView: Int8Array): Promise<Mesh>;
|
|
22
|
-
decodeDracoMeshToGeometryBuffers(json: GltfJson, dracoMesh: Mesh, dracoAttributes: {
|
|
23
|
-
[key: string]: number;
|
|
24
|
-
}, gltfAttributes: {
|
|
25
|
-
[key: string]: number;
|
|
26
|
-
}): Promise<MeshGeometryBufferDescriptor>;
|
|
27
|
-
private decodeVertexBuffer;
|
|
28
|
-
private computeVertexBufferDescriptor;
|
|
29
|
-
private getAttributeDescriptors;
|
|
30
|
-
private decodeIndex;
|
|
31
|
-
private copyLinearToInterleaved;
|
|
32
|
-
}
|