@itwin/core-backend 5.2.0-dev.7 → 5.3.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +2 -0
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js.map +1 -1
  5. package/lib/cjs/BackendLoggerCategory.d.ts +6 -0
  6. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  7. package/lib/cjs/BackendLoggerCategory.js +6 -0
  8. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  9. package/lib/cjs/BriefcaseManager.d.ts +57 -3
  10. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  11. package/lib/cjs/BriefcaseManager.js +151 -42
  12. package/lib/cjs/BriefcaseManager.js.map +1 -1
  13. package/lib/cjs/CloudSqlite.d.ts +4 -0
  14. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  15. package/lib/cjs/CloudSqlite.js.map +1 -1
  16. package/lib/cjs/ECDb.d.ts +8 -0
  17. package/lib/cjs/ECDb.d.ts.map +1 -1
  18. package/lib/cjs/ECDb.js +22 -0
  19. package/lib/cjs/ECDb.js.map +1 -1
  20. package/lib/cjs/IModelDb.d.ts +54 -3
  21. package/lib/cjs/IModelDb.d.ts.map +1 -1
  22. package/lib/cjs/IModelDb.js +87 -9
  23. package/lib/cjs/IModelDb.js.map +1 -1
  24. package/lib/cjs/IModelHost.d.ts +11 -1
  25. package/lib/cjs/IModelHost.d.ts.map +1 -1
  26. package/lib/cjs/IModelHost.js +5 -0
  27. package/lib/cjs/IModelHost.js.map +1 -1
  28. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts +1 -5
  29. package/lib/cjs/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  30. package/lib/cjs/IModelIncrementalSchemaLocater.js +0 -6
  31. package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
  32. package/lib/cjs/SqliteChangesetReader.d.ts +8 -0
  33. package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
  34. package/lib/cjs/SqliteChangesetReader.js +11 -0
  35. package/lib/cjs/SqliteChangesetReader.js.map +1 -1
  36. package/lib/cjs/StashManager.d.ts +175 -0
  37. package/lib/cjs/StashManager.d.ts.map +1 -0
  38. package/lib/cjs/StashManager.js +306 -0
  39. package/lib/cjs/StashManager.js.map +1 -0
  40. package/lib/cjs/TxnManager.d.ts +226 -15
  41. package/lib/cjs/TxnManager.d.ts.map +1 -1
  42. package/lib/cjs/TxnManager.js +249 -23
  43. package/lib/cjs/TxnManager.js.map +1 -1
  44. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  45. package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  46. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js +15 -6
  47. package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  48. package/lib/cjs/annotations/LeaderGeometry.d.ts +3 -2
  49. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -1
  50. package/lib/cjs/annotations/LeaderGeometry.js +5 -4
  51. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -1
  52. package/lib/cjs/annotations/TextAnnotationElement.d.ts +52 -24
  53. package/lib/cjs/annotations/TextAnnotationElement.d.ts.map +1 -1
  54. package/lib/cjs/annotations/TextAnnotationElement.js +49 -59
  55. package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
  56. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts +2 -0
  57. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  58. package/lib/cjs/annotations/TextAnnotationGeometry.js +26 -19
  59. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  60. package/lib/cjs/annotations/TextBlockGeometry.d.ts.map +1 -1
  61. package/lib/cjs/annotations/TextBlockGeometry.js +8 -0
  62. package/lib/cjs/annotations/TextBlockGeometry.js.map +1 -1
  63. package/lib/cjs/annotations/TextBlockLayout.d.ts +49 -36
  64. package/lib/cjs/annotations/TextBlockLayout.d.ts.map +1 -1
  65. package/lib/cjs/annotations/TextBlockLayout.js +204 -135
  66. package/lib/cjs/annotations/TextBlockLayout.js.map +1 -1
  67. package/lib/cjs/internal/ChannelAdmin.js +1 -1
  68. package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
  69. package/lib/cjs/internal/Symbols.d.ts +1 -0
  70. package/lib/cjs/internal/Symbols.d.ts.map +1 -1
  71. package/lib/cjs/internal/Symbols.js +2 -1
  72. package/lib/cjs/internal/Symbols.js.map +1 -1
  73. package/lib/cjs/internal/annotations/fields.d.ts +2 -12
  74. package/lib/cjs/internal/annotations/fields.d.ts.map +1 -1
  75. package/lib/cjs/internal/annotations/fields.js +49 -45
  76. package/lib/cjs/internal/annotations/fields.js.map +1 -1
  77. package/lib/cjs/workspace/Workspace.d.ts +1 -1
  78. package/lib/cjs/workspace/Workspace.js.map +1 -1
  79. package/lib/esm/BackendHubAccess.d.ts +2 -0
  80. package/lib/esm/BackendHubAccess.d.ts.map +1 -1
  81. package/lib/esm/BackendHubAccess.js.map +1 -1
  82. package/lib/esm/BackendLoggerCategory.d.ts +6 -0
  83. package/lib/esm/BackendLoggerCategory.d.ts.map +1 -1
  84. package/lib/esm/BackendLoggerCategory.js +6 -0
  85. package/lib/esm/BackendLoggerCategory.js.map +1 -1
  86. package/lib/esm/BriefcaseManager.d.ts +57 -3
  87. package/lib/esm/BriefcaseManager.d.ts.map +1 -1
  88. package/lib/esm/BriefcaseManager.js +152 -43
  89. package/lib/esm/BriefcaseManager.js.map +1 -1
  90. package/lib/esm/CloudSqlite.d.ts +4 -0
  91. package/lib/esm/CloudSqlite.d.ts.map +1 -1
  92. package/lib/esm/CloudSqlite.js.map +1 -1
  93. package/lib/esm/ECDb.d.ts +8 -0
  94. package/lib/esm/ECDb.d.ts.map +1 -1
  95. package/lib/esm/ECDb.js +22 -0
  96. package/lib/esm/ECDb.js.map +1 -1
  97. package/lib/esm/IModelDb.d.ts +54 -3
  98. package/lib/esm/IModelDb.d.ts.map +1 -1
  99. package/lib/esm/IModelDb.js +88 -10
  100. package/lib/esm/IModelDb.js.map +1 -1
  101. package/lib/esm/IModelHost.d.ts +11 -1
  102. package/lib/esm/IModelHost.d.ts.map +1 -1
  103. package/lib/esm/IModelHost.js +5 -0
  104. package/lib/esm/IModelHost.js.map +1 -1
  105. package/lib/esm/IModelIncrementalSchemaLocater.d.ts +1 -5
  106. package/lib/esm/IModelIncrementalSchemaLocater.d.ts.map +1 -1
  107. package/lib/esm/IModelIncrementalSchemaLocater.js +0 -6
  108. package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
  109. package/lib/esm/SqliteChangesetReader.d.ts +8 -0
  110. package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
  111. package/lib/esm/SqliteChangesetReader.js +11 -0
  112. package/lib/esm/SqliteChangesetReader.js.map +1 -1
  113. package/lib/esm/StashManager.d.ts +175 -0
  114. package/lib/esm/StashManager.d.ts.map +1 -0
  115. package/lib/esm/StashManager.js +301 -0
  116. package/lib/esm/StashManager.js.map +1 -0
  117. package/lib/esm/TxnManager.d.ts +226 -15
  118. package/lib/esm/TxnManager.d.ts.map +1 -1
  119. package/lib/esm/TxnManager.js +247 -21
  120. package/lib/esm/TxnManager.js.map +1 -1
  121. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +10 -1
  122. package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts.map +1 -1
  123. package/lib/esm/annotations/ElementDrivesTextAnnotation.js +13 -5
  124. package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
  125. package/lib/esm/annotations/LeaderGeometry.d.ts +3 -2
  126. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -1
  127. package/lib/esm/annotations/LeaderGeometry.js +5 -4
  128. package/lib/esm/annotations/LeaderGeometry.js.map +1 -1
  129. package/lib/esm/annotations/TextAnnotationElement.d.ts +52 -24
  130. package/lib/esm/annotations/TextAnnotationElement.d.ts.map +1 -1
  131. package/lib/esm/annotations/TextAnnotationElement.js +51 -61
  132. package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
  133. package/lib/esm/annotations/TextAnnotationGeometry.d.ts +2 -0
  134. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  135. package/lib/esm/annotations/TextAnnotationGeometry.js +26 -19
  136. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  137. package/lib/esm/annotations/TextBlockGeometry.d.ts.map +1 -1
  138. package/lib/esm/annotations/TextBlockGeometry.js +8 -0
  139. package/lib/esm/annotations/TextBlockGeometry.js.map +1 -1
  140. package/lib/esm/annotations/TextBlockLayout.d.ts +49 -36
  141. package/lib/esm/annotations/TextBlockLayout.d.ts.map +1 -1
  142. package/lib/esm/annotations/TextBlockLayout.js +205 -136
  143. package/lib/esm/annotations/TextBlockLayout.js.map +1 -1
  144. package/lib/esm/internal/ChannelAdmin.js +1 -1
  145. package/lib/esm/internal/ChannelAdmin.js.map +1 -1
  146. package/lib/esm/internal/Symbols.d.ts +1 -0
  147. package/lib/esm/internal/Symbols.d.ts.map +1 -1
  148. package/lib/esm/internal/Symbols.js +1 -0
  149. package/lib/esm/internal/Symbols.js.map +1 -1
  150. package/lib/esm/internal/annotations/fields.d.ts +2 -12
  151. package/lib/esm/internal/annotations/fields.d.ts.map +1 -1
  152. package/lib/esm/internal/annotations/fields.js +51 -47
  153. package/lib/esm/internal/annotations/fields.js.map +1 -1
  154. package/lib/esm/test/AnnotationTestUtils.d.ts +5 -1
  155. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -1
  156. package/lib/esm/test/AnnotationTestUtils.js +6 -1
  157. package/lib/esm/test/AnnotationTestUtils.js.map +1 -1
  158. package/lib/esm/test/annotations/Fields.test.js +163 -46
  159. package/lib/esm/test/annotations/Fields.test.js.map +1 -1
  160. package/lib/esm/test/annotations/LeaderGeometry.test.js +12 -10
  161. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
  162. package/lib/esm/test/annotations/TextAnnotation.test.js +299 -43
  163. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  164. package/lib/esm/test/annotations/TextBlock.test.js +453 -86
  165. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  166. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts +46 -0
  167. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.d.ts.map +1 -1
  168. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js +20 -2
  169. package/lib/esm/test/assets/IncrementalSchemaLocater/configs/simple.config.js.map +1 -1
  170. package/lib/esm/test/ecdb/ECDb.test.js +71 -1
  171. package/lib/esm/test/ecdb/ECDb.test.js.map +1 -1
  172. package/lib/esm/test/hubaccess/Rebase.test.d.ts +2 -0
  173. package/lib/esm/test/hubaccess/Rebase.test.d.ts.map +1 -0
  174. package/lib/esm/test/hubaccess/Rebase.test.js +640 -0
  175. package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -0
  176. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js +20 -20
  177. package/lib/esm/test/incrementalSchemaLocater/ECSqlQueries.test.js.map +1 -1
  178. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js +3 -3
  179. package/lib/esm/test/incrementalSchemaLocater/IncrementalLoading.test.js.map +1 -1
  180. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts +16 -1
  181. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.d.ts.map +1 -1
  182. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js +47 -0
  183. package/lib/esm/test/incrementalSchemaLocater/utils/TestSqlSchemaLocater.js.map +1 -1
  184. package/lib/esm/test/standalone/ChangeMerge.test.js +15 -19
  185. package/lib/esm/test/standalone/ChangeMerge.test.js.map +1 -1
  186. package/lib/esm/test/standalone/ChangesetReader.test.js +131 -1
  187. package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
  188. package/lib/esm/test/standalone/MergeConflict.test.js +3 -3
  189. package/lib/esm/test/standalone/MergeConflict.test.js.map +1 -1
  190. package/lib/esm/workspace/Workspace.d.ts +1 -1
  191. package/lib/esm/workspace/Workspace.js.map +1 -1
  192. package/package.json +13 -13
