@itwin/core-backend 5.1.0-dev.56 → 5.1.0-dev.58

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 (37) hide show
  1. package/lib/cjs/annotations/LeaderGeometry.d.ts +53 -0
  2. package/lib/cjs/annotations/LeaderGeometry.d.ts.map +1 -0
  3. package/lib/cjs/annotations/LeaderGeometry.js +175 -0
  4. package/lib/cjs/annotations/LeaderGeometry.js.map +1 -0
  5. package/lib/cjs/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  6. package/lib/cjs/annotations/TextAnnotationGeometry.js +5 -0
  7. package/lib/cjs/annotations/TextAnnotationGeometry.js.map +1 -1
  8. package/lib/cjs/core-backend.d.ts +1 -0
  9. package/lib/cjs/core-backend.d.ts.map +1 -1
  10. package/lib/cjs/core-backend.js +1 -0
  11. package/lib/cjs/core-backend.js.map +1 -1
  12. package/lib/esm/annotations/LeaderGeometry.d.ts +53 -0
  13. package/lib/esm/annotations/LeaderGeometry.d.ts.map +1 -0
  14. package/lib/esm/annotations/LeaderGeometry.js +170 -0
  15. package/lib/esm/annotations/LeaderGeometry.js.map +1 -0
  16. package/lib/esm/annotations/TextAnnotationGeometry.d.ts.map +1 -1
  17. package/lib/esm/annotations/TextAnnotationGeometry.js +5 -0
  18. package/lib/esm/annotations/TextAnnotationGeometry.js.map +1 -1
  19. package/lib/esm/core-backend.d.ts +1 -0
  20. package/lib/esm/core-backend.d.ts.map +1 -1
  21. package/lib/esm/core-backend.js +1 -0
  22. package/lib/esm/core-backend.js.map +1 -1
  23. package/lib/esm/test/AnnotationTestUtils.d.ts +15 -0
  24. package/lib/esm/test/AnnotationTestUtils.d.ts.map +1 -0
  25. package/lib/esm/test/AnnotationTestUtils.js +35 -0
  26. package/lib/esm/test/AnnotationTestUtils.js.map +1 -0
  27. package/lib/esm/test/annotations/FrameGeometry.test.js +2 -14
  28. package/lib/esm/test/annotations/FrameGeometry.test.js.map +1 -1
  29. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts +2 -0
  30. package/lib/esm/test/annotations/LeaderGeometry.test.d.ts.map +1 -0
  31. package/lib/esm/test/annotations/LeaderGeometry.test.js +251 -0
  32. package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -0
  33. package/lib/esm/test/annotations/TextAnnotation.test.js +2 -4
  34. package/lib/esm/test/annotations/TextAnnotation.test.js.map +1 -1
  35. package/lib/esm/test/annotations/TextBlock.test.js +2 -15
  36. package/lib/esm/test/annotations/TextBlock.test.js.map +1 -1
  37. package/package.json +12 -12
