@itwin/core-common 5.2.0-dev.8 → 5.3.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -1
- package/lib/cjs/BriefcaseTypes.d.ts +2 -0
- package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
- package/lib/cjs/BriefcaseTypes.js.map +1 -1
- package/lib/cjs/ElementProps.d.ts +8 -0
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/FeatureSymbology.js +0 -2
- package/lib/cjs/FeatureSymbology.js.map +1 -1
- package/lib/cjs/annotation/TextAnnotation.d.ts +1 -1
- package/lib/cjs/annotation/TextAnnotation.d.ts.map +1 -1
- package/lib/cjs/annotation/TextAnnotation.js +1 -1
- package/lib/cjs/annotation/TextAnnotation.js.map +1 -1
- package/lib/cjs/annotation/TextBlock.d.ts +114 -104
- package/lib/cjs/annotation/TextBlock.d.ts.map +1 -1
- package/lib/cjs/annotation/TextBlock.js +227 -108
- package/lib/cjs/annotation/TextBlock.js.map +1 -1
- package/lib/cjs/annotation/TextBlockLayoutResult.d.ts +3 -5
- package/lib/cjs/annotation/TextBlockLayoutResult.d.ts.map +1 -1
- package/lib/cjs/annotation/TextBlockLayoutResult.js.map +1 -1
- package/lib/cjs/annotation/TextField.d.ts +86 -0
- package/lib/cjs/annotation/TextField.d.ts.map +1 -0
- package/lib/cjs/annotation/TextField.js +10 -0
- package/lib/cjs/annotation/TextField.js.map +1 -0
- package/lib/cjs/annotation/TextStyle.d.ts +63 -1
- package/lib/cjs/annotation/TextStyle.d.ts.map +1 -1
- package/lib/cjs/annotation/TextStyle.js +44 -4
- package/lib/cjs/annotation/TextStyle.js.map +1 -1
- package/lib/cjs/core-common.d.ts +1 -0
- package/lib/cjs/core-common.d.ts.map +1 -1
- package/lib/cjs/core-common.js +1 -0
- package/lib/cjs/core-common.js.map +1 -1
- package/lib/cjs/internal/annotations/FieldFormatter.d.ts +18 -0
- package/lib/cjs/internal/annotations/FieldFormatter.d.ts.map +1 -0
- package/lib/cjs/internal/annotations/FieldFormatter.js +66 -0
- package/lib/cjs/internal/annotations/FieldFormatter.js.map +1 -0
- package/lib/cjs/internal/cross-package.d.ts +1 -0
- package/lib/cjs/internal/cross-package.d.ts.map +1 -1
- package/lib/cjs/internal/cross-package.js +4 -1
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/esm/BriefcaseTypes.d.ts +2 -0
- package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
- package/lib/esm/BriefcaseTypes.js.map +1 -1
- package/lib/esm/ElementProps.d.ts +8 -0
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/FeatureSymbology.js +0 -2
- package/lib/esm/FeatureSymbology.js.map +1 -1
- package/lib/esm/annotation/TextAnnotation.d.ts +1 -1
- package/lib/esm/annotation/TextAnnotation.d.ts.map +1 -1
- package/lib/esm/annotation/TextAnnotation.js +1 -1
- package/lib/esm/annotation/TextAnnotation.js.map +1 -1
- package/lib/esm/annotation/TextBlock.d.ts +114 -104
- package/lib/esm/annotation/TextBlock.d.ts.map +1 -1
- package/lib/esm/annotation/TextBlock.js +223 -107
- package/lib/esm/annotation/TextBlock.js.map +1 -1
- package/lib/esm/annotation/TextBlockLayoutResult.d.ts +3 -5
- package/lib/esm/annotation/TextBlockLayoutResult.d.ts.map +1 -1
- package/lib/esm/annotation/TextBlockLayoutResult.js.map +1 -1
- package/lib/esm/annotation/TextField.d.ts +86 -0
- package/lib/esm/annotation/TextField.d.ts.map +1 -0
- package/lib/esm/annotation/TextField.js +9 -0
- package/lib/esm/annotation/TextField.js.map +1 -0
- package/lib/esm/annotation/TextStyle.d.ts +63 -1
- package/lib/esm/annotation/TextStyle.d.ts.map +1 -1
- package/lib/esm/annotation/TextStyle.js +43 -3
- package/lib/esm/annotation/TextStyle.js.map +1 -1
- package/lib/esm/core-common.d.ts +1 -0
- package/lib/esm/core-common.d.ts.map +1 -1
- package/lib/esm/core-common.js +1 -0
- package/lib/esm/core-common.js.map +1 -1
- package/lib/esm/internal/annotations/FieldFormatter.d.ts +18 -0
- package/lib/esm/internal/annotations/FieldFormatter.d.ts.map +1 -0
- package/lib/esm/internal/annotations/FieldFormatter.js +62 -0
- package/lib/esm/internal/annotations/FieldFormatter.js.map +1 -0
- package/lib/esm/internal/cross-package.d.ts +1 -0
- package/lib/esm/internal/cross-package.d.ts.map +1 -1
- package/lib/esm/internal/cross-package.js +1 -0
- package/lib/esm/internal/cross-package.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAnnotation.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextAnnotation.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAEtC;;;;;OAKG;IACH,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAA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B,CAAC;IAC9B,qEAAqE;IACrE,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAClC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACI,WAAW,EAAE,kBAAkB,CAAC;IACvC,8BAA8B;IACvB,SAAS,EAAE,SAAS,CAAC;IAC5B,iEAAiE;IAC1D,MAAM,EAAE,oBAAoB,CAAC;IACpC,8IAA8I;IACvI,MAAM,EAAE,OAAO,CAAC;IACvB,0CAA0C;IACnC,OAAO,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAExC,OAAO;IAQP,oCAAoC;WACtB,MAAM,CAAC,IAAI,CAAC,EAAE,wBAAwB,GAAG,cAAc;IASrE;;OAEG;WACW,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,GAAG,cAAc;IAenE;;OAEG;IACI,MAAM,IAAI,mBAAmB;IA6BpC;;;;;;;;;;OAUG;IACI,gBAAgB,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,GAAE,MAAU,GAAG,SAAS;IAcjF;;;OAGG;IACI,kBAAkB,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAyBxD,0FAA0F;IAC1F,OAAO,CAAC,eAAe;IAsBvB,0EAA0E;IACnE,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO;CAW9C"}
|
|
@@ -44,7 +44,7 @@ export class TextAnnotation {
|
|
|
44
44
|
static create(args) {
|
|
45
45
|
const offset = args?.offset ?? new Point3d();
|
|
46
46
|
const angles = args?.orientation ?? new YawPitchRollAngles();
|
|
47
|
-
const textBlock = args?.textBlock ?? TextBlock.
|
|
47
|
+
const textBlock = args?.textBlock ?? TextBlock.create();
|
|
48
48
|
const anchor = args?.anchor ?? { vertical: "top", horizontal: "left" };
|
|
49
49
|
const leaders = args?.leaders ?? undefined;
|
|
50
50
|
return new TextAnnotation(offset, angles, textBlock, anchor, leaders);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text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E,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;gBACxC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;oBAAE,OAAO,KAAK,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAqB;QACjC,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,KAAK,CAAC,MAAM,CAAC,UAAU;YACpD,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ;YAC9C,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC;YAClD,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;YACxC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;YACvC,OAAO,KAAK,CAAC;QAEf,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAE3D,CAAC;CACF","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 Annotation\n */\n\nimport { Point3d, Range2d, Transform, XYZProps, YawPitchRollAngles, YawPitchRollProps } from \"@itwin/core-geometry\";\nimport { TextBlock, TextBlockProps } from \"./TextBlock\";\nimport { TextStyleSettingsProps } from \"./TextStyle\";\n\n/** Describes how to compute the \"anchor point\" for a [[TextAnnotation]].\n * The anchor point is a point on or inside of the 2d bounding box enclosing the contents of the annotation's [[TextBlock]].\n * The annotation can be rotated and translated relative to the anchor point. The anchor point also serves as the snap point\n * when [AccuSnap]($frontend) is set to [SnapMode.Origin]($frontend).\n * [[TextAnnotation.computeTransform]] will align the anchor point with (0, 0).\n * @see [[TextAnnotation]] for a description of how the anchor point is computed.\n * @beta\n */\nexport interface TextAnnotationAnchor {\n /**\n * The vertical alignment of the anchor point.\n * \"top\" aligns the anchor point with the top of the text's bounding box.\n * \"middle\" aligns the anchor point with the middle of the text's bounding box.\n * \"bottom\" aligns the anchor point with the bottom of the text's bounding box.\n */\n vertical: \"top\" | \"middle\" | \"bottom\";\n\n /**\n * The horizontal alignment of the anchor point.\n * \"left\" aligns the anchor point with left side of the text's bounding box.\n * \"center\" aligns the anchor point with center of the text with's bounding box.\n * \"right\" aligns the anchor point with right side of the text's bounding box.\n */\n horizontal: \"left\" | \"center\" | \"right\";\n}\n\n/**\n * Describes how to attach a [[TextAnnotationLeader]] to the frame around a [[TextBlock]].\n * Leader can be attached using one of the three modes:\n * - KeyPoint: attach to a point on the frame specified by the given curveIndex and fractional position.\n * - TextPoint: attach to a point that is projected on to the frame from the point on a particular line of text specified by [[LeaderTextPointOptions]].\n * - Nearest: attach to the point on frame that is nearest to [[TextAnnotationLeader.startPoint]].\n * @beta\n */\nexport type LeaderAttachment =\n | { mode: \"KeyPoint\"; curveIndex: number; fraction: number }\n | { mode: \"TextPoint\"; position: LeaderTextPointOptions }\n | { mode: \"Nearest\" };\n\n/**\n * Specifies the possible positions to attach a leader on the frame around a [[TextBlock]]\n * when [[TextAnnotationLeader.attachment.mode]] is set to TextPoint.\n * TopLeft : attach to a point projected onto the frame from the point on the left side of the first line of text.\n * TopRight : attach to a point projected onto the frame from the point on the right side of the first line of text.\n * BottomLeft : attach to a point projected onto the frame from the point on the left side of the last line of text.\n * BottomRight : attach to a point projected onto the frame from the point on the right side of the last line of text.\n * @beta\n */\nexport type LeaderTextPointOptions = \"TopLeft\" | \"TopRight\" | \"BottomLeft\" | \"BottomRight\"\n\n/**\n * A line that connects a [[TextAnnotation]] to a point in space relative to another element in the iModel.\n * A leader is always attached to the frame around the annotation's [[TextBlock]].\n * If the frame is not visible, the leader attaches to an invisible rectangular frame around the text block.\n * @see [[TextAnnotation.leaders]] for the leaders associated with an annotation.\n * @see [[TextStyleSettings.leader]] and [[styleOverrides]] to customize the appearance of leaders.\n * @beta\n*/\nexport interface TextAnnotationLeader {\n /** The point where the leader starts.\n * This is the point on another element where the leader points to */\n startPoint: Point3d;\n /** Describes how to attach the leader to the frame around [[textBlock]].*/\n attachment: LeaderAttachment;\n /** Optional intermediate points that the leader should pass through.\n * If not specified, the leader will be a straight line from startPoint to the point on the frame.\n * For now, intermediate points are a set of points which create additional LineSegments in the leader, but there could be intermediate shapes instead of straight LineSegments in future*/\n intermediatePoints?: Point3d[];\n /** Optional style overrides for the leader. If not specified, the leader will use the style defined by [[TextBlock.styleName]] as it is.\n * If specified, these overrides will be applied to the style.\n */\n styleOverrides?: TextStyleSettingsProps;\n}\n/**\n * JSON representation of a [[TextAnnotationLeader]].\n * @beta\n */\nexport interface TextAnnotationLeaderProps {\n /** See [[TextAnnotationLeader.startPoint]]. */\n startPoint: XYZProps;\n /** See [[TextAnnotationLeader.attachment]]. */\n attachment: LeaderAttachment;\n /** See [[TextAnnotationLeader.intermediatePoints]]. Default: no intermediate points. */\n intermediatePoints?: XYZProps[];\n /** See [[TextAnnotationLeader.styleOverrides]]. Default: no style overrides. */\n styleOverrides?: TextStyleSettingsProps;\n}\n\n/**\n * JSON representation of a [[TextAnnotation]].\n * @beta\n */\nexport interface TextAnnotationProps {\n /** See [[TextAnnotation.offset]]. Default: [0, 0, 0]. */\n offset?: XYZProps;\n /** See [[TextAnnotation.orientation]]. Default: no rotation. */\n orientation?: YawPitchRollProps;\n /** See [[TextAnnotation.textBlock]]. Default: an empty text block. */\n textBlock?: TextBlockProps;\n /** See [[TextAnnotation.anchor]]. Default: top-left. */\n anchor?: TextAnnotationAnchor;\n /** See [[TextAnnotation.leader]]. Default: an empty leader array */\n leaders?: TextAnnotationLeaderProps[];\n}\n\n/** Arguments supplied to [[TextAnnotation.create]].\n * @beta\n */\nexport interface TextAnnotationCreateArgs {\n /** See [[TextAnnotation.offset]]. Default: (0, 0, 0). */\n offset?: Point3d;\n /** See [[TextAnnotation.orientation]]. Default: no rotation. */\n orientation?: YawPitchRollAngles;\n /** See [[TextAnnotation.textBlock]]. Default: an empty text block. */\n textBlock?: TextBlock;\n /** See [[TextAnnotation.anchor]]. Default: top-left. */\n anchor?: TextAnnotationAnchor;\n /** See [[TextAnnotation.leader]]. Default: an empty leader array */\n leaders?: TextAnnotationLeader[];\n}\n\n/**\n * Represents a formatted block of text positioned in 2d or 3d space.\n * [TextAnnotation2d]($backend) and [TextAnnotation3d]($backend) elements store a single TextAnnotation from which their geometric representation is generated.\n * Other types of elements may store multiple TextAnnotations, positioned relative to one another.\n * The annotation's position and orientation relative to the host element's [Placement]($common) is determined as follows:\n * - First, a bounding box is computed enclosing the contents of the [[textBlock].\n * - Then, an \"anchor point\" is computed based on the bounding box and the [[anchor]] property. The anchor point can be at one of the four corners of the box, in the middle of one of its four\n * edges, or in the center of the box.\n * - The [[orientation]] is applied to rotate the box around the anchor point.\n * - Finally, the [[offset]] is added to the anchor point to apply translation.\n * @see [appendTextAnnotationGeometry]($backend) to construct the geometry and append it to an [[ElementGeometry.Builder]].\n * @beta\n */\nexport class TextAnnotation {\n /** The rotation of the annotation.\n * @note When defining an annotation for a [TextAnnotation2d]($backend), only the `yaw` component (rotation around the Z axis) is used.\n */\n public orientation: YawPitchRollAngles;\n /** The formatted document. */\n public textBlock: TextBlock;\n /** Describes how to compute the [[textBlock]]'s anchor point. */\n public anchor: TextAnnotationAnchor;\n /** An offset applied to the anchor point that can be used to position annotations within the same geometry stream relative to one another. */\n public offset: Point3d;\n /** The leaders of the text annotation. */\n public leaders?: TextAnnotationLeader[];\n\n private constructor(offset: Point3d, angles: YawPitchRollAngles, textBlock: TextBlock, anchor: TextAnnotationAnchor, leaders?: TextAnnotationLeader[]) {\n this.offset = offset;\n this.orientation = angles;\n this.textBlock = textBlock;\n this.anchor = anchor;\n this.leaders = leaders;\n }\n\n /** Creates a new TextAnnotation. */\n public static create(args?: TextAnnotationCreateArgs): TextAnnotation {\n const offset = args?.offset ?? new Point3d();\n const angles = args?.orientation ?? new YawPitchRollAngles();\n const textBlock = args?.textBlock ?? TextBlock.createEmpty();\n const anchor = args?.anchor ?? { vertical: \"top\", horizontal: \"left\" };\n const leaders = args?.leaders ?? undefined;\n return new TextAnnotation(offset, angles, textBlock, anchor, leaders);\n }\n\n /**\n * Creates a new TextAnnotation instance from its JSON representation.\n */\n public static fromJSON(props: TextAnnotationProps | undefined): TextAnnotation {\n return TextAnnotation.create({\n offset: props?.offset ? Point3d.fromJSON(props.offset) : undefined,\n orientation: props?.orientation ? YawPitchRollAngles.fromJSON(props.orientation) : undefined,\n textBlock: props?.textBlock ? TextBlock.create(props.textBlock) : undefined,\n anchor: props?.anchor ? { ...props.anchor } : undefined,\n leaders: props?.leaders ? props.leaders.map((leader) => ({\n startPoint: Point3d.fromJSON(leader.startPoint),\n attachment: leader.attachment,\n styleOverrides: leader.styleOverrides ?? undefined,\n intermediatePoints: leader.intermediatePoints ? leader.intermediatePoints.map((point) => Point3d.fromJSON(point)) : undefined,\n })) : undefined,\n });\n }\n\n /**\n * Converts this annotation to its JSON representation.\n */\n public toJSON(): TextAnnotationProps {\n const props: TextAnnotationProps = {};\n\n // Even if the text block is empty, we want to record its style ID and overrides, e.g.,\n // so the user can pick up where they left off editing it next time.\n props.textBlock = this.textBlock.toJSON();\n\n if (!this.offset.isZero) {\n props.offset = this.offset.toJSON();\n }\n\n if (!this.orientation.isIdentity()) {\n props.orientation = this.orientation.toJSON();\n }\n\n if (this.anchor.vertical !== \"top\" || this.anchor.horizontal !== \"left\") {\n props.anchor = { ...this.anchor };\n }\n\n props.leaders = this.leaders?.map((leader) => ({\n startPoint: leader.startPoint.toJSON(),\n attachment: leader.attachment,\n styleOverrides: leader.styleOverrides ?? undefined,\n intermediatePoints: leader.intermediatePoints ? leader.intermediatePoints.map((point) => point.toJSON()) : undefined,\n })) ?? undefined;\n\n return props;\n }\n\n /** Compute the transform that positions and orients this annotation relative to its anchor point, based on the [[textBlock]]'s computed bounding box.\n * The anchor point is computed as specified by this annotation's [[anchor]] setting. For example, if the text block is anchored\n * at the bottom left, then the transform will be relative to the bottom-left corner of `textBlockExtents`.\n * The text block will be rotated around the fixed anchor point according to [[orientation]], then translated by [[offset]].\n * The anchor point will coincide with (0, 0, 0) unless an [[offset]] is present.\n * If a scale factor is specified, the transform will also scale the annotation by that factor. Usually, this should come from the [[Drawing]] containing the annotation.\n * @param boundingBox A box fully containing the [[textBlock]]. This range should include the margins.\n * @param scaleFactor A factor by which to scale the annotation. Default: 1 (no scaling).\n * @see [[computeAnchorPoint]] to compute the transform's anchor point.\n * @see [computeLayoutTextBlockResult]($backend) to lay out a `TextBlock`.\n */\n public computeTransform(boundingBox: Range2d, scaleFactor: number = 1): Transform {\n const anchorPt = this.computeAnchorPoint(boundingBox);\n const matrix = this.orientation.toMatrix3d();\n\n const transform = Transform.createIdentity();\n const translation = Transform.createTranslation(this.offset.minus(anchorPt));\n const scaleTransform = Transform.createScaleAboutPoint(anchorPt, scaleFactor);\n const rotation = Transform.createFixedPointAndMatrix(anchorPt, matrix);\n transform.multiplyTransformTransform(translation, transform);\n transform.multiplyTransformTransform(scaleTransform, transform);\n transform.multiplyTransformTransform(rotation, transform);\n return transform;\n }\n\n /** Compute the anchor point of this annotation as specified by [[anchor]].\n * @param boundingBox A box fully containing the [[textBlock]].\n * @see [[computeTransform]] to compute the transform relative to the anchor point.\n */\n public computeAnchorPoint(boundingBox: Range2d): Point3d {\n let x = boundingBox.low.x;\n let y = boundingBox.high.y;\n\n switch (this.anchor.horizontal) {\n case \"center\":\n x += boundingBox.xLength() / 2;\n break;\n case \"right\":\n x += boundingBox.xLength();\n break;\n }\n\n switch (this.anchor.vertical) {\n case \"middle\":\n y -= boundingBox.yLength() / 2;\n break;\n case \"bottom\":\n y -= boundingBox.yLength();\n break;\n }\n\n return new Point3d(x, y, 0);\n }\n\n /** Returns true if the leaders of this annotation are equal to the leaders of `other`. */\n private areLeadersEqual(leadersA?: TextAnnotationLeader[], leadersB?: TextAnnotationLeader[]): boolean {\n if (leadersA === leadersB) return true;\n if (!leadersA || !leadersB || leadersA.length !== leadersB.length) return false;\n\n for (let i = 0; i < leadersA.length; ++i) {\n const a = leadersA[i];\n const b = leadersB[i];\n\n if (!a.startPoint.isAlmostEqual(b.startPoint)) return false;\n if (JSON.stringify(a.attachment) !== JSON.stringify(b.attachment)) return false;\n if (JSON.stringify(a.styleOverrides) !== JSON.stringify(b.styleOverrides)) return false;\n\n const pointsA = a.intermediatePoints ?? [];\n const pointsB = b.intermediatePoints ?? [];\n if (pointsA.length !== pointsB.length) return false;\n for (let j = 0; j < pointsA.length; ++j) {\n if (!pointsA[j].isAlmostEqual(pointsB[j])) return false;\n }\n }\n return true;\n }\n\n /** Returns true if this annotation is logically equivalent to `other`. */\n public equals(other: TextAnnotation): boolean {\n if (this.anchor.horizontal !== other.anchor.horizontal ||\n this.anchor.vertical !== other.anchor.vertical ||\n !this.orientation.isAlmostEqual(other.orientation) ||\n !this.offset.isAlmostEqual(other.offset) ||\n !this.textBlock.equals(other.textBlock))\n return false;\n\n return this.areLeadersEqual(this.leaders, other.leaders);\n\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"TextAnnotation.js","sourceRoot":"","sources":["../../../src/annotation/TextAnnotation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAW,SAAS,EAAY,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAC;AA4HxD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,cAAc;IACzB;;OAEG;IACI,WAAW,CAAqB;IACvC,8BAA8B;IACvB,SAAS,CAAY;IAC5B,iEAAiE;IAC1D,MAAM,CAAuB;IACpC,8I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QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ;YAC9C,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC;YAClD,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;YACxC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;YACvC,OAAO,KAAK,CAAC;QAEf,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAE3D,CAAC;CACF","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 Annotation\n */\n\nimport { Point3d, Range2d, Transform, XYZProps, YawPitchRollAngles, YawPitchRollProps } from \"@itwin/core-geometry\";\nimport { TextBlock, TextBlockProps } from \"./TextBlock\";\nimport { TextStyleSettingsProps } from \"./TextStyle\";\n\n/** Describes how to compute the \"anchor point\" for a [[TextAnnotation]].\n * The anchor point is a point on or inside of the 2d bounding box enclosing the contents of the annotation's [[TextBlock]].\n * The annotation can be rotated and translated relative to the anchor point. The anchor point also serves as the snap point\n * when [AccuSnap]($frontend) is set to [SnapMode.Origin]($frontend).\n * [[TextAnnotation.computeTransform]] will align the anchor point with (0, 0).\n * @see [[TextAnnotation]] for a description of how the anchor point is computed.\n * @beta\n */\nexport interface TextAnnotationAnchor {\n /**\n * The vertical alignment of the anchor point.\n * \"top\" aligns the anchor point with the top of the text's bounding box.\n * \"middle\" aligns the anchor point with the middle of the text's bounding box.\n * \"bottom\" aligns the anchor point with the bottom of the text's bounding box.\n */\n vertical: \"top\" | \"middle\" | \"bottom\";\n\n /**\n * The horizontal alignment of the anchor point.\n * \"left\" aligns the anchor point with left side of the text's bounding box.\n * \"center\" aligns the anchor point with center of the text with's bounding box.\n * \"right\" aligns the anchor point with right side of the text's bounding box.\n */\n horizontal: \"left\" | \"center\" | \"right\";\n}\n\n/**\n * Describes how to attach a [[TextAnnotationLeader]] to the frame around a [[TextBlock]].\n * Leader can be attached using one of the three modes:\n * - KeyPoint: attach to a point on the frame specified by the given curveIndex and fractional position.\n * - TextPoint: attach to a point that is projected on to the frame from the point on a particular line of text specified by [[LeaderTextPointOptions]].\n * - Nearest: attach to the point on frame that is nearest to [[TextAnnotationLeader.startPoint]].\n * @beta\n */\nexport type LeaderAttachment =\n | { mode: \"KeyPoint\"; curveIndex: number; fraction: number }\n | { mode: \"TextPoint\"; position: LeaderTextPointOptions }\n | { mode: \"Nearest\" };\n\n/**\n * Specifies the possible positions to attach a leader on the frame around a [[TextBlock]]\n * when [[TextAnnotationLeader.attachment.mode]] is set to TextPoint.\n * TopLeft : attach to a point projected onto the frame from the point on the left side of the first line of text.\n * TopRight : attach to a point projected onto the frame from the point on the right side of the first line of text.\n * BottomLeft : attach to a point projected onto the frame from the point on the left side of the last line of text.\n * BottomRight : attach to a point projected onto the frame from the point on the right side of the last line of text.\n * @beta\n */\nexport type LeaderTextPointOptions = \"TopLeft\" | \"TopRight\" | \"BottomLeft\" | \"BottomRight\"\n\n/**\n * A line that connects a [[TextAnnotation]] to a point in space relative to another element in the iModel.\n * A leader is always attached to the frame around the annotation's [[TextBlock]].\n * If the frame is not visible, the leader attaches to an invisible rectangular frame around the text block.\n * @see [[TextAnnotation.leaders]] for the leaders associated with an annotation.\n * @see [[TextStyleSettings.leader]] and [[styleOverrides]] to customize the appearance of leaders.\n * @beta\n*/\nexport interface TextAnnotationLeader {\n /** The point where the leader starts.\n * This is the point on another element where the leader points to */\n startPoint: Point3d;\n /** Describes how to attach the leader to the frame around [[textBlock]].*/\n attachment: LeaderAttachment;\n /** Optional intermediate points that the leader should pass through.\n * If not specified, the leader will be a straight line from startPoint to the point on the frame.\n * For now, intermediate points are a set of points which create additional LineSegments in the leader, but there could be intermediate shapes instead of straight LineSegments in future*/\n intermediatePoints?: Point3d[];\n /** Optional style overrides for the leader. If not specified, the leader will use the style defined by [[TextBlock.styleName]] as it is.\n * If specified, these overrides will be applied to the style.\n */\n styleOverrides?: TextStyleSettingsProps;\n}\n/**\n * JSON representation of a [[TextAnnotationLeader]].\n * @beta\n */\nexport interface TextAnnotationLeaderProps {\n /** See [[TextAnnotationLeader.startPoint]]. */\n startPoint: XYZProps;\n /** See [[TextAnnotationLeader.attachment]]. */\n attachment: LeaderAttachment;\n /** See [[TextAnnotationLeader.intermediatePoints]]. Default: no intermediate points. */\n intermediatePoints?: XYZProps[];\n /** See [[TextAnnotationLeader.styleOverrides]]. Default: no style overrides. */\n styleOverrides?: TextStyleSettingsProps;\n}\n\n/**\n * JSON representation of a [[TextAnnotation]].\n * @beta\n */\nexport interface TextAnnotationProps {\n /** See [[TextAnnotation.offset]]. Default: [0, 0, 0]. */\n offset?: XYZProps;\n /** See [[TextAnnotation.orientation]]. Default: no rotation. */\n orientation?: YawPitchRollProps;\n /** See [[TextAnnotation.textBlock]]. Default: an empty text block. */\n textBlock?: TextBlockProps;\n /** See [[TextAnnotation.anchor]]. Default: top-left. */\n anchor?: TextAnnotationAnchor;\n /** See [[TextAnnotation.leader]]. Default: an empty leader array */\n leaders?: TextAnnotationLeaderProps[];\n}\n\n/** Arguments supplied to [[TextAnnotation.create]].\n * @beta\n */\nexport interface TextAnnotationCreateArgs {\n /** See [[TextAnnotation.offset]]. Default: (0, 0, 0). */\n offset?: Point3d;\n /** See [[TextAnnotation.orientation]]. Default: no rotation. */\n orientation?: YawPitchRollAngles;\n /** See [[TextAnnotation.textBlock]]. Default: an empty text block. */\n textBlock?: TextBlock;\n /** See [[TextAnnotation.anchor]]. Default: top-left. */\n anchor?: TextAnnotationAnchor;\n /** See [[TextAnnotation.leader]]. Default: an empty leader array */\n leaders?: TextAnnotationLeader[];\n}\n\n/**\n * Represents a formatted block of text positioned in 2d or 3d space.\n * [TextAnnotation2d]($backend) and [TextAnnotation3d]($backend) elements store a single TextAnnotation from which their geometric representation is generated.\n * Other types of elements may store multiple TextAnnotations, positioned relative to one another.\n * The annotation's position and orientation relative to the host element's [Placement]($common) is determined as follows:\n * - First, a bounding box is computed enclosing the contents of the [[textBlock].\n * - Then, an \"anchor point\" is computed based on the bounding box and the [[anchor]] property. The anchor point can be at one of the four corners of the box, in the middle of one of its four\n * edges, or in the center of the box.\n * - The [[orientation]] is applied to rotate the box around the anchor point.\n * - Finally, the [[offset]] is added to the anchor point to apply translation.\n * @see [appendTextAnnotationGeometry]($backend) to construct the geometry and append it to an [[ElementGeometry.Builder]].\n * @beta\n */\nexport class TextAnnotation {\n /** The rotation of the annotation.\n * @note When defining an annotation for a [TextAnnotation2d]($backend), only the `yaw` component (rotation around the Z axis) is used.\n */\n public orientation: YawPitchRollAngles;\n /** The formatted document. */\n public textBlock: TextBlock;\n /** Describes how to compute the [[textBlock]]'s anchor point. */\n public anchor: TextAnnotationAnchor;\n /** An offset applied to the anchor point that can be used to position annotations within the same geometry stream relative to one another. */\n public offset: Point3d;\n /** The leaders of the text annotation. */\n public leaders?: TextAnnotationLeader[];\n\n private constructor(offset: Point3d, angles: YawPitchRollAngles, textBlock: TextBlock, anchor: TextAnnotationAnchor, leaders?: TextAnnotationLeader[]) {\n this.offset = offset;\n this.orientation = angles;\n this.textBlock = textBlock;\n this.anchor = anchor;\n this.leaders = leaders;\n }\n\n /** Creates a new TextAnnotation. */\n public static create(args?: TextAnnotationCreateArgs): TextAnnotation {\n const offset = args?.offset ?? new Point3d();\n const angles = args?.orientation ?? new YawPitchRollAngles();\n const textBlock = args?.textBlock ?? TextBlock.create();\n const anchor = args?.anchor ?? { vertical: \"top\", horizontal: \"left\" };\n const leaders = args?.leaders ?? undefined;\n return new TextAnnotation(offset, angles, textBlock, anchor, leaders);\n }\n\n /**\n * Creates a new TextAnnotation instance from its JSON representation.\n */\n public static fromJSON(props?: TextAnnotationProps): TextAnnotation {\n return TextAnnotation.create({\n offset: props?.offset ? Point3d.fromJSON(props.offset) : undefined,\n orientation: props?.orientation ? YawPitchRollAngles.fromJSON(props.orientation) : undefined,\n textBlock: props?.textBlock ? TextBlock.create(props.textBlock) : undefined,\n anchor: props?.anchor ? { ...props.anchor } : undefined,\n leaders: props?.leaders ? props.leaders.map((leader) => ({\n startPoint: Point3d.fromJSON(leader.startPoint),\n attachment: leader.attachment,\n styleOverrides: leader.styleOverrides ?? undefined,\n intermediatePoints: leader.intermediatePoints ? leader.intermediatePoints.map((point) => Point3d.fromJSON(point)) : undefined,\n })) : undefined,\n });\n }\n\n /**\n * Converts this annotation to its JSON representation.\n */\n public toJSON(): TextAnnotationProps {\n const props: TextAnnotationProps = {};\n\n // Even if the text block is empty, we want to record its style ID and overrides, e.g.,\n // so the user can pick up where they left off editing it next time.\n props.textBlock = this.textBlock.toJSON();\n\n if (!this.offset.isZero) {\n props.offset = this.offset.toJSON();\n }\n\n if (!this.orientation.isIdentity()) {\n props.orientation = this.orientation.toJSON();\n }\n\n if (this.anchor.vertical !== \"top\" || this.anchor.horizontal !== \"left\") {\n props.anchor = { ...this.anchor };\n }\n\n props.leaders = this.leaders?.map((leader) => ({\n startPoint: leader.startPoint.toJSON(),\n attachment: leader.attachment,\n styleOverrides: leader.styleOverrides ?? undefined,\n intermediatePoints: leader.intermediatePoints ? leader.intermediatePoints.map((point) => point.toJSON()) : undefined,\n })) ?? undefined;\n\n return props;\n }\n\n /** Compute the transform that positions and orients this annotation relative to its anchor point, based on the [[textBlock]]'s computed bounding box.\n * The anchor point is computed as specified by this annotation's [[anchor]] setting. For example, if the text block is anchored\n * at the bottom left, then the transform will be relative to the bottom-left corner of `textBlockExtents`.\n * The text block will be rotated around the fixed anchor point according to [[orientation]], then translated by [[offset]].\n * The anchor point will coincide with (0, 0, 0) unless an [[offset]] is present.\n * If a scale factor is specified, the transform will also scale the annotation by that factor. Usually, this should come from the [[Drawing]] containing the annotation.\n * @param boundingBox A box fully containing the [[textBlock]]. This range should include the margins.\n * @param scaleFactor A factor by which to scale the annotation. Default: 1 (no scaling).\n * @see [[computeAnchorPoint]] to compute the transform's anchor point.\n * @see [computeLayoutTextBlockResult]($backend) to lay out a `TextBlock`.\n */\n public computeTransform(boundingBox: Range2d, scaleFactor: number = 1): Transform {\n const anchorPt = this.computeAnchorPoint(boundingBox);\n const matrix = this.orientation.toMatrix3d();\n\n const transform = Transform.createIdentity();\n const translation = Transform.createTranslation(this.offset.minus(anchorPt));\n const scaleTransform = Transform.createScaleAboutPoint(anchorPt, scaleFactor);\n const rotation = Transform.createFixedPointAndMatrix(anchorPt, matrix);\n transform.multiplyTransformTransform(translation, transform);\n transform.multiplyTransformTransform(scaleTransform, transform);\n transform.multiplyTransformTransform(rotation, transform);\n return transform;\n }\n\n /** Compute the anchor point of this annotation as specified by [[anchor]].\n * @param boundingBox A box fully containing the [[textBlock]].\n * @see [[computeTransform]] to compute the transform relative to the anchor point.\n */\n public computeAnchorPoint(boundingBox: Range2d): Point3d {\n let x = boundingBox.low.x;\n let y = boundingBox.high.y;\n\n switch (this.anchor.horizontal) {\n case \"center\":\n x += boundingBox.xLength() / 2;\n break;\n case \"right\":\n x += boundingBox.xLength();\n break;\n }\n\n switch (this.anchor.vertical) {\n case \"middle\":\n y -= boundingBox.yLength() / 2;\n break;\n case \"bottom\":\n y -= boundingBox.yLength();\n break;\n }\n\n return new Point3d(x, y, 0);\n }\n\n /** Returns true if the leaders of this annotation are equal to the leaders of `other`. */\n private areLeadersEqual(leadersA?: TextAnnotationLeader[], leadersB?: TextAnnotationLeader[]): boolean {\n if (leadersA === leadersB) return true;\n if (!leadersA || !leadersB || leadersA.length !== leadersB.length) return false;\n\n for (let i = 0; i < leadersA.length; ++i) {\n const a = leadersA[i];\n const b = leadersB[i];\n\n if (!a.startPoint.isAlmostEqual(b.startPoint)) return false;\n if (JSON.stringify(a.attachment) !== JSON.stringify(b.attachment)) return false;\n if (JSON.stringify(a.styleOverrides) !== JSON.stringify(b.styleOverrides)) return false;\n\n const pointsA = a.intermediatePoints ?? [];\n const pointsB = b.intermediatePoints ?? [];\n if (pointsA.length !== pointsB.length) return false;\n for (let j = 0; j < pointsA.length; ++j) {\n if (!pointsA[j].isAlmostEqual(pointsB[j])) return false;\n }\n }\n return true;\n }\n\n /** Returns true if this annotation is logically equivalent to `other`. */\n public equals(other: TextAnnotation): boolean {\n if (this.anchor.horizontal !== other.anchor.horizontal ||\n this.anchor.vertical !== other.anchor.vertical ||\n !this.orientation.isAlmostEqual(other.orientation) ||\n !this.offset.isAlmostEqual(other.offset) ||\n !this.textBlock.equals(other.textBlock))\n return false;\n\n return this.areLeadersEqual(this.leaders, other.leaders);\n\n }\n}"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Annotation
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { ListMarker, TextStyleSettingsProps } from "./TextStyle";
|
|
5
|
+
import { FieldFormatOptions, FieldPropertyHost, FieldPropertyPath } from "./TextField";
|
|
6
6
|
/** Options supplied to [[TextBlockComponent.clearStyleOverrides]] to control how the style overrides are cleared on the component and its child components.
|
|
7
7
|
* @beta
|
|
8
8
|
*/
|
|
@@ -41,16 +41,30 @@ export interface TextBlockStringifyOptions {
|
|
|
41
41
|
* Default: "undefined" - use "\t".
|
|
42
42
|
*/
|
|
43
43
|
tabsAsSpaces?: number;
|
|
44
|
+
/** A string to insert in between the list marker and the list item.
|
|
45
|
+
* Default: " " - a single space.
|
|
46
|
+
*/
|
|
47
|
+
listMarkerBreak?: string;
|
|
44
48
|
}
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
49
|
+
/**
|
|
50
|
+
* Context information that may be useful when converting a [[TextBlock]] to a string.
|
|
51
|
+
* @beta
|
|
52
|
+
*/
|
|
53
|
+
export interface TextBlockStringifyContext {
|
|
54
|
+
/** The current depth of the text block in the document structure. */
|
|
55
|
+
depth: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Abstract representation of any of the building blocks that make up a [[TextBlock]] document - namely [[Run]]s and [[StructuralTextBlockComponent]]s.
|
|
59
|
+
* The [[TextBlock]] can specify an [AnnotationTextStyle]($backend) that formats its contents.
|
|
60
|
+
* Each component can specify an optional [[styleOverrides]] to customize that formatting.
|
|
47
61
|
* @beta
|
|
48
62
|
*/
|
|
49
63
|
export declare abstract class TextBlockComponent {
|
|
50
64
|
private _styleOverrides;
|
|
51
65
|
/** @internal */
|
|
52
66
|
protected constructor(props?: TextBlockComponentProps);
|
|
53
|
-
/** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend)
|
|
67
|
+
/** Deviations in individual properties of the [[TextStyleSettings]] in the [AnnotationTextStyle]($backend).
|
|
54
68
|
* For example, if the style uses the "Arial" font, you can override that by settings `styleOverrides.fontName` to "Comic Sans".
|
|
55
69
|
* @see [[clearStyleOverrides]] to reset this to an empty object.
|
|
56
70
|
*/
|
|
@@ -63,7 +77,9 @@ export declare abstract class TextBlockComponent {
|
|
|
63
77
|
/** Create a deep copy of this component. */
|
|
64
78
|
abstract clone(): TextBlockComponent;
|
|
65
79
|
/** Compute a string representation of the contents of this component and all of its sub-components. */
|
|
66
|
-
abstract stringify(options?: TextBlockStringifyOptions): string;
|
|
80
|
+
abstract stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string;
|
|
81
|
+
/** Returns true if this component has no content or children. */
|
|
82
|
+
abstract get isEmpty(): boolean;
|
|
67
83
|
/**
|
|
68
84
|
* Returns true if the string representation of this component consists only of whitespace characters.
|
|
69
85
|
* Useful for checking if the component is visually empty (producing no graphics) or contains only spaces, tabs, or line breaks.
|
|
@@ -90,7 +106,7 @@ export type RunProps = TextRunProps | FractionRunProps | TabRunProps | LineBreak
|
|
|
90
106
|
*/
|
|
91
107
|
export declare namespace Run {
|
|
92
108
|
/** Create a run from its JSON representation.
|
|
93
|
-
* @see [[TextRun.create]], [[FractionRun.create]], and [[LineBreakRun.create]] to create a run directly.
|
|
109
|
+
* @see [[TextRun.create]], [[FractionRun.create]], [[FieldRun.create]], [[TabRun.create]], and [[LineBreakRun.create]] to create a run directly.
|
|
94
110
|
*/
|
|
95
111
|
function fromJSON(props: RunProps): Run;
|
|
96
112
|
}
|
|
@@ -129,6 +145,7 @@ export declare class TextRun extends TextBlockComponent {
|
|
|
129
145
|
clone(): TextRun;
|
|
130
146
|
toJSON(): TextRunProps;
|
|
131
147
|
static create(props?: Omit<TextRunProps, "type">): TextRun;
|
|
148
|
+
get isEmpty(): boolean;
|
|
132
149
|
/** Simply returns [[content]]. */
|
|
133
150
|
stringify(): string;
|
|
134
151
|
equals(other: TextBlockComponent): boolean;
|
|
@@ -159,6 +176,7 @@ export declare class FractionRun extends TextBlockComponent {
|
|
|
159
176
|
toJSON(): FractionRunProps;
|
|
160
177
|
clone(): FractionRun;
|
|
161
178
|
static create(props?: Omit<FractionRunProps, "type">): FractionRun;
|
|
179
|
+
get isEmpty(): boolean;
|
|
162
180
|
/** Formats the fraction as a string with the [[numerator]] and [[denominator]] separated by [[TextBlockStringifyOptions.fractionSeparator]]. */
|
|
163
181
|
stringify(options?: TextBlockStringifyOptions): string;
|
|
164
182
|
equals(other: TextBlockComponent): boolean;
|
|
@@ -178,8 +196,9 @@ export declare class LineBreakRun extends TextBlockComponent {
|
|
|
178
196
|
readonly type = "linebreak";
|
|
179
197
|
private constructor();
|
|
180
198
|
toJSON(): LineBreakRunProps;
|
|
181
|
-
static create(props?:
|
|
199
|
+
static create(props?: Omit<LineBreakRunProps, "type">): LineBreakRun;
|
|
182
200
|
clone(): LineBreakRun;
|
|
201
|
+
get isEmpty(): boolean;
|
|
183
202
|
/** Simply returns [[TextBlockStringifyOptions.lineBreak]]. */
|
|
184
203
|
stringify(options?: TextBlockStringifyOptions): string;
|
|
185
204
|
equals(other: TextBlockComponent): boolean;
|
|
@@ -201,6 +220,7 @@ export declare class TabRun extends TextBlockComponent {
|
|
|
201
220
|
toJSON(): TabRunProps;
|
|
202
221
|
clone(): TabRun;
|
|
203
222
|
static create(props?: Omit<TabRunProps, "type">): TabRun;
|
|
223
|
+
get isEmpty(): boolean;
|
|
204
224
|
/**
|
|
205
225
|
* Converts a [[TabRun]] to its string representation.
|
|
206
226
|
* If the `tabsAsSpaces` option is provided, returns a string of spaces of the specified length.
|
|
@@ -209,56 +229,6 @@ export declare class TabRun extends TextBlockComponent {
|
|
|
209
229
|
stringify(options?: TextBlockStringifyOptions): string;
|
|
210
230
|
equals(other: TextBlockComponent): boolean;
|
|
211
231
|
}
|
|
212
|
-
/** A chain of property accesses that resolves to a primitive value that forms the basis of the displayed content
|
|
213
|
-
* of a [[FieldRun]].
|
|
214
|
-
* The simplest property paths consist of a [[propertyName]] and nothing else, where `propertyName` identifies
|
|
215
|
-
* a primitive property.
|
|
216
|
-
* If `propertyName` identifies a struct or array property, then additional [[accessors]] are required to identify the specific value.
|
|
217
|
-
* If `propertyName` (including any [[accessors]]) resolves to a JSON property, then additional [[jsonAccessors]] are required to identify a specific value within the JSON.
|
|
218
|
-
* Some examples:
|
|
219
|
-
* ```
|
|
220
|
-
* | Access String | propertyName | accessors | jsonAccessors |
|
|
221
|
-
* | ------------- | ------------ | --------- | ------------- |
|
|
222
|
-
* | name | "name" | undefined | undefined |
|
|
223
|
-
* | spouse.name | "spouse" | [name] | undefined |
|
|
224
|
-
* | colors[2] | "colors" | [2] | undefined |
|
|
225
|
-
* | spouse.favoriteRestaurants[1].address | "spouse" | ["favoriteRestaurants", 1, "address"] | undefined |
|
|
226
|
-
* | jsonProperties.contactInfo.email | "jsonProperties" | undefined | ["contactInfo", "email"] |
|
|
227
|
-
* | spouse.jsonProperties.contactInfo.phoneNumbers[0].areaCode | "spouse" | ["jsonProperties"] | ["contactInfo", "phoneNumbers", 0, "areaCode"] |
|
|
228
|
-
* ```
|
|
229
|
-
* @beta
|
|
230
|
-
*/
|
|
231
|
-
export interface FieldPropertyPath {
|
|
232
|
-
/** The name of the BIS property of the [[FieldPropertyHost]] that serves as the root of the path. */
|
|
233
|
-
propertyName: string;
|
|
234
|
-
/** Property names and/or array indices describing the path from [[propertyName]] to the ultimate BIS property. */
|
|
235
|
-
accessors?: Array<string | number>;
|
|
236
|
-
/** If [[propertyName]] and [[accessors]] (if defined) resolve to a BIS property of extended type `Json`, property names and/or
|
|
237
|
-
* array indices for selecting a primitive value within the JSON.
|
|
238
|
-
*/
|
|
239
|
-
jsonAccessors?: Array<string | number>;
|
|
240
|
-
}
|
|
241
|
-
/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.
|
|
242
|
-
* A field property is always hosted by an [Element]($backend). It may be a property of the element's BIS class itself,
|
|
243
|
-
* or that of one of its [ElementAspect]($backend)s.
|
|
244
|
-
* The [[schemaName]] and [[className]] should always identify the exact class that contains [[FieldPropertyPath.propertyName]] - not a subclass thereof.
|
|
245
|
-
* @beta
|
|
246
|
-
*/
|
|
247
|
-
export interface FieldPropertyHost {
|
|
248
|
-
/** The Id of the [Element]($backend) that hosts the property. */
|
|
249
|
-
elementId: Id64String;
|
|
250
|
-
/** The name of the schema containing the class identified by [[className]]. */
|
|
251
|
-
schemaName: string;
|
|
252
|
-
/** The name of the exact class (not a subclass) containing the property identified by [[FieldPropertyPath.propertyName]]. */
|
|
253
|
-
className: string;
|
|
254
|
-
}
|
|
255
|
-
/** Placeholder type for a description of how to format the raw property value resolved by a [[FieldPropertyPath]] into a [[FieldRun]]'s display string.
|
|
256
|
-
* *** COMING SOON ***
|
|
257
|
-
* @beta
|
|
258
|
-
*/
|
|
259
|
-
export interface FieldFormatter {
|
|
260
|
-
[k: string]: any;
|
|
261
|
-
}
|
|
262
232
|
/** JSON representation of a [[FieldRun]].
|
|
263
233
|
* @beta
|
|
264
234
|
*/
|
|
@@ -269,15 +239,21 @@ export interface FieldRunProps extends TextBlockComponentProps {
|
|
|
269
239
|
propertyHost: FieldPropertyHost;
|
|
270
240
|
/** Describes how to obtain the property value from [[propertyHost]]. */
|
|
271
241
|
propertyPath: FieldPropertyPath;
|
|
272
|
-
/** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].
|
|
273
|
-
|
|
274
|
-
|
|
242
|
+
/** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].
|
|
243
|
+
* The specific options used depend upon the field's [[propertyType]].
|
|
244
|
+
*/
|
|
245
|
+
formatOptions?: FieldFormatOptions;
|
|
246
|
+
/** The field's most recently evaluated display string.
|
|
247
|
+
* @note It is unnecessary to specify this when creating a field as part of an element like a [[TextAnnotation2d]], because
|
|
248
|
+
* all of the element's fields will be re-evaluated when inserting or updating the element in the iModel.
|
|
249
|
+
*/
|
|
275
250
|
cachedContent?: string;
|
|
276
251
|
}
|
|
277
252
|
/** A [[Run]] that displays the formatted value of a property of some [Element]($backend).
|
|
278
253
|
* When a [[TextBlock]] containing a [[FieldRun]] is written into the iModel as an [ITextAnnotation]($backend) element,
|
|
279
254
|
* a dependency is established between the two elements via the [ElementDrivesTextAnnotation]($backend) relationship such that
|
|
280
|
-
* whenever the source element specified by [[propertyHost]] is modified
|
|
255
|
+
* whenever the source element specified by [[propertyHost]] is modified or the `ITextAnnotation` element is inserted or updated in the iModel,
|
|
256
|
+
* the field(s) in the `ITextAnnotation` element are automatically
|
|
281
257
|
* recalculated, causing their [[cachedContent]] to update. If the field's display string cannot be evaluated (for example, because the specified element or
|
|
282
258
|
* property does not exist), then its cached content is set to [[FieldRun.invalidContentIndicator]].
|
|
283
259
|
* A [[FieldRun]] displays its [[cachedContent]] in the same way that [[TextRun]]s display their `content`, including word wrapping where appropriate.
|
|
@@ -292,8 +268,10 @@ export declare class FieldRun extends TextBlockComponent {
|
|
|
292
268
|
readonly propertyHost: Readonly<FieldPropertyHost>;
|
|
293
269
|
/** Describes how to obtain the property value from [[propertyHost]]. */
|
|
294
270
|
readonly propertyPath: Readonly<FieldPropertyPath>;
|
|
295
|
-
/** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].
|
|
296
|
-
|
|
271
|
+
/** Specifies how to format the property value obtained from [[propertyPath]] into a string to be stored in [[cachedContent]].
|
|
272
|
+
* The specific options used depend upon the [[FieldPropertyType]].
|
|
273
|
+
*/
|
|
274
|
+
readonly formatOptions?: FieldFormatOptions;
|
|
297
275
|
private _cachedContent;
|
|
298
276
|
/** The field's most recently evaluated display string. */
|
|
299
277
|
get cachedContent(): string;
|
|
@@ -306,6 +284,7 @@ export declare class FieldRun extends TextBlockComponent {
|
|
|
306
284
|
toJSON(): FieldRunProps;
|
|
307
285
|
/** Create a deep copy of this FieldRun. */
|
|
308
286
|
clone(): FieldRun;
|
|
287
|
+
get isEmpty(): boolean;
|
|
309
288
|
/** Convert this FieldRun to a simple string representation. */
|
|
310
289
|
stringify(): string;
|
|
311
290
|
/** Returns true if `this` is equivalent to `other`. */
|
|
@@ -315,29 +294,49 @@ export declare class FieldRun extends TextBlockComponent {
|
|
|
315
294
|
* @beta
|
|
316
295
|
*/
|
|
317
296
|
export interface ParagraphProps extends TextBlockComponentProps {
|
|
318
|
-
|
|
319
|
-
* Default: an empty array.
|
|
320
|
-
*/
|
|
321
|
-
runs?: RunProps[];
|
|
297
|
+
children?: Array<ListProps | RunProps>;
|
|
322
298
|
}
|
|
323
|
-
/** A collection of [[Run]]s
|
|
299
|
+
/** A collection of [[Run]]s and [[List]]s. Paragraphs can be appended to [[List]]s and [[TextBlock]]s.
|
|
300
|
+
* Each paragraph is laid out on a separate line. If included in a [[List]], the paragraph will be treated as a list item.
|
|
324
301
|
* @beta
|
|
325
302
|
*/
|
|
326
303
|
export declare class Paragraph extends TextBlockComponent {
|
|
327
|
-
|
|
328
|
-
readonly
|
|
304
|
+
readonly type = "paragraph";
|
|
305
|
+
readonly children: Array<List | Run>;
|
|
329
306
|
private constructor();
|
|
330
|
-
toJSON(): ParagraphProps;
|
|
331
307
|
/** Create a paragraph from its JSON representation. */
|
|
332
|
-
static create(props?: ParagraphProps): Paragraph;
|
|
308
|
+
static create(props?: Omit<ParagraphProps, "type">): Paragraph;
|
|
309
|
+
clearStyleOverrides(options?: ClearTextStyleOptions): void;
|
|
310
|
+
get isEmpty(): boolean;
|
|
333
311
|
clone(): Paragraph;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
312
|
+
toJSON(): ParagraphProps;
|
|
313
|
+
/** Compute a string representation of this paragraph by concatenating the string representations of all of its children. */
|
|
314
|
+
stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string;
|
|
315
|
+
equals(other: TextBlockComponent): boolean;
|
|
316
|
+
}
|
|
317
|
+
/** JSON representation of a [[List]].
|
|
318
|
+
* @beta
|
|
319
|
+
*/
|
|
320
|
+
export interface ListProps extends TextBlockComponentProps {
|
|
321
|
+
readonly type: "list";
|
|
322
|
+
children?: ParagraphProps[];
|
|
323
|
+
}
|
|
324
|
+
/** A collection of list items ([[Paragraph]]s). Lists can be appended to [[Paragraph]]s.
|
|
325
|
+
* Lists will be laid out on a new line. Each item in a list is laid out on a separate line.
|
|
326
|
+
* @beta
|
|
327
|
+
*/
|
|
328
|
+
export declare class List extends TextBlockComponent {
|
|
329
|
+
readonly type = "list";
|
|
330
|
+
readonly children: Paragraph[];
|
|
331
|
+
protected constructor(props?: ListProps);
|
|
332
|
+
/** Create a list from its JSON representation. */
|
|
333
|
+
static create(props?: Omit<ListProps, "type">): List;
|
|
338
334
|
clearStyleOverrides(options?: ClearTextStyleOptions): void;
|
|
339
|
-
|
|
340
|
-
|
|
335
|
+
get isEmpty(): boolean;
|
|
336
|
+
clone(): List;
|
|
337
|
+
toJSON(): ListProps;
|
|
338
|
+
/** Compute a string representation of this list by concatenating the string representations of all of its [[children]]. */
|
|
339
|
+
stringify(options?: TextBlockStringifyOptions, context?: TextBlockStringifyContext): string;
|
|
341
340
|
equals(other: TextBlockComponent): boolean;
|
|
342
341
|
}
|
|
343
342
|
/** Describes the relative alignment of the content of a [[TextBlock]].
|
|
@@ -361,8 +360,6 @@ export interface TextBlockMargins {
|
|
|
361
360
|
* @beta
|
|
362
361
|
*/
|
|
363
362
|
export interface TextBlockProps extends TextBlockComponentProps {
|
|
364
|
-
/** The ID of an [AnnotationTextStyle]($backend) stored in the iModel from which the base [[TextStyleSettings]] applied to the [[TextBlock]] originates. */
|
|
365
|
-
styleId: Id64String;
|
|
366
363
|
/** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.
|
|
367
364
|
* A value less than or equal to zero indicates no wrapping is to be applied.
|
|
368
365
|
* Default: 0
|
|
@@ -372,21 +369,15 @@ export interface TextBlockProps extends TextBlockComponentProps {
|
|
|
372
369
|
justification?: TextBlockJustification;
|
|
373
370
|
/** The margins to surround the document content. Default: 0 margins on all sides */
|
|
374
371
|
margins?: Partial<TextBlockMargins>;
|
|
375
|
-
|
|
376
|
-
paragraphs?: ParagraphProps[];
|
|
372
|
+
children?: ParagraphProps[];
|
|
377
373
|
}
|
|
378
|
-
/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content
|
|
379
|
-
* You can change the content of the document by directly modifying the contents of its [[paragraphs]], or via [[appendParagraph]] and [[appendRun]].
|
|
374
|
+
/** Represents a formatted text document consisting of a series of [[Paragraph]]s, each laid out on a separate line and containing their own content.
|
|
380
375
|
* No word-wrapping is applied to the document unless a [[width]] greater than zero is specified.
|
|
381
376
|
* @see [[TextAnnotation]] to position a text block as an annotation in 2d or 3d space.
|
|
382
377
|
* @beta
|
|
383
378
|
*/
|
|
384
379
|
export declare class TextBlock extends TextBlockComponent {
|
|
385
|
-
|
|
386
|
-
* @note Assigning to this property retains all style overrides on the TextBlock and its child components.
|
|
387
|
-
* Call [[clearStyleOverrides]] to clear the TextBlock's and optionally all children's style overrides.
|
|
388
|
-
*/
|
|
389
|
-
styleId: Id64String;
|
|
380
|
+
readonly children: Paragraph[];
|
|
390
381
|
/** The width of the document in meters. Lines that would exceed this width are instead wrapped around to the next line if possible.
|
|
391
382
|
* A value less than or equal to zero indicates no wrapping is to be applied.
|
|
392
383
|
* Default: 0
|
|
@@ -396,33 +387,52 @@ export declare class TextBlock extends TextBlockComponent {
|
|
|
396
387
|
justification: TextBlockJustification;
|
|
397
388
|
/** The margins of the document. */
|
|
398
389
|
margins: TextBlockMargins;
|
|
399
|
-
/** The ordered list of paragraphs within the document. */
|
|
400
|
-
readonly paragraphs: Paragraph[];
|
|
401
390
|
private constructor();
|
|
391
|
+
clearStyleOverrides(options?: ClearTextStyleOptions): void;
|
|
402
392
|
toJSON(): TextBlockProps;
|
|
403
393
|
/** Create a text block from its JSON representation. */
|
|
404
|
-
static create(props
|
|
405
|
-
/** Create an empty text block containing no [[paragraphs]] and an empty [[styleId]]. */
|
|
406
|
-
static createEmpty(): TextBlock;
|
|
394
|
+
static create(props?: Omit<TextBlockProps, "type">): TextBlock;
|
|
407
395
|
/** Returns true if every paragraph in this text block is empty. */
|
|
408
396
|
get isEmpty(): boolean;
|
|
409
397
|
clone(): TextBlock;
|
|
410
|
-
/**
|
|
411
|
-
* Clears any [[styleOverrides]] applied to this TextBlock.
|
|
412
|
-
* Will also clear [[styleOverrides]] from all child components unless [[ClearTextStyleOptions.preserveChildrenOverrides]] is `true`.
|
|
413
|
-
*/
|
|
414
|
-
clearStyleOverrides(options?: ClearTextStyleOptions): void;
|
|
415
|
-
/** Compute a string representation of the document's contents by concatenating the string representations of each of its [[paragraphs]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */
|
|
398
|
+
/** Compute a string representation of the document's contents by concatenating the string representations of each of its [[children]], separated by [[TextBlockStringifyOptions.paragraphBreak]]. */
|
|
416
399
|
stringify(options?: TextBlockStringifyOptions): string;
|
|
417
400
|
/** Add and return a new paragraph.
|
|
418
401
|
* By default, the paragraph will be created with no [[styleOverrides]], so that it inherits the style of this block.
|
|
419
|
-
* @param seedFromLast If true and [[
|
|
402
|
+
* @param seedFromLast If true and [[children]] is not empty, the new paragraph will inherit the style overrides of the last child in this block.
|
|
403
|
+
* @note Be sure you pass in [[ParagraphProps]] and not [[Paragraph]] or style overrides will be ignored.
|
|
420
404
|
*/
|
|
421
|
-
appendParagraph(seedFromLast?: boolean): Paragraph;
|
|
405
|
+
appendParagraph(props?: ParagraphProps, seedFromLast?: boolean): Paragraph;
|
|
422
406
|
/** Append a run to the last [[Paragraph]] in this block.
|
|
423
|
-
* If the block contains no [[
|
|
407
|
+
* If the block contains no [[children]], a new [[Paragraph]] will first be created using [[appendParagraph]].
|
|
424
408
|
*/
|
|
425
409
|
appendRun(run: Run): void;
|
|
426
410
|
equals(other: TextBlockComponent): boolean;
|
|
427
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* A union of all the [[TextBlockComponent]]s that can contain other components.
|
|
414
|
+
* @beta
|
|
415
|
+
*/
|
|
416
|
+
export type StructuralTextBlockComponent = List | Paragraph | TextBlock;
|
|
417
|
+
/**
|
|
418
|
+
* Recursively traverses a [[StructuralTextBlockComponent]] tree, yielding each child component along with its parent container.
|
|
419
|
+
* This generator enables depth-first iteration over all components in a text block structure, including paragraphs, lists, and runs.
|
|
420
|
+
*
|
|
421
|
+
* @param parent The root container whose children should be traversed.
|
|
422
|
+
* @returns An IterableIterator yielding objects with the child component and its parent container.
|
|
423
|
+
* @beta
|
|
424
|
+
*/
|
|
425
|
+
export declare function traverseTextBlockComponent(parent: StructuralTextBlockComponent): IterableIterator<{
|
|
426
|
+
parent: StructuralTextBlockComponent;
|
|
427
|
+
child: List | Paragraph | Run;
|
|
428
|
+
}>;
|
|
429
|
+
/**
|
|
430
|
+
* Returns the formatted marker text for a list item based on the marker type and item number.
|
|
431
|
+
* Supports ordered and unordered list markers, including alphabetic, Roman numeral, and numeric formats.
|
|
432
|
+
* @param marker The type of list marker to use.
|
|
433
|
+
* @param num The item number in the list.
|
|
434
|
+
* @returns The formatted marker string for the list item.
|
|
435
|
+
* @beta
|
|
436
|
+
*/
|
|
437
|
+
export declare function getMarkerText(marker: ListMarker, num: number): string;
|
|
428
438
|
//# sourceMappingURL=TextBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextBlock.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TextBlock.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextBlock.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAA2C,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;CACf;AAWD;;;;;GAKG;AACH,8BAAsB,kBAAkB;IACtC,OAAO,CAAC,eAAe,CAAyB;IAEhD,gBAAgB;IAChB,SAAS,aAAa,KAAK,CAAC,EAAE,uBAAuB;IAIrD;;;OAGG;IACH,IAAW,cAAc,IAAI,sBAAsB,CAElD;IAED,IAAW,cAAc,CAAC,SAAS,EAAE,sBAAsB,EAE1D;IAED,8DAA8D;IACvD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