@itwin/core-backend 5.3.0-dev.7 → 5.3.0-dev.9

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 (44) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/lib/cjs/IModelHost.d.ts +1 -2
  3. package/lib/cjs/IModelHost.d.ts.map +1 -1
  4. package/lib/cjs/IModelHost.js +9 -17
  5. package/lib/cjs/IModelHost.js.map +1 -1
  6. package/lib/cjs/TileStorage.d.ts +1 -1
  7. package/lib/cjs/TileStorage.d.ts.map +1 -1
  8. package/lib/cjs/TileStorage.js.map +1 -1
  9. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +7 -1
  10. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  11. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +25 -0
  12. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  13. package/lib/cjs/annotations/TextAnnotationElement.d.ts +20 -1
  14. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  15. package/lib/cjs/annotations/TextAnnotationElement.js +84 -2
  16. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  17. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  18. package/lib/cjs/internal/annotations/fields.js +1 -0
  19. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  20. package/lib/esm/IModelHost.d.ts +1 -2
  21. package/lib/esm/IModelHost.d.ts.map +1 -1
  22. package/lib/esm/IModelHost.js +10 -18
  23. package/lib/esm/IModelHost.js.map +1 -1
  24. package/lib/esm/TileStorage.d.ts +1 -1
  25. package/lib/esm/TileStorage.d.ts.map +1 -1
  26. package/lib/esm/TileStorage.js.map +1 -1
  27. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +7 -1
  28. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  29. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +25 -0
  30. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  31. package/lib/esm/annotations/TextAnnotationElement.d.ts +20 -1
  32. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  33. package/lib/esm/annotations/TextAnnotationElement.js +86 -5
  34. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  35. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  36. package/lib/esm/internal/annotations/fields.js +1 -0
  37. package/lib/esm/internal/annotations/fields.js.map +1 -1
  38. package/lib/esm/test/IModelHost.test.js +17 -11
  39. package/lib/esm/test/IModelHost.test.js.map +1 -1
  40. package/lib/esm/test/annotations/Fields.test.js +146 -51
  41. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  42. package/lib/esm/test/annotations/TextAnnotation.test.js +227 -2
  43. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  44. package/package.json +17 -19
@@ -1,17 +1,22 @@
1
1
  /** @packageDocumentation
2
2
  * @module Elements
3
3
  */
4
- import { AnnotationTextStyleProps, Code, CodeProps, CodeScopeProps, Placement2dProps, Placement3dProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps } from "@itwin/core-common";
4
+ import { AnnotationTextStyleProps, Code, CodeProps, CodeScopeProps, EntityReferenceSet, Placement2dProps, Placement3dProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps, VersionedJSON } from "@itwin/core-common";
5
5
  import { IModelDb } from "../IModelDb";
6
6
  import { AnnotationElement2d, DefinitionElement, GraphicalElement3d, OnElementIdArg, OnElementPropsArg } from "../Element";
7
7
  import { Id64String } from "@itwin/core-bentley";
8
8
  import { TextAnnotationUsesTextStyleByDefault, TextBlockAndId } from "./ElementDrivesTextAnnotation";
9
+ import { IModelElementCloneContext } from "../IModelElementCloneContext";
9
10
  import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from "../Entity";
10
11
  /** The version of the JSON stored in `TextAnnotation2d/3dProps.textAnnotationData` used by the code.
11
12
  * Uses the same semantics as [ECVersion]($ecschema-metadata).
12
13
  * @internal
13
14
  */
14
15
  export declare const TEXT_ANNOTATION_JSON_VERSION = "1.0.0";
16
+ /** Parses, validates, and potentially migrates the text annotation data from a JSON string.
17
+ * @internal
18
+ */
19
+ export declare function parseTextAnnotationData(json: string | undefined): VersionedJSON<TextAnnotationProps> | undefined;
15
20
  /** Arguments supplied when creating a [[TextAnnotation2d]].
16
21
  * @beta
17
22
  */
@@ -130,6 +135,9 @@ export declare class TextAnnotation2d extends AnnotationElement2d {
130
135
  static onInserted(arg: OnElementIdArg): void;
131
136
  /** @internal */
132
137
  static onUpdated(arg: OnElementIdArg): void;
138
+ protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
139
+ /** @internal */
140
+ protected static onCloned(context: IModelElementCloneContext, srcProps: TextAnnotation2dProps, dstProps: TextAnnotation2dProps): void;
133
141
  }
134
142
  /** An element that displays textual content within a 3d model.
135
143
  * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
@@ -215,6 +223,9 @@ export declare class TextAnnotation3d extends GraphicalElement3d {
215
223
  static onInserted(arg: OnElementIdArg): void;
216
224
  /** @internal */
217
225
  static onUpdated(arg: OnElementIdArg): void;
226
+ protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
227
+ /** @internal */
228
+ protected static onCloned(context: IModelElementCloneContext, srcProps: TextAnnotation3dProps, dstProps: TextAnnotation3dProps): void;
218
229
  }
219
230
  /** The version of the JSON stored in `AnnotationTextStyleProps.settings` used by the code.
220
231
  * Uses the same semantics as [ECVersion]($ecschema-metadata).
@@ -309,5 +320,13 @@ export declare class AnnotationTextStyle extends DefinitionElement {
309
320
  static serialize(props: AnnotationTextStyleProps, iModel: IModelDb): ECSqlRow;
310
321
  /** Parses, validates, and potentially migrates the text style settings data from a JSON string. */
311
322
  private static parseTextStyleSettings;
323
+ /** When copying an element from one iModel to another, returns the Id of the AnnotationTextStyle in the `context`'s target iModel
324
+ * corresponding to `sourceTextStyleId`, or [Id64.invalid]($bentley) if no corresponding text style exists.
325
+ * If a text style with the same [Code]($common) exists in the target iModel, the style Id will be remapped to refer to that style.
326
+ * Otherwise, a copy of the style will be imported into the target iModel and its element Id returned.
327
+ * Implementations of [[ITextAnnotation]] should invoke this function when implementing their [[Element._onCloned]] method.
328
+ * @throws Error if an attempt to import the text style failed.
329
+ */
330
+ static remapTextStyleId(sourceTextStyleId: Id64String, context: IModelElementCloneContext): Id64String;
312
331
  }
313
332
  //# sourceMappingURL=TextAnnotationElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationElement.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAe,IAAI,EAAE,SAAS,EAAE,cAAc,EAAyF,gBAAgB,EAAe,gBAAgB,EAAkB,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,EAAiB,MAAM,oBAAoB,CAAC;AACjZ,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAW,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpI,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAA+B,oCAAoC,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAClI,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGnF;;;EAGE;AACF,eAAO,MAAM,4BAA4B,UAAU,CAAC;AA+DpD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,0CAA0C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E,wBAAwB,EAAE,MAAM,EAAE,QAAQ;IAOvE;;;;;;;OAOG;WACW,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAKjG;;;;;;OAMG;WACW,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,mBAAmB,GAAG,mBAAmB;IAWvF;;;OAGG;IACa,MAAM,IAAI,wBAAwB;IAOlD,oFAAoF;WACtE,QAAQ,CAAC,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,QAAQ,GAAG,mBAAmB;IAI9F;;;;OAIG;qBACuB,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,IAAI;IAKhE;;;;OAIG;qBACuB,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,IAAI;IAKhE,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAU/B;;;;OAIG;IACH,0BAAmC,mBAAmB,EAAE,qBAAqB,EAAE,CAE7E;IAEF;;;;OAIG;WACoB,WAAW,CAAC,KAAK,EAAE,qBAAqB,GAAG,wBAAwB;IAS1F;;;;OAIG;WACoB,SAAS,CAAC,KAAK,EAAE,wBAAwB,EAAE,MAAM,EAAE,QAAQ,GAAG,QAAQ;IAQ7F,mGAAmG;IACnG,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAKrC;;;;;;OAMG;WACW,gBAAgB,CAAC,iBAAiB,EAAE,UAAU,EAAE,OAAO,EAAE,yBAAyB,GAAG,UAAU;CA8B9G"}
@@ -8,6 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.AnnotationTextStyle = exports.TEXT_STYLE_SETTINGS_JSON_VERSION = exports.TextAnnotation3d = exports.TextAnnotation2d = exports.TEXT_ANNOTATION_JSON_VERSION = void 0;
11
+ exports.parseTextAnnotationData = parseTextAnnotationData;
11
12
  const core_common_1 = require("@itwin/core-common");
12
13
  const Element_1 = require("../Element");
13
14
  const core_bentley_1 = require("@itwin/core-bentley");
@@ -49,7 +50,9 @@ function migrateTextAnnotationData(oldData) {
49
50
  // Place migration logic here.
50
51
  throw new Error(`Migration for textAnnotationData from version ${oldData.version} to ${exports.TEXT_ANNOTATION_JSON_VERSION} failed.`);
51
52
  }
52
- /** Parses, validates, and potentially migrates the text annotation data from a JSON string. */
53
+ /** Parses, validates, and potentially migrates the text annotation data from a JSON string.
54
+ * @internal
55
+ */
53
56
  function parseTextAnnotationData(json) {
54
57
  if (!json)
55
58
  return undefined;
@@ -218,6 +221,19 @@ class TextAnnotation2d extends Element_1.AnnotationElement2d /* implements IText
218
221
  super.onUpdated(arg);
219
222
  ElementDrivesTextAnnotation_1.ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);
220
223
  }
224
+ collectReferenceIds(referenceIds) {
225
+ super.collectReferenceIds(referenceIds);
226
+ collectReferenceIds(this, referenceIds);
227
+ }
228
+ /** @internal */
229
+ static onCloned(context, srcProps, dstProps) {
230
+ super.onCloned(context, srcProps, dstProps);
231
+ const srcElem = TextAnnotation2d.fromJSON(srcProps, context.sourceDb);
232
+ ElementDrivesTextAnnotation_1.ElementDrivesTextAnnotation.remapFields(srcElem, context);
233
+ const anno = srcElem.getAnnotation();
234
+ dstProps.textAnnotationData = anno ? JSON.stringify({ version: exports.TEXT_ANNOTATION_JSON_VERSION, data: anno.toJSON() }) : undefined;
235
+ remapTextStyle(context, srcElem, dstProps);
236
+ }
221
237
  }
222
238
  exports.TextAnnotation2d = TextAnnotation2d;
