@itwin/core-common 5.3.0-dev.8 → 5.4.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 +21 -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/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/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/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 +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
# Change Log - @itwin/core-common
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 24 Oct 2025 16:22:31 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 5.2.4
|
|
6
|
+
Fri, 24 Oct 2025 16:20:38 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 5.2.3
|
|
11
|
+
Thu, 16 Oct 2025 23:00:31 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 5.2.2
|
|
16
|
+
Fri, 10 Oct 2025 14:49:15 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 5.2.1
|
|
21
|
+
Thu, 09 Oct 2025 17:10:26 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
4
24
|
|
|
5
25
|
## 5.2.0
|
|
6
26
|
Wed, 01 Oct 2025 20:22:54 GMT
|
|
@@ -40,8 +40,10 @@ export interface FieldPropertyPath {
|
|
|
40
40
|
accessors?: Array<string | number>;
|
|
41
41
|
}
|
|
42
42
|
/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.
|
|
43
|
-
* A field property is always hosted by an [Element]($backend). It may
|
|
44
|
-
*
|
|
43
|
+
* A field property is always hosted by an [Element]($backend). It may refer to a property belonging to any of the following:
|
|
44
|
+
* - The element's BIS class itself;
|
|
45
|
+
* - One of the element's [ElementAspect]($backend)s;
|
|
46
|
+
* - Or an [EC view]($docs/learning/ECSqlReference/Views.md) with the same ECInstanceId as the element.
|
|
45
47
|
* The [[schemaName]] and [[className]] should always identify the exact class that contains [[FieldPropertyPath.propertyName]] - not a subclass thereof.
|
|
46
48
|
* @beta
|
|
47
49
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3H;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,kHAAkH;IAClH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACpC;AAED
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3H;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,kHAAkH;IAClH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,SAAS,EAAE,UAAU,CAAC;IACtB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,CAAC;IACnB,6HAA6H;IAC7H,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,4BAA4B,CAAC;IAC3C,mDAAmD;IACnD,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,0BAA0B,CAAC;CACvC"}
|
|
@@ -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"]}
|
|
@@ -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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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"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module Tile
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.GlbHeader = exports.GltfV2ChunkTypes = exports.GltfVersions = void 0;
|
|
10
|
+
exports.GltfHeader = exports.GlbHeader = exports.GltfV2ChunkTypes = exports.GltfVersions = void 0;
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
12
|
const TileIO_1 = require("./TileIO");
|
|
13
13
|
/** Known version of the [glTF format](https://www.khronos.org/gltf/).
|
|
@@ -110,4 +110,47 @@ class GlbHeader extends TileIO_1.TileHeader {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
exports.GlbHeader = GlbHeader;
|
|
113
|
+
/** @internal */
|
|
114
|
+
class GltfHeader extends TileIO_1.TileHeader {
|
|
115
|
+
gltfLength;
|
|
116
|
+
scenePosition = 0;
|
|
117
|
+
sceneStrLength = 0;
|
|
118
|
+
binaryPosition = 0;
|
|
119
|
+
get isValid() { return TileIO_1.TileFormat.Gltf === this.format; }
|
|
120
|
+
constructor(stream) {
|
|
121
|
+
super(stream);
|
|
122
|
+
this.gltfLength = stream.readUint32();
|
|
123
|
+
this.sceneStrLength = stream.readUint32();
|
|
124
|
+
const value5 = stream.readUint32();
|
|
125
|
+
// Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles
|
|
126
|
+
// validating the chunk type.
|
|
127
|
+
if (this.version === GltfVersions.Version2 && value5 === GltfVersions.Gltf1SceneFormat)
|
|
128
|
+
this.version = GltfVersions.Version1;
|
|
129
|
+
if (this.version === GltfVersions.Version1) {
|
|
130
|
+
const gltfSceneFormat = value5;
|
|
131
|
+
if (GltfVersions.Gltf1SceneFormat !== gltfSceneFormat) {
|
|
132
|
+
this.invalidate();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.scenePosition = stream.curPos;
|
|
136
|
+
this.binaryPosition = stream.curPos + this.sceneStrLength;
|
|
137
|
+
}
|
|
138
|
+
else if (this.version === GltfVersions.Version2) {
|
|
139
|
+
const sceneChunkType = value5;
|
|
140
|
+
this.scenePosition = stream.curPos;
|
|
141
|
+
stream.curPos = stream.curPos + this.sceneStrLength;
|
|
142
|
+
const binaryLength = stream.readUint32();
|
|
143
|
+
const binaryChunkType = stream.readUint32();
|
|
144
|
+
if (GltfV2ChunkTypes.JSON !== sceneChunkType || GltfV2ChunkTypes.Binary !== binaryChunkType || 0 === binaryLength) {
|
|
145
|
+
this.invalidate();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
this.binaryPosition = stream.curPos;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
this.invalidate();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.GltfHeader = GltfHeader;
|
|
113
156
|
//# 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,sDAAyD;AACzD,qCAAkD;AAElD;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YA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C,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,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;gBAC5B,IAAA,qBAAM,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;QACV,CAAC;IACH,CAAC;CACF;AAjFD,8BAiFC","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,sDAAyD;AACzD,qCAAkD;AAElD;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEAAyB,CAAA;IACzB,uEAAoB,CAAA;AACtB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,gBAAgB;AAChB,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,gEAAiB,CAAA;IACjB,iEAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,gCAAhB,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,MAAM,CAAC,UAAU;QACnB,OAAO,SAAS,CAAC;IAEnB,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACjC,MAAM,CAAC,OAAO,CAAC,MAAM,CAA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,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;AA5CD,gCA4CC","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"]}
|
|
@@ -40,8 +40,10 @@ export interface FieldPropertyPath {
|
|
|
40
40
|
accessors?: Array<string | number>;
|
|
41
41
|
}
|
|
42
42
|
/** Describes the source of the property value against which a [[FieldPropertyPath]] is evaluated.
|
|
43
|
-
* A field property is always hosted by an [Element]($backend). It may
|
|
44
|
-
*
|
|
43
|
+
* A field property is always hosted by an [Element]($backend). It may refer to a property belonging to any of the following:
|
|
44
|
+
* - The element's BIS class itself;
|
|
45
|
+
* - One of the element's [ElementAspect]($backend)s;
|
|
46
|
+
* - Or an [EC view]($docs/learning/ECSqlReference/Views.md) with the same ECInstanceId as the element.
|
|
45
47
|
* The [[schemaName]] and [[className]] should always identify the exact class that contains [[FieldPropertyPath.propertyName]] - not a subclass thereof.
|
|
46
48
|
* @beta
|
|
47
49
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3H;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,kHAAkH;IAClH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACpC;AAED
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/annotation/TextField.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3H;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,qGAAqG;IACrG,YAAY,EAAE,MAAM,CAAC;IACrB,kHAAkH;IAClH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,SAAS,EAAE,UAAU,CAAC;IACtB,+EAA+E;IAC/E,UAAU,EAAE,MAAM,CAAC;IACnB,6HAA6H;IAC7H,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,4BAA4B,CAAC;IAC3C,mDAAmD;IACnD,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,0BAA0B,CAAC;CACvC"}
|
|
@@ -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"]}
|
|
@@ -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,g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ACxC,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;;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,MAAM,CAAC,UAAU;QACnB,OAAO,SAAS,CAAC;IAEnB,MAAM,IAAI,GA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AAC;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;AACz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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.2",
|
|
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,12 +27,12 @@
|
|
|
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.2",
|
|
31
|
+
"@itwin/core-geometry": "5.4.0-dev.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@itwin/eslint-plugin": "5.2.2-dev.2",
|
|
35
|
-
"@itwin/object-storage-core": "^
|
|
35
|
+
"@itwin/object-storage-core": "^3.0.4",
|
|
36
36
|
"@types/chai": "4.3.1",
|
|
37
37
|
"@types/flatbuffers": "~1.10.0",
|
|
38
38
|
"@types/node": "~20.17.0",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
43
|
"typescript": "~5.6.2",
|
|
44
44
|
"vitest": "^3.0.6",
|
|
45
|
-
"@itwin/
|
|
46
|
-
"@itwin/
|
|
47
|
-
"@itwin/core-
|
|
45
|
+
"@itwin/core-bentley": "5.4.0-dev.2",
|
|
46
|
+
"@itwin/build-tools": "5.4.0-dev.2",
|
|
47
|
+
"@itwin/core-geometry": "5.4.0-dev.2"
|
|
48
48
|
},
|
|
49
49
|
"nyc": {
|
|
50
50
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|