@cognite/reveal 4.6.0 → 4.7.1
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/index.js +44 -40
- package/dist/index.js.map +1 -1
- package/dist/packages/360-images/src/Image360Facade.d.ts +1 -0
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +6 -0
- package/dist/packages/pointclouds/src/ClassificationHandler.d.ts +2 -0
- package/dist/packages/pointclouds/src/CognitePointCloudModel.d.ts +1 -0
- package/dist/packages/pointclouds/src/PointCloudNode.d.ts +2 -1
- package/dist/packages/tools/index.d.ts +1 -1
- package/dist/packages/tools/src/Measurement/MeasurementManager.d.ts +1 -7
- package/dist/packages/tools/src/Measurement/MeasurementTool.d.ts +5 -2
- package/dist/packages/tools/src/Measurement/types.d.ts +7 -6
- package/dist/packages/utilities/src/AsyncSequencer.d.ts +63 -0
- package/package.json +26 -26
|
@@ -13,6 +13,7 @@ export declare class Image360Facade<T> {
|
|
|
13
13
|
private readonly _image360Collections;
|
|
14
14
|
private readonly _rayCaster;
|
|
15
15
|
private readonly _image360Cache;
|
|
16
|
+
private readonly _loadSequencer;
|
|
16
17
|
get collections(): DefaultImage360Collection[];
|
|
17
18
|
set allIconsVisibility(visible: boolean);
|
|
18
19
|
set allIconsSelected(visible: boolean);
|
|
@@ -65,6 +65,10 @@ export declare class Cognite3DViewer {
|
|
|
65
65
|
private _clippingNeedsUpdate;
|
|
66
66
|
private _forceStopRendering;
|
|
67
67
|
private readonly spinner;
|
|
68
|
+
/**
|
|
69
|
+
* Enbles us to ensure models are added in the order their load is initialized.
|
|
70
|
+
*/
|
|
71
|
+
private readonly _addModelSequencer;
|
|
68
72
|
private get revealManager();
|
|
69
73
|
/**
|
|
70
74
|
* Reusable buffers used by functions in Cognite3dViewer to avoid allocations.
|
|
@@ -251,6 +255,7 @@ export declare class Cognite3DViewer {
|
|
|
251
255
|
* ```
|
|
252
256
|
*/
|
|
253
257
|
addCadModel(options: AddModelOptions): Promise<CogniteCadModel>;
|
|
258
|
+
private addCadModelWithSequencer;
|
|
254
259
|
/**
|
|
255
260
|
* Add a new pointcloud 3D model to the viewer.
|
|
256
261
|
* Call {@link Cognite3DViewer.fitCameraToModel} to see the model after the model has loaded.
|
|
@@ -267,6 +272,7 @@ export declare class Cognite3DViewer {
|
|
|
267
272
|
* ```
|
|
268
273
|
*/
|
|
269
274
|
addPointCloudModel(options: AddModelOptions): Promise<CognitePointCloudModel>;
|
|
275
|
+
private addPointCloudModelWithSequencer;
|
|
270
276
|
/**
|
|
271
277
|
* Adds a set of 360 images to the scene from the /events API in Cognite Data Fusion.
|
|
272
278
|
* @param datasource The CDF data source which holds the references to the 360 image sets.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { ClassificationInfo } from './potree-three-loader/loading/ClassificationInfo';
|
|
5
5
|
import { WellKnownAsprsPointClassCodes } from './types';
|
|
6
6
|
import { PointCloudMaterial, PointClassification } from '../../rendering';
|
|
7
|
+
import { Color } from 'three';
|
|
7
8
|
export declare class ClassificationHandler {
|
|
8
9
|
private readonly _classification;
|
|
9
10
|
private readonly _material;
|
|
@@ -18,6 +19,7 @@ export declare class ClassificationHandler {
|
|
|
18
19
|
get classes(): Array<{
|
|
19
20
|
name: string;
|
|
20
21
|
code: number;
|
|
22
|
+
color: Color;
|
|
21
23
|
}>;
|
|
22
24
|
createPointClassKey(pointClass: number | WellKnownAsprsPointClassCodes): number;
|
|
23
25
|
setClassificationAndRecompute(pointClass: number | WellKnownAsprsPointClassCodes, visible: boolean): void;
|
|
@@ -7,7 +7,7 @@ import { WellKnownAsprsPointClassCodes } from './types';
|
|
|
7
7
|
import { PointColorType, PointShape, PointSizeType } from '../../rendering';
|
|
8
8
|
import { PointCloudObjectMetadata, PointCloudObject } from '../../data-providers';
|
|
9
9
|
import { CompletePointCloudAppearance, StyledPointCloudObjectCollection } from '../../pointcloud-styling';
|
|
10
|
-
import { Matrix4, Group } from 'three';
|
|
10
|
+
import { Matrix4, Group, Color } from 'three';
|
|
11
11
|
export declare class PointCloudNode extends Group {
|
|
12
12
|
private readonly _cameraConfiguration?;
|
|
13
13
|
private readonly _octree;
|
|
@@ -72,6 +72,7 @@ export declare class PointCloudNode extends Group {
|
|
|
72
72
|
getClasses(): Array<{
|
|
73
73
|
name: string;
|
|
74
74
|
code: number | WellKnownAsprsPointClassCodes;
|
|
75
|
+
color: Color;
|
|
75
76
|
}>;
|
|
76
77
|
getBoundingBox(outBbox?: THREE.Box3): THREE.Box3;
|
|
77
78
|
setModelTransformation(matrix: THREE.Matrix4): void;
|
|
@@ -11,5 +11,5 @@ export { Keyframe } from './src/Timeline/Keyframe';
|
|
|
11
11
|
export { TimelineDateUpdateDelegate } from './src/Timeline/types';
|
|
12
12
|
export { Cognite3DViewerToolBase } from './src/Cognite3DViewerToolBase';
|
|
13
13
|
export { MeasurementTool } from './src/Measurement/MeasurementTool';
|
|
14
|
-
export { Measurement } from './src/Measurement/
|
|
14
|
+
export { Measurement } from './src/Measurement/types';
|
|
15
15
|
export { DistanceToLabelDelegate, MeasurementOptions, MeasurementAddedDelegate, MeasurementStartedDelegate, MeasurementEndedDelegate } from './src/Measurement/types';
|
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { HtmlOverlayTool } from '../HtmlOverlay/HtmlOverlayTool';
|
|
6
|
-
import { MeasurementOptions } from './types';
|
|
7
|
-
export type Measurement = {
|
|
8
|
-
readonly measurementId: number;
|
|
9
|
-
readonly startPoint: THREE.Vector3;
|
|
10
|
-
readonly endPoint: THREE.Vector3;
|
|
11
|
-
readonly distanceInMeters: number;
|
|
12
|
-
};
|
|
6
|
+
import { Measurement, MeasurementOptions } from './types';
|
|
13
7
|
export declare class MeasurementManager {
|
|
14
8
|
private readonly _measurementLabel;
|
|
15
9
|
private readonly _line;
|
|
@@ -5,8 +5,7 @@ import { Cognite3DViewer } from '../../../api';
|
|
|
5
5
|
import { Cognite3DViewerToolBase } from '../Cognite3DViewerToolBase';
|
|
6
6
|
import { DisposedDelegate } from '../../../utilities';
|
|
7
7
|
import * as THREE from 'three';
|
|
8
|
-
import { MeasurementAddedDelegate, MeasurementStartedDelegate, MeasurementEndedDelegate, MeasurementOptions } from './types';
|
|
9
|
-
import { Measurement } from './MeasurementManager';
|
|
8
|
+
import { MeasurementAddedDelegate, MeasurementStartedDelegate, MeasurementEndedDelegate, MeasurementOptions, Measurement } from './types';
|
|
10
9
|
/**
|
|
11
10
|
* Enables {@link Cognite3DViewer} to perform a point to point measurement.
|
|
12
11
|
* This can be achieved by selecting a point on the 3D Object and drag the pointer to
|
|
@@ -131,6 +130,10 @@ export declare class MeasurementTool extends Cognite3DViewerToolBase {
|
|
|
131
130
|
* @param measurement Measurement to be removed from Cognite3DViewer.
|
|
132
131
|
*/
|
|
133
132
|
removeMeasurement(measurement: Measurement): void;
|
|
133
|
+
/**
|
|
134
|
+
* Adds a measurement directly. E.g. to restore a previous state programatically
|
|
135
|
+
*/
|
|
136
|
+
addMeasurement(startPoint: THREE.Vector3, endPoint: THREE.Vector3): Measurement;
|
|
134
137
|
/**
|
|
135
138
|
* Removes all measurements from the Cognite3DViewer.
|
|
136
139
|
*/
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
+
export type Measurement = {
|
|
5
|
+
readonly measurementId: number;
|
|
6
|
+
readonly startPoint: THREE.Vector3;
|
|
7
|
+
readonly endPoint: THREE.Vector3;
|
|
8
|
+
readonly distanceInMeters: number;
|
|
9
|
+
};
|
|
4
10
|
/**
|
|
5
11
|
* Custom callback for users to change measurement label content.
|
|
6
12
|
*/
|
|
@@ -8,12 +14,7 @@ export type DistanceToLabelDelegate = (distanceInMeters: number) => string;
|
|
|
8
14
|
/**
|
|
9
15
|
* Delegate for measurement added events.
|
|
10
16
|
*/
|
|
11
|
-
export type MeasurementAddedDelegate = (
|
|
12
|
-
measurementId: number;
|
|
13
|
-
startPoint: THREE.Vector3;
|
|
14
|
-
endPoint: THREE.Vector3;
|
|
15
|
-
distanceInMeters: number;
|
|
16
|
-
}) => void;
|
|
17
|
+
export type MeasurementAddedDelegate = (measurement: Measurement) => void;
|
|
17
18
|
/**
|
|
18
19
|
* Delegate for measurement started events.
|
|
19
20
|
*/
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
export type SequencerFunction<T> = (region: () => Promise<T> | T) => Promise<T>;
|
|
5
|
+
/**
|
|
6
|
+
* AsyncSequencer - helper class for making sure a sequence of operations
|
|
7
|
+
* are performed in the same order, while permitting dependant computations
|
|
8
|
+
* to be performed in arbitrary order.
|
|
9
|
+
* See the following example of a function that loads data and puts it in an
|
|
10
|
+
* array:.
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* function loadData(id: any): Promise<void> {
|
|
14
|
+
* const result = await expensiveFetchOperation(id);
|
|
15
|
+
* this._array.push(result); // Shared array used for all retrieved data
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Calling `loadData` multiple times sequentially without awaiting may
|
|
20
|
+
* cause the retrieved data to be pushed to the array in an arbitrary order.
|
|
21
|
+
* This may be fine in some cases, but not in others.
|
|
22
|
+
* `AsyncSequencer` guarantees the order in the following way:
|
|
23
|
+
*
|
|
24
|
+
* ```
|
|
25
|
+
* const asyncSequencer = new AsyncSequencer();
|
|
26
|
+
* ...
|
|
27
|
+
* // Same function signature as before
|
|
28
|
+
* function loadData(id: any): Promise<void> {
|
|
29
|
+
*
|
|
30
|
+
* // `getNextSequencer` returns a _sequencer_ function that takes another
|
|
31
|
+
* // function (the "critical region") as input and ensures it is run
|
|
32
|
+
* // after the critical region of the previous _sequencer_ function
|
|
33
|
+
* // retrieved from the `asyncSequencer` object with `getNextSequencer`,
|
|
34
|
+
* // and before the next such sequencer's critical region
|
|
35
|
+
* const sequencer = asyncSequencer.getNextSequencer<void>();
|
|
36
|
+
*
|
|
37
|
+
* // The following line still runs and finishes at arbitrary times
|
|
38
|
+
* // across different calls to `loadData` ...
|
|
39
|
+
* const result = await expensiveFetchOperation(id);
|
|
40
|
+
*
|
|
41
|
+
* // ... However, the function given to `sequencer` will always
|
|
42
|
+
* // run in the same order as the `sequencer`s were created with
|
|
43
|
+
* // `getNextSequencer`
|
|
44
|
+
* await sequencer(() => {
|
|
45
|
+
* this._array.push(result)
|
|
46
|
+
* });
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
* Note that this approach allows `expensiveFetchOperation` to be run in parallel
|
|
50
|
+
* while still guaranteeing the order of the results.
|
|
51
|
+
* Also, be aware that if `loadData` had been declared `async`, it is not certain
|
|
52
|
+
* that the calls to `getNextSequencer` would have been in the same order as
|
|
53
|
+
* the calls to the corresponding `loadData`.
|
|
54
|
+
*/
|
|
55
|
+
export declare class AsyncSequencer {
|
|
56
|
+
private _currentPromise;
|
|
57
|
+
/**
|
|
58
|
+
* Returns a `sequencer` function that guarantees that the
|
|
59
|
+
* function it is called with is run after the previous `sequencer`'s
|
|
60
|
+
* function, and before the next one's.
|
|
61
|
+
*/
|
|
62
|
+
getNextSequencer<T>(): SequencerFunction<T>;
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.1",
|
|
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": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
],
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "yarn run clean && yarn run build:wasm && webpack --env development",
|
|
42
|
-
"build:wasm": "yarn workspaces foreach run run-wasm-pack build --target web ./wasm",
|
|
43
|
-
"build:wasm-test": "yarn workspaces foreach run run-wasm-pack build --target nodejs ./wasm",
|
|
42
|
+
"build:wasm": "yarn workspaces foreach -A run run-wasm-pack build --target web ./wasm",
|
|
43
|
+
"build:wasm-test": "yarn workspaces foreach -A run run-wasm-pack build --target nodejs ./wasm",
|
|
44
44
|
"build:watch": "yarn run clean && yarn run build:wasm && webpack --env development --watch",
|
|
45
45
|
"build:prod": "yarn run clean && yarn run build:wasm && webpack --env production",
|
|
46
46
|
"clean": "shx rm -rf dist/ && shx mkdir -p dist",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"retarget-types": "tsc-alias -p tsconfig.webpack.json -v true",
|
|
49
49
|
"test": "yarn run test:wasm && yarn run test:ts",
|
|
50
50
|
"test:ts": "yarn run build:wasm-test && cross-env NODE_OPTIONS=--experimental-vm-modules jest --maxWorkers=4",
|
|
51
|
-
"test:wasm": "yarn workspaces foreach run run-wasm-pack test --headless --chrome ./wasm",
|
|
51
|
+
"test:wasm": "yarn workspaces foreach -A run run-wasm-pack test --headless --chrome ./wasm",
|
|
52
52
|
"test:visual:client": "cross-env JEST_PUPPETEER_CONFIG=visual-tests/jest-puppeteer.config.js jest --config=visual-tests/jest.config.js --verbose",
|
|
53
53
|
"test:visual:server": "webpack-dev-server --config packages/webpack.config.js",
|
|
54
54
|
"test:visual": "yarn run build:wasm && concurrently --passthrough-arguments -k -s \"first\" \"yarn run test:visual:client {@}\" \"yarn run test:visual:server\"",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"html2canvas": "^1.4.1",
|
|
71
71
|
"lodash": "4.17.21",
|
|
72
72
|
"loglevel": "1.8.1",
|
|
73
|
-
"mixpanel-browser": "2.
|
|
73
|
+
"mixpanel-browser": "2.48.1",
|
|
74
74
|
"path-browserify": "1.0.1",
|
|
75
75
|
"random-seed": "0.3.0",
|
|
76
76
|
"rxjs": "7.8.1",
|
|
@@ -80,31 +80,31 @@
|
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@azure/msal-browser": "2.38.3",
|
|
82
82
|
"@cognite/sdk": "8.3.0",
|
|
83
|
-
"@microsoft/api-extractor": "7.38.
|
|
84
|
-
"@types/dat.gui": "0.7.
|
|
83
|
+
"@microsoft/api-extractor": "7.38.3",
|
|
84
|
+
"@types/dat.gui": "0.7.12",
|
|
85
85
|
"@types/gl": "^6.0.2",
|
|
86
86
|
"@types/glob": "8.1.0",
|
|
87
|
-
"@types/jest": "29.5.
|
|
88
|
-
"@types/jest-environment-puppeteer": "5.0.
|
|
89
|
-
"@types/jest-image-snapshot": "6.2.
|
|
90
|
-
"@types/jsdom": "21.1.
|
|
91
|
-
"@types/lodash": "4.14.
|
|
92
|
-
"@types/mixpanel-browser": "2.47.
|
|
93
|
-
"@types/node": "18.18.
|
|
94
|
-
"@types/random-seed": "0.3.
|
|
95
|
-
"@types/skmeans": "0.11.
|
|
87
|
+
"@types/jest": "29.5.10",
|
|
88
|
+
"@types/jest-environment-puppeteer": "5.0.6",
|
|
89
|
+
"@types/jest-image-snapshot": "6.2.3",
|
|
90
|
+
"@types/jsdom": "21.1.6",
|
|
91
|
+
"@types/lodash": "4.14.202",
|
|
92
|
+
"@types/mixpanel-browser": "2.47.5",
|
|
93
|
+
"@types/node": "18.18.13",
|
|
94
|
+
"@types/random-seed": "0.3.5",
|
|
95
|
+
"@types/skmeans": "0.11.7",
|
|
96
96
|
"@types/stats": "0.16.30",
|
|
97
|
-
"@types/three": "0.158.
|
|
97
|
+
"@types/three": "0.158.2",
|
|
98
98
|
"@types/tween.js": "18.5.1",
|
|
99
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
100
|
-
"@typescript-eslint/parser": "6.
|
|
99
|
+
"@typescript-eslint/eslint-plugin": "6.11.0",
|
|
100
|
+
"@typescript-eslint/parser": "6.11.0",
|
|
101
101
|
"concurrently": "8.2.2",
|
|
102
102
|
"cross-env": "7.0.3",
|
|
103
103
|
"dat.gui": "0.7.9",
|
|
104
|
-
"eslint": "8.
|
|
104
|
+
"eslint": "8.54.0",
|
|
105
105
|
"eslint-config-prettier": "9.0.0",
|
|
106
106
|
"eslint-plugin-header": "3.1.1",
|
|
107
|
-
"eslint-plugin-jsdoc": "46.
|
|
107
|
+
"eslint-plugin-jsdoc": "46.9.0",
|
|
108
108
|
"eslint-plugin-lodash": "7.4.0",
|
|
109
109
|
"eslint-plugin-prettier": "5.0.1",
|
|
110
110
|
"eslint-plugin-unused-imports": "3.0.0",
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"jest-puppeteer": "9.0.1",
|
|
122
122
|
"jsdom": "22.1.0",
|
|
123
123
|
"moq.ts": "10.0.8",
|
|
124
|
-
"nock": "13.3.
|
|
125
|
-
"prettier": "3.0
|
|
124
|
+
"nock": "13.3.8",
|
|
125
|
+
"prettier": "3.1.0",
|
|
126
126
|
"process": "0.11.10",
|
|
127
|
-
"puppeteer": "21.
|
|
127
|
+
"puppeteer": "21.5.2",
|
|
128
128
|
"random-seed": "0.3.0",
|
|
129
129
|
"raw-loader": "4.0.2",
|
|
130
130
|
"remove-files-webpack-plugin": "1.5.0",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"stats.js": "0.17.0",
|
|
134
134
|
"three": "0.158.0",
|
|
135
135
|
"ts-jest": "29.1.1",
|
|
136
|
-
"ts-loader": "9.5.
|
|
136
|
+
"ts-loader": "9.5.1",
|
|
137
137
|
"tsc-alias": "1.8.8",
|
|
138
138
|
"typescript": "5.2.2",
|
|
139
139
|
"wasm-pack": "0.12.1",
|
|
@@ -156,5 +156,5 @@
|
|
|
156
156
|
"files": [
|
|
157
157
|
"dist"
|
|
158
158
|
],
|
|
159
|
-
"packageManager": "yarn@
|
|
159
|
+
"packageManager": "yarn@4.0.2"
|
|
160
160
|
}
|