@@ -1,11 +1,45 @@
1
1
  /** @packageDocumentation
2
2
  * @module Elements
3
3
  */
4
- import { AnnotationTextStyleProps, Code, CodeProps, CodeScopeProps, EntityReferenceSet, Placement2dProps, Placement3dProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps } from "@itwin/core-common";
4
+ import { AnnotationTextStyleProps, Code, CodeProps, CodeScopeProps, Placement2dProps, Placement3dProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps } 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
- import { TextBlockAndId } from "./ElementDrivesTextAnnotation";
8
+ import { TextAnnotationUsesTextStyleByDefault, TextBlockAndId } from "./ElementDrivesTextAnnotation";
9
+ /** Arguments supplied when creating a [[TextAnnotation2d]].
10
+ * @beta
11
+ */
12
+ export interface TextAnnotation2dCreateArgs {
13
+ /** The category ID for the annotation. */
14
+ category: Id64String;
15
+ /** The model ID where the annotation will be placed. */
16
+ model: Id64String;
17
+ /** The placement properties for the annotation. */
18
+ placement: Placement2dProps;
19
+ /** The default text style ID for the annotation. */
20
+ defaultTextStyleId?: Id64String;
21
+ /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided. */
22
+ textAnnotationData?: TextAnnotationProps;
23
+ /** Optional code for the element. */
24
+ code?: CodeProps;
25
+ }
26
+ /** Arguments supplied when creating a [[TextAnnotation3d]].
27
+ * @beta
28
+ */
29
+ export interface TextAnnotation3dCreateArgs {
30
+ /** The category ID for the annotation. */
31
+ category: Id64String;
32
+ /** The model ID where the annotation will be placed. */
33
+ model: Id64String;
34
+ /** The placement properties for the annotation. */
35
+ placement: Placement3dProps;
36
+ /** The default text style ID for the annotation. */
37
+ defaultTextStyleId?: Id64String;
38
+ /** Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided. */
39
+ textAnnotationData?: TextAnnotationProps;
40
+ /** Optional code for the element. */
41
+ code?: CodeProps;
42
+ }
9
43
  /** An element that displays textual content within a 2d model.
10
44
  * The text is stored as a [TextAnnotation]($common) from which the element's [geometry]($docs/learning/common/GeometryStream.md) and [Placement]($common) are computed.
11
45
  * @see [[setAnnotation]] to change the textual content.
@@ -14,6 +48,11 @@ import { TextBlockAndId } from "./ElementDrivesTextAnnotation";
14
48
  export declare class TextAnnotation2d extends AnnotationElement2d {
15
49
  /** @internal */
