@itwin/core-common 5.3.0-dev.9 → 5.4.0-dev.3
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 +21 -1
- package/lib/cjs/ChangesetProps.d.ts +1 -0
- package/lib/cjs/ChangesetProps.d.ts.map +1 -1
- package/lib/cjs/ChangesetProps.js.map +1 -1
- package/lib/cjs/ElementProps.d.ts +47 -0
- package/lib/cjs/ElementProps.d.ts.map +1 -1
- package/lib/cjs/ElementProps.js.map +1 -1
- package/lib/cjs/annotation/TextField.d.ts +4 -2
- package/lib/cjs/annotation/TextField.d.ts.map +1 -1
- package/lib/cjs/annotation/TextField.js.map +1 -1
- package/lib/cjs/annotation/TextStyle.d.ts +14 -1
- package/lib/cjs/annotation/TextStyle.d.ts.map +1 -1
- package/lib/cjs/annotation/TextStyle.js +8 -2
- package/lib/cjs/annotation/TextStyle.js.map +1 -1
- package/lib/cjs/tile/GltfTileIO.d.ts +9 -0
- package/lib/cjs/tile/GltfTileIO.d.ts.map +1 -1
- package/lib/cjs/tile/GltfTileIO.js +44 -1
- package/lib/cjs/tile/GltfTileIO.js.map +1 -1
- package/lib/esm/ChangesetProps.d.ts +1 -0
- package/lib/esm/ChangesetProps.d.ts.map +1 -1
- package/lib/esm/ChangesetProps.js.map +1 -1
- package/lib/esm/ElementProps.d.ts +47 -0
- package/lib/esm/ElementProps.d.ts.map +1 -1
- package/lib/esm/ElementProps.js.map +1 -1
- package/lib/esm/annotation/TextField.d.ts +4 -2
- package/lib/esm/annotation/TextField.d.ts.map +1 -1
- package/lib/esm/annotation/TextField.js.map +1 -1
- package/lib/esm/annotation/TextStyle.d.ts +14 -1
- package/lib/esm/annotation/TextStyle.d.ts.map +1 -1
- package/lib/esm/annotation/TextStyle.js +7 -1
- package/lib/esm/annotation/TextStyle.js.map +1 -1
- package/lib/esm/tile/GltfTileIO.d.ts +9 -0
- package/lib/esm/tile/GltfTileIO.d.ts.map +1 -1
- package/lib/esm/tile/GltfTileIO.js +42 -0
- package/lib/esm/tile/GltfTileIO.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { Id64String } from \"@itwin/core-bentley\";\n\n/** Enumerates the different kinds of [Property]($ecschema-metadata) values that can be used as the basis for a [[FieldRun]]'s display string.\n * A field's property type is derived from the property's [PrimitiveType]($ecschema-metadata) and other attributes like its [PrimitiveOrEnumPropertyBase.extendedTypeName]($ecschema-metadata).\n * The conversion of the raw property value into a display string can be customized by different [[FieldFormatOptions]] based on its type.\n * The following types are currently recognized:\n * - \"quantity\": an often-unitized scalar value like a distance or area, formatted using a quantity [Format]($core-quantity).\n * - \"coordinate\": a 2- or 3-dimensional point, with each component formatted as a \"quantity\".\n * - \"boolean\": a true or false value.\n * - \"datetime\": an ECMAScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).\n * - \"int-enum\": an integer [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string-enum\": a string [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string\": a value convertible to a string.\n * @note Currently, only formatting of \"string\" and \"datetime\" types is implemented. Other types are converted to and formatted as \"string\".\n * @beta\n */\nexport type FieldPropertyType = \"quantity\" | \"coordinate\" | \"string\" | \"boolean\" | \"datetime\" | \"int-enum\" | \"string-enum\";\n\n/** A chain of property accesses that resolves to a primitive value that forms the basis of the displayed content\n * of a [[FieldRun]].\n * The simplest property paths consist of a [[propertyName]] and nothing else, where `propertyName` identifies\n * a primitive property.\n * If `propertyName` identifies a struct or array property, then additional [[accessors]] are required to identify the specific value.\n * Some examples:\n * ```\n * | Access String | propertyName | accessors |\n * | ------------- | ------------ | --------- |\n * | name | \"name\" | undefined |\n * | spouse.name | \"spouse\" | [name] |\n * | colors[2] | \"colors\" | [2] |\n * | spouse.favoriteRestaurants[1].address | \"spouse\" | [\"favoriteRestaurants\", 1, \"address\"] |\n * ```\n * @beta\n */\nexport interface FieldPropertyPath {\n /** The name of the BIS property of the [[FieldPropertyHost]] that serves as the root of the path. */\n propertyName: string;\n /** Property names and/or array indices describing the path from [[propertyName]] to the ultimate BIS property. */\n accessors?: Array<string | number>;\n}\n\n/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.\n * A field property is always hosted by an [Element]($backend). It may
|
|
1
|
+
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { Id64String } from \"@itwin/core-bentley\";\n\n/** Enumerates the different kinds of [Property]($ecschema-metadata) values that can be used as the basis for a [[FieldRun]]'s display string.\n * A field's property type is derived from the property's [PrimitiveType]($ecschema-metadata) and other attributes like its [PrimitiveOrEnumPropertyBase.extendedTypeName]($ecschema-metadata).\n * The conversion of the raw property value into a display string can be customized by different [[FieldFormatOptions]] based on its type.\n * The following types are currently recognized:\n * - \"quantity\": an often-unitized scalar value like a distance or area, formatted using a quantity [Format]($core-quantity).\n * - \"coordinate\": a 2- or 3-dimensional point, with each component formatted as a \"quantity\".\n * - \"boolean\": a true or false value.\n * - \"datetime\": an ECMAScript [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).\n * - \"int-enum\": an integer [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string-enum\": a string [EnumerationProperty]($ecschema-metadata) formatted using the enum value's display label.\n * - \"string\": a value convertible to a string.\n * @note Currently, only formatting of \"string\" and \"datetime\" types is implemented. Other types are converted to and formatted as \"string\".\n * @beta\n */\nexport type FieldPropertyType = \"quantity\" | \"coordinate\" | \"string\" | \"boolean\" | \"datetime\" | \"int-enum\" | \"string-enum\";\n\n/** A chain of property accesses that resolves to a primitive value that forms the basis of the displayed content\n * of a [[FieldRun]].\n * The simplest property paths consist of a [[propertyName]] and nothing else, where `propertyName` identifies\n * a primitive property.\n * If `propertyName` identifies a struct or array property, then additional [[accessors]] are required to identify the specific value.\n * Some examples:\n * ```\n * | Access String | propertyName | accessors |\n * | ------------- | ------------ | --------- |\n * | name | \"name\" | undefined |\n * | spouse.name | \"spouse\" | [name] |\n * | colors[2] | \"colors\" | [2] |\n * | spouse.favoriteRestaurants[1].address | \"spouse\" | [\"favoriteRestaurants\", 1, \"address\"] |\n * ```\n * @beta\n */\nexport interface FieldPropertyPath {\n /** The name of the BIS property of the [[FieldPropertyHost]] that serves as the root of the path. */\n propertyName: string;\n /** Property names and/or array indices describing the path from [[propertyName]] to the ultimate BIS property. */\n accessors?: Array<string | number>;\n}\n\n/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.\n * A field property is always hosted by an [Element]($backend). It may refer to a property belonging to any of the following:\n * - The element's BIS class itself;\n * - One of the element's [ElementAspect]($backend)s;\n * - Or an [EC view]($docs/learning/ECSqlReference/Views.md) with the same ECInstanceId as the element.\n * The [[schemaName]] and [[className]] should always identify the exact class that contains [[FieldPropertyPath.propertyName]] - not a subclass thereof.\n * @beta\n */\nexport interface FieldPropertyHost {\n /** The Id of the [Element]($backend) that hosts the property. */\n elementId: Id64String;\n /** The name of the schema containing the class identified by [[className]]. */\n schemaName: string;\n /** The name of the exact class (not a subclass) containing the property identified by [[FieldPropertyPath.propertyName]]. */\n className: string;\n}\n\n/** As part of [[FieldFormatOptions]], specifies how to modify the case of the display string.\n * \"as-is\" leaves it unmodified. \"upper\" and \"lower\" convert it to all upper-case or all lower-case, respectively.\n * @beta\n */\nexport type FieldCase = \"as-is\" | \"upper\" | \"lower\";\n\n/** As part of a [[FieldFormatOptions]], specifies how to format properties of [[FieldPropertyType]] \"datetime\".\n * @beta\n */\nexport interface DateTimeFieldFormatOptions {\n /** The locale with which to localize the display string.\n * Default: \"en-US\".\n */\n locale?: Intl.UnicodeBCP47LocaleIdentifier;\n /** Describes how to produce the display string. */\n formatOptions?: Intl.DateTimeFormatOptions;\n}\n\n/** Customizes how to format the raw property value resolved by a [[FieldPropertyPath]] into a [[FieldRun]]'s display string.\n * The exact options used depend upon the [[FieldPropertyType]].\n * @beta\n */\nexport interface FieldFormatOptions {\n /** A string inserted before the formatted string. This string is not affected by [[case]]. */\n prefix?: string;\n /** A string inserted after the formatted string. This string is not affected by [[case]]. */\n suffix?: string;\n /** Modifies the case of the formatted string. */\n case?: FieldCase;\n /** Formatting options for [[FieldPropertyType]] \"datetime\". */\n dateTime?: DateTimeFieldFormatOptions;\n}\n"]}
|
|
@@ -38,6 +38,14 @@ export declare const textAnnotationFrameShapes: readonly ["none", "line", "recta
|
|
|
38
38
|
* @beta
|
|
39
39
|
*/
|
|
40
40
|
export type TextAnnotationFrameShape = typeof textAnnotationFrameShapes[number];
|
|
41
|
+
/** Set of predefined shapes that can be used as terminators for leaders in a [[TextAnnotation]]
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export declare const terminatorShapes: readonly ["openArrow", "closedArrow", "closedArrowFilled", "circle", "circleFilled", "slash", "none"];
|
|
45
|
+
/** Describes a predefined shape that can be used as a terminator for leaders in a [[TextAnnotation]]
|
|
46
|
+
* @beta
|
|
47
|
+
*/
|
|
48
|
+
export type TerminatorShape = typeof terminatorShapes[number];
|
|
41
49
|
/**
|
|
42
50
|
* Describes what color to use when filling the frame around a [[TextBlock]].
|
|
43
51
|
* If `background` is specified, [[GeometryParams.BackgroundFill]] will be set to `BackgroundFill.Outline`.
|
|
@@ -109,6 +117,11 @@ export interface TextLeaderStyleProps {
|
|
|
109
117
|
* Default: 1.0
|
|
110
118
|
*/
|
|
111
119
|
elbowLength?: number;
|
|
120
|
+
/**
|
|
121
|
+
* The shape of the leader terminator.
|
|
122
|
+
* Default:"openArrow"
|
|
123
|
+
*/
|
|
124
|
+
terminatorShape?: TerminatorShape;
|
|
112
125
|
/** Multiplier to compute height of the leader terminator.
|
|
113
126
|
* The terminator height is computed in meters as terminatorHeight * [[textHeight]].
|
|
114
127
|
* Default: 1.0
|
|
@@ -194,7 +207,7 @@ export interface TextStyleSettingsProps {
|
|
|
194
207
|
widthFactor?: number;
|
|
195
208
|
/** Properties describing appearance of leaders in a [[TextAnnotation]]
|
|
196
209
|
* Used when producing geometry for [[TextAnnotation]]
|
|
197
|
-
* Default: {color:"subcategory", wantElbow:"false",elbowLength:1, terminatorWidthFactor:1, terminatorHeightFactor:1}.
|
|
210
|
+
* Default: {color:"subcategory", wantElbow:"false",elbowLength:1, terminatorShape:"openArrow",terminatorWidthFactor:1, terminatorHeightFactor:1}.
|
|
198
211
|
*/
|
|
199
212
|
leader?: TextLeaderStyleProps;
|
|
200
213
|
/** The size (in meters) used to calculate the tab stops in a run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextStyle.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextStyle.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAY,aAAa,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAY,MAAM,UAAU,CAAC;AAExD;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,uBAAuB;IACvB,MAAM,MAAM;IACZ,YAAY,MAAM;IAClB,MAAM,MAAM;IACZ,MAAM,WAAM;IACZ,MAAM,WAAM;IACZ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,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC/D,oDAAoD;IACpD,SAAgB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC9D,yCAAyC;IACzC,SAAgB,aAAa,EAAE,iBAAiB,CAAC;IAEjD,gHAAgH;IAChH,OAAc,YAAY,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC,CAwCxF;IAEF,kDAAkD;IAClD,OAAc,QAAQ,EAAE,iBAAiB,CAA6B;IAEtE,OAAO;IAqDP,uGAAuG;IAChG,KAAK,CAAC,YAAY,CAAC,EAAE,sBAAsB,GAAG,iBAAiB;IAItE,sDAAsD;WACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,sBAAsB,GAAG,iBAAiB;IAIlE,MAAM,IAAI,sBAAsB;IAIvC;;;OAGG;IACI,YAAY,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO;IAMlD,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAOhD,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAM9C,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO;IAgBhD;;;;;;;;;OASG;IACI,mBAAmB,IAAI,MAAM,EAAE;CAgBvC"}
|
|
@@ -27,6 +27,10 @@ export var ListMarkerEnumerator;
|
|
|
27
27
|
* @beta
|
|
28
28
|
*/
|
|
29
29
|
export const textAnnotationFrameShapes = ["none", "line", "rectangle", "circle", "equilateralTriangle", "diamond", "square", "pentagon", "hexagon", "octagon", "capsule", "roundedRectangle"];
|
|
30
|
+
/** Set of predefined shapes that can be used as terminators for leaders in a [[TextAnnotation]]
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
export const terminatorShapes = ["openArrow", "closedArrow", "closedArrowFilled", "circle", "circleFilled", "slash", "none"];
|
|
30
34
|
;
|
|
31
35
|
;
|
|
32
36
|
function deepFreeze(obj) {
|
|
@@ -143,6 +147,7 @@ export class TextStyleSettings {
|
|
|
143
147
|
color: "inherit",
|
|
144
148
|
wantElbow: false,
|
|
145
149
|
elbowLength: 1.0,
|
|
150
|
+
terminatorShape: terminatorShapes[0],
|
|
146
151
|
terminatorHeightFactor: 1.0,
|
|
147
152
|
terminatorWidthFactor: 1.0,
|
|
148
153
|
},
|
|
@@ -192,6 +197,7 @@ export class TextStyleSettings {
|
|
|
192
197
|
color: props.leader?.color ?? defaults.leader.color,
|
|
193
198
|
wantElbow: props.leader?.wantElbow ?? defaults.leader.wantElbow,
|
|
194
199
|
elbowLength: props.leader?.elbowLength ?? defaults.leader.elbowLength,
|
|
200
|
+
terminatorShape: props.leader?.terminatorShape ?? defaults.leader.terminatorShape,
|
|
195
201
|
terminatorHeightFactor: props.leader?.terminatorHeightFactor ?? defaults.leader.terminatorHeightFactor,
|
|
196
202
|
terminatorWidthFactor: props.leader?.terminatorWidthFactor ?? defaults.leader.terminatorWidthFactor,
|
|
197
203
|
};
|
|
@@ -232,7 +238,7 @@ export class TextStyleSettings {
|
|
|
232
238
|
*/
|
|
233
239
|
leaderEquals(other) {
|
|
234
240
|
return this.leader.color === other.color && this.leader.wantElbow === other.wantElbow
|
|
235
|
-
&& this.leader.elbowLength === other.elbowLength && this.leader.terminatorHeightFactor === other.terminatorHeightFactor
|
|
241
|
+
&& this.leader.elbowLength === other.elbowLength && this.leader.terminatorShape === other.terminatorShape && this.leader.terminatorHeightFactor === other.terminatorHeightFactor
|
|
236
242
|
&& this.leader.terminatorWidthFactor === other.terminatorWidthFactor;
|
|
237
243
|
}
|
|
238
244
|
frameEquals(other) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextStyle.js","sourceRoot":"","sources":["../../../src/annotation/TextStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAsB,QAAQ,EAA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I,CAAC,UAAU,CAAC,IAAI,KAAK,KAAK,CAAC,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC,UAAU;eAC1K,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;eAC1C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;eAC/B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC;eAC7B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;OASG;IACI,mBAAmB;QACxB,MAAM,aAAa,GAAa,EAAE,CAAC;QACnC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACjC,aAAa,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,IAAI,CAAC,oBAAoB,IAAI,CAAC,EAAE,CAAC;YACnC,aAAa,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;;AAGH,UAAU,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;AAC3C,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,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 Annotation\n */\n\nimport { DeepReadonlyObject, DeepRequiredObject } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"../ColorDef\";\nimport { FontFamilySelector, FontType } from \"../Fonts\";\n\n/** Predefined markers for list items in text annotations.\n * These values control the appearance of list item markers (e.g., bullet, circle, square, dash, number) that denote the start of a list item in a list.\n * @beta\n */\nexport enum ListMarkerEnumerator {\n /** English Alphabet */\n Letter = \"A\",\n RomanNumeral = \"I\",\n Number = \"1\",\n Bullet = \"•\",\n Circle = \"○\",\n Square = \"■\",\n /** EM Dash */\n Dash = \"–\",\n}\n\n/** A settings to specify how to mark or denote the start of a list item in a [[List]].\n * @beta\n */\nexport interface ListMarker {\n /** This can be either one of the predefined markers in [[ListMarkerEnumerator]], or any arbitrary string. */\n enumerator: ListMarkerEnumerator | string,\n /** The punctuation to follow the enumerator. */\n terminator?: \"parenthesis\" | \"period\",\n /** Whether to use upper or lower case for alphabetic or roman numeral enumerators. Ignored if [[enumerator]] is not alphabetic or roman numeral. */\n case?: \"upper\" | \"lower\",\n}\n\n/** Set of predefined shapes that can be computed and drawn around the margins of a [[TextBlock]]\n * @beta\n*/\nexport const textAnnotationFrameShapes = [\"none\", \"line\", \"rectangle\", \"circle\", \"equilateralTriangle\", \"diamond\", \"square\", \"pentagon\", \"hexagon\", \"octagon\", \"capsule\", \"roundedRectangle\"] as const;\n\n/** Describes a predefined shape that can be computed and drawn around the margins of a [[TextBlock]]\n * @beta\n*/\nexport type TextAnnotationFrameShape = typeof textAnnotationFrameShapes[number];\n\n/**\n * Describes what color to use when filling the frame around a [[TextBlock]].\n * If `background` is specified, [[GeometryParams.BackgroundFill]] will be set to `BackgroundFill.Outline`.\n * If `none` is specified, no fill will be applied.\n * @beta\n */\nexport type TextAnnotationFillColor = TextStyleColor | \"background\" | \"none\";\n\n/** Describes the margins around the content inside a [[TextBlock]], measured in meters.\n * All margins default to zero if `undefined`.\n * @beta\n */\nexport interface TextBlockMargins {\n /** The left margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n left?: number;\n /** The right margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n right?: number;\n /** The top margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n top?: number;\n /** The bottom margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n bottom?: number;\n};\n\n/** Describes the relative alignment of text.\n * @beta\n*/\nexport type TextJustification = \"left\" | \"center\" | \"right\";\n\n/** Specifies how to separate the numerator and denominator of a [[FractionRun]], by either a horizontal or diagonal bar.\n * @see [[TextStyleSettingsProps.stackedFractionType]] and [[TextStyleSettings.stackedFractionType]].\n * @beta\n */\nexport type StackedFractionType = \"horizontal\" | \"diagonal\";\n\n/** Describes the color in which to draw the text in a [[TextRun]].\n * \"subcategory\" indicates that the text should be drawn using the color of the [SubCategory]($backend) specified by the [GeometryStream]($docs/learning/common/GeometryStream.md) hosting the\n * text.\n * @beta\n */\nexport type TextStyleColor = ColorDefProps | \"subcategory\";\n\n/**\n * Describes how to draw the frame around a [[TextAnnotation]].\n * The frame can be a simple line, a filled shape, or both.\n * If only a subset of properties are specified, the others will be set to their default value.\n * @beta\n */\nexport interface TextFrameStyleProps {\n /** Shape of the frame. Default: \"none\" */\n shape?: TextAnnotationFrameShape;\n /** The color to fill the shape of the text frame. This fill is applied using [[FillDisplay.Blanking]]. Default: \"none\" */\n fillColor?: TextAnnotationFillColor;\n /** The color of the text frame's outline. Default: black */\n borderColor?: TextStyleColor;\n /** This will be used to set the [[GeometryParams.weight]] property of the frame (in pixels). Default: 1px */\n borderWeight?: number;\n};\n\n/** Properties describing the appearance of [[TextAnnotationLeader]] in a [[TextAnnotation]].\n * Used when producing geometry for [[TextAnnotation]].\n * @beta\n */\nexport interface TextLeaderStyleProps {\n /** The color of the leader.\n * If `inherit` is specified, the [[TextAnnotationLeader]] will use the color specified in the parent [[TextStyleSettings]]`.\n * Default: \"inherit\".\n */\n color?: TextStyleColor | \"inherit\";\n /** Whether to use an elbow in the leader.\n * Default: false\n */\n wantElbow?: boolean;\n /** Multiplier used to compute length of the elbow in the leader.\n * The elbowLength is computed in meters as elbowLength * [[textHeight]].\n * Default: 1.0\n */\n elbowLength?: number;\n /** Multiplier to compute height of the leader terminator.\n * The terminator height is computed in meters as terminatorHeight * [[textHeight]].\n * Default: 1.0\n */\n terminatorHeightFactor?: number;\n /** Multiplier to compute width of the leader terminator.\n * The terminator width is computed in meters as terminatorWidth * [[textHeight]].\n * Default: 1.0\n */\n terminatorWidthFactor?: number;\n}\n\n/** Serves both as the JSON representation of a [[TextStyleSettings]], and a way for a [[TextBlockComponent]] to selectively override aspects of a [AnnotationTextStyle]($backend)'s properties.\n * @beta\n */\nexport interface TextStyleSettingsProps {\n /** The color of the text.\n * Default: \"subcategory\".\n */\n color?: TextStyleColor;\n /** The font stored in an iModel, used to draw the contents of a [[TextRun]].\n * Default: { name: \"\" } (an invalid font name).\n */\n font?: FontFamilySelector;\n /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.\n * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and\n * textHeight * [[subScriptOffsetFactor]], respectively.\n * Default: 1.0. */\n textHeight?: number;\n /** Multiplier used to compute the vertical distance between two lines of text.\n * The distance is computed in meters as lineSpacingFactor * [[textHeight]].\n * Default: 0.5.\n */\n lineSpacingFactor?: number;\n /** Multiplier used to compute the vertical distance between two paragraphs of text.\n * The distance is computed in meters as paragraphSpacingFactor * [[textHeight]].\n * Default: 0.5.\n */\n paragraphSpacingFactor?: number;\n /** Specifies whether the content of a [[TextRun]] should be rendered **bold**.\n * Default: false.\n */\n isBold?: boolean;\n /** Specifies whether the content of a [[TextRun]] should be rendered in *italics*.\n * Default: false.\n */\n isItalic?: boolean;\n /** Specifies whether the content of a [[TextRun]] should be underlined.\n * Default: false.\n */\n isUnderlined?: boolean;\n /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].\n * The height is computed in meters as stackedFractionScale * [[textHeight]].\n * Default: 0.7.\n */\n stackedFractionScale?: number;\n /** Specifies how to separate the numerator and denominator of a [[FractionRun]].\n * Default: \"horizontal\".\n */\n stackedFractionType?: StackedFractionType;\n /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].\n * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].\n * Default: -0.15.\n */\n subScriptOffsetFactor?: number;\n /** Multiplier used to compute the height of a subscript [[TextRun]].\n * The height is computed as subScriptScale * [[textHeight]].\n * Default: 2/3\n */\n subScriptScale?: number;\n /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].\n * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].\n * Default: -0.5.\n */\n superScriptOffsetFactor?: number;\n /** Multiplier used to compute the height of a superscript [[TextRun]].\n * The height is computed as superScriptScale * [[textHeight]].\n * Default: 2/3\n */\n superScriptScale?: number;\n /** A scale applied to the width of each glyph.\n * Default: 1.0\n */\n widthFactor?: number;\n\n /** Properties describing appearance of leaders in a [[TextAnnotation]]\n * Used when producing geometry for [[TextAnnotation]]\n * Default: {color:\"subcategory\", wantElbow:\"false\",elbowLength:1, terminatorWidthFactor:1, terminatorHeightFactor:1}.\n */\n leader?: TextLeaderStyleProps;\n /** The size (in meters) used to calculate the tab stops in a run.\n * These are equally spaced from the left edge of the TextBlock.\n * [[tabInterval]] is also used in lists to compute the offset of each child or [[Paragraph]].\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n * Default: 4 meters.\n */\n tabInterval?: number;\n /**\n * A description of the frame around the text annotation.\n * Used when producing geometry for [[TextAnnotation]]s.\n * Default: {shape: \"none\", fill: \"none\", border: black, borderWeight: 1} for no frame.\n */\n frame?: TextFrameStyleProps;\n /** The margins to surround the document content.\n * Default: 0 margins on all sides */\n margins?: TextBlockMargins;\n /** The offset (in meters) from the left edge of the text block to the start of the line of text.\n * In lists, the indentation is added to offset of list items.\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n * Default: 0 meters.\n */\n indentation?: number;\n /** The marker used to indicate the start of a list item.\n * Default: \"1.\".\n */\n listMarker?: ListMarker;\n /** The alignment of the text content.\n * Default: \"left\". */\n justification?: TextJustification;\n}\n\nfunction deepFreeze<T>(obj: T) {\n if (obj === null || typeof obj !== \"object\" || Object.isFrozen(obj))\n return;\n Object.getOwnPropertyNames(obj).forEach((prop) => {\n const value = (obj as any)[prop];\n if (value && typeof value === \"object\") {\n deepFreeze(value);\n }\n });\n Object.freeze(obj);\n}\n\n/** A description of the formatting to be applied to a [[TextBlockComponent]].\n * Named instances of these settings can be stored as [AnnotationTextStyle]($backend)s in an iModel.\n * @note This is an immutable type. Use [[clone]] to create a modified copy.\n * @see [[TextStyleSettingsProps]] for documentation of each of the settings.\n * @beta\n */\nexport class TextStyleSettings {\n /** The color of the text. */\n public readonly color: TextStyleColor;\n /** The font stored in an iModel, used to draw the contents of a [[TextRun]].\n */\n public readonly font: Readonly<Required<FontFamilySelector>>;\n /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.\n * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and\n * textHeight * [[subScriptOffsetFactor]], respectively.\n */\n public readonly textHeight: number;\n /** Multiplier used to compute the vertical distance between two lines of text.\n * The distance is computed in meters as lineSpacingFactor * [[textHeight]] of the [[TextBlock]].\n */\n public readonly lineSpacingFactor: number;\n /** Multiplier used to compute the vertical distance between two paragraphs of text.\n * The distance is computed in meters as paragraphSpacingFactor * the [[TextBlock]]'s [[textHeight]].\n */\n public readonly paragraphSpacingFactor: number;\n /** Specifies whether the content of a [[TextRun]] should be rendered **bold**. */\n public readonly isBold: boolean;\n /** Specifies whether the content of a [[TextRun]] should be rendered in *italics*. */\n public readonly isItalic: boolean;\n /** Specifies whether the content of a [[TextRun]] should be underlined. */\n public readonly isUnderlined: boolean;\n /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].\n * The height is computed in meters as stackedFractionScale * [[textHeight]].\n */\n public readonly stackedFractionScale: number;\n /** Specifies how to separate the numerator and denominator of a [[FractionRun]]. */\n public readonly stackedFractionType: StackedFractionType;\n /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].\n * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].\n */\n public readonly subScriptOffsetFactor: number;\n /** Multiplier used to compute the height of a subscript [[TextRun]].\n * The height is computed as subScriptScale * [[textHeight]].\n */\n public readonly subScriptScale: number;\n /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].\n * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].\n */\n public readonly superScriptOffsetFactor: number;\n /** Multiplier used to compute the height of a superscript [[TextRun]].\n * The height is computed as superScriptScale * [[textHeight]].\n */\n public readonly superScriptScale: number;\n /** Multiplier used to compute the width of each glyph, relative to [[textHeight]]. */\n public readonly widthFactor: number;\n /** Properties describing appearance of leaders in a [[TextAnnotation]].\n * Used when producing geometry for [[TextAnnotation]].\n */\n public readonly leader: Readonly<Required<TextLeaderStyleProps>>;\n /** The size (in meters) used to calculate the tab stops in a run.\n * These are equally spaced from the left edge of the TextBlock.\n * [[tabInterval]] is also used in lists to compute the offset of each child or [[Paragraph]].\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n */\n public readonly tabInterval: number;\n /** The offset (in meters) from the left edge of the text block to the start of the line of text.\n * In lists, the indentation is added to offset of list items.\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n */\n public readonly indentation: number;\n /** The marker used to indicate the start of a list item.\n * Default: [[ListMarkerEnumerator.Number]].\n */\n public readonly listMarker: ListMarker;\n /** The frame settings of the [[TextAnnotation]]. */\n public readonly frame: Readonly<Required<TextFrameStyleProps>>;\n /** The margins to surround the document content. */\n public readonly margins: Readonly<Required<TextBlockMargins>>;\n /** The alignment of the text content. */\n public readonly justification: TextJustification;\n\n /** A fully-populated JSON representation of the default settings. A real `font` must be provided before use. */\n public static defaultProps: DeepReadonlyObject<DeepRequiredObject<TextStyleSettingsProps>> = {\n color: \"subcategory\",\n font: { name: \"\", type: FontType.TrueType },\n textHeight: 1,\n lineSpacingFactor: 0.5,\n paragraphSpacingFactor: 0.5,\n isBold: false,\n isItalic: false,\n isUnderlined: false,\n stackedFractionScale: 0.7,\n stackedFractionType: \"horizontal\",\n subScriptOffsetFactor: -0.15,\n subScriptScale: 2 / 3,\n superScriptOffsetFactor: 0.5,\n superScriptScale: 2 / 3,\n widthFactor: 1,\n leader: {\n color: \"inherit\",\n wantElbow: false,\n elbowLength: 1.0,\n terminatorHeightFactor: 1.0,\n terminatorWidthFactor: 1.0,\n },\n tabInterval: 4,\n indentation: 0,\n listMarker: { enumerator: \"1\", terminator: \"period\", case: \"lower\" },\n frame: {\n shape: \"none\",\n fillColor: \"none\",\n borderColor: ColorDef.black.toJSON(),\n borderWeight: 1,\n },\n margins: {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n },\n justification: \"left\",\n };\n\n /** Settings initialized to all default values. */\n public static defaults: TextStyleSettings = new TextStyleSettings({});\n\n private constructor(props: TextStyleSettingsProps, defaults?: Required<TextStyleSettingsProps>) {\n if (!defaults) {\n defaults = TextStyleSettings.defaultProps;\n }\n\n this.color = props.color ?? defaults.color;\n const font = {\n name: props.font?.name ?? defaults.font.name,\n type: props.font?.type ?? defaults.font.type,\n }\n this.font = Object.freeze(font) as Readonly<Required<FontFamilySelector>>;\n this.textHeight = props.textHeight ?? defaults.textHeight;\n this.lineSpacingFactor = props.lineSpacingFactor ?? defaults.lineSpacingFactor;\n this.paragraphSpacingFactor = props.paragraphSpacingFactor ?? defaults.paragraphSpacingFactor;\n this.isBold = props.isBold ?? defaults.isBold;\n this.isItalic = props.isItalic ?? defaults.isItalic;\n this.isUnderlined = props.isUnderlined ?? defaults.isUnderlined;\n this.stackedFractionScale = props.stackedFractionScale ?? defaults.stackedFractionScale;\n this.stackedFractionType = props.stackedFractionType ?? defaults.stackedFractionType;\n this.subScriptOffsetFactor = props.subScriptOffsetFactor ?? defaults.subScriptOffsetFactor;\n this.subScriptScale = props.subScriptScale ?? defaults.subScriptScale;\n this.superScriptOffsetFactor = props.superScriptOffsetFactor ?? defaults.superScriptOffsetFactor;\n this.superScriptScale = props.superScriptScale ?? defaults.superScriptScale;\n this.widthFactor = props.widthFactor ?? defaults.widthFactor;\n const leader = {\n color: props.leader?.color ?? defaults.leader.color,\n wantElbow: props.leader?.wantElbow ?? defaults.leader.wantElbow,\n elbowLength: props.leader?.elbowLength ?? defaults.leader.elbowLength,\n terminatorHeightFactor: props.leader?.terminatorHeightFactor ?? defaults.leader.terminatorHeightFactor,\n terminatorWidthFactor: props.leader?.terminatorWidthFactor ?? defaults.leader.terminatorWidthFactor,\n }\n this.leader = Object.freeze(leader) as Readonly<Required<TextLeaderStyleProps>>;\n this.tabInterval = props.tabInterval ?? defaults.tabInterval;\n this.indentation = props.indentation ?? defaults.indentation;\n this.listMarker = props.listMarker ?? defaults.listMarker;\n const frame = {\n shape: props.frame?.shape ?? defaults.frame.shape,\n fillColor: props.frame?.fillColor ?? defaults.frame.fillColor,\n borderColor: props.frame?.borderColor ?? defaults.frame.borderColor,\n borderWeight: props.frame?.borderWeight ?? defaults.frame.borderWeight,\n };\n // Cast to indicate to TypeScript that the frame properties are all defined\n this.frame = Object.freeze(frame) as Readonly<Required<TextFrameStyleProps>>;\n this.margins = Object.freeze({\n left: props.margins?.left ?? defaults.margins.left,\n right: props.margins?.right ?? defaults.margins.right,\n top: props.margins?.top ?? defaults.margins.top,\n bottom: props.margins?.bottom ?? defaults.margins.bottom,\n }) as Readonly<Required<TextBlockMargins>>;\n this.justification = props.justification ?? defaults.justification;\n }\n\n /** Create a copy of these settings, modified according to the properties defined by `alteredProps`. */\n public clone(alteredProps?: TextStyleSettingsProps): TextStyleSettings {\n return alteredProps ? new TextStyleSettings(alteredProps, this) : this;\n }\n\n /** Create settings from their JSON representation. */\n public static fromJSON(props?: TextStyleSettingsProps): TextStyleSettings {\n return props ? new TextStyleSettings(props) : TextStyleSettings.defaults;\n }\n\n public toJSON(): TextStyleSettingsProps {\n return structuredClone(this);\n }\n\n /** Compare two [[TextLeaderStyleProps]] for equality.\n * @param other The other leader style properties to compare against.\n * @returns true if the two leader styles are equal, false otherwise.\n */\n public leaderEquals(other: TextLeaderStyleProps): boolean {\n return this.leader.color === other.color && this.leader.wantElbow === other.wantElbow\n && this.leader.elbowLength === other.elbowLength && this.leader.terminatorHeightFactor === other.terminatorHeightFactor\n && this.leader.terminatorWidthFactor === other.terminatorWidthFactor;\n }\n\n public frameEquals(other: TextFrameStyleProps): boolean {\n return this.frame?.shape === other.shape\n && this.frame?.fillColor === other.fillColor\n && this.frame?.borderColor === other.borderColor\n && this.frame?.borderWeight === other.borderWeight;\n }\n\n public marginsEqual(other: TextBlockMargins): boolean {\n return Object.entries(this.margins).every(([key, value]) =>\n value === (other as any)[key]\n );\n }\n\n public equals(other: TextStyleSettings): boolean {\n return this.color === other.color && this.font.name === other.font.name && this.font.type === other.font.type\n && this.textHeight === other.textHeight && this.widthFactor === other.widthFactor\n && this.lineSpacingFactor === other.lineSpacingFactor && this.paragraphSpacingFactor === other.paragraphSpacingFactor\n && this.isBold === other.isBold && this.isItalic === other.isItalic && this.isUnderlined === other.isUnderlined\n && this.stackedFractionType === other.stackedFractionType && this.stackedFractionScale === other.stackedFractionScale\n && this.subScriptOffsetFactor === other.subScriptOffsetFactor && this.subScriptScale === other.subScriptScale\n && this.superScriptOffsetFactor === other.superScriptOffsetFactor && this.superScriptScale === other.superScriptScale\n && this.tabInterval === other.tabInterval && this.indentation === other.indentation\n && this.listMarker.case === other.listMarker.case && this.listMarker.enumerator === other.listMarker.enumerator && this.listMarker.terminator === other.listMarker.terminator\n && this.justification === other.justification\n && this.leaderEquals(other.leader)\n && this.frameEquals(other.frame)\n && this.marginsEqual(other.margins);\n }\n\n /**\n * Returns a list of validation errors for this instance.\n *\n * A TextStyleSettings object may contain values that are invalid in all contexts.\n * If this method returns any error strings, using the settings will likely result in rendering failures or runtime exceptions.\n *\n * This method only checks for universally invalid values. Additional domain-specific validation may be required depending on the context in which these settings are used.\n *\n * @returns An array of error strings describing the invalid values, or an empty array if the settings are valid.\n */\n public getValidationErrors(): string[] {\n const errorMessages: string[] = [];\n if (this.font.name.trim() === \"\") {\n errorMessages.push(\"font name must be provided\");\n }\n\n if (this.textHeight <= 0) {\n errorMessages.push(\"textHeight must be greater than 0\");\n }\n\n if (this.stackedFractionScale <= 0) {\n errorMessages.push(\"stackedFractionScale must be greater than 0\");\n }\n\n return errorMessages;\n }\n}\n\ndeepFreeze(TextStyleSettings.defaultProps);\ndeepFreeze(TextStyleSettings.defaults);"]}
|
|
1
|
+
{"version":3,"file":"TextStyle.js","sourceRoot":"","sources":["../../../src/annotation/TextStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAiB,MAAM,aAAa,CAAC;AACtD,OAAO,EAAsB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAN,IAAY,oBAUX;AAVD,WAAY,oBAAoB;IAC9B,uBAAuB;IACvB,oCAAY,CAAA;IACZ,0CAAkB,CAAA;IAClB,oCAAY,CAAA;IACZ,yCAAY,CAAA;IACZ,yCAAY,CAAA;IACZ,yCAAY,CAAA;IACZ,cAAc;IACd,uCAAU,CAAA;AACZ,CAAC,EAVW,oBAAoB,KAApB,oBAAoB,QAU/B;AAcD;;EAEE;AACF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAk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UAAU,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC,UAAU;eAC1K,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;eAC1C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;eAC/B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC;eAC7B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;OASG;IACI,mBAAmB;QACxB,MAAM,aAAa,GAAa,EAAE,CAAC;QACnC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACjC,aAAa,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,IAAI,CAAC,oBAAoB,IAAI,CAAC,EAAE,CAAC;YACnC,aAAa,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;;AAGH,UAAU,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;AAC3C,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,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 Annotation\n */\n\nimport { DeepReadonlyObject, DeepRequiredObject } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"../ColorDef\";\nimport { FontFamilySelector, FontType } from \"../Fonts\";\n\n/** Predefined markers for list items in text annotations.\n * These values control the appearance of list item markers (e.g., bullet, circle, square, dash, number) that denote the start of a list item in a list.\n * @beta\n */\nexport enum ListMarkerEnumerator {\n /** English Alphabet */\n Letter = \"A\",\n RomanNumeral = \"I\",\n Number = \"1\",\n Bullet = \"•\",\n Circle = \"○\",\n Square = \"■\",\n /** EM Dash */\n Dash = \"–\",\n}\n\n/** A settings to specify how to mark or denote the start of a list item in a [[List]].\n * @beta\n */\nexport interface ListMarker {\n /** This can be either one of the predefined markers in [[ListMarkerEnumerator]], or any arbitrary string. */\n enumerator: ListMarkerEnumerator | string,\n /** The punctuation to follow the enumerator. */\n terminator?: \"parenthesis\" | \"period\",\n /** Whether to use upper or lower case for alphabetic or roman numeral enumerators. Ignored if [[enumerator]] is not alphabetic or roman numeral. */\n case?: \"upper\" | \"lower\",\n}\n\n/** Set of predefined shapes that can be computed and drawn around the margins of a [[TextBlock]]\n * @beta\n*/\nexport const textAnnotationFrameShapes = [\"none\", \"line\", \"rectangle\", \"circle\", \"equilateralTriangle\", \"diamond\", \"square\", \"pentagon\", \"hexagon\", \"octagon\", \"capsule\", \"roundedRectangle\"] as const;\n\n/** Describes a predefined shape that can be computed and drawn around the margins of a [[TextBlock]]\n * @beta\n*/\nexport type TextAnnotationFrameShape = typeof textAnnotationFrameShapes[number];\n\n/** Set of predefined shapes that can be used as terminators for leaders in a [[TextAnnotation]]\n * @beta\n*/\nexport const terminatorShapes = [\"openArrow\", \"closedArrow\", \"closedArrowFilled\", \"circle\", \"circleFilled\", \"slash\", \"none\"] as const;\n\n/** Describes a predefined shape that can be used as a terminator for leaders in a [[TextAnnotation]]\n * @beta\n*/\nexport type TerminatorShape = typeof terminatorShapes[number];\n\n/**\n * Describes what color to use when filling the frame around a [[TextBlock]].\n * If `background` is specified, [[GeometryParams.BackgroundFill]] will be set to `BackgroundFill.Outline`.\n * If `none` is specified, no fill will be applied.\n * @beta\n */\nexport type TextAnnotationFillColor = TextStyleColor | \"background\" | \"none\";\n\n/** Describes the margins around the content inside a [[TextBlock]], measured in meters.\n * All margins default to zero if `undefined`.\n * @beta\n */\nexport interface TextBlockMargins {\n /** The left margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n left?: number;\n /** The right margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n right?: number;\n /** The top margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n top?: number;\n /** The bottom margin measured in meters. Must be a positive number >= 0. Negative values are disregarded */\n bottom?: number;\n};\n\n/** Describes the relative alignment of text.\n * @beta\n*/\nexport type TextJustification = \"left\" | \"center\" | \"right\";\n\n/** Specifies how to separate the numerator and denominator of a [[FractionRun]], by either a horizontal or diagonal bar.\n * @see [[TextStyleSettingsProps.stackedFractionType]] and [[TextStyleSettings.stackedFractionType]].\n * @beta\n */\nexport type StackedFractionType = \"horizontal\" | \"diagonal\";\n\n/** Describes the color in which to draw the text in a [[TextRun]].\n * \"subcategory\" indicates that the text should be drawn using the color of the [SubCategory]($backend) specified by the [GeometryStream]($docs/learning/common/GeometryStream.md) hosting the\n * text.\n * @beta\n */\nexport type TextStyleColor = ColorDefProps | \"subcategory\";\n\n/**\n * Describes how to draw the frame around a [[TextAnnotation]].\n * The frame can be a simple line, a filled shape, or both.\n * If only a subset of properties are specified, the others will be set to their default value.\n * @beta\n */\nexport interface TextFrameStyleProps {\n /** Shape of the frame. Default: \"none\" */\n shape?: TextAnnotationFrameShape;\n /** The color to fill the shape of the text frame. This fill is applied using [[FillDisplay.Blanking]]. Default: \"none\" */\n fillColor?: TextAnnotationFillColor;\n /** The color of the text frame's outline. Default: black */\n borderColor?: TextStyleColor;\n /** This will be used to set the [[GeometryParams.weight]] property of the frame (in pixels). Default: 1px */\n borderWeight?: number;\n};\n\n/** Properties describing the appearance of [[TextAnnotationLeader]] in a [[TextAnnotation]].\n * Used when producing geometry for [[TextAnnotation]].\n * @beta\n */\nexport interface TextLeaderStyleProps {\n /** The color of the leader.\n * If `inherit` is specified, the [[TextAnnotationLeader]] will use the color specified in the parent [[TextStyleSettings]]`.\n * Default: \"inherit\".\n */\n color?: TextStyleColor | \"inherit\";\n /** Whether to use an elbow in the leader.\n * Default: false\n */\n wantElbow?: boolean;\n /** Multiplier used to compute length of the elbow in the leader.\n * The elbowLength is computed in meters as elbowLength * [[textHeight]].\n * Default: 1.0\n */\n elbowLength?: number;\n /**\n * The shape of the leader terminator.\n * Default:\"openArrow\"\n */\n terminatorShape?: TerminatorShape;\n /** Multiplier to compute height of the leader terminator.\n * The terminator height is computed in meters as terminatorHeight * [[textHeight]].\n * Default: 1.0\n */\n terminatorHeightFactor?: number;\n /** Multiplier to compute width of the leader terminator.\n * The terminator width is computed in meters as terminatorWidth * [[textHeight]].\n * Default: 1.0\n */\n terminatorWidthFactor?: number;\n}\n\n/** Serves both as the JSON representation of a [[TextStyleSettings]], and a way for a [[TextBlockComponent]] to selectively override aspects of a [AnnotationTextStyle]($backend)'s properties.\n * @beta\n */\nexport interface TextStyleSettingsProps {\n /** The color of the text.\n * Default: \"subcategory\".\n */\n color?: TextStyleColor;\n /** The font stored in an iModel, used to draw the contents of a [[TextRun]].\n * Default: { name: \"\" } (an invalid font name).\n */\n font?: FontFamilySelector;\n /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.\n * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and\n * textHeight * [[subScriptOffsetFactor]], respectively.\n * Default: 1.0. */\n textHeight?: number;\n /** Multiplier used to compute the vertical distance between two lines of text.\n * The distance is computed in meters as lineSpacingFactor * [[textHeight]].\n * Default: 0.5.\n */\n lineSpacingFactor?: number;\n /** Multiplier used to compute the vertical distance between two paragraphs of text.\n * The distance is computed in meters as paragraphSpacingFactor * [[textHeight]].\n * Default: 0.5.\n */\n paragraphSpacingFactor?: number;\n /** Specifies whether the content of a [[TextRun]] should be rendered **bold**.\n * Default: false.\n */\n isBold?: boolean;\n /** Specifies whether the content of a [[TextRun]] should be rendered in *italics*.\n * Default: false.\n */\n isItalic?: boolean;\n /** Specifies whether the content of a [[TextRun]] should be underlined.\n * Default: false.\n */\n isUnderlined?: boolean;\n /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].\n * The height is computed in meters as stackedFractionScale * [[textHeight]].\n * Default: 0.7.\n */\n stackedFractionScale?: number;\n /** Specifies how to separate the numerator and denominator of a [[FractionRun]].\n * Default: \"horizontal\".\n */\n stackedFractionType?: StackedFractionType;\n /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].\n * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].\n * Default: -0.15.\n */\n subScriptOffsetFactor?: number;\n /** Multiplier used to compute the height of a subscript [[TextRun]].\n * The height is computed as subScriptScale * [[textHeight]].\n * Default: 2/3\n */\n subScriptScale?: number;\n /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].\n * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].\n * Default: -0.5.\n */\n superScriptOffsetFactor?: number;\n /** Multiplier used to compute the height of a superscript [[TextRun]].\n * The height is computed as superScriptScale * [[textHeight]].\n * Default: 2/3\n */\n superScriptScale?: number;\n /** A scale applied to the width of each glyph.\n * Default: 1.0\n */\n widthFactor?: number;\n\n /** Properties describing appearance of leaders in a [[TextAnnotation]]\n * Used when producing geometry for [[TextAnnotation]]\n * Default: {color:\"subcategory\", wantElbow:\"false\",elbowLength:1, terminatorShape:\"openArrow\",terminatorWidthFactor:1, terminatorHeightFactor:1}.\n */\n leader?: TextLeaderStyleProps;\n /** The size (in meters) used to calculate the tab stops in a run.\n * These are equally spaced from the left edge of the TextBlock.\n * [[tabInterval]] is also used in lists to compute the offset of each child or [[Paragraph]].\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n * Default: 4 meters.\n */\n tabInterval?: number;\n /**\n * A description of the frame around the text annotation.\n * Used when producing geometry for [[TextAnnotation]]s.\n * Default: {shape: \"none\", fill: \"none\", border: black, borderWeight: 1} for no frame.\n */\n frame?: TextFrameStyleProps;\n /** The margins to surround the document content.\n * Default: 0 margins on all sides */\n margins?: TextBlockMargins;\n /** The offset (in meters) from the left edge of the text block to the start of the line of text.\n * In lists, the indentation is added to offset of list items.\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n * Default: 0 meters.\n */\n indentation?: number;\n /** The marker used to indicate the start of a list item.\n * Default: \"1.\".\n */\n listMarker?: ListMarker;\n /** The alignment of the text content.\n * Default: \"left\". */\n justification?: TextJustification;\n}\n\nfunction deepFreeze<T>(obj: T) {\n if (obj === null || typeof obj !== \"object\" || Object.isFrozen(obj))\n return;\n Object.getOwnPropertyNames(obj).forEach((prop) => {\n const value = (obj as any)[prop];\n if (value && typeof value === \"object\") {\n deepFreeze(value);\n }\n });\n Object.freeze(obj);\n}\n\n/** A description of the formatting to be applied to a [[TextBlockComponent]].\n * Named instances of these settings can be stored as [AnnotationTextStyle]($backend)s in an iModel.\n * @note This is an immutable type. Use [[clone]] to create a modified copy.\n * @see [[TextStyleSettingsProps]] for documentation of each of the settings.\n * @beta\n */\nexport class TextStyleSettings {\n /** The color of the text. */\n public readonly color: TextStyleColor;\n /** The font stored in an iModel, used to draw the contents of a [[TextRun]].\n */\n public readonly font: Readonly<Required<FontFamilySelector>>;\n /** The height of the text, in meters. Many other settings use the text height as the basis for computing their own values.\n * For example, the height and offset from baseline of a subscript [[TextRun]] are computed as textHeight * [[subScriptScale]] and\n * textHeight * [[subScriptOffsetFactor]], respectively.\n */\n public readonly textHeight: number;\n /** Multiplier used to compute the vertical distance between two lines of text.\n * The distance is computed in meters as lineSpacingFactor * [[textHeight]] of the [[TextBlock]].\n */\n public readonly lineSpacingFactor: number;\n /** Multiplier used to compute the vertical distance between two paragraphs of text.\n * The distance is computed in meters as paragraphSpacingFactor * the [[TextBlock]]'s [[textHeight]].\n */\n public readonly paragraphSpacingFactor: number;\n /** Specifies whether the content of a [[TextRun]] should be rendered **bold**. */\n public readonly isBold: boolean;\n /** Specifies whether the content of a [[TextRun]] should be rendered in *italics*. */\n public readonly isItalic: boolean;\n /** Specifies whether the content of a [[TextRun]] should be underlined. */\n public readonly isUnderlined: boolean;\n /** Multiplier used to compute the height of both the numerator and denominator of a [[FractionRun]].\n * The height is computed in meters as stackedFractionScale * [[textHeight]].\n */\n public readonly stackedFractionScale: number;\n /** Specifies how to separate the numerator and denominator of a [[FractionRun]]. */\n public readonly stackedFractionType: StackedFractionType;\n /** Multiplier used to compute the vertical offset from the baseline for a subscript [[TextRun]].\n * The offset is computed in meters as subScriptOffsetFactor * [[textHeight]].\n */\n public readonly subScriptOffsetFactor: number;\n /** Multiplier used to compute the height of a subscript [[TextRun]].\n * The height is computed as subScriptScale * [[textHeight]].\n */\n public readonly subScriptScale: number;\n /** Multiplier used to compute the vertical offset from the baseline for a super [[TextRun]].\n * The offset is computed in meters as superScriptOffsetFactor * [[textHeight]].\n */\n public readonly superScriptOffsetFactor: number;\n /** Multiplier used to compute the height of a superscript [[TextRun]].\n * The height is computed as superScriptScale * [[textHeight]].\n */\n public readonly superScriptScale: number;\n /** Multiplier used to compute the width of each glyph, relative to [[textHeight]]. */\n public readonly widthFactor: number;\n /** Properties describing appearance of leaders in a [[TextAnnotation]].\n * Used when producing geometry for [[TextAnnotation]].\n */\n public readonly leader: Readonly<Required<TextLeaderStyleProps>>;\n /** The size (in meters) used to calculate the tab stops in a run.\n * These are equally spaced from the left edge of the TextBlock.\n * [[tabInterval]] is also used in lists to compute the offset of each child or [[Paragraph]].\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n */\n public readonly tabInterval: number;\n /** The offset (in meters) from the left edge of the text block to the start of the line of text.\n * In lists, the indentation is added to offset of list items.\n * The [[listMarker]] is right justified on [[indentation]] + [[tabInterval]]*(depth - 1/2).\n * [[Paragraph]]s will start at [[indentation]] + [[tabInterval]]*depth.\n */\n public readonly indentation: number;\n /** The marker used to indicate the start of a list item.\n * Default: [[ListMarkerEnumerator.Number]].\n */\n public readonly listMarker: ListMarker;\n /** The frame settings of the [[TextAnnotation]]. */\n public readonly frame: Readonly<Required<TextFrameStyleProps>>;\n /** The margins to surround the document content. */\n public readonly margins: Readonly<Required<TextBlockMargins>>;\n /** The alignment of the text content. */\n public readonly justification: TextJustification;\n\n /** A fully-populated JSON representation of the default settings. A real `font` must be provided before use. */\n public static defaultProps: DeepReadonlyObject<DeepRequiredObject<TextStyleSettingsProps>> = {\n color: \"subcategory\",\n font: { name: \"\", type: FontType.TrueType },\n textHeight: 1,\n lineSpacingFactor: 0.5,\n paragraphSpacingFactor: 0.5,\n isBold: false,\n isItalic: false,\n isUnderlined: false,\n stackedFractionScale: 0.7,\n stackedFractionType: \"horizontal\",\n subScriptOffsetFactor: -0.15,\n subScriptScale: 2 / 3,\n superScriptOffsetFactor: 0.5,\n superScriptScale: 2 / 3,\n widthFactor: 1,\n leader: {\n color: \"inherit\",\n wantElbow: false,\n elbowLength: 1.0,\n terminatorShape: terminatorShapes[0],\n terminatorHeightFactor: 1.0,\n terminatorWidthFactor: 1.0,\n },\n tabInterval: 4,\n indentation: 0,\n listMarker: { enumerator: \"1\", terminator: \"period\", case: \"lower\" },\n frame: {\n shape: \"none\",\n fillColor: \"none\",\n borderColor: ColorDef.black.toJSON(),\n borderWeight: 1,\n },\n margins: {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n },\n justification: \"left\",\n };\n\n /** Settings initialized to all default values. */\n public static defaults: TextStyleSettings = new TextStyleSettings({});\n\n private constructor(props: TextStyleSettingsProps, defaults?: Required<TextStyleSettingsProps>) {\n if (!defaults) {\n defaults = TextStyleSettings.defaultProps;\n }\n\n this.color = props.color ?? defaults.color;\n const font = {\n name: props.font?.name ?? defaults.font.name,\n type: props.font?.type ?? defaults.font.type,\n }\n this.font = Object.freeze(font) as Readonly<Required<FontFamilySelector>>;\n this.textHeight = props.textHeight ?? defaults.textHeight;\n this.lineSpacingFactor = props.lineSpacingFactor ?? defaults.lineSpacingFactor;\n this.paragraphSpacingFactor = props.paragraphSpacingFactor ?? defaults.paragraphSpacingFactor;\n this.isBold = props.isBold ?? defaults.isBold;\n this.isItalic = props.isItalic ?? defaults.isItalic;\n this.isUnderlined = props.isUnderlined ?? defaults.isUnderlined;\n this.stackedFractionScale = props.stackedFractionScale ?? defaults.stackedFractionScale;\n this.stackedFractionType = props.stackedFractionType ?? defaults.stackedFractionType;\n this.subScriptOffsetFactor = props.subScriptOffsetFactor ?? defaults.subScriptOffsetFactor;\n this.subScriptScale = props.subScriptScale ?? defaults.subScriptScale;\n this.superScriptOffsetFactor = props.superScriptOffsetFactor ?? defaults.superScriptOffsetFactor;\n this.superScriptScale = props.superScriptScale ?? defaults.superScriptScale;\n this.widthFactor = props.widthFactor ?? defaults.widthFactor;\n const leader = {\n color: props.leader?.color ?? defaults.leader.color,\n wantElbow: props.leader?.wantElbow ?? defaults.leader.wantElbow,\n elbowLength: props.leader?.elbowLength ?? defaults.leader.elbowLength,\n terminatorShape: props.leader?.terminatorShape ?? defaults.leader.terminatorShape,\n terminatorHeightFactor: props.leader?.terminatorHeightFactor ?? defaults.leader.terminatorHeightFactor,\n terminatorWidthFactor: props.leader?.terminatorWidthFactor ?? defaults.leader.terminatorWidthFactor,\n }\n this.leader = Object.freeze(leader) as Readonly<Required<TextLeaderStyleProps>>;\n this.tabInterval = props.tabInterval ?? defaults.tabInterval;\n this.indentation = props.indentation ?? defaults.indentation;\n this.listMarker = props.listMarker ?? defaults.listMarker;\n const frame = {\n shape: props.frame?.shape ?? defaults.frame.shape,\n fillColor: props.frame?.fillColor ?? defaults.frame.fillColor,\n borderColor: props.frame?.borderColor ?? defaults.frame.borderColor,\n borderWeight: props.frame?.borderWeight ?? defaults.frame.borderWeight,\n };\n // Cast to indicate to TypeScript that the frame properties are all defined\n this.frame = Object.freeze(frame) as Readonly<Required<TextFrameStyleProps>>;\n this.margins = Object.freeze({\n left: props.margins?.left ?? defaults.margins.left,\n right: props.margins?.right ?? defaults.margins.right,\n top: props.margins?.top ?? defaults.margins.top,\n bottom: props.margins?.bottom ?? defaults.margins.bottom,\n }) as Readonly<Required<TextBlockMargins>>;\n this.justification = props.justification ?? defaults.justification;\n }\n\n /** Create a copy of these settings, modified according to the properties defined by `alteredProps`. */\n public clone(alteredProps?: TextStyleSettingsProps): TextStyleSettings {\n return alteredProps ? new TextStyleSettings(alteredProps, this) : this;\n }\n\n /** Create settings from their JSON representation. */\n public static fromJSON(props?: TextStyleSettingsProps): TextStyleSettings {\n return props ? new TextStyleSettings(props) : TextStyleSettings.defaults;\n }\n\n public toJSON(): TextStyleSettingsProps {\n return structuredClone(this);\n }\n\n /** Compare two [[TextLeaderStyleProps]] for equality.\n * @param other The other leader style properties to compare against.\n * @returns true if the two leader styles are equal, false otherwise.\n */\n public leaderEquals(other: TextLeaderStyleProps): boolean {\n return this.leader.color === other.color && this.leader.wantElbow === other.wantElbow\n && this.leader.elbowLength === other.elbowLength && this.leader.terminatorShape === other.terminatorShape && this.leader.terminatorHeightFactor === other.terminatorHeightFactor\n && this.leader.terminatorWidthFactor === other.terminatorWidthFactor;\n }\n\n public frameEquals(other: TextFrameStyleProps): boolean {\n return this.frame?.shape === other.shape\n && this.frame?.fillColor === other.fillColor\n && this.frame?.borderColor === other.borderColor\n && this.frame?.borderWeight === other.borderWeight;\n }\n\n public marginsEqual(other: TextBlockMargins): boolean {\n return Object.entries(this.margins).every(([key, value]) =>\n value === (other as any)[key]\n );\n }\n\n public equals(other: TextStyleSettings): boolean {\n return this.color === other.color && this.font.name === other.font.name && this.font.type === other.font.type\n && this.textHeight === other.textHeight && this.widthFactor === other.widthFactor\n && this.lineSpacingFactor === other.lineSpacingFactor && this.paragraphSpacingFactor === other.paragraphSpacingFactor\n && this.isBold === other.isBold && this.isItalic === other.isItalic && this.isUnderlined === other.isUnderlined\n && this.stackedFractionType === other.stackedFractionType && this.stackedFractionScale === other.stackedFractionScale\n && this.subScriptOffsetFactor === other.subScriptOffsetFactor && this.subScriptScale === other.subScriptScale\n && this.superScriptOffsetFactor === other.superScriptOffsetFactor && this.superScriptScale === other.superScriptScale\n && this.tabInterval === other.tabInterval && this.indentation === other.indentation\n && this.listMarker.case === other.listMarker.case && this.listMarker.enumerator === other.listMarker.enumerator && this.listMarker.terminator === other.listMarker.terminator\n && this.justification === other.justification\n && this.leaderEquals(other.leader)\n && this.frameEquals(other.frame)\n && this.marginsEqual(other.margins);\n }\n\n /**\n * Returns a list of validation errors for this instance.\n *\n * A TextStyleSettings object may contain values that are invalid in all contexts.\n * If this method returns any error strings, using the settings will likely result in rendering failures or runtime exceptions.\n *\n * This method only checks for universally invalid values. Additional domain-specific validation may be required depending on the context in which these settings are used.\n *\n * @returns An array of error strings describing the invalid values, or an empty array if the settings are valid.\n */\n public getValidationErrors(): string[] {\n const errorMessages: string[] = [];\n if (this.font.name.trim() === \"\") {\n errorMessages.push(\"font name must be provided\");\n }\n\n if (this.textHeight <= 0) {\n errorMessages.push(\"textHeight must be greater than 0\");\n }\n\n if (this.stackedFractionScale <= 0) {\n errorMessages.push(\"stackedFractionScale must be greater than 0\");\n }\n\n return errorMessages;\n }\n}\n\ndeepFreeze(TextStyleSettings.defaultProps);\ndeepFreeze(TextStyleSettings.defaults);"]}
|
|
@@ -43,4 +43,13 @@ export declare class GlbHeader extends TileHeader {
|
|
|
43
43
|
get isValid(): boolean;
|
|
44
44
|
constructor(stream: ByteStream);
|
|
45
45
|
}
|
|
46
|
+
/** @internal */
|
|
47
|
+
export declare class GltfHeader extends TileHeader {
|
|
48
|
+
readonly gltfLength: number;
|
|
49
|
+
readonly scenePosition: number;
|
|
50
|
+
readonly sceneStrLength: number;
|
|
51
|
+
readonly binaryPosition: number;
|
|
52
|
+
get isValid(): boolean;
|
|
53
|
+
constructor(stream: ByteStream);
|
|
54
|
+
}
|
|
46
55
|
//# sourceMappingURL=GltfTileIO.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,cAAc,IAAW;IACzB,gBAAgB,IAAI;CACrB;AAED,gBAAgB;AAChB,oBAAY,gBAAgB;IAC1B,IAAI,aAAa;IACjB,MAAM,UAAa;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAiB1D,gBAAgB;AAChB,qBAAa,SAAU,SAAQ,UAAU;IACvC,SAAgB,UAAU,EAAE,MAAM,CAAK;IACvC,SAAgB,SAAS,EAAE,SAAS,CAA4B;IAChE,SAAgB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxC,SAAgB,gBAAgB,EAAE,cAAc,EAAE,CAAM;IAExD,IAAW,OAAO,IAAI,OAAO,CAE5B;gBAEkB,MAAM,EAAE,UAAU;CAuEtC"}
|
|
1
|
+
{"version":3,"file":"GltfTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,cAAc,IAAW;IACzB,gBAAgB,IAAI;CACrB;AAED,gBAAgB;AAChB,oBAAY,gBAAgB;IAC1B,IAAI,aAAa;IACjB,MAAM,UAAa;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAiB1D,gBAAgB;AAChB,qBAAa,SAAU,SAAQ,UAAU;IACvC,SAAgB,UAAU,EAAE,MAAM,CAAK;IACvC,SAAgB,SAAS,EAAE,SAAS,CAA4B;IAChE,SAAgB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxC,SAAgB,gBAAgB,EAAE,cAAc,EAAE,CAAM;IAExD,IAAW,OAAO,IAAI,OAAO,CAE5B;gBAEkB,MAAM,EAAE,UAAU;CAuEtC;AAED,gBAAgB;AAChB,qBAAa,UAAW,SAAQ,UAAU;IACxC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,aAAa,EAAE,MAAM,CAAK;IAC1C,SAAgB,cAAc,EAAE,MAAM,CAAK;IAC3C,SAAgB,cAAc,EAAE,MAAM,CAAK;IAC3C,IAAW,OAAO,IAAI,OAAO,CAA4C;gBAEtD,MAAM,EAAE,UAAU;CAqCtC"}
|
|
@@ -106,4 +106,46 @@ export class GlbHeader extends TileHeader {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
+
/** @internal */
|
|
110
|
+
export class GltfHeader extends TileHeader {
|
|
111
|
+
gltfLength;
|
|
112
|
+
scenePosition = 0;
|
|
113
|
+
sceneStrLength = 0;
|
|
114
|
+
binaryPosition = 0;
|
|
115
|
+
get isValid() { return TileFormat.Gltf === this.format; }
|
|
116
|
+
constructor(stream) {
|
|
117
|
+
super(stream);
|
|
118
|
+
this.gltfLength = stream.readUint32();
|
|
119
|
+
this.sceneStrLength = stream.readUint32();
|
|
120
|
+
const value5 = stream.readUint32();
|
|
121
|
+
// Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles
|
|
122
|
+
// validating the chunk type.
|
|
123
|
+
if (this.version === GltfVersions.Version2 && value5 === GltfVersions.Gltf1SceneFormat)
|
|
124
|
+
this.version = GltfVersions.Version1;
|
|
125
|
+
if (this.version === GltfVersions.Version1) {
|
|
126
|
+
const gltfSceneFormat = value5;
|
|
127
|
+
if (GltfVersions.Gltf1SceneFormat !== gltfSceneFormat) {
|
|
128
|
+
this.invalidate();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.scenePosition = stream.curPos;
|
|
132
|
+
this.binaryPosition = stream.curPos + this.sceneStrLength;
|
|
133
|
+
}
|
|
134
|
+
else if (this.version === GltfVersions.Version2) {
|
|
135
|
+
const sceneChunkType = value5;
|
|
136
|
+
this.scenePosition = stream.curPos;
|
|
137
|
+
stream.curPos = stream.curPos + this.sceneStrLength;
|
|
138
|
+
const binaryLength = stream.readUint32();
|
|
139
|
+
const binaryChunkType = stream.readUint32();
|
|
140
|
+
if (GltfV2ChunkTypes.JSON !== sceneChunkType || GltfV2ChunkTypes.Binary !== binaryChunkType || 0 === binaryLength) {
|
|
141
|
+
this.invalidate();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this.binaryPosition = stream.curPos;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.invalidate();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
109
151
|
//# sourceMappingURL=GltfTileIO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD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nB,KAAK,gBAAgB,CAAC,IAAI;4BACxB,0DAA0D;4BAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;4BAClB,OAAO;wBACT,KAAK,gBAAgB,CAAC,MAAM;4BAC1B,2EAA2E;4BAC3E,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;gCACrD,IAAI,CAAC,UAAU,EAAE,CAAC;gCAClB,OAAO;4BACT,CAAC;4BAED,IAAI,CAAC,WAAW,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;4BAClE,MAAM;wBACR;4BACE,kEAAkE;4BAClE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BAClC,MAAM;oBACV,CAAC;gBACH,CAAC;gBAED,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;oBACpB,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,OAAO;gBACT,CAAC;gBAED,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;gBAC5B,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;QACV,CAAC;IACH,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 Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { TileFormat, TileHeader } from \"./TileIO\";\n\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\n * @internal\n */\nexport enum GltfVersions {\n Version1 = 1,\n Version2 = 2,\n CurrentVersion = Version1,\n Gltf1SceneFormat = 0,\n}\n\n/** @internal */\nexport enum GltfV2ChunkTypes {\n JSON = 0x4E4F534a,\n Binary = 0x004E4942,\n}\n\n/** A chunk of a glb file.\n * @internal\n */\nexport interface GltfChunk {\n /** Offset of the first byte of the chunk's data relative to the beginning of the glb data.\n * This excludes the 8-byte chunk header containing the length and type fields.\n */\n offset: number;\n /** The number of bytes in the chunk's data. */\n length: number;\n}\n\n/** Describes a glTF chunk's data along with its type.\n * @internal\n */\nexport type TypedGltfChunk = GltfChunk & { type: number };\n\nfunction consumeNextChunk(stream: ByteStream): TypedGltfChunk | undefined | false {\n if (stream.isAtTheEnd)\n return undefined;\n\n const offset = stream.curPos + 8;\n\n const length = stream.readUint32();\n if (stream.isAtTheEnd)\n return undefined;\n\n const type = stream.readUint32();\n stream.advance(length);\n return stream.isPastTheEnd ? false : { offset, length, type };\n}\n\n/** @internal */\nexport class GlbHeader extends TileHeader {\n public readonly gltfLength: number = 0;\n public readonly jsonChunk: GltfChunk = { offset: 0, length: 0 };\n public readonly binaryChunk?: GltfChunk;\n public readonly additionalChunks: TypedGltfChunk[] = [];\n\n public get isValid(): boolean {\n return TileFormat.Gltf === this.format;\n }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.gltfLength = stream.readUint32();\n\n const jsonLength = stream.readUint32();\n const word5 = stream.readUint32();\n\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\n // validating the chunk type.\n if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)\n this.version = GltfVersions.Version1;\n\n this.jsonChunk = { offset: stream.curPos, length: jsonLength };\n switch (this.version) {\n case GltfVersions.Version1:\n if (GltfVersions.Gltf1SceneFormat !== word5) {\n this.invalidate();\n return;\n }\n\n const binaryOffset = stream.curPos + jsonLength;\n this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };\n break;\n case GltfVersions.Version2:\n if (word5 !== GltfV2ChunkTypes.JSON) {\n this.invalidate();\n return;\n }\n\n stream.advance(jsonLength);\n if (stream.isPastTheEnd) {\n this.invalidate();\n return;\n }\n\n let chunk;\n while (chunk = consumeNextChunk(stream)) {\n switch (chunk.type) {\n case GltfV2ChunkTypes.JSON:\n // Only one JSON chunk permitted and it must be the first.\n this.invalidate();\n return;\n case GltfV2ChunkTypes.Binary:\n // At most one binary chunk permitted and it must be the second if present.\n if (this.binaryChunk || this.additionalChunks.length) {\n this.invalidate();\n return;\n }\n\n this.binaryChunk = { offset: chunk.offset, length: chunk.length };\n break;\n default:\n // Any other chunk type should be ignored - for use by extensions.\n this.additionalChunks.push(chunk);\n break;\n }\n }\n\n if (false === chunk) {\n this.invalidate();\n return;\n }\n\n assert(undefined === chunk);\n assert(stream.isAtTheEnd);\n break;\n default:\n this.invalidate();\n break;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEAAyB,CAAA;IACzB,uEAAoB,CAAA;AACtB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,gEAAiB,CAAA;IACjB,iEAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAmBD,SAAS,gBAAgB,CAAC,MAAkB;IAC1C,IAAI,MAAM,CAAC,UAAU;QACnB,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAEjC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACnC,IAAI,MA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nC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC;QAC5D,CAAC;aAAM,IAAI,IAAI,CAAC,OAAO,KAAK,YAAY,CAAC,QAAQ,EAAE,CAAC;YAClD,MAAM,cAAc,GAAG,MAAM,CAAC;YAC9B,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;YACnC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC;YACpD,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YAC5C,IAAI,gBAAgB,CAAC,IAAI,KAAK,cAAc,IAAI,gBAAgB,CAAC,MAAM,KAAK,eAAe,IAAI,CAAC,KAAK,YAAY,EAAE,CAAC;gBAClH,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC;IACH,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 Tile\n */\n\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\nimport { TileFormat, TileHeader } from \"./TileIO\";\n\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\n * @internal\n */\nexport enum GltfVersions {\n Version1 = 1,\n Version2 = 2,\n CurrentVersion = Version1,\n Gltf1SceneFormat = 0,\n}\n\n/** @internal */\nexport enum GltfV2ChunkTypes {\n JSON = 0x4E4F534a,\n Binary = 0x004E4942,\n}\n\n/** A chunk of a glb file.\n * @internal\n */\nexport interface GltfChunk {\n /** Offset of the first byte of the chunk's data relative to the beginning of the glb data.\n * This excludes the 8-byte chunk header containing the length and type fields.\n */\n offset: number;\n /** The number of bytes in the chunk's data. */\n length: number;\n}\n\n/** Describes a glTF chunk's data along with its type.\n * @internal\n */\nexport type TypedGltfChunk = GltfChunk & { type: number };\n\nfunction consumeNextChunk(stream: ByteStream): TypedGltfChunk | undefined | false {\n if (stream.isAtTheEnd)\n return undefined;\n\n const offset = stream.curPos + 8;\n\n const length = stream.readUint32();\n if (stream.isAtTheEnd)\n return undefined;\n\n const type = stream.readUint32();\n stream.advance(length);\n return stream.isPastTheEnd ? false : { offset, length, type };\n}\n\n/** @internal */\nexport class GlbHeader extends TileHeader {\n public readonly gltfLength: number = 0;\n public readonly jsonChunk: GltfChunk = { offset: 0, length: 0 };\n public readonly binaryChunk?: GltfChunk;\n public readonly additionalChunks: TypedGltfChunk[] = [];\n\n public get isValid(): boolean {\n return TileFormat.Gltf === this.format;\n }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.gltfLength = stream.readUint32();\n\n const jsonLength = stream.readUint32();\n const word5 = stream.readUint32();\n\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\n // validating the chunk type.\n if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)\n this.version = GltfVersions.Version1;\n\n this.jsonChunk = { offset: stream.curPos, length: jsonLength };\n switch (this.version) {\n case GltfVersions.Version1:\n if (GltfVersions.Gltf1SceneFormat !== word5) {\n this.invalidate();\n return;\n }\n\n const binaryOffset = stream.curPos + jsonLength;\n this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };\n break;\n case GltfVersions.Version2:\n if (word5 !== GltfV2ChunkTypes.JSON) {\n this.invalidate();\n return;\n }\n\n stream.advance(jsonLength);\n if (stream.isPastTheEnd) {\n this.invalidate();\n return;\n }\n\n let chunk;\n while (chunk = consumeNextChunk(stream)) {\n switch (chunk.type) {\n case GltfV2ChunkTypes.JSON:\n // Only one JSON chunk permitted and it must be the first.\n this.invalidate();\n return;\n case GltfV2ChunkTypes.Binary:\n // At most one binary chunk permitted and it must be the second if present.\n if (this.binaryChunk || this.additionalChunks.length) {\n this.invalidate();\n return;\n }\n\n this.binaryChunk = { offset: chunk.offset, length: chunk.length };\n break;\n default:\n // Any other chunk type should be ignored - for use by extensions.\n this.additionalChunks.push(chunk);\n break;\n }\n }\n\n if (false === chunk) {\n this.invalidate();\n return;\n }\n\n assert(undefined === chunk);\n assert(stream.isAtTheEnd);\n break;\n default:\n this.invalidate();\n break;\n }\n }\n}\n\n/** @internal */\nexport class GltfHeader extends TileHeader {\n public readonly gltfLength: number;\n public readonly scenePosition: number = 0;\n public readonly sceneStrLength: number = 0;\n public readonly binaryPosition: number = 0;\n public get isValid(): boolean { return TileFormat.Gltf === this.format; }\n\n public constructor(stream: ByteStream) {\n super(stream);\n this.gltfLength = stream.readUint32();\n\n this.sceneStrLength = stream.readUint32();\n const value5 = stream.readUint32();\n\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\n // validating the chunk type.\n if (this.version === GltfVersions.Version2 && value5 === GltfVersions.Gltf1SceneFormat)\n this.version = GltfVersions.Version1;\n\n if (this.version === GltfVersions.Version1) {\n const gltfSceneFormat = value5;\n if (GltfVersions.Gltf1SceneFormat !== gltfSceneFormat) {\n this.invalidate();\n return;\n }\n\n this.scenePosition = stream.curPos;\n this.binaryPosition = stream.curPos + this.sceneStrLength;\n } else if (this.version === GltfVersions.Version2) {\n const sceneChunkType = value5;\n this.scenePosition = stream.curPos;\n stream.curPos = stream.curPos + this.sceneStrLength;\n const binaryLength = stream.readUint32();\n const binaryChunkType = stream.readUint32();\n if (GltfV2ChunkTypes.JSON !== sceneChunkType || GltfV2ChunkTypes.Binary !== binaryChunkType || 0 === binaryLength) {\n this.invalidate();\n return;\n }\n\n this.binaryPosition = stream.curPos;\n } else {\n this.invalidate();\n }\n }\n}\n\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-common",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0-dev.3",
|
|
4
4
|
"description": "iTwin.js components common to frontend and backend",
|
|
5
5
|
"main": "lib/cjs/core-common.js",
|
|
6
6
|
"module": "lib/esm/core-common.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"js-base64": "^3.6.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@itwin/core-bentley": "5.
|
|
31
|
-
"@itwin/core-geometry": "5.
|
|
30
|
+
"@itwin/core-bentley": "5.4.0-dev.3",
|
|
31
|
+
"@itwin/core-geometry": "5.4.0-dev.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@itwin/eslint-plugin": "5.2.2-dev.2",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
43
|
"typescript": "~5.6.2",
|
|
44
44
|
"vitest": "^3.0.6",
|
|
45
|
-
"@itwin/core-bentley": "5.
|
|
46
|
-
"@itwin/build-tools": "5.
|
|
47
|
-
"@itwin/core-geometry": "5.
|
|
45
|
+
"@itwin/core-bentley": "5.4.0-dev.3",
|
|
46
|
+
"@itwin/build-tools": "5.4.0-dev.3",
|
|
47
|
+
"@itwin/core-geometry": "5.4.0-dev.3"
|
|
48
48
|
},
|
|
49
49
|
"nyc": {
|
|
50
50
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|