@itwin/core-backend 5.1.0-dev.3 → 5.1.0-dev.5
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/Category.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { Id64String } from "@itwin/core-bentley";
|
|
|
5
5
|
import { CategoryProps, Code, CodeScopeProps, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps } from "@itwin/core-common";
|
|
6
6
|
import { DefinitionElement } from "./Element";
|
|
7
7
|
import { IModelDb } from "./IModelDb";
|
|
8
|
+
import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from "./Entity";
|
|
8
9
|
/** Defines the appearance for graphics in Geometric elements
|
|
9
10
|
* @public
|
|
10
11
|
*/
|
|
@@ -15,6 +16,24 @@ export declare class SubCategory extends DefinitionElement {
|
|
|
15
16
|
/** Optional description of this SubCategory. */
|
|
16
17
|
description?: string;
|
|
17
18
|
protected constructor(props: SubCategoryProps, iModel: IModelDb);
|
|
19
|
+
/**
|
|
20
|
+
* SubCategory custom HandledProps include 'description' and 'properties'.
|
|
21
|
+
* @inheritdoc
|
|
22
|
+
* @beta
|
|
23
|
+
*/
|
|
24
|
+
protected static readonly _customHandledProps: CustomHandledProperty[];
|
|
25
|
+
/**
|
|
26
|
+
* SubCategory deserializes 'description' and 'properties'.
|
|
27
|
+
* @inheritdoc
|
|
28
|
+
* @beta
|
|
29
|
+
*/
|
|
30
|
+
static deserialize(props: DeserializeEntityArgs): SubCategoryProps;
|
|
31
|
+
/**
|
|
32
|
+
* SubCategory serialize 'description' and 'properties'.
|
|
33
|
+
* @inheritdoc
|
|
34
|
+
* @beta
|
|
35
|
+
*/
|
|
36
|
+
static serialize(props: SubCategoryProps, iModel: IModelDb): ECSqlRow;
|
|
18
37
|
toJSON(): SubCategoryProps;
|
|
19
38
|
/** Get the SubCategory's name (its Code value). */
|
|
20
39
|
getSubCategoryName(): string;
|
|
@@ -57,6 +76,24 @@ export declare class Category extends DefinitionElement {
|
|
|
57
76
|
rank: Rank;
|
|
58
77
|
description?: string;
|
|
59
78
|
protected constructor(props: CategoryProps, iModel: IModelDb);
|
|
79
|
+
/**
|
|
80
|
+
* Category custom HandledProps include 'rank' and 'description'.
|
|
81
|
+
* @inheritdoc
|
|
82
|
+
* @beta
|
|
83
|
+
*/
|
|
84
|
+
protected static readonly _customHandledProps: CustomHandledProperty[];
|
|
85
|
+
/**
|
|
86
|
+
* Category deserializes 'rank' and 'description'.
|
|
87
|
+
* @inheritdoc
|
|
88
|
+
* @beta
|
|
89
|
+
*/
|
|
90
|
+
static deserialize(props: DeserializeEntityArgs): CategoryProps;
|
|
91
|
+
/**
|
|
92
|
+
* Category serialize 'rank' and 'description'.
|
|
93
|
+
* @inheritdoc
|
|
94
|
+
* @beta
|
|
95
|
+
*/
|
|
96
|
+
static serialize(props: CategoryProps, iModel: IModelDb): ECSqlRow;
|
|
60
97
|
toJSON(): CategoryProps;
|
|
61
98
|
/** Get the Id of the default SubCategory for this Category. */
|
|
62
99
|
myDefaultSubCategoryId(): Id64String;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACQ,aAAa,EAAE,IAAI,EAAE,cAAc,EAAY,YAAY,EAAE,IAAI,EAAE,qBAAqB,EAAE,gBAAgB,EACxH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACQ,aAAa,EAAE,IAAI,EAAE,cAAc,EAAY,YAAY,EAAE,IAAI,EAAE,qBAAqB,EAAE,gBAAgB,EACxH,MAAM,oBAAoB,CAAC;A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IAAI,EAAE,MAAM,GAAG,eAAe;IAUtG;;;;;;;OAOG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,qBAAqB,CAAC,KAAK,GAAG,qBAAqB,GAAG,UAAU;CAO1K;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,WAA2B,SAAS,IAAI,MAAM,CAA8B;IAC5E,SAAS,aAAa,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ;IAE1D,4EAA4E;WAC9D,eAAe,IAAI,MAAM;IAEvC,qEAAqE;WACvD,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAK7H;;;;;OAKG;WACW,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAKjG;;;;;;OAMG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe;IAUtG;;;;;;;OAOG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,qBAAqB,CAAC,KAAK,GAAG,qBAAqB,GAAG,UAAU;CAM1K"}
|
package/lib/cjs/Category.js
CHANGED
|
@@ -27,6 +27,46 @@ class SubCategory extends Element_1.DefinitionElement {
|
|
|
27
27
|
this.appearance = new core_common_1.SubCategoryAppearance(props.appearance);
|
|
28
28
|
this.description = core_bentley_1.JsonUtils.asString(props.description);
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* SubCategory custom HandledProps include 'description' and 'properties'.
|
|
32
|
+
* @inheritdoc
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
static _customHandledProps = [
|
|
36
|
+
{ propertyName: "description", source: "Class" },
|
|
37
|
+
{ propertyName: "properties", source: "Class" },
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* SubCategory deserializes 'description' and 'properties'.
|
|
41
|
+
* @inheritdoc
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
static deserialize(props) {
|
|
45
|
+
const elProps = super.deserialize(props);
|
|
46
|
+
elProps.description = core_bentley_1.JsonUtils.asString(props.row.description);
|
|
47
|
+
if (props.row.properties !== '') {
|
|
48
|
+
elProps.appearance = JSON.parse(props.row.properties);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
elProps.appearance = undefined;
|
|
52
|
+
}
|
|
53
|
+
return elProps;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* SubCategory serialize 'description' and 'properties'.
|
|
57
|
+
* @inheritdoc
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
static serialize(props, iModel) {
|
|
61
|
+
const inst = super.serialize(props, iModel);
|
|
62
|
+
if (props.description !== undefined) {
|
|
63
|
+
inst.description = props.description;
|
|
64
|
+
}
|
|
65
|
+
if (props.appearance !== undefined) {
|
|
66
|
+
inst.properties = JSON.stringify(props.appearance);
|
|
67
|
+
}
|
|
68
|
+
return inst;
|
|
69
|
+
}
|
|
30
70
|
toJSON() {
|
|
31
71
|
const val = super.toJSON();
|
|
32
72
|
val.appearance = this.appearance.toJSON();
|
|
@@ -98,6 +138,39 @@ class Category extends Element_1.DefinitionElement {
|
|
|
98
138
|
this.rank = core_bentley_1.JsonUtils.asInt(props.rank);
|
|
99
139
|
this.description = core_bentley_1.JsonUtils.asString(props.description);
|
|
100
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Category custom HandledProps include 'rank' and 'description'.
|
|
143
|
+
* @inheritdoc
|
|
144
|
+
* @beta
|
|
145
|
+
*/
|
|
146
|
+
static _customHandledProps = [
|
|
147
|
+
{ propertyName: "rank", source: "Class" },
|
|
148
|
+
{ propertyName: "description", source: "Class" },
|
|
149
|
+
];
|
|
150
|
+
/**
|
|
151
|
+
* Category deserializes 'rank' and 'description'.
|
|
152
|
+
* @inheritdoc
|
|
153
|
+
* @beta
|
|
154
|
+
*/
|
|
155
|
+
static deserialize(props) {
|
|
156
|
+
const elProps = super.deserialize(props);
|
|
157
|
+
elProps.description = core_bentley_1.JsonUtils.asString(props.row.description);
|
|
158
|
+
elProps.rank = core_bentley_1.JsonUtils.asInt(props.row.rank);
|
|
159
|
+
return elProps;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Category serialize 'rank' and 'description'.
|
|
163
|
+
* @inheritdoc
|
|
164
|
+
* @beta
|
|
165
|
+
*/
|
|
166
|
+
static serialize(props, iModel) {
|
|
167
|
+
const inst = super.serialize(props, iModel);
|
|
168
|
+
if (undefined !== props.description) {
|
|
169
|
+
inst.description = props.description;
|
|
170
|
+
}
|
|
171
|
+
inst.rank = props.rank;
|
|
172
|
+
return inst;
|
|
173
|
+
}
|
|
101
174
|
toJSON() {
|
|
102
175
|
const val = super.toJSON();
|
|
103
176
|
val.rank = this.rank;
|
package/lib/cjs/Category.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,uCAA8C;AAC9C,yCAAsC;AACtC,qEAAqE;AAErE;;GAEG;AACH,MAAa,WAAY,SAAQ,2BAAiB;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IACxE,qDAAqD;IAC9C,UAAU,CAAwB;IACzC,gDAAgD;IACzC,WAAW,CAAU;IAE5B,YAAsB,KAAuB,EAAE,MAAgB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC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AAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,SAAS,EAAE,KAAK;SACjB,CAAC;QACF,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,iBAAsE;QAC1J,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAChE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF;AAvDD,0CAuDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\n\n/** Defines the appearance for graphics in Geometric elements\n * @public\n */\nexport class SubCategory extends DefinitionElement {\n public static override get className(): string { return \"SubCategory\"; }\n /** The Appearance parameters for this SubCategory */\n public appearance: SubCategoryAppearance;\n /** Optional description of this SubCategory. */\n public description?: string;\n\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.appearance = new SubCategoryAppearance(props.appearance);\n this.description = JsonUtils.asString(props.description);\n }\n\n public override toJSON(): SubCategoryProps {\n const val = super.toJSON() as SubCategoryProps;\n val.appearance = this.appearance.toJSON();\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the SubCategory's name (its Code value). */\n public getSubCategoryName(): string { return this.code.value; }\n /** Get the Id of the SubCategory. */\n public getSubCategoryId(): Id64String { return this.id; }\n /** Get the Id of this SubCategory's parent Category. */\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\n /** Check if this is the default SubCategory of its parent Category. */\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\n\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\n * @param iModel The IModel\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\n * @param codeValue The name of the SubCategory\n */\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\n }\n\n /** Create a new SubCategory\n * @param iModelDb The iModel\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The newly constructed SubCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\n if (appearance instanceof SubCategoryAppearance)\n appearance = appearance.toJSON();\n\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\n const subCategoryProps: SubCategoryProps = {\n classFullName: this.classFullName,\n model: parentCategory.model,\n parent: new CategoryOwnsSubCategories(parentCategoryId),\n code: this.createCode(iModelDb, parentCategoryId, name),\n appearance,\n };\n return new SubCategory(subCategoryProps, iModelDb);\n }\n\n /** Insert a new SubCategory\n * @param iModelDb Insert into this iModel\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The Id of the newly inserted SubCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const subCategory = this.create(iModelDb, parentCategoryId, name, appearance);\n return iModelDb.elements.insertElement(subCategory.toJSON());\n }\n}\n\n/** A Category element is the target of the `category` member of [[GeometricElement]].\n * @public\n */\nexport class Category extends DefinitionElement {\n public static override get className(): string { return \"Category\"; }\n public rank: Rank = Rank.User;\n public description?: string;\n\n protected constructor(props: CategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.rank = JsonUtils.asInt(props.rank);\n this.description = JsonUtils.asString(props.description);\n }\n\n public override toJSON(): CategoryProps {\n const val = super.toJSON() as CategoryProps;\n val.rank = this.rank;\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the Id of the default SubCategory for this Category. */\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\n\n /** Set the appearance of the default SubCategory for this Category */\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void {\n if (props instanceof SubCategoryAppearance)\n props = props.toJSON();\n\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\n subCat.appearance = new SubCategoryAppearance(props);\n this.iModel.elements.updateElement(subCat.toJSON());\n }\n}\n\n/** Categorizes 2d GeometricElements.\n * @public\n */\nexport class DrawingCategory extends Category {\n public static override get className(): string { return \"DrawingCategory\"; }\n\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\n\n /** Looks up the CategoryId of a DrawingCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A drawing category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new DrawingCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @returns The newly constructed DrawingCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new DrawingCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new DrawingCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\n * @returns The Id of the newly inserted DrawingCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n const elements = iModelDb.elements;\n category.id = elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\n * @public\n */\nexport class SpatialCategory extends Category {\n public static override get className(): string { return \"SpatialCategory\"; }\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\n\n /** Looks up the CategoryId of a SpatialCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A spatial category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new SpatialCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the SpatialCategory\n * @returns The newly constructed SpatialCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new SpatialCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new SpatialCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\n * @param name The name of the SpatialCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\n * @returns The Id of the newly inserted SpatialCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n category.id = iModelDb.elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Category.js","sourceRoot":"","sources":["../../src/Category.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAClE,oDAE4B;AAC5B,uCAA8C;AAC9C,yCAAsC;AACtC,qEAAqE;AAGrE;;GAEG;AACH,MAAa,WAAY,SAAQ,2BAAiB;IACzC,MAAM,KAAc,SAAS,KAAa,OAAO,aAAa,CAAC,CAAC,CAAC;IACxE,qDAAqD;IAC9C,UAAU,CAAwB;IACzC,gDAAgD;IACzC,WAAW,CAAU;IAE5B,YAAsB,KAAuB,EAAE,MAAgB;QAC7D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,mCAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,CAAC,WAAW,GAAG,wBAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAmB,mBAAmB,GAA4B;QAChF,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;QAChD,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE;KAChD,CAAC;IAEF;;;;OAIG;IACI,MAAM,CAAU,WAAW,CAAC,KAA4B;QAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAqB,CAAC;QAC7D,OAAO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,CAAC,CAAC;QACzF,OAAO,IAAI,kBAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY;QAClF,MAAM,aAAa,GAAkB;YACnC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,SAAS,EAAE,KAAK;SACjB,CAAC;QACF,OAAO,IAAI,eAAe,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,iBAAsE;QAC1J,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;QAChE,QAAQ,CAAC,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;CACF;AAvDD,0CAuDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, CategoryProps, Code, CodeScopeProps, CodeSpec, ElementProps, Rank, SubCategoryAppearance, SubCategoryProps,\n} from \"@itwin/core-common\";\nimport { DefinitionElement } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { CategoryOwnsSubCategories } from \"./NavigationRelationship\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\n\n/** Defines the appearance for graphics in Geometric elements\n * @public\n */\nexport class SubCategory extends DefinitionElement {\n public static override get className(): string { return \"SubCategory\"; }\n /** The Appearance parameters for this SubCategory */\n public appearance: SubCategoryAppearance;\n /** Optional description of this SubCategory. */\n public description?: string;\n\n protected constructor(props: SubCategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.appearance = new SubCategoryAppearance(props.appearance);\n this.description = JsonUtils.asString(props.description);\n }\n\n /**\n * SubCategory custom HandledProps include 'description' and 'properties'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"description\", source: \"Class\" },\n { propertyName: \"properties\", source: \"Class\" },\n ];\n\n /**\n * SubCategory deserializes 'description' and 'properties'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): SubCategoryProps {\n const elProps = super.deserialize(props) as SubCategoryProps;\n elProps.description = JsonUtils.asString(props.row.description);\n if (props.row.properties !== '') {\n elProps.appearance = JSON.parse(props.row.properties) as SubCategoryAppearance.Props;\n } else {\n elProps.appearance = undefined;\n }\n return elProps;\n }\n\n /**\n * SubCategory serialize 'description' and 'properties'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: SubCategoryProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (props.description !== undefined) {\n inst.description = props.description;\n }\n if (props.appearance !== undefined) {\n inst.properties = JSON.stringify(props.appearance);\n }\n return inst;\n }\n\n public override toJSON(): SubCategoryProps {\n const val = super.toJSON() as SubCategoryProps;\n val.appearance = this.appearance.toJSON();\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the SubCategory's name (its Code value). */\n public getSubCategoryName(): string { return this.code.value; }\n /** Get the Id of the SubCategory. */\n public getSubCategoryId(): Id64String { return this.id; }\n /** Get the Id of this SubCategory's parent Category. */\n public getCategoryId(): Id64String { return this.parent ? this.parent.id : Id64.invalid; }\n /** Check if this is the default SubCategory of its parent Category. */\n public get isDefaultSubCategory(): boolean { return IModelDb.getDefaultSubCategoryId(this.getCategoryId()) === this.getSubCategoryId(); }\n\n /** Create a Code for a SubCategory given a name that is meant to be unique within the scope of the specified parent Category.\n * @param iModel The IModel\n * @param parentCategoryId The Id of the parent Category that owns the SubCategory and provides the scope for its name.\n * @param codeValue The name of the SubCategory\n */\n public static createCode(iModel: IModelDb, parentCategoryId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.subCategory);\n return new Code({ spec: codeSpec.id, scope: parentCategoryId, value: codeValue });\n }\n\n /** Create a new SubCategory\n * @param iModelDb The iModel\n * @param parentCategoryId Create the new SubCategory as a child of this [[Category]]\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The newly constructed SubCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): SubCategory {\n if (appearance instanceof SubCategoryAppearance)\n appearance = appearance.toJSON();\n\n const parentCategory = iModelDb.elements.getElement<Category>(parentCategoryId);\n const subCategoryProps: SubCategoryProps = {\n classFullName: this.classFullName,\n model: parentCategory.model,\n parent: new CategoryOwnsSubCategories(parentCategoryId),\n code: this.createCode(iModelDb, parentCategoryId, name),\n appearance,\n };\n return new SubCategory(subCategoryProps, iModelDb);\n }\n\n /** Insert a new SubCategory\n * @param iModelDb Insert into this iModel\n * @param parentCategoryId Insert the new SubCategory as a child of this Category\n * @param name The name of the SubCategory\n * @param appearance The appearance settings to use for this SubCategory\n * @returns The Id of the newly inserted SubCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const subCategory = this.create(iModelDb, parentCategoryId, name, appearance);\n return iModelDb.elements.insertElement(subCategory.toJSON());\n }\n}\n\n/** A Category element is the target of the `category` member of [[GeometricElement]].\n * @public\n */\nexport class Category extends DefinitionElement {\n public static override get className(): string { return \"Category\"; }\n public rank: Rank = Rank.User;\n public description?: string;\n\n protected constructor(props: CategoryProps, iModel: IModelDb) {\n super(props, iModel);\n this.rank = JsonUtils.asInt(props.rank);\n this.description = JsonUtils.asString(props.description);\n }\n\n /**\n * Category custom HandledProps include 'rank' and 'description'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"rank\", source: \"Class\" },\n { propertyName: \"description\", source: \"Class\" },\n ];\n\n /**\n * Category deserializes 'rank' and 'description'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): CategoryProps {\n const elProps = super.deserialize(props) as CategoryProps;\n elProps.description = JsonUtils.asString(props.row.description);\n elProps.rank = JsonUtils.asInt(props.row.rank);\n return elProps;\n }\n\n /**\n * Category serialize 'rank' and 'description'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: CategoryProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (undefined !== props.description) {\n inst.description = props.description;\n }\n inst.rank = props.rank;\n return inst;\n }\n public override toJSON(): CategoryProps {\n const val = super.toJSON() as CategoryProps;\n val.rank = this.rank;\n if (this.description && this.description.length > 0)\n val.description = this.description;\n return val;\n }\n\n /** Get the Id of the default SubCategory for this Category. */\n public myDefaultSubCategoryId(): Id64String { return IModelDb.getDefaultSubCategoryId(this.id); }\n\n /** Set the appearance of the default SubCategory for this Category */\n public setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void {\n if (props instanceof SubCategoryAppearance)\n props = props.toJSON();\n\n const subCat = this.iModel.elements.getElement<SubCategory>(this.myDefaultSubCategoryId());\n subCat.appearance = new SubCategoryAppearance(props);\n this.iModel.elements.updateElement(subCat.toJSON());\n }\n}\n\n/** Categorizes 2d GeometricElements.\n * @public\n */\nexport class DrawingCategory extends Category {\n public static override get className(): string { return \"DrawingCategory\"; }\n\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by DrawingCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.drawingCategory; }\n\n /** Looks up the CategoryId of a DrawingCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = DrawingCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a DrawingCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the DrawingCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A drawing category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(DrawingCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new DrawingCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @returns The newly constructed DrawingCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DrawingCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new DrawingCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new DrawingCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DrawingCategory into this [[DefinitionModel]]\n * @param name The name of the DrawingCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this DrawingCategory\n * @returns The Id of the newly inserted DrawingCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n const elements = iModelDb.elements;\n category.id = elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n\n/** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).\n * @public\n */\nexport class SpatialCategory extends Category {\n public static override get className(): string { return \"SpatialCategory\"; }\n protected constructor(opts: ElementProps, iModel: IModelDb) { super(opts, iModel); }\n\n /** Get the name of the CodeSpec that is used by SpatialCategory objects. */\n public static getCodeSpecName(): string { return BisCodeSpec.spatialCategory; }\n\n /** Looks up the CategoryId of a SpatialCategory by model and name */\n public static queryCategoryIdByName(iModel: IModelDb, scopeModelId: Id64String, categoryName: string): Id64String | undefined {\n const code: Code = SpatialCategory.createCode(iModel, scopeModelId, categoryName);\n return iModel.elements.queryElementIdByCode(code);\n }\n\n /** Create a Code for a SpatialCategory given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModel\n * @param scopeModelId The Id of the DefinitionModel that contains the SpatialCategory and provides the scope for its name.\n * @param codeValue The name of the category\n * @return A spatial category Code\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(SpatialCategory.getCodeSpecName());\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n /** Create a new SpatialCategory\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the SpatialCategory\n * @returns The newly constructed SpatialCategory element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): SpatialCategory {\n const categoryProps: CategoryProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name),\n isPrivate: false,\n };\n return new SpatialCategory(categoryProps, iModelDb);\n }\n\n /** Insert a new SpatialCategory\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new SpatialCategory into this DefinitionModel\n * @param name The name of the SpatialCategory\n * @param defaultAppearance The appearance settings to use for the default SubCategory of this SpatialCategory\n * @returns The Id of the newly inserted SpatialCategory element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String {\n const category = this.create(iModelDb, definitionModelId, name);\n category.id = iModelDb.elements.insertElement(category.toJSON());\n category.setDefaultAppearance(defaultAppearance);\n return category.id;\n }\n}\n"]}
|
|
@@ -6,6 +6,7 @@ import { Code, CodeScopeProps, ColorDef, DisplayStyle3dProps, DisplayStyle3dSett
|
|
|
6
6
|
import { DefinitionElement } from "./Element";
|
|
7
7
|
import { IModelDb } from "./IModelDb";
|
|
8
8
|
import { IModelElementCloneContext } from "./IModelElementCloneContext";
|
|
9
|
+
import { DeserializeEntityArgs, ECSqlRow } from "./Entity";
|
|
9
10
|
/** A DisplayStyle defines the parameters for 'styling' the contents of a view.
|
|
10
11
|
* Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.
|
|
11
12
|
* Many ViewDefinitions may share the same DisplayStyle.
|
|
@@ -15,6 +16,10 @@ export declare abstract class DisplayStyle extends DefinitionElement {
|
|
|
15
16
|
static get className(): string;
|
|
16
17
|
abstract get settings(): DisplayStyleSettings;
|
|
17
18
|
protected constructor(props: DisplayStyleProps, iModel: IModelDb);
|
|
19
|
+
/** @beta */
|
|
20
|
+
static deserialize(props: DeserializeEntityArgs): DisplayStyleProps;
|
|
21
|
+
/** @beta */
|
|
22
|
+
static serialize(props: DisplayStyleProps, iModel: IModelDb): ECSqlRow;
|
|
18
23
|
/** Create a Code for a DisplayStyle given a name that is meant to be unique within the scope of the specified DefinitionModel.
|
|
19
24
|
* @param iModel The IModelDb
|
|
20
25
|
* @param scopeModelId The Id of the DefinitionModel that contains the DisplayStyle and provides the scope for its name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayStyle.d.ts","sourceRoot":"","sources":["../../src/DisplayStyle.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAsC,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EACQ,IAAI,EAAE,cAAc,EAAY,QAAQ,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,2BAA2B,EAC/H,iBAAiB,EAAE,oBAAoB,EAAgC,kBAAkB,EAA+B,cAAc,EAAoB,SAAS,EACpK,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"DisplayStyle.d.ts","sourceRoot":"","sources":["../../src/DisplayStyle.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAsC,UAAU,EAAuB,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EACQ,IAAI,EAAE,cAAc,EAAY,QAAQ,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,2BAA2B,EAC/H,iBAAiB,EAAE,oBAAoB,EAAgC,kBAAkB,EAA+B,cAAc,EAAoB,SAAS,EACpK,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,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;;;;GAOG;AACH,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,2BAA2B,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;IAC1H;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,eAAe,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CACrC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,WAA2B,SAAS,IAAI,MAAM,CAA6B;IAC3E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IAEnD,IAAW,QAAQ,IAAI,sBAAsB,CAA2B;IAExE,SAAS,aAAa,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ;cAK/C,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAkB9E,aAAa;qBACa,QAAQ,CAAC,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,mBAAmB,GAAG,IAAI;IAgD9J;;;;;;OAMG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG,cAAc;IAyB5I;;;;;;;OAOG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG,UAAU;CAIzI"}
|
package/lib/cjs/DisplayStyle.js
CHANGED
|
@@ -21,6 +21,33 @@ class DisplayStyle extends Element_1.DefinitionElement {
|
|
|
21
21
|
constructor(props, iModel) {
|
|
22
22
|
super(props, iModel);
|
|
23
23
|
}
|
|
24
|
+
/** @beta */
|
|
25
|
+
static deserialize(props) {
|
|
26
|
+
const elProps = super.deserialize(props);
|
|
27
|
+
const displayOptions = props.options?.element?.displayStyle;
|
|
28
|
+
// Uncompress excludedElements if they are compressed
|
|
29
|
+
if (!displayOptions?.compressExcludedElementIds && elProps.jsonProperties?.styles?.excludedElements) {
|
|
30
|
+
const excludedElements = elProps.jsonProperties.styles.excludedElements;
|
|
31
|
+
if (typeof excludedElements === "string" && excludedElements.startsWith("+")) {
|
|
32
|
+
const ids = [];
|
|
33
|
+
core_bentley_1.CompressedId64Set.decompressSet(excludedElements).forEach((id) => {
|
|
34
|
+
ids.push(id);
|
|
35
|
+
});
|
|
36
|
+
elProps.jsonProperties.styles.excludedElements = ids;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Omit Schedule Script Element Ids if the option is set
|
|
40
|
+
if (displayOptions?.omitScheduleScriptElementIds && elProps.jsonProperties?.styles?.scheduleScript) {
|
|
41
|
+
const scheduleScript = elProps.jsonProperties.styles.scheduleScript;
|
|
42
|
+
elProps.jsonProperties.styles.scheduleScript = core_common_1.RenderSchedule.Script.removeScheduleScriptElementIds(scheduleScript);
|
|
43
|
+
}
|
|
44
|
+
return elProps;
|
|
45
|
+
}
|
|
46
|
+
/** @beta */
|
|
47
|
+
static serialize(props, iModel) {
|
|
48
|
+
const inst = super.serialize(props, iModel);
|
|
49
|
+
return inst;
|
|
50
|
+
}
|
|
24
51
|
/** Create a Code for a DisplayStyle given a name that is meant to be unique within the scope of the specified DefinitionModel.
|
|
25
52
|
* @param iModel The IModelDb
|
|
26
53
|
* @param scopeModelId The Id of the DefinitionModel that contains the DisplayStyle and provides the scope for its name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayStyle.js","sourceRoot":"","sources":["../../src/DisplayStyle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0G;AAC1G,oDAG4B;AAC5B,uCAA8D;AAI9D;;;;GAIG;AACH,MAAsB,YAAa,SAAQ,2BAAiB;IACnD,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IAGzE,YAAsB,KAAwB,EAAE,MAAgB;Q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OAAqC;QACzH,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7E,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,CAAC;CACF;AA1HD,wCA0HC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ViewDefinitions\n */\n\nimport { CompressedId64Set, Id64, Id64Array, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, ColorDef, DisplayStyle3dProps, DisplayStyle3dSettings, DisplayStyle3dSettingsProps,\n DisplayStyleProps, DisplayStyleSettings, DisplayStyleSubCategoryProps, EntityReferenceSet, PlanProjectionSettingsProps, RenderSchedule, SkyBoxImageProps, ViewFlags,\n} from \"@itwin/core-common\";\nimport { DefinitionElement, RenderTimeline } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\n\n/** A DisplayStyle defines the parameters for 'styling' the contents of a view.\n * Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.\n * Many ViewDefinitions may share the same DisplayStyle.\n * @public\n */\nexport abstract class DisplayStyle extends DefinitionElement {\n public static override get className(): string { return \"DisplayStyle\"; }\n public abstract get settings(): DisplayStyleSettings;\n\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\n super(props, iModel);\n }\n\n /** Create a Code for a DisplayStyle given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the DisplayStyle and provides the scope for its name.\n * @param codeValue The DisplayStyle name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.displayStyle);\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n for (const [id] of this.settings.subCategoryOverrides) {\n referenceIds.addElement(id);\n }\n\n for (const excludedElementId of this.settings.excludedElementIds)\n referenceIds.addElement(excludedElementId);\n\n if (this.settings.renderTimeline) {\n referenceIds.addElement(this.settings.renderTimeline);\n } else {\n const script = this.loadScheduleScript();\n if (script)\n script.script.discloseIds(referenceIds);\n }\n }\n\n /** @alpha */\n protected static override onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyleProps, targetElementProps: DisplayStyleProps): void {\n super.onCloned(context, sourceElementProps, targetElementProps);\n\n if (!context.isBetweenIModels || !targetElementProps.jsonProperties?.styles)\n return;\n\n const settings = targetElementProps.jsonProperties.styles;\n if (settings.subCategoryOvr) {\n const targetOverrides: DisplayStyleSubCategoryProps[] = [];\n for (const ovr of settings.subCategoryOvr) {\n ovr.subCategory;\n const targetSubCategoryId = context.findTargetElementId(Id64.fromJSON(ovr.subCategory));\n if (Id64.isValid(targetSubCategoryId))\n targetOverrides.push({...ovr, subCategory: targetSubCategoryId});\n }\n settings.subCategoryOvr = targetOverrides;\n }\n\n if (settings.excludedElements) {\n const excluded: Id64Array = \"string\" === typeof settings.excludedElements ? CompressedId64Set.decompressArray(settings.excludedElements) : settings.excludedElements;\n const excludedTargetElements: Id64Array = [];\n for (const excludedElement of excluded) {\n const remapped = context.findTargetElementId(excludedElement);\n if (Id64.isValid(remapped))\n excludedTargetElements.push(remapped);\n }\n\n if (0 === excludedTargetElements.length)\n delete settings.excludedElements;\n else\n settings.excludedElements = CompressedId64Set.compressIds(OrderedId64Iterable.sortArray(excludedTargetElements));\n }\n\n if (settings.renderTimeline) {\n const renderTimeline = context.findTargetElementId(settings.renderTimeline);\n if (Id64.isValid(renderTimeline))\n settings.renderTimeline = renderTimeline;\n else\n delete settings.renderTimeline;\n } else if (settings.scheduleScript) {\n const scheduleScript = RenderTimeline.remapScript(context, settings.scheduleScript);\n if (scheduleScript.length > 0)\n settings.scheduleScript = scheduleScript;\n else\n delete settings.scheduleScript;\n }\n }\n\n public loadScheduleScript(): RenderSchedule.ScriptReference | undefined {\n let script;\n let sourceId;\n if (this.settings.renderTimeline) {\n const timeline = this.iModel.elements.tryGetElement<RenderTimeline>(this.settings.renderTimeline);\n if (timeline) {\n script = RenderSchedule.Script.fromJSON(timeline.scriptProps);\n sourceId = timeline.id;\n }\n } else if (this.settings.scheduleScriptProps) {\n script = RenderSchedule.Script.fromJSON(this.settings.scheduleScriptProps);\n sourceId = this.id;\n }\n\n return undefined !== sourceId && undefined !== script ? new RenderSchedule.ScriptReference(sourceId, script) : undefined;\n }\n}\n\n/** A DisplayStyle for 2d views.\n * @public\n */\nexport class DisplayStyle2d extends DisplayStyle {\n public static override get className(): string { return \"DisplayStyle2d\"; }\n private readonly _settings: DisplayStyleSettings;\n\n public get settings(): DisplayStyleSettings { return this._settings; }\n\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\n super(props, iModel);\n this._settings = new DisplayStyleSettings(this.jsonProperties);\n }\n /** Create a DisplayStyle2d for use by a ViewDefinition.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the DisplayStyle2d\n * @returns The newly constructed DisplayStyle2d element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DisplayStyle2d {\n const displayStyleProps: DisplayStyleProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, name),\n model: definitionModelId,\n isPrivate: false,\n jsonProperties: {\n styles: {\n backgroundColor: 0,\n monochromeColor: ColorDef.white.toJSON(),\n viewflags: ViewFlags.defaults,\n },\n },\n };\n return new DisplayStyle2d(displayStyleProps, iModelDb);\n }\n /** Insert a DisplayStyle2d for use by a ViewDefinition.\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DisplayStyle2d into this DefinitionModel\n * @param name The name of the DisplayStyle2d\n * @returns The Id of the newly inserted DisplayStyle2d element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string): Id64String {\n const displayStyle = this.create(iModelDb, definitionModelId, name);\n return iModelDb.elements.insertElement(displayStyle.toJSON());\n }\n}\n\n/** Describes initial settings for a new [[DisplayStyle3d]].\n * Most properties are inherited from [DisplayStyle3dSettingsProps]($common), but for backwards compatibility reasons, this interface is slightly awkward:\n * - It adds a `viewFlags` member that differs only in case and type from [DisplayStyleSettingsProps.viewflags]($common); and\n * - It extends the type of [DisplayStyleSettingsProps.backgroundColor]($common) to include [ColorDef]($common).\n * These idiosyncrasies will be addressed in a future version of core-backend.\n * @see [[DisplayStyle3d.create]].\n * @public\n */\nexport interface DisplayStyleCreationOptions extends Omit<DisplayStyle3dSettingsProps, \"backgroundColor\" | \"scheduleScript\"> {\n /** If supplied, the [ViewFlags]($common) applied by the display style.\n * If undefined, [DisplayStyle3dSettingsProps.viewflags]($common) will be used if present (note the difference in case); otherwise, default-constructed [ViewFlags]($common) will be used.\n */\n viewFlags?: ViewFlags;\n backgroundColor?: ColorDef | number;\n}\n\n/** A DisplayStyle for 3d views.\n * See [how to create a DisplayStyle3d]$(docs/learning/backend/CreateElements.md#DisplayStyle3d).\n * @public\n */\nexport class DisplayStyle3d extends DisplayStyle {\n public static override get className(): string { return \"DisplayStyle3d\"; }\n private readonly _settings: DisplayStyle3dSettings;\n\n public get settings(): DisplayStyle3dSettings { return this._settings; }\n\n protected constructor(props: DisplayStyle3dProps, iModel: IModelDb) {\n super(props, iModel);\n this._settings = new DisplayStyle3dSettings(this.jsonProperties);\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n for (const textureId of this.settings.environment.sky.textureIds)\n referenceIds.addElement(textureId);\n\n if (this.settings.planProjectionSettings)\n for (const planProjectionSetting of this.settings.planProjectionSettings)\n referenceIds.addElement(planProjectionSetting[0]);\n\n const groups = this.settings.contours.groups;\n for (const group of groups) {\n const subCategories = group.subCategories;\n for (const subCategoryId of subCategories) {\n referenceIds.addElement(subCategoryId);\n }\n }\n }\n\n /** @alpha */\n protected static override onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyle3dProps, targetElementProps: DisplayStyle3dProps): void {\n super.onCloned(context, sourceElementProps, targetElementProps);\n if (context.isBetweenIModels) {\n const convertTexture = (id: string) => Id64.isValidId64(id) ? context.findTargetElementId(id) : id;\n\n const skyBoxImageProps: SkyBoxImageProps | undefined = targetElementProps?.jsonProperties?.styles?.environment?.sky?.image;\n if (skyBoxImageProps?.texture && Id64.isValidId64(skyBoxImageProps.texture))\n skyBoxImageProps.texture = convertTexture(skyBoxImageProps.texture);\n\n if (skyBoxImageProps?.textures) {\n skyBoxImageProps.textures.front = convertTexture(skyBoxImageProps.textures.front);\n skyBoxImageProps.textures.back = convertTexture(skyBoxImageProps.textures.back);\n skyBoxImageProps.textures.left = convertTexture(skyBoxImageProps.textures.left);\n skyBoxImageProps.textures.right = convertTexture(skyBoxImageProps.textures.right);\n skyBoxImageProps.textures.top = convertTexture(skyBoxImageProps.textures.top);\n skyBoxImageProps.textures.bottom = convertTexture(skyBoxImageProps.textures.bottom);\n }\n\n if (targetElementProps?.jsonProperties?.styles?.planProjections) {\n const remappedPlanProjections: { [modelId: string]: PlanProjectionSettingsProps } = {};\n for (const entry of Object.entries(targetElementProps.jsonProperties.styles.planProjections)) {\n const remappedModelId: Id64String = context.findTargetElementId(entry[0]);\n if (Id64.isValidId64(remappedModelId)) {\n remappedPlanProjections[remappedModelId] = entry[1];\n }\n }\n targetElementProps.jsonProperties.styles.planProjections = remappedPlanProjections;\n }\n\n const groups = targetElementProps?.jsonProperties?.styles?.contours?.groups;\n if (groups) {\n for (const group of groups) {\n if (group.subCategories) {\n const subCategories = CompressedId64Set.decompressArray(group.subCategories);\n const remappedSubCategories: Id64String[] = [];\n for (const subCategoryId of subCategories) {\n const remappedSubCategoryId: Id64String = context.findTargetElementId(subCategoryId);\n if (Id64.isValidId64(remappedSubCategoryId)) {\n remappedSubCategories.push(remappedSubCategoryId);\n }\n }\n group.subCategories = CompressedId64Set.sortAndCompress(remappedSubCategories);\n }\n }\n }\n }\n }\n\n /** Create a DisplayStyle3d for use by a ViewDefinition.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the DisplayStyle3d\n * @returns The newly constructed DisplayStyle3d element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): DisplayStyle3d {\n options = options ?? {};\n let viewflags = options.viewFlags?.toJSON();\n if (!viewflags)\n viewflags = options.viewflags ?? new ViewFlags().toJSON();\n\n const backgroundColor = options.backgroundColor instanceof ColorDef ? options.backgroundColor.toJSON() : options.backgroundColor;\n\n const settings: DisplayStyle3dSettingsProps = {\n ...options,\n viewflags,\n backgroundColor,\n };\n\n const displayStyleProps: DisplayStyle3dProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, name),\n model: definitionModelId,\n jsonProperties: { styles: settings },\n isPrivate: false,\n\n };\n\n return new DisplayStyle3d(displayStyleProps, iModelDb);\n }\n /**\n * Insert a DisplayStyle3d for use by a ViewDefinition.\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DisplayStyle3d into this [[DefinitionModel]]\n * @param name The name of the DisplayStyle3d\n * @returns The Id of the newly inserted DisplayStyle3d element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String {\n const displayStyle = this.create(iModelDb, definitionModelId, name, options);\n return iModelDb.elements.insertElement(displayStyle.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a,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,CAAC;YACxD,KAAK,EAAE,iBAAiB;YACxB,cAAc,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;YACpC,SAAS,EAAE,KAAK;SAEjB,CAAC;QAEF,OAAO,IAAI,cAAc,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IACD;;;;;;;OAOG;IACI,MAAM,CAAC,MAAM,CAAC,QAAkB,EAAE,iBAA6B,EAAE,IAAY,EAAE,OAAqC;QACzH,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7E,OAAO,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,CAAC;CACF;AA1HD,wCA0HC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ViewDefinitions\n */\n\nimport { CompressedId64Set, Id64, Id64Array, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec, Code, CodeScopeProps, CodeSpec, ColorDef, DisplayStyle3dProps, DisplayStyle3dSettings, DisplayStyle3dSettingsProps,\n DisplayStyleProps, DisplayStyleSettings, DisplayStyleSubCategoryProps, EntityReferenceSet, PlanProjectionSettingsProps, RenderSchedule, SkyBoxImageProps, ViewFlags,\n} from \"@itwin/core-common\";\nimport { DefinitionElement, RenderTimeline } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { IModelElementCloneContext } from \"./IModelElementCloneContext\";\nimport { DeserializeEntityArgs, ECSqlRow } from \"./Entity\";\n\n/** A DisplayStyle defines the parameters for 'styling' the contents of a view.\n * Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.\n * Many ViewDefinitions may share the same DisplayStyle.\n * @public\n */\nexport abstract class DisplayStyle extends DefinitionElement {\n public static override get className(): string { return \"DisplayStyle\"; }\n public abstract get settings(): DisplayStyleSettings;\n\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\n super(props, iModel);\n }\n\n /** @beta */\n public static override deserialize(props: DeserializeEntityArgs): DisplayStyleProps {\n const elProps = super.deserialize(props) as DisplayStyleProps;\n const displayOptions = props.options?.element?.displayStyle;\n // Uncompress excludedElements if they are compressed\n if (!displayOptions?.compressExcludedElementIds && elProps.jsonProperties?.styles?.excludedElements) {\n const excludedElements = elProps.jsonProperties.styles.excludedElements;\n if (typeof excludedElements === \"string\" && excludedElements.startsWith(\"+\")) {\n const ids: string[] = [];\n CompressedId64Set.decompressSet(excludedElements).forEach((id: string) => {\n ids.push(id);\n });\n elProps.jsonProperties.styles.excludedElements = ids;\n }\n }\n // Omit Schedule Script Element Ids if the option is set\n if (displayOptions?.omitScheduleScriptElementIds && elProps.jsonProperties?.styles?.scheduleScript) {\n const scheduleScript: RenderSchedule.ScriptProps = elProps.jsonProperties.styles.scheduleScript;\n elProps.jsonProperties.styles.scheduleScript = RenderSchedule.Script.removeScheduleScriptElementIds(scheduleScript);\n }\n return elProps;\n }\n\n /** @beta */\n public static override serialize(props: DisplayStyleProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n return inst;\n }\n\n /** Create a Code for a DisplayStyle given a name that is meant to be unique within the scope of the specified DefinitionModel.\n * @param iModel The IModelDb\n * @param scopeModelId The Id of the DefinitionModel that contains the DisplayStyle and provides the scope for its name.\n * @param codeValue The DisplayStyle name\n */\n public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.displayStyle);\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n for (const [id] of this.settings.subCategoryOverrides) {\n referenceIds.addElement(id);\n }\n\n for (const excludedElementId of this.settings.excludedElementIds)\n referenceIds.addElement(excludedElementId);\n\n if (this.settings.renderTimeline) {\n referenceIds.addElement(this.settings.renderTimeline);\n } else {\n const script = this.loadScheduleScript();\n if (script)\n script.script.discloseIds(referenceIds);\n }\n }\n\n /** @alpha */\n protected static override onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyleProps, targetElementProps: DisplayStyleProps): void {\n super.onCloned(context, sourceElementProps, targetElementProps);\n\n if (!context.isBetweenIModels || !targetElementProps.jsonProperties?.styles)\n return;\n\n const settings = targetElementProps.jsonProperties.styles;\n if (settings.subCategoryOvr) {\n const targetOverrides: DisplayStyleSubCategoryProps[] = [];\n for (const ovr of settings.subCategoryOvr) {\n ovr.subCategory;\n const targetSubCategoryId = context.findTargetElementId(Id64.fromJSON(ovr.subCategory));\n if (Id64.isValid(targetSubCategoryId))\n targetOverrides.push({...ovr, subCategory: targetSubCategoryId});\n }\n settings.subCategoryOvr = targetOverrides;\n }\n\n if (settings.excludedElements) {\n const excluded: Id64Array = \"string\" === typeof settings.excludedElements ? CompressedId64Set.decompressArray(settings.excludedElements) : settings.excludedElements;\n const excludedTargetElements: Id64Array = [];\n for (const excludedElement of excluded) {\n const remapped = context.findTargetElementId(excludedElement);\n if (Id64.isValid(remapped))\n excludedTargetElements.push(remapped);\n }\n\n if (0 === excludedTargetElements.length)\n delete settings.excludedElements;\n else\n settings.excludedElements = CompressedId64Set.compressIds(OrderedId64Iterable.sortArray(excludedTargetElements));\n }\n\n if (settings.renderTimeline) {\n const renderTimeline = context.findTargetElementId(settings.renderTimeline);\n if (Id64.isValid(renderTimeline))\n settings.renderTimeline = renderTimeline;\n else\n delete settings.renderTimeline;\n } else if (settings.scheduleScript) {\n const scheduleScript = RenderTimeline.remapScript(context, settings.scheduleScript);\n if (scheduleScript.length > 0)\n settings.scheduleScript = scheduleScript;\n else\n delete settings.scheduleScript;\n }\n }\n\n public loadScheduleScript(): RenderSchedule.ScriptReference | undefined {\n let script;\n let sourceId;\n if (this.settings.renderTimeline) {\n const timeline = this.iModel.elements.tryGetElement<RenderTimeline>(this.settings.renderTimeline);\n if (timeline) {\n script = RenderSchedule.Script.fromJSON(timeline.scriptProps);\n sourceId = timeline.id;\n }\n } else if (this.settings.scheduleScriptProps) {\n script = RenderSchedule.Script.fromJSON(this.settings.scheduleScriptProps);\n sourceId = this.id;\n }\n\n return undefined !== sourceId && undefined !== script ? new RenderSchedule.ScriptReference(sourceId, script) : undefined;\n }\n}\n\n/** A DisplayStyle for 2d views.\n * @public\n */\nexport class DisplayStyle2d extends DisplayStyle {\n public static override get className(): string { return \"DisplayStyle2d\"; }\n private readonly _settings: DisplayStyleSettings;\n\n public get settings(): DisplayStyleSettings { return this._settings; }\n\n protected constructor(props: DisplayStyleProps, iModel: IModelDb) {\n super(props, iModel);\n this._settings = new DisplayStyleSettings(this.jsonProperties);\n }\n /** Create a DisplayStyle2d for use by a ViewDefinition.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the DisplayStyle2d\n * @returns The newly constructed DisplayStyle2d element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DisplayStyle2d {\n const displayStyleProps: DisplayStyleProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, name),\n model: definitionModelId,\n isPrivate: false,\n jsonProperties: {\n styles: {\n backgroundColor: 0,\n monochromeColor: ColorDef.white.toJSON(),\n viewflags: ViewFlags.defaults,\n },\n },\n };\n return new DisplayStyle2d(displayStyleProps, iModelDb);\n }\n /** Insert a DisplayStyle2d for use by a ViewDefinition.\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DisplayStyle2d into this DefinitionModel\n * @param name The name of the DisplayStyle2d\n * @returns The Id of the newly inserted DisplayStyle2d element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string): Id64String {\n const displayStyle = this.create(iModelDb, definitionModelId, name);\n return iModelDb.elements.insertElement(displayStyle.toJSON());\n }\n}\n\n/** Describes initial settings for a new [[DisplayStyle3d]].\n * Most properties are inherited from [DisplayStyle3dSettingsProps]($common), but for backwards compatibility reasons, this interface is slightly awkward:\n * - It adds a `viewFlags` member that differs only in case and type from [DisplayStyleSettingsProps.viewflags]($common); and\n * - It extends the type of [DisplayStyleSettingsProps.backgroundColor]($common) to include [ColorDef]($common).\n * These idiosyncrasies will be addressed in a future version of core-backend.\n * @see [[DisplayStyle3d.create]].\n * @public\n */\nexport interface DisplayStyleCreationOptions extends Omit<DisplayStyle3dSettingsProps, \"backgroundColor\" | \"scheduleScript\"> {\n /** If supplied, the [ViewFlags]($common) applied by the display style.\n * If undefined, [DisplayStyle3dSettingsProps.viewflags]($common) will be used if present (note the difference in case); otherwise, default-constructed [ViewFlags]($common) will be used.\n */\n viewFlags?: ViewFlags;\n backgroundColor?: ColorDef | number;\n}\n\n/** A DisplayStyle for 3d views.\n * See [how to create a DisplayStyle3d]$(docs/learning/backend/CreateElements.md#DisplayStyle3d).\n * @public\n */\nexport class DisplayStyle3d extends DisplayStyle {\n public static override get className(): string { return \"DisplayStyle3d\"; }\n private readonly _settings: DisplayStyle3dSettings;\n\n public get settings(): DisplayStyle3dSettings { return this._settings; }\n\n protected constructor(props: DisplayStyle3dProps, iModel: IModelDb) {\n super(props, iModel);\n this._settings = new DisplayStyle3dSettings(this.jsonProperties);\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n for (const textureId of this.settings.environment.sky.textureIds)\n referenceIds.addElement(textureId);\n\n if (this.settings.planProjectionSettings)\n for (const planProjectionSetting of this.settings.planProjectionSettings)\n referenceIds.addElement(planProjectionSetting[0]);\n\n const groups = this.settings.contours.groups;\n for (const group of groups) {\n const subCategories = group.subCategories;\n for (const subCategoryId of subCategories) {\n referenceIds.addElement(subCategoryId);\n }\n }\n }\n\n /** @alpha */\n protected static override onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyle3dProps, targetElementProps: DisplayStyle3dProps): void {\n super.onCloned(context, sourceElementProps, targetElementProps);\n if (context.isBetweenIModels) {\n const convertTexture = (id: string) => Id64.isValidId64(id) ? context.findTargetElementId(id) : id;\n\n const skyBoxImageProps: SkyBoxImageProps | undefined = targetElementProps?.jsonProperties?.styles?.environment?.sky?.image;\n if (skyBoxImageProps?.texture && Id64.isValidId64(skyBoxImageProps.texture))\n skyBoxImageProps.texture = convertTexture(skyBoxImageProps.texture);\n\n if (skyBoxImageProps?.textures) {\n skyBoxImageProps.textures.front = convertTexture(skyBoxImageProps.textures.front);\n skyBoxImageProps.textures.back = convertTexture(skyBoxImageProps.textures.back);\n skyBoxImageProps.textures.left = convertTexture(skyBoxImageProps.textures.left);\n skyBoxImageProps.textures.right = convertTexture(skyBoxImageProps.textures.right);\n skyBoxImageProps.textures.top = convertTexture(skyBoxImageProps.textures.top);\n skyBoxImageProps.textures.bottom = convertTexture(skyBoxImageProps.textures.bottom);\n }\n\n if (targetElementProps?.jsonProperties?.styles?.planProjections) {\n const remappedPlanProjections: { [modelId: string]: PlanProjectionSettingsProps } = {};\n for (const entry of Object.entries(targetElementProps.jsonProperties.styles.planProjections)) {\n const remappedModelId: Id64String = context.findTargetElementId(entry[0]);\n if (Id64.isValidId64(remappedModelId)) {\n remappedPlanProjections[remappedModelId] = entry[1];\n }\n }\n targetElementProps.jsonProperties.styles.planProjections = remappedPlanProjections;\n }\n\n const groups = targetElementProps?.jsonProperties?.styles?.contours?.groups;\n if (groups) {\n for (const group of groups) {\n if (group.subCategories) {\n const subCategories = CompressedId64Set.decompressArray(group.subCategories);\n const remappedSubCategories: Id64String[] = [];\n for (const subCategoryId of subCategories) {\n const remappedSubCategoryId: Id64String = context.findTargetElementId(subCategoryId);\n if (Id64.isValidId64(remappedSubCategoryId)) {\n remappedSubCategories.push(remappedSubCategoryId);\n }\n }\n group.subCategories = CompressedId64Set.sortAndCompress(remappedSubCategories);\n }\n }\n }\n }\n }\n\n /** Create a DisplayStyle3d for use by a ViewDefinition.\n * @param iModelDb The iModel\n * @param definitionModelId The [[DefinitionModel]]\n * @param name The name/CodeValue of the DisplayStyle3d\n * @returns The newly constructed DisplayStyle3d element.\n * @throws [[IModelError]] if unable to create the element.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): DisplayStyle3d {\n options = options ?? {};\n let viewflags = options.viewFlags?.toJSON();\n if (!viewflags)\n viewflags = options.viewflags ?? new ViewFlags().toJSON();\n\n const backgroundColor = options.backgroundColor instanceof ColorDef ? options.backgroundColor.toJSON() : options.backgroundColor;\n\n const settings: DisplayStyle3dSettingsProps = {\n ...options,\n viewflags,\n backgroundColor,\n };\n\n const displayStyleProps: DisplayStyle3dProps = {\n classFullName: this.classFullName,\n code: this.createCode(iModelDb, definitionModelId, name),\n model: definitionModelId,\n jsonProperties: { styles: settings },\n isPrivate: false,\n\n };\n\n return new DisplayStyle3d(displayStyleProps, iModelDb);\n }\n /**\n * Insert a DisplayStyle3d for use by a ViewDefinition.\n * @param iModelDb Insert into this iModel\n * @param definitionModelId Insert the new DisplayStyle3d into this [[DefinitionModel]]\n * @param name The name of the DisplayStyle3d\n * @returns The Id of the newly inserted DisplayStyle3d element.\n * @throws [[IModelError]] if unable to insert the element.\n */\n public static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String {\n const displayStyle = this.create(iModelDb, definitionModelId, name, options);\n return iModelDb.elements.insertElement(displayStyle.toJSON());\n }\n}\n"]}
|