@cognite/reveal 4.2.0-dev.20230509 → 4.2.0-dev.20230511

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.
@@ -9,7 +9,8 @@ export { Image360CollectionFactory } from './src/collection/Image360CollectionFa
9
9
  export { Image360Entity } from './src/entity/Image360Entity';
10
10
  export { Image360RevisionEntity } from './src/entity/Image360RevisionEntity';
11
11
  export { Image360Visualization } from './src/entity/Image360Visualization';
12
- export { Image360EnteredDelegate, Image360ExitedDelegate, Image360AnnotationHoveredDelegate, Image360AnnotationClickedDelegate } from './src/types';
12
+ export { Image360EnteredDelegate, Image360ExitedDelegate } from './src/types';
13
13
  export { Image360AnnotationAppearance } from './src/annotation/types';
14
+ export { Image360AnnotationIntersection } from './src/annotation/Image360AnnotationIntersection';
14
15
  export { Image360Annotation } from './src/annotation/Image360Annotation';
15
16
  export { DefaultImage360Collection } from './src/collection/DefaultImage360Collection';
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import { ImageAnnotationObjectData } from './ImageAnnotationData';
5
5
  import { BufferGeometry, Matrix4, PlaneGeometry } from 'three';
6
- import { AnnotationsBoundingBox, AnnotationsObjectDetection } from '@cognite/sdk';
6
+ import { AnnotationsBoundingBox } from '@cognite/sdk';
7
7
  export declare class BoxAnnotationData implements ImageAnnotationObjectData {
8
8
  private readonly _geometry;
9
9
  private readonly _initialTranslation;
10
- constructor(annotation: AnnotationsObjectDetection);
10
+ constructor(annotationsBox: AnnotationsBoundingBox);
11
11
  createGeometry(annotationsBox: AnnotationsBoundingBox): PlaneGeometry;
12
12
  getGeometry(): BufferGeometry;
13
13
  getNormalizationMatrix(): Matrix4;
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * Copyright 2023 Cognite AS
3
+ */
4
+ import { Image360Annotation } from './Image360Annotation';
5
+ import { Vector3 } from 'three';
6
+ /**
7
+ * Describes an intersection with a 360 image annotation
8
+ */
9
+ export type Image360AnnotationIntersection = {
10
+ /**
11
+ * The intersection type.
12
+ */
13
+ type: 'image360Annotation';
14
+ /**
15
+ * The intersected annotation
16
+ */
17
+ annotation: Image360Annotation;
18
+ /**
19
+ * The world direction from the camera to the intersection point
20
+ */
21
+ direction: Vector3;
22
+ };
@@ -15,6 +15,7 @@ export declare class ImageAnnotationObject implements Image360Annotation {
15
15
  private readonly _appearance;
16
16
  get annotation(): AnnotationModel;
17
17
  static createAnnotationObject(annotation: AnnotationModel, face: FaceType): ImageAnnotationObject | undefined;
18
+ private static createObjectData;
18
19
  private constructor();
19
20
  private getRotationFromFace;
20
21
  private initializeTransform;
@@ -1,14 +1,12 @@
1
1
  /*!
2
2
  * Copyright 2023 Cognite AS
3
3
  */
4
- import { EventTrigger, PointerEventData } from '../../../utilities';
4
+ import { EventTrigger } from '../../../utilities';
5
5
  import { Image360Collection } from './Image360Collection';
6
6
  import { Image360Entity } from '../entity/Image360Entity';
7
- import { Image360AnnotationClickedDelegate, Image360AnnotationHoveredDelegate, Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
7
+ import { Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
8
8
  import { IconCollection, IconCullingScheme } from '../icons/IconCollection';
9
- import { ImageAnnotationObject } from '../annotation/ImageAnnotationObject';
10
9
  import { Image360AnnotationAppearance } from '../annotation/types';
11
- import { Vector3 } from 'three';
12
10
  /**
13
11
  * Default implementation of {@link Image360Collection}. Used for events when entering
14
12
  * and exiting 360 image mode
@@ -38,8 +36,6 @@ export declare class DefaultImage360Collection implements Image360Collection {
38
36
  get events(): {
39
37
  image360Entered: EventTrigger<Image360EnteredDelegate>;
40
38
  image360Exited: EventTrigger<Image360ExitedDelegate>;
41
- annotationHovered: EventTrigger<Image360AnnotationHoveredDelegate>;
42
- annotationClicked: EventTrigger<Image360AnnotationClickedDelegate>;
43
39
  };
44
40
  get isCollectionVisible(): boolean;
45
41
  constructor(collectionId: string, entities: Image360Entity[], icons: IconCollection);
@@ -52,8 +48,6 @@ export declare class DefaultImage360Collection implements Image360Collection {
52
48
  */
53
49
  on(event: 'image360Entered', callback: Image360EnteredDelegate): void;
54
50
  on(event: 'image360Exited', callback: Image360ExitedDelegate): void;
55
- on(event: 'image360AnnotationHovered', callback: Image360AnnotationHoveredDelegate): void;
56
- on(event: 'image360AnnotationClicked', callback: Image360AnnotationClickedDelegate): void;
57
51
  /**
58
52
  * Specify parameters used to determine the number of icons that are visible when entering 360 Images.
59
53
  * @param radius Only icons within the given radius will be made visible.
@@ -72,10 +66,6 @@ export declare class DefaultImage360Collection implements Image360Collection {
72
66
  */
73
67
  off(event: 'image360Entered', callback: Image360EnteredDelegate): void;
74
68
  off(event: 'image360Exited', callback: Image360ExitedDelegate): void;
75
- off(event: 'image360AnnotationHovered', callback: Image360AnnotationHoveredDelegate): void;
76
- off(event: 'image360AnnotationClicked', callback: Image360AnnotationClickedDelegate): void;
77
- fireHoverEvent(annotationObject: ImageAnnotationObject, pointerEvent: PointerEventData, direction: Vector3): void;
78
- fireClickEvent(annotationObject: ImageAnnotationObject, pointerEvent: PointerEventData, direction: Vector3): void;
79
69
  setSelectedVisibility(visible: boolean): void;
80
70
  setCullingScheme(scheme: IconCullingScheme): void;
81
71
  remove(entity: Image360Entity): void;
@@ -2,7 +2,7 @@
2
2
  * Copyright 2022 Cognite AS
3
3
  */
4
4
  import { Image360 } from './../entity/Image360';
5
- import { Image360AnnotationClickedDelegate, Image360AnnotationHoveredDelegate, Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
5
+ import { Image360EnteredDelegate, Image360ExitedDelegate } from '../types';
6
6
  import { Image360AnnotationAppearance } from '../annotation/types';
7
7
  /**
8
8
  * A wrapper that represents a set of 360 images.
@@ -32,15 +32,11 @@ export interface Image360Collection {
32
32
  * Subscribes to events on 360 Image datasets. There are several event types:
33
33
  * 'image360Entered' - Subscribes to a event for entering 360 image mode.
34
34
  * 'image360Exited' - Subscribes to events indicating 360 image mode has exited.
35
- * 'image360AnnotationHovered - Subscribes to events indicating that the cursor hovered over an image annotation.
36
- * 'image360AnnotationClicked - Subscribes to events indicating a click on an image annotation
37
35
  * @param event The event type.
38
36
  * @param callback Callback to be called when the event is fired.
39
37
  */
40
38
  on(event: 'image360Entered', callback: Image360EnteredDelegate): void;
41
39
  on(event: 'image360Exited', callback: Image360ExitedDelegate): void;
42
- on(event: 'image360AnnotationHovered', callback: Image360AnnotationHoveredDelegate): void;
43
- on(event: 'image360AnnotationClicked', callback: Image360AnnotationClickedDelegate): void;
44
40
  /**
45
41
  * Unsubscribes from 360 image dataset event.
46
42
  * @param event The event type.
@@ -48,8 +44,6 @@ export interface Image360Collection {
48
44
  */
49
45
  off(event: 'image360Entered', callback: Image360EnteredDelegate): void;
50
46
  off(event: 'image360Exited', callback: Image360ExitedDelegate): void;
51
- off(event: 'image360AnnotationHovered', callback: Image360AnnotationHoveredDelegate): void;
52
- off(event: 'image360AnnotationClicked', callback: Image360AnnotationClickedDelegate): void;
53
47
  /**
54
48
  * Assign a default style which affects all annotations
55
49
  */
@@ -3,9 +3,6 @@
3
3
  */
4
4
  import { Image360 } from './entity/Image360';
5
5
  import { Image360Revision } from './entity/Image360Revision';
6
- import { Image360Annotation } from './annotation/Image360Annotation';
7
- import { PointerEventData } from '../../utilities';
8
- import { Vector3 } from 'three';
9
6
  /**
10
7
  * Delegate for 360 image mode entered events.
11
8
  */
@@ -14,11 +11,3 @@ export type Image360EnteredDelegate = (image360: Image360, revision: Image360Rev
14
11
  * Delegate for 360 image mode exited events.
15
12
  */
16
13
  export type Image360ExitedDelegate = () => void;
17
- /**
18
- * Delegate for 360 image annotation hover events
19
- */
20
- export type Image360AnnotationHoveredDelegate = (annotation: Image360Annotation, pointerEvent: PointerEventData, direction: Vector3) => void;
21
- /**
22
- * Delegate for 360 image annotation click events
23
- */
24
- export type Image360AnnotationClickedDelegate = (annotation: Image360Annotation, pointerEvent: PointerEventData, direction: Vector3) => void;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as THREE from 'three';
5
5
  import { CogniteClient, Metadata } from '@cognite/sdk';
6
- import { Image360Collection, Image360Entity, Image360, Image360RevisionEntity } from '../../../360-images';
6
+ import { Image360Collection, Image360Entity, Image360, Image360RevisionEntity, Image360AnnotationIntersection } 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 {
@@ -23,7 +23,6 @@ export declare class Image360ApiHelper {
23
23
  get needsRedraw(): boolean;
24
24
  resetRedraw(): void;
25
25
  private getNormalizedOffset;
26
- private handleAnnotationCursorEvent;
27
26
  add360ImageSet(eventFilter: Metadata, collectionTransform: THREE.Matrix4, preMultipliedRotation: boolean): Promise<Image360Collection>;
28
27
  remove360Images(entities: Image360[]): Promise<void>;
29
28
  enter360Image(image360Entity: Image360Entity, revision?: Image360RevisionEntity): Promise<void>;
@@ -37,6 +36,7 @@ export declare class Image360ApiHelper {
37
36
  private findRevisionIdToEnter;
38
37
  private enter360ImageOnIntersect;
39
38
  intersect360ImageIcons(offsetX: number, offsetY: number): Image360Entity | undefined;
39
+ intersect360ImageAnnotations(offsetX: number, offsetY: number): Image360AnnotationIntersection | undefined;
40
40
  private setHoverIconOnIntersect;
41
41
  private exit360ImageOnEscape;
42
42
  }
@@ -10,7 +10,7 @@ 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, Image360Revision } from '../../../../360-images';
13
+ import { Image360Collection, Image360, Image360Revision, Image360AnnotationIntersection } from '../../../../360-images';
14
14
  /**
15
15
  * @example
16
16
  * ```js
@@ -559,6 +559,14 @@ export declare class Cognite3DViewer {
559
559
  * ```
560
560
  */
561
561
  getIntersectionFromPixel(offsetX: number, offsetY: number): Promise<null | Intersection>;
562
+ /**
563
+ * Check for intersections with 360 annotations through the given pixel.
564
+ * Similar to {getIntersectionFromPixel}, but checks 360 image annotations
565
+ * instead of models.
566
+ * @param offsetX
567
+ * @param offsetY
568
+ */
569
+ get360AnnotationIntersectionFromPixel(offsetX: number, offsetY: number): Promise<null | Image360AnnotationIntersection>;
562
570
  /** @private */
563
571
  private getModels;
564
572
  /**
@@ -13,7 +13,7 @@ export type PointCloudIntersection = {
13
13
  */
14
14
  model: CognitePointCloudModel;
15
15
  /**
16
- * Tree index of the intersected 3D node.
16
+ * Coordinate of the intersection.
17
17
  */
18
18
  point: THREE.Vector3;
19
19
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.2.0-dev.20230509",
3
+ "version": "4.2.0-dev.20230511",
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": {
@@ -79,10 +79,10 @@
79
79
  "three-stdlib": "2.21.11"
80
80
  },
81
81
  "devDependencies": {
82
- "@azure/msal-browser": "2.36.0",
82
+ "@azure/msal-browser": "2.37.0",
83
83
  "@cognite/sdk": "8.1.1",
84
84
  "@microsoft/api-extractor": "^7.33.6",
85
- "@types/dat.gui": "0.7.9",
85
+ "@types/dat.gui": "0.7.10",
86
86
  "@types/gl": "^6.0.2",
87
87
  "@types/glob": "8.1.0",
88
88
  "@types/jest": "29.5.1",
@@ -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.3",
94
+ "@types/node": "18.16.5",
95
95
  "@types/random-seed": "0.3.3",
96
96
  "@types/skmeans": "0.11.4",
97
97
  "@types/stats": "0.16.30",
@@ -102,7 +102,7 @@
102
102
  "concurrently": "8.0.1",
103
103
  "cross-env": "7.0.3",
104
104
  "dat.gui": "0.7.9",
105
- "eslint": "8.39.0",
105
+ "eslint": "8.40.0",
106
106
  "eslint-config-prettier": "8.8.0",
107
107
  "eslint-plugin-header": "3.1.1",
108
108
  "eslint-plugin-jsdoc": "43.1.1",
@@ -138,7 +138,7 @@
138
138
  "tsc-alias": "1.8.6",
139
139
  "typescript": "5.0.4",
140
140
  "wasm-pack": "0.10.3",
141
- "webpack": "5.81.0",
141
+ "webpack": "5.82.0",
142
142
  "webpack-cli": "5.0.2",
143
143
  "webpack-dev-server": "4.13.3",
144
144
  "webpack-node-externals": "3.0.0",