@cognite/reveal 4.2.0-dev.20230427 → 4.2.0-dev.20230501
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 +1 -1
- package/dist/index.js +30 -30
- package/dist/index.js.map +1 -1
- package/dist/packages/360-images/index.d.ts +2 -0
- package/dist/packages/360-images/src/annotation/Image360Annotation.d.ts +22 -0
- package/dist/packages/360-images/src/annotation/ImageAnnotationObject.d.ts +11 -2
- package/dist/packages/360-images/src/annotation/types.d.ts +17 -0
- package/dist/packages/360-images/src/cache/Image360LoadingCache.d.ts +5 -3
- package/dist/packages/360-images/src/collection/DefaultImage360Collection.d.ts +4 -0
- package/dist/packages/360-images/src/collection/Image360Collection.d.ts +5 -0
- package/dist/packages/360-images/src/entity/Image360Entity.d.ts +1 -0
- package/dist/packages/360-images/src/entity/Image360Revision.d.ts +5 -0
- package/dist/packages/360-images/src/entity/Image360RevisionEntity.d.ts +15 -11
- package/dist/packages/360-images/src/entity/Image360VisualizationBox.d.ts +2 -0
- package/dist/packages/360-images/src/types.d.ts +3 -3
- package/package.json +5 -5
|
@@ -10,4 +10,6 @@ export { Image360Entity } from './src/entity/Image360Entity';
|
|
|
10
10
|
export { Image360RevisionEntity } from './src/entity/Image360RevisionEntity';
|
|
11
11
|
export { Image360Visualization } from './src/entity/Image360Visualization';
|
|
12
12
|
export { Image360EnteredDelegate, Image360ExitedDelegate, Image360AnnotationHoveredDelegate, Image360AnnotationClickedDelegate } from './src/types';
|
|
13
|
+
export { Image360AnnotationAppearance } from './src/annotation/types';
|
|
14
|
+
export { Image360Annotation } from './src/annotation/Image360Annotation';
|
|
13
15
|
export { DefaultImage360Collection } from './src/collection/DefaultImage360Collection';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Color } from 'three';
|
|
5
|
+
import { AnnotationModel } from '@cognite/sdk';
|
|
6
|
+
/**
|
|
7
|
+
* An annotation associated with a 360 image revision
|
|
8
|
+
*/
|
|
9
|
+
export interface Image360Annotation {
|
|
10
|
+
/**
|
|
11
|
+
* The underlying CDF annotation
|
|
12
|
+
*/
|
|
13
|
+
readonly annotation: AnnotationModel;
|
|
14
|
+
/**
|
|
15
|
+
* Set the display color of this annotation. Default: Random, based on annotation label
|
|
16
|
+
*/
|
|
17
|
+
setColor(color?: Color): void;
|
|
18
|
+
/**
|
|
19
|
+
* Set whether this annotation should be visible. Default: true
|
|
20
|
+
*/
|
|
21
|
+
setVisible(visible?: boolean): void;
|
|
22
|
+
}
|
|
@@ -3,16 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { AnnotationModel } from '@cognite/sdk';
|
|
5
5
|
import { Image360FileDescriptor } from '../../../data-providers';
|
|
6
|
-
import { Object3D } from 'three';
|
|
6
|
+
import { Color, Object3D } from 'three';
|
|
7
|
+
import { Image360Annotation } from './Image360Annotation';
|
|
8
|
+
import { Image360AnnotationAppearance } from './types';
|
|
7
9
|
type FaceType = Image360FileDescriptor['face'];
|
|
8
|
-
export declare class ImageAnnotationObject {
|
|
10
|
+
export declare class ImageAnnotationObject implements Image360Annotation {
|
|
9
11
|
private readonly _annotation;
|
|
10
12
|
private readonly _mesh;
|
|
13
|
+
private readonly _material;
|
|
14
|
+
private _defaultAppearance;
|
|
15
|
+
private readonly _appearance;
|
|
11
16
|
get annotation(): AnnotationModel;
|
|
12
17
|
static createAnnotationObject(annotation: AnnotationModel, face: FaceType): ImageAnnotationObject | undefined;
|
|
13
18
|
private constructor();
|
|
14
19
|
private getRotationFromFace;
|
|
15
20
|
private initializeTransform;
|
|
16
21
|
getObject(): Object3D;
|
|
22
|
+
updateMaterial(): void;
|
|
23
|
+
setDefaultStyle(appearance: Image360AnnotationAppearance): void;
|
|
24
|
+
setColor(color?: Color): void;
|
|
25
|
+
setVisible(visible?: boolean): void;
|
|
17
26
|
}
|
|
18
27
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Color } from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* The appearance of a 360 image annotation
|
|
7
|
+
*/
|
|
8
|
+
export type Image360AnnotationAppearance = {
|
|
9
|
+
/**
|
|
10
|
+
* The color of the annotation. Default: Random, based on annotation label
|
|
11
|
+
*/
|
|
12
|
+
color?: Color;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the annotation is visible. Default: true
|
|
15
|
+
*/
|
|
16
|
+
visible?: boolean;
|
|
17
|
+
};
|
|
@@ -6,14 +6,13 @@ import { Image360RevisionEntity } from '../entity/Image360RevisionEntity';
|
|
|
6
6
|
export type DownloadRequest = {
|
|
7
7
|
entity: Image360Entity;
|
|
8
8
|
revision: Image360RevisionEntity;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
anyCompleted: Promise<void>;
|
|
10
|
+
allCompleted: Promise<void>;
|
|
11
11
|
abort: () => void;
|
|
12
12
|
};
|
|
13
13
|
export type Loaded360Image = {
|
|
14
14
|
entity: Image360Entity;
|
|
15
15
|
revision: Image360RevisionEntity;
|
|
16
|
-
isFullResolution: boolean;
|
|
17
16
|
};
|
|
18
17
|
export declare class Image360LoadingCache {
|
|
19
18
|
private readonly _imageCacheSize;
|
|
@@ -27,8 +26,11 @@ export declare class Image360LoadingCache {
|
|
|
27
26
|
constructor(_imageCacheSize?: number, _downloadCacheSize?: number);
|
|
28
27
|
cachedPreload(entity: Image360Entity, revision: Image360RevisionEntity, lockDownload?: boolean): Promise<void>;
|
|
29
28
|
purge(entity: Image360Entity): Promise<void>;
|
|
29
|
+
private cacheWhenAllComplete;
|
|
30
|
+
private purgeFromInProgressDownloads;
|
|
30
31
|
private addRevisionToCache;
|
|
31
32
|
private abortLastRecentlyReqestedRevision;
|
|
33
|
+
private purgeRevision;
|
|
32
34
|
private createAbortSignal;
|
|
33
35
|
private isRevisionVisible;
|
|
34
36
|
}
|
|
@@ -7,6 +7,7 @@ import { Image360Entity } from '../entity/Image360Entity';
|
|
|
7
7
|
import { Image360AnnotationClickedDelegate, Image360AnnotationHoveredDelegate, Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
|
|
8
8
|
import { IconCollection, IconCullingScheme } from '../icons/IconCollection';
|
|
9
9
|
import { ImageAnnotationObject } from '../annotation/ImageAnnotationObject';
|
|
10
|
+
import { Image360AnnotationAppearance } from '../annotation/types';
|
|
10
11
|
/**
|
|
11
12
|
* Default implementation of {@link Image360Collection}. Used for events when entering
|
|
12
13
|
* and exiting 360 image mode
|
|
@@ -22,6 +23,7 @@ export declare class DefaultImage360Collection implements Image360Collection {
|
|
|
22
23
|
*/
|
|
23
24
|
private _targetRevisionDate;
|
|
24
25
|
private _needsRedraw;
|
|
26
|
+
private _defaultStyle;
|
|
25
27
|
private readonly _events;
|
|
26
28
|
private readonly _icons;
|
|
27
29
|
private _isCollectionVisible;
|
|
@@ -79,4 +81,6 @@ export declare class DefaultImage360Collection implements Image360Collection {
|
|
|
79
81
|
dispose(): void;
|
|
80
82
|
get needsRedraw(): boolean;
|
|
81
83
|
resetRedraw(): void;
|
|
84
|
+
get defaultStyle(): Image360AnnotationAppearance;
|
|
85
|
+
setDefaultStyle(defaultStyle: Image360AnnotationAppearance): void;
|
|
82
86
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Image360 } from './../entity/Image360';
|
|
5
5
|
import { Image360AnnotationClickedDelegate, Image360AnnotationHoveredDelegate, Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
|
|
6
|
+
import { Image360AnnotationAppearance } from '../annotation/types';
|
|
6
7
|
/**
|
|
7
8
|
* A wrapper that represents a set of 360 images.
|
|
8
9
|
*/
|
|
@@ -49,4 +50,8 @@ export interface Image360Collection {
|
|
|
49
50
|
off(event: 'image360Exited', callback: Image360ExitedDelegate): void;
|
|
50
51
|
off(event: 'image360AnnotationHovered', callback: Image360AnnotationHoveredDelegate): void;
|
|
51
52
|
off(event: 'image360AnnotationClicked', callback: Image360AnnotationClickedDelegate): void;
|
|
53
|
+
/**
|
|
54
|
+
* Assign a default style which affects all annotations
|
|
55
|
+
*/
|
|
56
|
+
setDefaultStyle(appearance: Image360AnnotationAppearance): void;
|
|
52
57
|
}
|
|
@@ -45,6 +45,7 @@ export declare class Image360Entity implements Image360 {
|
|
|
45
45
|
*/
|
|
46
46
|
getActiveRevision(): Image360RevisionEntity;
|
|
47
47
|
setActiveRevision(revision: Image360RevisionEntity): void;
|
|
48
|
+
applyFullResolutionTextures(): Promise<void>;
|
|
48
49
|
getMostRecentRevision(): Image360RevisionEntity;
|
|
49
50
|
/**
|
|
50
51
|
* Get the revision closest to the provided date.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
+
import { Image360Annotation } from '../annotation/Image360Annotation';
|
|
4
5
|
/**
|
|
5
6
|
* Interface used to manage historical revisions of {@link Image360}.
|
|
6
7
|
* One instance represents one specific image revision.
|
|
@@ -11,4 +12,8 @@ export interface Image360Revision {
|
|
|
11
12
|
* @returns Date | undefined
|
|
12
13
|
*/
|
|
13
14
|
readonly date: Date | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The annotations associated with this revision
|
|
17
|
+
*/
|
|
18
|
+
annotations: Image360Annotation[];
|
|
14
19
|
}
|
|
@@ -9,8 +9,9 @@ export declare class Image360RevisionEntity implements Image360Revision {
|
|
|
9
9
|
private readonly _imageProvider;
|
|
10
10
|
private readonly _image360Descriptor;
|
|
11
11
|
private readonly _image360VisualzationBox;
|
|
12
|
-
private
|
|
13
|
-
private
|
|
12
|
+
private _previewTextures;
|
|
13
|
+
private _fullResolutionTextures;
|
|
14
|
+
private _onFullResolutionCompleted;
|
|
14
15
|
private _annotations;
|
|
15
16
|
constructor(imageProvider: Image360DataProvider, image360Descriptor: Image360Descriptor, image360VisualzationBox: Image360VisualizationBox);
|
|
16
17
|
/**
|
|
@@ -23,29 +24,32 @@ export declare class Image360RevisionEntity implements Image360Revision {
|
|
|
23
24
|
/**
|
|
24
25
|
* Loads the textures needed for the 360 image (6 faces).
|
|
25
26
|
*
|
|
26
|
-
* This will start the download of both low and full resolution textures and return one promise for when
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* to the image360VisualzationBox at a desired time.
|
|
27
|
+
* This will start the download of both low and full resolution textures and return one promise for when each texture set is ready.
|
|
28
|
+
* If the low resolution images are completed first the full resolution download and texture loading will continue in the background,
|
|
29
|
+
* and applyFullResolutionTextures can be called to apply full resolution textures to the image360VisualzationBox at a desired time.
|
|
30
30
|
*
|
|
31
|
-
* @returns
|
|
32
|
-
* @returns fullResolutionCompleted A promise for when full resolution images are done loading.
|
|
31
|
+
* @returns lowResolutionCompleted A promise for when the low resolution images are done loading.
|
|
32
|
+
* @returns fullResolutionCompleted A promise for when the full resolution images are done loading.
|
|
33
33
|
*/
|
|
34
34
|
loadTextures(abortSignal?: AbortSignal): {
|
|
35
|
-
|
|
35
|
+
lowResolutionCompleted: Promise<void>;
|
|
36
36
|
fullResolutionCompleted: Promise<void>;
|
|
37
|
+
annotationsCompleted: Promise<void>;
|
|
37
38
|
};
|
|
39
|
+
private loadPreviewTextures;
|
|
40
|
+
private loadFullTextures;
|
|
38
41
|
private loadAnnotations;
|
|
39
42
|
/**
|
|
40
43
|
* Clear the cached textures used by this revision.
|
|
41
44
|
*/
|
|
42
|
-
|
|
45
|
+
dispose(): void;
|
|
43
46
|
/**
|
|
44
47
|
* Apply cached textures to the image360VisualzationBox.
|
|
45
48
|
*/
|
|
46
49
|
applyTextures(): void;
|
|
47
50
|
/**
|
|
48
|
-
* Apply full resolution textures to the image360VisualzationBox.
|
|
51
|
+
* Apply full resolution textures to the image360VisualzationBox.
|
|
52
|
+
* This has no effect if full resolution has already been applied.
|
|
49
53
|
*/
|
|
50
54
|
applyFullResolutionTextures(): Promise<void>;
|
|
51
55
|
}
|
|
@@ -18,6 +18,7 @@ export declare class Image360VisualizationBox implements Image360Visualization {
|
|
|
18
18
|
private readonly _faceMaterialOrder;
|
|
19
19
|
private readonly _meshLoadPromise;
|
|
20
20
|
private readonly _annotationsLoadPromise;
|
|
21
|
+
private readonly _annotationsGroup;
|
|
21
22
|
get opacity(): number;
|
|
22
23
|
set opacity(alpha: number);
|
|
23
24
|
get visible(): boolean;
|
|
@@ -30,4 +31,5 @@ export declare class Image360VisualizationBox implements Image360Visualization {
|
|
|
30
31
|
loadFaceTextures(faces: Image360Face[]): Promise<Image360Texture[]>;
|
|
31
32
|
unloadImages(): void;
|
|
32
33
|
private getScaledImageTexture;
|
|
34
|
+
setAnnotationsVisibility(visibility: boolean): void;
|
|
33
35
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2023 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import { AnnotationModel } from '@cognite/sdk';
|
|
5
4
|
import { Image360 } from './entity/Image360';
|
|
6
5
|
import { Image360Revision } from './entity/Image360Revision';
|
|
6
|
+
import { Image360Annotation } from './annotation/Image360Annotation';
|
|
7
7
|
/**
|
|
8
8
|
* Delegate for 360 image mode entered events.
|
|
9
9
|
*/
|
|
@@ -15,8 +15,8 @@ export type Image360ExitedDelegate = () => void;
|
|
|
15
15
|
/**
|
|
16
16
|
* Delegate for 360 image annotation hover events
|
|
17
17
|
*/
|
|
18
|
-
export type Image360AnnotationHoveredDelegate = (annotation:
|
|
18
|
+
export type Image360AnnotationHoveredDelegate = (annotation: Image360Annotation) => void;
|
|
19
19
|
/**
|
|
20
20
|
* Delegate for 360 image annotation click events
|
|
21
21
|
*/
|
|
22
|
-
export type Image360AnnotationClickedDelegate = (annotation:
|
|
22
|
+
export type Image360AnnotationClickedDelegate = (annotation: Image360Annotation) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "4.2.0-dev.
|
|
3
|
+
"version": "4.2.0-dev.20230501",
|
|
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": {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@types/jsdom": "21.1.1",
|
|
92
92
|
"@types/lodash": "4.14.194",
|
|
93
93
|
"@types/mixpanel-browser": "2.38.1",
|
|
94
|
-
"@types/node": "18.
|
|
94
|
+
"@types/node": "18.16.0",
|
|
95
95
|
"@types/random-seed": "0.3.3",
|
|
96
96
|
"@types/skmeans": "0.11.4",
|
|
97
97
|
"@types/stats": "0.16.30",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"eslint-plugin-unused-imports": "2.0.0",
|
|
112
112
|
"file-loader": "6.2.0",
|
|
113
113
|
"gl": "6.0.2",
|
|
114
|
-
"glob": "10.2.
|
|
114
|
+
"glob": "10.2.2",
|
|
115
115
|
"glslify-loader": "2.0.0",
|
|
116
116
|
"html-webpack-plugin": "5.5.1",
|
|
117
117
|
"jest": "29.5.0",
|
|
@@ -123,9 +123,9 @@
|
|
|
123
123
|
"jsdom": "21.1.1",
|
|
124
124
|
"moq.ts": "10.0.2",
|
|
125
125
|
"nock": "13.3.0",
|
|
126
|
-
"prettier": "2.8.
|
|
126
|
+
"prettier": "2.8.8",
|
|
127
127
|
"process": "0.11.10",
|
|
128
|
-
"puppeteer": "19.
|
|
128
|
+
"puppeteer": "19.11.0",
|
|
129
129
|
"random-seed": "0.3.0",
|
|
130
130
|
"raw-loader": "4.0.2",
|
|
131
131
|
"remove-files-webpack-plugin": "1.5.0",
|