@itwin/core-backend 5.1.0-dev.27 → 5.1.0-dev.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/cjs/Category.d.ts +4 -4
  2. package/lib/cjs/Category.js +4 -4
  3. package/lib/cjs/Category.js.map +1 -1
  4. package/lib/cjs/CodeSpecs.d.ts +1 -1
  5. package/lib/cjs/CodeSpecs.js +1 -1
  6. package/lib/cjs/CodeSpecs.js.map +1 -1
  7. package/lib/cjs/DisplayStyle.d.ts +4 -4
  8. package/lib/cjs/DisplayStyle.js +3 -3
  9. package/lib/cjs/DisplayStyle.js.map +1 -1
  10. package/lib/cjs/Element.d.ts +50 -50
  11. package/lib/cjs/Element.js +50 -50
  12. package/lib/cjs/Element.js.map +1 -1
  13. package/lib/cjs/ElementAspect.d.ts +7 -7
  14. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  15. package/lib/cjs/ElementAspect.js +7 -7
  16. package/lib/cjs/ElementAspect.js.map +1 -1
  17. package/lib/cjs/Entity.d.ts +2 -2
  18. package/lib/cjs/Entity.js +1 -1
  19. package/lib/cjs/Entity.js.map +1 -1
  20. package/lib/cjs/IModelDb.d.ts +6 -6
  21. package/lib/cjs/IModelDb.d.ts.map +1 -1
  22. package/lib/cjs/IModelDb.js +27 -15
  23. package/lib/cjs/IModelDb.js.map +1 -1
  24. package/lib/cjs/Model.d.ts +22 -22
  25. package/lib/cjs/Model.js +22 -22
  26. package/lib/cjs/Model.js.map +1 -1
  27. package/lib/cjs/TextAnnotationElement.d.ts +2 -2
  28. package/lib/cjs/TextAnnotationElement.js +2 -2
  29. package/lib/cjs/TextAnnotationElement.js.map +1 -1
  30. package/lib/cjs/Texture.d.ts +1 -1
  31. package/lib/cjs/Texture.js +1 -1
  32. package/lib/cjs/Texture.js.map +1 -1
  33. package/lib/cjs/TxnManager.d.ts +4 -4
  34. package/lib/cjs/TxnManager.js +1 -1
  35. package/lib/cjs/TxnManager.js.map +1 -1
  36. package/lib/cjs/ViewDefinition.d.ts +14 -14
  37. package/lib/cjs/ViewDefinition.js +14 -14
  38. package/lib/cjs/ViewDefinition.js.map +1 -1
  39. package/lib/esm/Category.d.ts +4 -4
  40. package/lib/esm/Category.js +4 -4
  41. package/lib/esm/Category.js.map +1 -1
  42. package/lib/esm/CodeSpecs.d.ts +1 -1
  43. package/lib/esm/CodeSpecs.js +1 -1
  44. package/lib/esm/CodeSpecs.js.map +1 -1
  45. package/lib/esm/DisplayStyle.d.ts +4 -4
  46. package/lib/esm/DisplayStyle.js +3 -3
  47. package/lib/esm/DisplayStyle.js.map +1 -1
  48. package/lib/esm/Element.d.ts +50 -50
  49. package/lib/esm/Element.js +50 -50
  50. package/lib/esm/Element.js.map +1 -1
  51. package/lib/esm/ElementAspect.d.ts +7 -7
  52. package/lib/esm/ElementAspect.d.ts.map +1 -1
  53. package/lib/esm/ElementAspect.js +7 -7
  54. package/lib/esm/ElementAspect.js.map +1 -1
  55. package/lib/esm/Entity.d.ts +2 -2
  56. package/lib/esm/Entity.js +1 -1
  57. package/lib/esm/Entity.js.map +1 -1
  58. package/lib/esm/IModelDb.d.ts +6 -6
  59. package/lib/esm/IModelDb.d.ts.map +1 -1
  60. package/lib/esm/IModelDb.js +28 -16
  61. package/lib/esm/IModelDb.js.map +1 -1
  62. package/lib/esm/Model.d.ts +22 -22
  63. package/lib/esm/Model.js +22 -22
  64. package/lib/esm/Model.js.map +1 -1
  65. package/lib/esm/TextAnnotationElement.d.ts +2 -2
  66. package/lib/esm/TextAnnotationElement.js +2 -2
  67. package/lib/esm/TextAnnotationElement.js.map +1 -1
  68. package/lib/esm/Texture.d.ts +1 -1
  69. package/lib/esm/Texture.js +1 -1
  70. package/lib/esm/Texture.js.map +1 -1
  71. package/lib/esm/TxnManager.d.ts +4 -4
  72. package/lib/esm/TxnManager.js +1 -1
  73. package/lib/esm/TxnManager.js.map +1 -1
  74. package/lib/esm/ViewDefinition.d.ts +14 -14
  75. package/lib/esm/ViewDefinition.js +14 -14
  76. package/lib/esm/ViewDefinition.js.map +1 -1
  77. package/lib/esm/test/imodel/IModel.test.js +32 -3
  78. package/lib/esm/test/imodel/IModel.test.js.map +1 -1
  79. package/package.json +12 -12
