@cognite/reveal 4.28.5 → 4.28.6
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 +206 -202
- package/dist/index.js.map +1 -1
- package/dist/packages/api/src/public/RevealManager.d.ts +0 -2
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +1 -1
- package/dist/packages/cad-geometry-loaders/src/CadManager.d.ts +5 -3
- package/dist/packages/cad-geometry-loaders/src/CadModelUpdateHandler.d.ts +9 -5
- package/dist/packages/cad-model/src/CadModelFactory.d.ts +1 -1
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +2 -2
- package/dist/packages/cad-styling/index.d.ts +3 -0
- package/dist/packages/{rendering/src/rendering → cad-styling/src}/NodeAppearanceTextureBuilder.d.ts +3 -2
- package/dist/packages/pointclouds/src/potree-three-loader/Potree.d.ts +4 -0
- package/dist/packages/rendering/index.d.ts +0 -1
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +1 -2
- package/dist/packages/rendering/src/pointcloud-rendering/constants.d.ts +3 -3
- package/dist/packages/utilities/index.d.ts +2 -1
- package/dist/packages/utilities/src/batchedDebounce.d.ts +58 -0
- package/dist/packages/utilities/src/events/EventTrigger.d.ts +4 -0
- package/package.json +2 -2
- /package/dist/packages/{rendering → cad-styling}/src/transform/NodeTransformProvider.d.ts +0 -0
- /package/dist/packages/{rendering → cad-styling}/src/transform/NodeTransformTextureBuilder.d.ts +0 -0
- /package/dist/packages/{rendering → cad-styling}/src/transform/TransformOverrideBuffer.d.ts +0 -0
|
@@ -30,7 +30,6 @@ export declare class RevealManager {
|
|
|
30
30
|
private _isDisposed;
|
|
31
31
|
private readonly _subscriptions;
|
|
32
32
|
private readonly _events;
|
|
33
|
-
private readonly _updateSubject;
|
|
34
33
|
private readonly _cameraManager;
|
|
35
34
|
private readonly _onCameraChange;
|
|
36
35
|
private readonly _onCameraStop;
|
|
@@ -62,6 +61,5 @@ export declare class RevealManager {
|
|
|
62
61
|
addModel<T extends DataSourceType>(type: 'pointcloud', modelIdentifier: AddModelOptionsWithModelRevisionId<T>): Promise<PointCloudNode<T>>;
|
|
63
62
|
removeModel(type: 'cad', model: CadNode): void;
|
|
64
63
|
removeModel(type: 'pointcloud', model: PointCloudNode): void;
|
|
65
|
-
private notifyLoadingStateChanged;
|
|
66
64
|
private initLoadingStateObserver;
|
|
67
65
|
}
|
|
@@ -27,6 +27,7 @@ import { Image360Action } from '../../../../360-images/src/Image360Action';
|
|
|
27
27
|
export declare class Cognite3DViewer<DataSourceT extends DataSourceType = ClassicDataSourceType> {
|
|
28
28
|
private readonly _domElementResizeObserver;
|
|
29
29
|
private readonly _image360ApiHelper;
|
|
30
|
+
private readonly _unsubsribeOnLoading;
|
|
30
31
|
/**
|
|
31
32
|
* Returns the rendering canvas, the DOM element where the renderer draws its output.
|
|
32
33
|
*/
|
|
@@ -50,7 +51,6 @@ export declare class Cognite3DViewer<DataSourceT extends DataSourceType = Classi
|
|
|
50
51
|
private readonly _dataSource;
|
|
51
52
|
private readonly _sceneHandler;
|
|
52
53
|
private readonly _activeCameraManager;
|
|
53
|
-
private readonly _subscription;
|
|
54
54
|
private readonly _revealManagerHelper;
|
|
55
55
|
private readonly _domElement;
|
|
56
56
|
private readonly _renderer;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { Observable } from 'rxjs';
|
|
6
5
|
import { CadModelMetadata } from '../../cad-parsers';
|
|
7
6
|
import { CadModelUpdateHandler } from './CadModelUpdateHandler';
|
|
8
7
|
import { LoadingState } from '../../model-base';
|
|
@@ -15,9 +14,11 @@ export declare class CadManager {
|
|
|
15
14
|
private readonly _cadModelFactory;
|
|
16
15
|
private readonly _cadModelUpdateHandler;
|
|
17
16
|
private readonly _cadModelMap;
|
|
18
|
-
private readonly
|
|
17
|
+
private readonly _unsubscribeConsumedSectors;
|
|
18
|
+
private readonly _unsubscribeLoadingState;
|
|
19
19
|
private _compatibleFileFormat;
|
|
20
20
|
private _needsRedraw;
|
|
21
|
+
private readonly _loadingStateChangedTrigger;
|
|
21
22
|
private readonly _markNeedsRedrawBound;
|
|
22
23
|
private readonly _materialsChangedListener;
|
|
23
24
|
private readonly _sectorBufferTime;
|
|
@@ -42,7 +43,8 @@ export declare class CadManager {
|
|
|
42
43
|
updateModelCompatibilityFormat(modelMetadata: CadModelMetadata): void;
|
|
43
44
|
addModel(modelIdentifier: ModelIdentifier, geometryFilter?: GeometryFilter): Promise<CadNode>;
|
|
44
45
|
removeModel(model: CadNode): void;
|
|
45
|
-
|
|
46
|
+
on(event: 'loadingStateChanged', listener: (loadingState: LoadingState) => void): void;
|
|
47
|
+
off(event: 'loadingStateChanged', listener: (loadingState: LoadingState) => void): void;
|
|
46
48
|
/**
|
|
47
49
|
* Sets the Memory Cache size for all loaded models to the current budget
|
|
48
50
|
* @param budget The budget to calculate cache size by
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
+
import { EventTrigger, type EventListener } from '../../utilities';
|
|
5
6
|
import { ConsumedSector } from '../../cad-parsers';
|
|
6
|
-
import { Observable } from 'rxjs';
|
|
7
7
|
import { SectorCuller } from './sector/culling/SectorCuller';
|
|
8
8
|
import { CadLoadingHints } from './CadLoadingHints';
|
|
9
9
|
import { LoadingState } from '../../model-base';
|
|
10
10
|
import { CadModelBudget } from './CadModelBudget';
|
|
11
11
|
import { SectorLoadingSpent } from './sector/culling/types';
|
|
12
12
|
import { CadNode } from '../../cad-model';
|
|
13
|
+
type CadModelUpdateHandlerEvents = {
|
|
14
|
+
onNewConsumedSector: EventTrigger<(consumedSector: ConsumedSector) => void>;
|
|
15
|
+
onLoadingStateChanged: EventTrigger<(loadingState: LoadingState) => void>;
|
|
16
|
+
};
|
|
13
17
|
export declare class CadModelUpdateHandler {
|
|
14
18
|
private readonly _sectorCuller;
|
|
15
19
|
private readonly _modelStateHandler;
|
|
@@ -22,8 +26,8 @@ export declare class CadModelUpdateHandler {
|
|
|
22
26
|
private readonly _prioritizedLoadingHintsSubject;
|
|
23
27
|
private readonly _modelSubject;
|
|
24
28
|
private readonly _budgetSubject;
|
|
25
|
-
private readonly
|
|
26
|
-
private
|
|
29
|
+
private readonly _consumedSectorSubscription;
|
|
30
|
+
private readonly _events;
|
|
27
31
|
constructor(sectorCuller: SectorCuller, continuousModelStreaming?: boolean);
|
|
28
32
|
dispose(): void;
|
|
29
33
|
updateCamera(camera: THREE.PerspectiveCamera, cameraInMotion: boolean): void;
|
|
@@ -35,8 +39,7 @@ export declare class CadModelUpdateHandler {
|
|
|
35
39
|
removeModel(model: CadNode): void;
|
|
36
40
|
updateLoadingHints(cadLoadingHints: CadLoadingHints): void;
|
|
37
41
|
private updatePrioritizedAreas;
|
|
38
|
-
|
|
39
|
-
getLoadingStateObserver(): Observable<LoadingState>;
|
|
42
|
+
on<EventKey extends keyof CadModelUpdateHandlerEvents>(event: EventKey, listener: EventListener<CadModelUpdateHandlerEvents, EventKey>): () => void;
|
|
40
43
|
reportNewSectorsLoaded(loadedCountChange: number): void;
|
|
41
44
|
/**
|
|
42
45
|
* When loading hints of a CAD model changes, propagate the event down to the stream and either add or remove
|
|
@@ -44,3 +47,4 @@ export declare class CadModelUpdateHandler {
|
|
|
44
47
|
*/
|
|
45
48
|
private loadingModelObservable;
|
|
46
49
|
}
|
|
50
|
+
export {};
|
|
@@ -10,7 +10,7 @@ export declare class CadModelFactory {
|
|
|
10
10
|
private _gltfSectorRepository;
|
|
11
11
|
constructor(materialManager: CadMaterialManager, modelMetadataProvider: ModelMetadataProvider, modelDataProvider: ModelDataProvider);
|
|
12
12
|
loadModelMetadata(externalModelIdentifier: ModelIdentifier): Promise<CadModelMetadata>;
|
|
13
|
-
createModel(metadata: CadModelMetadata, geometryFilter?: GeometryFilter):
|
|
13
|
+
createModel(metadata: CadModelMetadata, geometryFilter?: GeometryFilter): CadNode;
|
|
14
14
|
private getSectorRepository;
|
|
15
15
|
dispose(): void;
|
|
16
16
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import { NodeAppearanceProvider, NodeAppearance, PrioritizedArea } from '../../../cad-styling';
|
|
4
|
+
import { NodeAppearanceProvider, NodeAppearance, PrioritizedArea, type NodeTransformProvider } from '../../../cad-styling';
|
|
5
5
|
import { SectorScene, CadModelMetadata, RootSectorNode, WantedSector, ConsumedSector } from '../../../cad-parsers';
|
|
6
6
|
import { SectorRepository } from '../../../sector-loader';
|
|
7
7
|
import { ParsedGeometry } from '../../../sector-parser';
|
|
8
|
-
import { CadMaterialManager,
|
|
8
|
+
import { CadMaterialManager, RenderMode } from '../../../rendering';
|
|
9
9
|
import { Group, Object3D, Plane, Matrix4, Object3DEventMap } from 'three';
|
|
10
10
|
import { TreeIndexToSectorsMap } from '../utilities/TreeIndexToSectorsMap';
|
|
11
11
|
import { ParsedMeshGeometry } from '../../../cad-parsers';
|
|
@@ -22,3 +22,6 @@ export { AreaCollection } from './src/prioritized/AreaCollection';
|
|
|
22
22
|
export { EmptyAreaCollection } from './src/prioritized/EmptyAreaCollection';
|
|
23
23
|
export { ClusteredAreaCollection } from './src/prioritized/ClusteredAreaCollection';
|
|
24
24
|
export { PrioritizedArea } from './src/prioritized/types';
|
|
25
|
+
export { NodeTransformProvider } from './src/transform/NodeTransformProvider';
|
|
26
|
+
export { NodeTransformTextureBuilder } from './src/transform/NodeTransformTextureBuilder';
|
|
27
|
+
export { NodeAppearanceTextureBuilder } from './src/NodeAppearanceTextureBuilder';
|
package/dist/packages/{rendering/src/rendering → cad-styling/src}/NodeAppearanceTextureBuilder.d.ts
RENAMED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { IndexSet } from '
|
|
6
|
-
import {
|
|
5
|
+
import { IndexSet } from '../../utilities';
|
|
6
|
+
import { type NodeAppearance } from './NodeAppearance';
|
|
7
|
+
import type { NodeAppearanceProvider } from './NodeAppearanceProvider';
|
|
7
8
|
export declare class NodeAppearanceTextureBuilder {
|
|
8
9
|
private _defaultAppearance;
|
|
9
10
|
private readonly _styleProvider;
|
|
@@ -19,6 +19,9 @@ export declare class Potree implements IPotree {
|
|
|
19
19
|
private readonly _materialManager;
|
|
20
20
|
private _throttledUpdateFunc;
|
|
21
21
|
private _shouldLoad;
|
|
22
|
+
private _updateInProgress;
|
|
23
|
+
private readonly _tempCameraForward;
|
|
24
|
+
private readonly _tempToNode;
|
|
22
25
|
maxNumNodesLoading: number;
|
|
23
26
|
lru: LRU;
|
|
24
27
|
constructor(modelDataProvider: ModelDataProvider, pointCloudMaterialManager: PointCloudMaterialManager);
|
|
@@ -26,6 +29,7 @@ export declare class Potree implements IPotree {
|
|
|
26
29
|
loadPointCloud(baseUrl: string, fileName: string, stylableObject: StylableObject[], modelIdentifier: symbol): Promise<PointCloudOctree>;
|
|
27
30
|
updatePointClouds(pointClouds: PointCloudOctree[], camera: Camera, renderer: WebGLRenderer): void;
|
|
28
31
|
set shouldLoad(value: boolean);
|
|
32
|
+
private createEmptyVisibilityResult;
|
|
29
33
|
private innerUpdatePointClouds;
|
|
30
34
|
get pointBudget(): number;
|
|
31
35
|
set pointBudget(value: number);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { CadMaterialManager } from './src/CadMaterialManager';
|
|
5
5
|
export { PointCloudMaterialManager } from './src/PointCloudMaterialManager';
|
|
6
|
-
export { NodeTransformProvider } from './src/transform/NodeTransformProvider';
|
|
7
6
|
export { RenderOptions, defaultRenderOptions, SsaoParameters, SsaoSampleQuality, AntiAliasingMode, EdlOptions } from './src/rendering/types';
|
|
8
7
|
export * from './src/pointcloud-rendering/constants';
|
|
9
8
|
export * from './src/pointcloud-rendering/enums';
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { NodeTransformProvider } from './transform/NodeTransformProvider';
|
|
6
5
|
import { Materials } from './rendering/materials';
|
|
7
6
|
import { RenderMode } from './rendering/RenderMode';
|
|
8
|
-
import { NodeAppearance, NodeAppearanceProvider } from '../../cad-styling';
|
|
7
|
+
import { NodeAppearance, NodeAppearanceProvider, NodeTransformProvider } from '../../cad-styling';
|
|
9
8
|
import { IndexSet } from '../../utilities';
|
|
10
9
|
export declare class CadMaterialManager {
|
|
11
10
|
private readonly _events;
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Adapted from pnext/three-loader (https://github.com/pnext/three-loader)
|
|
3
3
|
*/
|
|
4
4
|
import { Color } from 'three';
|
|
5
|
-
export declare const DEFAULT_MAX_POINT_SIZE =
|
|
5
|
+
export declare const DEFAULT_MAX_POINT_SIZE = 10;
|
|
6
6
|
export declare const DEFAULT_MIN_NODE_PIXEL_SIZE = 50;
|
|
7
7
|
export declare const DEFAULT_MIN_POINT_SIZE = 1;
|
|
8
8
|
export declare const DEFAULT_PICK_WINDOW_SIZE = 15;
|
|
9
9
|
export declare const DEFAULT_POINT_BUDGET = 3000000;
|
|
10
|
-
export declare const MAX_LOADS_TO_GPU =
|
|
10
|
+
export declare const MAX_LOADS_TO_GPU = 15;
|
|
11
11
|
export declare const MAX_NUM_NODES_LOADING = 8;
|
|
12
12
|
export declare const UPDATE_THROTTLE_TIME_MS = 100;
|
|
13
13
|
export declare const PERSPECTIVE_CAMERA = "PerspectiveCamera";
|
|
14
14
|
export declare const COLOR_BLACK: Color;
|
|
15
15
|
export declare const COLOR_WHITE: Color;
|
|
16
|
-
export declare const DEFAULT_EDL_NEIGHBOURS_COUNT =
|
|
16
|
+
export declare const DEFAULT_EDL_NEIGHBOURS_COUNT = 16;
|
|
17
17
|
export declare const OBJECT_STYLING_TEXTURE_WIDTH = 256;
|
|
18
18
|
export declare const OBJECT_STYLING_TEXTURE_HEIGHT = 256;
|
|
@@ -5,7 +5,7 @@ export { traverseDepthFirst } from './src/objectTraversal';
|
|
|
5
5
|
export { transformCameraConfiguration } from './src/transformCameraConfiguration';
|
|
6
6
|
export { RandomColors } from './src/RandomColors';
|
|
7
7
|
export { CameraConfiguration } from './src/CameraConfiguration';
|
|
8
|
-
export { EventTrigger } from './src/events/EventTrigger';
|
|
8
|
+
export { EventTrigger, EventListener } from './src/events/EventTrigger';
|
|
9
9
|
export { InputHandler } from './src/events/InputHandler';
|
|
10
10
|
export { PointerEvents } from './src/events/PointerEvents';
|
|
11
11
|
export { PointerEventsTarget } from './src/events/PointerEventsTarget';
|
|
@@ -25,6 +25,7 @@ export { unionBoxes } from './src/three/unionBoxes';
|
|
|
25
25
|
export { determineCurrentDevice, DeviceDescriptor } from './src/device';
|
|
26
26
|
export { createRenderTriangle } from './src/three/createFullScreenTriangleGeometry';
|
|
27
27
|
export { VariableWidthLine } from './src/three/VariableWidthLine';
|
|
28
|
+
export { batchedDebounce, BatchedDebounce } from './src/batchedDebounce';
|
|
28
29
|
export { fitCameraToBoundingBox } from './src/three/fitCameraToBoundingBox';
|
|
29
30
|
export { isBox3OnPositiveSideOfPlane } from './src/three/isBox3OnPositiveSideOfPlane';
|
|
30
31
|
export { visitBox3CornerPoints } from './src/three/visitBox3CornerPoints';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2025 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import debounce from 'lodash/debounce';
|
|
5
|
+
export interface BatchedDebounce<T, R> {
|
|
6
|
+
(item: T): Promise<R>;
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
}
|
|
9
|
+
type BatchCallback<T, R> = (items: T[]) => R extends void ? Promise<void> | void : Promise<R[]> | R[];
|
|
10
|
+
/**
|
|
11
|
+
* Creates a debounced function that batches multiple individual calls into a single batch operation.
|
|
12
|
+
* Each call returns a promise that resolves with the corresponding result from the batch callback.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The type of input items
|
|
15
|
+
* @template R - The type of result items (use void for callbacks that don't return results)
|
|
16
|
+
*
|
|
17
|
+
* @param callback - Function that processes a batch of items. Should return an array with the same
|
|
18
|
+
* length as the input array, or void if no results are needed.
|
|
19
|
+
* @param wait - The number of milliseconds to delay before processing the batch
|
|
20
|
+
* @param options - Optional debounce options (leading, trailing, maxWait) passed to lodash debounce
|
|
21
|
+
*
|
|
22
|
+
* @returns A debounced function that accepts individual items and returns promises for their results.
|
|
23
|
+
* The function includes a `cancel()` method to cancel pending batches.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // With results
|
|
28
|
+
* const batchedFetch = batchedDebounce(
|
|
29
|
+
* async (ids: number[]) => {
|
|
30
|
+
* const response = await fetch('/api/items', {
|
|
31
|
+
* method: 'POST',
|
|
32
|
+
* body: JSON.stringify({ ids })
|
|
33
|
+
* });
|
|
34
|
+
* return response.json();
|
|
35
|
+
* },
|
|
36
|
+
* 100
|
|
37
|
+
* );
|
|
38
|
+
*
|
|
39
|
+
* const item1 = batchedFetch(1);
|
|
40
|
+
* const item2 = batchedFetch(2);
|
|
41
|
+
* const results = await Promise.all([item1, item2]);
|
|
42
|
+
*
|
|
43
|
+
* // Without results (void)
|
|
44
|
+
* const batchedLog = batchedDebounce(
|
|
45
|
+
* async (ids: number[]) => {
|
|
46
|
+
* await fetch('/api/log', {
|
|
47
|
+
* method: 'POST',
|
|
48
|
+
* body: JSON.stringify({ ids })
|
|
49
|
+
* });
|
|
50
|
+
* },
|
|
51
|
+
* 100
|
|
52
|
+
* );
|
|
53
|
+
*
|
|
54
|
+
* await batchedLog(1);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function batchedDebounce<T, R = void>(callback: BatchCallback<T, R>, wait: number, options?: Parameters<typeof debounce>[2]): BatchedDebounce<T, R>;
|
|
58
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2021 Cognite AS
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the listener type from an EventTrigger in an events map
|
|
6
|
+
*/
|
|
7
|
+
export type EventListener<T extends Record<string, EventTrigger<(...args: any[]) => void>>, K extends keyof T> = T[K] extends EventTrigger<infer U> ? U : never;
|
|
4
8
|
/**
|
|
5
9
|
* Subscribable event source.
|
|
6
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.28.
|
|
3
|
+
"version": "4.28.6",
|
|
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": {
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"eslint-plugin-prettier": "^5.1.3",
|
|
109
109
|
"eslint-plugin-unused-imports": "^3.1.0",
|
|
110
110
|
"file-loader": "^6.2.0",
|
|
111
|
-
"glob": "^11.
|
|
111
|
+
"glob": "^11.1.0",
|
|
112
112
|
"glslify-loader": "^2.0.0",
|
|
113
113
|
"html-webpack-plugin": "^5.6.0",
|
|
114
114
|
"jest": "^29.7.0",
|
|
File without changes
|
/package/dist/packages/{rendering → cad-styling}/src/transform/NodeTransformTextureBuilder.d.ts
RENAMED
|
File without changes
|
|
File without changes
|