@cognite/reveal 4.0.0-dev.20221117 → 4.0.0-dev.20221121

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.
@@ -5,7 +5,5 @@ export { Cognite3DViewer } from './src/public/migration/Cognite3DViewer';
5
5
  export { CogniteCadModel } from '../cad-model';
6
6
  export { ViewerState, ModelState } from './src/utilities/ViewStateHelper';
7
7
  export * from './src/public/types';
8
- import * as THREE from 'three';
9
- export { THREE };
10
8
  declare const REVEAL_VERSION: string;
11
9
  export { REVEAL_VERSION };
@@ -15,7 +15,7 @@ export declare type GeometryFilter = {
15
15
  */
16
16
  boundingBox?: THREE.Box3;
17
17
  /**
18
- * When set, the geometry filter {@link boundingBox} will be considered to be in "Reveal/ThreeJS space".
18
+ * When set, the geometry filter `boundingBox` will be considered to be in "Reveal/ThreeJS space".
19
19
  * Rather than CDF space which is the default. When using Reveal space, the model transformation
20
20
  * which can be specified using {@link https://docs.cognite.com/api/v1/#operation/update3DRevisions |the CDF API},
21
21
  * or set in {@link https://fusion.cognite.com/ |Cognite Fusion}.
@@ -9,8 +9,7 @@ export { createPointCloudManager } from './src/createPointCloudManager';
9
9
  export { PointCloudBudget } from './src/PointCloudBudget';
10
10
  export { PointCloudIntersection } from './src/PointCloudIntersection';
11
11
  export { CognitePointCloudModel } from './src/CognitePointCloudModel';
12
- export { PotreeNodeWrapper } from './src/PotreeNodeWrapper';
13
- export { PotreeGroupWrapper } from './src/PotreeGroupWrapper';
12
+ export { PointCloudLoadingStateHandler } from './src/PointCloudLoadingStateHandler';
14
13
  export { PointCloudFactory } from './src/PointCloudFactory';
15
14
  export { IPointClassificationsProvider } from './src/classificationsProviders/IPointClassificationsProvider';
16
15
  export { LocalPointClassificationsProvider } from './src/classificationsProviders/LocalPointClassificationsProvider';
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2022 Cognite AS
3
+ */
4
+ import { ClassificationInfo } from './potree-three-loader/loading/ClassificationInfo';
5
+ import { WellKnownAsprsPointClassCodes } from './types';
6
+ import { PointCloudMaterial, PointClassification } from '../../rendering';
7
+ export declare class ClassificationHandler {
8
+ private readonly _classification;
9
+ private readonly _material;
10
+ private readonly _classNameToCodeMap;
11
+ constructor(material: PointCloudMaterial, classificationInfo: ClassificationInfo);
12
+ private createClassNameToCodeMap;
13
+ private createDefaultClassNameToCodeMap;
14
+ private getDefaultClassColor;
15
+ private getClassNameFromCode;
16
+ private createClassificationFromClassificationMap;
17
+ get classification(): PointClassification;
18
+ get classes(): Array<{
19
+ name: string;
20
+ code: number;
21
+ }>;
22
+ createPointClassKey(pointClass: number | WellKnownAsprsPointClassCodes): number;
23
+ setClassificationAndRecompute(pointClass: number | WellKnownAsprsPointClassCodes, visible: boolean): void;
24
+ hasClass(pointClass: number | WellKnownAsprsPointClassCodes): boolean;
25
+ isClassVisible(pointClass: number | WellKnownAsprsPointClassCodes): boolean;
26
+ }
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
- import { PotreeNodeWrapper } from './PotreeNodeWrapper';
4
+ import { PointCloudNode } from './PointCloudNode';
5
5
  import { PointCloudMetadata } from './PointCloudMetadata';
6
6
  import { PointCloudStylableObjectProvider } from '../../data-providers';
7
7
  import { IPointClassificationsProvider } from './classificationsProviders/IPointClassificationsProvider';
@@ -14,5 +14,5 @@ export declare class PointCloudFactory {
14
14
  private readonly _pointCloudMaterialManager;
15
15
  constructor(modelLoader: ModelDataProvider, pointCloudObjectProvider: PointCloudStylableObjectProvider, classificationsProvider: IPointClassificationsProvider, pointCloudMaterialManager: PointCloudMaterialManager);
16
16
  dispose(): void;
17
- createModel(modelMetadata: PointCloudMetadata): Promise<PotreeNodeWrapper>;
17
+ createModel(modelMetadata: PointCloudMetadata): Promise<PointCloudNode>;
18
18
  }
@@ -0,0 +1,33 @@
1
+ /*!
2
+ * Copyright 2021 Cognite AS
3
+ */
4
+ import { LoadingState } from '../../model-base';
5
+ import { Observable } from 'rxjs';
6
+ import { PointCloudNode } from './PointCloudNode';
7
+ /**
8
+ * Wrapper around Potree.Group with type information and
9
+ * basic functionality.
10
+ */
11
+ export declare class PointCloudLoadingStateHandler {
12
+ private _lastDrawPointBuffersHash;
13
+ private readonly _forceLoadingSubject;
14
+ private readonly _loadingObservable;
15
+ private _numNodesLoadingAfterLastRedraw;
16
+ private _numModels;
17
+ /**
18
+ * @param pollLoadingStatusInterval Controls how often the wrapper checks for loading status. Used for testing.
19
+ */
20
+ constructor(pollLoadingStatusInterval?: number);
21
+ needsRedraw(pointCloudNodes: PointCloudNode[]): boolean;
22
+ getLoadingStateObserver(): Observable<LoadingState>;
23
+ onModelAdded(): void;
24
+ onModelRemoved(): void;
25
+ resetFrameStats(): void;
26
+ private createLoadingStateObservable;
27
+ updatePointBuffersHash(pointCloudNodes: PointCloudNode[]): void;
28
+ /**
29
+ * Generates a hash for the current loaded points to allow determining if we have
30
+ * loaded data since last redraw.
31
+ */
32
+ private getPointBuffersHash;
33
+ }
@@ -6,22 +6,24 @@ import { LoadingState } from '../../model-base';
6
6
  import { PointCloudFactory } from './PointCloudFactory';
7
7
  import { PointCloudNode } from './PointCloudNode';
8
8
  import { PointCloudMetadataRepository } from './PointCloudMetadataRepository';
9
- import { PotreeGroupWrapper } from './PotreeGroupWrapper';
10
9
  import { Potree } from './potree-three-loader';
11
10
  import { Observable } from 'rxjs';
12
11
  import { ModelIdentifier } from '../../data-providers';
13
12
  import { PointCloudMaterialManager } from '../../rendering';
13
+ import { Mesh } from 'three';
14
14
  export declare class PointCloudManager {
15
15
  private readonly _pointCloudMetadataRepository;
16
16
  private readonly _pointCloudFactory;
17
17
  private readonly _materialManager;
18
- private readonly _pointCloudGroupWrapper;
18
+ private readonly _loadingStateHandler;
19
+ private readonly _potreeInstance;
20
+ private readonly _pointCloudNodes;
19
21
  private readonly _cameraSubject;
20
22
  private readonly _modelSubject;
21
23
  private readonly _budgetSubject;
22
24
  private readonly _renderer;
25
+ private _needsRedraw;
23
26
  constructor(metadataRepository: PointCloudMetadataRepository, materialManager: PointCloudMaterialManager, modelFactory: PointCloudFactory, potreeInstance: Potree, scene: THREE.Scene, renderer: THREE.WebGLRenderer);
24
- get pointCloudGroupWrapper(): PotreeGroupWrapper;
25
27
  requestRedraw(): void;
26
28
  resetRedraw(): void;
27
29
  get pointBudget(): number;
@@ -35,4 +37,5 @@ export declare class PointCloudManager {
35
37
  removeModel(node: PointCloudNode): void;
36
38
  dispose(): void;
37
39
  private loadedModelsObservable;
40
+ createDrawResetTrigger(): Mesh;
38
41
  }
@@ -3,32 +3,35 @@
3
3
  */
4
4
  import * as THREE from 'three';
5
5
  import { CameraConfiguration } from '../../utilities';
6
- import { PotreeGroupWrapper } from './PotreeGroupWrapper';
7
- import { PotreeNodeWrapper } from './PotreeNodeWrapper';
6
+ import { ClassificationInfo, PointCloudOctree, PickPoint } from './potree-three-loader';
8
7
  import { WellKnownAsprsPointClassCodes } from './types';
9
- import { PickPoint } from './potree-three-loader';
10
8
  import { PointColorType, PointShape, PointSizeType } from '../../rendering';
9
+ import { PointCloudObjectMetadata, PointCloudObject } from '../../data-providers';
11
10
  import { CompletePointCloudAppearance, StyledPointCloudObjectCollection } from '../../pointcloud-styling';
12
11
  export declare class PointCloudNode extends THREE.Group {
13
- private readonly _potreeGroup;
14
- private readonly _potreeNode;
15
12
  private readonly _cameraConfiguration?;
16
- constructor(potreeGroup: PotreeGroupWrapper, potreeNode: PotreeNodeWrapper, cameraConfiguration?: CameraConfiguration);
17
- get potreeGroup(): PotreeGroupWrapper;
18
- get potreeNode(): PotreeNodeWrapper;
13
+ private readonly _octree;
14
+ private readonly _annotations;
15
+ private readonly _classificationHandler;
16
+ private _needsRedraw;
17
+ private static readonly pickingWindowSize;
18
+ private readonly _modelIdentifier;
19
+ constructor(modelIdentifier: symbol, octree: PointCloudOctree, annotations: PointCloudObject[], classificationInfo: ClassificationInfo, cameraConfiguration?: CameraConfiguration);
20
+ get modelIdentifier(): symbol;
21
+ get octree(): PointCloudOctree;
22
+ get needsRedraw(): boolean;
23
+ resetRedraw(): void;
19
24
  get hasCameraConfiguration(): boolean;
20
25
  get cameraConfiguration(): CameraConfiguration | undefined;
21
- get needsRedraw(): boolean;
22
- requestRedraw(): void;
23
26
  get pointSize(): number;
24
27
  set pointSize(size: number);
25
28
  get pointSizeType(): PointSizeType;
26
29
  set pointSizeType(pointSizeType: PointSizeType);
27
- get visiblePointCount(): number;
28
30
  get pointColorType(): PointColorType;
29
31
  set pointColorType(type: PointColorType);
30
32
  get pointShape(): PointShape;
31
33
  set pointShape(value: PointShape);
34
+ get visiblePointCount(): number;
32
35
  /**
33
36
  * GPU-based picking allowing to get point data based on ray directing from the camera.
34
37
  * @param renderer Renderer object used for Reveal rendereing.
@@ -71,6 +74,8 @@ export declare class PointCloudNode extends THREE.Group {
71
74
  getBoundingBox(outBbox?: THREE.Box3): THREE.Box3;
72
75
  setModelTransformation(matrix: THREE.Matrix4): void;
73
76
  getModelTransformation(out?: THREE.Matrix4): THREE.Matrix4;
77
+ get stylableObjectAnnotationMetadata(): Iterable<PointCloudObjectMetadata>;
78
+ get stylableObjects(): PointCloudObject[];
74
79
  get defaultAppearance(): CompletePointCloudAppearance;
75
80
  set defaultAppearance(appearance: CompletePointCloudAppearance);
76
81
  assignStyledPointCloudObjectCollection(styledCollection: StyledPointCloudObjectCollection): void;
@@ -6,4 +6,5 @@ export * from './tree/PointCloudTree';
6
6
  export * from './Potree';
7
7
  export * from './types/types';
8
8
  export * from './version';
9
+ export * from './loading/ClassificationInfo';
9
10
  export { globalNumNodesLoading as numPointCloudNodesLoading } from './loading/globalLoadingCounter';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.0.0-dev.20221117",
3
+ "version": "4.0.0-dev.20221121",
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": {
@@ -80,7 +80,6 @@
80
80
  "proj4": "2.8.0",
81
81
  "rxjs": "7.5.7",
82
82
  "skmeans": "0.11.3",
83
- "three": "0.146.0",
84
83
  "three-stdlib": "2.17.3"
85
84
  },
86
85
  "devDependencies": {
@@ -120,9 +119,9 @@
120
119
  "glob": "8.0.3",
121
120
  "glslify-loader": "2.0.0",
122
121
  "html-webpack-plugin": "5.5.0",
123
- "jest": "29.2.2",
122
+ "jest": "29.3.1",
124
123
  "jest-canvas-mock": "2.4.0",
125
- "jest-environment-jsdom": "29.2.2",
124
+ "jest-environment-jsdom": "29.3.1",
126
125
  "jest-extended": "3.1.0",
127
126
  "jest-image-snapshot": "5.2.0",
128
127
  "jest-puppeteer": "6.1.1",
@@ -138,12 +137,13 @@
138
137
  "resize-observer-polyfill": "1.5.1",
139
138
  "shx": "0.3.4",
140
139
  "stats.js": "0.17.0",
140
+ "three": "0.146.0",
141
141
  "ts-jest": "29.0.3",
142
142
  "ts-loader": "9.4.1",
143
143
  "tsc-alias": "1.7.1",
144
144
  "typescript": "4.8.4",
145
145
  "wasm-pack": "0.10.3",
146
- "webpack": "5.74.0",
146
+ "webpack": "5.75.0",
147
147
  "webpack-cli": "4.10.0",
148
148
  "webpack-dev-server": "4.11.1",
149
149
  "webpack-node-externals": "3.0.0",
@@ -152,7 +152,8 @@
152
152
  },
153
153
  "peerDependencies": {
154
154
  "@cognite/sdk": "7.11.0",
155
- "@cognite/sdk-core": "^4.1.0"
155
+ "@cognite/sdk-core": "^4.1.0",
156
+ "three": "0.146.0"
156
157
  },
157
158
  "glslify": {
158
159
  "transform": [
@@ -1,46 +0,0 @@
1
- /*!
2
- * Copyright 2021 Cognite AS
3
- */
4
- import { LoadingState } from '../../model-base';
5
- import { Observable } from 'rxjs';
6
- import * as THREE from 'three';
7
- import { PotreeNodeWrapper } from './PotreeNodeWrapper';
8
- import { Potree, PointCloudOctree } from './potree-three-loader';
9
- /**
10
- * Wrapper around Potree.Group with type information and
11
- * basic functionality.
12
- */
13
- export declare class PotreeGroupWrapper extends THREE.Object3D {
14
- private _needsRedraw;
15
- private _lastDrawPointBuffersHash;
16
- private readonly _forceLoadingSubject;
17
- private readonly _loadingObservable;
18
- private readonly _pointClouds;
19
- get needsRedraw(): boolean;
20
- private readonly nodes;
21
- private readonly potreeGroup;
22
- private readonly _potreeInstance;
23
- private numNodesLoadingAfterLastRedraw;
24
- private numChildrenAfterLastRedraw;
25
- /**
26
- * @param potreeInstance Main instance of the Potree library in this Reveal instance
27
- * @param pollLoadingStatusInterval Controls how often the wrapper checks for loading status. Used for testing.
28
- */
29
- constructor(potreeInstance: Potree, pollLoadingStatusInterval?: number);
30
- get pointBudget(): number;
31
- set pointBudget(points: number);
32
- get pointClouds(): PointCloudOctree[];
33
- get potreeInstance(): Potree;
34
- getLoadingStateObserver(): Observable<LoadingState>;
35
- addPointCloud(node: PotreeNodeWrapper): void;
36
- removePointCloud(node: PotreeNodeWrapper): void;
37
- traversePointClouds(callback: (pointCloud: PointCloudOctree) => void): void;
38
- requestRedraw(): void;
39
- resetRedraw(): void;
40
- private createLoadingStateObservable;
41
- /**
42
- * Generates a hash for the current loaded points to allow determining if we have
43
- * loaded data since last redraw.
44
- */
45
- private get pointBuffersHash();
46
- }
@@ -1,52 +0,0 @@
1
- /*!
2
- * Copyright 2021 Cognite AS
3
- */
4
- import * as THREE from 'three';
5
- import { StyledPointCloudObjectCollection, CompletePointCloudAppearance } from '../../pointcloud-styling';
6
- import { PointCloudOctree, PickPoint } from './potree-three-loader';
7
- import { PointColorType, PointShape, PointClassification } from '../../rendering';
8
- import { WellKnownAsprsPointClassCodes } from './types';
9
- import { PointCloudObjectMetadata, PointCloudObject } from '../../data-providers';
10
- import { ClassificationInfo } from './potree-three-loader/loading/ClassificationInfo';
11
- /**
12
- * Wrapper around `Potree.PointCloudOctree` with some convenience functions.
13
- */
14
- export declare class PotreeNodeWrapper {
15
- readonly octree: PointCloudOctree;
16
- private _needsRedraw;
17
- private readonly _classification;
18
- private readonly _modelIdentifier;
19
- private static readonly pickingWindowSize;
20
- private readonly _classNameToCodeMap;
21
- private readonly _annotations;
22
- get needsRedraw(): boolean;
23
- constructor(modelIdentifier: symbol, octree: PointCloudOctree, annotations: PointCloudObject[], classificationInfo: ClassificationInfo);
24
- private createClassNameToCodeMap;
25
- private getDefaultClassColor;
26
- private createDefaultClassNameToCodeMap;
27
- private updateMaterialClassMap;
28
- get modelIdentifier(): symbol;
29
- get pointSize(): number;
30
- set pointSize(size: number);
31
- get visiblePointCount(): number;
32
- get boundingBox(): THREE.Box3;
33
- get pointColorType(): PointColorType;
34
- set pointColorType(type: PointColorType);
35
- get pointShape(): PointShape;
36
- set pointShape(shape: PointShape);
37
- get classification(): PointClassification;
38
- private getClassNameFromCode;
39
- get classes(): Array<{
40
- name: string;
41
- code: number;
42
- }>;
43
- get stylableObjectAnnotationMetadata(): Iterable<PointCloudObjectMetadata>;
44
- get stylableObjects(): PointCloudObject[];
45
- get defaultAppearance(): CompletePointCloudAppearance;
46
- set defaultAppearance(appearance: CompletePointCloudAppearance);
47
- pick(renderer: THREE.WebGLRenderer, camera: THREE.Camera, ray: THREE.Ray): PickPoint | null;
48
- assignObjectStyle(styledCollection: StyledPointCloudObjectCollection): void;
49
- createPointClassKey(pointClass: number | WellKnownAsprsPointClassCodes): number;
50
- setClassificationAndRecompute(pointClass: number | WellKnownAsprsPointClassCodes, visible: boolean): void;
51
- resetRedraw(): void;
52
- }