@vived/app 4.17.5 → 4.18.1
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/lib/Components/ChannelModel/Adapters/channelModelAdapter.d.ts +3 -0
- package/lib/Components/ChannelModel/Adapters/channelModelAdapter.js +23 -0
- package/lib/Components/ChannelModel/Adapters/channelModelObjectAdapter.d.ts +3 -0
- package/lib/Components/ChannelModel/Adapters/channelModelObjectAdapter.js +23 -0
- package/lib/Components/ChannelModel/Adapters/index.d.ts +2 -0
- package/lib/Components/ChannelModel/Adapters/index.js +14 -0
- package/lib/Components/ChannelModel/Controllers/index.d.ts +1 -0
- package/lib/Components/ChannelModel/Controllers/index.js +13 -0
- package/lib/Components/ChannelModel/Controllers/setModelObjectLabel.d.ts +2 -0
- package/lib/Components/ChannelModel/Controllers/setModelObjectLabel.js +14 -0
- package/lib/Components/ChannelModel/Entities/ChannelModel.d.ts +132 -33
- package/lib/Components/ChannelModel/Entities/ChannelModel.js +119 -22
- package/lib/Components/ChannelModel/Entities/ChannelModelObject.d.ts +15 -0
- package/lib/Components/ChannelModel/Entities/ChannelModelObject.js +64 -0
- package/lib/Components/ChannelModel/Entities/ChannelModelRepo.d.ts +5 -4
- package/lib/Components/ChannelModel/Entities/ChannelModelRepo.js +8 -1
- package/lib/Components/ChannelModel/Entities/index.d.ts +1 -0
- package/lib/Components/ChannelModel/Entities/index.js +1 -0
- package/lib/Components/ChannelModel/Mocks/ChannelModelObjectPMMock.d.ts +7 -0
- package/lib/Components/ChannelModel/Mocks/ChannelModelObjectPMMock.js +11 -0
- package/lib/Components/ChannelModel/Mocks/ChannelModelPMMock.d.ts +7 -0
- package/lib/Components/ChannelModel/Mocks/ChannelModelPMMock.js +11 -0
- package/lib/Components/ChannelModel/Mocks/index.d.ts +3 -0
- package/lib/Components/ChannelModel/Mocks/index.js +15 -0
- package/lib/Components/ChannelModel/PMs/ChannelModelObjectPM.d.ts +12 -0
- package/lib/Components/ChannelModel/PMs/ChannelModelObjectPM.js +60 -0
- package/lib/Components/ChannelModel/PMs/ChannelModelPM.d.ts +11 -0
- package/lib/Components/ChannelModel/PMs/ChannelModelPM.js +66 -0
- package/lib/Components/ChannelModel/PMs/index.d.ts +2 -0
- package/lib/Components/ChannelModel/PMs/index.js +14 -0
- package/lib/Components/ChannelModel/UC/InitializeChannelModelFromGLB.d.ts +0 -0
- package/lib/Components/ChannelModel/UC/InitializeChannelModelFromGLB.js +1 -0
- package/lib/Components/ChannelModel/UC/SetupChannelModelUC.d.ts +3 -4
- package/lib/Components/ChannelModel/UC/SetupChannelModelUC.js +1 -139
- package/lib/Components/ChannelModel/index.d.ts +4 -0
- package/lib/Components/ChannelModel/index.js +4 -0
- package/lib/Components/GLBModel/Entities/GblModelRepo.d.ts +9 -0
- package/lib/Components/GLBModel/Entities/GblModelRepo.js +32 -0
- package/lib/Components/GLBModel/Entities/GlbModelEntity.d.ts +26 -0
- package/lib/Components/GLBModel/Entities/GlbModelEntity.js +56 -0
- package/lib/Components/GLBModel/Entities/index.d.ts +2 -0
- package/lib/Components/GLBModel/Entities/index.js +14 -0
- package/lib/Components/GLBModel/Mocks/LoadGlbFileUCMock.d.ts +8 -0
- package/lib/Components/GLBModel/Mocks/LoadGlbFileUCMock.js +15 -0
- package/lib/Components/GLBModel/Mocks/index.d.ts +1 -0
- package/lib/Components/GLBModel/Mocks/index.js +13 -0
- package/lib/Components/GLBModel/UCs/LoadGlbFileUC.d.ts +7 -0
- package/lib/Components/GLBModel/UCs/LoadGlbFileUC.js +11 -0
- package/lib/Components/GLBModel/UCs/index.d.ts +1 -0
- package/lib/Components/GLBModel/UCs/index.js +13 -0
- package/lib/Components/GLBModel/index.d.ts +3 -0
- package/lib/Components/GLBModel/index.js +15 -0
- package/lib/Components/Landmarks/UseCases/DeleteLandmarkUC.js +3 -3
- package/lib/Components/index.d.ts +1 -0
- package/lib/Components/index.js +1 -0
- package/lib/Types/index.d.ts +0 -1
- package/lib/Types/index.js +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.channelModelAdapter = void 0;
|
|
4
|
+
const ChannelModelPM_1 = require("../PMs/ChannelModelPM");
|
|
5
|
+
exports.channelModelAdapter = {
|
|
6
|
+
defaultVM: ChannelModelPM_1.defaultChannelModelVM,
|
|
7
|
+
subscribe: (id, appObjects, setVM) => {
|
|
8
|
+
const pm = ChannelModelPM_1.ChannelModelPM.get(id, appObjects);
|
|
9
|
+
if (!pm) {
|
|
10
|
+
appObjects.submitError("channelModelAdapter", "Unable to find PM");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
pm.addView(setVM);
|
|
14
|
+
},
|
|
15
|
+
unsubscribe: (id, appObjects, setVM) => {
|
|
16
|
+
const pm = ChannelModelPM_1.ChannelModelPM.get(id, appObjects);
|
|
17
|
+
if (!pm) {
|
|
18
|
+
appObjects.submitError("channelModelAdapter", "Unable to find PM");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
pm.removeView(setVM);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.channelModelObjectAdapter = void 0;
|
|
4
|
+
const ChannelModelObjectPM_1 = require("../PMs/ChannelModelObjectPM");
|
|
5
|
+
exports.channelModelObjectAdapter = {
|
|
6
|
+
defaultVM: ChannelModelObjectPM_1.defaultChannelModelObjectVM,
|
|
7
|
+
subscribe: (id, appObjects, setVM) => {
|
|
8
|
+
const pm = ChannelModelObjectPM_1.ChannelModelObjectPM.get(id, appObjects);
|
|
9
|
+
if (!pm) {
|
|
10
|
+
appObjects.submitError("channelModelObjectAdapter", "Unable to find PM");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
pm.addView(setVM);
|
|
14
|
+
},
|
|
15
|
+
unsubscribe: (id, appObjects, setVM) => {
|
|
16
|
+
const pm = ChannelModelObjectPM_1.ChannelModelObjectPM.get(id, appObjects);
|
|
17
|
+
if (!pm) {
|
|
18
|
+
appObjects.submitError("channelModelObjectAdapter", "Unable to find PM");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
pm.removeView(setVM);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -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("./channelModelAdapter"), exports);
|
|
14
|
+
__exportStar(require("./channelModelObjectAdapter"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./setModelObjectLabel";
|
|
@@ -0,0 +1,13 @@
|
|
|
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("./setModelObjectLabel"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setModelObjectLabel = void 0;
|
|
4
|
+
const Entities_1 = require("../Entities");
|
|
5
|
+
function setModelObjectLabel(label, id, appObjects) {
|
|
6
|
+
const entity = Entities_1.ChannelModelObject.get(id, appObjects);
|
|
7
|
+
if (entity) {
|
|
8
|
+
entity.label = label;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
appObjects.submitWarning("setModelObjectLabel", "Unable to find object by ID");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.setModelObjectLabel = setModelObjectLabel;
|
|
@@ -1,41 +1,140 @@
|
|
|
1
|
-
import { AppObject, AppObjectEntity } from "../../../AppObject";
|
|
1
|
+
import { AppObject, AppObjectEntity, AppObjectRepo } from "../../../AppObject";
|
|
2
2
|
import { Quaternion, Vector3 } from "../../../ValueObjects";
|
|
3
|
+
import { ChannelModelObject } from "./ChannelModelObject";
|
|
3
4
|
export declare enum ChannelModelState {
|
|
4
5
|
INIT = "Initialized",
|
|
5
6
|
LOADING = "Loading",
|
|
6
7
|
READY = "Ready",
|
|
7
8
|
ERROR = "Error"
|
|
8
9
|
}
|
|
9
|
-
export declare class
|
|
10
|
-
static readonly type = "
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
get
|
|
15
|
-
set
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
get
|
|
21
|
-
set
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
get
|
|
27
|
-
set
|
|
28
|
-
|
|
29
|
-
get
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
10
|
+
export declare abstract class ChannelModelEntity extends AppObjectEntity {
|
|
11
|
+
static readonly type = "ChannelModelEntity";
|
|
12
|
+
abstract get id(): string;
|
|
13
|
+
abstract get name(): string;
|
|
14
|
+
abstract set name(val: string);
|
|
15
|
+
abstract get bounds_min(): Vector3;
|
|
16
|
+
abstract set bounds_min(val: Vector3);
|
|
17
|
+
abstract get bounds_max(): Vector3;
|
|
18
|
+
abstract set bounds_max(val: Vector3);
|
|
19
|
+
abstract get defaultPosition(): Vector3;
|
|
20
|
+
abstract set defaultPosition(val: Vector3);
|
|
21
|
+
abstract get defaultRotation(): Quaternion;
|
|
22
|
+
abstract set defaultRotation(val: Quaternion);
|
|
23
|
+
abstract get defaultScale(): number;
|
|
24
|
+
abstract set defaultScale(val: number);
|
|
25
|
+
abstract get state(): ChannelModelState;
|
|
26
|
+
abstract set state(val: ChannelModelState);
|
|
27
|
+
abstract get modelError(): Error | undefined;
|
|
28
|
+
abstract set modelError(val: Error | undefined);
|
|
29
|
+
abstract get modelObjectIds(): string[];
|
|
30
|
+
abstract get data(): ChannelModelDTOv2;
|
|
31
|
+
abstract setupFromData(data: object): void;
|
|
32
|
+
abstract originalCollectionID?: string;
|
|
33
|
+
abstract modelObjectFactory(id: string): ChannelModelObject;
|
|
34
|
+
abstract addModelObject(id?: string): ChannelModelObject;
|
|
35
|
+
abstract hasModelObject(id: string): boolean;
|
|
36
|
+
abstract getModelObject(id: string): ChannelModelObject | undefined;
|
|
37
|
+
abstract modelObjects(): ChannelModelObject[];
|
|
38
|
+
static get(id: string, appObjects: AppObjectRepo): ChannelModelEntity | undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare function makeChannelModelEntity(appObject: AppObject): ChannelModelEntity;
|
|
41
|
+
export interface ChannelModelDTOv2 {
|
|
42
|
+
version: 2;
|
|
43
|
+
objects: ChannelModelDataMeshDTOv2[];
|
|
44
|
+
name: string;
|
|
45
|
+
bounds_min: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
z: number;
|
|
49
|
+
};
|
|
50
|
+
bounds_max: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
z: number;
|
|
54
|
+
};
|
|
55
|
+
defaultPosition: {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
z: number;
|
|
59
|
+
};
|
|
60
|
+
defaultRotation: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
z: number;
|
|
64
|
+
w: number;
|
|
65
|
+
};
|
|
66
|
+
defaultScale: number;
|
|
67
|
+
originalCollectionID?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ChannelModelDTOv1 {
|
|
70
|
+
version: number;
|
|
71
|
+
objects: ChannelModelDataMeshDTOv1[];
|
|
72
|
+
name: string;
|
|
73
|
+
bounds_min: {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
z: number;
|
|
77
|
+
};
|
|
78
|
+
bounds_max: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
z: number;
|
|
82
|
+
};
|
|
83
|
+
defaultPosition: {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
z: number;
|
|
87
|
+
};
|
|
88
|
+
defaultRotation: {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
z: number;
|
|
92
|
+
w: number;
|
|
93
|
+
};
|
|
94
|
+
defaultScale: number;
|
|
95
|
+
}
|
|
96
|
+
export interface ChannelModelDTOv0 {
|
|
97
|
+
version: number;
|
|
98
|
+
objects: ChannelModelDataMeshDTOv0[];
|
|
99
|
+
name: string;
|
|
100
|
+
description: string;
|
|
101
|
+
bounds_min: {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
z: number;
|
|
105
|
+
};
|
|
106
|
+
bounds_max: {
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
z: number;
|
|
110
|
+
};
|
|
111
|
+
defaultPosition: {
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
z: number;
|
|
115
|
+
};
|
|
116
|
+
defaultRotation: {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
z: number;
|
|
120
|
+
w: number;
|
|
121
|
+
};
|
|
122
|
+
defaultScale: number;
|
|
123
|
+
}
|
|
124
|
+
export interface ChannelModelDataMeshDTOv2 {
|
|
125
|
+
id: string;
|
|
126
|
+
meshPaths: string[];
|
|
127
|
+
label: string;
|
|
128
|
+
tags: string[];
|
|
129
|
+
}
|
|
130
|
+
export interface ChannelModelDataMeshDTOv1 {
|
|
131
|
+
version: number;
|
|
132
|
+
id: string;
|
|
133
|
+
meshPaths: string[];
|
|
134
|
+
label: string;
|
|
135
|
+
}
|
|
136
|
+
export interface ChannelModelDataMeshDTOv0 {
|
|
137
|
+
id: string;
|
|
138
|
+
meshPaths: string[];
|
|
139
|
+
label: string;
|
|
41
140
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.makeChannelModelEntity = exports.ChannelModelEntity = exports.ChannelModelState = void 0;
|
|
4
4
|
const AppObject_1 = require("../../../AppObject");
|
|
5
5
|
const Entities_1 = require("../../../Entities");
|
|
6
|
+
const Utilities_1 = require("../../../Utilities");
|
|
6
7
|
const ValueObjects_1 = require("../../../ValueObjects");
|
|
8
|
+
const ChannelModelObject_1 = require("./ChannelModelObject");
|
|
7
9
|
var ChannelModelState;
|
|
8
10
|
(function (ChannelModelState) {
|
|
9
11
|
ChannelModelState["INIT"] = "Initialized";
|
|
@@ -11,9 +13,25 @@ var ChannelModelState;
|
|
|
11
13
|
ChannelModelState["READY"] = "Ready";
|
|
12
14
|
ChannelModelState["ERROR"] = "Error";
|
|
13
15
|
})(ChannelModelState = exports.ChannelModelState || (exports.ChannelModelState = {}));
|
|
14
|
-
class
|
|
16
|
+
class ChannelModelEntity extends AppObject_1.AppObjectEntity {
|
|
17
|
+
static get(id, appObjects) {
|
|
18
|
+
const appObject = appObjects.get(id);
|
|
19
|
+
if (!appObject) {
|
|
20
|
+
appObjects.submitWarning("ChannelModel.get", "Unable to find app object by ID");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
return appObject.getComponent(ChannelModelEntity.type);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ChannelModelEntity = ChannelModelEntity;
|
|
27
|
+
ChannelModelEntity.type = "ChannelModelEntity";
|
|
28
|
+
function makeChannelModelEntity(appObject) {
|
|
29
|
+
return new ChannelModelEntityImp(appObject);
|
|
30
|
+
}
|
|
31
|
+
exports.makeChannelModelEntity = makeChannelModelEntity;
|
|
32
|
+
class ChannelModelEntityImp extends ChannelModelEntity {
|
|
15
33
|
constructor(appObject) {
|
|
16
|
-
super(appObject,
|
|
34
|
+
super(appObject, ChannelModelEntity.type);
|
|
17
35
|
this._name = new Entities_1.MemoizedString("", this.notifyOnChange);
|
|
18
36
|
this._boundsMin = new Entities_1.MemoizedVector3(ValueObjects_1.Vector3.Zero(), this.notifyOnChange);
|
|
19
37
|
this._boundsMax = new Entities_1.MemoizedVector3(ValueObjects_1.Vector3.Zero(), this.notifyOnChange);
|
|
@@ -21,19 +39,61 @@ class ChannelModel extends AppObject_1.AppObjectEntity {
|
|
|
21
39
|
this._defaultRotation = new Entities_1.MemoizedQuaternion(ValueObjects_1.Quaternion.Identity(), this.notifyOnChange);
|
|
22
40
|
this._defaultScale = new Entities_1.MemoizedNumber(1, this.notifyOnChange);
|
|
23
41
|
this._state = new Entities_1.MemoizedString(ChannelModelState.INIT, this.notifyOnChange);
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
this.modelObjectLookup = new Map();
|
|
43
|
+
this.setupFromData = (data) => {
|
|
44
|
+
if ("bounds_max" in data) {
|
|
45
|
+
this.bounds_max = ValueObjects_1.Vector3.FromDTO(data.bounds_max);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.bounds_max = ValueObjects_1.Vector3.Zero();
|
|
49
|
+
}
|
|
50
|
+
if ("bounds_min" in data) {
|
|
51
|
+
this.bounds_min = ValueObjects_1.Vector3.FromDTO(data.bounds_min);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.bounds_min = ValueObjects_1.Vector3.Zero();
|
|
55
|
+
}
|
|
56
|
+
if ("defaultPosition" in data) {
|
|
57
|
+
this.defaultPosition = ValueObjects_1.Vector3.FromDTO(data.defaultPosition);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.defaultPosition = ValueObjects_1.Vector3.Zero();
|
|
61
|
+
}
|
|
62
|
+
if ("defaultRotation" in data) {
|
|
63
|
+
this.defaultRotation = ValueObjects_1.Quaternion.FromDTO(data.defaultRotation);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.defaultRotation = ValueObjects_1.Quaternion.Identity();
|
|
67
|
+
}
|
|
68
|
+
if ("defaultScale" in data) {
|
|
69
|
+
this.defaultScale = data.defaultScale;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.defaultScale = 1;
|
|
73
|
+
}
|
|
74
|
+
if ("name" in data) {
|
|
75
|
+
this.name = data.name;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.name = "Unnamed Channel";
|
|
79
|
+
}
|
|
80
|
+
if ("originalCollectionID" in data) {
|
|
81
|
+
this.originalCollectionID = data.originalCollectionID;
|
|
82
|
+
}
|
|
83
|
+
if ("objects" in data) {
|
|
84
|
+
const objects = data.objects;
|
|
85
|
+
objects.forEach((obj) => {
|
|
86
|
+
var _a;
|
|
87
|
+
const modelObj = this.addModelObject(obj.id);
|
|
88
|
+
modelObj.label = obj.label;
|
|
89
|
+
modelObj.subMeshPaths = obj.meshPaths;
|
|
90
|
+
modelObj.tags = (_a = obj.tags) !== null && _a !== void 0 ? _a : [];
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
get id() {
|
|
96
|
+
return this.appObject.id;
|
|
37
97
|
}
|
|
38
98
|
get name() {
|
|
39
99
|
return this._name.val;
|
|
@@ -84,13 +144,50 @@ class ChannelModel extends AppObject_1.AppObjectEntity {
|
|
|
84
144
|
this._error = val;
|
|
85
145
|
this._state.val = ChannelModelState.ERROR;
|
|
86
146
|
}
|
|
87
|
-
|
|
88
|
-
|
|
147
|
+
modelObjectFactory(id) {
|
|
148
|
+
const ao = this.appObjects.getOrCreate(id);
|
|
149
|
+
return ChannelModelObject_1.makeChannelModelObject(ao);
|
|
89
150
|
}
|
|
90
|
-
|
|
91
|
-
|
|
151
|
+
addModelObject(id) {
|
|
152
|
+
const idToUse = id !== null && id !== void 0 ? id : Utilities_1.generateUniqueID();
|
|
153
|
+
const obj = this.modelObjectFactory(idToUse);
|
|
154
|
+
this.modelObjectLookup.set(idToUse, obj);
|
|
155
|
+
obj.addChangeObserver(this.notifyOnChange);
|
|
92
156
|
this.notifyOnChange();
|
|
157
|
+
return obj;
|
|
158
|
+
}
|
|
159
|
+
getModelObject(id) {
|
|
160
|
+
return this.modelObjectLookup.get(id);
|
|
161
|
+
}
|
|
162
|
+
hasModelObject(id) {
|
|
163
|
+
return this.modelObjectLookup.has(id);
|
|
164
|
+
}
|
|
165
|
+
modelObjects() {
|
|
166
|
+
return Array.from(this.modelObjectLookup.values());
|
|
167
|
+
}
|
|
168
|
+
get modelObjectIds() {
|
|
169
|
+
return Array.from(this.modelObjectLookup.keys());
|
|
170
|
+
}
|
|
171
|
+
get data() {
|
|
172
|
+
const modelObjects = Array.from(this.modelObjectLookup.values());
|
|
173
|
+
const objects = modelObjects.map((obj) => {
|
|
174
|
+
return {
|
|
175
|
+
id: obj.id,
|
|
176
|
+
label: obj.label,
|
|
177
|
+
meshPaths: [...obj.subMeshPaths],
|
|
178
|
+
tags: [...obj.tags],
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
bounds_max: this._boundsMax.val.dto,
|
|
183
|
+
bounds_min: this._boundsMin.val.dto,
|
|
184
|
+
defaultPosition: this._defaultPosition.val.dto,
|
|
185
|
+
defaultRotation: this._defaultRotation.val.dto,
|
|
186
|
+
defaultScale: this._defaultScale.val,
|
|
187
|
+
name: this._name.val,
|
|
188
|
+
objects,
|
|
189
|
+
version: 2,
|
|
190
|
+
originalCollectionID: this.originalCollectionID,
|
|
191
|
+
};
|
|
93
192
|
}
|
|
94
193
|
}
|
|
95
|
-
exports.ChannelModel = ChannelModel;
|
|
96
|
-
ChannelModel.type = "CHANNEL_MODEL";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AppObject, AppObjectEntity, AppObjectRepo } from "../../../AppObject";
|
|
2
|
+
export declare abstract class ChannelModelObject extends AppObjectEntity {
|
|
3
|
+
static readonly type = "ChannelModelObject";
|
|
4
|
+
abstract get id(): string;
|
|
5
|
+
abstract get label(): string;
|
|
6
|
+
abstract set label(val: string);
|
|
7
|
+
abstract get labelValidationMessage(): string | null;
|
|
8
|
+
abstract labelValidator(val: string): string | null;
|
|
9
|
+
abstract get tags(): string[];
|
|
10
|
+
abstract set tags(val: string[]);
|
|
11
|
+
abstract get subMeshPaths(): string[];
|
|
12
|
+
abstract set subMeshPaths(val: string[]);
|
|
13
|
+
static get(id: string, appObjects: AppObjectRepo): ChannelModelObject | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare function makeChannelModelObject(appObject: AppObject): ChannelModelObject;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeChannelModelObject = exports.ChannelModelObject = void 0;
|
|
4
|
+
const AppObject_1 = require("../../../AppObject");
|
|
5
|
+
const Entities_1 = require("../../../Entities");
|
|
6
|
+
class ChannelModelObject extends AppObject_1.AppObjectEntity {
|
|
7
|
+
static get(id, appObjects) {
|
|
8
|
+
const appObject = appObjects.get(id);
|
|
9
|
+
if (!appObject) {
|
|
10
|
+
appObjects.submitWarning("ChannelModelObject.get", "Unable to find app object by ID");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return appObject.getComponent(ChannelModelObject.type);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ChannelModelObject = ChannelModelObject;
|
|
17
|
+
ChannelModelObject.type = "ChannelModelObject";
|
|
18
|
+
function makeChannelModelObject(appObject) {
|
|
19
|
+
return new ChannelModelObjectImp(appObject);
|
|
20
|
+
}
|
|
21
|
+
exports.makeChannelModelObject = makeChannelModelObject;
|
|
22
|
+
class ChannelModelObjectImp extends ChannelModelObject {
|
|
23
|
+
constructor(appObject) {
|
|
24
|
+
super(appObject, ChannelModelObject.type);
|
|
25
|
+
this.memoisedLabel = new Entities_1.MemoizedString("", this.notifyOnChange);
|
|
26
|
+
this.labelValidator = (val) => {
|
|
27
|
+
if (val.length === 0) {
|
|
28
|
+
return "Object name cannot be empty";
|
|
29
|
+
}
|
|
30
|
+
else if (val.length > 40) {
|
|
31
|
+
return "Object names are limited to 40 characters";
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
};
|
|
35
|
+
this._tags = [];
|
|
36
|
+
this._subMeshes = [];
|
|
37
|
+
}
|
|
38
|
+
get id() {
|
|
39
|
+
return this.appObject.id;
|
|
40
|
+
}
|
|
41
|
+
get label() {
|
|
42
|
+
return this.memoisedLabel.val;
|
|
43
|
+
}
|
|
44
|
+
set label(val) {
|
|
45
|
+
this.memoisedLabel.val = val;
|
|
46
|
+
}
|
|
47
|
+
get labelValidationMessage() {
|
|
48
|
+
return this.labelValidator(this.memoisedLabel.val);
|
|
49
|
+
}
|
|
50
|
+
get tags() {
|
|
51
|
+
return [...this._tags];
|
|
52
|
+
}
|
|
53
|
+
set tags(val) {
|
|
54
|
+
this._tags = [...val];
|
|
55
|
+
this.notifyOnChange();
|
|
56
|
+
}
|
|
57
|
+
get subMeshPaths() {
|
|
58
|
+
return [...this._subMeshes];
|
|
59
|
+
}
|
|
60
|
+
set subMeshPaths(val) {
|
|
61
|
+
this._subMeshes = [...val];
|
|
62
|
+
this.notifyOnChange();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AppObject, AppObjectEntityRepo, AppObjectRepo } from "../../../AppObject";
|
|
2
|
-
import {
|
|
3
|
-
export declare abstract class ChannelModelRepo extends AppObjectEntityRepo<
|
|
2
|
+
import { ChannelModelEntity } from "./ChannelModel";
|
|
3
|
+
export declare abstract class ChannelModelRepo extends AppObjectEntityRepo<ChannelModelEntity> {
|
|
4
4
|
static readonly type = "CHANNEL_MODEL_REPO";
|
|
5
5
|
abstract get isLoadingChannelModel(): boolean;
|
|
6
6
|
abstract set isLoadingChannelModel(val: boolean);
|
|
7
|
-
abstract getChannelModel(id: string, createIfMissing: boolean):
|
|
8
|
-
abstract channelModelFactory(id: string):
|
|
7
|
+
abstract getChannelModel(id: string, createIfMissing: boolean): ChannelModelEntity | undefined;
|
|
8
|
+
abstract channelModelFactory(id: string): ChannelModelEntity;
|
|
9
|
+
abstract createChannelModel(id?: string): ChannelModelEntity;
|
|
9
10
|
static get: (appObjects: AppObjectRepo) => ChannelModelRepo | undefined;
|
|
10
11
|
}
|
|
11
12
|
export declare function makeChannelModelRepo(appObject: AppObject): ChannelModelRepo;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.makeChannelModelRepo = exports.ChannelModelRepo = void 0;
|
|
4
4
|
const AppObject_1 = require("../../../AppObject");
|
|
5
5
|
const Entities_1 = require("../../../Entities");
|
|
6
|
+
const Utilities_1 = require("../../../Utilities");
|
|
6
7
|
const ChannelModel_1 = require("./ChannelModel");
|
|
7
8
|
class ChannelModelRepo extends AppObject_1.AppObjectEntityRepo {
|
|
8
9
|
}
|
|
@@ -25,9 +26,15 @@ class ChannelModelRepoImp extends ChannelModelRepo {
|
|
|
25
26
|
}
|
|
26
27
|
return rVal;
|
|
27
28
|
};
|
|
29
|
+
this.createChannelModel = (id) => {
|
|
30
|
+
const idToUse = id !== null && id !== void 0 ? id : Utilities_1.generateUniqueID();
|
|
31
|
+
const object = this.channelModelFactory(idToUse);
|
|
32
|
+
this.add(object);
|
|
33
|
+
return object;
|
|
34
|
+
};
|
|
28
35
|
this.channelModelFactory = (id) => {
|
|
29
36
|
const ao = this.appObjects.getOrCreate(id);
|
|
30
|
-
return
|
|
37
|
+
return ChannelModel_1.makeChannelModelEntity(ao);
|
|
31
38
|
};
|
|
32
39
|
}
|
|
33
40
|
get isLoadingChannelModel() {
|
|
@@ -11,4 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./ChannelModel"), exports);
|
|
14
|
+
__exportStar(require("./ChannelModelObject"), exports);
|
|
14
15
|
__exportStar(require("./ChannelModelRepo"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { ChannelModelObjectPM } from "../PMs/ChannelModelObjectPM";
|
|
4
|
+
export declare class ChannelModelObjectPMMock extends ChannelModelObjectPM {
|
|
5
|
+
vmsAreEqual: jest.Mock<any, any>;
|
|
6
|
+
constructor(appObject: AppObject);
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelModelObjectPMMock = void 0;
|
|
4
|
+
const ChannelModelObjectPM_1 = require("../PMs/ChannelModelObjectPM");
|
|
5
|
+
class ChannelModelObjectPMMock extends ChannelModelObjectPM_1.ChannelModelObjectPM {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, ChannelModelObjectPM_1.ChannelModelObjectPM.type);
|
|
8
|
+
this.vmsAreEqual = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ChannelModelObjectPMMock = ChannelModelObjectPMMock;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { AppObject } from "../../../AppObject";
|
|
3
|
+
import { ChannelModelPM } from "../PMs/ChannelModelPM";
|
|
4
|
+
export declare class ChannelModelPMMock extends ChannelModelPM {
|
|
5
|
+
vmsAreEqual: jest.Mock<any, any>;
|
|
6
|
+
constructor(appObject: AppObject);
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelModelPMMock = void 0;
|
|
4
|
+
const ChannelModelPM_1 = require("../PMs/ChannelModelPM");
|
|
5
|
+
class ChannelModelPMMock extends ChannelModelPM_1.ChannelModelPM {
|
|
6
|
+
constructor(appObject) {
|
|
7
|
+
super(appObject, ChannelModelPM_1.ChannelModelPM.type);
|
|
8
|
+
this.vmsAreEqual = jest.fn();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ChannelModelPMMock = ChannelModelPMMock;
|