@vived/app 4.2.0 → 4.4.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.
Files changed (68) hide show
  1. package/lib/Components/Babylon/Mocks/MockSceneRayPickUC.d.ts +2 -0
  2. package/lib/Components/Babylon/Mocks/MockSceneRayPickUC.js +2 -2
  3. package/lib/Components/Dispatcher/UC/RestoreCurrentStateUC.d.ts +10 -0
  4. package/lib/Components/Dispatcher/UC/RestoreCurrentStateUC.js +35 -0
  5. package/lib/Components/Dispatcher/UC/index.d.ts +1 -0
  6. package/lib/Components/Dispatcher/UC/index.js +1 -0
  7. package/lib/Components/Landmarks/Controller/Mouse/MouseLandmark.d.ts +22 -0
  8. package/lib/Components/Landmarks/Controller/Mouse/MouseLandmark.js +91 -0
  9. package/lib/Components/Landmarks/Controller/MouseLandmark.d.ts +22 -0
  10. package/lib/Components/Landmarks/Controller/MouseLandmark.js +91 -0
  11. package/lib/Components/Landmarks/Controller/SetSelectedLandmarkColor.d.ts +3 -0
  12. package/lib/Components/Landmarks/Controller/SetSelectedLandmarkColor.js +24 -0
  13. package/lib/Components/Landmarks/Controller/SubmitLandmarkSize.d.ts +2 -0
  14. package/lib/Components/Landmarks/Controller/SubmitLandmarkSize.js +19 -0
  15. package/lib/Components/Landmarks/Controller/Touch/TouchLandmark.d.ts +20 -0
  16. package/lib/Components/Landmarks/Controller/Touch/TouchLandmark.js +84 -0
  17. package/lib/Components/Landmarks/Controller/TouchLandmark.d.ts +20 -0
  18. package/lib/Components/Landmarks/Controller/TouchLandmark.js +84 -0
  19. package/lib/Components/Landmarks/Controller/UpdateLandmarkSize.d.ts +2 -0
  20. package/lib/Components/Landmarks/Controller/UpdateLandmarkSize.js +19 -0
  21. package/lib/Components/Landmarks/Controller/index.d.ts +5 -0
  22. package/lib/Components/Landmarks/Controller/index.js +17 -0
  23. package/lib/Components/Landmarks/Entities/LandmarkEntity.d.ts +40 -0
  24. package/lib/Components/Landmarks/Entities/LandmarkEntity.js +111 -0
  25. package/lib/Components/Landmarks/Entities/LandmarkGlobals.d.ts +14 -0
  26. package/lib/Components/Landmarks/Entities/LandmarkGlobals.js +32 -0
  27. package/lib/Components/Landmarks/Entities/LandmarkRepo.d.ts +9 -0
  28. package/lib/Components/Landmarks/Entities/LandmarkRepo.js +33 -0
  29. package/lib/Components/Landmarks/Entities/index.d.ts +3 -0
  30. package/lib/Components/Landmarks/Entities/index.js +15 -0
  31. package/lib/Components/Landmarks/Mocks/MockLandmark.d.ts +27 -0
  32. package/lib/Components/Landmarks/Mocks/MockLandmark.js +50 -0
  33. package/lib/Components/Landmarks/PM/LandmarkListPM.d.ts +10 -0
  34. package/lib/Components/Landmarks/PM/LandmarkListPM.js +46 -0
  35. package/lib/Components/Landmarks/PM/LandmarkSizePM.d.ts +10 -0
  36. package/lib/Components/Landmarks/PM/LandmarkSizePM.js +44 -0
  37. package/lib/Components/Landmarks/PM/index.d.ts +2 -0
  38. package/lib/Components/Landmarks/PM/index.js +14 -0
  39. package/lib/Components/Landmarks/UseCases/AddLandmarkUC.d.ts +8 -0
  40. package/lib/Components/Landmarks/UseCases/AddLandmarkUC.js +67 -0
  41. package/lib/Components/Landmarks/UseCases/AddLandmarkUndoRedo.d.ts +13 -0
  42. package/lib/Components/Landmarks/UseCases/AddLandmarkUndoRedo.js +48 -0
  43. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUC.d.ts +9 -0
  44. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUC.js +48 -0
  45. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUndoRedo.d.ts +13 -0
  46. package/lib/Components/Landmarks/UseCases/DeleteLandmarkUndoRedo.js +48 -0
  47. package/lib/Components/Landmarks/UseCases/SerializeLandmarks.d.ts +16 -0
  48. package/lib/Components/Landmarks/UseCases/SerializeLandmarks.js +108 -0
  49. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUC.d.ts +12 -0
  50. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUC.js +57 -0
  51. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUndoRedo.d.ts +11 -0
  52. package/lib/Components/Landmarks/UseCases/SetLandmarkSizeUndoRedo.js +37 -0
  53. package/lib/Components/Landmarks/UseCases/SetOverlayColorUC.d.ts +11 -0
  54. package/lib/Components/Landmarks/UseCases/SetOverlayColorUC.js +46 -0
  55. package/lib/Components/Landmarks/UseCases/SetOverlayColorUndoRedo.d.ts +12 -0
  56. package/lib/Components/Landmarks/UseCases/SetOverlayColorUndoRedo.js +37 -0
  57. package/lib/Components/Landmarks/UseCases/TryAddNewLandmarkUC.d.ts +9 -0
  58. package/lib/Components/Landmarks/UseCases/TryAddNewLandmarkUC.js +59 -0
  59. package/lib/Components/Landmarks/UseCases/TryPreviewLandmarkUC.d.ts +15 -0
  60. package/lib/Components/Landmarks/UseCases/TryPreviewLandmarkUC.js +63 -0
  61. package/lib/Components/Landmarks/UseCases/index.d.ts +11 -0
  62. package/lib/Components/Landmarks/UseCases/index.js +23 -0
  63. package/lib/Components/Landmarks/index.d.ts +4 -0
  64. package/lib/Components/Landmarks/index.js +16 -0
  65. package/lib/Components/OverlayColor/Entities/OverlayColor.d.ts +5 -5
  66. package/lib/Components/OverlayColor/Entities/OverlayColor.js +24 -24
  67. package/lib/Components/OverlayColor/PM/OverlayColorPM.d.ts +3 -3
  68. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ import { AppObject, AppObjectEntity } from "../../../AppObject";
