@itwin/core-backend 5.1.0-dev.3 → 5.1.0-dev.4
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/cjs/Category.d.ts +37 -0
- package/lib/cjs/Category.d.ts.map +1 -1
- package/lib/cjs/Category.js +73 -0
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +5 -0
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +27 -0
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/Element.d.ts +166 -10
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +510 -9
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/Entity.d.ts +41 -1
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +58 -0
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +19 -36
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +129 -69
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +13 -0
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +6 -0
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/Material.d.ts +19 -0
- package/lib/cjs/Material.d.ts.map +1 -1
- package/lib/cjs/Material.js +29 -0
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +42 -6
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +93 -5
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +1 -0
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +100 -0
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +208 -0
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js +3 -3
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/internal/ElementLRUCache.d.ts +28 -0
- package/lib/cjs/internal/ElementLRUCache.d.ts.map +1 -0
- package/lib/cjs/internal/ElementLRUCache.js +120 -0
- package/lib/cjs/internal/ElementLRUCache.js.map +1 -0
- package/lib/cjs/internal/Symbols.d.ts +1 -0
- package/lib/cjs/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/internal/Symbols.js +2 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +2 -2
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/Category.d.ts +37 -0
- package/lib/esm/Category.d.ts.map +1 -1
- package/lib/esm/Category.js +73 -0
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +5 -0
- package/lib/esm/DisplayStyle.d.ts.map +1 -1
- package/lib/esm/DisplayStyle.js +27 -0
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/Element.d.ts +166 -10
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +513 -12
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/Entity.d.ts +41 -1
- package/lib/esm/Entity.d.ts.map +1 -1
- package/lib/esm/Entity.js +58 -0
- package/lib/esm/Entity.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +19 -36
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +132 -72
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelHost.d.ts +13 -0
- package/lib/esm/IModelHost.d.ts.map +1 -1
- package/lib/esm/IModelHost.js +6 -0
- package/lib/esm/IModelHost.js.map +1 -1
- package/lib/esm/Material.d.ts +19 -0
- package/lib/esm/Material.d.ts.map +1 -1
- package/lib/esm/Material.js +30 -1
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +42 -6
- package/lib/esm/Model.d.ts.map +1 -1
- package/lib/esm/Model.js +94 -6
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +1 -0
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +100 -0
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +209 -1
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/ViewStateHydrator.js +3 -3
- package/lib/esm/ViewStateHydrator.js.map +1 -1
- package/lib/esm/internal/ElementLRUCache.d.ts +28 -0
- package/lib/esm/internal/ElementLRUCache.d.ts.map +1 -0
- package/lib/esm/internal/ElementLRUCache.js +116 -0
- package/lib/esm/internal/ElementLRUCache.js.map +1 -0
- package/lib/esm/internal/Symbols.d.ts +1 -0
- package/lib/esm/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/internal/Symbols.js +1 -0
- package/lib/esm/internal/Symbols.js.map +1 -1
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js +2 -2
- package/lib/esm/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/esm/test/ElementLRUCache.test.d.ts +2 -0
- package/lib/esm/test/ElementLRUCache.test.d.ts.map +1 -0
- package/lib/esm/test/ElementLRUCache.test.js +212 -0
- package/lib/esm/test/ElementLRUCache.test.js.map +1 -0
- package/lib/esm/test/ecdb/ECSqlQuery.test.js +0 -23
- package/lib/esm/test/ecdb/ECSqlQuery.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +22 -11
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/standalone/SnapshotDb.test.js +1 -0
- package/lib/esm/test/standalone/SnapshotDb.test.js.map +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js +1 -1
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/package.json +12 -12
package/lib/cjs/Element.js
CHANGED
|
@@ -65,6 +65,51 @@ class Element extends Entity_1.Entity {
|
|
|
65
65
|
this.userLabel = props.userLabel;
|
|
66
66
|
this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Element custom HandledProps include 'codeValue', 'codeSpec', 'codeScope', 'model', 'parent', 'federationGuid', and 'lastMod'.
|
|
70
|
+
* @inheritdoc
|
|
71
|
+
* @beta
|
|
72
|
+
*/
|
|
73
|
+
static _customHandledProps = [
|
|
74
|
+
{ propertyName: "codeValue", source: "Class" },
|
|
75
|
+
{ propertyName: "codeSpec", source: "Class" },
|
|
76
|
+
{ propertyName: "codeScope", source: "Class" },
|
|
77
|
+
{ propertyName: "model", source: "Class" },
|
|
78
|
+
{ propertyName: "parent", source: "Class" },
|
|
79
|
+
{ propertyName: "federationGuid", source: "Class" },
|
|
80
|
+
{ propertyName: "lastMod", source: "Class" },
|
|
81
|
+
];
|
|
82
|
+
/**
|
|
83
|
+
* Element deserializes 'codeValue', 'codeSpec', 'codeScope', 'model', 'parent', and 'federationGuid'.
|
|
84
|
+
* @inheritdoc
|
|
85
|
+
* @beta
|
|
86
|
+
*/
|
|
87
|
+
static deserialize(props) {
|
|
88
|
+
const elProps = super.deserialize(props);
|
|
89
|
+
const instance = props.row;
|
|
90
|
+
elProps.code = { value: instance.codeValue ?? "", spec: instance.codeSpec.id, scope: instance.codeScope.id };
|
|
91
|
+
elProps.model = instance.model.id;
|
|
92
|
+
if (instance.parent)
|
|
93
|
+
elProps.parent = instance.parent;
|
|
94
|
+
if (instance.federationGuid)
|
|
95
|
+
elProps.federationGuid = instance.federationGuid;
|
|
96
|
+
return elProps;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Element serialize 'codeValue', 'codeSpec', 'codeScope', 'model', 'parent', and 'federationGuid'.
|
|
100
|
+
* @inheritdoc
|
|
101
|
+
* @beta
|
|
102
|
+
*/
|
|
103
|
+
static serialize(props, iModel) {
|
|
104
|
+
const inst = super.serialize(props, iModel);
|
|
105
|
+
inst.codeValue = props.code.value;
|
|
106
|
+
inst.codeSpec = { id: props.code.spec };
|
|
107
|
+
inst.codeScope = { id: props.code.scope };
|
|
108
|
+
inst.model = { id: props.model };
|
|
109
|
+
inst.parent = props.parent;
|
|
110
|
+
inst.federationGuid = props.federationGuid ?? iModel[Symbols_1._nativeDb].newBeGuid();
|
|
111
|
+
return inst;
|
|
112
|
+
}
|
|
68
113
|
/** Called before a new Element is inserted.
|
|
69
114
|
* @note throw an exception to disallow the insert
|
|
70
115
|
* @note If you override this method, you must call super.
|
|
@@ -89,6 +134,7 @@ class Element extends Entity_1.Entity {
|
|
|
89
134
|
const locks = arg.iModel.locks;
|
|
90
135
|
if (locks && !locks.holdsExclusiveLock(arg.model))
|
|
91
136
|
locks[Symbols_1._elementWasCreated](arg.id);
|
|
137
|
+
arg.iModel.models[Symbols_1._cache].delete(arg.model);
|
|
92
138
|
}
|
|
93
139
|
/** Called before an Element is updated.
|
|
94
140
|
* @note throw an exception to disallow the update
|
|
@@ -107,7 +153,10 @@ class Element extends Entity_1.Entity {
|
|
|
107
153
|
* @note `this` is the class of the Element that was updated
|
|
108
154
|
* @beta
|
|
109
155
|
*/
|
|
110
|
-
static onUpdated(
|
|
156
|
+
static onUpdated(arg) {
|
|
157
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id: arg.id });
|
|
158
|
+
arg.iModel.models[Symbols_1._cache].delete(arg.model);
|
|
159
|
+
}
|
|
111
160
|
/** Called before an Element is deleted.
|
|
112
161
|
* @note throw an exception to disallow the delete
|
|
113
162
|
* @note If you override this method, you must call super.
|
|
@@ -123,7 +172,10 @@ class Element extends Entity_1.Entity {
|
|
|
123
172
|
* @note `this` is the class of the Element that was deleted
|
|
124
173
|
* @beta
|
|
125
174
|
*/
|
|
126
|
-
static onDeleted(
|
|
175
|
+
static onDeleted(arg) {
|
|
176
|
+
arg.iModel.elements[Symbols_1._cache].delete(arg);
|
|
177
|
+
arg.iModel.models[Symbols_1._cache].delete(arg.model);
|
|
178
|
+
}
|
|
127
179
|
/** Called when an element with an instance of this class as its parent is about to be deleted.
|
|
128
180
|
* @note throw an exception if the element should not be deleted
|
|
129
181
|
* @note implementers should not presume that the element was deleted if this method does not throw,
|
|
@@ -136,7 +188,10 @@ class Element extends Entity_1.Entity {
|
|
|
136
188
|
* @note `this` is the class of the parent Element whose child was deleted
|
|
137
189
|
* @beta
|
|
138
190
|
*/
|
|
139
|
-
static onChildDeleted(
|
|
191
|
+
static onChildDeleted(arg) {
|
|
192
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id: arg.parentId });
|
|
193
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id: arg.childId });
|
|
194
|
+
}
|
|
140
195
|
/** Called when a *new element* with an instance of this class as its parent is about to be inserted.
|
|
141
196
|
* @note throw an exception if the element should not be inserted
|
|
142
197
|
* @note `this` is the class of the prospective parent Element.
|
|
@@ -147,7 +202,9 @@ class Element extends Entity_1.Entity {
|
|
|
147
202
|
* @note `this` is the class of the parent Element.
|
|
148
203
|
* @beta
|
|
149
204
|
*/
|
|
150
|
-
static onChildInserted(
|
|
205
|
+
static onChildInserted(arg) {
|
|
206
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id: arg.parentId });
|
|
207
|
+
}
|
|
151
208
|
/** Called when an element with an instance of this class as its parent is about to be updated.
|
|
152
209
|
* @note throw an exception if the element should not be updated
|
|
153
210
|
* @note `this` is the class of the parent Element.
|
|
@@ -158,7 +215,9 @@ class Element extends Entity_1.Entity {
|
|
|
158
215
|
* @note `this` is the class of the parent Element.
|
|
159
216
|
* @beta
|
|
160
217
|
*/
|
|
161
|
-
static onChildUpdated(
|
|
218
|
+
static onChildUpdated(arg) {
|
|
219
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id: arg.parentId });
|
|
220
|
+
}
|
|
162
221
|
/** Called when an *existing element* is about to be updated so that an instance of this class will become its new parent.
|
|
163
222
|
* @note throw an exception if the element should not be added
|
|
164
223
|
* @note `this` is the class of the prospective parent Element.
|
|
@@ -169,7 +228,9 @@ class Element extends Entity_1.Entity {
|
|
|
169
228
|
* @note `this` is the class of the new parent Element.
|
|
170
229
|
* @beta
|
|
171
230
|
*/
|
|
172
|
-
static onChildAdded(
|
|
231
|
+
static onChildAdded(arg) {
|
|
232
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id: arg.parentId });
|
|
233
|
+
}
|
|
173
234
|
/** Called when an element with an instance of this class as its parent is about to be updated change to a different parent.
|
|
174
235
|
* @note throw an exception if the element should not be dropped
|
|
175
236
|
* @note `this` is the class of the parent Element.
|
|
@@ -180,7 +241,9 @@ class Element extends Entity_1.Entity {
|
|
|
180
241
|
* @note `this` is the class of the previous parent Element.
|
|
181
242
|
* @beta
|
|
182
243
|
*/
|
|
183
|
-
static onChildDropped(
|
|
244
|
+
static onChildDropped(arg) {
|
|
245
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id: arg.parentId });
|
|
246
|
+
}
|
|
184
247
|
/** Called when an instance of this class is being *sub-modeled* by a new Model.
|
|
185
248
|
* @note throw an exception if model should not be inserted
|
|
186
249
|
* @note `this` is the class of Element to be sub-modeled.
|
|
@@ -191,7 +254,11 @@ class Element extends Entity_1.Entity {
|
|
|
191
254
|
* @note `this` is the class of Element that is now sub-modeled.
|
|
192
255
|
* @beta
|
|
193
256
|
*/
|
|
194
|
-
static onSubModelInserted(
|
|
257
|
+
static onSubModelInserted(arg) {
|
|
258
|
+
const id = arg.subModelId;
|
|
259
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id });
|
|
260
|
+
arg.iModel.models[Symbols_1._cache].delete(id);
|
|
261
|
+
}
|
|
195
262
|
/** Called when a sub-model of an instance of this class is being deleted.
|
|
196
263
|
* @note throw an exception if model should not be deleted
|
|
197
264
|
* @note `this` is the class of Element that is sub-modeled.
|
|
@@ -202,7 +269,11 @@ class Element extends Entity_1.Entity {
|
|
|
202
269
|
* @note `this` is the class of Element that was sub-modeled.
|
|
203
270
|
* @beta
|
|
204
271
|
*/
|
|
205
|
-
static onSubModelDeleted(
|
|
272
|
+
static onSubModelDeleted(arg) {
|
|
273
|
+
const id = arg.subModelId;
|
|
274
|
+
arg.iModel.elements[Symbols_1._cache].delete({ id });
|
|
275
|
+
arg.iModel.models[Symbols_1._cache].delete(id);
|
|
276
|
+
}
|
|
206
277
|
/** Called during the iModel transformation process after an Element from the source iModel was *cloned* for the target iModel.
|
|
207
278
|
* The transformation process automatically handles remapping BisCore properties and those that are properly described in ECSchema.
|
|
208
279
|
* This callback is only meant to be overridden if there are other Ids in non-standard locations that need to be remapped or other data that needs to be fixed up after the clone.
|
|
@@ -371,6 +442,30 @@ class GeometricElement extends Element {
|
|
|
371
442
|
...super.requiredReferenceKeyTypeMap,
|
|
372
443
|
category: core_common_1.ConcreteEntityTypes.Element,
|
|
373
444
|
};
|
|
445
|
+
/**
|
|
446
|
+
* GeometricElement custom HandledProps includes 'inSpatialIndex'.
|
|
447
|
+
* @inheritdoc
|
|
448
|
+
* @beta
|
|
449
|
+
*/
|
|
450
|
+
static _customHandledProps = [
|
|
451
|
+
{ propertyName: "inSpatialIndex", source: "Class" },
|
|
452
|
+
];
|
|
453
|
+
/**
|
|
454
|
+
* GeometricElement deserializes 'inSpatialIndex'.
|
|
455
|
+
* @inheritdoc
|
|
456
|
+
* @beta
|
|
457
|
+
*/
|
|
458
|
+
static deserialize(props) {
|
|
459
|
+
return super.deserialize(props);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* GeometricElement serialize 'inSpatialIndex'.
|
|
463
|
+
* @inheritdoc
|
|
464
|
+
* @beta
|
|
465
|
+
*/
|
|
466
|
+
static serialize(props, iModel) {
|
|
467
|
+
return super.serialize(props, iModel);
|
|
468
|
+
}
|
|
374
469
|
}
|
|
375
470
|
exports.GeometricElement = GeometricElement;
|
|
376
471
|
/** An abstract base class to model real world entities that intrinsically have 3d geometry.
|
|
@@ -399,6 +494,123 @@ class GeometricElement3d extends GeometricElement {
|
|
|
399
494
|
if (undefined !== this.typeDefinition)
|
|
400
495
|
referenceIds.addElement(this.typeDefinition.id);
|
|
401
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* GeometricElement3d custom HandledProps includes 'category', 'geometryStream', 'origin', 'yaw', 'pitch', 'roll',
|
|
499
|
+
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
|
|
500
|
+
* @inheritdoc
|
|
501
|
+
* @beta
|
|
502
|
+
*/
|
|
503
|
+
static _customHandledProps = [
|
|
504
|
+
{ propertyName: "category", source: "Class" },
|
|
505
|
+
{ propertyName: "geometryStream", source: "Class" },
|
|
506
|
+
{ propertyName: "origin", source: "Class" },
|
|
507
|
+
{ propertyName: "yaw", source: "Class" },
|
|
508
|
+
{ propertyName: "pitch", source: "Class" },
|
|
509
|
+
{ propertyName: "roll", source: "Class" },
|
|
510
|
+
{ propertyName: "bBoxLow", source: "Class" },
|
|
511
|
+
{ propertyName: "bBoxHigh", source: "Class" },
|
|
512
|
+
{ propertyName: "typeDefinition", source: "Class" }
|
|
513
|
+
];
|
|
514
|
+
/**
|
|
515
|
+
* GeometricElement3d deserializes 'category', 'geometryStream', 'origin', 'yaw', 'pitch', 'roll',
|
|
516
|
+
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
|
|
517
|
+
* @inheritdoc
|
|
518
|
+
* @beta
|
|
519
|
+
*/
|
|
520
|
+
static deserialize(props) {
|
|
521
|
+
const elProps = super.deserialize(props);
|
|
522
|
+
const instance = props.row;
|
|
523
|
+
elProps.category = instance.category.id;
|
|
524
|
+
const origin = instance.origin ? [instance.origin.x, instance.origin.y, instance.origin.z] : [0, 0, 0];
|
|
525
|
+
let bbox;
|
|
526
|
+
if ("bBoxHigh" in instance && instance.bBoxHigh !== undefined && "bBoxLow" in instance && instance.bBoxLow !== undefined) {
|
|
527
|
+
bbox = {
|
|
528
|
+
low: [instance.bBoxLow.x, instance.bBoxLow.y, instance.bBoxLow.z],
|
|
529
|
+
high: [instance.bBoxHigh.x, instance.bBoxHigh.y, instance.bBoxHigh.z],
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
elProps.placement = {
|
|
533
|
+
origin,
|
|
534
|
+
angles: core_geometry_1.YawPitchRollAngles.createDegrees(instance.yaw ?? 0, instance.pitch ?? 0, instance.roll ?? 0).toJSON(),
|
|
535
|
+
bbox
|
|
536
|
+
};
|
|
537
|
+
if (instance.geometryStream) {
|
|
538
|
+
elProps.geom = props.iModel[Symbols_1._nativeDb].convertOrUpdateGeometrySource({
|
|
539
|
+
is2d: false,
|
|
540
|
+
geom: instance.geometryStream,
|
|
541
|
+
placement: elProps.placement,
|
|
542
|
+
categoryId: elProps.category
|
|
543
|
+
}, "GeometryStreamProps", props.options?.element ?? {}).geom;
|
|
544
|
+
}
|
|
545
|
+
if (instance.typeDefinition) {
|
|
546
|
+
elProps.typeDefinition = instance.typeDefinition;
|
|
547
|
+
}
|
|
548
|
+
return elProps;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* GeometricElement3d serializes 'category', 'geometryStream', 'origin', 'yaw', 'pitch', 'roll',
|
|
552
|
+
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
|
|
553
|
+
* @inheritdoc
|
|
554
|
+
* @beta
|
|
555
|
+
*/
|
|
556
|
+
static serialize(props, iModel) {
|
|
557
|
+
const inst = super.serialize(props, iModel);
|
|
558
|
+
inst.category = { id: props.category };
|
|
559
|
+
const assignPlacement = (placement) => {
|
|
560
|
+
if (Array.isArray(placement.origin)) {
|
|
561
|
+
inst.origin = { x: placement.origin[0], y: placement.origin[1], z: placement.origin[2] };
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
inst.origin = placement.origin;
|
|
565
|
+
}
|
|
566
|
+
inst.yaw = placement.angles.yaw;
|
|
567
|
+
inst.pitch = placement.angles.pitch;
|
|
568
|
+
inst.roll = placement.angles.roll;
|
|
569
|
+
if (placement.bbox) {
|
|
570
|
+
if (Array.isArray(placement.bbox.low)) {
|
|
571
|
+
inst.bBoxLow = { x: placement.bbox.low[0], y: placement.bbox.low[1], z: placement.bbox.low[2] };
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
inst.bBoxLow = placement.bbox.low;
|
|
575
|
+
}
|
|
576
|
+
if (Array.isArray(placement.bbox.high)) {
|
|
577
|
+
inst.bBoxHigh = { x: placement.bbox.high[0], y: placement.bbox.high[1], z: placement.bbox.high[2] };
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
inst.bBoxHigh = placement.bbox.high;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
if (props.placement) {
|
|
585
|
+
assignPlacement(props.placement);
|
|
586
|
+
}
|
|
587
|
+
if (props.elementGeometryBuilderParams) {
|
|
588
|
+
const source = iModel[Symbols_1._nativeDb].convertOrUpdateGeometrySource({
|
|
589
|
+
builder: props.elementGeometryBuilderParams,
|
|
590
|
+
is2d: true,
|
|
591
|
+
placement: props.placement,
|
|
592
|
+
categoryId: props.category,
|
|
593
|
+
}, "BinaryStream", {});
|
|
594
|
+
inst.geometryStream = source.geom;
|
|
595
|
+
if (source.placement) {
|
|
596
|
+
assignPlacement(source.placement);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (props.geom) {
|
|
600
|
+
const source = iModel[Symbols_1._nativeDb].convertOrUpdateGeometrySource({
|
|
601
|
+
geom: props.geom,
|
|
602
|
+
is2d: false,
|
|
603
|
+
placement: props.placement,
|
|
604
|
+
categoryId: props.category,
|
|
605
|
+
}, "BinaryStream", {});
|
|
606
|
+
inst.geometryStream = source.geom;
|
|
607
|
+
if (source.placement) {
|
|
608
|
+
assignPlacement(source.placement);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
inst.typeDefinition = props.typeDefinition;
|
|
612
|
+
return inst;
|
|
613
|
+
}
|
|
402
614
|
}
|
|
403
615
|
exports.GeometricElement3d = GeometricElement3d;
|
|
404
616
|
/** A 3d Graphical Element
|
|
@@ -429,6 +641,123 @@ class GeometricElement2d extends GeometricElement {
|
|
|
429
641
|
val.typeDefinition = this.typeDefinition;
|
|
430
642
|
return val;
|
|
431
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* GeometricElement2d custom HandledProps includes 'category', 'geometryStream', 'origin', 'rotation',
|
|
646
|
+
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
|
|
647
|
+
* @inheritdoc
|
|
648
|
+
* @beta
|
|
649
|
+
*/
|
|
650
|
+
static _customHandledProps = [
|
|
651
|
+
{ propertyName: "category", source: "Class" },
|
|
652
|
+
{ propertyName: "geometryStream", source: "Class" },
|
|
653
|
+
{ propertyName: "origin", source: "Class" },
|
|
654
|
+
{ propertyName: "rotation", source: "Class" },
|
|
655
|
+
{ propertyName: "bBoxLow", source: "Class" },
|
|
656
|
+
{ propertyName: "bBoxHigh", source: "Class" },
|
|
657
|
+
{ propertyName: "typeDefinition", source: "Class" }
|
|
658
|
+
];
|
|
659
|
+
/**
|
|
660
|
+
* GeometricElement2d deserialize 'category', 'geometryStream', 'origin', 'rotation',
|
|
661
|
+
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
|
|
662
|
+
* @inheritdoc
|
|
663
|
+
* @beta
|
|
664
|
+
*/
|
|
665
|
+
static deserialize(props) {
|
|
666
|
+
const elProps = super.deserialize(props);
|
|
667
|
+
const instance = props.row;
|
|
668
|
+
elProps.category = instance.category.id;
|
|
669
|
+
const origin = instance.origin ? [instance.origin.x, instance.origin.y] : [0, 0];
|
|
670
|
+
let bbox;
|
|
671
|
+
if ("bBoxHigh" in instance && instance.bBoxHigh !== undefined && "bBoxLow" in instance && instance.bBoxLow !== undefined) {
|
|
672
|
+
bbox = {
|
|
673
|
+
low: [instance.bBoxLow.x, instance.bBoxLow.y],
|
|
674
|
+
high: [instance.bBoxHigh.x, instance.bBoxHigh.y],
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
elProps.placement = {
|
|
678
|
+
origin,
|
|
679
|
+
angle: instance.rotation,
|
|
680
|
+
bbox,
|
|
681
|
+
};
|
|
682
|
+
if (instance.geometryStream) {
|
|
683
|
+
const source = props.iModel[Symbols_1._nativeDb].convertOrUpdateGeometrySource({
|
|
684
|
+
is2d: true,
|
|
685
|
+
geom: instance.geometryStream,
|
|
686
|
+
placement: elProps.placement,
|
|
687
|
+
categoryId: elProps.category
|
|
688
|
+
}, "GeometryStreamProps", props.options?.element ?? {});
|
|
689
|
+
elProps.geom = source.geom;
|
|
690
|
+
if (source.placement) {
|
|
691
|
+
elProps.placement = source.placement;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
if (instance.typeDefinition) {
|
|
695
|
+
elProps.typeDefinition = instance.typeDefinition;
|
|
696
|
+
}
|
|
697
|
+
return elProps;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* GeometricElement2d serializes 'category', 'geometryStream', 'origin', 'rotation',
|
|
701
|
+
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
|
|
702
|
+
* @inheritdoc
|
|
703
|
+
* @beta
|
|
704
|
+
*/
|
|
705
|
+
static serialize(props, iModel) {
|
|
706
|
+
const inst = super.serialize(props, iModel);
|
|
707
|
+
inst.category = { id: props.category };
|
|
708
|
+
const assignPlacement = (placement) => {
|
|
709
|
+
if (Array.isArray(placement.origin)) {
|
|
710
|
+
inst.origin = { x: placement.origin[0], y: placement.origin[1] };
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
inst.origin = placement.origin;
|
|
714
|
+
}
|
|
715
|
+
inst.rotation = placement.angle;
|
|
716
|
+
if (placement.bbox) {
|
|
717
|
+
if (Array.isArray(placement.bbox.low)) {
|
|
718
|
+
inst.bBoxLow = { x: placement.bbox.low[0], y: placement.bbox.low[1] };
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
inst.bBoxLow = placement.bbox.low;
|
|
722
|
+
}
|
|
723
|
+
if (Array.isArray(placement.bbox.high)) {
|
|
724
|
+
inst.bBoxHigh = { x: placement.bbox.high[0], y: placement.bbox.high[1] };
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
inst.bBoxHigh = placement.bbox.high;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
if (props.placement) {
|
|
732
|
+
assignPlacement(props.placement);
|
|
733
|
+
}
|
|
734
|
+
if (props.elementGeometryBuilderParams) {
|
|
735
|
+
const source = iModel[Symbols_1._nativeDb].convertOrUpdateGeometrySource({
|
|
736
|
+
builder: props.elementGeometryBuilderParams,
|
|
737
|
+
is2d: true,
|
|
738
|
+
placement: props.placement,
|
|
739
|
+
categoryId: props.category,
|
|
740
|
+
}, "BinaryStream", {});
|
|
741
|
+
inst.geometryStream = source.geom;
|
|
742
|
+
if (source.placement) {
|
|
743
|
+
assignPlacement(source.placement);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
if (props.geom) {
|
|
747
|
+
const source = iModel[Symbols_1._nativeDb].convertOrUpdateGeometrySource({
|
|
748
|
+
geom: props.geom,
|
|
749
|
+
is2d: true,
|
|
750
|
+
placement: props.placement,
|
|
751
|
+
categoryId: props.category,
|
|
752
|
+
}, "BinaryStream", {});
|
|
753
|
+
inst.geometryStream = source.geom;
|
|
754
|
+
if (source.placement) {
|
|
755
|
+
assignPlacement(source.placement);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
inst.typeDefinition = props.typeDefinition;
|
|
759
|
+
return inst;
|
|
760
|
+
}
|
|
432
761
|
collectReferenceIds(referenceIds) {
|
|
433
762
|
super.collectReferenceIds(referenceIds);
|
|
434
763
|
if (undefined !== this.typeDefinition)
|
|
@@ -834,6 +1163,37 @@ class DefinitionElement extends InformationContentElement {
|
|
|
834
1163
|
super(props, iModel);
|
|
835
1164
|
this.isPrivate = true === props.isPrivate;
|
|
836
1165
|
}
|
|
1166
|
+
/**
|
|
1167
|
+
* DefinitionElement custom HandledProps includes 'isPrivate'.
|
|
1168
|
+
* @inheritdoc
|
|
1169
|
+
* @beta
|
|
1170
|
+
*/
|
|
1171
|
+
static _customHandledProps = [
|
|
1172
|
+
{ propertyName: "isPrivate", source: "Class" },
|
|
1173
|
+
];
|
|
1174
|
+
/**
|
|
1175
|
+
* DefinitionElement deserializes 'isPrivate'.
|
|
1176
|
+
* @inheritdoc
|
|
1177
|
+
* @beta
|
|
1178
|
+
*/
|
|
1179
|
+
static deserialize(props) {
|
|
1180
|
+
const elProps = super.deserialize(props);
|
|
1181
|
+
if (props.row.isPrivate !== undefined)
|
|
1182
|
+
elProps.isPrivate = props.row.isPrivate;
|
|
1183
|
+
return elProps;
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* DefinitionElement serialize 'isPrivate'.
|
|
1187
|
+
* @inheritdoc
|
|
1188
|
+
* @beta
|
|
1189
|
+
*/
|
|
1190
|
+
static serialize(props, iModel) {
|
|
1191
|
+
const inst = super.serialize(props, iModel);
|
|
1192
|
+
if (undefined !== props.isPrivate) {
|
|
1193
|
+
inst.isPrivate = props.isPrivate;
|
|
1194
|
+
}
|
|
1195
|
+
return inst;
|
|
1196
|
+
}
|
|
837
1197
|
toJSON() {
|
|
838
1198
|
const val = super.toJSON();
|
|
839
1199
|
val.isPrivate = this.isPrivate;
|
|
@@ -1250,6 +1610,36 @@ class UrlLink extends LinkElement {
|
|
|
1250
1610
|
this.description = props.description;
|
|
1251
1611
|
this.url = props.url;
|
|
1252
1612
|
}
|
|
1613
|
+
/**
|
|
1614
|
+
* UrlLink custom HandledProps includes 'description', and 'url'.
|
|
1615
|
+
* @inheritdoc
|
|
1616
|
+
* @beta
|
|
1617
|
+
*/
|
|
1618
|
+
static _customHandledProps = [
|
|
1619
|
+
{ propertyName: "description", source: "Class" },
|
|
1620
|
+
{ propertyName: "url", source: "Class" },
|
|
1621
|
+
];
|
|
1622
|
+
/**
|
|
1623
|
+
* UrlLink deserializes 'description', and 'url'.
|
|
1624
|
+
* @inheritdoc
|
|
1625
|
+
* @beta
|
|
1626
|
+
*/
|
|
1627
|
+
static deserialize(props) {
|
|
1628
|
+
const elProps = super.deserialize(props);
|
|
1629
|
+
elProps.description = props.row.description ?? "";
|
|
1630
|
+
elProps.url = props.row.url;
|
|
1631
|
+
return elProps;
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* UrlLink serializes 'description', and 'url'.
|
|
1635
|
+
* @inheritdoc
|
|
1636
|
+
* @beta
|
|
1637
|
+
*/
|
|
1638
|
+
static serialize(props, iModel) {
|
|
1639
|
+
const inst = super.serialize(props, iModel);
|
|
1640
|
+
inst.description = props.description;
|
|
1641
|
+
return inst;
|
|
1642
|
+
}
|
|
1253
1643
|
toJSON() {
|
|
1254
1644
|
const val = super.toJSON();
|
|
1255
1645
|
val.description = this.description;
|
|
@@ -1316,6 +1706,73 @@ class GeometryPart extends DefinitionElement {
|
|
|
1316
1706
|
this.geom = props.geom;
|
|
1317
1707
|
this.bbox = core_geometry_1.Range3d.fromJSON(props.bbox);
|
|
1318
1708
|
}
|
|
1709
|
+
/**
|
|
1710
|
+
* GeometryPart custom HandledProps includes 'geometryStream', 'bBoxHigh', and 'bBoxLow'.
|
|
1711
|
+
* @inheritdoc
|
|
1712
|
+
* @beta
|
|
1713
|
+
*/
|
|
1714
|
+
static _customHandledProps = [
|
|
1715
|
+
{ propertyName: "geometryStream", source: "Class" },
|
|
1716
|
+
{ propertyName: "bBoxLow", source: "Class" },
|
|
1717
|
+
{ propertyName: "bBoxHigh", source: "Class" },
|
|
1718
|
+
];
|
|
1719
|
+
/**
|
|
1720
|
+
* GeometryPart deserializes 'geometryStream', 'bBoxHigh', and 'bBoxLow'.
|
|
1721
|
+
* @inheritdoc
|
|
1722
|
+
* @beta
|
|
1723
|
+
*/
|
|
1724
|
+
static deserialize(props) {
|
|
1725
|
+
const elProps = super.deserialize(props);
|
|
1726
|
+
const instance = props.row;
|
|
1727
|
+
if ("bBoxHigh" in instance && instance.bBoxHigh !== undefined && "bBoxLow" in instance && instance.bBoxLow !== undefined) {
|
|
1728
|
+
elProps.bbox = {
|
|
1729
|
+
low: [instance.bBoxLow.x, instance.bBoxLow.y, instance.bBoxLow.z],
|
|
1730
|
+
high: [instance.bBoxHigh.x, instance.bBoxHigh.y, instance.bBoxHigh.z],
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
if (instance.geometryStream) {
|
|
1734
|
+
elProps.geom = props.iModel[Symbols_1._nativeDb].convertOrUpdateGeometryPart({
|
|
1735
|
+
geom: instance.geometryStream,
|
|
1736
|
+
is2d: false,
|
|
1737
|
+
bbox: elProps.bbox,
|
|
1738
|
+
}, "GeometryStreamProps", props.options?.element ?? {}).geom;
|
|
1739
|
+
}
|
|
1740
|
+
return elProps;
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* GeometryPart serialize 'geometryStream', 'bBoxHigh', and 'bBoxLow'.
|
|
1744
|
+
* @inheritdoc
|
|
1745
|
+
* @beta
|
|
1746
|
+
*/
|
|
1747
|
+
static serialize(props, iModel) {
|
|
1748
|
+
const inst = super.serialize(props, iModel);
|
|
1749
|
+
if (undefined !== props.geom) {
|
|
1750
|
+
const source = inst.geometryStream = iModel[Symbols_1._nativeDb].convertOrUpdateGeometryPart({
|
|
1751
|
+
geom: props.geom,
|
|
1752
|
+
is2d: false,
|
|
1753
|
+
bbox: props.bbox,
|
|
1754
|
+
}, "BinaryStream", {});
|
|
1755
|
+
inst.geometryStream = source.geom;
|
|
1756
|
+
if (source.bbox) {
|
|
1757
|
+
props.bbox = source.bbox;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
if (undefined !== props.bbox) {
|
|
1761
|
+
if (Array.isArray(props.bbox.low)) {
|
|
1762
|
+
inst.bBoxLow = { x: props.bbox.low[0], y: props.bbox.low[1], z: props.bbox.low[2] };
|
|
1763
|
+
}
|
|
1764
|
+
else {
|
|
1765
|
+
inst.bBoxLow = props.bbox.low;
|
|
1766
|
+
}
|
|
1767
|
+
if (Array.isArray(props.bbox.high)) {
|
|
1768
|
+
inst.bBoxHigh = { x: props.bbox.high[0], y: props.bbox.high[1], z: props.bbox.high[2] };
|
|
1769
|
+
}
|
|
1770
|
+
else {
|
|
1771
|
+
inst.bBoxHigh = props.bbox.high;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
return inst;
|
|
1775
|
+
}
|
|
1319
1776
|
toJSON() {
|
|
1320
1777
|
const val = super.toJSON();
|
|
1321
1778
|
val.geom = this.geom;
|
|
@@ -1346,6 +1803,35 @@ class LineStyle extends DefinitionElement {
|
|
|
1346
1803
|
this.description = props.description;
|
|
1347
1804
|
this.data = props.data;
|
|
1348
1805
|
}
|
|
1806
|
+
/**
|
|
1807
|
+
* LineStyle custom HandledProps includes 'data'.
|
|
1808
|
+
* @inheritdoc
|
|
1809
|
+
* @beta
|
|
1810
|
+
*/
|
|
1811
|
+
static _customHandledProps = [
|
|
1812
|
+
{ propertyName: "data", source: "Class" },
|
|
1813
|
+
];
|
|
1814
|
+
/**
|
|
1815
|
+
* LineStyle deserializes 'data'.
|
|
1816
|
+
* @inheritdoc
|
|
1817
|
+
* @beta
|
|
1818
|
+
*/
|
|
1819
|
+
static deserialize(props) {
|
|
1820
|
+
const elProps = super.deserialize(props);
|
|
1821
|
+
const instance = props.row;
|
|
1822
|
+
elProps.data = instance.data ?? "";
|
|
1823
|
+
return elProps;
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* LineStyle serializes 'data'.
|
|
1827
|
+
* @inheritdoc
|
|
1828
|
+
* @beta
|
|
1829
|
+
*/
|
|
1830
|
+
static serialize(props, iModel) {
|
|
1831
|
+
const inst = super.serialize(props, iModel);
|
|
1832
|
+
inst.data = props.data;
|
|
1833
|
+
return inst;
|
|
1834
|
+
}
|
|
1349
1835
|
/** Create a Code for a LineStyle definition given a name that is meant to be unique within the scope of the specified model.
|
|
1350
1836
|
* @param iModel The IModel
|
|
1351
1837
|
* @param scopeModelId The Id of the DefinitionModel that contains the LineStyle and provides the scope for its name.
|
|
@@ -1384,6 +1870,21 @@ class RenderTimeline extends InformationRecordElement {
|
|
|
1384
1870
|
props.script = JSON.stringify(this.scriptProps);
|
|
1385
1871
|
return props;
|
|
1386
1872
|
}
|
|
1873
|
+
/**
|
|
1874
|
+
* RenderTimeline deserialize checks if Schedule Script Element Ids need to be omitted, and if so, removes them.
|
|
1875
|
+
* @inheritdoc
|
|
1876
|
+
* @beta
|
|
1877
|
+
*/
|
|
1878
|
+
static deserialize(props) {
|
|
1879
|
+
const elProps = super.deserialize(props);
|
|
1880
|
+
const options = props.options?.element?.renderTimeline;
|
|
1881
|
+
// Omit Schedule Script Element Ids if the option is set
|
|
1882
|
+
if (options?.omitScriptElementIds && elProps.script) {
|
|
1883
|
+
const scriptProps = RenderTimeline.parseScriptProps(elProps.script);
|
|
1884
|
+
elProps.script = JSON.stringify(core_common_1.RenderSchedule.Script.removeScheduleScriptElementIds(scriptProps));
|
|
1885
|
+
}
|
|
1886
|
+
return elProps;
|
|
1887
|
+
}
|
|
1387
1888
|
static parseScriptProps(json) {
|
|
1388
1889
|
try {
|
|
1389
1890
|
return JSON.parse(json);
|