223
239
  /** An element that displays textual content within a 3d model.
@@ -371,8 +387,42 @@ class TextAnnotation3d extends Element_1.GraphicalElement3d /* implements ITextA
371
387
  super.onUpdated(arg);
372
388
  ElementDrivesTextAnnotation_1.ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);
373
389
  }
390
+ collectReferenceIds(referenceIds) {
391
+ super.collectReferenceIds(referenceIds);
392
+ collectReferenceIds(this, referenceIds);
393
+ }
394
+ /** @internal */
395
+ static onCloned(context, srcProps, dstProps) {
396
+ super.onCloned(context, srcProps, dstProps);
397
+ const srcElem = TextAnnotation3d.fromJSON(srcProps, context.sourceDb);
398
+ ElementDrivesTextAnnotation_1.ElementDrivesTextAnnotation.remapFields(srcElem, context);
399
+ const anno = srcElem.getAnnotation();
400
+ dstProps.textAnnotationData = anno ? JSON.stringify({ version: exports.TEXT_ANNOTATION_JSON_VERSION, data: anno.toJSON() }) : undefined;
401
+ remapTextStyle(context, srcElem, dstProps);
402
+ }
374
403
  }
375
404
  exports.TextAnnotation3d = TextAnnotation3d;
405
+ function remapTextStyle(context, srcElem, dstProps) {
406
+ const dstStyleId = AnnotationTextStyle.remapTextStyleId(srcElem.defaultTextStyle?.id ?? core_bentley_1.Id64.invalid, context);
407
+ dstProps.defaultTextStyle = core_bentley_1.Id64.isValid(dstStyleId) ? new ElementDrivesTextAnnotation_1.TextAnnotationUsesTextStyleByDefault(dstStyleId).toJSON() : undefined;
408
+ }
409
+ function collectReferenceIds(elem, referenceIds) {
410
+ const style = elem.defaultTextStyle?.id;
411
+ if (style && core_bentley_1.Id64.isValidId64(style)) {
412
+ referenceIds.addElement(style);
413
+ }
414
+ const block = elem.getAnnotation()?.textBlock;
415
+ if (block) {
416
+ for (const { child } of (0, core_common_1.traverseTextBlockComponent)(block)) {
417
+ if (child.type === "field") {
418
+ const hostId = child.propertyHost.elementId;
419
+ if (core_bentley_1.Id64.isValidId64(hostId)) {
420
+ referenceIds.addElement(hostId);
421
+ }
422
+ }
423
+ }
424
+ }
425
+ }
376
426
  function getTextBlocks(elem) {
377
427
  const annotation = elem.getAnnotation();
378
428
  return annotation ? [{ textBlock: annotation.textBlock, id: undefined }] : [];
@@ -388,7 +438,6 @@ function updateTextBlocks(elem, textBlocks) {
388
438
  }
389
439
  annotation.textBlock = textBlocks[0].textBlock;
390
440
  elem.setAnnotation(annotation);
391
- elem.update();
392
441
  }
393
442
  /** The version of the JSON stored in `AnnotationTextStyleProps.settings` used by the code.
394
443
  * Uses the same semantics as [ECVersion]($ecschema-metadata).
@@ -534,6 +583,39 @@ class AnnotationTextStyle extends Element_1.DefinitionElement {
534
583
  return undefined;
535
584
  return validateAndMigrateVersionedJSON(json, exports.TEXT_STYLE_SETTINGS_JSON_VERSION, migrateTextStyleSettings);
536
585
  }
586
+ /** When copying an element from one iModel to another, returns the Id of the AnnotationTextStyle in the `context`'s target iModel
587
+ * corresponding to `sourceTextStyleId`, or [Id64.invalid]($bentley) if no corresponding text style exists.
588
+ * If a text style with the same [Code]($common) exists in the target iModel, the style Id will be remapped to refer to that style.
589
+ * Otherwise, a copy of the style will be imported into the target iModel and its element Id returned.
590
+ * Implementations of [[ITextAnnotation]] should invoke this function when implementing their [[Element._onCloned]] method.
591
+ * @throws Error if an attempt to import the text style failed.
592
+ */
593
+ static remapTextStyleId(sourceTextStyleId, context) {
594
+ // No remapping necessary if there's no text style or we're not copying to a different iModel.
595
+ if (!core_bentley_1.Id64.isValid(sourceTextStyleId) || !context.isBetweenIModels) {
596
+ return sourceTextStyleId;
597
+ }
598
+ // If the style's already been remapped, we're finished.
599
+ let dstStyleId = context.findTargetElementId(sourceTextStyleId);
600
+ if (core_bentley_1.Id64.isValid(dstStyleId)) {
601
+ return dstStyleId;
602
+ }
603
+ // Look up the style. It really ought to exist.
604
+ const srcStyle = context.sourceDb.elements.tryGetElement(sourceTextStyleId);
605
+ if (!srcStyle) {
606
+ return core_bentley_1.Id64.invalid;
607
+ }
608
+ // If a style with the same code exists in the target iModel, remap to that one.
609
+ dstStyleId = context.targetDb.elements.queryElementIdByCode(srcStyle.code);
610
+ if (undefined !== dstStyleId) {
611
+ return dstStyleId;
612
+ }
613
+ // Copy the style into the target iModel and remap its Id.
614
+ const dstStyleProps = context.cloneElement(srcStyle);
615
+ dstStyleId = context.targetDb.elements.insertElement(dstStyleProps);
616
+ context.remapElement(sourceTextStyleId, dstStyleId);
617
+ return dstStyleId;
618
+ }
537
619
  }
538
620
  exports.AnnotationTextStyle = AnnotationTextStyle;