16
50
  static get className(): string;
51
+ /**
52
+ * The default [[AnnotationTextStyle]] used by the TextAnnotation2d.
53
+ * @beta
54
+ */
55
+ defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;
17
56
  /** Optional string containing the data associated with the text annotation. */
18
57
  private _textAnnotationData?;
19
58
  /** Extract the textual content, if present.
@@ -37,13 +76,10 @@ export declare class TextAnnotation2d extends AnnotationElement2d {
37
76
  toJSON(): TextAnnotation2dProps;
38
77
  /** Creates a new `TextAnnotation2d` instance with the specified properties.
39
78
  * @param iModelDb The iModel.
40
- * @param category The category ID for the annotation.
41
- * @param model The model ID where the annotation will be placed.
42
- * @param placement The placement properties for the annotation.
43
- * @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided.
44
- * @param code Optional code for the element.
79
+ * @param arg The arguments for creating the TextAnnotation2d.
80
+ * @beta
45
81
  */
46
- static create(iModelDb: IModelDb, category: Id64String, model: Id64String, placement: Placement2dProps, textAnnotationData?: TextAnnotationProps, code?: CodeProps): TextAnnotation2d;
82
+ static create(iModelDb: IModelDb, arg: TextAnnotation2dCreateArgs): TextAnnotation2d;
47
83
  /**
48
84
  * Updates the geometry of the TextAnnotation2d on insert.
49
85
  * @inheritdoc
@@ -61,11 +97,6 @@ export declare class TextAnnotation2d extends AnnotationElement2d {
61
97
  * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.
62
98
  */
63
99
  protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation2dProps): void;
64
- /**
65
- * Collects reference IDs used by this `TextAnnotation2d`.
66
- * @inheritdoc
67
- */
68
- protected collectReferenceIds(ids: EntityReferenceSet): void;
69
100
  /** @internal */
70
101
  getTextBlocks(): Iterable<TextBlockAndId>;
71
102
  /** @internal */
@@ -83,6 +114,11 @@ export declare class TextAnnotation2d extends AnnotationElement2d {
83
114
  export declare class TextAnnotation3d extends GraphicalElement3d {
84
115
  /** @internal */
85
116
  static get className(): string;
117
+ /**
118
+ * The default [[AnnotationTextStyle]] used by the TextAnnotation3d.
119
+ * @beta
120
+ */
121
+ defaultTextStyle?: TextAnnotationUsesTextStyleByDefault;
86
122
  /** Optional string containing the data associated with the text annotation. */
87
123
  private _textAnnotationData?;
88
124
  /** Extract the textual content, if present.
@@ -105,13 +141,10 @@ export declare class TextAnnotation3d extends GraphicalElement3d {
105
141
  toJSON(): TextAnnotation3dProps;
106
142
  /** Creates a new `TextAnnotation3d` instance with the specified properties.
107
143
  * @param iModelDb The iModel.
108
- * @param category The category ID for the annotation.
109
- * @param model The model ID where the annotation will be placed.
110
- * @param placement The placement properties for the annotation.
111
- * @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided.
112
- * @param code Optional code for the element.
144
+ * @param arg The arguments for creating the TextAnnotation3d.
145
+ * @beta
113
146
  */
114
- static create(iModelDb: IModelDb, category: Id64String, model: Id64String, placement: Placement3dProps, textAnnotationData?: TextAnnotationProps, code?: CodeProps): TextAnnotation3d;
147
+ static create(iModelDb: IModelDb, arg: TextAnnotation3dCreateArgs): TextAnnotation3d;
115
148
  /**
116
149
  * Updates the geometry of the TextAnnotation3d on insert.
117
150
  * @inheritdoc
@@ -129,11 +162,6 @@ export declare class TextAnnotation3d extends GraphicalElement3d {
129
162
  * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.
130
163
  */
131
164
  protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation3dProps): void;
132
- /**
133
- * Collects reference IDs used by this `TextAnnotation3d`.
134
- * @inheritdoc
135
- */
136
- protected collectReferenceIds(ids: EntityReferenceSet): void;
137
165
  /** @internal */
138
166
  getTextBlocks(): Iterable<TextBlockAndId>;
139
167
  /** @internal */
@@ -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,EAA2D,kBAAkB,EAAe,gBAAgB,EAAe,gBAAgB,EAAkB,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACrY,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3H,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAA+B,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAsB5F;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,mBAAmB;IACvD,gB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,MAAM,EAAE,QAAQ,CAAC,EAAE,sBAAsB,EAAE,WAAW,CAAC,EAAE,MAAM;IAW7I;;;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,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAQtC"}
@@ -24,13 +24,17 @@ function parseTextAnnotationData(json) {
24
24
  return undefined;
25
25
  }
26
26
  }