@@ -7,7 +7,7 @@ import { DefinitionElement } from "./Element";
7
7
  import { IModelDb } from "./IModelDb";
8
8
  import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from "./Entity";
9
9
  /** Defines the appearance for graphics in Geometric elements
10
- * @public
10
+ * @public @preview
11
11
  */
12
12
  export declare class SubCategory extends DefinitionElement {
13
13
  static get className(): string;
@@ -69,7 +69,7 @@ export declare class SubCategory extends DefinitionElement {
69
69
  static insert(iModelDb: IModelDb, parentCategoryId: Id64String, name: string, appearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
70
70
  }
71
71
  /** A Category element is the target of the `category` member of [[GeometricElement]].
72
- * @public
72
+ * @public @preview
73
73
  */
74
74
  export declare class Category extends DefinitionElement {
75
75
  static get className(): string;
@@ -101,7 +101,7 @@ export declare class Category extends DefinitionElement {
101
101
  setDefaultAppearance(props: SubCategoryAppearance.Props | SubCategoryAppearance): void;
102
102
  }
103
103
  /** Categorizes 2d GeometricElements.
104
- * @public
104
+ * @public @preview
105
105
  */
106
106
  export declare class DrawingCategory extends Category {
107
107
  static get className(): string;
@@ -136,7 +136,7 @@ export declare class DrawingCategory extends Category {
136
136
  static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, defaultAppearance: SubCategoryAppearance.Props | SubCategoryAppearance): Id64String;
137
137
  }
138
138
  /** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).
139
- * @public
139
+ * @public @preview
140
140
  */
141
141
  export declare class SpatialCategory extends Category {
142
142
  static get className(): string;
@@ -14,7 +14,7 @@ const Element_1 = require("./Element");
14
14
  const IModelDb_1 = require("./IModelDb");
15
15
  const NavigationRelationship_1 = require("./NavigationRelationship");
16
16
  /** Defines the appearance for graphics in Geometric elements
17
- * @public
17
+ * @public @preview
18
18
  */
19
19
  class SubCategory extends Element_1.DefinitionElement {
20
20
  static get className() { return "SubCategory"; }
@@ -127,7 +127,7 @@ class SubCategory extends Element_1.DefinitionElement {
127
127
  }
128
128
  exports.SubCategory = SubCategory;
129
129
  /** A Category element is the target of the `category` member of [[GeometricElement]].
130
- * @public
130
+ * @public @preview
131
131
  */
132
132
  class Category extends Element_1.DefinitionElement {
133
133
  static get className() { return "Category"; }
@@ -191,7 +191,7 @@ class Category extends Element_1.DefinitionElement {
191
191
  }
192
192
  exports.Category = Category;
193
193
  /** Categorizes 2d GeometricElements.
194
- * @public
194
+ * @public @preview
195
195
  */
196
196
  class DrawingCategory extends Category {
197
197
  static get className() { return "DrawingCategory"; }
@@ -247,7 +247,7 @@ class DrawingCategory extends Category {
247
247
  }
248
248
  exports.DrawingCategory = DrawingCategory;
249
249
  /** Categorizes SpatialElements. See [how to create a SpatialCategory]($docs/learning/backend/CreateElements.md#SpatialCategory).
250
- * @public
250
+ * @public @preview
251
251
  */
252
252
  class SpatialCategory extends Category {
253
253
  static get className() { return "SpatialCategory"; }
@@ -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;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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AAC,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"]}
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,OAA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AAC,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 @preview\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 @preview\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 @preview\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 @preview\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"]}
@@ -5,7 +5,7 @@ import { Id64String } from "@itwin/core-bentley";
5
5
  import { CodeScopeSpec, CodeSpec, CodeSpecProperties } from "@itwin/core-common";
6
6
  import { IModelDb } from "./IModelDb";
7
7
  /** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]
8
- * @public
8
+ * @public @preview
9
9
  */
10
10
  export declare class CodeSpecs {
11
11
  private static tableName;
@@ -11,7 +11,7 @@ exports.CodeSpecs = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const core_common_1 = require("@itwin/core-common");
13
13
  /** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]
14
- * @public
14
+ * @public @preview
15
15
  */
16
16
  class CodeSpecs {
17
17
  static tableName = "bis_CodeSpec";
@@ -1 +1 @@
1
- {"version":3,"file":"CodeSpecs.js","sourceRoot":"","sources":["../../src/CodeSpecs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6F;AAC7F,oDAA8F;AAI9F;;GAEG;AACH,MAAa,SAAS;IACZ,MAAM,CAAC,SAAS,GAAG,cAAc,CAAC;IAClC,OAAO,CAAW;IAClB,gBAAgB,GAAe,EAAE,CAAC;IAE1C,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC;YAC3B,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAEO,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,kBAAkB,SAAS,CAAC,SAAS,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;YACrG,IAAI,CAAC,UAAU,CAAC,CAA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C,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACL,CAAC;;AAxKH,8BAyKC","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 Codes\n */\n\nimport { BentleyError, DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { CodeScopeSpec, CodeSpec, CodeSpecProperties, IModelError } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\nimport { CodeService } from \"./CodeService\";\n\n/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]\n * @public\n */\nexport class CodeSpecs {\n private static tableName = \"bis_CodeSpec\";\n private _imodel: IModelDb;\n private _loadedCodeSpecs: CodeSpec[] = [];\n\n constructor(imodel: IModelDb) {\n this._imodel = imodel;\n if (imodel.isBriefcaseDb()) {\n imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);\n }\n }\n\n private findByName(name: string): Id64String | undefined {\n return this._imodel.withSqliteStatement(`SELECT Id FROM ${CodeSpecs.tableName} WHERE Name=?`, (stmt) => {\n stmt.bindString(1, name);\n return stmt.nextRow() ? stmt.getValueId(0) : undefined;\n });\n }\n\n /** Look up the Id of the CodeSpec with the specified name. */\n public queryId(name: string): Id64String {\n const id = this.findByName(name);\n if (!id)\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\n return id;\n }\n\n /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.\n * @param codeSpecId The Id of the CodeSpec to load\n * @returns The CodeSpec with the specified Id\n * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.\n */\n public getById(codeSpecId: Id64String): CodeSpec {\n // good chance it is already loaded - check there before running a query\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);\n if (found !== undefined)\n return found;\n\n // must load this codespec\n const loadedCodeSpec = this.load(codeSpecId);\n this._loadedCodeSpecs.push(loadedCodeSpec);\n return loadedCodeSpec;\n }\n\n /** Returns true if the IModelDb has a CodeSpec of the specified Id. */\n public hasId(codeSpecId: Id64String): boolean {\n try {\n return undefined !== this.getById(codeSpecId);\n } catch {\n return false;\n }\n }\n\n /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.\n * @param name The name of the CodeSpec to load\n * @returns The CodeSpec with the specified name\n * @throws [[IModelError]] if no CodeSpec with the specified name could be found.\n */\n public getByName(name: string): CodeSpec {\n // good chance it is already loaded - check there before running a query\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);\n if (found !== undefined)\n return found;\n const codeSpecId = this.queryId(name);\n if (codeSpecId === undefined)\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\n return this.getById(codeSpecId);\n }\n\n /** Returns true if the IModelDb has a CodeSpec of the specified name. */\n public hasName(name: string): boolean {\n try {\n return undefined !== this.getByName(name);\n } catch {\n return false;\n }\n }\n\n private insertCodeSpec(specName: string, properties: CodeSpecProperties): Id64String {\n const iModel = this._imodel;\n const spec: CodeService.BisCodeSpecIndexProps = { name: specName.trim(), props: JSON.stringify(properties) };\n if (this.findByName(spec.name))\n throw new IModelError(IModelStatus.DuplicateName, \"CodeSpec already exists\");\n\n const internalCodes = iModel.codeService?.internalCodes;\n if (internalCodes) {\n // Since there is no lock on the codespec table, to add a codespec to an iModel it must first be reserved in the\n // internal code index via `internalCodes.reserveBisCodeSpecs` prior to calling this function.\n // This ensures that the Ids will be unique, and the property values consistent, even if more than one user\n // adds them without pushing their changes. The call to `verifyBisCodeSpec` will throw otherwise.\n internalCodes.reader.verifyBisCodeSpec(spec);\n } else {\n // If this iModel doesn't have an internal code index, we have no way of coordinating the Ids for CodeSpecs across multiple users.\n // Just look in this briefcase to find the currently highest used Id and hope for the best.\n spec.id = iModel.withSqliteStatement(`SELECT MAX(Id) FROM ${CodeSpecs.tableName}`, (stmt) => stmt.nextRow() ? stmt.getValueInteger(0) + 1 : 1);\n }\n\n const id = spec.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n iModel.withSqliteStatement(`INSERT INTO ${CodeSpecs.tableName}(Id,Name,JsonProperties) VALUES(?,?,?)`, (stmt) => {\n stmt.bindInteger(1, id);\n stmt.bindString(2, spec.name);\n stmt.bindString(3, spec.props);\n const rc = stmt.step();\n if (rc !== DbResult.BE_SQLITE_DONE)\n throw new BentleyError(rc, \"Error inserting codeSpec\");\n });\n\n return Id64.fromLocalAndBriefcaseIds(id, 0);\n }\n\n /** Add a new CodeSpec to the iModel.\n * @param codeSpec The CodeSpec to insert\n * @returns The Id of the persistent CodeSpec.\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\n * @throws IModelError if the insertion fails\n */\n public insert(codeSpec: CodeSpec): Id64String;\n\n /** Add a new CodeSpec to the IModelDb.\n * @param name The name for the new CodeSpec.\n * @param properties The properties or the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.\n * @returns The Id of the persistent CodeSpec.\n * @throws IModelError if the insertion fails\n */\n public insert(name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;\n public insert(codeSpecOrName: CodeSpec | string, props?: CodeSpecProperties | CodeScopeSpec.Type): Id64String {\n if (codeSpecOrName instanceof CodeSpec) {\n const id = this.insertCodeSpec(codeSpecOrName.name, codeSpecOrName.properties);\n codeSpecOrName.id = id;\n return id;\n }\n if (props === undefined)\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\n\n if (typeof props === \"object\")\n return this.insertCodeSpec(codeSpecOrName, props);\n\n const spec = CodeSpec.create(this._imodel, codeSpecOrName, props);\n return this.insertCodeSpec(spec.name, spec.properties);\n }\n\n /** Update the Json properties of an existing CodeSpec.\n * @param codeSpec The codeSpec holding Json properties values to update\n * @throws if unable to update the codeSpec.\n */\n public updateProperties(codeSpec: CodeSpec): void {\n this._imodel.withSqliteStatement(`UPDATE ${CodeSpecs.tableName} SET JsonProperties=? WHERE Id=?`, (stmt) => {\n stmt.bindString(1, JSON.stringify(codeSpec.properties));\n stmt.bindId(2, codeSpec.id);\n if (DbResult.BE_SQLITE_DONE !== stmt.step())\n throw new IModelError(IModelStatus.BadArg, \"error updating CodeSpec properties\");\n });\n }\n\n /** Load a CodeSpec from the iModel\n * @param id The persistent Id of the CodeSpec to load\n */\n public load(id: Id64String): CodeSpec {\n if (Id64.isInvalid(id))\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\n\n return this._imodel.withSqliteStatement(`SELECT Name,JsonProperties FROM ${CodeSpecs.tableName} WHERE Id=?`, (stmt) => {\n stmt.bindId(1, id);\n if (!stmt.nextRow())\n throw new IModelError(IModelStatus.InvalidId, \"CodeSpec not found\");\n\n return CodeSpec.createFromJson(this._imodel, id, stmt.getValueString(0), JSON.parse(stmt.getValueString(1)));\n });\n }\n}\n"]}
1
+ {"version":3,"file":"CodeSpecs.js","sourceRoot":"","sources":["../../src/CodeSpecs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6F;AAC7F,oDAA8F;AAI9F;;GAEG;AACH,MAAa,SAAS;IACZ,MAAM,CAAC,SAAS,GAAG,cAAc,CAAC;IAClC,OAAO,CAAW;IAClB,gBAAgB,GAAe,EAAE,CAAC;IAE1C,YAAY,MAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC;YAC3B,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,C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IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;YAEtE,OAAO,sBAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACL,CAAC;;AAxKH,8BAyKC","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 Codes\n */\n\nimport { BentleyError, DbResult, Id64, Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { CodeScopeSpec, CodeSpec, CodeSpecProperties, IModelError } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\nimport { CodeService } from \"./CodeService\";\n\n/** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]]\n * @public @preview\n */\nexport class CodeSpecs {\n private static tableName = \"bis_CodeSpec\";\n private _imodel: IModelDb;\n private _loadedCodeSpecs: CodeSpec[] = [];\n\n constructor(imodel: IModelDb) {\n this._imodel = imodel;\n if (imodel.isBriefcaseDb()) {\n imodel.onChangesetApplied.addListener(() => this._loadedCodeSpecs.length = 0);\n }\n }\n\n private findByName(name: string): Id64String | undefined {\n return this._imodel.withSqliteStatement(`SELECT Id FROM ${CodeSpecs.tableName} WHERE Name=?`, (stmt) => {\n stmt.bindString(1, name);\n return stmt.nextRow() ? stmt.getValueId(0) : undefined;\n });\n }\n\n /** Look up the Id of the CodeSpec with the specified name. */\n public queryId(name: string): Id64String {\n const id = this.findByName(name);\n if (!id)\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\n return id;\n }\n\n /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary.\n * @param codeSpecId The Id of the CodeSpec to load\n * @returns The CodeSpec with the specified Id\n * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found.\n */\n public getById(codeSpecId: Id64String): CodeSpec {\n // good chance it is already loaded - check there before running a query\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.id === codeSpecId);\n if (found !== undefined)\n return found;\n\n // must load this codespec\n const loadedCodeSpec = this.load(codeSpecId);\n this._loadedCodeSpecs.push(loadedCodeSpec);\n return loadedCodeSpec;\n }\n\n /** Returns true if the IModelDb has a CodeSpec of the specified Id. */\n public hasId(codeSpecId: Id64String): boolean {\n try {\n return undefined !== this.getById(codeSpecId);\n } catch {\n return false;\n }\n }\n\n /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary.\n * @param name The name of the CodeSpec to load\n * @returns The CodeSpec with the specified name\n * @throws [[IModelError]] if no CodeSpec with the specified name could be found.\n */\n public getByName(name: string): CodeSpec {\n // good chance it is already loaded - check there before running a query\n const found = this._loadedCodeSpecs.find((codeSpec) => codeSpec.name === name);\n if (found !== undefined)\n return found;\n const codeSpecId = this.queryId(name);\n if (codeSpecId === undefined)\n throw new IModelError(IModelStatus.NotFound, \"CodeSpec not found\");\n return this.getById(codeSpecId);\n }\n\n /** Returns true if the IModelDb has a CodeSpec of the specified name. */\n public hasName(name: string): boolean {\n try {\n return undefined !== this.getByName(name);\n } catch {\n return false;\n }\n }\n\n private insertCodeSpec(specName: string, properties: CodeSpecProperties): Id64String {\n const iModel = this._imodel;\n const spec: CodeService.BisCodeSpecIndexProps = { name: specName.trim(), props: JSON.stringify(properties) };\n if (this.findByName(spec.name))\n throw new IModelError(IModelStatus.DuplicateName, \"CodeSpec already exists\");\n\n const internalCodes = iModel.codeService?.internalCodes;\n if (internalCodes) {\n // Since there is no lock on the codespec table, to add a codespec to an iModel it must first be reserved in the\n // internal code index via `internalCodes.reserveBisCodeSpecs` prior to calling this function.\n // This ensures that the Ids will be unique, and the property values consistent, even if more than one user\n // adds them without pushing their changes. The call to `verifyBisCodeSpec` will throw otherwise.\n internalCodes.reader.verifyBisCodeSpec(spec);\n } else {\n // If this iModel doesn't have an internal code index, we have no way of coordinating the Ids for CodeSpecs across multiple users.\n // Just look in this briefcase to find the currently highest used Id and hope for the best.\n spec.id = iModel.withSqliteStatement(`SELECT MAX(Id) FROM ${CodeSpecs.tableName}`, (stmt) => stmt.nextRow() ? stmt.getValueInteger(0) + 1 : 1);\n }\n\n const id = spec.id!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n iModel.withSqliteStatement(`INSERT INTO ${CodeSpecs.tableName}(Id,Name,JsonProperties) VALUES(?,?,?)`, (stmt) => {\n stmt.bindInteger(1, id);\n stmt.bindString(2, spec.name);\n stmt.bindString(3, spec.props);\n const rc = stmt.step();\n if (rc !== DbResult.BE_SQLITE_DONE)\n throw new BentleyError(rc, \"Error inserting codeSpec\");\n });\n\n return Id64.fromLocalAndBriefcaseIds(id, 0);\n }\n\n /** Add a new CodeSpec to the iModel.\n * @param codeSpec The CodeSpec to insert\n * @returns The Id of the persistent CodeSpec.\n * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec\n * @throws IModelError if the insertion fails\n */\n public insert(codeSpec: CodeSpec): Id64String;\n\n /** Add a new CodeSpec to the IModelDb.\n * @param name The name for the new CodeSpec.\n * @param properties The properties or the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`.\n * @returns The Id of the persistent CodeSpec.\n * @throws IModelError if the insertion fails\n */\n public insert(name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String;\n public insert(codeSpecOrName: CodeSpec | string, props?: CodeSpecProperties | CodeScopeSpec.Type): Id64String {\n if (codeSpecOrName instanceof CodeSpec) {\n const id = this.insertCodeSpec(codeSpecOrName.name, codeSpecOrName.properties);\n codeSpecOrName.id = id;\n return id;\n }\n if (props === undefined)\n throw new IModelError(IModelStatus.BadArg, \"Invalid argument\");\n\n if (typeof props === \"object\")\n return this.insertCodeSpec(codeSpecOrName, props);\n\n const spec = CodeSpec.create(this._imodel, codeSpecOrName, props);\n return this.insertCodeSpec(spec.name, spec.properties);\n }\n\n /** Update the Json properties of an existing CodeSpec.\n * @param codeSpec The codeSpec holding Json properties values to update\n * @throws if unable to update the codeSpec.\n */\n public updateProperties(codeSpec: CodeSpec): void {\n this._imodel.withSqliteStatement(`UPDATE ${CodeSpecs.tableName} SET JsonProperties=? WHERE Id=?`, (stmt) => {\n stmt.bindString(1, JSON.stringify(codeSpec.properties));\n stmt.bindId(2, codeSpec.id);\n if (DbResult.BE_SQLITE_DONE !== stmt.step())\n throw new IModelError(IModelStatus.BadArg, \"error updating CodeSpec properties\");\n });\n }\n\n /** Load a CodeSpec from the iModel\n * @param id The persistent Id of the CodeSpec to load\n */\n public load(id: Id64String): CodeSpec {\n if (Id64.isInvalid(id))\n throw new IModelError(IModelStatus.InvalidId, \"Invalid codeSpecId\");\n\n return this._imodel.withSqliteStatement(`SELECT Name,JsonProperties FROM ${CodeSpecs.tableName} WHERE Id=?`, (stmt) => {\n stmt.bindId(1, id);\n if (!stmt.nextRow())\n throw new IModelError(IModelStatus.InvalidId, \"CodeSpec not found\");\n\n return CodeSpec.createFromJson(this._imodel, id, stmt.getValueString(0), JSON.parse(stmt.getValueString(1)));\n });\n }\n}\n"]}
@@ -10,7 +10,7 @@ import { DeserializeEntityArgs, ECSqlRow } from "./Entity";
10
10
  /** A DisplayStyle defines the parameters for 'styling' the contents of a view.
11
11
  * Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.
12
12
  * Many ViewDefinitions may share the same DisplayStyle.
13
- * @public
13
+ * @public @preview
14
14
  */
15
15
  export declare abstract class DisplayStyle extends DefinitionElement {
16
16
  static get className(): string;
@@ -32,7 +32,7 @@ export declare abstract class DisplayStyle extends DefinitionElement {
32
32
  loadScheduleScript(): RenderSchedule.ScriptReference | undefined;
33
33
  }
34
34
  /** A DisplayStyle for 2d views.
35
- * @public
35
+ * @public @preview
36
36
  */
37
37
  export declare class DisplayStyle2d extends DisplayStyle {
38
38
  static get className(): string;
@@ -62,7 +62,7 @@ export declare class DisplayStyle2d extends DisplayStyle {
62
62
  * - It extends the type of [DisplayStyleSettingsProps.backgroundColor]($common) to include [ColorDef]($common).
63
63
  * These idiosyncrasies will be addressed in a future version of core-backend.
64
64
  * @see [[DisplayStyle3d.create]].
65
- * @public
65
+ * @public @preview
66
66
  */
67
67
  export interface DisplayStyleCreationOptions extends Omit<DisplayStyle3dSettingsProps, "backgroundColor" | "scheduleScript"> {
68
68
  /** If supplied, the [ViewFlags]($common) applied by the display style.
@@ -73,7 +73,7 @@ export interface DisplayStyleCreationOptions extends Omit<DisplayStyle3dSettings
73
73
  }
74
74
  /** A DisplayStyle for 3d views.
75
75
  * See [how to create a DisplayStyle3d]$(docs/learning/backend/CreateElements.md#DisplayStyle3d).
76
- * @public
76
+ * @public @preview
77
77
  */
78
78
  export declare class DisplayStyle3d extends DisplayStyle {
79
79
  static get className(): string;
@@ -14,7 +14,7 @@ const Element_1 = require("./Element");
14
14
  /** A DisplayStyle defines the parameters for 'styling' the contents of a view.
15
15
  * Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.
16
16
  * Many ViewDefinitions may share the same DisplayStyle.
17
- * @public
17
+ * @public @preview
18
18
  */
19
19
  class DisplayStyle extends Element_1.DefinitionElement {
20
20
  static get className() { return "DisplayStyle"; }
@@ -136,7 +136,7 @@ class DisplayStyle extends Element_1.DefinitionElement {
136
136
  }
137
137
  exports.DisplayStyle = DisplayStyle;
138
138
  /** A DisplayStyle for 2d views.
139
- * @public
139
+ * @public @preview
140
140
  */
141
141
  class DisplayStyle2d extends DisplayStyle {
142
142
  static get className() { return "DisplayStyle2d"; }
@@ -184,7 +184,7 @@ class DisplayStyle2d extends DisplayStyle {
184
184
  exports.DisplayStyle2d = DisplayStyle2d;
185
185
  /** A DisplayStyle for 3d views.
186
186
  * See [how to create a DisplayStyle3d]$(docs/learning/backend/CreateElements.md#DisplayStyle3d).
187
- * @public
187
+ * @public @preview
188
188
  */
189
189
  class DisplayStyle3d extends DisplayStyle {
190
190
  static get className() { return "DisplayStyle3d"; }
@@ -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;AAK9D;;;;GAIG;AACH,MAAsB,YAAa,SAAQ,2BAAiB;IACnD,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IAGzE,YAAsB,KAAwB,EAAE,MAAgB;QAC9D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,YAAY;IACL,MAAM,CAAU,WAAW,CAAC,KAA4B;QAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAsB,CAAC;QAC9D,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC;QAC5D,qDAAqD;QACrD,IAAI,CAAC,cAAc,EAAE,0BAA0B,IAAI,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;YACpG,MAAM,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACxE,IAAI,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7E,MAAM,GAAG,GAAa,EAAE,CAAC;gBACzB,gCAAiB,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,EAAU,EAAE,EAA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eAAe,YAAY,sBAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;QAEjI,MAAM,QAAQ,GAAgC;YAC5C,GAAG,OAAO;YACV,SAAS;YACT,eAAe;SAChB,CAAC;QAEF,MAAM,iBAAiB,GAAwB;YAC7C,aAAa,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"]}
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;AAK9D;;;;GAIG;AACH,MAAsB,YAAa,SAAQ,2BAAiB;IACnD,MAAM,KAAc,SAAS,KAAa,OAAO,cAAc,CAAC,CAAC,CAAC;IAGzE,YAAsB,KAAwB,EAAE,MAAgB;QAC9D,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,YAAY;IACL,MAAM,CAAU,WAAW,CAAC,KAA4B;QAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAsB,CAAC;QAC9D,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC;QAC5D,qDAAqD;QACrD,IAAI,CAAC,cAAc,EAAE,0BAA0B,IAAI,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;YACpG,MAAM,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,CAAC;YACxE,IAAI,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7E,MAAM,GAAG,GAAa,EAAE,CAAC;gBACzB,gCAAiB,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,EAAU,EAAE,EAAE;oBACvE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACf,CAAC,CAAC,CAAC;gBACH,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAg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MAAM,QAAQ,GAAgC;YAC5C,GAAG,OAAO;YACV,SAAS;YACT,eAAe;SAChB,CAAC;QAEF,MAAM,iBAAiB,GAAwB;YAC7C,aAAa,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 @preview\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 @preview\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 @preview\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 @preview\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"]}