539
621
  //# sourceMappingURL=TextAnnotationElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAiZ;AAEjZ,wCAAoI;AACpI,sDAAyD;AACzD,uDAAuE;AACvE,qEAAwE;AACxE,+EAAkI;AAElI,iCAAiC;AAEjC;;;EAGE;AACW,QAAA,4BAA4B,GAAG,OAAO,CAAC;AAEpD,SAAS,+BAA+B,CACtC,IAAY,EACZ,cAA+B,EAC/B,OAAqC;IAErC,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAqB,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAEzD,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI;QACzD,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAEtD,QAAQ;IACR,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,gBAAgB,MAAM,CAAC,OAAO,oCAAoC,cAAc,mDAAmD,CAAC,CAAC;IAEvJ,QAAQ;IACR,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,CAAC;QACvC,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,CAAC,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I,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAU,SAAS,CAAC,KAA+B,EAAE,MAAgB;QAChF,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mGAAmG;IAC3F,MAAM,CAAC,sBAAsB,CAAC,IAAwB;QAC5D,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5B,OAAO,+BAA+B,CAAyB,IAAI,EAAE,wCAAgC,EAAE,wBAAwB,CAAC,CAAC;IACnI,CAAC;;AAzIH,kDA0IC","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 Elements\n */\n\nimport { AnnotationTextStyleProps, BisCodeSpec, Code, CodeProps, CodeScopeProps, CodeSpec, ECVersionString, ElementGeometry, ElementGeometryBuilderParams, Placement2d, Placement2dProps, Placement3d, Placement3dProps, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps, VersionedJSON } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\nimport { AnnotationElement2d, DefinitionElement, Drawing, GraphicalElement3d, OnElementIdArg, OnElementPropsArg } from \"../Element\";\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport { layoutTextBlock, TextStyleResolver } from \"./TextBlockLayout\";\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\nimport { ElementDrivesTextAnnotation, TextAnnotationUsesTextStyleByDefault, TextBlockAndId } from \"./ElementDrivesTextAnnotation\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"../Entity\";\nimport * as semver from \"semver\";\n\n/** The version of the JSON stored in `TextAnnotation2d/3dProps.textAnnotationData` used by the code.\n * Uses the same semantics as [ECVersion]($ecschema-metadata).\n * @internal\n*/\nexport const TEXT_ANNOTATION_JSON_VERSION = \"1.0.0\";\n\nfunction validateAndMigrateVersionedJSON<T>(\n json: string,\n currentVersion: ECVersionString,\n migrate: (old: VersionedJSON<T>) => T\n): VersionedJSON<T> | undefined {\n let parsed;\n try {\n parsed = JSON.parse(json) as VersionedJSON<T>;\n } catch {\n return undefined;\n }\n\n const version = parsed.version;\n if (typeof version !== \"string\" || !semver.valid(version))\n throw new Error(\"JSON version is missing or invalid.\");\n\n if (typeof parsed.data !== \"object\" || parsed.data === null)\n throw new Error(\"JSON data is missing or invalid.\");\n\n // Newer\n if (semver.gt(version, currentVersion))\n throw new Error(`JSON version ${parsed.version} is newer than supported version ${currentVersion}. Application update required to understand data.`);\n\n // Older\n if (semver.lt(version, currentVersion)) {\n parsed.data = migrate(parsed);\n parsed.version = currentVersion;\n }\n\n return parsed;\n}\n\nfunction migrateTextAnnotationData(oldData: VersionedJSON<TextAnnotationProps>): TextAnnotationProps {\n if (oldData.version === TEXT_ANNOTATION_JSON_VERSION) return oldData.data;\n\n // Place migration logic here.\n\n throw new Error(`Migration for textAnnotationData from version ${oldData.version} to ${TEXT_ANNOTATION_JSON_VERSION} failed.`);\n}\n\n/** Parses, validates, and potentially migrates the text annotation data from a JSON string. */\nfunction parseTextAnnotationData(json: string | undefined): VersionedJSON<TextAnnotationProps> | undefined {\n if (!json) return undefined;\n\n return validateAndMigrateVersionedJSON<TextAnnotationProps>(json, TEXT_ANNOTATION_JSON_VERSION, migrateTextAnnotationData);\n}\n\nfunction getElementGeometryBuilderParams(iModel: IModelDb, modelId: Id64String, categoryId: Id64String, _placementProps: PlacementProps, annotationProps?: TextAnnotationProps, textStyleId?: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\n const textStyleResolver = new TextStyleResolver({textBlock, textStyleId: textStyleId ?? \"\", iModel});\n const layout = layoutTextBlock({ iModel, textBlock, textStyleResolver });\n const builder = new ElementGeometry.Builder();\n let scaleFactor = 1;\n const element = iModel.elements.getElement(modelId);\n if (element instanceof Drawing)\n scaleFactor = element.scaleFactor;\n appendTextAnnotationGeometry({ layout, textStyleResolver, scaleFactor, annotationProps: annotationProps ?? {}, builder, categoryId });\n\n return { entryArray: builder.entries };\n}\n\n/** Arguments supplied when creating a [[TextAnnotation2d]].\n * @beta\n */\nexport interface TextAnnotation2dCreateArgs {\n /** The category ID for the annotation. */\n category: Id64String;\n /** The model ID where the annotation will be placed. */\n model: Id64String;\n /** The placement properties for the annotation. */\n placement: Placement2dProps;\n /** The default text style ID for the annotation. */\n defaultTextStyleId?: Id64String;\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided. */\n textAnnotationProps?: TextAnnotationProps;\n /** Optional code for the element. */\n code?: CodeProps;\n}\n\n/** Arguments supplied when creating a [[TextAnnotation3d]].\n * @beta\n */\nexport interface TextAnnotation3dCreateArgs {\n /** The category ID for the annotation. */\n category: Id64String;\n /** The model ID where the annotation will be placed. */\n model: Id64String;\n /** The placement properties for the annotation. */\n placement: Placement3dProps;\n /** The default text style ID for the annotation. */\n defaultTextStyleId?: Id64String;\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided. */\n textAnnotationProps?: TextAnnotationProps;\n /** Optional code for the element. */\n code?: CodeProps;\n}\n\n/** An element that displays textual content within a 2d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation2d extends AnnotationElement2d /* implements ITextAnnotation */ {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation2d\"; }\n /**\n * The default [[AnnotationTextStyle]] used by the TextAnnotation2d.\n * @beta\n */\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\n /** The data associated with the text annotation. */\n private _textAnnotationProps?: TextAnnotationProps;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n return this._textAnnotationProps ? TextAnnotation.fromJSON(this._textAnnotationProps) : undefined;\n }\n\n /** Change the textual content of the `TextAnnotation2d`.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this._textAnnotationProps = annotation.toJSON();\n }\n\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.defaultTextStyle) {\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\n }\n this._textAnnotationProps = parseTextAnnotationData(props.textAnnotationData)?.data;\n }\n\n /** Creates a new instance of `TextAnnotation2d` from its JSON representation. */\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\n return new TextAnnotation2d(props, iModel);\n }\n\n /**\n * Converts the current `TextAnnotation2d` instance to its JSON representation.\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation2dProps {\n const props = super.toJSON() as TextAnnotation2dProps;\n props.textAnnotationData = this._textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: this._textAnnotationProps }) : undefined;\n if (this._textAnnotationProps) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.category, this.placement, this._textAnnotationProps, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation2d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param arg The arguments for creating the TextAnnotation2d.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextAnnotation2dCreateArgs): TextAnnotation2d {\n const elementProps: TextAnnotation2dProps = {\n classFullName: this.classFullName,\n textAnnotationData: arg.textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: arg.textAnnotationProps }) : undefined,\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\n placement: arg.placement,\n model: arg.model,\n category: arg.category,\n code: arg.code ?? Code.createEmpty(),\n };\n return new this(elementProps, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on insert and validates version.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on update and validates version.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation2dProps]($common).\n * Only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n * Also, validates the version of the text annotation data and migrates it if necessary.\n * @beta\n */\n protected static validateVersionAndUpdateGeometry(arg: OnElementPropsArg): void {\n const props = arg.props as TextAnnotation2dProps;\n const textAnnotationData = parseTextAnnotationData(props.textAnnotationData);\n if (!props.elementGeometryBuilderParams && textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(arg.iModel, props.model, props.category, props.placement ?? Placement2d.fromJSON(), textAnnotationData.data, props.defaultTextStyle?.id);\n }\n }\n\n /**\n * TextAnnotation2d custom HandledProps include 'textAnnotationData'.\n * @inheritdoc\n * @internal\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"textAnnotationData\", source: \"Class\" },\n ];\n\n /**\n * TextAnnotation2d deserializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): TextAnnotation2dProps {\n const elProps = super.deserialize(props) as TextAnnotation2dProps;\n const textAnnotationData = parseTextAnnotationData(props.row.textAnnotationData);\n if (textAnnotationData) {\n elProps.textAnnotationData = JSON.stringify(textAnnotationData);\n }\n return elProps;\n }\n\n /**\n * TextAnnotation2d serializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: TextAnnotation2dProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (props.textAnnotationData !== undefined) {\n inst.textAnnotationData = props.textAnnotationData;\n }\n return inst;\n }\n\n /** @internal */\n public getTextBlocks(): Iterable<TextBlockAndId> {\n return getTextBlocks(this);\n }\n\n /** @internal */\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\n return updateTextBlocks(this, textBlocks);\n }\n\n /** @internal */\n public static override onInserted(arg: OnElementIdArg): void {\n super.onInserted(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n /** @internal */\n public static override onUpdated(arg: OnElementIdArg): void {\n super.onUpdated(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n}\n\n/** An element that displays textual content within a 3d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation3d extends GraphicalElement3d /* implements ITextAnnotation */ {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation3d\"; }\n /**\n * The default [[AnnotationTextStyle]] used by the TextAnnotation3d.\n * @beta\n */\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\n /** The data associated with the text annotation. */\n private _textAnnotationProps?: TextAnnotationProps;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n return this._textAnnotationProps ? TextAnnotation.fromJSON(this._textAnnotationProps) : undefined;\n }\n\n /** Change the textual content of the `TextAnnotation3d`.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this._textAnnotationProps = annotation.toJSON();\n }\n\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.defaultTextStyle) {\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\n }\n this._textAnnotationProps = parseTextAnnotationData(props.textAnnotationData)?.data;\n }\n\n /** Creates a new instance of `TextAnnotation3d` from its JSON representation. */\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\n return new TextAnnotation3d(props, iModel);\n }\n\n /**\n * Converts the current `TextAnnotation3d` instance to its JSON representation.\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation3dProps {\n const props = super.toJSON() as TextAnnotation3dProps;\n props.textAnnotationData = this._textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: this._textAnnotationProps }) : undefined;\n if (this._textAnnotationProps) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.category, this.placement, this._textAnnotationProps, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation3d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param arg The arguments for creating the TextAnnotation3d.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextAnnotation3dCreateArgs): TextAnnotation3d {\n const elementProps: TextAnnotation3dProps = {\n classFullName: this.classFullName,\n textAnnotationData: arg.textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: arg.textAnnotationProps }) : undefined,\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\n placement: arg.placement,\n model: arg.model,\n category: arg.category,\n code: arg.code ?? Code.createEmpty(),\n };\n return new this(elementProps, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on insert and validates version..\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on update and validates version..\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation3dProps]($common).\n * Only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n * Also, validates the version of the text annotation data and migrates it if necessary.\n * @beta\n */\n protected static validateVersionAndUpdateGeometry(arg: OnElementPropsArg): void {\n const props = arg.props as TextAnnotation3dProps;\n const textAnnotationData = parseTextAnnotationData(props.textAnnotationData);\n if (!props.elementGeometryBuilderParams && textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(arg.iModel, props.model, props.category, props.placement ?? Placement3d.fromJSON(), textAnnotationData.data, props.defaultTextStyle?.id);\n }\n }\n\n /**\n * TextAnnotation3d custom HandledProps include 'textAnnotationData'.\n * @inheritdoc\n * @internal\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"textAnnotationData\", source: \"Class\" },\n ];\n\n /**\n * TextAnnotation3d deserializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): TextAnnotation3dProps {\n const elProps = super.deserialize(props) as TextAnnotation3dProps;\n const textAnnotationData = parseTextAnnotationData(props.row.textAnnotationData);\n if (textAnnotationData) {\n elProps.textAnnotationData = JSON.stringify(textAnnotationData);\n }\n return elProps;\n }\n\n /**\n * TextAnnotation3d serializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: TextAnnotation3dProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (props.textAnnotationData !== undefined) {\n inst.textAnnotationData = props.textAnnotationData;\n }\n return inst;\n }\n\n /** @internal */\n public getTextBlocks(): Iterable<TextBlockAndId> {\n return getTextBlocks(this);\n }\n\n /** @internal */\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\n return updateTextBlocks(this, textBlocks);\n }\n\n /** @internal */\n public static override onInserted(arg: OnElementIdArg): void {\n super.onInserted(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n /** @internal */\n public static override onUpdated(arg: OnElementIdArg): void {\n super.onUpdated(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n}\n\nfunction getTextBlocks(elem: TextAnnotation2d | TextAnnotation3d): Iterable<TextBlockAndId> {\n const annotation = elem.getAnnotation();\n return annotation ? [{ textBlock: annotation.textBlock, id: undefined }] : [];\n}\n\nfunction updateTextBlocks(elem: TextAnnotation2d | TextAnnotation3d, textBlocks: TextBlockAndId[]): void {\n assert(textBlocks.length === 1);\n assert(textBlocks[0].id === undefined);\n\n const annotation = elem.getAnnotation();\n if (!annotation) {\n // We must obtain the TextBlockAndId from the element in the first place, so the only way we could end up here is if\n // somebody removed the text annotation after we called getTextBlocks. That's gotta be a mistake.\n throw new Error(\"Text annotation element has no text\");\n }\n\n annotation.textBlock = textBlocks[0].textBlock;\n\n elem.setAnnotation(annotation);\n elem.update();\n}\n\n/** The version of the JSON stored in `AnnotationTextStyleProps.settings` used by the code.\n * Uses the same semantics as [ECVersion]($ecschema-metadata).\n * @internal\n*/\nexport const TEXT_STYLE_SETTINGS_JSON_VERSION = \"1.0.0\";\n\nfunction migrateTextStyleSettings(oldData: VersionedJSON<TextStyleSettingsProps>): TextStyleSettingsProps {\n if (oldData.version === TEXT_STYLE_SETTINGS_JSON_VERSION) return oldData.data;\n\n // Place migration logic here.\n\n throw new Error(`Migration for settings from version ${oldData.version} to ${TEXT_STYLE_SETTINGS_JSON_VERSION} failed.`);\n}\n\n/** Arguments supplied when creating an [[AnnotationTextStyle]].\n * @beta\n */\nexport interface TextStyleCreateArgs {\n /** The ID of the [[DefinitionModel]]. */\n definitionModelId: Id64String;\n /** The name to assign to the [[AnnotationTextStyle]]. */\n name: string;\n /** Optional text style settings used to create the [[AnnotationTextStyle]]. Default settings will be used if not provided. */\n settings?: TextStyleSettingsProps;\n /** Optional description for the [[AnnotationTextStyle]]. */\n description?: string;\n}\n\n/**\n * The definition element that holds text style information.\n * The style is stored as a [TextStyleSettings]($common).\n * @beta\n */\nexport class AnnotationTextStyle extends DefinitionElement {\n /** @internal */\n public static override get className(): string { return \"AnnotationTextStyle\"; }\n /**\n * Optional text describing the `AnnotationTextStyle`.\n */\n public description?: string;\n /**\n * The text style settings for the `AnnotationTextStyle`.\n * @see [[TextStyleSettings]] for more information.\n */\n public settings: TextStyleSettings;\n\n protected constructor(props: AnnotationTextStyleProps, iModel: IModelDb) {\n super(props, iModel);\n this.description = props.description;\n const settingsProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\n this.settings = TextStyleSettings.fromJSON(settingsProps?.data);\n }\n\n /**\n * Creates a Code for an `AnnotationTextStyle` given a name that is meant to be unique within the scope of the specified DefinitionModel.\n *\n * @param iModel - The IModelDb.\n * @param definitionModelId - The ID of the DefinitionModel that contains the AnnotationTextStyle and provides the scope for its name.\n * @param name - The AnnotationTextStyle name.\n * @beta\n */\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.annotationTextStyle);\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\n }\n\n /**\n * Creates a new instance of `AnnotationTextStyle` with the specified properties.\n *\n * @param iModelDb - The iModelDb.\n * @param arg - The arguments for creating the AnnotationTextStyle.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextStyleCreateArgs): AnnotationTextStyle {\n const props: AnnotationTextStyleProps = {\n classFullName: this.classFullName,\n model: arg.definitionModelId,\n code: this.createCode(iModelDb, arg.definitionModelId, arg.name).toJSON(),\n description: arg.description,\n settings: arg.settings ? JSON.stringify({version: TEXT_STYLE_SETTINGS_JSON_VERSION, data: arg.settings}) : undefined,\n }\n return new this(props, iModelDb);\n }\n\n /**\n * Converts the current `AnnotationTextStyle` instance to its JSON representation.\n * @inheritdoc\n */\n public override toJSON(): AnnotationTextStyleProps {\n const props = super.toJSON() as AnnotationTextStyleProps;\n props.description = this.description;\n props.settings = JSON.stringify({version: TEXT_STYLE_SETTINGS_JSON_VERSION, data: this.settings.toJSON()});\n return props;\n }\n\n /** Creates a new instance of `AnnotationTextStyle` from its JSON representation. */\n public static fromJSON(props: AnnotationTextStyleProps, iModel: IModelDb): AnnotationTextStyle {\n return new AnnotationTextStyle(props, iModel);\n }\n\n /**\n * Validates that the AnnotationTextStyle's settings are valid before insert.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.validateSettings(arg.props as AnnotationTextStyleProps);\n }\n\n /**\n * Validates that the AnnotationTextStyle's settings are valid before update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.validateSettings(arg.props as AnnotationTextStyleProps);\n }\n\n private static validateSettings(props: AnnotationTextStyleProps): void {\n const settingProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\n if (!settingProps) return;\n const settings = TextStyleSettings.fromJSON(settingProps.data);\n const errors = settings.getValidationErrors();\n if (errors.length > 0) {\n throw new Error(`Invalid AnnotationTextStyle settings: ${errors.join(\", \")}`);\n }\n }\n\n /**\n * AnnotationTextStyle custom HandledProps include 'settings'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"settings\", source: \"Class\" },\n ];\n\n /**\n * AnnotationTextStyle deserializes 'settings'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): AnnotationTextStyleProps {\n const elProps = super.deserialize(props) as AnnotationTextStyleProps;\n const settings = this.parseTextStyleSettings(props.row.settings);\n if (settings) {\n elProps.settings = JSON.stringify(settings);\n }\n return elProps;\n }\n\n /**\n * AnnotationTextStyle serializes 'settings'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: AnnotationTextStyleProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (props.settings !== undefined) {\n inst.settings = props.settings;\n }\n return inst;\n }\n\n /** Parses, validates, and potentially migrates the text style settings data from a JSON string. */\n private static parseTextStyleSettings(json: string | undefined): VersionedJSON<TextStyleSettingsProps> | undefined {\n if (!json) return undefined;\n return validateAndMigrateVersionedJSON<TextStyleSettingsProps>(json, TEXT_STYLE_SETTINGS_JSON_VERSION, migrateTextStyleSettings);\n }\n}"]}