27
- function getElementGeometryBuilderParams(iModel, modelId, _placementProps, stringifiedAnnotationProps, categoryId, _subCategory) {
27
+ function getElementGeometryBuilderParams(iModel, modelId, _placementProps, stringifiedAnnotationProps, categoryId, textStyleId, _subCategory) {
28
28
  const annotationProps = parseTextAnnotationData(stringifiedAnnotationProps);
29
29
  const textBlock = core_common_1.TextAnnotation.fromJSON(annotationProps).textBlock;
30
- const textStyleResolver = new TextBlockLayout_1.TextStyleResolver({ textBlock, iModel, modelId });
30
+ const textStyleResolver = new TextBlockLayout_1.TextStyleResolver({ textBlock, textStyleId: textStyleId ?? "", iModel });
31
31
  const layout = (0, TextBlockLayout_1.layoutTextBlock)({ iModel, textBlock, textStyleResolver });
32
32
  const builder = new core_common_1.ElementGeometry.Builder();
33
- (0, TextAnnotationGeometry_1.appendTextAnnotationGeometry)({ layout, textStyleResolver, annotationProps: annotationProps ?? {}, builder, categoryId });
33
+ let scaleFactor = 1;
34
+ const element = iModel.elements.getElement(modelId);
35
+ if (element instanceof Element_1.Drawing)
36
+ scaleFactor = element.scaleFactor;
37
+ (0, TextAnnotationGeometry_1.appendTextAnnotationGeometry)({ layout, textStyleResolver, scaleFactor, annotationProps: annotationProps ?? {}, builder, categoryId });
34
38
  return { entryArray: builder.entries };
35
39
  }
36
40
  /** An element that displays textual content within a 2d model.
@@ -41,6 +45,11 @@ function getElementGeometryBuilderParams(iModel, modelId, _placementProps, strin
41
45
  class TextAnnotation2d extends Element_1.AnnotationElement2d /* implements ITextAnnotation */ {
42
46
  /** @internal */
43
47
  static get className() { return "TextAnnotation2d"; }
48
+ /**
49
+ * The default [[AnnotationTextStyle]] used by the TextAnnotation2d.
50
+ * @beta
51
+ */
52
+ defaultTextStyle;
44
53
  /** Optional string containing the data associated with the text annotation. */
45
54
  _textAnnotationData;
46
55
  /** Extract the textual content, if present.
@@ -59,6 +68,9 @@ class TextAnnotation2d extends Element_1.AnnotationElement2d /* implements IText
59
68
  }
60
69
  constructor(props, iModel) {
61
70
  super(props, iModel);
71
+ if (props.defaultTextStyle) {
72
+ this.defaultTextStyle = new ElementDrivesTextAnnotation_1.TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);
73
+ }
62
74
  this._textAnnotationData = props.textAnnotationData;
63
75
  }
64
76
  /** Creates a new instance of `TextAnnotation2d` from its JSON representation. */
@@ -75,28 +87,26 @@ class TextAnnotation2d extends Element_1.AnnotationElement2d /* implements IText
75
87
  const props = super.toJSON();
76
88
  props.textAnnotationData = this._textAnnotationData;
77
89
  if (this._textAnnotationData) {
78
- props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category);
90
+ props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);
79
91
  }
80
92
  return props;
81
93
  }
82
94
  /** Creates a new `TextAnnotation2d` instance with the specified properties.
83
95
  * @param iModelDb The iModel.
84
- * @param category The category ID for the annotation.
85
- * @param model The model ID where the annotation will be placed.
86
- * @param placement The placement properties for the annotation.
87
- * @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided.
88
- * @param code Optional code for the element.
96
+ * @param arg The arguments for creating the TextAnnotation2d.
97
+ * @beta
89
98
  */
90
- static create(iModelDb, category, model, placement, textAnnotationData, code) {
91
- const props = {
99
+ static create(iModelDb, arg) {
100
+ const elementProps = {
92
101
  classFullName: this.classFullName,
93
- textAnnotationData: JSON.stringify(textAnnotationData),
94
- placement,
95
- model,
96
- category,
97
- code: code ?? core_common_1.Code.createEmpty(),
102
+ textAnnotationData: JSON.stringify(arg.textAnnotationData),
103
+ defaultTextStyle: arg.defaultTextStyleId ? new ElementDrivesTextAnnotation_1.TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,
104
+ placement: arg.placement,
105
+ model: arg.model,
106
+ category: arg.category,
107
+ code: arg.code ?? core_common_1.Code.createEmpty(),
98
108
  };
99
- return new this(props, iModelDb);
109
+ return new this(elementProps, iModelDb);
100
110
  }
101
111
  /**
102
112
  * Updates the geometry of the TextAnnotation2d on insert.
@@ -124,20 +134,7 @@ class TextAnnotation2d extends Element_1.AnnotationElement2d /* implements IText
124
134
  if (props.elementGeometryBuilderParams || !props.textAnnotationData) {
125
135
  return;
126
136
  }
127
- props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? core_common_1.Placement2d.fromJSON(), props.textAnnotationData, props.category);
128
- }
129
- /**
130
- * Collects reference IDs used by this `TextAnnotation2d`.
131
- * @inheritdoc
132
- */
133
- collectReferenceIds(ids) {
134
- super.collectReferenceIds(ids);
135
- const annotation = this.getAnnotation();
136
- if (!annotation) {
137
- return;
138
- }
139
- if (annotation.textBlock.styleId)
140
- ids.addElement(annotation.textBlock.styleId);
137
+ props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? core_common_1.Placement2d.fromJSON(), props.textAnnotationData, props.category, props.defaultTextStyle ? props.defaultTextStyle.id : undefined);
141
138
  }
142
139
  /** @internal */
143
140
  getTextBlocks() {
@@ -167,6 +164,11 @@ exports.TextAnnotation2d = TextAnnotation2d;
167
164
  class TextAnnotation3d extends Element_1.GraphicalElement3d /* implements ITextAnnotation */ {
168
165
  /** @internal */
169
166
  static get className() { return "TextAnnotation3d"; }
167
+ /**
168
+ * The default [[AnnotationTextStyle]] used by the TextAnnotation3d.
169
+ * @beta
170
+ */
171
+ defaultTextStyle;
170
172
  /** Optional string containing the data associated with the text annotation. */
171
173
  _textAnnotationData;
172
174
  /** Extract the textual content, if present.
@@ -185,6 +187,9 @@ class TextAnnotation3d extends Element_1.GraphicalElement3d /* implements ITextA
185
187
  }
186
188
  constructor(props, iModel) {
187
189
  super(props, iModel);
190
+ if (props.defaultTextStyle) {
191
+ this.defaultTextStyle = new ElementDrivesTextAnnotation_1.TextAnnotationUsesTextStyleByDefault(props.defaultTextStyle.id);
192
+ }
188
193
  this._textAnnotationData = props.textAnnotationData;
189
194
  }
190
195
  /** Creates a new instance of `TextAnnotation3d` from its JSON representation. */
@@ -200,28 +205,26 @@ class TextAnnotation3d extends Element_1.GraphicalElement3d /* implements ITextA
200
205
  const props = super.toJSON();
201
206
  props.textAnnotationData = this._textAnnotationData;
202
207
  if (this._textAnnotationData) {
203
- props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category);
208
+ props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category, this.defaultTextStyle ? this.defaultTextStyle.id : undefined);
204
209
  }
205
210
  return props;
206
211
  }
207
212
  /** Creates a new `TextAnnotation3d` instance with the specified properties.
208
213
  * @param iModelDb The iModel.
209
- * @param category The category ID for the annotation.
210
- * @param model The model ID where the annotation will be placed.
211
- * @param placement The placement properties for the annotation.
212
- * @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided.
213
- * @param code Optional code for the element.
214
+ * @param arg The arguments for creating the TextAnnotation3d.
215
+ * @beta
214
216
  */
215
- static create(iModelDb, category, model, placement, textAnnotationData, code) {
216
- const props = {
217
+ static create(iModelDb, arg) {
218
+ const elementProps = {
217
219
  classFullName: this.classFullName,
218
- textAnnotationData: JSON.stringify(textAnnotationData),
219
- placement,
220
- model,
221
- category,
222
- code: code ?? core_common_1.Code.createEmpty(),
220
+ textAnnotationData: JSON.stringify(arg.textAnnotationData),
221
+ defaultTextStyle: arg.defaultTextStyleId ? new ElementDrivesTextAnnotation_1.TextAnnotationUsesTextStyleByDefault(arg.defaultTextStyleId).toJSON() : undefined,
222
+ placement: arg.placement,
223
+ model: arg.model,
224
+ category: arg.category,
225
+ code: arg.code ?? core_common_1.Code.createEmpty(),
223
226
  };
224
- return new this(props, iModelDb);
227
+ return new this(elementProps, iModelDb);
225
228
  }
226
229
  /**
227
230
  * Updates the geometry of the TextAnnotation3d on insert.
@@ -249,20 +252,7 @@ class TextAnnotation3d extends Element_1.GraphicalElement3d /* implements ITextA
249
252
  if (props.elementGeometryBuilderParams || !props.textAnnotationData) {
250
253
  return;
251
254
  }
252
- props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? core_common_1.Placement3d.fromJSON(), props.textAnnotationData, props.category);
253
- }
254
- /**
255
- * Collects reference IDs used by this `TextAnnotation3d`.
256
- * @inheritdoc
257
- */
258
- collectReferenceIds(ids) {
259
- super.collectReferenceIds(ids);
260
- const annotation = this.getAnnotation();
261
- if (!annotation) {
262
- return;
263
- }
264
- if (annotation.textBlock.styleId)
265
- ids.addElement(annotation.textBlock.styleId);
255
+ props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? core_common_1.Placement3d.fromJSON(), props.textAnnotationData, props.category, props.defaultTextStyle ? props.defaultTextStyle.id : undefined);
266
256
  }
267
257
  /** @internal */
268
258
  getTextBlocks() {
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mapp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ACtB,MAAM,IAAI,KAAK,CAAC,yCAAyC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,IAAwB;QAC5D,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AA1GD,kDA0GC","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, ElementGeometry, ElementGeometryBuilderParams, EntityReferenceSet, Placement2d, Placement2dProps, Placement3d, Placement3dProps, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps } from \"@itwin/core-common\";\nimport { IModelDb } from \"../IModelDb\";\nimport { AnnotationElement2d, DefinitionElement, GraphicalElement3d, OnElementIdArg, OnElementPropsArg } from \"../Element\";\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport { layoutTextBlock, TextStyleResolver } from \"./TextBlockLayout\";\nimport { appendTextAnnotationGeometry } from \"./TextAnnotationGeometry\";\nimport { ElementDrivesTextAnnotation, TextBlockAndId } from \"./ElementDrivesTextAnnotation\";\n\nfunction parseTextAnnotationData(json: string | undefined): TextAnnotationProps | undefined {\n if (!json) return undefined;\n try {\n return JSON.parse(json);\n } catch {\n return undefined;\n }\n}\n\nfunction getElementGeometryBuilderParams(iModel: IModelDb, modelId: Id64String, _placementProps: PlacementProps, stringifiedAnnotationProps: string, categoryId: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\n const annotationProps = parseTextAnnotationData(stringifiedAnnotationProps);\n const textBlock = TextAnnotation.fromJSON(annotationProps).textBlock;\n const textStyleResolver = new TextStyleResolver({textBlock, iModel, modelId});\n const layout = layoutTextBlock({ iModel, textBlock, textStyleResolver });\n const builder = new ElementGeometry.Builder();\n appendTextAnnotationGeometry({ layout, textStyleResolver, annotationProps: annotationProps ?? {}, builder, categoryId })\n\n return { entryArray: builder.entries };\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 /** Optional string containing the data associated with the text annotation. */\n private _textAnnotationData?: string;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const textAnnotationProps = parseTextAnnotationData(this._textAnnotationData);\n return textAnnotationProps ? TextAnnotation.fromJSON(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._textAnnotationData = annotation ? JSON.stringify(annotation.toJSON()) : undefined;\n }\n\n protected constructor(props: TextAnnotation2dProps, iModel: IModelDb) {\n super(props, iModel);\n this._textAnnotationData = props.textAnnotationData;\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\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation2dProps {\n const props = super.toJSON() as TextAnnotation2dProps;\n props.textAnnotationData = this._textAnnotationData;\n if (this._textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation2d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param category The category ID for the annotation.\n * @param model The model ID where the annotation will be placed.\n * @param placement The placement properties for the annotation.\n * @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation2d`. Essentially an empty element if not provided.\n * @param code Optional code for the element.\n */\n public static create(iModelDb: IModelDb, category: Id64String, model: Id64String, placement: Placement2dProps, textAnnotationData?: TextAnnotationProps, code?: CodeProps): TextAnnotation2d {\n const props: TextAnnotation2dProps = {\n classFullName: this.classFullName,\n textAnnotationData: JSON.stringify(textAnnotationData),\n placement,\n model,\n category,\n code: code ?? Code.createEmpty(),\n }\n return new this(props, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on insert.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation2dProps);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation2dProps);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation2dProps]($common).\n * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n */\n protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation2dProps): void {\n if (props.elementGeometryBuilderParams || !props.textAnnotationData) {\n return;\n }\n\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? Placement2d.fromJSON(), props.textAnnotationData, props.category);\n }\n\n /**\n * Collects reference IDs used by this `TextAnnotation2d`.\n * @inheritdoc\n */\n protected override collectReferenceIds(ids: EntityReferenceSet): void {\n super.collectReferenceIds(ids);\n const annotation = this.getAnnotation();\n if (!annotation) {\n return;\n }\n if (annotation.textBlock.styleId)\n ids.addElement(annotation.textBlock.styleId);\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 /** Optional string containing the data associated with the text annotation. */\n private _textAnnotationData?: string;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const textAnnotationProps = parseTextAnnotationData(this._textAnnotationData);\n return textAnnotationProps ? TextAnnotation.fromJSON(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._textAnnotationData = annotation ? JSON.stringify(annotation.toJSON()) : undefined;\n }\n\n protected constructor(props: TextAnnotation3dProps, iModel: IModelDb) {\n super(props, iModel);\n this._textAnnotationData = props.textAnnotationData;\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._textAnnotationData;\n if (this._textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category);\n }\n\n return props;\n }\n\n /** Creates a new `TextAnnotation3d` instance with the specified properties.\n * @param iModelDb The iModel.\n * @param category The category ID for the annotation.\n * @param model The model ID where the annotation will be placed.\n * @param placement The placement properties for the annotation.\n * @param textAnnotationData Optional [[TextAnnotation]] JSON representation used to create the `TextAnnotation3d`. Essentially an empty element if not provided.\n * @param code Optional code for the element.\n */\n public static create(iModelDb: IModelDb, category: Id64String, model: Id64String, placement: Placement3dProps, textAnnotationData?: TextAnnotationProps, code?: CodeProps): TextAnnotation3d {\n const props: TextAnnotation3dProps = {\n classFullName: this.classFullName,\n textAnnotationData: JSON.stringify(textAnnotationData),\n placement,\n model,\n category,\n code: code ?? Code.createEmpty(),\n }\n return new this(props, iModelDb);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on insert.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation3dProps);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation3dProps);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation3dProps]($common).\n * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n */\n protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation3dProps): void {\n if (props.elementGeometryBuilderParams || !props.textAnnotationData) {\n return;\n }\n\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? Placement3d.fromJSON(), props.textAnnotationData, props.category);\n }\n\n /**\n * Collects reference IDs used by this `TextAnnotation3d`.\n * @inheritdoc\n */\n protected override collectReferenceIds(ids: EntityReferenceSet): void {\n super.collectReferenceIds(ids);\n const annotation = this.getAnnotation();\n if (!annotation) {\n return;\n }\n if (annotation.textBlock.styleId)\n ids.addElement(annotation.textBlock.styleId);\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/**\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);\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 */\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 definitionModelId - The ID of the [[DefinitionModel]].\n * @param name - The name to assign to the `AnnotationTextStyle`.\n * @param settings - Optional text style settings used to create the `AnnotationTextStyle`. Default settings will be used if not provided.\n * @param description - Optional description for the `AnnotationTextStyle`.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, settings?: TextStyleSettingsProps, description?: string) {\n const props: AnnotationTextStyleProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name).toJSON(),\n description,\n settings: JSON.stringify(settings),\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(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);\n const errors = settings.getValidationErrors();\n if (errors.length > 0) {\n throw new Error(`Invalid AnnotationTextStyle settings: ${errors.join(\", \")}`);\n }\n }\n\n private static parseTextStyleSettings(json: string | undefined): TextStyleSettingsProps | undefined {\n if (!json) return undefined;\n try {\n return JSON.parse(json);\n } catch {\n return undefined;\n }\n }\n}\n\n\n"]}
1
+ {"version":3,"file":"TextAnnotationElement.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationElement.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAiX;AAEjX,wCAAoI;AACpI,sDAAyD;AACzD,uDAAuE;AACvE,qEAAwE;AACxE,+EAAkI;AAElI,SAAS,uBAAuB,CAAC,IAAwB;IACvD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,C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B;QACvD,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAiC,CAAC,CAAC;IAC/D,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,KAA+B;QAC7D,MAAM,YAAY,GAAG,mBAAmB,CAAC,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChF,IAAI,CAAC,YAAY;YAAE,OAAO;QAC1B,MAAM,QAAQ,GAAG,+BAAiB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,QAAQ,CAAC,mBAAmB,EAAE,CAAC;QAC9C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,yCAAyC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,sBAAsB,CAAC,IAAwB;QAC5D,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AA1GD,kDA0GC","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, ElementGeometry, ElementGeometryBuilderParams, Placement2d, Placement2dProps, Placement3d, Placement3dProps, PlacementProps, TextAnnotation, TextAnnotation2dProps, TextAnnotation3dProps, TextAnnotationProps, TextStyleSettings, TextStyleSettingsProps } 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\";\n\nfunction parseTextAnnotationData(json: string | undefined): TextAnnotationProps | undefined {\n if (!json) return undefined;\n try {\n return JSON.parse(json);\n } catch {\n return undefined;\n }\n}\n\nfunction getElementGeometryBuilderParams(iModel: IModelDb, modelId: Id64String, _placementProps: PlacementProps, stringifiedAnnotationProps: string, categoryId: Id64String, textStyleId?: Id64String, _subCategory?: Id64String): ElementGeometryBuilderParams {\n const annotationProps = parseTextAnnotationData(stringifiedAnnotationProps);\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 textAnnotationData?: 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 textAnnotationData?: 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 /** Optional string containing the data associated with the text annotation. */\n private _textAnnotationData?: string;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const textAnnotationProps = parseTextAnnotationData(this._textAnnotationData);\n return textAnnotationProps ? TextAnnotation.fromJSON(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._textAnnotationData = annotation ? JSON.stringify(annotation.toJSON()) : undefined;\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._textAnnotationData = props.textAnnotationData;\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\n * @inheritdoc\n */\n public override toJSON(): TextAnnotation2dProps {\n const props = super.toJSON() as TextAnnotation2dProps;\n props.textAnnotationData = this._textAnnotationData;\n if (this._textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category, 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: JSON.stringify(arg.textAnnotationData),\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.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation2dProps);\n }\n\n /**\n * Updates the geometry of the TextAnnotation2d on update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation2dProps);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation2dProps]($common).\n * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n */\n protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation2dProps): void {\n if (props.elementGeometryBuilderParams || !props.textAnnotationData) {\n return;\n }\n\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? Placement2d.fromJSON(), props.textAnnotationData, props.category, props.defaultTextStyle ? props.defaultTextStyle.id : undefined);\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 /** Optional string containing the data associated with the text annotation. */\n private _textAnnotationData?: string;\n\n /** Extract the textual content, if present.\n * @see [[setAnnotation]] to change it.\n */\n public getAnnotation(): TextAnnotation | undefined {\n const textAnnotationProps = parseTextAnnotationData(this._textAnnotationData);\n return textAnnotationProps ? TextAnnotation.fromJSON(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._textAnnotationData = annotation ? JSON.stringify(annotation.toJSON()) : undefined;\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._textAnnotationData = props.textAnnotationData;\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._textAnnotationData;\n if (this._textAnnotationData) {\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(this.iModel, this.model, this.placement, this._textAnnotationData, this.category, 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: JSON.stringify(arg.textAnnotationData),\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.\n * @inheritdoc\n * @beta\n */\n protected static override onInsert(arg: OnElementPropsArg): void {\n super.onInsert(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation3dProps);\n }\n\n /**\n * Updates the geometry of the TextAnnotation3d on update.\n * @inheritdoc\n * @beta\n */\n protected static override onUpdate(arg: OnElementPropsArg): void {\n super.onUpdate(arg);\n this.updateGeometry(arg.iModel, arg.props as TextAnnotation3dProps);\n }\n\n /**\n * Populates the `elementGeometryBuilderParams` property in the [TextAnnotation3dProps]($common).\n * It only does this if the `elementGeometryBuilderParams` is not already set and if there is actually a text annotation to produce geometry for.\n */\n protected static updateGeometry(iModelDb: IModelDb, props: TextAnnotation3dProps): void {\n if (props.elementGeometryBuilderParams || !props.textAnnotationData) {\n return;\n }\n\n props.elementGeometryBuilderParams = getElementGeometryBuilderParams(iModelDb, props.model, props.placement ?? Placement3d.fromJSON(), props.textAnnotationData, props.category, props.defaultTextStyle ? props.defaultTextStyle.id : undefined);\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/**\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);\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 */\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 definitionModelId - The ID of the [[DefinitionModel]].\n * @param name - The name to assign to the `AnnotationTextStyle`.\n * @param settings - Optional text style settings used to create the `AnnotationTextStyle`. Default settings will be used if not provided.\n * @param description - Optional description for the `AnnotationTextStyle`.\n */\n public static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, settings?: TextStyleSettingsProps, description?: string) {\n const props: AnnotationTextStyleProps = {\n classFullName: this.classFullName,\n model: definitionModelId,\n code: this.createCode(iModelDb, definitionModelId, name).toJSON(),\n description,\n settings: JSON.stringify(settings),\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(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);\n const errors = settings.getValidationErrors();\n if (errors.length > 0) {\n throw new Error(`Invalid AnnotationTextStyle settings: ${errors.join(\", \")}`);\n }\n }\n\n private static parseTextStyleSettings(json: string | undefined): TextStyleSettingsProps | undefined {\n if (!json) return undefined;\n try {\n return JSON.parse(json);\n } catch {\n return undefined;\n }\n }\n}\n\n\n"]}
@@ -16,6 +16,8 @@ export interface AppendTextAnnotationGeometryArgs {
16
16
  layout: TextBlockLayout;
17
17
  /** [[TextStyleResolver]] used to get styling and scale information for creating geometry. */
18
18
  textStyleResolver: TextStyleResolver;
19
+ /** The scale factor to apply to the annotation. Usually comes from the `scaleFactor` of a [[Drawing]] element. */
20
+ scaleFactor: number;
19
21
  /** Builder that will be added to in place */
20
22
  builder: ElementGeometry.Builder;
21
23
  /** The category the element will belong to. This will passed into the [[GeometryParams]] */
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAA+C,mBAAmB,EAAqB,MAAM,oBAAoB,CAAC;AACpJ,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKvD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,4GAA4G;IAC5G,eAAe,EAAE,mBAAmB,CAAC;IACrC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IACxB,6FAA6F;IAC7F,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,6CAA6C;IAC7C,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC;IACjC,4FAA4F;IAC5F,UAAU,EAAE,UAAU,CAAA;IACtB,yGAAyG;IACzG,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CA8B7F"}
1
+ {"version":3,"file":"TextAnnotationGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAA+C,mBAAmB,EAAqB,MAAM,oBAAoB,CAAC;AACpJ,OAAO,EAAa,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKvD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,4GAA4G;IAC5G,eAAe,EAAE,mBAAmB,CAAC;IACrC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IACxB,6FAA6F;IAC7F,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kHAAkH;IAClH,WAAW,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC;IACjC,4FAA4F;IAC5F,UAAU,EAAE,UAAU,CAAA;IACtB,yGAAyG;IACzG,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CA8B7F"}
@@ -20,7 +20,7 @@ const LeaderGeometry_1 = require("./LeaderGeometry");
20
20
  */
21
21
  function appendTextAnnotationGeometry(props) {
22
22
  const annotation = core_common_1.TextAnnotation.fromJSON(props.annotationProps);
23
- const transform = annotation.computeTransform(props.layout.range, props.textStyleResolver.scaleFactor);
23
+ const transform = annotation.computeTransform(props.layout.range, props.scaleFactor);
24
24
  let result = true;
25
25
  // Construct the TextBlockGeometry
26
26
  const params = new core_common_1.GeometryParams(props.categoryId, props.subCategoryId);
@@ -32,7 +32,7 @@ function appendTextAnnotationGeometry(props) {
32
32
  }
33
33
  // Construct the leader geometry
34
34
  if (annotation.leaders && annotation.leaders.length > 0) {
35
- result = result && (0, LeaderGeometry_1.appendLeadersToBuilder)(props.builder, annotation.leaders, props.layout, transform.clone(), params, props.textStyleResolver);
35
+ result = result && (0, LeaderGeometry_1.appendLeadersToBuilder)(props.builder, annotation.leaders, props.layout, transform.clone(), params, props.textStyleResolver, props.scaleFactor);
36
36
  }
37
37
  // Construct the debug geometry
38
38
  if (props.wantDebugGeometry) {
@@ -99,8 +99,7 @@ function debugSnapPoints(builder, style, range, transform) {
99
99
  */
100
100
  function debugRunLayout(builder, layout, documentTransform) {
101
101
  let result = true; // Tracks if all geometry was appended successfully
102
- let color = core_common_1.ColorDef.black; // Current color for the run type
103
- let lastColor = color; // Last color used, to minimize param changes
102
+ let lastColor = core_common_1.ColorDef.black; // Last color used, to minimize param changes
104
103
  // Map run types to debug colors
105
104
  const colors = {
106
105
  "text": core_common_1.ColorDef.fromString("orange"),
@@ -108,28 +107,36 @@ function debugRunLayout(builder, layout, documentTransform) {
108
107
  "fraction": core_common_1.ColorDef.fromString("green"),
109
108
  "tab": core_common_1.ColorDef.fromString("aquamarine"),
110
109
  "field": core_common_1.ColorDef.fromString("purple"),
110
+ "marker": core_common_1.ColorDef.fromString("pink"),
111
+ };
112
+ const drawBox = (run, lineTransform, newColor) => {
113
+ // Only change geometry params if the color changes
114
+ if (lastColor !== newColor) {
115
+ const colorParams = new core_common_1.GeometryParams(core_bentley_1.Id64.invalid);
116
+ colorParams.lineColor = newColor;
117
+ colorParams.weight = run.source.type === "linebreak" ? 3 : undefined;
118
+ result = result && builder.appendGeometryParamsChange(colorParams);
119
+ lastColor = newColor;
120
+ }
121
+ // Apply the line's offset to the run's offset
122
+ const runTrans = core_geometry_1.Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);
123
+ lineTransform.multiplyTransformTransform(runTrans, runTrans);
124
+ // Draw the enclosing range for the run
125
+ const runCorners = run.range.corners3d(true);
126
+ runTrans.multiplyPoint3dArrayInPlace(runCorners);
127
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(runCorners));
111
128
  };
112
129
  layout.lines.forEach(line => {
113
130
  // Apply the line's offset transform
114
131
  const lineTrans = core_geometry_1.Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);
115
132
  documentTransform.multiplyTransformTransform(lineTrans, lineTrans);
133
+ if (line.marker) {
134
+ drawBox(line.marker, lineTrans, colors.marker);
135
+ }
116
136
  line.runs.forEach(run => {
117
137
  // Determine color for this run type
118
- color = colors[run.source.type] ?? core_common_1.ColorDef.black;
119
- // Only change geometry params if the color changes
120
- if (!lastColor.equals(color)) {
121
- const colorParams = new core_common_1.GeometryParams(core_bentley_1.Id64.invalid);
122
- colorParams.lineColor = color;
123
- result = result && builder.appendGeometryParamsChange(colorParams);
124
- lastColor = color;
125
- }
126
- // Apply the line's offset to the run's offset
127
- const runTrans = core_geometry_1.Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);
128
- lineTrans.multiplyTransformTransform(runTrans, runTrans);
129
- // Draw the enclosing range for the run
130
- const runCorners = run.range.corners3d(true);
131
- runTrans.multiplyPoint3dArrayInPlace(runCorners);
132
- result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(runCorners));
138
+ const color = colors[run.source.type] ?? core_common_1.ColorDef.black;
139
+ drawBox(run, lineTrans, color);
133
140
  });
134
141
  });
135
142
  return result;