@cognite/reveal 4.2.0-dev.20230516 → 4.2.0-dev.20230517

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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export { Image360, Image360Metadata } from './src/entity/Image360';
5
5
  export { Image360Revision } from './src/entity/Image360Revision';
6
- export { Image360Collection } from './src/collection/Image360Collection';
6
+ export { Image360Collection, Image360AnnotationAssetFilter, Image360AnnotationAssetQueryResult } from './src/collection/Image360Collection';
7
7
  export { Image360Facade } from './src/Image360Facade';
8
8
  export { Image360CollectionFactory } from './src/collection/Image360CollectionFactory';
9
9
  export { Image360Entity } from './src/entity/Image360Entity';
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2023 Cognite AS
3
3
  */
4
- import { Color } from 'three';
4
+ import { Color, Vector3 } from 'three';
5
5
  import { AnnotationModel } from '@cognite/sdk';
6
6
  /**
7
7
  * An annotation associated with a 360 image revision
@@ -19,4 +19,8 @@ export interface Image360Annotation {
19
19
  * Set whether this annotation should be visible. Default: true
20
20
  */
21
21
  setVisible(visible?: boolean): void;
22
+ /**
23
+ * Get center of annotation, to e.g. point the camera toward it
24
+ */
25
+ getCenter(out?: Vector3): Vector3;
22
26
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { AnnotationModel } from '@cognite/sdk';
5
5
  import { Image360FileDescriptor } from '../../../data-providers';
6
- import { Color, Object3D } from 'three';
6
+ import { Color, Vector3, Object3D } from 'three';
7
7
  import { Image360Annotation } from './Image360Annotation';
8
8
  import { Image360AnnotationAppearance } from './types';
9
9
  type FaceType = Image360FileDescriptor['face'];
@@ -26,5 +26,6 @@ export declare class ImageAnnotationObject implements Image360Annotation {
26
26
  setDefaultStyle(appearance: Image360AnnotationAppearance): void;
27
27
  setColor(color?: Color): void;
28
28
  setVisible(visible?: boolean): void;
29
+ getCenter(out?: Vector3): Vector3;
29
30
  }
30
31
  export {};
@@ -2,11 +2,12 @@
2
2
  * Copyright 2023 Cognite AS
3
3
  */
4
4
  import { EventTrigger } from '../../../utilities';
5
- import { Image360Collection } from './Image360Collection';
5
+ import { Image360AnnotationAssetFilter, Image360AnnotationAssetQueryResult, Image360Collection } from './Image360Collection';
6
6
  import { Image360Entity } from '../entity/Image360Entity';