1
+ {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA8DH,0DAIC;AAhED,oDAAic;AAEjc,wCAAoI;AACpI,sDAA+D;AAC/D,uDAAuE;AACvE,qEAAwE;AACxE,+EAAkI;AAGlI,iCAAiC;AAEjC;;;EAGE;AACW,QAAA,4BAA4B,GAAG,OAAO,CAAC;AAEpD,SAAS,+BAA+B,CACtC,IAAY,EACZ,cAA+B,EAC/B,OAAqC;IAErC,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAqB,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IA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S,CAAC;QAC5B,OAAO,+BAA+B,CAAyB,IAAI,EAAE,wCAAgC,EAAE,wBAAwB,CAAC,CAAC;IACnI,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,iBAA6B,EAAE,OAAkC;QAC9F,8FAA8F;QAC9F,IAAI,CAAC,mBAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAClE,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QAED,wDAAwD;QACxD,IAAI,UAAU,GAA2B,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;QACxF,IAAI,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,+CAA+C;QAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAsB,iBAAiB,CAAC,CAAC;QACjG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,mBAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAED,gFAAgF;QAChF,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,0DAA0D;QAC1D,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACrD,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QACpE,OAAO,CAAC,YAAY,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QACpD,OAAO,UAAU,CAAC;IACpB,CAAC;;AA/KH,kDAgLC","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 Elements\n */\n\nimport { AnnotationTextStyleProps, BisCodeSpec, Code, CodeProps, CodeScopeProps, CodeSpec, ECVersionString, ElementGeometry, ElementGeometryBuilderParams, EntityReferenceSet, Placement2d, Placement2dProps, Placement3d, Placement3dProps, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps, traverseTextBlockComponent, VersionedJSON } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\nimport { AnnotationElement2d, DefinitionElement, Drawing, GraphicalElement3d, OnElementIdArg, OnElementPropsArg } from \"../Element\";\nimport { assert, Id64, Id64String } from \"@itwin/core-bentley\";\nimport { layoutTextBlock, TextStyleResolver } from \"./TextBlockLayout\";\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\nimport { ElementDrivesTextAnnotation, TextAnnotationUsesTextStyleByDefault, TextBlockAndId } from \"./ElementDrivesTextAnnotation\";\nimport { IModelElementCloneContext } from \"../IModelElementCloneContext\";\nimport { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from \"../Entity\";\nimport * as semver from \"semver\";\n\n/** The version of the JSON stored in `TextAnnotation2d/3dProps.textAnnotationData` used by the code.\n * Uses the same semantics as [ECVersion]($ecschema-metadata).\n * @internal\n*/\nexport const TEXT_ANNOTATION_JSON_VERSION = \"1.0.0\";\n\nfunction validateAndMigrateVersionedJSON<T>(\n json: string,\n currentVersion: ECVersionString,\n migrate: (old: VersionedJSON<T>) => T\n): VersionedJSON<T> | undefined {\n let parsed;\n try {\n parsed = JSON.parse(json) as VersionedJSON<T>;\n } catch {\n return undefined;\n }\n\n const version = parsed.version;\n if (typeof version !== \"string\" || !semver.valid(version))\n throw new Error(\"JSON version is missing or invalid.\");\n\n if (typeof parsed.data !== \"object\" || parsed.data === null)\n throw new Error(\"JSON data is missing or invalid.\");\n\n // Newer\n if (semver.gt(version, currentVersion))\n throw new Error(`JSON version ${parsed.version} is newer than supported version ${currentVersion}. Application update required to understand data.`);\n\n // Older\n if (semver.lt(version, currentVersion)) {\n parsed.data = migrate(parsed);\n parsed.version = currentVersion;\n }\n\n return parsed;\n}\n\nfunction migrateTextAnnotationData(oldData: VersionedJSON<TextAnnotationProps>): TextAnnotationProps {\n if (oldData.version === TEXT_ANNOTATION_JSON_VERSION) return oldData.data;\n\n // Place migration logic here.\n\n throw new Error(`Migration for textAnnotationData from version ${oldData.version} to ${TEXT_ANNOTATION_JSON_VERSION} failed.`);\n}\n\n/** Parses, validates, and potentially migrates the text annotation data from a JSON string.\n * @internal\n */\nexport function parseTextAnnotationData(json: string | undefined): VersionedJSON<TextAnnotationProps> | undefined {\n if (!json) return undefined;\n\n return validateAndMigrateVersionedJSON<TextAnnotationProps>(json, TEXT_ANNOTATION_JSON_VERSION, migrateTextAnnotationData);\n}\n\nfunction getElementGeometryBuilderParams(iModel: IModelDb, modelId: Id64String, categoryId: Id64String, _placementProps: PlacementProps, annotationProps?: TextAnnotationProps, textStyleId?: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\n const textStyleResolver = new TextStyleResolver({textBlock, textStyleId: textStyleId ?? \"\", iModel});\n const layout = layoutTextBlock({ iModel, textBlock, textStyleResolver });\n const builder = new ElementGeometry.Builder();\n let scaleFactor = 1;\n const element = iModel.elements.getElement(modelId);\n if (element instanceof Drawing)\n scaleFactor = element.scaleFactor;\n appendTextAnnotationGeometry({ layout, textStyleResolver, scaleFactor, annotationProps: annotationProps ?? {}, builder, categoryId });\n\n return { entryArray: builder.entries };\n}\n\n/** Arguments supplied when creating a [[TextAnnotation2d]].\n * @beta\n */\nexport interface TextAnnotation2dCreateArgs {\n /** The category ID for the annotation. */\n category: Id64String;\n /** The model ID where the annotation will be placed. */\n model: Id64String;\n /** The placement properties for the annotation. */\n placement: Placement2dProps;\n /** The default text style ID for the annotation. */\n defaultTextStyleId?: Id64String;\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided. */\n textAnnotationProps?: TextAnnotationProps;\n /** Optional code for the element. */\n code?: CodeProps;\n}\n\n/** Arguments supplied when creating a [[TextAnnotation3d]].\n * @beta\n */\nexport interface TextAnnotation3dCreateArgs {\n /** The category ID for the annotation. */\n category: Id64String;\n /** The model ID where the annotation will be placed. */\n model: Id64String;\n /** The placement properties for the annotation. */\n placement: Placement3dProps;\n /** The default text style ID for the annotation. */\n defaultTextStyleId?: Id64String;\n /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided. */\n textAnnotationProps?: TextAnnotationProps;\n /** Optional code for the element. */\n code?: CodeProps;\n}\n\n/** An element that displays textual content within a 2d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation2d extends AnnotationElement2d /* implements ITextAnnotation */ {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation2d\"; }\n /**\n * The default [[AnnotationTextStyle]] used by the TextAnnotation2d.\n * @beta\n */\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\n /** The data associated with the text annotation. */\n private _textAnnotationProps?: TextAnnotationProps;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n return this._textAnnotationProps ? TextAnnotation.fromJSON(this._textAnnotationProps) : undefined;\n }\n\n /** Change the textual content of the `TextAnnotation2d`.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this._textAnnotationProps = annotation.toJSON();\n }\n\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.defaultTextStyle) {\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\n }\n this._textAnnotationProps = parseTextAnnotationData(props.textAnnotationData)?.data;\n }\n\n /** Creates a new instance of `TextAnnotation2d` from its JSON representation. */\n public static fromJSON(props: TextAnnotation2dProps, iModel: IModelDb): TextAnnotation2d {\n return new TextAnnotation2d(props, iModel);\n }\n\n /**\n * Converts the current `TextAnnotation2d` instance to its JSON representation.\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation2dProps {\n const props = super.toJSON() as TextAnnotation2dProps;\n props.textAnnotationData = this._textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: this._textAnnotationProps }) : undefined;\n if (this._textAnnotationProps) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.category, this.placement, this._textAnnotationProps, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation2d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param arg The arguments for creating the TextAnnotation2d.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextAnnotation2dCreateArgs): TextAnnotation2d {\n const elementProps: TextAnnotation2dProps = {\n classFullName: this.classFullName,\n textAnnotationData: arg.textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: arg.textAnnotationProps }) : undefined,\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\n placement: arg.placement,\n model: arg.model,\n category: arg.category,\n code: arg.code ?? Code.createEmpty(),\n };\n return new this(elementProps, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on insert and validates version.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on update and validates version.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation2dProps]($common).\n * Only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n * Also, validates the version of the text annotation data and migrates it if necessary.\n * @beta\n */\n protected static validateVersionAndUpdateGeometry(arg: OnElementPropsArg): void {\n const props = arg.props as TextAnnotation2dProps;\n const textAnnotationData = parseTextAnnotationData(props.textAnnotationData);\n if (!props.elementGeometryBuilderParams && textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(arg.iModel, props.model, props.category, props.placement ?? Placement2d.fromJSON(), textAnnotationData.data, props.defaultTextStyle?.id);\n }\n }\n\n /**\n * TextAnnotation2d custom HandledProps include 'textAnnotationData'.\n * @inheritdoc\n * @internal\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"textAnnotationData\", source: \"Class\" },\n ];\n\n /**\n * TextAnnotation2d deserializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): TextAnnotation2dProps {\n const elProps = super.deserialize(props) as TextAnnotation2dProps;\n const textAnnotationData = parseTextAnnotationData(props.row.textAnnotationData);\n if (textAnnotationData) {\n elProps.textAnnotationData = JSON.stringify(textAnnotationData);\n }\n return elProps;\n }\n\n /**\n * TextAnnotation2d serializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: TextAnnotation2dProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (props.textAnnotationData !== undefined) {\n inst.textAnnotationData = props.textAnnotationData;\n }\n return inst;\n }\n\n /** @internal */\n public getTextBlocks(): Iterable<TextBlockAndId> {\n return getTextBlocks(this);\n }\n\n /** @internal */\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\n return updateTextBlocks(this, textBlocks);\n }\n\n /** @internal */\n public static override onInserted(arg: OnElementIdArg): void {\n super.onInserted(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n /** @internal */\n public static override onUpdated(arg: OnElementIdArg): void {\n super.onUpdated(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n collectReferenceIds(this, referenceIds);\n }\n\n /** @internal */\n protected static override onCloned(context: IModelElementCloneContext, srcProps: TextAnnotation2dProps, dstProps: TextAnnotation2dProps): void {\n super.onCloned(context, srcProps, dstProps);\n\n const srcElem = TextAnnotation2d.fromJSON(srcProps, context.sourceDb);\n ElementDrivesTextAnnotation.remapFields(srcElem, context);\n const anno = srcElem.getAnnotation();\ndstProps.textAnnotationData = anno ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: anno.toJSON() }) : undefined;\n\n remapTextStyle(context, srcElem, dstProps);\n }\n}\n\n/** An element that displays textual content within a 3d model.\n * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.\n * @see [[setAnnotation]] to change the textual content.\n * @public @preview\n */\nexport class TextAnnotation3d extends GraphicalElement3d /* implements ITextAnnotation */ {\n /** @internal */\n public static override get className(): string { return \"TextAnnotation3d\"; }\n /**\n * The default [[AnnotationTextStyle]] used by the TextAnnotation3d.\n * @beta\n */\n public defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;\n /** The data associated with the text annotation. */\n private _textAnnotationProps?: TextAnnotationProps;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n return this._textAnnotationProps ? TextAnnotation.fromJSON(this._textAnnotationProps) : undefined;\n }\n\n /** Change the textual content of the `TextAnnotation3d`.\n * @see [[getAnnotation]] to extract the current annotation.\n * @param annotation The new annotation\n */\n public setAnnotation(annotation: TextAnnotation) {\n this._textAnnotationProps = annotation.toJSON();\n }\n\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.defaultTextStyle) {\n this.defaultTextStyle = new TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);\n }\n this._textAnnotationProps = parseTextAnnotationData(props.textAnnotationData)?.data;\n }\n\n /** Creates a new instance of `TextAnnotation3d` from its JSON representation. */\n public static fromJSON(props: TextAnnotation3dProps, iModel: IModelDb): TextAnnotation3d {\n return new TextAnnotation3d(props, iModel);\n }\n\n /**\n * Converts the current `TextAnnotation3d` instance to its JSON representation.\n * It also computes the `elementGeometryBuilderParams` property used to create the GeometryStream.\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation3dProps {\n const props = super.toJSON() as TextAnnotation3dProps;\n props.textAnnotationData = this._textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: this._textAnnotationProps }) : undefined;\n if (this._textAnnotationProps) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.category, this.placement, this._textAnnotationProps, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation3d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param arg The arguments for creating the TextAnnotation3d.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextAnnotation3dCreateArgs): TextAnnotation3d {\n const elementProps: TextAnnotation3dProps = {\n classFullName: this.classFullName,\n textAnnotationData: arg.textAnnotationProps ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: arg.textAnnotationProps }) : undefined,\n defaultTextStyle: arg.defaultTextStyleId ? new TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,\n placement: arg.placement,\n model: arg.model,\n category: arg.category,\n code: arg.code ?? Code.createEmpty(),\n };\n return new this(elementProps, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on insert and validates version..\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on update and validates version..\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.validateVersionAndUpdateGeometry(arg);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation3dProps]($common).\n * Only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n * Also, validates the version of the text annotation data and migrates it if necessary.\n * @beta\n */\n protected static validateVersionAndUpdateGeometry(arg: OnElementPropsArg): void {\n const props = arg.props as TextAnnotation3dProps;\n const textAnnotationData = parseTextAnnotationData(props.textAnnotationData);\n if (!props.elementGeometryBuilderParams && textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(arg.iModel, props.model, props.category, props.placement ?? Placement3d.fromJSON(), textAnnotationData.data, props.defaultTextStyle?.id);\n }\n }\n\n /**\n * TextAnnotation3d custom HandledProps include 'textAnnotationData'.\n * @inheritdoc\n * @internal\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"textAnnotationData\", source: \"Class\" },\n ];\n\n /**\n * TextAnnotation3d deserializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): TextAnnotation3dProps {\n const elProps = super.deserialize(props) as TextAnnotation3dProps;\n const textAnnotationData = parseTextAnnotationData(props.row.textAnnotationData);\n if (textAnnotationData) {\n elProps.textAnnotationData = JSON.stringify(textAnnotationData);\n }\n return elProps;\n }\n\n /**\n * TextAnnotation3d serializes 'textAnnotationData'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: TextAnnotation3dProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (props.textAnnotationData !== undefined) {\n inst.textAnnotationData = props.textAnnotationData;\n }\n return inst;\n }\n\n /** @internal */\n public getTextBlocks(): Iterable<TextBlockAndId> {\n return getTextBlocks(this);\n }\n\n /** @internal */\n public updateTextBlocks(textBlocks: TextBlockAndId[]): void {\n return updateTextBlocks(this, textBlocks);\n }\n\n /** @internal */\n public static override onInserted(arg: OnElementIdArg): void {\n super.onInserted(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n /** @internal */\n public static override onUpdated(arg: OnElementIdArg): void {\n super.onUpdated(arg);\n ElementDrivesTextAnnotation.updateFieldDependencies(arg.id, arg.iModel);\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n collectReferenceIds(this, referenceIds);\n }\n\n /** @internal */\n protected static override onCloned(context: IModelElementCloneContext, srcProps: TextAnnotation3dProps, dstProps: TextAnnotation3dProps): void {\n super.onCloned(context, srcProps, dstProps);\n\n const srcElem = TextAnnotation3d.fromJSON(srcProps, context.sourceDb);\n ElementDrivesTextAnnotation.remapFields(srcElem, context);\n const anno = srcElem.getAnnotation();\n dstProps.textAnnotationData = anno ? JSON.stringify({ version: TEXT_ANNOTATION_JSON_VERSION, data: anno.toJSON() }) : undefined;\n\n remapTextStyle(context, srcElem, dstProps);\n }\n}\n\nfunction remapTextStyle(\n context: IModelElementCloneContext,\n srcElem: TextAnnotation2d | TextAnnotation3d,\n dstProps: TextAnnotation2dProps | TextAnnotation3dProps\n): void {\n const dstStyleId = AnnotationTextStyle.remapTextStyleId(srcElem.defaultTextStyle?.id ?? Id64.invalid, context);\n dstProps.defaultTextStyle = Id64.isValid(dstStyleId) ? new TextAnnotationUsesTextStyleByDefault(dstStyleId).toJSON() : undefined;\n}\n\nfunction collectReferenceIds(elem: TextAnnotation2d | TextAnnotation3d, referenceIds: EntityReferenceSet): void {\n const style = elem.defaultTextStyle?.id;\n if (style && Id64.isValidId64(style)) {\n referenceIds.addElement(style);\n }\n\n const block = elem.getAnnotation()?.textBlock;\n if (block) {\n for (const { child } of traverseTextBlockComponent(block)) {\n if (child.type === \"field\") {\n const hostId = child.propertyHost.elementId;\n if (Id64.isValidId64(hostId)) {\n referenceIds.addElement(hostId);\n }\n }\n }\n }\n}\n\nfunction getTextBlocks(elem: TextAnnotation2d | TextAnnotation3d): Iterable<TextBlockAndId> {\n const annotation = elem.getAnnotation();\n return annotation ? [{ textBlock: annotation.textBlock, id: undefined }] : [];\n}\n\nfunction updateTextBlocks(elem: TextAnnotation2d | TextAnnotation3d, textBlocks: TextBlockAndId[]): void {\n assert(textBlocks.length === 1);\n assert(textBlocks[0].id === undefined);\n\n const annotation = elem.getAnnotation();\n if (!annotation) {\n // We must obtain the TextBlockAndId from the element in the first place, so the only way we could end up here is if\n // somebody removed the text annotation after we called getTextBlocks. That's gotta be a mistake.\n throw new Error(\"Text annotation element has no text\");\n }\n\n annotation.textBlock = textBlocks[0].textBlock;\n\n elem.setAnnotation(annotation);\n}\n\n/** The version of the JSON stored in `AnnotationTextStyleProps.settings` used by the code.\n * Uses the same semantics as [ECVersion]($ecschema-metadata).\n * @internal\n*/\nexport const TEXT_STYLE_SETTINGS_JSON_VERSION = \"1.0.0\";\n\nfunction migrateTextStyleSettings(oldData: VersionedJSON<TextStyleSettingsProps>): TextStyleSettingsProps {\n if (oldData.version === TEXT_STYLE_SETTINGS_JSON_VERSION) return oldData.data;\n\n // Place migration logic here.\n\n throw new Error(`Migration for settings from version ${oldData.version} to ${TEXT_STYLE_SETTINGS_JSON_VERSION} failed.`);\n}\n\n/** Arguments supplied when creating an [[AnnotationTextStyle]].\n * @beta\n */\nexport interface TextStyleCreateArgs {\n /** The ID of the [[DefinitionModel]]. */\n definitionModelId: Id64String;\n /** The name to assign to the [[AnnotationTextStyle]]. */\n name: string;\n /** Optional text style settings used to create the [[AnnotationTextStyle]]. Default settings will be used if not provided. */\n settings?: TextStyleSettingsProps;\n /** Optional description for the [[AnnotationTextStyle]]. */\n description?: string;\n}\n\n/**\n * The definition element that holds text style information.\n * The style is stored as a [TextStyleSettings]($common).\n * @beta\n */\nexport class AnnotationTextStyle extends DefinitionElement {\n /** @internal */\n public static override get className(): string { return \"AnnotationTextStyle\"; }\n /**\n * Optional text describing the `AnnotationTextStyle`.\n */\n public description?: string;\n /**\n * The text style settings for the `AnnotationTextStyle`.\n * @see [[TextStyleSettings]] for more information.\n */\n public settings: TextStyleSettings;\n\n protected constructor(props: AnnotationTextStyleProps, iModel: IModelDb) {\n super(props, iModel);\n this.description = props.description;\n const settingsProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\n this.settings = TextStyleSettings.fromJSON(settingsProps?.data);\n }\n\n /**\n * Creates a Code for an `AnnotationTextStyle` given a name that is meant to be unique within the scope of the specified DefinitionModel.\n *\n * @param iModel - The IModelDb.\n * @param definitionModelId - The ID of the DefinitionModel that contains the AnnotationTextStyle and provides the scope for its name.\n * @param name - The AnnotationTextStyle name.\n * @beta\n */\n public static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code {\n const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.annotationTextStyle);\n return new Code({ spec: codeSpec.id, scope: definitionModelId, value: name });\n }\n\n /**\n * Creates a new instance of `AnnotationTextStyle` with the specified properties.\n *\n * @param iModelDb - The iModelDb.\n * @param arg - The arguments for creating the AnnotationTextStyle.\n * @beta\n */\n public static create(iModelDb: IModelDb, arg: TextStyleCreateArgs): AnnotationTextStyle {\n const props: AnnotationTextStyleProps = {\n classFullName: this.classFullName,\n model: arg.definitionModelId,\n code: this.createCode(iModelDb, arg.definitionModelId, arg.name).toJSON(),\n description: arg.description,\n settings: arg.settings ? JSON.stringify({version: TEXT_STYLE_SETTINGS_JSON_VERSION, data: arg.settings}) : undefined,\n }\n return new this(props, iModelDb);\n }\n\n /**\n * Converts the current `AnnotationTextStyle` instance to its JSON representation.\n * @inheritdoc\n */\n public override toJSON(): AnnotationTextStyleProps {\n const props = super.toJSON() as AnnotationTextStyleProps;\n props.description = this.description;\n props.settings = JSON.stringify({version: TEXT_STYLE_SETTINGS_JSON_VERSION, data: this.settings.toJSON()});\n return props;\n }\n\n /** Creates a new instance of `AnnotationTextStyle` from its JSON representation. */\n public static fromJSON(props: AnnotationTextStyleProps, iModel: IModelDb): AnnotationTextStyle {\n return new AnnotationTextStyle(props, iModel);\n }\n\n /**\n * Validates that the AnnotationTextStyle's settings are valid before insert.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.validateSettings(arg.props as AnnotationTextStyleProps);\n }\n\n /**\n * Validates that the AnnotationTextStyle's settings are valid before update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.validateSettings(arg.props as AnnotationTextStyleProps);\n }\n\n private static validateSettings(props: AnnotationTextStyleProps): void {\n const settingProps = AnnotationTextStyle.parseTextStyleSettings(props.settings);\n if (!settingProps) return;\n const settings = TextStyleSettings.fromJSON(settingProps.data);\n const errors = settings.getValidationErrors();\n if (errors.length > 0) {\n throw new Error(`Invalid AnnotationTextStyle settings: ${errors.join(\", \")}`);\n }\n }\n\n /**\n * AnnotationTextStyle custom HandledProps include 'settings'.\n * @inheritdoc\n * @beta\n */\n protected static override readonly _customHandledProps: CustomHandledProperty[] = [\n { propertyName: \"settings\", source: \"Class\" },\n ];\n\n /**\n * AnnotationTextStyle deserializes 'settings'.\n * @inheritdoc\n * @beta\n */\n public static override deserialize(props: DeserializeEntityArgs): AnnotationTextStyleProps {\n const elProps = super.deserialize(props) as AnnotationTextStyleProps;\n const settings = this.parseTextStyleSettings(props.row.settings);\n if (settings) {\n elProps.settings = JSON.stringify(settings);\n }\n return elProps;\n }\n\n /**\n * AnnotationTextStyle serializes 'settings'.\n * @inheritdoc\n * @beta\n */\n public static override serialize(props: AnnotationTextStyleProps, iModel: IModelDb): ECSqlRow {\n const inst = super.serialize(props, iModel);\n if (props.settings !== undefined) {\n inst.settings = props.settings;\n }\n return inst;\n }\n\n /** Parses, validates, and potentially migrates the text style settings data from a JSON string. */\n private static parseTextStyleSettings(json: string | undefined): VersionedJSON<TextStyleSettingsProps> | undefined {\n if (!json) return undefined;\n return validateAndMigrateVersionedJSON<TextStyleSettingsProps>(json, TEXT_STYLE_SETTINGS_JSON_VERSION, migrateTextStyleSettings);\n }\n\n /** When copying an element from one iModel to another, returns the Id of the AnnotationTextStyle in the `context`'s target iModel\n * corresponding to `sourceTextStyleId`, or [Id64.invalid]($bentley) if no corresponding text style exists.\n * If a text style with the same [Code]($common) exists in the target iModel, the style Id will be remapped to refer to that style.\n * Otherwise, a copy of the style will be imported into the target iModel and its element Id returned.\n * Implementations of [[ITextAnnotation]] should invoke this function when implementing their [[Element._onCloned]] method.\n * @throws Error if an attempt to import the text style failed.\n */\n public static remapTextStyleId(sourceTextStyleId: Id64String, context: IModelElementCloneContext): Id64String {\n // No remapping necessary if there's no text style or we're not copying to a different iModel.\n if (!Id64.isValid(sourceTextStyleId) || !context.isBetweenIModels) {\n return sourceTextStyleId;\n }\n\n // If the style's already been remapped, we're finished.\n let dstStyleId: Id64String | undefined = context.findTargetElementId(sourceTextStyleId);\n if (Id64.isValid(dstStyleId)) {\n return dstStyleId;\n }\n\n // Look up the style. It really ought to exist.\n const srcStyle = context.sourceDb.elements.tryGetElement<AnnotationTextStyle>(sourceTextStyleId);\n if (!srcStyle) {\n return Id64.invalid;\n }\n\n // If a style with the same code exists in the target iModel, remap to that one.\n dstStyleId = context.targetDb.elements.queryElementIdByCode(srcStyle.code);\n if (undefined !== dstStyleId) {\n return dstStyleId;\n }\n\n // Copy the style into the target iModel and remap its Id.\n const dstStyleProps = context.cloneElement(srcStyle);\n dstStyleId = context.targetDb.elements.insertElement(dstStyleProps);\n context.remapElement(sourceTextStyleId, dstStyleId);\n return dstStyleId;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/internal/annotations/fields.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0D,QAAQ,EAAE,UAAU,EAAoB,iBAAiB,EAAE,SAAS,EAA8B,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAmC,UAAU,EAAU,MAAM,qBAAqB,CAAC;AA8B1F,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IAEnC,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAA;CACrD;AAsLD,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,mBAAmB,CAKlH;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAsBlF;AAID,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,CASvF;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAmBtG"}
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../../src/internal/annotations/fields.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0D,QAAQ,EAAE,UAAU,EAAoB,iBAAiB,EAAE,SAAS,EAA8B,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAmC,UAAU,EAAU,MAAM,qBAAqB,CAAC;AA8B1F,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IAEnC,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAA;CACrD;AAsLD,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,mBAAmB,CAKlH;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAsBlF;AAID,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,CASvF;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAoBtG"}
@@ -232,6 +232,7 @@ function updateElementFields(props, iModel, deleted) {
232
232
  }