@@ -0,0 +1,53 @@
1
+ /** @packageDocumentation
2
+ * @module ElementGeometry
3
+ */
4
+ import { ElementGeometry, GeometryParams, TextAnnotationLeader, TextFrameStyleProps } from "@itwin/core-common";
5
+ import { Loop, Path, Point3d, Transform, Vector3d } from "@itwin/core-geometry";
6
+ import { TextBlockLayout } from "./TextBlockLayout";
7
+ /**
8
+ * Constructs and appends leader lines and their terminators to the provided geometry builder for a text annotation.
9
+ *
10
+ * This function processes an array of `TextAnnotationLeader` objects, computes their attachment points
11
+ * relative to a text frame (or a default rectangular frame if none is provided), and appends the leader
12
+ * line and terminator geometry to the builder. It also applies color overrides if specified
13
+ * in the leader's style overrides.
14
+ *
15
+ * @param builder - The geometry builder to which the leader geometries will be appended.
16
+ * @param leaders - An array of leader properties.
17
+ * @param layout - The layout information for the text block, including its range.
18
+ * @param transform - The transform to apply to the frame and leader geometry.
19
+ * @param params - The geometry parameters, such as color, to use for the leader lines.
20
+ * @param frame - (Optional) The style properties for the text frame. If not provided or set to "none", a default rectangle is used.
21
+ * @returns `true` if at least one leader with a terminator was successfully appended; otherwise, `false`.
22
+ * @beta
23
+ */
24
+ export declare function appendLeadersToBuilder(builder: ElementGeometry.Builder, leaders: TextAnnotationLeader[], layout: TextBlockLayout, transform: Transform, params: GeometryParams, frame?: TextFrameStyleProps): boolean;
25
+ /**
26
+ * Computes the direction vector for an "elbow" for leader based on the attachment point and a frame curve.
27
+ * The elbow direction is determined by whether the attachment point is closer to the left or right side of the frame.
28
+ * If the computed elbow would be tangent to the frame at the intersection, no elbow direction is returned.
29
+ *
30
+ * @param attachmentPoint - The point where the leader attaches.
31
+ * @param frameCurve - The frame curve (either a Loop or Path) to which the leader is attached.
32
+ * @param elbowLength - The length of the elbow segment to be created.
33
+ * @returns The direction vector for the elbow, or `undefined` if the elbow would be tangent to the frame.
34
+ * @beta
35
+ */
36
+ export declare function computeElbowDirection(attachmentPoint: Point3d, frameCurve: Loop | Path, elbowLength: number): Vector3d | undefined;
37
+ /**
38
+ * Computes the attachment point for a leader line on a text annotation frame.
39
+ *
40
+ * The attachment point is determined based on the leader's attachment mode:
41
+ * - `"Nearest"`: Finds the closest point on the frame curve to the leader's start point.
42
+ * - `"KeyPoint"`: Uses a specific curve segment and fraction along that segment to determine the point.
43
+ * - `"TextPoint"`: Calculates a point on the text layout (top/bottom, left/right) and projects it onto the frame curve.
44
+ *
45
+ * @param leader - The leader props.
46
+ * @param frameCurve - The curve (Loop or Path) representing the annotation frame.
47
+ * @param textLayout - The layout information for the text block.
48
+ * @param transform - The transform applied to the text layout.
49
+ * @returns The computed attachment point as a `Point3d`, or `undefined` if it cannot be determined.
50
+ * @beta
51
+ */
52
+ export declare function computeLeaderAttachmentPoint(leader: TextAnnotationLeader, frameCurve: Loop | Path, textLayout: TextBlockLayout, transform: Transform): Point3d | undefined;
53
+ //# sourceMappingURL=LeaderGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeaderGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/LeaderGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAA2C,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEzH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAwDrN;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA4BlI;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,EAC5B,UAAU,EAAE,IAAI,GAAG,IAAI,EACvB,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,SAAS,GACnB,OAAO,GAAG,SAAS,CAyCrB"}
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module ElementGeometry
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.appendLeadersToBuilder = appendLeadersToBuilder;
11
+ exports.computeElbowDirection = computeElbowDirection;
12
+ exports.computeLeaderAttachmentPoint = computeLeaderAttachmentPoint;
13
+ const core_common_1 = require("@itwin/core-common");
14
+ const core_geometry_1 = require("@itwin/core-geometry");
15
+ const FrameGeometry_1 = require("./FrameGeometry");
16
+ /**
17
+ * Constructs and appends leader lines and their terminators to the provided geometry builder for a text annotation.
18
+ *
19
+ * This function processes an array of `TextAnnotationLeader` objects, computes their attachment points
20
+ * relative to a text frame (or a default rectangular frame if none is provided), and appends the leader
21
+ * line and terminator geometry to the builder. It also applies color overrides if specified
22
+ * in the leader's style overrides.
23
+ *
24
+ * @param builder - The geometry builder to which the leader geometries will be appended.
25
+ * @param leaders - An array of leader properties.
26
+ * @param layout - The layout information for the text block, including its range.
27
+ * @param transform - The transform to apply to the frame and leader geometry.
28
+ * @param params - The geometry parameters, such as color, to use for the leader lines.
29
+ * @param frame - (Optional) The style properties for the text frame. If not provided or set to "none", a default rectangle is used.
30
+ * @returns `true` if at least one leader with a terminator was successfully appended; otherwise, `false`.
31
+ * @beta
32
+ */
33
+ function appendLeadersToBuilder(builder, leaders, layout, transform, params, frame) {
34
+ let result = true;
35
+ // If there is no frame, use a rectangular frame to compute the attachmentPoints for leaders.
36
+ if (frame === undefined || frame.shape === "none") {
37
+ frame = { shape: "rectangle" };
38
+ }
39
+ if (frame.shape === undefined || frame.shape === "none")
40
+ return false;
41
+ const frameCurve = (0, FrameGeometry_1.computeFrame)({ frame: frame.shape, range: layout.range, transform });
42
+ for (const leader of leaders) {
43
+ if (leader.styleOverrides?.leader?.color !== "subcategory" && leader.styleOverrides?.color !== "subcategory") {
44
+ const color = leader.styleOverrides?.leader?.color ?? leader.styleOverrides?.color;
45
+ params.lineColor = color ? core_common_1.ColorDef.fromJSON(color) : core_common_1.ColorDef.black;
46
+ result = result && builder.appendGeometryParamsChange(params);
47
+ }
48
+ const attachmentPoint = computeLeaderAttachmentPoint(leader, frameCurve, layout, transform);
49
+ if (!attachmentPoint)
50
+ return false;
51
+ // Leader line geometry
52
+ const leaderLinePoints = [];
53
+ leaderLinePoints.push(leader.startPoint);
54
+ leader.intermediatePoints?.forEach((point) => {
55
+ leaderLinePoints.push(point);
56
+ });
57
+ if (leader.styleOverrides?.leader?.wantElbow) {
58
+ const elbowLength = (leader.styleOverrides.leader.elbowLength ?? 1) * (leader.styleOverrides.lineHeight ?? 1);
59
+ const elbowDirection = computeElbowDirection(attachmentPoint, frameCurve, elbowLength);
60
+ if (elbowDirection)
61
+ leaderLinePoints.push(attachmentPoint.plusScaled(elbowDirection, elbowLength));
62
+ }
63
+ leaderLinePoints.push(attachmentPoint);
64
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create(leaderLinePoints));
65
+ // Terminator geometry
66
+ const terminatorDirection = core_geometry_1.Vector3d.createStartEnd(leaderLinePoints[0], leaderLinePoints[1]).normalize();
67
+ const termY = terminatorDirection?.unitCrossProduct(core_geometry_1.Vector3d.unitZ());
68
+ if (!termY || !terminatorDirection)
69
+ continue; // Assuming leaders without terminators is a valid case.
70
+ const terminatorHeight = (leader.styleOverrides?.leader?.terminatorHeightFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);
71
+ const terminatorWidth = (leader.styleOverrides?.leader?.terminatorWidthFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);
72
+ const basePoint = leader.startPoint.plusScaled(terminatorDirection, terminatorWidth);
73
+ const termPointA = basePoint.plusScaled(termY, terminatorHeight);
74
+ const termPointB = basePoint.plusScaled(termY.negate(), terminatorHeight);
75
+ result = result && builder.appendGeometryQuery(core_geometry_1.LineString3d.create([termPointA, leader.startPoint, termPointB]));
76
+ }
77
+ return result;
78
+ }
79
+ /**
80
+ * Computes the direction vector for an "elbow" for leader based on the attachment point and a frame curve.
81
+ * The elbow direction is determined by whether the attachment point is closer to the left or right side of the frame.
82
+ * If the computed elbow would be tangent to the frame at the intersection, no elbow direction is returned.
83
+ *
84
+ * @param attachmentPoint - The point where the leader attaches.
85
+ * @param frameCurve - The frame curve (either a Loop or Path) to which the leader is attached.
86
+ * @param elbowLength - The length of the elbow segment to be created.
87
+ * @returns The direction vector for the elbow, or `undefined` if the elbow would be tangent to the frame.
88
+ * @beta
89
+ */
90
+ function computeElbowDirection(attachmentPoint, frameCurve, elbowLength) {
91
+ let elbowDirection;
92
+ // Determine the direction based on the closest point's position relative to the frame
93
+ const isCloserToLeft = Math.abs(attachmentPoint.x - frameCurve.range().low.x) < Math.abs(attachmentPoint.x - frameCurve.range().high.x);
94
+ // Decide the direction: left (-X) or right (+X)
95
+ elbowDirection = isCloserToLeft ? core_geometry_1.Vector3d.unitX().negate() : core_geometry_1.Vector3d.unitX();
96
+ // Verify if the elbow is a tangent to the frame, if yes, do not create an elbow
97
+ const elbowPoint = attachmentPoint.plusScaled(elbowDirection, elbowLength);
98
+ const elbowLine = core_geometry_1.LineSegment3d.create(attachmentPoint, elbowPoint);
99
+ // Find intersection points between the elbow and the frame
100
+ const intersections = core_geometry_1.CurveCurve.intersectionXYZPairs(elbowLine, false, frameCurve, false);
101
+ // As the elbow will intersect the frame only at one point, we can safely use the first intersection
102
+ const intersection = intersections[0];
103
+ const curveFraction = intersection.detailB.fraction;
104
+ const derivative = intersection.detailB.curve?.fractionToPointAndDerivative(curveFraction);
105
+ const tangent = derivative?.direction.normalize();
106
+ const lineDirection = core_geometry_1.Vector3d.createStartEnd(elbowLine.point0Ref, elbowLine.point1Ref).normalize();
107
+ if (tangent && lineDirection) {
108
+ const dot = tangent.dotProduct(lineDirection);
109
+ // If the tangent and line direction are aligned (dot product close to 1 or -1), it's tangent
110
+ if (Math.abs(dot) > 0.999) {
111
+ elbowDirection = undefined;
112
+ }
113
+ }
114
+ return elbowDirection;
115
+ }
116
+ /**
117
+ * Computes the attachment point for a leader line on a text annotation frame.
118
+ *
119
+ * The attachment point is determined based on the leader's attachment mode:
120
+ * - `"Nearest"`: Finds the closest point on the frame curve to the leader's start point.
121
+ * - `"KeyPoint"`: Uses a specific curve segment and fraction along that segment to determine the point.
122
+ * - `"TextPoint"`: Calculates a point on the text layout (top/bottom, left/right) and projects it onto the frame curve.
123
+ *
124
+ * @param leader - The leader props.
125
+ * @param frameCurve - The curve (Loop or Path) representing the annotation frame.
126
+ * @param textLayout - The layout information for the text block.
127
+ * @param transform - The transform applied to the text layout.
128
+ * @returns The computed attachment point as a `Point3d`, or `undefined` if it cannot be determined.
129
+ * @beta
130
+ */
131
+ function computeLeaderAttachmentPoint(leader, frameCurve, textLayout, transform) {
132
+ let attachmentPoint;
133
+ if (leader.attachment.mode === "Nearest") {
134
+ attachmentPoint = frameCurve.closestPoint(leader.startPoint)?.point;
135
+ }
136
+ else if (leader.attachment.mode === "KeyPoint") {
137
+ const curves = frameCurve.collectCurvePrimitives(undefined, false, true);
138
+ const curveIndex = leader.attachment.curveIndex;
139
+ const fraction = leader.attachment.fraction;
140
+ if (curveIndex >= curves.length) {
141
+ // If the curveIndex is invalid, use the last curve
142
+ // This is a fallback to avoid out-of-bounds access
143
+ attachmentPoint = curves[curves.length - 1].fractionToPoint(fraction);
144
+ }
145
+ else {
146
+ attachmentPoint = curves[curveIndex].fractionToPoint(fraction);
147
+ }
148
+ }
149
+ else { // attachment.mode="TextPoint"
150
+ let scaleDirection = transform.matrix.getColumn(0).negate(); // direction to draw a scaled line from text attachment point to find intersection point on frame
151
+ let lineIndex;
152
+ if (leader.attachment.position.includes("Top")) {
153
+ lineIndex = 0;
154
+ }
155
+ else {
156
+ lineIndex = textLayout.lines.length - 1;
157
+ }
158
+ const lineRange = textLayout.lines[lineIndex].range;
159
+ const lineOffset = textLayout.lines[lineIndex].offsetFromDocument;
160
+ const origin = transform.multiplyPoint3d(core_geometry_1.Point3d.fromJSON(lineOffset));
161
+ let attachmentPointOnText = origin.plusScaled(transform.matrix.getColumn(1), ((lineRange.yLength()) / 2));
162
+ if (leader.attachment.position.includes("Right")) {
163
+ attachmentPointOnText = attachmentPointOnText.plusScaled(transform.matrix.getColumn(0), lineRange.xLength());
164
+ scaleDirection = scaleDirection.negate();
165
+ }
166
+ // Find the nearest intersection point on the frame to get the correct attachment point
167
+ // Extend the direction vector to create a target point far along the direction
168
+ const targetPoint = attachmentPointOnText.plusScaled(scaleDirection, 1e6); // Scale the direction vector to a large value
169
+ const intersectionLine = core_geometry_1.LineSegment3d.create(attachmentPointOnText, targetPoint);
170
+ const closestPointDetail = core_geometry_1.CurveCurve.intersectionXYZPairs(intersectionLine, false, frameCurve, false);
171
+ attachmentPoint = closestPointDetail[0]?.detailA.point;
172
+ }
173
+ return attachmentPoint;
174
+ }
175
+ //# sourceMappingURL=LeaderGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeaderGeometry.js","sourceRoot":"","sources":["../../../src/annotations/LeaderGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAwBH,wDAwDC;AAcD,sDA4BC;AAiBD,oEA8CC;AAvLD,oDAA0H;AAC1H,wDAAyH;AACzH,mDAA+C;AAG/C;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,sBAAsB,CAAC,OAAgC,EAAE,OAA+B,EAAE,MAAuB,EAAE,SAAoB,EAAE,MAAsB,EAAE,KAA2B;IAC1M,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,6FAA6F;IAC7F,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QAClD,KAAK,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA;IAChC,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACtE,MAAM,UAAU,GAAG,IAAA,4BAAY,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAExF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,KAAK,aAAa,IAAI,MAAM,CAAC,cAAc,EAAE,KAAK,KAAK,aAAa,EAAE,CAAC;YAC7G,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,IAAI,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC;YACnF,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,sBAAQ,CAAC,QA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;IACzD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,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/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { ColorDef, ElementGeometry, GeometryParams, TextAnnotationLeader, TextFrameStyleProps } from \"@itwin/core-common\";\nimport { CurveCurve, LineSegment3d, LineString3d, Loop, Path, Point3d, Transform, Vector3d } from \"@itwin/core-geometry\";\nimport { computeFrame } from \"./FrameGeometry\";\nimport { TextBlockLayout } from \"./TextBlockLayout\";\n\n/**\n * Constructs and appends leader lines and their terminators to the provided geometry builder for a text annotation.\n *\n * This function processes an array of `TextAnnotationLeader` objects, computes their attachment points\n * relative to a text frame (or a default rectangular frame if none is provided), and appends the leader\n * line and terminator geometry to the builder. It also applies color overrides if specified\n * in the leader's style overrides.\n *\n * @param builder - The geometry builder to which the leader geometries will be appended.\n * @param leaders - An array of leader properties.\n * @param layout - The layout information for the text block, including its range.\n * @param transform - The transform to apply to the frame and leader geometry.\n * @param params - The geometry parameters, such as color, to use for the leader lines.\n * @param frame - (Optional) The style properties for the text frame. If not provided or set to \"none\", a default rectangle is used.\n * @returns `true` if at least one leader with a terminator was successfully appended; otherwise, `false`.\n * @beta\n */\nexport function appendLeadersToBuilder(builder: ElementGeometry.Builder, leaders: TextAnnotationLeader[], layout: TextBlockLayout, transform: Transform, params: GeometryParams, frame?: TextFrameStyleProps): boolean {\n let result = true;\n\n // If there is no frame, use a rectangular frame to compute the attachmentPoints for leaders.\n if (frame === undefined || frame.shape === \"none\") {\n frame = { shape: \"rectangle\" }\n }\n if (frame.shape === undefined || frame.shape === \"none\") return false;\n const frameCurve = computeFrame({ frame: frame.shape, range: layout.range, transform });\n\n for (const leader of leaders) {\n if (leader.styleOverrides?.leader?.color !== \"subcategory\" && leader.styleOverrides?.color !== \"subcategory\") {\n const color = leader.styleOverrides?.leader?.color ?? leader.styleOverrides?.color;\n params.lineColor = color ? ColorDef.fromJSON(color) : ColorDef.black;\n result = result && builder.appendGeometryParamsChange(params);\n }\n\n const attachmentPoint = computeLeaderAttachmentPoint(leader, frameCurve, layout, transform);\n if (!attachmentPoint) return false;\n\n // Leader line geometry\n const leaderLinePoints: Point3d[] = [];\n\n leaderLinePoints.push(leader.startPoint)\n\n leader.intermediatePoints?.forEach((point) => {\n leaderLinePoints.push(point);\n });\n\n if (leader.styleOverrides?.leader?.wantElbow) {\n const elbowLength = (leader.styleOverrides.leader.elbowLength ?? 1) * (leader.styleOverrides.lineHeight ?? 1)\n const elbowDirection = computeElbowDirection(attachmentPoint, frameCurve, elbowLength);\n if (elbowDirection)\n leaderLinePoints.push(attachmentPoint.plusScaled(elbowDirection, elbowLength))\n }\n\n leaderLinePoints.push(attachmentPoint)\n\n result = result && builder.appendGeometryQuery(LineString3d.create(leaderLinePoints));\n\n // Terminator geometry\n const terminatorDirection = Vector3d.createStartEnd(\n leaderLinePoints[0], leaderLinePoints[1]\n ).normalize();\n\n const termY = terminatorDirection?.unitCrossProduct(Vector3d.unitZ());\n if (!termY || !terminatorDirection) continue; // Assuming leaders without terminators is a valid case.\n const terminatorHeight = (leader.styleOverrides?.leader?.terminatorHeightFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);\n const terminatorWidth = (leader.styleOverrides?.leader?.terminatorWidthFactor ?? 1) * (leader.styleOverrides?.lineHeight ?? 1);\n const basePoint = leader.startPoint.plusScaled(terminatorDirection, terminatorWidth);\n const termPointA = basePoint.plusScaled(termY, terminatorHeight);\n const termPointB = basePoint.plusScaled(termY.negate(), terminatorHeight);\n result = result && builder.appendGeometryQuery(LineString3d.create([termPointA, leader.startPoint, termPointB]));\n\n }\n return result;\n}\n\n\n/**\n * Computes the direction vector for an \"elbow\" for leader based on the attachment point and a frame curve.\n * The elbow direction is determined by whether the attachment point is closer to the left or right side of the frame.\n * If the computed elbow would be tangent to the frame at the intersection, no elbow direction is returned.\n *\n * @param attachmentPoint - The point where the leader attaches.\n * @param frameCurve - The frame curve (either a Loop or Path) to which the leader is attached.\n * @param elbowLength - The length of the elbow segment to be created.\n * @returns The direction vector for the elbow, or `undefined` if the elbow would be tangent to the frame.\n * @beta\n */\nexport function computeElbowDirection(attachmentPoint: Point3d, frameCurve: Loop | Path, elbowLength: number): Vector3d | undefined {\n\n let elbowDirection: Vector3d | undefined;\n // Determine the direction based on the closest point's position relative to the frame\n const isCloserToLeft = Math.abs(attachmentPoint.x - frameCurve.range().low.x) < Math.abs(attachmentPoint.x - frameCurve.range().high.x);\n\n // Decide the direction: left (-X) or right (+X)\n elbowDirection = isCloserToLeft ? Vector3d.unitX().negate() : Vector3d.unitX();\n\n // Verify if the elbow is a tangent to the frame, if yes, do not create an elbow\n const elbowPoint = attachmentPoint.plusScaled(elbowDirection, elbowLength);\n const elbowLine = LineSegment3d.create(attachmentPoint, elbowPoint);\n // Find intersection points between the elbow and the frame\n const intersections = CurveCurve.intersectionXYZPairs(elbowLine, false, frameCurve, false);\n // As the elbow will intersect the frame only at one point, we can safely use the first intersection\n const intersection = intersections[0];\n const curveFraction = intersection.detailB.fraction;\n const derivative = intersection.detailB.curve?.fractionToPointAndDerivative(curveFraction);\n const tangent = derivative?.direction.normalize();\n const lineDirection = Vector3d.createStartEnd(elbowLine.point0Ref, elbowLine.point1Ref).normalize();\n if (tangent && lineDirection) {\n const dot = tangent.dotProduct(lineDirection);\n // If the tangent and line direction are aligned (dot product close to 1 or -1), it's tangent\n if (Math.abs(dot) > 0.999) {\n elbowDirection = undefined;\n }\n }\n return elbowDirection;\n}\n\n/**\n * Computes the attachment point for a leader line on a text annotation frame.\n *\n * The attachment point is determined based on the leader's attachment mode:\n * - `\"Nearest\"`: Finds the closest point on the frame curve to the leader's start point.\n * - `\"KeyPoint\"`: Uses a specific curve segment and fraction along that segment to determine the point.\n * - `\"TextPoint\"`: Calculates a point on the text layout (top/bottom, left/right) and projects it onto the frame curve.\n *\n * @param leader - The leader props.\n * @param frameCurve - The curve (Loop or Path) representing the annotation frame.\n * @param textLayout - The layout information for the text block.\n * @param transform - The transform applied to the text layout.\n * @returns The computed attachment point as a `Point3d`, or `undefined` if it cannot be determined.\n * @beta\n */\nexport function computeLeaderAttachmentPoint(\n leader: TextAnnotationLeader,\n frameCurve: Loop | Path,\n textLayout: TextBlockLayout,\n transform: Transform\n): Point3d | undefined {\n let attachmentPoint: Point3d | undefined;\n\n if (leader.attachment.mode === \"Nearest\") {\n attachmentPoint = frameCurve.closestPoint(leader.startPoint)?.point;\n } else if (leader.attachment.mode === \"KeyPoint\") {\n const curves = frameCurve.collectCurvePrimitives(undefined, false, true);\n const curveIndex = leader.attachment.curveIndex;\n const fraction = leader.attachment.fraction;\n if (curveIndex >= curves.length) {\n // If the curveIndex is invalid, use the last curve\n // This is a fallback to avoid out-of-bounds access\n attachmentPoint = curves[curves.length - 1].fractionToPoint(fraction);\n } else {\n attachmentPoint = curves[curveIndex].fractionToPoint(fraction);\n }\n } else { // attachment.mode=\"TextPoint\"\n let scaleDirection = transform.matrix.getColumn(0).negate(); // direction to draw a scaled line from text attachment point to find intersection point on frame\n let lineIndex: number;\n if (leader.attachment.position.includes(\"Top\")) {\n lineIndex = 0\n } else {\n lineIndex = textLayout.lines.length - 1\n }\n const lineRange = textLayout.lines[lineIndex].range;\n const lineOffset = textLayout.lines[lineIndex].offsetFromDocument;\n const origin = transform.multiplyPoint3d(Point3d.fromJSON(lineOffset));\n let attachmentPointOnText = origin.plusScaled(transform.matrix.getColumn(1), ((lineRange.yLength()) / 2));\n\n if (leader.attachment.position.includes(\"Right\")) {\n attachmentPointOnText = attachmentPointOnText.plusScaled(transform.matrix.getColumn(0), lineRange.xLength());\n scaleDirection = scaleDirection.negate();\n }\n // Find the nearest intersection point on the frame to get the correct attachment point\n // Extend the direction vector to create a target point far along the direction\n const targetPoint = attachmentPointOnText.plusScaled(scaleDirection, 1e6); // Scale the direction vector to a large value\n const intersectionLine = LineSegment3d.create(attachmentPointOnText, targetPoint);\n const closestPointDetail = CurveCurve.intersectionXYZPairs(intersectionLine, false, frameCurve, false);\n attachmentPoint = closestPointDetail[0]?.detailA.point;\n }\n return attachmentPoint;\n}"]}
@@ -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,EAAuB,MAAM,oBAAoB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,4GAA4G;IAC5G,eAAe,EAAE,mBAAmB,CAAC;IACrC,qDAAqD;IACrD,MAAM,EAAE,eAAe,CAAC;IACxB,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,CAwB7F"}
1
+ {"version":3,"file":"TextAnnotationGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAA+C,mBAAmB,EAAuB,MAAM,oBAAoB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,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,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,CA6B7F"}
@@ -13,6 +13,7 @@ const core_geometry_1 = require("@itwin/core-geometry");
13
13
  const core_bentley_1 = require("@itwin/core-bentley");