7
7
  import { Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
8
8
  import { IconCollection, IconCullingScheme } from '../icons/IconCollection';
9
9
  import { Image360AnnotationAppearance } from '../annotation/types';
10
+ import { Image360DataProvider } from '../../../data-providers';
10
11
  /**
11
12
  * Default implementation of {@link Image360Collection}. Used for events when entering
12
13
  * and exiting 360 image mode
@@ -23,6 +24,7 @@ export declare class DefaultImage360Collection implements Image360Collection {
23
24
  private _targetRevisionDate;
24
25
  private _needsRedraw;
25
26
  private _defaultStyle;
27
+ private readonly _image360DataProvider;
26
28
  private readonly _events;
27
29
  private readonly _icons;
28
30
  private _isCollectionVisible;
@@ -38,7 +40,7 @@ export declare class DefaultImage360Collection implements Image360Collection {
38
40
  image360Exited: EventTrigger<Image360ExitedDelegate>;
39
41
  };
40
42
  get isCollectionVisible(): boolean;
41
- constructor(collectionId: string, entities: Image360Entity[], icons: IconCollection);
43
+ constructor(collectionId: string, entities: Image360Entity[], icons: IconCollection, image360DataProvider: Image360DataProvider);
42
44
  /**
43
45
  * Subscribes to events on 360 Image datasets. There are several event types:
44
46
  * 'image360Entered' - Subscribes to a event for entering 360 image mode.
@@ -75,4 +77,5 @@ export declare class DefaultImage360Collection implements Image360Collection {
75
77
  resetRedraw(): void;
76
78
  get defaultStyle(): Image360AnnotationAppearance;
77
79
  setDefaultAnnotationStyle(defaultStyle: Image360AnnotationAppearance): void;
80
+ findImageAnnotation(filter: Image360AnnotationAssetFilter): Promise<Image360AnnotationAssetQueryResult[]>;
78
81
  }
@@ -4,6 +4,32 @@
4
4
  import { Image360 } from './../entity/Image360';
5
5
  import { Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
6
6
  import { Image360AnnotationAppearance } from '../annotation/types';
7
+ import { Image360Revision } from '../entity/Image360Revision';
8
+ import { IdEither } from '@cognite/sdk';
9
+ import { Image360Annotation } from '../annotation/Image360Annotation';
10
+ /**
11
+ * Filter for finding annotation related to asset
12
+ */
13
+ export type Image360AnnotationAssetFilter = {
14
+ assetRef: IdEither;
15
+ };
16
+ /**
17
+ * Result item from an asset annotation query
18
+ */
19
+ export type Image360AnnotationAssetQueryResult = {
20
+ /**
21
+ * The Image360 to which the result annotation belongs
22
+ */
23
+ image: Image360;
24
+ /**
25
+ * The image revision to which the result annotation belongs
26
+ */
27
+ revision: Image360Revision;
28
+ /**
29
+ * The found annotation
30
+ */
31
+ annotation: Image360Annotation;
32
+ };
7
33
  /**
8
34
  * A wrapper that represents a set of 360 images.
9
35
  */
@@ -48,4 +74,8 @@ export interface Image360Collection {
48
74
  * Assign a default style which affects all annotations
49
75
  */
50
76
  setDefaultAnnotationStyle(appearance: Image360AnnotationAppearance): void;
77
+ /**
78
+ * Find 360 images associated with a asset with the given assetRef
79
+ */
80
+ findImageAnnotation(filter: Image360AnnotationAssetFilter): Promise<Image360AnnotationAssetQueryResult[]>;
51
81
  }
@@ -55,4 +55,5 @@ export declare class Image360RevisionEntity implements Image360Revision {
55
55
  * This has no effect if full resolution has already been applied.
56
56
  */
57
57
  applyFullResolutionTextures(): Promise<void>;
58
+ getDescriptors(): Image360Descriptor;
58
59
  }
@@ -19,6 +19,13 @@ export declare class CameraManagerHelper {
19
19
  * @returns
20
20
  */
21
21
  static calculateNewTargetFromRotation(camera: THREE.PerspectiveCamera, rotation: THREE.Quaternion, currentTarget: THREE.Vector3): THREE.Vector3;
22
+ /**
23
+ * Calculates camera rotation from target
24
+ * @param camera Used Camera instance
25
+ * @param newTarget The target to compute rotation from
26
+ * @returns New camera rotationg
27
+ */
28
+ static calculateNewRotationFromTarget(camera: THREE.PerspectiveCamera, newTarget: THREE.Vector3): THREE.Quaternion;
22
29
  /**
23
30
  * Updates near and far plane of the camera based on the bounding box.
24
31
  * @param camera Used camera instance.
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
- import { AnnotationModel, CogniteClient, Metadata } from '@cognite/sdk';
4
+ import { AnnotationModel, CogniteClient, IdEither, Metadata, CogniteInternalId } from '@cognite/sdk';
5
5
  import { Historical360ImageSet, Image360Face, Image360FileDescriptor } from '../types';
6
6
  import { Image360Provider } from '../Image360Provider';
7
7
  export declare class Cdf360ImageEventProvider implements Image360Provider<Metadata> {
@@ -9,6 +9,7 @@ export declare class Cdf360ImageEventProvider implements Image360Provider<Metada
9
9
  constructor(client: CogniteClient);
10
10
  get360ImageDescriptors(metadataFilter: Metadata, preMultipliedRotation: boolean): Promise<Historical360ImageSet[]>;
11
11
  get360ImageAnnotations(descriptors: Image360FileDescriptor[]): Promise<AnnotationModel[]>;
12
+ getFilesByAssetRef(assetRef: IdEither): Promise<CogniteInternalId[]>;
12
13
  get360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise<Image360Face[]>;
13
14
  getLowResolution360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise<Image360Face[]>;
14
15
  private getFileIds;
@@ -1,6 +1,6 @@
1
1
  import { Image360Provider } from '../Image360Provider';
2
2
  import { Historical360ImageSet, Image360Face, Image360FileDescriptor } from '../types';
3
- import { AnnotationModel } from '@cognite/sdk/dist/src';
3
+ import { AnnotationModel, CogniteInternalId, IdEither } from '@cognite/sdk/dist/src';
4
4
  export declare class Local360ImageProvider implements Image360Provider<unknown> {
5
5
  private readonly _modelUrl;
6
6
  constructor(modelUrl: string);
@@ -8,4 +8,5 @@ export declare class Local360ImageProvider implements Image360Provider<unknown>
8
8
  get360ImageAnnotations(_descriptors: Image360FileDescriptor[]): Promise<AnnotationModel[]>;
9
9
  get360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise<Image360Face[]>;
10
10
  getLowResolution360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise<Image360Face[]>;
11
+ getFilesByAssetRef(_assetId: IdEither): Promise<CogniteInternalId[]>;
11
12
  }
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright 2021 Cognite AS
3
3
  */
4
- import { AnnotationModel } from '@cognite/sdk';
4
+ import { AnnotationModel, CogniteInternalId, IdEither } from '@cognite/sdk';
5
5
  import * as THREE from 'three';
6
6
  export interface JsonFileProvider {
7
7
  getJsonFile(baseUrl: string, fileName: string): Promise<any>;
@@ -11,6 +11,7 @@ export interface BinaryFileProvider {
11
11
  }
12
12
  export interface Image360AnnotationProvider {
13
13
  get360ImageAnnotations(descriptors: Image360FileDescriptor[]): Promise<AnnotationModel[]>;
14
+ getFilesByAssetRef(assetId: IdEither): Promise<CogniteInternalId[]>;
14
15
  }
15
16
  export interface Image360DescriptorProvider<T> {
16
17
  get360ImageDescriptors(metadataFilter: T, preMultipliedRotation: boolean): Promise<Historical360ImageSet[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.2.0-dev.20230516",
3
+ "version": "4.2.0-dev.20230517",
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.16.7",
94
+ "@types/node": "18.16.8",
95
95
  "@types/random-seed": "0.3.3",
96
96
  "@types/skmeans": "0.11.4",
97
97
  "@types/stats": "0.16.30",