233
233
  if (updatedBlocks.length > 0) {
234
234
  target.updateTextBlocks(updatedBlocks);
235
+ target.update();
235
236
  }
236
237
  }
237
238
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/internal/annotations/fields.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;AA4N/F,kDAKC;AAGD,kCAsBC;AAID,oCASC;AAGD,kDAmBC;AA3RD,oDAA8L;AAE9L,sDAA0F;AAC1F,uEAAoE;AACpE,+FAAkF;AAClF,gEAA6H;AAiC7H,0EAA0E;AAC1E,SAAS,qBAAqB,CAAC,KAAe,EAAE,MAAgB;IAC9D,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;IAChC,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3F,IAAI,CAAC,+BAAW,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,GAAa,UAAU,CAAC;IACnC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE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AC;QAC9D,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;YAC1D,EAAE,UAAU,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,uHAAuH;AACvH,SAAgB,mBAAmB,CAAC,KAAwB,EAAE,MAAgB,EAAE,OAAgB;IAC9F,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC1D,IAAI,IAAA,+CAAiB,EAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACrE,MAAM,aAAa,GAAG,EAAE,CAAC;YACzB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC;gBAC3C,IAAI,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;oBAC3C,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC","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\nimport { ECSqlValueType, FieldPrimitiveValue, FieldPropertyType, FieldRun, FieldValue, formatFieldValue, RelationshipProps, TextBlock, traverseTextBlockComponent } from \"@itwin/core-common\";\nimport { IModelDb } from \"../../IModelDb\";\nimport { assert, DbResult, expectDefined, Id64String, Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"../../BackendLoggerCategory\";\nimport { isITextAnnotation } from \"../../annotations/ElementDrivesTextAnnotation\";\nimport { AnyClass, EntityClass, PrimitiveType, Property, PropertyType, StructArrayProperty } from \"@itwin/ecschema-metadata\";\n\ninterface FieldStructValue { [key: string]: any }\n\n// An intermediate value obtained while evaluating a FieldPropertyPath.\ntype FieldValueType = {\n primitive: FieldPrimitiveValue;\n struct?: never;\n primitiveArray?: never;\n structArray?: never;\n} | {\n primitive?: never;\n struct: FieldStructValue;\n primitiveArray?: never;\n structArray?: never;\n} | {\n primitive?: never;\n struct?: never;\n primitiveArray: FieldPrimitiveValue[];\n structArray?: never;\n} | {\n primitive?: never;\n struct?: never;\n primitiveArray?: never;\n structArray: FieldStructValue[];\n}\n\nexport interface UpdateFieldsContext {\n readonly hostElementId: Id64String;\n\n getProperty(field: FieldRun): FieldValue | undefined\n}\n\n// Resolve the raw primitive value of the property that a field points to.\nfunction getFieldPropertyValue(field: FieldRun, iModel: IModelDb): FieldValue | undefined {\n const host = field.propertyHost;\n const schemaItem = iModel.schemaContext.getSchemaItemSync(host.schemaName, host.className);\n if (!EntityClass.isEntityClass(schemaItem)) {\n return undefined;\n }\n\n let ecClass: AnyClass = schemaItem;\n const { propertyName, accessors } = field.propertyPath;\n let ecProp = ecClass.getPropertySync(propertyName);\n if (!ecProp) {\n return undefined;\n }\n\n const isAspect = ecClass.isSync(\"ElementAspect\", \"BisCore\");\n const where = ` WHERE ${isAspect ? \"Element.Id\" : \"ECInstanceId\"}=${host.elementId}`;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n let curValue: FieldValueType | undefined = iModel.withPreparedStatement(`SELECT ${propertyName} FROM ${host.schemaName}.${host.className} ${where}`, (stmt) => {\n if (stmt.step() !== DbResult.BE_SQLITE_ROW) {\n return undefined;\n }\n\n const rootValue = stmt.getValue(0);\n if (undefined === rootValue || rootValue.isNull) {\n return undefined;\n }\n\n switch (rootValue.columnInfo.getType()) {\n case ECSqlValueType.Blob:\n return { primitive: rootValue.getBlob() };\n case ECSqlValueType.Boolean:\n return { primitive: rootValue.getBoolean() };\n case ECSqlValueType.DateTime:\n return { primitive: new Date(rootValue.getDateTime()) };\n case ECSqlValueType.Double:\n return { primitive: rootValue.getDouble() };\n case ECSqlValueType.Guid:\n return { primitive: rootValue.getGuid() };\n case ECSqlValueType.Int:\n case ECSqlValueType.Int64:\n return { primitive: rootValue.getInteger() };\n case ECSqlValueType.Point2d:\n return { primitive: rootValue.getXAndY() };\n case ECSqlValueType.Point3d:\n return { primitive: rootValue.getXYAndZ() };\n case ECSqlValueType.String:\n return { primitive: rootValue.getString() };\n case ECSqlValueType.Struct: {\n ecProp = expectDefined(ecProp);\n assert(ecProp.isStruct());\n ecClass = ecProp.structClass;\n return { struct: rootValue.getStruct() };\n }\n case ECSqlValueType.PrimitiveArray: {\n return { primitiveArray: rootValue.getArray() };\n }\n case ECSqlValueType.StructArray: {\n return { structArray: rootValue.getArray() };\n }\n // Unsupported:\n // case ECSqlValueType.Geometry:\n // case ECSqlValueType.Navigation:\n // case ECSqlValueType.Id:\n }\n\n return undefined;\n });\n\n if (undefined === curValue) {\n return undefined;\n }\n\n if (accessors) {\n for (const accessor of accessors) {\n if (undefined !== curValue.primitive) {\n // Can't index into a primitive.\n return undefined;\n }\n\n if (typeof accessor === \"number\") {\n const array: FieldPrimitiveValue[] | FieldStructValue[] | undefined = curValue.primitiveArray ?? curValue.structArray;\n if (!array) {\n return undefined;\n }\n\n const index: number = accessor < 0 ? (array.length + accessor) : accessor;\n const item: FieldPrimitiveValue | FieldStructValue = array[index];\n if (undefined === item) {\n return undefined;\n } else if (curValue.primitiveArray) {\n curValue = { primitive: curValue.primitiveArray[index] };\n } else {\n assert(undefined !== curValue.structArray);\n assert(ecProp instanceof StructArrayProperty);\n\n ecClass = ecProp.structClass;\n curValue = { struct: curValue.structArray[index] };\n }\n } else {\n if (undefined === curValue.struct) {\n return undefined;\n }\n\n const item: any = curValue.struct[accessor];\n if (undefined === item) {\n return undefined;\n }\n\n ecProp = ecClass.getPropertySync(accessor);\n if (!ecProp) {\n return undefined;\n }\n\n if (ecProp.isArray()) {\n curValue = ecProp.isStruct() ? { structArray: item } : { primitiveArray: item };\n } else if (ecProp.isStruct()) {\n ecClass = ecProp.structClass;\n curValue = { struct: item };\n } else if (ecProp.isPrimitive()) {\n curValue = { primitive: item };\n } else {\n return undefined;\n }\n }\n }\n }\n\n const propertyType = determineFieldPropertyType(ecProp);\n if(!propertyType) {\n return undefined;\n }\n\n // The ultimate result must be a primitive value.\n if (undefined === curValue.primitive) {\n return undefined;\n }\n\n return { value: curValue.primitive, type: propertyType };\n}\n\nfunction determineFieldPropertyType(prop: Property): FieldPropertyType | undefined {\n if (prop.isEnumeration()) {\n switch (prop.propertyType) {\n case PropertyType.Integer_Enumeration:\n return \"int-enum\";\n case PropertyType.String_Enumeration:\n return \"string-enum\";\n default:\n return undefined;\n }\n }\n\n if (prop.isPrimitive()) {\n switch (prop.primitiveType) {\n case PrimitiveType.Boolean:\n return \"boolean\";\n case PrimitiveType.String:\n return prop.extendedTypeName === \"DateTime\" ? \"datetime\" : \"string\";\n case PrimitiveType.DateTime:\n return \"datetime\";\n case PrimitiveType.Double:\n case PrimitiveType.Long:\n return \"quantity\";\n case PrimitiveType.Point2d:\n case PrimitiveType.Point3d:\n return \"coordinate\";\n case PrimitiveType.Binary:\n return prop.extendedTypeName === \"BeGuid\" ? \"string\" : undefined;\n case PrimitiveType.Integer:\n case PrimitiveType.Long:\n return \"string\";\n default:\n return undefined;\n }\n }\n\n return undefined;\n}\n\nexport function createUpdateContext(hostElementId: string, iModel: IModelDb, deleted: boolean): UpdateFieldsContext {\n return {\n hostElementId,\n getProperty: deleted ? () => undefined : (field) => getFieldPropertyValue(field, iModel),\n };\n}\n\n// Recompute the display value of a single field, return false if it couldn't be evaluated.\nexport function updateField(field: FieldRun, context: UpdateFieldsContext): boolean {\n if (context.hostElementId !== field.propertyHost.elementId) {\n return false;\n }\n\n let newContent: string | undefined;\n try {\n const propValue = context.getProperty(field);\n if (undefined !== propValue) {\n newContent = formatFieldValue(propValue, field.formatOptions);\n }\n } catch (err) {\n Logger.logException(BackendLoggerCategory.IModelDb, err);\n }\n\n newContent = newContent ?? FieldRun.invalidContentIndicator;\n if (newContent === field.cachedContent) {\n return false;\n }\n\n field.setCachedContent(newContent);\n return true;\n}\n\n// Re-evaluates the display strings for all fields that target the element specified by `context` and returns the number\n// of fields whose display strings changed as a result.\nexport function updateFields(textBlock: TextBlock, context: UpdateFieldsContext): number {\n let numUpdated = 0;\n for (const { child } of traverseTextBlockComponent(textBlock)) {\n if (child.type === \"field\" && updateField(child, context)) {\n ++numUpdated;\n }\n }\n\n return numUpdated;\n}\n\n// Invoked by ElementDrivesTextAnnotation to update fields in target element when source element changes or is deleted.\nexport function updateElementFields(props: RelationshipProps, iModel: IModelDb, deleted: boolean): void {\n try {\n const target = iModel.elements.getElement(props.targetId);\n if (isITextAnnotation(target)) {\n const context = createUpdateContext(props.sourceId, iModel, deleted);\n const updatedBlocks = [];\n for (const block of target.getTextBlocks()) {\n if (updateFields(block.textBlock, context)) {\n updatedBlocks.push(block);\n }\n }\n\n if (updatedBlocks.length > 0) {\n target.updateTextBlocks(updatedBlocks);\n }\n }\n } catch (err) {\n Logger.logException(BackendLoggerCategory.IModelDb, err);\n }\n}\n\n"]}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/internal/annotations/fields.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;AA4N/F,kDAKC;AAGD,kCAsBC;AAID,oCASC;AAGD,kDAoBC;AA5RD,oDAA8L;AAE9L,sDAA0F;AAC1F,uEAAoE;AACpE,+FAAkF;AAClF,gEAA6H;AAiC7H,0EAA0E;AAC1E,SAA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BAAgB,CAAC,aAAa,CAAC,CAAC;gBACvC,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC","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\nimport { ECSqlValueType, FieldPrimitiveValue, FieldPropertyType, FieldRun, FieldValue, formatFieldValue, RelationshipProps, TextBlock, traverseTextBlockComponent } from \"@itwin/core-common\";\nimport { IModelDb } from \"../../IModelDb\";\nimport { assert, DbResult, expectDefined, Id64String, Logger } from \"@itwin/core-bentley\";\nimport { BackendLoggerCategory } from \"../../BackendLoggerCategory\";\nimport { isITextAnnotation } from \"../../annotations/ElementDrivesTextAnnotation\";\nimport { AnyClass, EntityClass, PrimitiveType, Property, PropertyType, StructArrayProperty } from \"@itwin/ecschema-metadata\";\n\ninterface FieldStructValue { [key: string]: any }\n\n// An intermediate value obtained while evaluating a FieldPropertyPath.\ntype FieldValueType = {\n primitive: FieldPrimitiveValue;\n struct?: never;\n primitiveArray?: never;\n structArray?: never;\n} | {\n primitive?: never;\n struct: FieldStructValue;\n primitiveArray?: never;\n structArray?: never;\n} | {\n primitive?: never;\n struct?: never;\n primitiveArray: FieldPrimitiveValue[];\n structArray?: never;\n} | {\n primitive?: never;\n struct?: never;\n primitiveArray?: never;\n structArray: FieldStructValue[];\n}\n\nexport interface UpdateFieldsContext {\n readonly hostElementId: Id64String;\n\n getProperty(field: FieldRun): FieldValue | undefined\n}\n\n// Resolve the raw primitive value of the property that a field points to.\nfunction getFieldPropertyValue(field: FieldRun, iModel: IModelDb): FieldValue | undefined {\n const host = field.propertyHost;\n const schemaItem = iModel.schemaContext.getSchemaItemSync(host.schemaName, host.className);\n if (!EntityClass.isEntityClass(schemaItem)) {\n return undefined;\n }\n\n let ecClass: AnyClass = schemaItem;\n const { propertyName, accessors } = field.propertyPath;\n let ecProp = ecClass.getPropertySync(propertyName);\n if (!ecProp) {\n return undefined;\n }\n\n const isAspect = ecClass.isSync(\"ElementAspect\", \"BisCore\");\n const where = ` WHERE ${isAspect ? \"Element.Id\" : \"ECInstanceId\"}=${host.elementId}`;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n let curValue: FieldValueType | undefined = iModel.withPreparedStatement(`SELECT ${propertyName} FROM ${host.schemaName}.${host.className} ${where}`, (stmt) => {\n if (stmt.step() !== DbResult.BE_SQLITE_ROW) {\n return undefined;\n }\n\n const rootValue = stmt.getValue(0);\n if (undefined === rootValue || rootValue.isNull) {\n return undefined;\n }\n\n switch (rootValue.columnInfo.getType()) {\n case ECSqlValueType.Blob:\n return { primitive: rootValue.getBlob() };\n case ECSqlValueType.Boolean:\n return { primitive: rootValue.getBoolean() };\n case ECSqlValueType.DateTime:\n return { primitive: new Date(rootValue.getDateTime()) };\n case ECSqlValueType.Double:\n return { primitive: rootValue.getDouble() };\n case ECSqlValueType.Guid:\n return { primitive: rootValue.getGuid() };\n case ECSqlValueType.Int:\n case ECSqlValueType.Int64:\n return { primitive: rootValue.getInteger() };\n case ECSqlValueType.Point2d:\n return { primitive: rootValue.getXAndY() };\n case ECSqlValueType.Point3d:\n return { primitive: rootValue.getXYAndZ() };\n case ECSqlValueType.String:\n return { primitive: rootValue.getString() };\n case ECSqlValueType.Struct: {\n ecProp = expectDefined(ecProp);\n assert(ecProp.isStruct());\n ecClass = ecProp.structClass;\n return { struct: rootValue.getStruct() };\n }\n case ECSqlValueType.PrimitiveArray: {\n return { primitiveArray: rootValue.getArray() };\n }\n case ECSqlValueType.StructArray: {\n return { structArray: rootValue.getArray() };\n }\n // Unsupported:\n // case ECSqlValueType.Geometry:\n // case ECSqlValueType.Navigation:\n // case ECSqlValueType.Id:\n }\n\n return undefined;\n });\n\n if (undefined === curValue) {\n return undefined;\n }\n\n if (accessors) {\n for (const accessor of accessors) {\n if (undefined !== curValue.primitive) {\n // Can't index into a primitive.\n return undefined;\n }\n\n if (typeof accessor === \"number\") {\n const array: FieldPrimitiveValue[] | FieldStructValue[] | undefined = curValue.primitiveArray ?? curValue.structArray;\n if (!array) {\n return undefined;\n }\n\n const index: number = accessor < 0 ? (array.length + accessor) : accessor;\n const item: FieldPrimitiveValue | FieldStructValue = array[index];\n if (undefined === item) {\n return undefined;\n } else if (curValue.primitiveArray) {\n curValue = { primitive: curValue.primitiveArray[index] };\n } else {\n assert(undefined !== curValue.structArray);\n assert(ecProp instanceof StructArrayProperty);\n\n ecClass = ecProp.structClass;\n curValue = { struct: curValue.structArray[index] };\n }\n } else {\n if (undefined === curValue.struct) {\n return undefined;\n }\n\n const item: any = curValue.struct[accessor];\n if (undefined === item) {\n return undefined;\n }\n\n ecProp = ecClass.getPropertySync(accessor);\n if (!ecProp) {\n return undefined;\n }\n\n if (ecProp.isArray()) {\n curValue = ecProp.isStruct() ? { structArray: item } : { primitiveArray: item };\n } else if (ecProp.isStruct()) {\n ecClass = ecProp.structClass;\n curValue = { struct: item };\n } else if (ecProp.isPrimitive()) {\n curValue = { primitive: item };\n } else {\n return undefined;\n }\n }\n }\n }\n\n const propertyType = determineFieldPropertyType(ecProp);\n if(!propertyType) {\n return undefined;\n }\n\n // The ultimate result must be a primitive value.\n if (undefined === curValue.primitive) {\n return undefined;\n }\n\n return { value: curValue.primitive, type: propertyType };\n}\n\nfunction determineFieldPropertyType(prop: Property): FieldPropertyType | undefined {\n if (prop.isEnumeration()) {\n switch (prop.propertyType) {\n case PropertyType.Integer_Enumeration:\n return \"int-enum\";\n case PropertyType.String_Enumeration:\n return \"string-enum\";\n default:\n return undefined;\n }\n }\n\n if (prop.isPrimitive()) {\n switch (prop.primitiveType) {\n case PrimitiveType.Boolean:\n return \"boolean\";\n case PrimitiveType.String:\n return prop.extendedTypeName === \"DateTime\" ? \"datetime\" : \"string\";\n case PrimitiveType.DateTime:\n return \"datetime\";\n case PrimitiveType.Double:\n case PrimitiveType.Long:\n return \"quantity\";\n case PrimitiveType.Point2d:\n case PrimitiveType.Point3d:\n return \"coordinate\";\n case PrimitiveType.Binary:\n return prop.extendedTypeName === \"BeGuid\" ? \"string\" : undefined;\n case PrimitiveType.Integer:\n case PrimitiveType.Long:\n return \"string\";\n default:\n return undefined;\n }\n }\n\n return undefined;\n}\n\nexport function createUpdateContext(hostElementId: string, iModel: IModelDb, deleted: boolean): UpdateFieldsContext {\n return {\n hostElementId,\n getProperty: deleted ? () => undefined : (field) => getFieldPropertyValue(field, iModel),\n };\n}\n\n// Recompute the display value of a single field, return false if it couldn't be evaluated.\nexport function updateField(field: FieldRun, context: UpdateFieldsContext): boolean {\n if (context.hostElementId !== field.propertyHost.elementId) {\n return false;\n }\n\n let newContent: string | undefined;\n try {\n const propValue = context.getProperty(field);\n if (undefined !== propValue) {\n newContent = formatFieldValue(propValue, field.formatOptions);\n }\n } catch (err) {\n Logger.logException(BackendLoggerCategory.IModelDb, err);\n }\n\n newContent = newContent ?? FieldRun.invalidContentIndicator;\n if (newContent === field.cachedContent) {\n return false;\n }\n\n field.setCachedContent(newContent);\n return true;\n}\n\n// Re-evaluates the display strings for all fields that target the element specified by `context` and returns the number\n// of fields whose display strings changed as a result.\nexport function updateFields(textBlock: TextBlock, context: UpdateFieldsContext): number {\n let numUpdated = 0;\n for (const { child } of traverseTextBlockComponent(textBlock)) {\n if (child.type === \"field\" && updateField(child, context)) {\n ++numUpdated;\n }\n }\n\n return numUpdated;\n}\n\n// Invoked by ElementDrivesTextAnnotation to update fields in target element when source element changes or is deleted.\nexport function updateElementFields(props: RelationshipProps, iModel: IModelDb, deleted: boolean): void {\n try {\n const target = iModel.elements.getElement(props.targetId);\n if (isITextAnnotation(target)) {\n const context = createUpdateContext(props.sourceId, iModel, deleted);\n const updatedBlocks = [];\n for (const block of target.getTextBlocks()) {\n if (updateFields(block.textBlock, context)) {\n updatedBlocks.push(block);\n }\n }\n\n if (updatedBlocks.length > 0) {\n target.updateTextBlocks(updatedBlocks);\n target.update();\n }\n }\n } catch (err) {\n Logger.logException(BackendLoggerCategory.IModelDb, err);\n }\n}\n\n"]}
@@ -2,10 +2,9 @@
2
2
  * @module IModelHost
3
3
  */
4
4
  import "./IModelDb";
5
- import "reflect-metadata";
6
5
  import { AccessToken, BeEvent, GuidString, Mutable } from "@itwin/core-bentley";
7
6
  import { AuthorizationClient, LocalDirName, SessionProps } from "@itwin/core-common";
8
- import { ServerStorage } from "@itwin/object-storage-core";
7
+ import type { ServerStorage } from "@itwin/object-storage-core";
9
8
  import { BackendHubAccess, CreateNewIModelProps } from "./BackendHubAccess";
10
9
  import { TileStorage } from "./TileStorage";
11
10
  import { SettingsSchemas } from "./workspace/SettingsSchemas";
@@ -1 +1 @@
1
- {"version":3,"file":"IModelHost.d.ts","sourceRoot":"","sources":["../../src/IModelHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,YAAY,CAAC;AAIpB,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAU,OAAO,EAAiC,UAAU,EAAwB,OAAO,EAAmB,MAAM,qBAAqB,CAAC;AAC9J,OAAO,EAAE,mBAAmB,EAAe,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElG,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAc5E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAMjE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAM9E,gB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