2
+ import { Quaternion, QuaternionDTO, Vector3, Vector3DTO } from "../../../ValueObjects";
3
+ import { Hideable } from "../../Hideable";
4
+ import { Label } from "../../Label";
5
+ import { OverlayColor, OverlayColorEnums } from "../../OverlayColor";
6
+ import { Selectable } from "../../Selection";
7
+ import { Transform3D } from "../../Transform3D";
8
+ import { LandmarkRepo } from "./LandmarkRepo";
9
+ export declare const LANDMARK_MINIMUM_SIZE: number;
10
+ export declare const LANDMARK_MAXIMUM_SIZE: number;
11
+ export interface LandmarkDTO {
12
+ id: string;
13
+ position: Vector3DTO;
14
+ size: number;
15
+ rotation: QuaternionDTO;
16
+ label: string;
17
+ defaultLabel: string;
18
+ parentID: string;
19
+ color: OverlayColorEnums;
20
+ }
21
+ export declare abstract class LandmarkEntity extends AppObjectEntity {
22
+ static readonly type = "LANDMARK";
23
+ static get(appObj: AppObject): LandmarkEntity | undefined;
24
+ abstract inRepo?: LandmarkRepo;
25
+ abstract get size(): number;
26
+ abstract set size(val: number);
27
+ abstract readonly parentID: string;
28
+ abstract get label(): Label;
29
+ abstract get transform(): Transform3D;
30
+ abstract get hideable(): Hideable;
31
+ abstract get overlayColor(): OverlayColor;
32
+ abstract get selectable(): Selectable;
33
+ abstract get position(): Vector3;
34
+ abstract set position(p: Vector3);
35
+ abstract get rotation(): Quaternion;
36
+ abstract set rotation(r: Quaternion);
37
+ abstract get data(): LandmarkDTO;
38
+ abstract set data(dto: LandmarkDTO);
39
+ }
40
+ export declare function makeLandmarkEntity(appObject: AppObject, parentID: string): LandmarkEntity;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeLandmarkEntity = exports.LandmarkEntity = exports.LANDMARK_MAXIMUM_SIZE = exports.LANDMARK_MINIMUM_SIZE = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const Entities_1 = require("../../../Entities");
6
+ const ValueObjects_1 = require("../../../ValueObjects");
7
+ const Hideable_1 = require("../../Hideable");
8
+ const Label_1 = require("../../Label");
9
+ const OverlayColor_1 = require("../../OverlayColor");
10
+ const Selection_1 = require("../../Selection");
11
+ const Transform3D_1 = require("../../Transform3D");
12
+ exports.LANDMARK_MINIMUM_SIZE = 0.1;
13
+ exports.LANDMARK_MAXIMUM_SIZE = 2;
14
+ class LandmarkEntity extends AppObject_1.AppObjectEntity {
15
+ static get(appObj) {
16
+ return appObj.getComponent(this.type);
17
+ }
18
+ }
19
+ exports.LandmarkEntity = LandmarkEntity;
20
+ LandmarkEntity.type = "LANDMARK";
21
+ function makeLandmarkEntity(appObject, parentID) {
22
+ const landmark = new LandmarkImp(appObject, parentID);
23
+ return landmark;
24
+ }
25
+ exports.makeLandmarkEntity = makeLandmarkEntity;
26
+ class LandmarkImp extends LandmarkEntity {
27
+ constructor(appObject, parentID) {
28
+ super(appObject, LandmarkEntity.type);
29
+ this.memoizedSize = new Entities_1.MemoizedNumber(1, this.notifyOnChange);
30
+ this.parentID = parentID;
31
+ this._label = Label_1.Label.addIfMissing(appObject);
32
+ this._label.addChangeObserver(this.notifyOnChange);
33
+ this._transform = Transform3D_1.Transform3D.addIfMissing(appObject);
34
+ this._transform.addChangeObserver(this.notifyOnChange);
35
+ this._hideable = Hideable_1.Hideable.addIfMissing(appObject);
36
+ this._hideable.addChangeObserver(this.notifyOnChange);
37
+ this._overlayColor = OverlayColor_1.OverlayColor.addIfMissing(appObject);
38
+ this._overlayColor.addChangeObserver(this.notifyOnChange);
39
+ this._selectable = Selection_1.makeSelectable(appObject);
40
+ this._selectable.addChangeObserver(this.notifyOnChange);
41
+ }
42
+ get label() {
43
+ return this._label;
44
+ }
45
+ get transform() {
46
+ return this._transform;
47
+ }
48
+ get hideable() {
49
+ return this._hideable;
50
+ }
51
+ get overlayColor() {
52
+ return this._overlayColor;
53
+ }
54
+ get selectable() {
55
+ return this._selectable;
56
+ }
57
+ get size() {
58
+ return this.memoizedSize.val;
59
+ }
60
+ set size(val) {
61
+ this.memoizedSize.val = val;
62
+ }
63
+ get position() {
64
+ return this._transform.localPosition;
65
+ }
66
+ set position(p) {
67
+ this._transform.localPosition = p;
68
+ }
69
+ get rotation() {
70
+ return this._transform.localRotation;
71
+ }
72
+ set rotation(r) {
73
+ this._transform.localRotation = r;
74
+ }
75
+ get data() {
76
+ return {
77
+ id: this.appObject.id,
78
+ parentID: this.parentID,
79
+ position: this.position.dto,
80
+ rotation: this.rotation.dto,
81
+ size: this.memoizedSize.val,
82
+ label: this._label.custom,
83
+ defaultLabel: this._label.default,
84
+ color: this._overlayColor.overlayColor,
85
+ };
86
+ }
87
+ set data(dto) {
88
+ this.rotation = ValueObjects_1.Quaternion.FromDTO(dto.rotation);
89
+ this.position = ValueObjects_1.Vector3.FromDTO(dto.position);
90
+ this.memoizedSize.val = dto.size;
91
+ this._label.custom = dto.label;
92
+ this._label.default = dto.defaultLabel;
93
+ this._overlayColor.overlayColor = dto.color;
94
+ }
95
+ dispose() {
96
+ super.dispose();
97
+ this._label.removeChangeObserver(this.notifyOnChange);
98
+ this._transform.removeChangeObserver(this.notifyOnChange);
99
+ this._hideable.removeChangeObserver(this.notifyOnChange);
100
+ this._overlayColor.removeChangeObserver(this.notifyOnChange);
101
+ this._selectable.removeChangeObserver(this.notifyOnChange);
102
+ this._label.dispose();
103
+ this._transform.dispose();
104
+ this._hideable.dispose();
105
+ this._overlayColor.dispose();
106
+ this._selectable.dispose();
107
+ if (this.inRepo) {
108
+ this.inRepo.removeForAppObject(this.appObject.id);
109
+ }
110
+ }
111
+ }
@@ -0,0 +1,14 @@
1
+ import { AppObject, AppObjectEntity, AppObjectRepo } from "../../../AppObject";
2
+ import { OverlayColorEnums } from "../../OverlayColor";
3
+ import { LandmarkEntity } from "./LandmarkEntity";
4
+ import { LandmarkRepo } from "./LandmarkRepo";
5
+ export declare abstract class LandmarkGlobals extends AppObjectEntity {
6
+ static readonly type = "LandmarkGlobals";
7
+ static get: (appObjects: AppObjectRepo) => LandmarkGlobals | undefined;
8
+ abstract landmarkFactory(id: string): LandmarkEntity | undefined;
9
+ abstract landmarkRepoFactory(id: string): LandmarkRepo | undefined;
10
+ abstract lastSize: number;
11
+ abstract lastColor: OverlayColorEnums;
12
+ abstract readonly previewLandmark: LandmarkEntity;
13
+ }
14
+ export declare function makeLandmarkGlobals(appObject: AppObject): LandmarkGlobals;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeLandmarkGlobals = exports.LandmarkGlobals = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const OverlayColor_1 = require("../../OverlayColor");
6
+ const LandmarkEntity_1 = require("./LandmarkEntity");
7
+ class LandmarkGlobals extends AppObject_1.AppObjectEntity {
8
+ }
9
+ exports.LandmarkGlobals = LandmarkGlobals;
10
+ LandmarkGlobals.type = "LandmarkGlobals";
11
+ LandmarkGlobals.get = (appObjects) => AppObject_1.getSingletonComponent(LandmarkGlobals.type, appObjects);
12
+ function makeLandmarkGlobals(appObject) {
13
+ return new LandmarkConstantsImp(appObject);
14
+ }
15
+ exports.makeLandmarkGlobals = makeLandmarkGlobals;
16
+ class LandmarkConstantsImp extends LandmarkGlobals {
17
+ constructor(appObject) {
18
+ super(appObject, LandmarkGlobals.type);
19
+ this.lastSize = 1;
20
+ this.lastColor = OverlayColor_1.OverlayColorEnums.BLUE;
21
+ this.appObjects.registerSingleton(this);
22
+ this.previewLandmark = LandmarkEntity_1.makeLandmarkEntity(appObject, "global");
23
+ }
24
+ landmarkFactory(id) {
25
+ this.error("Landmark Factory was in injected");
26
+ return;
27
+ }
28
+ landmarkRepoFactory(id) {
29
+ this.error("Landmark Repo Factory was in injected");
30
+ return;
31
+ }
32
+ }
@@ -0,0 +1,9 @@
1
+ import { AppObject, AppObjectEntityRepo } from "../../../AppObject";
2
+ import { LandmarkEntity } from "./LandmarkEntity";
3
+ export declare type LandmarkFactory = (id: string) => LandmarkEntity;
4
+ export declare abstract class LandmarkRepo extends AppObjectEntityRepo<LandmarkEntity> {
5
+ static readonly type = "LANDMARK_REPO";
6
+ static get(appObj: AppObject): LandmarkRepo | undefined;
7
+ static addIfMissing(appObject: AppObject): LandmarkRepo;
8
+ }
9
+ export declare function makeLandmarkRepoEntity(appObject: AppObject): LandmarkRepo;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeLandmarkRepoEntity = exports.LandmarkRepo = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ class LandmarkRepo extends AppObject_1.AppObjectEntityRepo {
6
+ static get(appObj) {
7
+ return appObj.getComponent(this.type);
8
+ }
9
+ static addIfMissing(appObject) {
10
+ const existing = appObject.getComponent(LandmarkRepo.type);
11
+ if (existing) {
12
+ return existing;
13
+ }
14
+ else {
15
+ return makeLandmarkRepoEntity(appObject);
16
+ }
17
+ }
18
+ }
19
+ exports.LandmarkRepo = LandmarkRepo;
20
+ LandmarkRepo.type = "LANDMARK_REPO";
21
+ function makeLandmarkRepoEntity(appObject) {
22
+ return new LandmarkRepoImp(appObject);
23
+ }
24
+ exports.makeLandmarkRepoEntity = makeLandmarkRepoEntity;
25
+ class LandmarkRepoImp extends LandmarkRepo {
26
+ add(landmark) {
27
+ super.add(landmark);
28
+ landmark.inRepo = this;
29
+ }
30
+ constructor(appObject) {
31
+ super(appObject, LandmarkRepo.type);
32
+ }
33
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./LandmarkEntity";
2
+ export * from "./LandmarkGlobals";
3
+ export * from "./LandmarkRepo";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./LandmarkEntity"), exports);
14
+ __exportStar(require("./LandmarkGlobals"), exports);
15
+ __exportStar(require("./LandmarkRepo"), exports);
@@ -0,0 +1,27 @@
1
+ import { AppObject } from "../../../AppObject";
2
+ import { Quaternion, Vector3 } from "../../../ValueObjects";
3
+ import { Hideable } from "../../Hideable";
4
+ import { Label } from "../../Label";
5
+ import { OverlayColor } from "../../OverlayColor";
6
+ import { Selectable } from "../../Selection";
7
+ import { Transform3D } from "../../Transform3D";
8
+ import { LandmarkDTO, LandmarkEntity } from "../Entities/LandmarkEntity";
9
+ import { LandmarkRepo } from "../Entities/LandmarkRepo";
10
+ export declare class MockLandmark extends LandmarkEntity {
11
+ inRepo?: LandmarkRepo | undefined;
12
+ get size(): number;
13
+ set size(val: number);
14
+ parentID: string;
15
+ get label(): Label;
16
+ get transform(): Transform3D;
17
+ get hideable(): Hideable;
18
+ get overlayColor(): OverlayColor;
19
+ get selectable(): Selectable;
20
+ get position(): Vector3;
21
+ set position(p: Vector3);
22
+ get rotation(): Quaternion;
23
+ set rotation(r: Quaternion);
24
+ get data(): LandmarkDTO;
25
+ set data(dto: LandmarkDTO);
26
+ constructor(appObject: AppObject);
27
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockLandmark = void 0;
4
+ const LandmarkEntity_1 = require("../Entities/LandmarkEntity");
5
+ class MockLandmark extends LandmarkEntity_1.LandmarkEntity {
6
+ constructor(appObject) {
7
+ super(appObject, LandmarkEntity_1.LandmarkEntity.type);
8
+ this.parentID = "";
9
+ }
10
+ get size() {
11
+ throw new Error("Method not implemented.");
12
+ }
13
+ set size(val) {
14
+ throw new Error("Method not implemented.");
15
+ }
16
+ get label() {
17
+ throw new Error("Method not implemented.");
18
+ }
19
+ get transform() {
20
+ throw new Error("Method not implemented.");
21
+ }
22
+ get hideable() {
23
+ throw new Error("Method not implemented.");
24
+ }
25
+ get overlayColor() {
26
+ throw new Error("Method not implemented.");
27
+ }
28
+ get selectable() {
29
+ throw new Error("Method not implemented.");
30
+ }
31
+ get position() {
32
+ throw new Error("Method not implemented.");
33
+ }
34
+ set position(p) {
35
+ throw new Error("Method not implemented.");
36
+ }
37
+ get rotation() {
38
+ throw new Error("Method not implemented.");
39
+ }
40
+ set rotation(r) {
41
+ throw new Error("Method not implemented.");
42
+ }
43
+ get data() {
44
+ throw new Error("Method not implemented.");
45
+ }
46
+ set data(dto) {
47
+ throw new Error("Method not implemented.");
48
+ }
49
+ }
50
+ exports.MockLandmark = MockLandmark;
@@ -0,0 +1,10 @@
1
+ import { AppObject, AppObjectPM } from "../../../AppObject";
2
+ export declare class LandmarkListPM extends AppObjectPM<string[]> {
3
+ static readonly type = "LandmarkListPM";
4
+ static addIfMissing(appObj: AppObject): LandmarkListPM;
5
+ private landmarkRepo?;
6
+ vmsAreEqual(a: string[], b: string[]): boolean;
7
+ onRepoChange: () => void;
8
+ dispose: () => void;
9
+ constructor(appObject: AppObject);
10
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LandmarkListPM = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
6
+ class LandmarkListPM extends AppObject_1.AppObjectPM {
7
+ constructor(appObject) {
8
+ super(appObject, LandmarkListPM.type);
9
+ this.onRepoChange = () => {
10
+ if (!this.landmarkRepo)
11
+ return;
12
+ const landmarks = this.landmarkRepo.getAll();
13
+ const ids = landmarks.map((landmark) => landmark.appObject.id);
14
+ this.doUpdateView(ids);
15
+ };
16
+ this.dispose = () => {
17
+ var _a, _b;
18
+ super.dispose();
19
+ (_a = this.landmarkRepo) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onRepoChange);
20
+ (_b = this.landmarkRepo) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
21
+ };
22
+ this.landmarkRepo = appObject.getComponent(LandmarkRepo_1.LandmarkRepo.type);
23
+ if (this.landmarkRepo) {
24
+ this.landmarkRepo.addChangeObserver(this.onRepoChange);
25
+ this.landmarkRepo.addOnDisposeObserver(() => this.dispose());
26
+ this.onRepoChange();
27
+ }
28
+ else {
29
+ console.warn("[LandmarkListPM] App Object does not have a LandmarkRepo Entity");
30
+ }
31
+ }
32
+ static addIfMissing(appObj) {
33
+ const existing = appObj.getComponent(LandmarkListPM.type);
34
+ if (existing) {
35
+ return existing;
36
+ }
37
+ else {
38
+ return new LandmarkListPM(appObj);
39
+ }
40
+ }
41
+ vmsAreEqual(a, b) {
42
+ return a.length === b.length;
43
+ }
44
+ }
45
+ exports.LandmarkListPM = LandmarkListPM;
46
+ LandmarkListPM.type = "LandmarkListPM";
@@ -0,0 +1,10 @@
1
+ import { AppObject, AppObjectPM } from "../../../AppObject";
2
+ export declare class LandmarkSizePM extends AppObjectPM<number> {
3
+ static readonly type = "LandmarkSizePM";
4
+ static addIfMissing(appObj: AppObject): LandmarkSizePM;
5
+ private landmarkEntity?;
6
+ vmsAreEqual(a: number, b: number): boolean;
7
+ onRepoChange: () => void;
8
+ dispose: () => void;
9
+ constructor(appObject: AppObject);
10
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LandmarkSizePM = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const LandmarkEntity_1 = require("../Entities/LandmarkEntity");
6
+ class LandmarkSizePM extends AppObject_1.AppObjectPM {
7
+ constructor(appObject) {
8
+ super(appObject, LandmarkSizePM.type);
9
+ this.onRepoChange = () => {
10
+ if (!this.landmarkEntity)
11
+ return;
12
+ this.doUpdateView(this.landmarkEntity.size);
13
+ };
14
+ this.dispose = () => {
15
+ var _a, _b;
16
+ super.dispose();
17
+ (_a = this.landmarkEntity) === null || _a === void 0 ? void 0 : _a.removeChangeObserver(this.onRepoChange);
18
+ (_b = this.landmarkEntity) === null || _b === void 0 ? void 0 : _b.removeOnDisposeObserver(this.dispose);
19
+ };
20
+ this.landmarkEntity = appObject.getComponent(LandmarkEntity_1.LandmarkEntity.type);
21
+ if (this.landmarkEntity) {
22
+ this.landmarkEntity.addChangeObserver(this.onRepoChange);
23
+ this.landmarkEntity.addOnDisposeObserver(() => this.dispose());
24
+ this.onRepoChange();
25
+ }
26
+ else {
27
+ console.warn("[LandmarkSizePM] App Object does not have a LandmarkEntity Entity");
28
+ }
29
+ }
30
+ static addIfMissing(appObj) {
31
+ const existing = appObj.getComponent(LandmarkSizePM.type);
32
+ if (existing) {
33
+ return existing;
34
+ }
35
+ else {
36
+ return new LandmarkSizePM(appObj);
37
+ }
38
+ }
39
+ vmsAreEqual(a, b) {
40
+ return a === b;
41
+ }
42
+ }
43
+ exports.LandmarkSizePM = LandmarkSizePM;
44
+ LandmarkSizePM.type = "LandmarkSizePM";
@@ -0,0 +1,2 @@
1
+ export * from "./LandmarkListPM";
2
+ export * from "./LandmarkSizePM";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./LandmarkListPM"), exports);
14
+ __exportStar(require("./LandmarkSizePM"), exports);
@@ -0,0 +1,8 @@
1
+ import { AppObject, AppObjectUC } from "../../../AppObject";
2
+ import { LandmarkDTO, LandmarkEntity } from "../Entities/LandmarkEntity";
3
+ export declare abstract class AddLandmarkUC extends AppObjectUC {
4
+ static readonly type = "AddLandmarkUC";
5
+ abstract addFromData(data: LandmarkDTO): LandmarkEntity | undefined;
6
+ abstract addNew(): LandmarkEntity | undefined;
7
+ }
8
+ export declare function makeAddLandmarkUC(appObject: AppObject): AddLandmarkUC;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeAddLandmarkUC = exports.AddLandmarkUC = void 0;
4
+ const AppObject_1 = require("../../../AppObject");
5
+ const Utilities_1 = require("../../../Utilities");
6
+ const Label_1 = require("../../Label");
7
+ const Transform3D_1 = require("../../Transform3D");
8
+ const LandmarkGlobals_1 = require("../Entities/LandmarkGlobals");
9
+ const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
10
+ class AddLandmarkUC extends AppObject_1.AppObjectUC {
11
+ }
12
+ exports.AddLandmarkUC = AddLandmarkUC;
13
+ AddLandmarkUC.type = "AddLandmarkUC";
14
+ function makeAddLandmarkUC(appObject) {
15
+ return new AddLandmarkUCImp(appObject);
16
+ }
17
+ exports.makeAddLandmarkUC = makeAddLandmarkUC;
18
+ class AddLandmarkUCImp extends AddLandmarkUC {
19
+ constructor(appObject) {
20
+ super(appObject, AddLandmarkUC.type);
21
+ this.landmarkRepo = appObject.getComponent(LandmarkRepo_1.LandmarkRepo.type);
22
+ if (!this.landmarkRepo) {
23
+ this.warn("LandmarkRepo App Object has not been added. Add to the LandmarkRepo App Object before Adding Landmark.");
24
+ return;
25
+ }
26
+ this.transform3D = appObject.getComponent(Transform3D_1.Transform3D.type);
27
+ if (!this.transform3D) {
28
+ this.warn("Transform3D App Object has not been added. Add to the Transform3D App Object before Adding Landmark.");
29
+ return;
30
+ }
31
+ this.label = appObject.getComponent(Label_1.Label.type); // Not required
32
+ }
33
+ addFromData(data) {
34
+ if (!this.landmarkRepo || !this.transform3D)
35
+ return;
36
+ if (data.parentID !== this.appObject.id)
37
+ return;
38
+ const existingLandmark = this.landmarkRepo.getForAppObject(data.id);
39
+ if (existingLandmark) {
40
+ existingLandmark.data = data;
41
+ return;
42
+ }
43
+ const globals = this.appObjects.getSingleton(LandmarkGlobals_1.LandmarkGlobals.type);
44
+ if (!globals)
45
+ return;
46
+ const newLandmark = globals.landmarkFactory(data.id);
47
+ if (!newLandmark)
48
+ return;
49
+ newLandmark.transform.parent = this.transform3D;
50
+ newLandmark.data = data;
51
+ this.landmarkRepo.add(newLandmark);
52
+ return newLandmark;
53
+ }
54
+ addNew() {
55
+ if (!this.landmarkRepo || !this.transform3D)
56
+ return;
57
+ const globals = this.appObjects.getSingleton(LandmarkGlobals_1.LandmarkGlobals.type);
58
+ if (!globals)
59
+ return;
60
+ const newLandmark = globals.landmarkFactory(Utilities_1.generateUniqueID());
61
+ if (!newLandmark)
62
+ return;
63
+ newLandmark.transform.parent = this.transform3D;
64
+ this.landmarkRepo.add(newLandmark);
65
+ return newLandmark;
66
+ }
67
+ }
@@ -0,0 +1,13 @@
1
+ import { AppObject } from "../../../AppObject";
2
+ import { UndoRedoAction } from "../../UndoRedo/Entities/UndoRedoEntity";
3
+ import { LandmarkDTO } from "../Entities/LandmarkEntity";
4
+ export declare class AddLandmarkUndoRedo implements UndoRedoAction {
5
+ private landmarkDTO;
6
+ private appObject;
7
+ private landmarkRepo?;
8
+ private addLandmarkUC?;
9
+ private deleteLandmarkUC?;
10
+ undoAction: () => void;
11
+ redoAction: () => void;
12
+ constructor(landmarkDTO: LandmarkDTO, appObject: AppObject);
13
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddLandmarkUndoRedo = void 0;
4
+ const DispatchStateChangeUC_1 = require("../../Dispatcher/UC/DispatchStateChangeUC");
5
+ const UndoRedoEntity_1 = require("../../UndoRedo/Entities/UndoRedoEntity");
6
+ const LandmarkRepo_1 = require("../Entities/LandmarkRepo");
7
+ const AddLandmarkUC_1 = require("./AddLandmarkUC");
8
+ const DeleteLandmarkUC_1 = require("./DeleteLandmarkUC");
9
+ class AddLandmarkUndoRedo {
10
+ constructor(landmarkDTO, appObject) {
11
+ this.landmarkDTO = landmarkDTO;
12
+ this.appObject = appObject;
13
+ this.undoAction = () => {
14
+ if (!this.deleteLandmarkUC)
15
+ return;
16
+ this.deleteLandmarkUC.deleteLandmark(this.landmarkDTO.id, true);
17
+ DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
18
+ };
19
+ this.redoAction = () => {
20
+ if (!this.addLandmarkUC)
21
+ return;
22
+ this.addLandmarkUC.addFromData(this.landmarkDTO);
23
+ DispatchStateChangeUC_1.dispatchStateChange(this.appObject.appObjectRepo);
24
+ };
25
+ this.landmarkRepo = appObject.getComponent(LandmarkRepo_1.LandmarkRepo.type);
26
+ if (!this.landmarkRepo) {
27
+ appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "App Object does not have a Landmark Repo");
28
+ return;
29
+ }
30
+ this.addLandmarkUC = appObject.getComponent(AddLandmarkUC_1.AddLandmarkUC.type);
31
+ if (!this.addLandmarkUC) {
32
+ appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "App Object does not have a AddLandmarkUC");
33
+ return;
34
+ }
35
+ this.deleteLandmarkUC = appObject.getComponent(DeleteLandmarkUC_1.DeleteLandmarkUC.type);
36
+ if (!this.deleteLandmarkUC) {
37
+ appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "App Object does not have a DeleteLandmarkUC");
38
+ return;
39
+ }
40
+ const undoRedo = UndoRedoEntity_1.UndoRedoEntity.get(appObject.appObjectRepo);
41
+ if (!undoRedo) {
42
+ appObject.appObjectRepo.submitWarning("AddLandmarkUndoRedo", "Unable to find UndoRedoEntity");
43
+ return;
44
+ }
45
+ undoRedo.submitAction(this);
46
+ }
47
+ }
48
+ exports.AddLandmarkUndoRedo = AddLandmarkUndoRedo;
@@ -0,0 +1,9 @@
1
+ import { AppObject, AppObjectUC } from "../../../AppObject";
2
+ export declare class DeleteLandmarkUC extends AppObjectUC {
3
+ static readonly type = "DeleteLandmarkUC";
4
+ private landmarkRepo?;
5
+ static get(appObj: AppObject): DeleteLandmarkUC | undefined;
6
+ static addIfMissing(appObj: AppObject): DeleteLandmarkUC;
7
+ deleteLandmark: (id: string, quietly?: boolean, createUndo?: boolean) => void;
8
+ constructor(appObject: AppObject);
9
+ }