@cognite/reveal 4.2.1 → 4.3.0
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 +2 -1
- package/dist/index.js +195 -170
- package/dist/index.js.map +1 -1
- package/dist/packages/360-images/index.d.ts +7 -1
- package/dist/packages/360-images/src/Image360Facade.d.ts +7 -7
- package/dist/packages/360-images/src/annotation/BoxAnnotationData.d.ts +16 -0
- package/dist/packages/360-images/src/annotation/Image360Annotation.d.ts +34 -0
- package/dist/packages/360-images/src/annotation/Image360AnnotationFilter.d.ts +12 -0
- package/dist/packages/360-images/src/annotation/Image360AnnotationIntersection.d.ts +22 -0
- package/dist/packages/360-images/src/annotation/ImageAnnotationData.d.ts +9 -0
- package/dist/packages/360-images/src/annotation/ImageAnnotationObject.d.ts +38 -0
- package/dist/packages/360-images/src/annotation/PolygonAnnotationData.d.ts +15 -0
- package/dist/packages/360-images/src/annotation/types.d.ts +28 -0
- package/dist/packages/360-images/src/cache/Image360LoadingCache.d.ts +14 -8
- package/dist/packages/360-images/src/collection/DefaultImage360Collection.d.ts +26 -2
- package/dist/packages/360-images/src/collection/Image360Collection.d.ts +61 -0
- package/dist/packages/360-images/src/collection/Image360CollectionFactory.d.ts +7 -3
- package/dist/packages/360-images/src/entity/Image360.d.ts +25 -0
- package/dist/packages/360-images/src/entity/Image360Entity.d.ts +42 -28
- package/dist/packages/360-images/src/entity/Image360Revision.d.ts +23 -0
- package/dist/packages/360-images/src/entity/Image360RevisionEntity.d.ts +62 -0
- package/dist/packages/360-images/src/entity/Image360VisualizationBox.d.ts +10 -3
- package/dist/packages/360-images/src/icons/IconCollection.d.ts +13 -7
- package/dist/packages/360-images/src/types.d.ts +2 -1
- package/dist/packages/3d-overlays/index.d.ts +9 -0
- package/dist/packages/{360-images/src/icons → 3d-overlays/src}/IconOctree.d.ts +6 -6
- package/dist/packages/3d-overlays/src/Overlay3D.d.ts +33 -0
- package/dist/packages/3d-overlays/src/Overlay3DCollection.d.ts +35 -0
- package/dist/packages/3d-overlays/src/Overlay3DIcon.d.ts +70 -0
- package/dist/packages/3d-overlays/src/OverlayCollection.d.ts +55 -0
- package/dist/packages/3d-overlays/src/OverlayPointsObject.d.ts +27 -0
- package/dist/packages/api/src/api-helpers/Image360ApiHelper.d.ts +16 -8
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +30 -7
- package/dist/packages/api/src/public/migration/types.d.ts +15 -1
- package/dist/packages/cad-geometry-loaders/src/sector/SectorLoader.d.ts +1 -1
- package/dist/packages/cad-geometry-loaders/src/sector/culling/SectorCuller.d.ts +6 -5
- package/dist/packages/cad-model/src/types.d.ts +1 -1
- package/dist/packages/cad-model/src/wrappers/CadNode.d.ts +2 -0
- package/dist/packages/cad-model/src/wrappers/CogniteCadModel.d.ts +7 -7
- package/dist/packages/cad-parsers/src/metadata/CadModelMetadata.d.ts +1 -1
- package/dist/packages/cad-styling/src/NodeAppearance.d.ts +2 -2
- package/dist/packages/cad-styling/src/PopulateIndexSetFromPagedResponseHelper.d.ts +2 -1
- package/dist/packages/camera-manager/src/CameraManager.d.ts +4 -4
- package/dist/packages/camera-manager/src/CameraManagerHelper.d.ts +7 -0
- package/dist/packages/data-providers/index.d.ts +2 -2
- package/dist/packages/data-providers/src/Image360Provider.d.ts +4 -2
- package/dist/packages/data-providers/src/image-360-data-providers/Cdf360ImageEventProvider.d.ts +7 -5
- package/dist/packages/data-providers/src/image-360-data-providers/Local360ImageProvider.d.ts +6 -2
- package/dist/packages/data-providers/src/types.d.ts +16 -4
- package/dist/packages/model-base/src/types.d.ts +1 -4
- package/dist/packages/pointclouds/src/CognitePointCloudModel.d.ts +2 -2
- package/dist/packages/pointclouds/src/PointCloudIntersection.d.ts +1 -1
- package/dist/packages/pointclouds/src/potree-three-loader/loading/ClassificationInfo.d.ts +1 -1
- package/dist/packages/rendering/src/pointcloud-rendering/PointCloudMaterial.d.ts +2 -87
- package/dist/packages/rendering/src/rendering/NodeAppearanceTextureBuilder.d.ts +2 -2
- package/dist/packages/tools/index.d.ts +1 -0
- package/dist/packages/tools/src/HtmlOverlay/BucketGrid2D.d.ts +1 -1
- package/dist/packages/tools/src/HtmlOverlay/HtmlOverlayTool.d.ts +1 -1
- package/dist/packages/tools/src/Overlay3D/Overlay3DTool.d.ts +134 -0
- package/dist/packages/utilities/index.d.ts +1 -1
- package/dist/packages/utilities/src/WebGLRendererStateHelper.d.ts +1 -1
- package/dist/packages/utilities/src/constants.d.ts +1 -3
- package/dist/packages/utilities/src/three/VariableWidthLine.d.ts +15 -0
- package/package.json +41 -40
- package/dist/packages/360-images/src/icons/Image360Icon.d.ts +0 -29
- package/dist/packages/360-images/src/icons/InstancedIconSprite.d.ts +0 -16
- package/dist/packages/tools/src/types.d.ts +0 -4
- package/dist/packages/utilities/src/three/BoundingBoxLOD.d.ts +0 -27
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Image360DataProvider, Image360Descriptor } from '../../../data-providers';
|
|
5
|
+
import { Image360Revision } from './Image360Revision';
|
|
6
|
+
import { Image360VisualizationBox } from './Image360VisualizationBox';
|
|
7
|
+
import { ImageAnnotationObject } from '../annotation/ImageAnnotationObject';
|
|
8
|
+
import { Image360AnnotationAppearance } from '../annotation/types';
|
|
9
|
+
import { Image360AnnotationFilter } from '../annotation/Image360AnnotationFilter';
|
|
10
|
+
export declare class Image360RevisionEntity implements Image360Revision {
|
|
11
|
+
private readonly _imageProvider;
|
|
12
|
+
private readonly _image360Descriptor;
|
|
13
|
+
private readonly _image360VisualizationBox;
|
|
14
|
+
private _previewTextures;
|
|
15
|
+
private _fullResolutionTextures;
|
|
16
|
+
private _onFullResolutionCompleted;
|
|
17
|
+
private _defaultAppearance;
|
|
18
|
+
private _annotations;
|
|
19
|
+
private readonly _annotationFilterer;
|
|
20
|
+
constructor(imageProvider: Image360DataProvider, image360Descriptor: Image360Descriptor, image360VisualizationBox: Image360VisualizationBox, annotationFilterer: Image360AnnotationFilter);
|
|
21
|
+
/**
|
|
22
|
+
* The date of this revision. Undefined if the revision is undated.
|
|
23
|
+
* @returns Date | undefined
|
|
24
|
+
*/
|
|
25
|
+
get date(): Date | undefined;
|
|
26
|
+
getAnnotations(): Promise<ImageAnnotationObject[]>;
|
|
27
|
+
intersectAnnotations(raycaster: THREE.Raycaster): ImageAnnotationObject | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Loads the textures needed for the 360 image (6 faces).
|
|
30
|
+
*
|
|
31
|
+
* This will start the download of both low and full resolution textures and return one promise for when each texture set is ready.
|
|
32
|
+
* If the low resolution images are completed first the full resolution download and texture loading will continue in the background,
|
|
33
|
+
* and applyFullResolutionTextures can be called to apply full resolution textures to the image360VisualizationBox at a desired time.
|
|
34
|
+
*
|
|
35
|
+
* @returns lowResolutionCompleted A promise for when the low resolution images are done loading.
|
|
36
|
+
* @returns fullResolutionCompleted A promise for when the full resolution images are done loading.
|
|
37
|
+
*/
|
|
38
|
+
loadTextures(abortSignal?: AbortSignal): {
|
|
39
|
+
lowResolutionCompleted: Promise<void>;
|
|
40
|
+
fullResolutionCompleted: Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
getPreviewThumbnailUrl(face?: 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom'): Promise<string | undefined>;
|
|
43
|
+
private loadPreviewTextures;
|
|
44
|
+
private loadFullTextures;
|
|
45
|
+
private loadAndSetAnnotations;
|
|
46
|
+
setDefaultAppearance(appearance: Image360AnnotationAppearance): void;
|
|
47
|
+
private propagateDefaultAppearanceToAnnotations;
|
|
48
|
+
/**
|
|
49
|
+
* Clear the cached textures used by this revision.
|
|
50
|
+
*/
|
|
51
|
+
dispose(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Apply cached textures to the image360VisualizationBox.
|
|
54
|
+
*/
|
|
55
|
+
applyTextures(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Apply full resolution textures to the image360VisualizationBox.
|
|
58
|
+
* This has no effect if full resolution has already been applied.
|
|
59
|
+
*/
|
|
60
|
+
applyFullResolutionTextures(): Promise<void>;
|
|
61
|
+
getDescriptors(): Image360Descriptor;
|
|
62
|
+
}
|
|
@@ -2,25 +2,32 @@
|
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { SceneHandler } from '../../../utilities';
|
|
5
|
+
import { DeviceDescriptor, SceneHandler } from '../../../utilities';
|
|
6
6
|
import { Image360Face, Image360Texture } from '../../../data-providers';
|
|
7
7
|
import { Image360Visualization } from './Image360Visualization';
|
|
8
|
+
import { ImageAnnotationObject } from '../annotation/ImageAnnotationObject';
|
|
8
9
|
export declare class Image360VisualizationBox implements Image360Visualization {
|
|
10
|
+
private readonly MAX_MOBILE_IMAGE_SIZE;
|
|
9
11
|
private readonly _worldTransform;
|
|
10
12
|
private _visualizationMesh;
|
|
11
13
|
private _faceMaterials;
|
|
12
14
|
private readonly _sceneHandler;
|
|
15
|
+
private readonly _device;
|
|
13
16
|
private readonly _visualizationState;
|
|
14
17
|
private readonly _textureLoader;
|
|
15
18
|
private readonly _faceMaterialOrder;
|
|
19
|
+
private readonly _annotationsGroup;
|
|
16
20
|
get opacity(): number;
|
|
17
21
|
set opacity(alpha: number);
|
|
18
22
|
get visible(): boolean;
|
|
19
23
|
set visible(isVisible: boolean);
|
|
20
24
|
set scale(newScale: THREE.Vector3);
|
|
21
25
|
set renderOrder(newRenderOrder: number);
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
setAnnotations(annotations: ImageAnnotationObject[]): void;
|
|
27
|
+
constructor(worldTransform: THREE.Matrix4, sceneHandler: SceneHandler, device: DeviceDescriptor);
|
|
28
|
+
loadImages(textures: Image360Texture[]): void;
|
|
24
29
|
loadFaceTextures(faces: Image360Face[]): Promise<Image360Texture[]>;
|
|
25
30
|
unloadImages(): void;
|
|
31
|
+
private getScaledImageTexture;
|
|
32
|
+
setAnnotationsVisibility(visibility: boolean): void;
|
|
26
33
|
}
|
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Vector3 } from 'three';
|
|
5
5
|
import { BeforeSceneRenderedDelegate, EventTrigger, SceneHandler } from '../../../utilities';
|
|
6
|
-
import {
|
|
6
|
+
import { Overlay3DIcon } from '../../../3d-overlays';
|
|
7
7
|
export type IconCullingScheme = 'clustered' | 'proximity';
|
|
8
|
+
export type IconsOptions = {
|
|
9
|
+
platformMaxPointsSize?: number;
|
|
10
|
+
};
|
|
8
11
|
export declare class IconCollection {
|
|
9
|
-
private readonly
|
|
10
|
-
private readonly
|
|
12
|
+
private static readonly MinPixelSize;
|
|
13
|
+
private static readonly DefaultMaxPixelSize;
|
|
14
|
+
private readonly _maxPixelSize;
|
|
11
15
|
private readonly _sceneHandler;
|
|
12
|
-
private readonly _hoverIconTexture;
|
|
13
16
|
private readonly _sharedTexture;
|
|
17
|
+
private readonly _hoverSprite;
|
|
14
18
|
private readonly _icons;
|
|
15
|
-
private readonly
|
|
19
|
+
private readonly _pointsObject;
|
|
16
20
|
private readonly _computeClustersEventHandler;
|
|
17
21
|
private readonly _computeProximityPointsEventHandler;
|
|
18
22
|
private readonly _onBeforeSceneRenderedEvent;
|
|
@@ -21,14 +25,16 @@ export declare class IconCollection {
|
|
|
21
25
|
private _iconCullingScheme;
|
|
22
26
|
private _proximityRadius;
|
|
23
27
|
private _proximityPointLimit;
|
|
24
|
-
get icons():
|
|
28
|
+
get icons(): Overlay3DIcon[];
|
|
29
|
+
set hoverSpriteVisibility(value: boolean);
|
|
25
30
|
setCullingScheme(scheme: IconCullingScheme): void;
|
|
26
31
|
set360IconCullingRestrictions(radius: number, pointLimit: number): void;
|
|
27
|
-
constructor(points: Vector3[], sceneHandler: SceneHandler, onBeforeSceneRendered: EventTrigger<BeforeSceneRenderedDelegate
|
|
32
|
+
constructor(points: Vector3[], sceneHandler: SceneHandler, onBeforeSceneRendered: EventTrigger<BeforeSceneRenderedDelegate>, iconOptions?: IconsOptions);
|
|
28
33
|
private setIconClustersByLOD;
|
|
29
34
|
private computeProximityPoints;
|
|
30
35
|
private initializeImage360Icons;
|
|
31
36
|
dispose(): void;
|
|
37
|
+
private createHoverSprite;
|
|
32
38
|
private createOuterRingsTexture;
|
|
33
39
|
private createHoverIconTexture;
|
|
34
40
|
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Copyright 2023 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import { Image360 } from './entity/Image360';
|
|
5
|
+
import { Image360Revision } from './entity/Image360Revision';
|
|
5
6
|
/**
|
|
6
7
|
* Delegate for 360 image mode entered events.
|
|
7
8
|
*/
|
|
8
|
-
export type Image360EnteredDelegate = (image360: Image360) => void;
|
|
9
|
+
export type Image360EnteredDelegate = (image360: Image360, revision: Image360Revision) => void;
|
|
9
10
|
/**
|
|
10
11
|
* Delegate for 360 image mode exited events.
|
|
11
12
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
export { Overlay3DCollection } from './src/Overlay3DCollection';
|
|
5
|
+
export { OverlayPointsObject, OverlayPointsParameters } from './src/OverlayPointsObject';
|
|
6
|
+
export { Overlay3DIcon } from './src/Overlay3DIcon';
|
|
7
|
+
export { Overlay3D } from './src/Overlay3D';
|
|
8
|
+
export { OverlayCollection, OverlayInfo, DefaultOverlay3DContentType } from './src/OverlayCollection';
|
|
9
|
+
export { IconOctree } from './src/IconOctree';
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Node, PointOctant, PointOctree } from 'sparse-octree';
|
|
5
5
|
import { Box3, Matrix4 } from 'three';
|
|
6
|
-
import {
|
|
7
|
-
export declare class IconOctree extends PointOctree<
|
|
6
|
+
import { Overlay3DIcon } from './Overlay3DIcon';
|
|
7
|
+
export declare class IconOctree extends PointOctree<Overlay3DIcon> {
|
|
8
8
|
private readonly _nodeCenters;
|
|
9
|
-
static getMinimalOctreeBoundsFromIcons(icons:
|
|
10
|
-
constructor(icons:
|
|
11
|
-
getNodeIcon(node: Node):
|
|
12
|
-
getLODByScreenArea(areaThreshold: number, projection: Matrix4, minimumLevel?: number): Set<PointOctant<
|
|
9
|
+
static getMinimalOctreeBoundsFromIcons(icons: Overlay3DIcon[]): Box3;
|
|
10
|
+
constructor(icons: Overlay3DIcon[], bounds: Box3, maxLeafSize: number);
|
|
11
|
+
getNodeIcon(node: Node): Overlay3DIcon | undefined;
|
|
12
|
+
getLODByScreenArea(areaThreshold: number, projection: Matrix4, minimumLevel?: number): Set<PointOctant<Overlay3DIcon>>;
|
|
13
13
|
private populateNodeCenters;
|
|
14
14
|
private filterEmptyLeaves;
|
|
15
15
|
private hasChildren;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Color, Vector3 } from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Represents one 3d overlay
|
|
7
|
+
*/
|
|
8
|
+
export interface Overlay3D<ContentType> {
|
|
9
|
+
/**
|
|
10
|
+
* Set whether this overlay should be visible.
|
|
11
|
+
* */
|
|
12
|
+
setVisible(visible: boolean): void;
|
|
13
|
+
/**
|
|
14
|
+
* Get whether this overlay is visible.
|
|
15
|
+
*/
|
|
16
|
+
getVisible(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the position of this overlay.
|
|
19
|
+
*/
|
|
20
|
+
getPosition(): Vector3;
|
|
21
|
+
/**
|
|
22
|
+
* Set the display color of this overlay.
|
|
23
|
+
* */
|
|
24
|
+
setColor(color: Color): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get the display color of this overlay.
|
|
27
|
+
* */
|
|
28
|
+
getColor(): Color;
|
|
29
|
+
/**
|
|
30
|
+
* Get the metadata associated with this overlay.
|
|
31
|
+
* */
|
|
32
|
+
getContent(): ContentType;
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Color, Texture, Object3D } from 'three';
|
|
5
|
+
import { Overlay3D } from './Overlay3D';
|
|
6
|
+
import { DefaultOverlay3DContentType, OverlayCollection, OverlayInfo } from './OverlayCollection';
|
|
7
|
+
export type Overlay3DCollectionOptions = {
|
|
8
|
+
overlayTexture?: Texture;
|
|
9
|
+
overlayTextureMask?: Texture;
|
|
10
|
+
maxPointSize?: number;
|
|
11
|
+
defaultOverlayColor?: Color;
|
|
12
|
+
};
|
|
13
|
+
export declare class Overlay3DCollection<MetadataType = DefaultOverlay3DContentType> extends Object3D implements OverlayCollection<MetadataType> {
|
|
14
|
+
private readonly MinPixelSize;
|
|
15
|
+
private readonly MaxPixelSize;
|
|
16
|
+
private readonly DefaultMaxPoints;
|
|
17
|
+
private readonly defaultOverlayColor;
|
|
18
|
+
private readonly _sharedTextures;
|
|
19
|
+
private readonly _overlayPoints;
|
|
20
|
+
private readonly _iconRadius;
|
|
21
|
+
private _overlays;
|
|
22
|
+
private _octree;
|
|
23
|
+
constructor(overlayInfos?: OverlayInfo<MetadataType>[], options?: Overlay3DCollectionOptions);
|
|
24
|
+
setVisibility(visibility: boolean): void;
|
|
25
|
+
getOverlays(): Overlay3D<MetadataType>[];
|
|
26
|
+
addOverlays(overlayInfos: OverlayInfo<MetadataType>[]): Overlay3D<MetadataType>[];
|
|
27
|
+
sortOverlaysRelativeToCamera(camera: THREE.Camera): void;
|
|
28
|
+
removeOverlays(overlays: Overlay3D<MetadataType>[]): void;
|
|
29
|
+
removeAllOverlays(): void;
|
|
30
|
+
private rebuildOctree;
|
|
31
|
+
private updatePointsObject;
|
|
32
|
+
private initializeOverlay3DIcons;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private createCircleTextures;
|
|
35
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { PerspectiveCamera, Ray, Vector3, Color } from 'three';
|
|
5
|
+
import { Overlay3D } from './Overlay3D';
|
|
6
|
+
import { DefaultOverlay3DContentType } from './OverlayCollection';
|
|
7
|
+
export type IconParameters = {
|
|
8
|
+
position: THREE.Vector3;
|
|
9
|
+
color?: THREE.Color;
|
|
10
|
+
minPixelSize: number;
|
|
11
|
+
maxPixelSize: number;
|
|
12
|
+
iconRadius: number;
|
|
13
|
+
hoverSprite?: THREE.Sprite;
|
|
14
|
+
};
|
|
15
|
+
export type SetAdaptiveScaleDelegate = (args: {
|
|
16
|
+
camera: THREE.Camera;
|
|
17
|
+
renderSize: THREE.Vector2;
|
|
18
|
+
domElement: HTMLElement;
|
|
19
|
+
}) => void;
|
|
20
|
+
export type ParametersChangeDelegate = (event: {
|
|
21
|
+
color: THREE.Color;
|
|
22
|
+
visble: boolean;
|
|
23
|
+
}) => void;
|
|
24
|
+
export type SelectedDelegate = (event: {
|
|
25
|
+
selected: boolean;
|
|
26
|
+
}) => void;
|
|
27
|
+
export type IconEvent = 'selected' | 'parametersChange';
|
|
28
|
+
export declare class Overlay3DIcon<ContentType = DefaultOverlay3DContentType> implements Overlay3D<ContentType> {
|
|
29
|
+
private readonly _position;
|
|
30
|
+
private readonly _minPixelSize;
|
|
31
|
+
private readonly _maxPixelSize;
|
|
32
|
+
private readonly _setAdaptiveScale;
|
|
33
|
+
private readonly _iconRadius;
|
|
34
|
+
private readonly _hoverSprite?;
|
|
35
|
+
private readonly _content;
|
|
36
|
+
private readonly _raycastBoundingSphere;
|
|
37
|
+
private _adaptiveScale;
|
|
38
|
+
private _visible;
|
|
39
|
+
private _culled;
|
|
40
|
+
private _selected;
|
|
41
|
+
private _color;
|
|
42
|
+
private readonly _ndcPosition;
|
|
43
|
+
private readonly _events;
|
|
44
|
+
constructor(iconParameters: IconParameters, content: ContentType);
|
|
45
|
+
on(event: 'selected', callback: SelectedDelegate): void;
|
|
46
|
+
on(event: 'parametersChange', callback: ParametersChangeDelegate): void;
|
|
47
|
+
off(event: 'selected', callback: SelectedDelegate): void;
|
|
48
|
+
off(event: 'parametersChange', callback: ParametersChangeDelegate): void;
|
|
49
|
+
set selected(newValue: boolean);
|
|
50
|
+
get selected(): boolean;
|
|
51
|
+
updateHoverSpriteScale(): void;
|
|
52
|
+
updateAdaptiveScale(delegateArguments: {
|
|
53
|
+
renderSize: THREE.Vector2;
|
|
54
|
+
camera: PerspectiveCamera;
|
|
55
|
+
domElement: HTMLElement;
|
|
56
|
+
}): void;
|
|
57
|
+
setColor(color: Color): void;
|
|
58
|
+
getColor(): Color;
|
|
59
|
+
getContent(): ContentType;
|
|
60
|
+
get adaptiveScale(): number;
|
|
61
|
+
set culled(culled: boolean);
|
|
62
|
+
get culled(): boolean;
|
|
63
|
+
setVisible(visible: boolean): void;
|
|
64
|
+
getVisible(): boolean;
|
|
65
|
+
getPosition(): Vector3;
|
|
66
|
+
intersect(ray: Ray): Vector3 | null;
|
|
67
|
+
dispose(): void;
|
|
68
|
+
private setupAdaptiveScaling;
|
|
69
|
+
private computeAdaptiveScaling;
|
|
70
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Overlay3D } from './Overlay3D';
|
|
5
|
+
/**
|
|
6
|
+
* The default metadata type contained in Overlays
|
|
7
|
+
*/
|
|
8
|
+
export type DefaultOverlay3DContentType = {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Data used in creating an overlay.
|
|
13
|
+
*/
|
|
14
|
+
export type OverlayInfo<ContentType = DefaultOverlay3DContentType> = {
|
|
15
|
+
/**
|
|
16
|
+
* Position of the overlay
|
|
17
|
+
*/
|
|
18
|
+
position: THREE.Vector3;
|
|
19
|
+
/**
|
|
20
|
+
* The data contained in this overlay
|
|
21
|
+
*/
|
|
22
|
+
content: ContentType;
|
|
23
|
+
/**
|
|
24
|
+
* The color of this overlay. Will be set by collection if undefined
|
|
25
|
+
*/
|
|
26
|
+
color?: THREE.Color;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* A set of overlays managed.
|
|
30
|
+
*/
|
|
31
|
+
export interface OverlayCollection<ContentType> {
|
|
32
|
+
/**
|
|
33
|
+
* Get all overlays in the collection.
|
|
34
|
+
* */
|
|
35
|
+
getOverlays(): Overlay3D<ContentType>[];
|
|
36
|
+
/**
|
|
37
|
+
* Add overlays to the collection.
|
|
38
|
+
* @param overlays Overlays to add to the collection.
|
|
39
|
+
* @returns The added overlays.
|
|
40
|
+
*/
|
|
41
|
+
addOverlays(overlays: OverlayInfo<ContentType>[]): Overlay3D<ContentType>[];
|
|
42
|
+
/**
|
|
43
|
+
* Remove overlays from the collection.
|
|
44
|
+
* @param overlays Overlays to remove from the collection.
|
|
45
|
+
*/
|
|
46
|
+
removeOverlays(overlays: Overlay3D<ContentType>[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Remove all overlays from the collection.
|
|
49
|
+
*/
|
|
50
|
+
removeAllOverlays(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Sets whether overlays in the collection should be visible.
|
|
53
|
+
*/
|
|
54
|
+
setVisibility(visibility: boolean): void;
|
|
55
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Color, DepthModes, Group, Texture, Vector3 } from 'three';
|
|
5
|
+
export type OverlayPointsParameters = {
|
|
6
|
+
spriteTexture: Texture;
|
|
7
|
+
maskTexture?: Texture;
|
|
8
|
+
minPixelSize: number;
|
|
9
|
+
maxPixelSize: number;
|
|
10
|
+
radius: number;
|
|
11
|
+
colorTint?: Color;
|
|
12
|
+
depthMode?: DepthModes;
|
|
13
|
+
collectionOpacity?: number;
|
|
14
|
+
};
|
|
15
|
+
export declare class OverlayPointsObject extends Group {
|
|
16
|
+
private readonly _geometry;
|
|
17
|
+
private readonly _frontMaterial;
|
|
18
|
+
private readonly _positionBuffer;
|
|
19
|
+
private readonly _positionAttribute;
|
|
20
|
+
private readonly _colorBuffer;
|
|
21
|
+
private readonly _colorAttribute;
|
|
22
|
+
constructor(maxNumberOfPoints: number, materialParameters: OverlayPointsParameters);
|
|
23
|
+
setPoints(points: Vector3[], colors?: Color[]): void;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
private initializePoints;
|
|
26
|
+
private createIconsMaterial;
|
|
27
|
+
}
|
|
@@ -2,36 +2,44 @@
|
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { CogniteClient } from '@cognite/sdk';
|
|
6
|
-
import { Image360Collection, Image360Entity, Image360 } from '../../../360-images';
|
|
5
|
+
import { CogniteClient, Metadata } from '@cognite/sdk';
|
|
6
|
+
import { Image360Collection, Image360Entity, Image360, IconsOptions, Image360RevisionEntity, Image360AnnotationIntersection, Image360AnnotationFilterOptions } from '../../../360-images';
|
|
7
7
|
import { BeforeSceneRenderedDelegate, EventTrigger, InputHandler, SceneHandler } from '../../../utilities';
|
|
8
8
|
import { ProxyCameraManager } from '../../../camera-manager';
|
|
9
9
|
export declare class Image360ApiHelper {
|
|
10
10
|
private readonly _image360Facade;
|
|
11
11
|
private readonly _domElement;
|
|
12
12
|
private _transitionInProgress;
|
|
13
|
+
private readonly _raycaster;
|
|
14
|
+
private _needsRedraw;
|
|
15
|
+
private readonly _imageCollections;
|
|
13
16
|
private readonly _interactionState;
|
|
14
17
|
private readonly _eventHandlers;
|
|
15
18
|
private readonly _debouncePreLoad;
|
|
16
|
-
private readonly _requestRedraw;
|
|
17
19
|
private readonly _activeCameraManager;
|
|
18
20
|
private readonly _image360Navigation;
|
|
19
21
|
private readonly _onBeforeSceneRenderedEvent;
|
|
20
22
|
private _cachedCameraManager;
|
|
21
|
-
constructor(cogniteClient: CogniteClient, sceneHandler: SceneHandler, domElement: HTMLElement, activeCameraManager: ProxyCameraManager, inputHandler: InputHandler,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
constructor(cogniteClient: CogniteClient, sceneHandler: SceneHandler, domElement: HTMLElement, activeCameraManager: ProxyCameraManager, inputHandler: InputHandler, onBeforeSceneRendered: EventTrigger<BeforeSceneRenderedDelegate>, iconsOptions?: IconsOptions);
|
|
24
|
+
get needsRedraw(): boolean;
|
|
25
|
+
resetRedraw(): void;
|
|
26
|
+
private getNormalizedOffset;
|
|
27
|
+
add360ImageSet(eventFilter: Metadata, collectionTransform: THREE.Matrix4, preMultipliedRotation: boolean, annotationOptions?: Image360AnnotationFilterOptions): Promise<Image360Collection>;
|
|
28
|
+
getImageCollections(): Image360Collection[];
|
|
25
29
|
remove360Images(entities: Image360[]): Promise<void>;
|
|
26
|
-
|
|
30
|
+
remove360ImageCollection(collection: Image360Collection): void;
|
|
31
|
+
enter360Image(image360Entity: Image360Entity, revision?: Image360RevisionEntity): Promise<void>;
|
|
32
|
+
private applyFullResolutionTextures;
|
|
27
33
|
private transition;
|
|
28
34
|
private tweenVisualizationAlpha;
|
|
29
35
|
private tweenVisualizationZoom;
|
|
30
36
|
private set360CameraManager;
|
|
31
37
|
exit360Image(): void;
|
|
32
38
|
dispose(): void;
|
|
39
|
+
private findRevisionIdToEnter;
|
|
33
40
|
private enter360ImageOnIntersect;
|
|
34
41
|
intersect360ImageIcons(offsetX: number, offsetY: number): Image360Entity | undefined;
|
|
42
|
+
intersect360ImageAnnotations(offsetX: number, offsetY: number): Image360AnnotationIntersection | undefined;
|
|
35
43
|
private setHoverIconOnIntersect;
|
|
36
44
|
private exit360ImageOnEscape;
|
|
37
45
|
}
|
|
@@ -5,12 +5,12 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { PointerEventDelegate, SceneRenderedDelegate, DisposedDelegate, BeforeSceneRenderedDelegate } from '../../../../utilities';
|
|
6
6
|
import { CogniteCadModel } from '../../../../cad-model';
|
|
7
7
|
import { PointCloudBudget, CognitePointCloudModel } from '../../../../pointclouds';
|
|
8
|
-
import { AddImage360Options, AddModelOptions, Cognite3DViewerOptions, Intersection, CadModelBudget, ResolutionOptions } from './types';
|
|
8
|
+
import { AddImage360Options, AddModelOptions, Cognite3DViewerOptions, Intersection, CadModelBudget, ResolutionOptions, RenderParameters } from './types';
|
|
9
9
|
import { CogniteModel } from '../types';
|
|
10
10
|
import { ViewerState } from '../../utilities/ViewStateHelper';
|
|
11
11
|
import { CameraManager, CameraChangeDelegate, CameraStopDelegate } from '../../../../camera-manager';
|
|
12
12
|
import { SupportedModelTypes } from '../../../../model-base';
|
|
13
|
-
import { Image360Collection, Image360 } from '../../../../360-images';
|
|
13
|
+
import { Image360Collection, Image360, Image360Revision, Image360AnnotationIntersection } from '../../../../360-images';
|
|
14
14
|
/**
|
|
15
15
|
* @example
|
|
16
16
|
* ```js
|
|
@@ -35,6 +35,10 @@ export declare class Cognite3DViewer {
|
|
|
35
35
|
* The DOM element cannot be changed after the viewer has been created.
|
|
36
36
|
*/
|
|
37
37
|
get domElement(): HTMLElement;
|
|
38
|
+
/**
|
|
39
|
+
* Returns parameters of THREE.WebGLRenderer used by the viewer.
|
|
40
|
+
*/
|
|
41
|
+
get renderParameters(): RenderParameters;
|
|
38
42
|
/**
|
|
39
43
|
* Returns the renderer used to produce images from 3D geometry.
|
|
40
44
|
*/
|
|
@@ -110,10 +114,10 @@ export declare class Cognite3DViewer {
|
|
|
110
114
|
/**
|
|
111
115
|
* Dispose of WebGL resources. Can be used to free up memory when the viewer is no longer in use.
|
|
112
116
|
* @see {@link https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects}
|
|
113
|
-
* ```
|
|
117
|
+
* ```js
|
|
114
118
|
* // Viewer is no longer in use, free up memory
|
|
115
119
|
* viewer.dispose();
|
|
116
|
-
*
|
|
120
|
+
* ```
|
|
117
121
|
*/
|
|
118
122
|
dispose(): void;
|
|
119
123
|
/**
|
|
@@ -181,7 +185,7 @@ export declare class Cognite3DViewer {
|
|
|
181
185
|
*/
|
|
182
186
|
off(event: 'cameraStop', callback: CameraStopDelegate): void;
|
|
183
187
|
/**
|
|
184
|
-
* Unsubscribe the 'beforeSceneRendered'-event previously subscribed with {@link on}.
|
|
188
|
+
* Unsubscribe the 'beforeSceneRendered'-event previously subscribed with {@link Cognite3DViewer.on}.
|
|
185
189
|
*/
|
|
186
190
|
off(event: 'beforeSceneRendered', callback: BeforeSceneRenderedDelegate): void;
|
|
187
191
|
/**
|
|
@@ -277,16 +281,27 @@ export declare class Cognite3DViewer {
|
|
|
277
281
|
add360ImageSet(datasource: 'events', eventFilter: {
|
|
278
282
|
[key: string]: string;
|
|
279
283
|
}, add360ImageOptions?: AddImage360Options): Promise<Image360Collection>;
|
|
284
|
+
/**
|
|
285
|
+
* Returns a list of added 360 image collections.
|
|
286
|
+
*/
|
|
287
|
+
get360ImageCollections(): Image360Collection[];
|
|
280
288
|
/**
|
|
281
289
|
* Remove a set of 360 images.
|
|
282
290
|
* @param image360Entities
|
|
291
|
+
* @deprecated
|
|
283
292
|
*/
|
|
284
293
|
remove360Images(...image360Entities: Image360[]): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Removes a previously added 360 image collection from the viewer.
|
|
296
|
+
* @param imageCollection Collection to remove.
|
|
297
|
+
*/
|
|
298
|
+
remove360ImageSet(imageCollection: Image360Collection): void;
|
|
285
299
|
/**
|
|
286
300
|
* Enter visualization of a 360 image.
|
|
287
|
-
* @param image360
|
|
301
|
+
* @param image360 The 360 image to enter.
|
|
302
|
+
* @param revision The image revision to use. If not provided the newest revision will be shown.
|
|
288
303
|
*/
|
|
289
|
-
enter360Image(image360: Image360): Promise<void>;
|
|
304
|
+
enter360Image(image360: Image360, revision?: Image360Revision): Promise<void>;
|
|
290
305
|
/**
|
|
291
306
|
* Exit visualization of the 360 image.
|
|
292
307
|
*/
|
|
@@ -558,6 +573,14 @@ export declare class Cognite3DViewer {
|
|
|
558
573
|
* ```
|
|
559
574
|
*/
|
|
560
575
|
getIntersectionFromPixel(offsetX: number, offsetY: number): Promise<null | Intersection>;
|
|
576
|
+
/**
|
|
577
|
+
* Check for intersections with 360 annotations through the given pixel.
|
|
578
|
+
* Similar to {getIntersectionFromPixel}, but checks 360 image annotations
|
|
579
|
+
* instead of models.
|
|
580
|
+
* @param offsetX
|
|
581
|
+
* @param offsetY
|
|
582
|
+
*/
|
|
583
|
+
get360AnnotationIntersectionFromPixel(offsetX: number, offsetY: number): Promise<null | Image360AnnotationIntersection>;
|
|
561
584
|
/** @private */
|
|
562
585
|
private getModels;
|
|
563
586
|
/**
|
|
@@ -8,6 +8,7 @@ import { CameraManager } from '../../../../camera-manager';
|
|
|
8
8
|
import { GeometryFilter, CogniteCadModel } from '../../../../cad-model';
|
|
9
9
|
import { DataSource } from '../../../../data-source';
|
|
10
10
|
import { EdlOptions } from '../../../../rendering';
|
|
11
|
+
import { Image360AnnotationFilterOptions } from '../../../../360-images';
|
|
11
12
|
/**
|
|
12
13
|
* Callback to monitor loaded requests and progress.
|
|
13
14
|
* Use OnLoadingCallback instead of onProgress/onComplete.
|
|
@@ -18,6 +19,15 @@ import { EdlOptions } from '../../../../rendering';
|
|
|
18
19
|
* @param itemsCulled Number of items deemed unnecessary to load in this batch.
|
|
19
20
|
*/
|
|
20
21
|
export type OnLoadingCallback = (itemsLoaded: number, itemsRequested: number, itemsCulled: number) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Some parameters of THREE.WebGLRenderer initialized with {@link Cognite3DViewer}.
|
|
24
|
+
*/
|
|
25
|
+
export type RenderParameters = {
|
|
26
|
+
/**
|
|
27
|
+
* Current width and height of the renderer's output canvas, in pixels.
|
|
28
|
+
*/
|
|
29
|
+
renderSize: THREE.Vector2;
|
|
30
|
+
};
|
|
21
31
|
/**
|
|
22
32
|
* @module @cognite/reveal
|
|
23
33
|
*/
|
|
@@ -123,7 +133,7 @@ export interface Cognite3DViewerOptions {
|
|
|
123
133
|
*
|
|
124
134
|
* Note that the data source must support {@link CdfModelIdentifier}.
|
|
125
135
|
*
|
|
126
|
-
* This cannot be used together with {@link _localModels}.
|
|
136
|
+
* This cannot be used together with {@link Cognite3DViewerOptions._localModels}.
|
|
127
137
|
*/
|
|
128
138
|
customDataSource?: DataSource;
|
|
129
139
|
/**
|
|
@@ -154,6 +164,10 @@ export type AddImage360Options = {
|
|
|
154
164
|
* @default true
|
|
155
165
|
*/
|
|
156
166
|
preMultipliedRotation?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Annotation options.
|
|
169
|
+
*/
|
|
170
|
+
annotationFilter?: Image360AnnotationFilterOptions;
|
|
157
171
|
};
|
|
158
172
|
export type CadIntersection = {
|
|
159
173
|
/**
|
|
@@ -7,7 +7,7 @@ import { SectorCuller } from './culling/SectorCuller';
|
|
|
7
7
|
import { ModelStateHandler } from './ModelStateHandler';
|
|
8
8
|
/**
|
|
9
9
|
* Loads sector based on a given camera pose, a set of models and budget.
|
|
10
|
-
* Uses {@link SectorCuller} to determine what to load, {@link
|
|
10
|
+
* Uses {@link SectorCuller} to determine what to load, {@link SectorDownloadScheduler} to
|
|
11
11
|
* load sectors and {@link ModelStateHandler} to keep track of what has been
|
|
12
12
|
* loaded to avoid loading data that's already available.
|
|
13
13
|
*
|
|
@@ -10,7 +10,8 @@ import { DetermineSectorsInput, SectorLoadingSpent } from './types';
|
|
|
10
10
|
export interface SectorCuller {
|
|
11
11
|
/**
|
|
12
12
|
* Determine initial sector prioritization about what we think to load. This provides an initial guesstimate of
|
|
13
|
-
* what sectors we should load. Use {@link filterSectorsToLoad} to improve
|
|
13
|
+
* what sectors we should load. Use {@link SectorCuller.filterSectorsToLoad} to improve
|
|
14
|
+
* this estimate as new data is loaded.
|
|
14
15
|
* @param input
|
|
15
16
|
*/
|
|
16
17
|
determineSectors(input: DetermineSectorsInput): {
|
|
@@ -19,11 +20,11 @@ export interface SectorCuller {
|
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
22
|
* Evaluates if sectors provided should be loaded or not, e.g. based on geometry we have now loaded
|
|
22
|
-
* since {@link determineSectors} was called. This can be used to e.g.
|
|
23
|
-
* of sectors based on geometry that has been loaded.
|
|
23
|
+
* since {@link SectorCuller.determineSectors} was called. This can be used to e.g.
|
|
24
|
+
* implement pre-load occlusion culling of sectors based on geometry that has been loaded.
|
|
24
25
|
*
|
|
25
|
-
* @param input Same input as used in {@link determineSectors}.
|
|
26
|
-
* @param wantedSectorsBatch A set of sectors from {@link determineSectors}, e.g. in batches of 5-10.
|
|
26
|
+
* @param input Same input as used in {@link SectorCuller.determineSectors}.
|
|
27
|
+
* @param wantedSectorsBatch A set of sectors from {@link SectorCuller.determineSectors}, e.g. in batches of 5-10.
|
|
27
28
|
*/
|
|
28
29
|
filterSectorsToLoad(input: DetermineSectorsInput, wantedSectorsBatch: WantedSector[]): Promise<WantedSector[]>;
|
|
29
30
|
/**
|
|
@@ -11,7 +11,7 @@ export type GeometryFilter = {
|
|
|
11
11
|
* will be transformed into coordinates relative to the model using the the model transformation
|
|
12
12
|
* which can be specified using {@link https://docs.cognite.com/api/v1/#operation/update3DRevisions |the CDF API},
|
|
13
13
|
* or set in {@link https://fusion.cognite.com/ |Cognite Fusion}.
|
|
14
|
-
* @see {@link isBoundingBoxInModelCoordinates}.
|
|
14
|
+
* @see {@link GeometryFilter.isBoundingBoxInModelCoordinates}.
|
|
15
15
|
*/
|
|
16
16
|
boundingBox?: THREE.Box3;
|
|
17
17
|
/**
|
|
@@ -20,8 +20,10 @@ export declare class CadNode extends Object3D {
|
|
|
20
20
|
private readonly _batchedGeometryMeshGroup;
|
|
21
21
|
private readonly _styledTreeIndexSets;
|
|
22
22
|
private _needsRedraw;
|
|
23
|
+
readonly type = "CadNode";
|
|
23
24
|
constructor(model: CadModelMetadata, materialManager: CadMaterialManager, sectorRepository: SectorRepository);
|
|
24
25
|
get needsRedraw(): boolean;
|
|
26
|
+
resetRedraw(): void;
|
|
25
27
|
get nodeTransformProvider(): NodeTransformProvider;
|
|
26
28
|
get nodeAppearanceProvider(): NodeAppearanceProvider;
|
|
27
29
|
get defaultNodeAppearance(): NodeAppearance;
|