14
14
  const TextBlockGeometry_1 = require("./TextBlockGeometry");
15
15
  const FrameGeometry_1 = require("./FrameGeometry");
16
+ const LeaderGeometry_1 = require("./LeaderGeometry");
16
17
  /** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.
17
18
  * @returns true if the geometry was successfully appended.
18
19
  * @beta
@@ -30,6 +31,10 @@ function appendTextAnnotationGeometry(props) {
30
31
  if (annotation.frame && annotation.frame.shape !== "none") {
31
32
  result = result && (0, FrameGeometry_1.appendFrameToBuilder)(props.builder, annotation.frame, range, transform, params);
32
33
  }
34
+ // Construct the leader geometry
35
+ if (annotation.leaders && annotation.leaders.length > 0) {
36
+ result = result && (0, LeaderGeometry_1.appendLeadersToBuilder)(props.builder, annotation.leaders, props.layout, transform, params, annotation.frame);
37
+ }
33
38
  // Construct the debug geometry
34
39
  if (props.wantDebugGeometry) {
35
40
  result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));
@@ -1 +1 @@
1
- {"version":3,"file":"TextAnnotationGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAiCH,oEAwBC;AAvDD,oDAAsJ;AAEtJ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AAC;QAC1G,iBAAiB,CAAC,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAEnE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACtB,oCAAoC;YACpC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAQ,CAAC,KAAK,CAAC;YAElD,mDAAmD;YACnD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,MAAM,WAAW,GAAG,IAAI,4BAAc,CAAC,mBAAI,CAAC,OAAO,CAAC,CAAC;gBACrD,WAAW,CAAC,SAAS,GAAG,KAAK,CAAC;gBAC9B,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;gBACnE,SAAS,GAAG,KAAK,CAAC;YACpB,CAAC;YAED,8CAA8C;YAC9C,MAAM,QAAQ,GAAG,yBAAS,CAAC,oBAAoB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/F,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAEzD,uCAAuC;YACvC,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7C,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;YACjD,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC,4BAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,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/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotation, TextAnnotationProps, TextFrameStyleProps } from \"@itwin/core-common\";\nimport { TextBlockLayout } from \"./TextBlockLayout\";\nimport { LineString3d, PointString3d, Range2d, Transform } from \"@itwin/core-geometry\";\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { produceTextBlockGeometry } from \"./TextBlockGeometry\";\nimport { appendFrameToBuilder, computeIntervalPoints } from \"./FrameGeometry\";\n\n/**\n * Properties required to compute the geometry of a text annotation.\n * @beta\n * @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].\n */\nexport interface AppendTextAnnotationGeometryArgs {\n /** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */\n annotationProps: TextAnnotationProps;\n /** Layout provided by calling [[layoutTextBlock]] */\n layout: TextBlockLayout;\n /** Builder that will be added to in place */\n builder: ElementGeometry.Builder;\n /** The category the element will belong to. This will passed into the [[GeometryParams]] */\n categoryId: Id64String\n /** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */\n subCategoryId?: Id64String\n /** Whether or not to draw geometry for things like the snap points, range, and anchor point */\n wantDebugGeometry?: boolean;\n}\n\n/** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.\n * @returns true if the geometry was successfully appended.\n * @beta\n */\nexport function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean {\n const annotation = TextAnnotation.fromJSON(props.annotationProps);\n const range = Range2d.fromJSON(props.layout.range);\n const transform = annotation.computeTransform(range);\n let result = true;\n\n // Construct the TextBlockGeometry\n const params = new GeometryParams(props.categoryId, props.subCategoryId);\n const entries = produceTextBlockGeometry(props.layout, annotation.computeTransform(props.layout.range));\n result = result && props.builder.appendTextBlock(entries, params);\n\n // Construct the frame geometry\n if (annotation.frame && annotation.frame.shape !== \"none\") {\n result = result && appendFrameToBuilder(props.builder, annotation.frame, range, transform, params);\n }\n\n // Construct the debug geometry\n if (props.wantDebugGeometry) {\n result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));\n result = result && debugRunLayout(props.builder, props.layout, annotation.computeTransform(props.layout.range));\n if (annotation.frame) result = result && debugSnapPoints(props.builder, annotation.frame, props.layout.range, annotation.computeTransform(props.layout.range));\n }\n\n return result;\n};\n\n/**\n * Draws the anchor point and margins of the text annotation.\n * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).\n * The margins are drawn as a blue box.\n * The text range is drawn as a red box.\n */\nfunction debugAnchorPoint(builder: ElementGeometry.Builder, annotation: TextAnnotation, layout: TextBlockLayout, transform: Transform): boolean {\n const range = Range2d.fromJSON(layout.range);\n const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));\n\n // Make it blue\n const blueLineParams = new GeometryParams(Id64.invalid);\n blueLineParams.lineColor = ColorDef.blue;\n let result = builder.appendGeometryParamsChange(blueLineParams);\n\n // Draw a blue box to show the element's margin\n const marginCorners = range.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(marginCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(marginCorners));\n\n // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));\n\n // Draw a red box to show the text range\n const redLineParams = new GeometryParams(Id64.invalid);\n redLineParams.lineColor = ColorDef.red;\n result = result && builder.appendGeometryParamsChange(redLineParams);\n\n const rangeCorners = layout.textRange.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(rangeCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(rangeCorners));\n\n return result;\n}\n\n/** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */\nfunction debugSnapPoints(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform): boolean {\n if (undefined === frame.shape || frame.shape === \"none\")\n return false;\n const points = computeIntervalPoints({ frame: frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });\n\n const params = new GeometryParams(Id64.invalid);\n params.lineColor = ColorDef.black;\n params.weight = (frame.borderWeight ?? 1) * 5; // We want the dots to be bigger than the frame so we can see them.\n params.fillDisplay = FillDisplay.Always;\n\n const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(PointString3d.create(points));\n return result;\n}\n\n/**\n * Draws debug geometry for each line and run in a TextBlockLayout.\n *\n * For each line and run, this function draws boxes to visualize their layout and boundaries.\n * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.\n * This is useful for debugging text layout and alignment issues.\n *\n * @param builder - The geometry builder to append debug geometry to.\n * @param layout - The text block layout containing lines and runs to visualize.\n * @param documentTransform - The transform to apply to the entire document.\n * @returns True if all debug geometry was successfully appended.\n */\nfunction debugRunLayout(builder: ElementGeometry.Builder, layout: TextBlockLayout, documentTransform: Transform): boolean {\n let result = true; // Tracks if all geometry was appended successfully\n let color = ColorDef.black; // Current color for the run type\n let lastColor = color; // Last color used, to minimize param changes\n\n // Map run types to debug colors\n const colors = {\n \"text\": ColorDef.fromString(\"orange\"),\n \"linebreak\": ColorDef.fromString(\"yellow\"),\n \"fraction\": ColorDef.fromString(\"green\"),\n \"tab\": ColorDef.fromString(\"aquamarine\"),\n }\n\n layout.lines.forEach(line => {\n // Apply the line's offset transform\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\n documentTransform.multiplyTransformTransform(lineTrans, lineTrans);\n\n line.runs.forEach(run => {\n // Determine color for this run type\n color = colors[run.source.type] ?? ColorDef.black;\n\n // Only change geometry params if the color changes\n if (!lastColor.equals(color)) {\n const colorParams = new GeometryParams(Id64.invalid);\n colorParams.lineColor = color;\n result = result && builder.appendGeometryParamsChange(colorParams);\n lastColor = color;\n }\n\n // Apply the line's offset to the run's offset\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\n\n // Draw the enclosing range for the run\n const runCorners = run.range.corners3d(true);\n runTrans.multiplyPoint3dArrayInPlace(runCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(runCorners));\n });\n });\n\n return result;\n}"]}
1
+ {"version":3,"file":"TextAnnotationGeometry.js","sourceRoot":"","sources":["../../../src/annotations/TextAnnotationGeometry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AAkCH,oEA6BC;AA7DD,oDAAsJ;AAEtJ,wDAAuF;AACvF,sDAAuD;AACvD,2DAA+D;AAC/D,mDAA8E;AAC9E,qDAA0D;AAsB1D;;;GAGG;AACH,SAAgB,4BAA4B,CAAC,KAAuC;IAClF,MAAM,UAAU,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClE,MAAM,KAAK,GAAG,uBAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,SAAS,GAAG,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrD,IAAI,MAAM,GAAG,IAAI,CAAC;IAElB,kCAAkC;IAClC,MAAM,MAAM,GAAG,IAAI,4BAAc,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,IAAA,4CAAwB,EAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACxG,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE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SAAS,GAAG,KAAK,CAAC;gBAC9B,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;gBACnE,SAAS,GAAG,KAAK,CAAC;YACpB,CAAC;YAED,8CAA8C;YAC9C,MAAM,QAAQ,GAAG,yBAAS,CAAC,oBAAoB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/F,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAEzD,uCAAuC;YACvC,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7C,QAAQ,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;YACjD,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC,4BAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,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/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { ColorDef, ElementGeometry, FillDisplay, GeometryParams, TextAnnotation, TextAnnotationProps, TextFrameStyleProps } from \"@itwin/core-common\";\nimport { TextBlockLayout } from \"./TextBlockLayout\";\nimport { LineString3d, PointString3d, Range2d, Transform } from \"@itwin/core-geometry\";\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { produceTextBlockGeometry } from \"./TextBlockGeometry\";\nimport { appendFrameToBuilder, computeIntervalPoints } from \"./FrameGeometry\";\nimport { appendLeadersToBuilder } from \"./LeaderGeometry\";\n\n/**\n * Properties required to compute the geometry of a text annotation.\n * @beta\n * @see [[appendTextAnnotationGeometry]] to append the geometry to an [[ElementGeometry.Builder]].\n */\nexport interface AppendTextAnnotationGeometryArgs {\n /** The annotation to be drawn. Be sure to include a TextBlock with runs or no geometry will be produced. */\n annotationProps: TextAnnotationProps;\n /** Layout provided by calling [[layoutTextBlock]] */\n layout: TextBlockLayout;\n /** Builder that will be added to in place */\n builder: ElementGeometry.Builder;\n /** The category the element will belong to. This will passed into the [[GeometryParams]] */\n categoryId: Id64String\n /** The optional sub-category the element will belong to. This will passed into the [[GeometryParams]] */\n subCategoryId?: Id64String\n /** Whether or not to draw geometry for things like the snap points, range, and anchor point */\n wantDebugGeometry?: boolean;\n}\n\n/** Constructs the TextBlockGeometry and frame geometry and appends the geometry to the provided builder.\n * @returns true if the geometry was successfully appended.\n * @beta\n */\nexport function appendTextAnnotationGeometry(props: AppendTextAnnotationGeometryArgs): boolean {\n const annotation = TextAnnotation.fromJSON(props.annotationProps);\n const range = Range2d.fromJSON(props.layout.range);\n const transform = annotation.computeTransform(range);\n let result = true;\n\n // Construct the TextBlockGeometry\n const params = new GeometryParams(props.categoryId, props.subCategoryId);\n const entries = produceTextBlockGeometry(props.layout, annotation.computeTransform(props.layout.range));\n result = result && props.builder.appendTextBlock(entries, params);\n\n // Construct the frame geometry\n if (annotation.frame && annotation.frame.shape !== \"none\") {\n result = result && appendFrameToBuilder(props.builder, annotation.frame, range, transform, params);\n }\n\n // Construct the leader geometry\n if (annotation.leaders && annotation.leaders.length > 0) {\n result = result && appendLeadersToBuilder(props.builder, annotation.leaders, props.layout, transform, params, annotation.frame);\n }\n\n // Construct the debug geometry\n if (props.wantDebugGeometry) {\n result = result && debugAnchorPoint(props.builder, annotation, props.layout, annotation.computeTransform(props.layout.range));\n result = result && debugRunLayout(props.builder, props.layout, annotation.computeTransform(props.layout.range));\n if (annotation.frame) result = result && debugSnapPoints(props.builder, annotation.frame, props.layout.range, annotation.computeTransform(props.layout.range));\n }\n\n return result;\n};\n\n/**\n * Draws the anchor point and margins of the text annotation.\n * The anchor point is the point around which the text rotates and is drawn as a blue x (1m by 1m).\n * The margins are drawn as a blue box.\n * The text range is drawn as a red box.\n */\nfunction debugAnchorPoint(builder: ElementGeometry.Builder, annotation: TextAnnotation, layout: TextBlockLayout, transform: Transform): boolean {\n const range = Range2d.fromJSON(layout.range);\n const debugAnchorPt = transform.multiplyPoint3d(annotation.computeAnchorPoint(range));\n\n // Make it blue\n const blueLineParams = new GeometryParams(Id64.invalid);\n blueLineParams.lineColor = ColorDef.blue;\n let result = builder.appendGeometryParamsChange(blueLineParams);\n\n // Draw a blue box to show the element's margin\n const marginCorners = range.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(marginCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(marginCorners));\n\n // Draw a blue x to show the anchor point - Rotation occurs around this point. The x will be 1 m by 1 m.\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(-1, -1), debugAnchorPt.plusXYZ(1, 1)));\n result = result && builder.appendGeometryQuery(LineString3d.create(debugAnchorPt.plusXYZ(1, -1), debugAnchorPt.plusXYZ(-1, 1)));\n\n // Draw a red box to show the text range\n const redLineParams = new GeometryParams(Id64.invalid);\n redLineParams.lineColor = ColorDef.red;\n result = result && builder.appendGeometryParamsChange(redLineParams);\n\n const rangeCorners = layout.textRange.corners3d(true);\n transform.multiplyPoint3dArrayInPlace(rangeCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(rangeCorners));\n\n return result;\n}\n\n/** Draws the interval points defined by calling [[computeIntervalPoints]]. The points are shown as black dots 5x larger than the borderWeight */\nfunction debugSnapPoints(builder: ElementGeometry.Builder, frame: TextFrameStyleProps, range: Range2d, transform: Transform): boolean {\n if (undefined === frame.shape || frame.shape === \"none\")\n return false;\n const points = computeIntervalPoints({ frame: frame.shape, range, transform, lineIntervalFactor: 0.5, arcIntervalFactor: 0.25 });\n\n const params = new GeometryParams(Id64.invalid);\n params.lineColor = ColorDef.black;\n params.weight = (frame.borderWeight ?? 1) * 5; // We want the dots to be bigger than the frame so we can see them.\n params.fillDisplay = FillDisplay.Always;\n\n const result = builder.appendGeometryParamsChange(params) && builder.appendGeometryQuery(PointString3d.create(points));\n return result;\n}\n\n/**\n * Draws debug geometry for each line and run in a TextBlockLayout.\n *\n * For each line and run, this function draws boxes to visualize their layout and boundaries.\n * Different run types (e.g., text, linebreak, fraction, tab) are assigned distinct colors for clarity.\n * This is useful for debugging text layout and alignment issues.\n *\n * @param builder - The geometry builder to append debug geometry to.\n * @param layout - The text block layout containing lines and runs to visualize.\n * @param documentTransform - The transform to apply to the entire document.\n * @returns True if all debug geometry was successfully appended.\n */\nfunction debugRunLayout(builder: ElementGeometry.Builder, layout: TextBlockLayout, documentTransform: Transform): boolean {\n let result = true; // Tracks if all geometry was appended successfully\n let color = ColorDef.black; // Current color for the run type\n let lastColor = color; // Last color used, to minimize param changes\n\n // Map run types to debug colors\n const colors = {\n \"text\": ColorDef.fromString(\"orange\"),\n \"linebreak\": ColorDef.fromString(\"yellow\"),\n \"fraction\": ColorDef.fromString(\"green\"),\n \"tab\": ColorDef.fromString(\"aquamarine\"),\n }\n\n layout.lines.forEach(line => {\n // Apply the line's offset transform\n const lineTrans = Transform.createTranslationXYZ(line.offsetFromDocument.x, line.offsetFromDocument.y, 0);\n documentTransform.multiplyTransformTransform(lineTrans, lineTrans);\n\n line.runs.forEach(run => {\n // Determine color for this run type\n color = colors[run.source.type] ?? ColorDef.black;\n\n // Only change geometry params if the color changes\n if (!lastColor.equals(color)) {\n const colorParams = new GeometryParams(Id64.invalid);\n colorParams.lineColor = color;\n result = result && builder.appendGeometryParamsChange(colorParams);\n lastColor = color;\n }\n\n // Apply the line's offset to the run's offset\n const runTrans = Transform.createTranslationXYZ(run.offsetFromLine.x, run.offsetFromLine.y, 0);\n lineTrans.multiplyTransformTransform(runTrans, runTrans);\n\n // Draw the enclosing range for the run\n const runCorners = run.range.corners3d(true);\n runTrans.multiplyPoint3dArrayInPlace(runCorners);\n result = result && builder.appendGeometryQuery(LineString3d.create(runCorners));\n });\n });\n\n return result;\n}"]}
@@ -1,4 +1,5 @@
1
1
  export * from "./annotations/FrameGeometry";
2
+ export * from "./annotations/LeaderGeometry";
2
3
  export * from "./annotations/TextAnnotationElement";
3
4
  export * from "./annotations/TextAnnotationGeometry";
4
5
  export * from "./annotations/TextBlockGeometry";
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.d.ts","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":"AAKA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,C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;GAIG;AAEH;;;IAGI;AAEJ;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG"}
@@ -19,6 +19,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  __exportStar(require("./annotations/FrameGeometry"), exports);
22
+ __exportStar(require("./annotations/LeaderGeometry"), exports);
22
23
  __exportStar(require("./annotations/TextAnnotationElement"), exports);
23
24
  __exportStar(require("./annotations/TextAnnotationGeometry"), exports);
24
25
  __exportStar(require("./annotations/TextBlockGeometry"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;AAE/F,8DAA4C;AAC5C,sEAAoD;AACpD,uEAAqD;AACrD,kEAAgD;AAChD,gEAA8C;AAC9C,qDAAmC;AACnC,0DAAwC;AACxC,kDAAgC;AAChC,yDAAuC;AACvC,qDAAmC;AACnC,8CAA4B;AAC5B,6CAA2B;AAC3B,sDAAoC;AACpC,yDAAuC;AACvC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B;AAC9B,8CAA4B;AAC5B,6CAA2B;AAC3B,iDAA+B;AAC/B,+DAA6C;AAC7C,6DAA2C;AAC3C,4DAA0C;AAC1C,0DAAwC;AACxC,yCAAuB;AACvB,uDAAqC;AACrC,mDAAiC;AACjC,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,sDAAoC;AACpC,2CAAyB;AACzB,qDAAmC;AACnC,mDAAiC;AACjC,mDAAiC;AACjC,6CAA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;QAC7C,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;IAGI;AAEJ;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG","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\nexport * from \"./annotations/FrameGeometry\";\nexport * from \"./annotations/TextAnnotationElement\";\nexport * from \"./annotations/TextAnnotationGeometry\";\nexport * from \"./annotations/TextBlockGeometry\";\nexport * from \"./annotations/TextBlockLayout\";\nexport * from \"./BackendHubAccess\";\nexport * from \"./BackendLoggerCategory\";\nexport * from \"./BisCoreSchema\";\nexport * from \"./BlobContainerService\";\nexport * from \"./BriefcaseManager\";\nexport * from \"./CatalogDb\";\nexport * from \"./Category\";\nexport * from \"./ChangedElementsDb\";\nexport * from \"./ChangeSummaryManager\";\nexport * from \"./ChannelControl\";\nexport * from \"./CheckpointManager\";\nexport * from \"./ClassRegistry\";\nexport * from \"./CloudSqlite\";\nexport * from \"./CodeService\";\nexport * from \"./CodeSpecs\";\nexport * from \"./DevTools\";\nexport * from \"./DisplayStyle\";\nexport * from \"./domains/FunctionalElements\";\nexport * from \"./domains/FunctionalSchema\";\nexport * from \"./domains/GenericElements\";\nexport * from \"./domains/GenericSchema\";\nexport * from \"./ECDb\";\nexport * from \"./ECSchemaXmlContext\";\nexport * from \"./ECSqlStatement\";\nexport * from \"./Element\";\nexport * from \"./ElementAspect\";\nexport * from \"./ElementGraphics\";\nexport * from \"./ElementTreeWalker\";\nexport * from \"./Entity\";\nexport * from \"./EntityReferences\";\nexport * from \"./ExportGraphics\";\nexport * from \"./ExternalSource\";\nexport * from \"./FontFile\";\nexport * from \"./GeoCoordConfig\";\nexport * from \"./GeographicCRSServices\";\nexport * from \"./ImageSourceConversion\";\nexport * from \"./IModelDb\";\nexport * from \"./IModelDbFonts\";\nexport * from \"./IModelElementCloneContext\";\nexport * from \"./IModelHost\";\nexport * from \"./IModelJsFs\";\nexport * from \"./SchemaSync\";\nexport * from \"./IpcHost\";\nexport * from \"./LineStyle\";\nexport * from \"./LocalhostIpcHost\";\nexport * from \"./LocalHub\";\nexport * from \"./LockControl\";\nexport * from \"./Material\";\nexport * from \"./Model\";\nexport * from \"./NativeAppStorage\";\nexport * from \"./NativeHost\";\nexport * from \"./NavigationRelationship\";\nexport * from \"./PropertyStore\";\nexport * from \"./Relationship\";\nexport * from \"./rpc/tracing\";\nexport * from \"./Schema\";\nexport * from \"./SchemaUtils\";\nexport * from \"./SheetIndex\";\nexport * from \"./SQLiteDb\";\nexport * from \"./SqliteStatement\";\nexport * from \"./Texture\";\nexport * from \"./TileStorage\";\nexport * from \"./TxnManager\";\nexport * from \"./ViewDefinition\";\nexport * from \"./ViewStore\";\nexport * from \"./workspace/Settings\";\nexport * from \"./workspace/SettingsSchemas\";\nexport * from \"./workspace/Workspace\";\nexport * from \"./workspace/WorkspaceEditor\";\nexport * from \"./SqliteChangesetReader\";\nexport * from \"./ChangesetECAdaptor\";\n\nexport * from \"./internal/cross-package\";\n\nconst globalSymbolCoreBackend = Symbol.for(\"itwin.core.backend.globals\");\nif ((globalThis as any)[globalSymbolCoreBackend]) {\n // Get the stack trace from when the module was first loaded\n const firstLoadStack = (globalThis as any)[globalSymbolCoreBackend].stack;\n\n const error = new Error(\n \"Multiple @itwin/core-backend imports detected! This may happen if:\\n\" +\n \"- You have multiple versions of the package installed\\n\" +\n \"- Your bundling configuration is incorrect\\n\" +\n \"- You're importing from both ESM and CommonJS versions\"\n );\n\n /* eslint-disable no-console */\n console.error(\"Duplicate @itwin/core-backend import:\", error);\n console.error(\"First import occurred at:\", firstLoadStack);\n console.error(\"Current import occurred at:\", error.stack);\n /* eslint-enable no-console */\n\n throw error;\n} else {\n (globalThis as any)[globalSymbolCoreBackend] = {\n stack: new Error().stack,\n };\n}\n\n/** @docs-package-description\n * The core-backend package always runs on the computer with a local Briefcase.\n *\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\n */\n\n/**\n * @docs-group-description BlobContainers\n * Classes for working with cloud-based blob containers.\n */\n\n/**\n * @docs-group-description Codes\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ECDb\n * Classes for working with ECDb.\n */\n\n/**\n * @docs-group-description ECSQL\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\n */\n\n/**\n * @docs-group-description ElementAspects\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ElementGeometry\n * Classes for defining the symbology and geometry of geometric elements\n */\n\n/**\n * @docs-group-description Elements\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ExportGraphics\n * APIs for producing low-level graphics primitives from element geometry.\n */\n\n/**\n * @docs-group-description HubAccess\n * APIs for working with IModelHub\n */\n\n/**\n * @docs-group-description Images\n * APIs for encoding and decoding images\n */\n\n/**\n * @docs-group-description IModelHost\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\n * See [the learning article]($docs/learning/backend/IModelHost.md).\n */\n\n/**\n * @docs-group-description iModels\n * Classes for working with [iModels]($docs/learning/iModels.md).\n * See [the learning article]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description Logging\n * Logger categories used by this package.\n */\n\n/**\n * @docs-group-description Models\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description NativeApp\n * Classes for working with Mobile/Desktop Application.\n */\n\n/**\n * @docs-group-description Portability\n */\n\n/**\n * @docs-group-description Relationships\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\n */\n\n/**\n * @docs-group-description RpcInterface\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\n */\n\n/**\n * @docs-group-description Schema\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\n */\n\n/**\n * @docs-group-description SQLite\n * Classes for working directly with SQLite\n */\n\n/**\n * @docs-group-description SQLiteDb\n * Classes for working with SQLiteDb.\n */\n\n/**\n * @docs-group-description TileStorage\n * Class for working with cloud storage using iTwin/object-storage cloud providers\n */\n\n/**\n * @docs-group-description ViewDefinitions\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\n */\n\n/**\n * @docs-group-description Workspace\n * APIs for loading and using Settings and Workspace resources\n */\n"]}
1
+ {"version":3,"file":"core-backend.js","sourceRoot":"","sources":["../../src/core-backend.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;AAE/F,8DAA4C;AAC5C,+DAA6C;AAC7C,sEAAoD;AACpD,uEAAqD;AACrD,kEAAgD;AAChD,gEAA8C;AAC9C,qDAAmC;AACnC,0DAAwC;AACxC,kDAAgC;AAChC,yDAAuC;AACvC,qDAAmC;AACnC,8CAA4B;AAC5B,6CAA2B;AAC3B,sDAAoC;AACpC,yDAAuC;AACvC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,gDAA8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OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;IAC3D,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,8BAA8B;IAE9B,MAAM,KAAK,CAAC;AACd,CAAC;KAAM,CAAC;IACL,UAAkB,CAAC,uBAAuB,CAAC,GAAG;QAC7C,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;IAGI;AAEJ;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;GAGG","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\nexport * from \"./annotations/FrameGeometry\";\nexport * from \"./annotations/LeaderGeometry\";\nexport * from \"./annotations/TextAnnotationElement\";\nexport * from \"./annotations/TextAnnotationGeometry\";\nexport * from \"./annotations/TextBlockGeometry\";\nexport * from \"./annotations/TextBlockLayout\";\nexport * from \"./BackendHubAccess\";\nexport * from \"./BackendLoggerCategory\";\nexport * from \"./BisCoreSchema\";\nexport * from \"./BlobContainerService\";\nexport * from \"./BriefcaseManager\";\nexport * from \"./CatalogDb\";\nexport * from \"./Category\";\nexport * from \"./ChangedElementsDb\";\nexport * from \"./ChangeSummaryManager\";\nexport * from \"./ChannelControl\";\nexport * from \"./CheckpointManager\";\nexport * from \"./ClassRegistry\";\nexport * from \"./CloudSqlite\";\nexport * from \"./CodeService\";\nexport * from \"./CodeSpecs\";\nexport * from \"./DevTools\";\nexport * from \"./DisplayStyle\";\nexport * from \"./domains/FunctionalElements\";\nexport * from \"./domains/FunctionalSchema\";\nexport * from \"./domains/GenericElements\";\nexport * from \"./domains/GenericSchema\";\nexport * from \"./ECDb\";\nexport * from \"./ECSchemaXmlContext\";\nexport * from \"./ECSqlStatement\";\nexport * from \"./Element\";\nexport * from \"./ElementAspect\";\nexport * from \"./ElementGraphics\";\nexport * from \"./ElementTreeWalker\";\nexport * from \"./Entity\";\nexport * from \"./EntityReferences\";\nexport * from \"./ExportGraphics\";\nexport * from \"./ExternalSource\";\nexport * from \"./FontFile\";\nexport * from \"./GeoCoordConfig\";\nexport * from \"./GeographicCRSServices\";\nexport * from \"./ImageSourceConversion\";\nexport * from \"./IModelDb\";\nexport * from \"./IModelDbFonts\";\nexport * from \"./IModelElementCloneContext\";\nexport * from \"./IModelHost\";\nexport * from \"./IModelJsFs\";\nexport * from \"./SchemaSync\";\nexport * from \"./IpcHost\";\nexport * from \"./LineStyle\";\nexport * from \"./LocalhostIpcHost\";\nexport * from \"./LocalHub\";\nexport * from \"./LockControl\";\nexport * from \"./Material\";\nexport * from \"./Model\";\nexport * from \"./NativeAppStorage\";\nexport * from \"./NativeHost\";\nexport * from \"./NavigationRelationship\";\nexport * from \"./PropertyStore\";\nexport * from \"./Relationship\";\nexport * from \"./rpc/tracing\";\nexport * from \"./Schema\";\nexport * from \"./SchemaUtils\";\nexport * from \"./SheetIndex\";\nexport * from \"./SQLiteDb\";\nexport * from \"./SqliteStatement\";\nexport * from \"./Texture\";\nexport * from \"./TileStorage\";\nexport * from \"./TxnManager\";\nexport * from \"./ViewDefinition\";\nexport * from \"./ViewStore\";\nexport * from \"./workspace/Settings\";\nexport * from \"./workspace/SettingsSchemas\";\nexport * from \"./workspace/Workspace\";\nexport * from \"./workspace/WorkspaceEditor\";\nexport * from \"./SqliteChangesetReader\";\nexport * from \"./ChangesetECAdaptor\";\n\nexport * from \"./internal/cross-package\";\n\nconst globalSymbolCoreBackend = Symbol.for(\"itwin.core.backend.globals\");\nif ((globalThis as any)[globalSymbolCoreBackend]) {\n // Get the stack trace from when the module was first loaded\n const firstLoadStack = (globalThis as any)[globalSymbolCoreBackend].stack;\n\n const error = new Error(\n \"Multiple @itwin/core-backend imports detected! This may happen if:\\n\" +\n \"- You have multiple versions of the package installed\\n\" +\n \"- Your bundling configuration is incorrect\\n\" +\n \"- You're importing from both ESM and CommonJS versions\"\n );\n\n /* eslint-disable no-console */\n console.error(\"Duplicate @itwin/core-backend import:\", error);\n console.error(\"First import occurred at:\", firstLoadStack);\n console.error(\"Current import occurred at:\", error.stack);\n /* eslint-enable no-console */\n\n throw error;\n} else {\n (globalThis as any)[globalSymbolCoreBackend] = {\n stack: new Error().stack,\n };\n}\n\n/** @docs-package-description\n * The core-backend package always runs on the computer with a local Briefcase.\n *\n * It contains classes that [backend code]($docs/learning/backend/index.md) can use to work with directly with iModels.\n */\n\n/**\n * @docs-group-description BlobContainers\n * Classes for working with cloud-based blob containers.\n */\n\n/**\n * @docs-group-description Codes\n * Classes for working with [Codes]($docs/BIS/guide/fundamentals/codes.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ECDb\n * Classes for working with ECDb.\n */\n\n/**\n * @docs-group-description ECSQL\n * Classes for working with [ECSQL]($docs/learning/ECSQL.md)\n */\n\n/**\n * @docs-group-description ElementAspects\n * Subclasses of [ElementAspects]($docs/bis/guide/fundamentals/elementaspect-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ElementGeometry\n * Classes for defining the symbology and geometry of geometric elements\n */\n\n/**\n * @docs-group-description Elements\n * Subclasses of [Elements]($docs/BIS/guide/fundamentals/element-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description ExportGraphics\n * APIs for producing low-level graphics primitives from element geometry.\n */\n\n/**\n * @docs-group-description HubAccess\n * APIs for working with IModelHub\n */\n\n/**\n * @docs-group-description Images\n * APIs for encoding and decoding images\n */\n\n/**\n * @docs-group-description IModelHost\n * Classes for configuring and administering the backend [host]($docs/learning/backend/IModelHost.md).\n * See [the learning article]($docs/learning/backend/IModelHost.md).\n */\n\n/**\n * @docs-group-description iModels\n * Classes for working with [iModels]($docs/learning/iModels.md).\n * See [the learning article]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description Logging\n * Logger categories used by this package.\n */\n\n/**\n * @docs-group-description Models\n * Subclasses of [Models]($docs/BIS/guide/fundamentals/model-fundamentals.md).\n * See [the learning articles]($docs/learning/backend/index.md).\n */\n\n/**\n * @docs-group-description NativeApp\n * Classes for working with Mobile/Desktop Application.\n */\n\n/**\n * @docs-group-description Portability\n */\n\n/**\n * @docs-group-description Relationships\n * Classes that describe the [relationships]($docs/bis/guide/fundamentals/relationship-fundamentals.md) between elements.\n */\n\n/**\n * @docs-group-description RpcInterface\n * Classes for working with [RpcInterfaces]($docs/learning/RpcInterface.md).\n */\n\n/**\n * @docs-group-description Schema\n * Classes for working with [ECSchemas]($docs/learning/backend/SchemasAndElementsInTypeScript.md)\n */\n\n/**\n * @docs-group-description SQLite\n * Classes for working directly with SQLite\n */\n\n/**\n * @docs-group-description SQLiteDb\n * Classes for working with SQLiteDb.\n */\n\n/**\n * @docs-group-description TileStorage\n * Class for working with cloud storage using iTwin/object-storage cloud providers\n */\n\n/**\n * @docs-group-description ViewDefinitions\n * Classes for working with Elements that define what appears in [Views]($docs/learning/frontend/views.md).\n * See [the learning articles]($docs/learning/backend/createelements/#orthographicviewdefinition).\n */\n\n/**\n * @docs-group-description Workspace\n * APIs for loading and using Settings and Workspace resources\n */\n"]}
@@ -0,0 +1,53 @@
1
+ /** @packageDocumentation
2
+ * @module ElementGeometry
3
+ */
4
+ import { ElementGeometry, GeometryParams, TextAnnotationLeader, TextFrameStyleProps } from "@itwin/core-common";
5
+ import { Loop, Path, Point3d, Transform, Vector3d } from "@itwin/core-geometry";
6
+ import { TextBlockLayout } from "./TextBlockLayout";
7
+ /**
8
+ * Constructs and appends leader lines and their terminators to the provided geometry builder for a text annotation.
9
+ *
10
+ * This function processes an array of `TextAnnotationLeader` objects, computes their attachment points
11
+ * relative to a text frame (or a default rectangular frame if none is provided), and appends the leader
12
+ * line and terminator geometry to the builder. It also applies color overrides if specified
13
+ * in the leader's style overrides.
14
+ *
15
+ * @param builder - The geometry builder to which the leader geometries will be appended.
16
+ * @param leaders - An array of leader properties.
17
+ * @param layout - The layout information for the text block, including its range.
18
+ * @param transform - The transform to apply to the frame and leader geometry.
19
+ * @param params - The geometry parameters, such as color, to use for the leader lines.
20
+ * @param frame - (Optional) The style properties for the text frame. If not provided or set to "none", a default rectangle is used.
21
+ * @returns `true` if at least one leader with a terminator was successfully appended; otherwise, `false`.
22
+ * @beta
23
+ */
24
+ export declare function appendLeadersToBuilder(builder: ElementGeometry.Builder, leaders: TextAnnotationLeader[], layout: TextBlockLayout, transform: Transform, params: GeometryParams, frame?: TextFrameStyleProps): boolean;
25
+ /**
26
+ * Computes the direction vector for an "elbow" for leader based on the attachment point and a frame curve.
27
+ * The elbow direction is determined by whether the attachment point is closer to the left or right side of the frame.
28
+ * If the computed elbow would be tangent to the frame at the intersection, no elbow direction is returned.
29
+ *
30
+ * @param attachmentPoint - The point where the leader attaches.
31
+ * @param frameCurve - The frame curve (either a Loop or Path) to which the leader is attached.
32
+ * @param elbowLength - The length of the elbow segment to be created.
33
+ * @returns The direction vector for the elbow, or `undefined` if the elbow would be tangent to the frame.
34
+ * @beta
35
+ */
36
+ export declare function computeElbowDirection(attachmentPoint: Point3d, frameCurve: Loop | Path, elbowLength: number): Vector3d | undefined;
37
+ /**
38
+ * Computes the attachment point for a leader line on a text annotation frame.
39
+ *
40
+ * The attachment point is determined based on the leader's attachment mode:
41
+ * - `"Nearest"`: Finds the closest point on the frame curve to the leader's start point.
42
+ * - `"KeyPoint"`: Uses a specific curve segment and fraction along that segment to determine the point.
43
+ * - `"TextPoint"`: Calculates a point on the text layout (top/bottom, left/right) and projects it onto the frame curve.
44
+ *
45
+ * @param leader - The leader props.
46
+ * @param frameCurve - The curve (Loop or Path) representing the annotation frame.
47
+ * @param textLayout - The layout information for the text block.
48
+ * @param transform - The transform applied to the text layout.
49
+ * @returns The computed attachment point as a `Point3d`, or `undefined` if it cannot be determined.
50
+ * @beta
51
+ */
52
+ export declare function computeLeaderAttachmentPoint(leader: TextAnnotationLeader, frameCurve: Loop | Path, textLayout: TextBlockLayout, transform: Transform): Point3d | undefined;
53
+ //# sourceMappingURL=LeaderGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeaderGeometry.d.ts","sourceRoot":"","sources":["../../../src/annotations/LeaderGeometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAY,eAAe,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAA2C,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEzH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAwDrN;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CA4BlI;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,EAC5B,UAAU,EAAE,IAAI,GAAG,IAAI,EACvB,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,SAAS,GACnB,OAAO,GAAG,SAAS,CAyCrB"}