@itwin/core-common 4.4.0-dev.2 → 4.4.0-dev.21
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/IModel.d.ts +10 -2
- package/lib/cjs/IModel.d.ts.map +1 -1
- package/lib/cjs/IModel.js +28 -9
- package/lib/cjs/IModel.js.map +1 -1
- package/lib/cjs/MaterialProps.d.ts +18 -0
- package/lib/cjs/MaterialProps.d.ts.map +1 -1
- package/lib/cjs/MaterialProps.js.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.d.ts +5 -3
- package/lib/cjs/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/cjs/geometry/ElementGeometry.js +37 -1
- package/lib/cjs/geometry/ElementGeometry.js.map +1 -1
- package/lib/cjs/geometry/TextString.d.ts +10 -1
- package/lib/cjs/geometry/TextString.d.ts.map +1 -1
- package/lib/cjs/geometry/TextString.js.map +1 -1
- package/lib/cjs/rpc/core/RpcInvocation.js +2 -2
- package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.d.ts +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.d.ts.map +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.js +1 -1
- package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/cjs/rpc/core/RpcProtocol.js +2 -2
- package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
- package/lib/cjs/tile/IModelTileIO.js +2 -2
- package/lib/cjs/tile/IModelTileIO.js.map +1 -1
- package/lib/esm/IModel.d.ts +10 -2
- package/lib/esm/IModel.d.ts.map +1 -1
- package/lib/esm/IModel.js +28 -9
- package/lib/esm/IModel.js.map +1 -1
- package/lib/esm/MaterialProps.d.ts +18 -0
- package/lib/esm/MaterialProps.d.ts.map +1 -1
- package/lib/esm/MaterialProps.js.map +1 -1
- package/lib/esm/geometry/ElementGeometry.d.ts +5 -3
- package/lib/esm/geometry/ElementGeometry.d.ts.map +1 -1
- package/lib/esm/geometry/ElementGeometry.js +38 -2
- package/lib/esm/geometry/ElementGeometry.js.map +1 -1
- package/lib/esm/geometry/TextString.d.ts +10 -1
- package/lib/esm/geometry/TextString.d.ts.map +1 -1
- package/lib/esm/geometry/TextString.js.map +1 -1
- package/lib/esm/rpc/core/RpcInvocation.js +2 -2
- package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.d.ts +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.d.ts.map +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.js +1 -1
- package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
- package/lib/esm/rpc/core/RpcProtocol.js +2 -2
- package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
- package/lib/esm/tile/IModelTileIO.d.ts +2 -2
- package/lib/esm/tile/IModelTileIO.js +2 -2
- package/lib/esm/tile/IModelTileIO.js.map +1 -1
- package/package.json +9 -9
|
@@ -778,8 +778,28 @@ var ElementGeometry;
|
|
|
778
778
|
return textString.toJSON();
|
|
779
779
|
}
|
|
780
780
|
ElementGeometry.toTextString = toTextString;
|
|
781
|
+
/** Returns only the [[TextStringGlyphData]] embedded in the [[TextString]] flatbuffer. This data is only internal to the native display libaries. */
|
|
782
|
+
function toTextStringGlyphData(entry) {
|
|
783
|
+
if (ElementGeometryOpcode.TextString !== entry.opcode)
|
|
784
|
+
return undefined;
|
|
785
|
+
const buffer = new flatbuffers_1.flatbuffers.ByteBuffer(entry.data);
|
|
786
|
+
const ppfb = ElementGeometryFB_1.EGFBAccessors.TextString.getRootAsTextString(buffer);
|
|
787
|
+
const glyphOriginToPoint2d = (origin) => {
|
|
788
|
+
if (!origin)
|
|
789
|
+
throw new Error("Value cannot be null.");
|
|
790
|
+
return new core_geometry_1.Point2d(origin.x(), origin.y());
|
|
791
|
+
};
|
|
792
|
+
const textStringRangeToRange2d = (r) => r ? new core_geometry_1.Range2d(r.lowx(), r.lowy(), r.highx(), r.highy()) : null;
|
|
793
|
+
const range = textStringRangeToRange2d(ppfb.range());
|
|
794
|
+
const glyphIds = Array.from({ length: ppfb.glyphIdsLength() }, (_, i) => ppfb.glyphIds(i) ?? 0);
|
|
795
|
+
const glyphOrigins = Array.from({ length: ppfb.glyphOriginsLength() }, (_, i) => glyphOriginToPoint2d(ppfb.glyphOrigins(i)));
|
|
796
|
+
if (!range || range.isNull || glyphIds.length === 0 || glyphOrigins.length === 0)
|
|
797
|
+
return undefined;
|
|
798
|
+
return { glyphIds, glyphOrigins, range };
|
|
799
|
+
}
|
|
800
|
+
ElementGeometry.toTextStringGlyphData = toTextStringGlyphData;
|
|
781
801
|
/** Create entry from a [[TextString]] */
|
|
782
|
-
function fromTextString(text, worldToLocal) {
|
|
802
|
+
function fromTextString(text, worldToLocal, glyphs) {
|
|
783
803
|
if (undefined !== worldToLocal) {
|
|
784
804
|
const localText = new TextString_1.TextString(text);
|
|
785
805
|
if (!localText.transformInPlace(worldToLocal))
|
|
@@ -790,6 +810,17 @@ var ElementGeometry;
|
|
|
790
810
|
const builder = ElementGeometryFB_1.EGFBAccessors.TextString;
|
|
791
811
|
const textOffset = fbb.createString(text.text);
|
|
792
812
|
const styleOffset = ElementGeometryFB_1.EGFBAccessors.TextStringStyle.createTextStringStyle(fbb, 1, 0, text.font, undefined === text.bold ? false : text.bold, undefined === text.italic ? false : text.italic, undefined === text.underline ? false : text.underline, text.height, undefined === text.widthFactor ? 1.0 : text.widthFactor);
|
|
813
|
+
const fbbGlyphs = (() => {
|
|
814
|
+
if (!glyphs || glyphs.range.isNull)
|
|
815
|
+
return undefined;
|
|
816
|
+
const glyphIdsOffset = builder.createGlyphIdsVector(fbb, glyphs.glyphIds);
|
|
817
|
+
builder.startGlyphOriginsVector(fbb, glyphs.glyphOrigins.length);
|
|
818
|
+
for (const origin of [...glyphs.glyphOrigins].reverse()) {
|
|
819
|
+
ElementGeometryFB_1.EGFBAccessors.TextStringGlyphOrigin.createTextStringGlyphOrigin(fbb, origin.x, origin.y);
|
|
820
|
+
}
|
|
821
|
+
const glyphOriginsOffset = fbb.endVector();
|
|
822
|
+
return { glyphIdsOffset, glyphOriginsOffset, range: glyphs.range };
|
|
823
|
+
})();
|
|
793
824
|
builder.startTextString(fbb);
|
|
794
825
|
builder.addMajorVersion(fbb, 1);
|
|
795
826
|
builder.addMinorVersion(fbb, 0);
|
|
@@ -803,6 +834,11 @@ var ElementGeometry;
|
|
|
803
834
|
const transformOffset = ElementGeometryFB_1.EGFBAccessors.TextStringTransform.createTextStringTransform(fbb, coffs[0], coffs[1], coffs[2], origin.x, coffs[3], coffs[4], coffs[5], origin.y, coffs[6], coffs[7], coffs[8], origin.z);
|
|
804
835
|
builder.addTransform(fbb, transformOffset);
|
|
805
836
|
}
|
|
837
|
+
if (fbbGlyphs) {
|
|
838
|
+
builder.addRange(fbb, ElementGeometryFB_1.EGFBAccessors.TextStringRange.createTextStringRange(fbb, fbbGlyphs.range.low.x, fbbGlyphs.range.low.y, fbbGlyphs.range.high.x, fbbGlyphs.range.high.y));
|
|
839
|
+
builder.addGlyphIds(fbb, fbbGlyphs.glyphIdsOffset);
|
|
840
|
+
builder.addGlyphOrigins(fbb, fbbGlyphs.glyphOriginsOffset);
|
|
841
|
+
}
|
|
806
842
|
const mLoc = builder.endTextString(fbb);
|
|
807
843
|
fbb.finish(mLoc);
|
|
808
844
|
const data = fbb.asUint8Array();
|