@cognite/reveal 4.1.2 → 4.2.0-dev.20230329
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 +191 -167
- package/dist/index.js.map +1 -1
- package/dist/packages/360-images/index.d.ts +6 -6
- package/dist/packages/360-images/src/Image360Facade.d.ts +13 -10
- package/dist/packages/360-images/src/cache/Image360LoadingCache.d.ts +30 -0
- package/dist/packages/360-images/src/{DefaultImage360Collection.d.ts → collection/DefaultImage360Collection.d.ts} +22 -5
- package/dist/packages/360-images/src/{Image360Collection.d.ts → collection/Image360Collection.d.ts} +13 -2
- package/dist/packages/360-images/src/collection/Image360CollectionFactory.d.ts +13 -0
- package/dist/packages/360-images/src/{Image360Entity.d.ts → entity/Image360Entity.d.ts} +21 -6
- package/dist/packages/360-images/src/{Image360VisualizationBox.d.ts → entity/Image360VisualizationBox.d.ts} +6 -3
- package/dist/packages/360-images/src/icons/IconCollection.d.ts +34 -0
- package/dist/packages/360-images/src/icons/IconOctree.d.ts +21 -0
- package/dist/packages/360-images/src/icons/Image360Icon.d.ts +29 -0
- package/dist/packages/360-images/src/icons/InstancedIconSprite.d.ts +16 -0
- package/dist/packages/360-images/src/types.d.ts +1 -1
- package/dist/packages/api/src/api-helpers/Image360ApiHelper.d.ts +6 -6
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +24 -8
- package/dist/packages/cad-geometry-loaders/src/sector/SectorDownloadScheduler.d.ts +5 -1
- package/dist/packages/cad-model/src/picking/PickingHandler.d.ts +4 -1
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +1 -1
- package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +4 -0
- package/dist/packages/cad-parsers/src/metadata/parsers/types.d.ts +1 -0
- package/dist/packages/camera-manager/src/ComboControls.d.ts +2 -0
- package/dist/packages/camera-manager/src/DefaultCameraManager.d.ts +1 -1
- package/dist/packages/camera-manager/src/StationaryCameraManager.d.ts +3 -3
- package/dist/packages/data-providers/index.d.ts +1 -1
- package/dist/packages/data-providers/src/ModelDataProvider.d.ts +2 -1
- package/dist/packages/data-providers/src/image-360-data-providers/Cdf360ImageEventProvider.d.ts +13 -4
- package/dist/packages/data-providers/src/image-360-data-providers/Local360ImageProvider.d.ts +3 -2
- package/dist/packages/data-providers/src/model-data-providers/CdfModelDataProvider.d.ts +1 -1
- package/dist/packages/data-providers/src/model-data-providers/LocalModelDataProvider.d.ts +1 -1
- package/dist/packages/data-providers/src/types.d.ts +18 -8
- package/dist/packages/metrics/index.d.ts +1 -0
- package/dist/packages/metrics/src/SessionLogger.d.ts +22 -0
- package/dist/packages/metrics/src/types.d.ts +1 -1
- package/dist/packages/model-base/src/types.d.ts +1 -4
- package/dist/packages/pointclouds/src/CognitePointCloudModel.d.ts +4 -0
- package/dist/packages/pointclouds/src/PointCloudFactory.d.ts +2 -2
- package/dist/packages/pointclouds/src/PointCloudPickingHandler.d.ts +1 -0
- package/dist/packages/pointclouds/src/potree-three-loader/Potree.d.ts +2 -1
- package/dist/packages/pointclouds/src/potree-three-loader/loading/ClassificationInfo.d.ts +1 -1
- package/dist/packages/pointclouds/src/potree-three-loader/utils/WorkerPool.d.ts +1 -1
- package/dist/packages/rendering/src/CadMaterialManager.d.ts +3 -0
- package/dist/packages/rendering/src/rendering/materials.d.ts +6 -1
- package/dist/packages/rendering/src/rendering/shaders.d.ts +0 -8
- package/dist/packages/sector-loader/src/GltfSectorLoader.d.ts +1 -1
- package/dist/packages/sector-loader/src/GltfSectorRepository.d.ts +1 -1
- package/dist/packages/sector-loader/src/SectorRepository.d.ts +1 -1
- package/dist/packages/sector-parser/src/GltfSectorParser.d.ts +1 -0
- package/dist/packages/sector-parser/src/types.d.ts +23 -1
- package/dist/packages/tools/src/Measurement/MeasurementLine.d.ts +6 -0
- package/dist/packages/tools/src/Measurement/MeasurementManager.d.ts +5 -0
- package/dist/packages/tools/src/Measurement/MeasurementTool.d.ts +2 -0
- package/dist/packages/utilities/index.d.ts +2 -0
- package/dist/packages/utilities/src/WebGLRendererStateHelper.d.ts +1 -1
- package/dist/packages/utilities/src/events/clickOrTouchEventOffset.d.ts +2 -2
- package/dist/packages/utilities/src/projectedBounds.d.ts +6 -0
- package/dist/packages/utilities/src/three/AttributeDataAccessor.d.ts +12 -0
- package/dist/packages/utilities/src/three/visitBox3CornerPoints.d.ts +1 -0
- package/package.json +32 -40
- package/dist/packages/360-images/src/Image360EntityFactory.d.ts +0 -13
- package/dist/packages/360-images/src/Image360Icon.d.ts +0 -19
- package/dist/packages/360-images/src/Image360LoadingCache.d.ts +0 -15
- /package/dist/packages/360-images/src/{Image360.d.ts → entity/Image360.d.ts} +0 -0
- /package/dist/packages/360-images/src/{Image360Visualization.d.ts → entity/Image360Visualization.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
export { Image360 } from './src/Image360';
|
|
5
|
-
export { Image360Collection } from './src/Image360Collection';
|
|
4
|
+
export { Image360 } from './src/entity/Image360';
|
|
5
|
+
export { Image360Collection } from './src/collection/Image360Collection';
|
|
6
6
|
export { Image360Facade } from './src/Image360Facade';
|
|
7
|
-
export {
|
|
8
|
-
export { Image360Entity } from './src/Image360Entity';
|
|
9
|
-
export { Image360Visualization } from './src/Image360Visualization';
|
|
7
|
+
export { Image360CollectionFactory } from './src/collection/Image360CollectionFactory';
|
|
8
|
+
export { Image360Entity } from './src/entity/Image360Entity';
|
|
9
|
+
export { Image360Visualization } from './src/entity/Image360Visualization';
|
|
10
10
|
export { Image360EnteredDelegate, Image360ExitedDelegate } from './src/types';
|
|
11
|
-
export { DefaultImage360Collection } from './src/DefaultImage360Collection';
|
|
11
|
+
export { DefaultImage360Collection } from './src/collection/DefaultImage360Collection';
|
|
@@ -2,21 +2,24 @@
|
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { Image360Entity } from './Image360Entity';
|
|
6
|
-
import {
|
|
5
|
+
import { Image360Entity } from './entity/Image360Entity';
|
|
6
|
+
import { Image360CollectionFactory } from './collection/Image360CollectionFactory';
|
|
7
|
+
import { DefaultImage360Collection } from './collection/DefaultImage360Collection';
|
|
8
|
+
import { IconCullingScheme } from './icons/IconCollection';
|
|
7
9
|
export declare class Image360Facade<T> {
|
|
8
10
|
private readonly _entityFactory;
|
|
9
|
-
private readonly
|
|
11
|
+
private readonly _image360Collections;
|
|
10
12
|
private readonly _rayCaster;
|
|
11
13
|
private readonly _image360Cache;
|
|
14
|
+
get collections(): DefaultImage360Collection[];
|
|
12
15
|
set allIconsVisibility(visible: boolean);
|
|
13
16
|
set allHoverIconsVisibility(visible: boolean);
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
set allIconCullingScheme(scheme: IconCullingScheme);
|
|
18
|
+
constructor(_entityFactory: Image360CollectionFactory<T>);
|
|
19
|
+
create(dataProviderFilter: T, postTransform?: THREE.Matrix4, preComputedRotation?: boolean): Promise<DefaultImage360Collection>;
|
|
16
20
|
delete(entity: Image360Entity): Promise<void>;
|
|
17
|
-
preload(entity: Image360Entity): Promise<void>;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, camera: THREE.Camera): Image360Entity | undefined;
|
|
21
|
+
preload(entity: Image360Entity, lockDownload?: boolean): Promise<void>;
|
|
22
|
+
getCollectionContainingEntity(entity: Image360Entity): DefaultImage360Collection;
|
|
23
|
+
intersect(coords: THREE.Vector2, camera: THREE.Camera): Image360Entity | undefined;
|
|
24
|
+
dispose(): void;
|
|
22
25
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Image360Entity } from '../entity/Image360Entity';
|
|
5
|
+
export type DownloadRequest = {
|
|
6
|
+
entity: Image360Entity;
|
|
7
|
+
firstCompleted: Promise<void>;
|
|
8
|
+
fullResolutionCompleted: Promise<void>;
|
|
9
|
+
abort: () => void;
|
|
10
|
+
};
|
|
11
|
+
export type Loaded360Image = {
|
|
12
|
+
entity: Image360Entity;
|
|
13
|
+
isFullResolution: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare class Image360LoadingCache {
|
|
16
|
+
private readonly _imageCacheSize;
|
|
17
|
+
private readonly _downloadCacheSize;
|
|
18
|
+
private readonly _loaded360Images;
|
|
19
|
+
private readonly _inProgressDownloads;
|
|
20
|
+
private _lockedDownload;
|
|
21
|
+
get cachedEntities(): Image360Entity[];
|
|
22
|
+
get currentlyLoadingEntities(): DownloadRequest[];
|
|
23
|
+
getDownloadInProgress(entity: Image360Entity): DownloadRequest | undefined;
|
|
24
|
+
constructor(_imageCacheSize?: number, _downloadCacheSize?: number);
|
|
25
|
+
cachedPreload(entity: Image360Entity, lockDownload?: boolean): Promise<void>;
|
|
26
|
+
purge(entity: Image360Entity): Promise<void>;
|
|
27
|
+
private addEntityToCache;
|
|
28
|
+
private abortLastRecentlyReqestedEntity;
|
|
29
|
+
private createAbortSignal;
|
|
30
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2023 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import { EventTrigger } from '
|
|
5
|
-
import { Image360 } from './Image360';
|
|
4
|
+
import { EventTrigger } from '../../../utilities';
|
|
6
5
|
import { Image360Collection } from './Image360Collection';
|
|
7
|
-
import { Image360Entity } from '
|
|
8
|
-
import { Image360EnteredDelegate, Image360ExitedDelegate } from '
|
|
6
|
+
import { Image360Entity } from '../entity/Image360Entity';
|
|
7
|
+
import { Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
|
|
8
|
+
import { IconCollection, IconCullingScheme } from '../icons/IconCollection';
|
|
9
9
|
/**
|
|
10
10
|
* Default implementation of {@link Image360Collection}. Used for events when entering
|
|
11
11
|
* and exiting 360 image mode
|
|
@@ -16,6 +16,8 @@ export declare class DefaultImage360Collection implements Image360Collection {
|
|
|
16
16
|
*/
|
|
17
17
|
readonly image360Entities: Image360Entity[];
|
|
18
18
|
private readonly _events;
|
|
19
|
+
private readonly _icons;
|
|
20
|
+
private _isCollectionVisible;
|
|
19
21
|
/**
|
|
20
22
|
* The events from the image collection.
|
|
21
23
|
*/
|
|
@@ -23,7 +25,8 @@ export declare class DefaultImage360Collection implements Image360Collection {
|
|
|
23
25
|
image360Entered: EventTrigger<Image360EnteredDelegate>;
|
|
24
26
|
image360Exited: EventTrigger<Image360ExitedDelegate>;
|
|
25
27
|
};
|
|
26
|
-
|
|
28
|
+
get isCollectionVisible(): boolean;
|
|
29
|
+
constructor(entities: Image360Entity[], icons: IconCollection);
|
|
27
30
|
/**
|
|
28
31
|
* Subscribes to events on 360 Image datasets. There are several event types:
|
|
29
32
|
* 'image360Entered' - Subscribes to a event for entering 360 image mode.
|
|
@@ -33,6 +36,17 @@ export declare class DefaultImage360Collection implements Image360Collection {
|
|
|
33
36
|
*/
|
|
34
37
|
on(event: 'image360Entered', callback: Image360EnteredDelegate): void;
|
|
35
38
|
on(event: 'image360Exited', callback: Image360ExitedDelegate): void;
|
|
39
|
+
/**
|
|
40
|
+
* Specify parameters used to determine the number of icons that are visible when entering 360 Images.
|
|
41
|
+
* @param radius Only icons within the given radius will be made visible.
|
|
42
|
+
* @param pointLimit Limit the number of points within the given radius. Points closer to the camera will be prioritized.
|
|
43
|
+
*/
|
|
44
|
+
set360IconCullingRestrictions(radius: number, pointLimit: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Set visibility of all 360 image icons.
|
|
47
|
+
* @param visible If true all icons are made visible according to the active culling scheme. If false all icons are hidden.
|
|
48
|
+
*/
|
|
49
|
+
setIconsVisibility(visible: boolean): void;
|
|
36
50
|
/**
|
|
37
51
|
* Unsubscribes from 360 image dataset event.
|
|
38
52
|
* @param event The event type.
|
|
@@ -40,5 +54,8 @@ export declare class DefaultImage360Collection implements Image360Collection {
|
|
|
40
54
|
*/
|
|
41
55
|
off(event: 'image360Entered', callback: Image360EnteredDelegate): void;
|
|
42
56
|
off(event: 'image360Exited', callback: Image360ExitedDelegate): void;
|
|
57
|
+
setSelectedVisibility(visible: boolean): void;
|
|
58
|
+
setCullingScheme(scheme: IconCullingScheme): void;
|
|
59
|
+
remove(entity: Image360Entity): void;
|
|
43
60
|
dispose(): void;
|
|
44
61
|
}
|
package/dist/packages/360-images/src/{Image360Collection.d.ts → collection/Image360Collection.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import { Image360 } from '
|
|
5
|
-
import { Image360EnteredDelegate, Image360ExitedDelegate } from '
|
|
4
|
+
import { Image360 } from './../entity/Image360';
|
|
5
|
+
import { Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
|
|
6
6
|
/**
|
|
7
7
|
* A wrapper that represents a set of 360 images.
|
|
8
8
|
*/
|
|
@@ -11,6 +11,17 @@ export interface Image360Collection {
|
|
|
11
11
|
* A list containing all the 360 images in this set.
|
|
12
12
|
*/
|
|
13
13
|
readonly image360Entities: Image360[];
|
|
14
|
+
/**
|
|
15
|
+
* Specify parameters used to determine the number of icons that are visible when entering 360 Images.
|
|
16
|
+
* @param radius Only icons within the given radius will be made visible.
|
|
17
|
+
* @param pointLimit Limit the number of points within the given radius. Points closer to the camera will be prioritized.
|
|
18
|
+
*/
|
|
19
|
+
set360IconCullingRestrictions(radius: number, pointLimit: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Set visibility of all 360 image icons.
|
|
22
|
+
* @param visible If true all icons are made visible according to the active culling scheme. If false all icons are hidden.
|
|
23
|
+
*/
|
|
24
|
+
setIconsVisibility(visible: boolean): void;
|
|
14
25
|
/**
|
|
15
26
|
* Subscribes to events on 360 Image datasets. There are several event types:
|
|
16
27
|
* 'image360Entered' - Subscribes to a event for entering 360 image mode.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Image360Provider } from '../../../data-providers';
|
|
5
|
+
import { BeforeSceneRenderedDelegate, EventTrigger, SceneHandler } from '../../../utilities';
|
|
6
|
+
import { DefaultImage360Collection } from './DefaultImage360Collection';
|
|
7
|
+
export declare class Image360CollectionFactory<T> {
|
|
8
|
+
private readonly _image360DataProvider;
|
|
9
|
+
private readonly _sceneHandler;
|
|
10
|
+
private readonly _onBeforeSceneRendered;
|
|
11
|
+
constructor(image360DataProvider: Image360Provider<T>, sceneHandler: SceneHandler, onBeforeSceneRendered: EventTrigger<BeforeSceneRenderedDelegate>);
|
|
12
|
+
create(dataProviderFilter: T, postTransform: THREE.Matrix4, preMultipliedRotation: boolean): Promise<DefaultImage360Collection>;
|
|
13
|
+
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { SceneHandler } from '
|
|
6
|
-
import { Image360Descriptor, Image360FileProvider } from '
|
|
7
|
-
import { Image360Icon } from '
|
|
5
|
+
import { SceneHandler } from '../../../utilities';
|
|
6
|
+
import { Image360Descriptor, Image360FileProvider } from '../../../data-providers';
|
|
7
|
+
import { Image360Icon } from '../icons/Image360Icon';
|
|
8
8
|
import { Image360VisualizationBox } from './Image360VisualizationBox';
|
|
9
9
|
import { Image360 } from './Image360';
|
|
10
10
|
export declare class Image360Entity implements Image360 {
|
|
@@ -13,6 +13,7 @@ export declare class Image360Entity implements Image360 {
|
|
|
13
13
|
private readonly _transform;
|
|
14
14
|
private readonly _image360Icon;
|
|
15
15
|
private readonly _image360VisualzationBox;
|
|
16
|
+
private _getFullResolutionTextures;
|
|
16
17
|
/**
|
|
17
18
|
* Get a copy of the model-to-world transformation matrix
|
|
18
19
|
* of the given 360 image.
|
|
@@ -30,11 +31,26 @@ export declare class Image360Entity implements Image360 {
|
|
|
30
31
|
* @returns Image360Visualization
|
|
31
32
|
*/
|
|
32
33
|
get image360Visualization(): Image360VisualizationBox;
|
|
33
|
-
constructor(image360Metadata: Image360Descriptor, sceneHandler: SceneHandler, imageProvider: Image360FileProvider,
|
|
34
|
+
constructor(image360Metadata: Image360Descriptor, sceneHandler: SceneHandler, imageProvider: Image360FileProvider, transform: THREE.Matrix4, icon: Image360Icon);
|
|
34
35
|
/**
|
|
35
36
|
* Loads the 360 image (6 faces) into the visualization object.
|
|
37
|
+
*
|
|
38
|
+
* This will start the download of both low and full resolution images and return one promise for when the first image set is ready
|
|
39
|
+
* and one promise for when both downloads are completed. If the low resolution images are completed first the full resolution
|
|
40
|
+
* download and texture loading will continue in the background, and applyFullResolution can be used to apply full resolution textures
|
|
41
|
+
* to the image360VisualzationBox at a desired time.
|
|
42
|
+
*
|
|
43
|
+
* @returns firstCompleted A promise for when the first set om images has been loaded and applied to the image360VisualzationBox.
|
|
44
|
+
* @returns fullResolutionCompleted A promise for when full resolution images are done loading.
|
|
36
45
|
*/
|
|
37
|
-
load360Image():
|
|
46
|
+
load360Image(abortSignal?: AbortSignal): {
|
|
47
|
+
firstCompleted: Promise<void>;
|
|
48
|
+
fullResolutionCompleted: Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Apply full resolution textures to the image360VisualzationBox. This has no effect if full resolution has already been applied.
|
|
52
|
+
*/
|
|
53
|
+
applyFullResolution(): Promise<void>;
|
|
38
54
|
/**
|
|
39
55
|
* Drops the GPU resources for the 360 image
|
|
40
56
|
* the icon will be preserved.
|
|
@@ -44,5 +60,4 @@ export declare class Image360Entity implements Image360 {
|
|
|
44
60
|
* @obvious
|
|
45
61
|
*/
|
|
46
62
|
dispose(): void;
|
|
47
|
-
private computeTransform;
|
|
48
63
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { SceneHandler } from '
|
|
6
|
-
import { Image360Face } from '
|
|
5
|
+
import { SceneHandler } from '../../../utilities';
|
|
6
|
+
import { Image360Face, Image360Texture } from '../../../data-providers';
|
|
7
7
|
import { Image360Visualization } from './Image360Visualization';
|
|
8
8
|
export declare class Image360VisualizationBox implements Image360Visualization {
|
|
9
9
|
private readonly _worldTransform;
|
|
@@ -11,6 +11,8 @@ export declare class Image360VisualizationBox implements Image360Visualization {
|
|
|
11
11
|
private _faceMaterials;
|
|
12
12
|
private readonly _sceneHandler;
|
|
13
13
|
private readonly _visualizationState;
|
|
14
|
+
private readonly _textureLoader;
|
|
15
|
+
private readonly _faceMaterialOrder;
|
|
14
16
|
get opacity(): number;
|
|
15
17
|
set opacity(alpha: number);
|
|
16
18
|
get visible(): boolean;
|
|
@@ -18,6 +20,7 @@ export declare class Image360VisualizationBox implements Image360Visualization {
|
|
|
18
20
|
set scale(newScale: THREE.Vector3);
|
|
19
21
|
set renderOrder(newRenderOrder: number);
|
|
20
22
|
constructor(worldTransform: THREE.Matrix4, sceneHandler: SceneHandler);
|
|
21
|
-
loadImages(
|
|
23
|
+
loadImages(textures: Image360Texture[]): Promise<void>;
|
|
24
|
+
loadFaceTextures(faces: Image360Face[]): Promise<Image360Texture[]>;
|
|
22
25
|
unloadImages(): void;
|
|
23
26
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Vector3 } from 'three';
|
|
5
|
+
import { BeforeSceneRenderedDelegate, EventTrigger, SceneHandler } from '../../../utilities';
|
|
6
|
+
import { Image360Icon } from './Image360Icon';
|
|
7
|
+
export type IconCullingScheme = 'clustered' | 'proximity';
|
|
8
|
+
export declare class IconCollection {
|
|
9
|
+
private readonly MIN_PIXEL_SIZE;
|
|
10
|
+
private readonly MAX_PIXEL_SIZE;
|
|
11
|
+
private readonly _sceneHandler;
|
|
12
|
+
private readonly _hoverIconTexture;
|
|
13
|
+
private readonly _sharedTexture;
|
|
14
|
+
private readonly _icons;
|
|
15
|
+
private readonly _iconsSprite;
|
|
16
|
+
private readonly _computeClustersEventHandler;
|
|
17
|
+
private readonly _computeProximityPointsEventHandler;
|
|
18
|
+
private readonly _onBeforeSceneRenderedEvent;
|
|
19
|
+
private readonly _iconRadius;
|
|
20
|
+
private _activeCullingSchemeEventHandeler;
|
|
21
|
+
private _iconCullingScheme;
|
|
22
|
+
private _proximityRadius;
|
|
23
|
+
private _proximityPointLimit;
|
|
24
|
+
get icons(): Image360Icon[];
|
|
25
|
+
setCullingScheme(scheme: IconCullingScheme): void;
|
|
26
|
+
set360IconCullingRestrictions(radius: number, pointLimit: number): void;
|
|
27
|
+
constructor(points: Vector3[], sceneHandler: SceneHandler, onBeforeSceneRendered: EventTrigger<BeforeSceneRenderedDelegate>);
|
|
28
|
+
private setIconClustersByLOD;
|
|
29
|
+
private computeProximityPoints;
|
|
30
|
+
private initializeImage360Icons;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
private createOuterRingsTexture;
|
|
33
|
+
private createHoverIconTexture;
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Node, PointOctant, PointOctree } from 'sparse-octree';
|
|
5
|
+
import { Box3, Matrix4 } from 'three';
|
|
6
|
+
import { Image360Icon } from '../icons/Image360Icon';
|
|
7
|
+
export declare class IconOctree extends PointOctree<Image360Icon> {
|
|
8
|
+
private readonly _nodeCenters;
|
|
9
|
+
static getMinimalOctreeBoundsFromIcons(icons: Image360Icon[]): Box3;
|
|
10
|
+
constructor(icons: Image360Icon[], bounds: Box3, maxLeafSize: number);
|
|
11
|
+
getNodeIcon(node: Node): Image360Icon | undefined;
|
|
12
|
+
getLODByScreenArea(areaThreshold: number, projection: Matrix4, minimumLevel?: number): Set<PointOctant<Image360Icon>>;
|
|
13
|
+
private populateNodeCenters;
|
|
14
|
+
private filterEmptyLeaves;
|
|
15
|
+
private hasChildren;
|
|
16
|
+
private isEmptyLeaf;
|
|
17
|
+
private hasData;
|
|
18
|
+
private isPointOctant;
|
|
19
|
+
private getClosestToAverageIcon;
|
|
20
|
+
traverseLevelsBottomUp(func: (nodes: Node[]) => void): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { BeforeSceneRenderedDelegate, EventTrigger, SceneHandler } from '../../../utilities';
|
|
5
|
+
import * as THREE from 'three';
|
|
6
|
+
import { Ray, Vector3 } from 'three';
|
|
7
|
+
export declare class Image360Icon {
|
|
8
|
+
private readonly _hoverSprite;
|
|
9
|
+
private readonly _position;
|
|
10
|
+
private readonly _sceneHandler;
|
|
11
|
+
private readonly _minPixelSize;
|
|
12
|
+
private readonly _maxPixelSize;
|
|
13
|
+
private readonly _iconRadius;
|
|
14
|
+
private readonly _setAdaptiveScale;
|
|
15
|
+
private readonly _onRenderTrigger;
|
|
16
|
+
private _adaptiveScale;
|
|
17
|
+
private _visible;
|
|
18
|
+
private _culled;
|
|
19
|
+
constructor(position: THREE.Vector3, hoverIconTexture: THREE.CanvasTexture, sceneHandler: SceneHandler, minPixelSize: number, maxPixelSize: number, iconRadius: number, onRenderTrigger: EventTrigger<BeforeSceneRenderedDelegate>);
|
|
20
|
+
setVisibility(visible: boolean): void;
|
|
21
|
+
setCulled(culled: boolean): void;
|
|
22
|
+
isVisible(): boolean;
|
|
23
|
+
get position(): Vector3;
|
|
24
|
+
set hoverSpriteVisible(visible: boolean);
|
|
25
|
+
intersect(ray: Ray): Vector3 | null;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
private setupAdaptiveScaling;
|
|
28
|
+
private createHoverSprite;
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Color, Group, Texture, Vector3 } from 'three';
|
|
5
|
+
export declare class InstancedIconSprite extends Group {
|
|
6
|
+
private readonly _geometry;
|
|
7
|
+
private readonly _frontMaterial;
|
|
8
|
+
private readonly _backMaterial;
|
|
9
|
+
private readonly _positionBuffer;
|
|
10
|
+
private readonly _positionAttribute;
|
|
11
|
+
constructor(maxNumberOfPoints: number, spriteTexture: Texture, minPixelSize: number, maxPixelSize: number, radius: number, colorTint?: Color);
|
|
12
|
+
setPoints(points: Vector3[]): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
private initializePoints;
|
|
15
|
+
private createIconsMaterial;
|
|
16
|
+
}
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { CogniteClient } from '@cognite/sdk';
|
|
6
|
-
import { Image360Collection, Image360Entity } from '../../../360-images';
|
|
7
|
-
import { InputHandler, SceneHandler } from '../../../utilities';
|
|
6
|
+
import { Image360Collection, Image360Entity, Image360 } from '../../../360-images';
|
|
7
|
+
import { BeforeSceneRenderedDelegate, EventTrigger, InputHandler, SceneHandler } from '../../../utilities';
|
|
8
8
|
import { ProxyCameraManager } from '../../../camera-manager';
|
|
9
|
-
import { Image360 } from '../../../360-images/src/Image360';
|
|
10
9
|
export declare class Image360ApiHelper {
|
|
11
10
|
private readonly _image360Facade;
|
|
12
11
|
private readonly _domElement;
|
|
13
12
|
private _transitionInProgress;
|
|
14
13
|
private readonly _interactionState;
|
|
15
|
-
private readonly
|
|
14
|
+
private readonly _eventHandlers;
|
|
15
|
+
private readonly _debouncePreLoad;
|
|
16
16
|
private readonly _requestRedraw;
|
|
17
17
|
private readonly _activeCameraManager;
|
|
18
18
|
private readonly _image360Navigation;
|
|
19
|
+
private readonly _onBeforeSceneRenderedEvent;
|
|
19
20
|
private _cachedCameraManager;
|
|
20
|
-
|
|
21
|
-
constructor(cogniteClient: CogniteClient, sceneHandler: SceneHandler, domElement: HTMLElement, activeCameraManager: ProxyCameraManager, inputHandler: InputHandler, requestRedraw: () => void);
|
|
21
|
+
constructor(cogniteClient: CogniteClient, sceneHandler: SceneHandler, domElement: HTMLElement, activeCameraManager: ProxyCameraManager, inputHandler: InputHandler, requestRedraw: () => void, onBeforeSceneRendered: EventTrigger<BeforeSceneRenderedDelegate>);
|
|
22
22
|
add360ImageSet(eventFilter: {
|
|
23
23
|
[key: string]: string;
|
|
24
24
|
}, collectionTransform: THREE.Matrix4, preMultipliedRotation: boolean): Promise<Image360Collection>;
|
|
@@ -8,10 +8,9 @@ import { PointCloudBudget, CognitePointCloudModel } from '../../../../pointcloud
|
|
|
8
8
|
import { AddImage360Options, AddModelOptions, Cognite3DViewerOptions, Intersection, CadModelBudget, ResolutionOptions } from './types';
|
|
9
9
|
import { CogniteModel } from '../types';
|
|
10
10
|
import { ViewerState } from '../../utilities/ViewStateHelper';
|
|
11
|
-
import { CameraManager, CameraChangeDelegate } from '../../../../camera-manager';
|
|
11
|
+
import { CameraManager, CameraChangeDelegate, CameraStopDelegate } from '../../../../camera-manager';
|
|
12
12
|
import { SupportedModelTypes } from '../../../../model-base';
|
|
13
|
-
import { Image360Collection } from '../../../../360-images';
|
|
14
|
-
import { Image360 } from '../../../../360-images/src/Image360';
|
|
13
|
+
import { Image360Collection, Image360 } from '../../../../360-images';
|
|
15
14
|
/**
|
|
16
15
|
* @example
|
|
17
16
|
* ```js
|
|
@@ -57,8 +56,10 @@ export declare class Cognite3DViewer {
|
|
|
57
56
|
private readonly _models;
|
|
58
57
|
private isDisposed;
|
|
59
58
|
private latestRequestId;
|
|
60
|
-
private readonly
|
|
59
|
+
private readonly sessionLogger;
|
|
60
|
+
private readonly cameraManagerClock;
|
|
61
61
|
private _clippingNeedsUpdate;
|
|
62
|
+
private _forceStopRendering;
|
|
62
63
|
private readonly spinner;
|
|
63
64
|
private get revealManager();
|
|
64
65
|
/**
|
|
@@ -137,6 +138,15 @@ export declare class Cognite3DViewer {
|
|
|
137
138
|
* ```
|
|
138
139
|
*/
|
|
139
140
|
on(event: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
141
|
+
/**
|
|
142
|
+
* @example
|
|
143
|
+
* ```js
|
|
144
|
+
* viewer.on('cameraStop', () => {
|
|
145
|
+
* console.log('Camera stopped');
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
on(event: 'cameraStop', callback: CameraStopDelegate): void;
|
|
140
150
|
/**
|
|
141
151
|
* Event that is triggered immediately before the scene is rendered.
|
|
142
152
|
* @param event Metadata about the rendering frame.
|
|
@@ -163,6 +173,13 @@ export declare class Cognite3DViewer {
|
|
|
163
173
|
* ```
|
|
164
174
|
*/
|
|
165
175
|
off(event: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
176
|
+
/**
|
|
177
|
+
* @example
|
|
178
|
+
* ```js
|
|
179
|
+
* viewer.off('cameraStop', onCameraStop);
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
off(event: 'cameraStop', callback: CameraStopDelegate): void;
|
|
166
183
|
/**
|
|
167
184
|
* Unsubscribe the 'beforeSceneRendered'-event previously subscribed with {@link on}.
|
|
168
185
|
*/
|
|
@@ -451,7 +468,7 @@ export declare class Cognite3DViewer {
|
|
|
451
468
|
requestRedraw(): void;
|
|
452
469
|
/**
|
|
453
470
|
* Convert a point in world space to its coordinates in the canvas. This can be used to place HTML objects near 3D objects on top of the 3D viewer.
|
|
454
|
-
* @see {@link https://www.w3schools.com/graphics/canvas_coordinates.asp
|
|
471
|
+
* @see {@link https://www.w3schools.com/graphics/canvas_coordinates.asp} For details on HTML Canvas Coordinates.
|
|
455
472
|
* @param point World space coordinate.
|
|
456
473
|
* @param normalize Optional. If true, coordinates are normalized into [0,1]. If false, the values are in the range [0, <canvas_size>).
|
|
457
474
|
* @returns Returns 2D coordinates if the point is visible on screen, or `null` if object is outside screen.
|
|
@@ -491,7 +508,7 @@ export declare class Cognite3DViewer {
|
|
|
491
508
|
* `html2canvas` is used to draw UI and this has some limitations on what CSS properties it is able to render. See {@link https://html2canvas.hertzen.com/documentation the html2canvas documentation} for details.
|
|
492
509
|
* @param width Width of the final image. Default is current canvas size.
|
|
493
510
|
* @param height Height of the final image. Default is current canvas size.
|
|
494
|
-
* @param includeUI If false the screenshot will include only the rendered 3D.
|
|
511
|
+
* @param includeUI If false the screenshot will include only the rendered 3D. Default is true.
|
|
495
512
|
* @returns A {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URL} of the image ('image/png').
|
|
496
513
|
* @example
|
|
497
514
|
* ```js
|
|
@@ -513,8 +530,7 @@ export declare class Cognite3DViewer {
|
|
|
513
530
|
* @param offsetY Y coordinate in pixels (relative to the domElement).
|
|
514
531
|
* @returns A promise that if there was an intersection then return the intersection object - otherwise it
|
|
515
532
|
* returns `null` if there were no intersections.
|
|
516
|
-
* @see {@link https://en.wikipedia.org/wiki/Ray_casting}.
|
|
517
|
-
*
|
|
533
|
+
* @see {@link https://en.wikipedia.org/wiki/Ray_casting} For more details on Ray casting.
|
|
518
534
|
* @example For CAD model
|
|
519
535
|
* ```js
|
|
520
536
|
* const offsetX = 50 // pixels from the left
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { ConsumedSector, WantedSector } from '../../../cad-parsers';
|
|
5
5
|
export type SectorDownloadData = {
|
|
6
6
|
sector: WantedSector;
|
|
7
|
-
downloadSector: (sector: WantedSector) => Promise<ConsumedSector>;
|
|
7
|
+
downloadSector: (sector: WantedSector, abortSignal: AbortSignal) => Promise<ConsumedSector>;
|
|
8
8
|
};
|
|
9
9
|
export declare class SectorDownloadScheduler {
|
|
10
10
|
private readonly _maxConcurrentSectorDownloads;
|
|
@@ -15,8 +15,12 @@ export declare class SectorDownloadScheduler {
|
|
|
15
15
|
get numberOfQueuedDownloads(): number;
|
|
16
16
|
constructor(maxConcurrentSectorDownloads?: number);
|
|
17
17
|
queueSectorBatchForDownload(downloadData: SectorDownloadData[]): Promise<ConsumedSector>[];
|
|
18
|
+
private createDiscardedConsumedSector;
|
|
19
|
+
private abortPendingDownload;
|
|
20
|
+
private removeDownloadFromQueue;
|
|
18
21
|
private getOrAddToQueuedDownloads;
|
|
19
22
|
private addSectorToPendingDownloads;
|
|
20
23
|
private processNextQueuedSectorDownload;
|
|
21
24
|
private getSectorIdentifier;
|
|
25
|
+
private createAbortSignal;
|
|
22
26
|
}
|
|
@@ -16,6 +16,7 @@ type IntersectCadNodesResult = {
|
|
|
16
16
|
export declare class PickingHandler {
|
|
17
17
|
private readonly _clearColor;
|
|
18
18
|
private readonly _clearAlpha;
|
|
19
|
+
private readonly _raycaster;
|
|
19
20
|
private readonly _pickPixelColorStorage;
|
|
20
21
|
private readonly _rgbaVector;
|
|
21
22
|
private readonly _unpackFactors;
|
|
@@ -25,7 +26,9 @@ export declare class PickingHandler {
|
|
|
25
26
|
private readonly _mutex;
|
|
26
27
|
constructor(renderer: THREE.WebGLRenderer, materialManager: CadMaterialManager, sceneHandler: SceneHandler);
|
|
27
28
|
intersectCadNodes(cadNodes: CadNode[], input: IntersectInput, async?: boolean): Promise<IntersectCadNodesResult[]>;
|
|
28
|
-
|
|
29
|
+
private filterOutOfBoundCadNodes;
|
|
30
|
+
private intersectCadNodeDepth;
|
|
31
|
+
private intersectCadNodeTreeIndex;
|
|
29
32
|
private pickTreeIndex;
|
|
30
33
|
private perspectiveDepthToViewZ;
|
|
31
34
|
private pickDepth;
|
|
@@ -35,7 +35,7 @@ export declare class CadNode extends Object3D {
|
|
|
35
35
|
get materialManager(): CadMaterialManager;
|
|
36
36
|
set renderMode(mode: RenderMode);
|
|
37
37
|
get renderMode(): RenderMode;
|
|
38
|
-
loadSector(sector: WantedSector): Promise<ConsumedSector>;
|
|
38
|
+
loadSector(sector: WantedSector, abortSignal?: AbortSignal): Promise<ConsumedSector>;
|
|
39
39
|
/**
|
|
40
40
|
* Sets transformation matrix of the model. This overrides the current transformation.
|
|
41
41
|
* @param matrix Transformation matrix.
|
|
@@ -200,6 +200,10 @@ export declare class CogniteCadModel implements CdfModelNodeCollectionDataProvid
|
|
|
200
200
|
* global clipping planes.
|
|
201
201
|
*/
|
|
202
202
|
setModelClippingPlanes(clippingPlanes: THREE.Plane[]): void;
|
|
203
|
+
/**
|
|
204
|
+
* Get the clipping planes for this model.
|
|
205
|
+
*/
|
|
206
|
+
getModelClippingPlanes(): THREE.Plane[];
|
|
203
207
|
/**
|
|
204
208
|
* Gets transformation from CDF space to ThreeJS space,
|
|
205
209
|
* which includes any additional "default" transformations assigned to this model.
|
|
@@ -29,6 +29,7 @@ export type SceneSectorMetadata = {
|
|
|
29
29
|
readonly boundingBox: BoundingBox;
|
|
30
30
|
readonly geometryBoundingBox?: BoundingBox;
|
|
31
31
|
readonly sectorFileName: string | null;
|
|
32
|
+
readonly texturedFileName: string | null;
|
|
32
33
|
readonly maxDiagonalLength: number;
|
|
33
34
|
readonly minDiagonalLength: number;
|
|
34
35
|
readonly downloadSize: number;
|
|
@@ -85,6 +85,7 @@ export declare class ComboControls extends EventDispatcher {
|
|
|
85
85
|
private readonly _raycaster;
|
|
86
86
|
private readonly _targetFPS;
|
|
87
87
|
private _targetFPSOverActualFPS;
|
|
88
|
+
private readonly _pointEventCache;
|
|
88
89
|
private _enabled;
|
|
89
90
|
private _options;
|
|
90
91
|
private static readonly DefaultControlsOptions;
|
|
@@ -128,6 +129,7 @@ export declare class ComboControls extends EventDispatcher {
|
|
|
128
129
|
private readonly convertPixelCoordinatesToNormalized;
|
|
129
130
|
private readonly onPointerDown;
|
|
130
131
|
private readonly onMouseDown;
|
|
132
|
+
private readonly onPointerUp;
|
|
131
133
|
private readonly onMouseUp;
|
|
132
134
|
private readonly onMouseWheel;
|
|
133
135
|
private readonly onTouchStart;
|
|
@@ -114,7 +114,7 @@ export declare class DefaultCameraManager implements CameraManager {
|
|
|
114
114
|
private calculateNewTargetWithoutModel;
|
|
115
115
|
/**
|
|
116
116
|
* Calculates new camera target based on cursor position.
|
|
117
|
-
* @param event
|
|
117
|
+
* @param event PointerEvent that contains pointer location data.
|
|
118
118
|
*/
|
|
119
119
|
private calculateNewTarget;
|
|
120
120
|
/**
|
|
@@ -12,7 +12,7 @@ export declare class StationaryCameraManager implements CameraManager {
|
|
|
12
12
|
private readonly _minFOV;
|
|
13
13
|
private readonly _stopEventTrigger;
|
|
14
14
|
private _isDragging;
|
|
15
|
-
private
|
|
15
|
+
private _pointerEventCache;
|
|
16
16
|
constructor(domElement: HTMLElement, camera: THREE.PerspectiveCamera);
|
|
17
17
|
getCamera(): THREE.PerspectiveCamera;
|
|
18
18
|
get defaultFOV(): number;
|
|
@@ -33,9 +33,9 @@ export declare class StationaryCameraManager implements CameraManager {
|
|
|
33
33
|
private readonly onPointerDown;
|
|
34
34
|
private readonly onPointerMove;
|
|
35
35
|
private rotateCamera;
|
|
36
|
-
private
|
|
36
|
+
private pinchZoomAndRotate;
|
|
37
37
|
private readonly zoomCamera;
|
|
38
38
|
private getCursorRay;
|
|
39
39
|
private getTarget;
|
|
40
|
-
private
|
|
40
|
+
private calculatePinchZoomDistanceDelta;
|
|
41
41
|
}
|
|
@@ -18,4 +18,4 @@ export { StylableObject, SerializableStylableObject } from './src/pointcloud-sty
|
|
|
18
18
|
export { CdfPointCloudStylableObjectProvider } from './src/pointcloud-stylable-object-providers/CdfPointCloudStylableObjectProvider';
|
|
19
19
|
export { DummyPointCloudStylableObjectProvider } from './src/pointcloud-stylable-object-providers/DummyPointCloudStylableObjectProvider';
|
|
20
20
|
export { Image360Provider } from './src/Image360Provider';
|
|
21
|
-
export { BinaryFileProvider, JsonFileProvider, File3dFormat, BlobOutputMetadata, Image360Descriptor, Image360FileProvider, Image360Face } from './src/types';
|
|
21
|
+
export { BinaryFileProvider, JsonFileProvider, File3dFormat, BlobOutputMetadata, Image360Descriptor, Image360FileProvider, Image360Face, Image360Texture } from './src/types';
|
|
@@ -16,6 +16,7 @@ export interface ModelDataProvider extends JsonFileProvider, BinaryFileProvider
|
|
|
16
16
|
* Downloads a binary blob.
|
|
17
17
|
* @param baseUrl Base URL of the model.
|
|
18
18
|
* @param fileName Filename of binary file.
|
|
19
|
+
* @param abortSignal Optional abort signal that can be used to cancel an in progress fetch.
|
|
19
20
|
*/
|
|
20
|
-
getBinaryFile(baseUrl: string, fileName: string): Promise<ArrayBuffer>;
|
|
21
|
+
getBinaryFile(baseUrl: string, fileName: string, abortSignal?: AbortSignal): Promise<ArrayBuffer>;
|
|
21
22
|
}
|