@itwin/core-geometry 5.1.0-dev.57 → 5.1.0-dev.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js +4 -0
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +2 -3
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +2 -4
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +5 -5
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js +4 -0
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +2 -3
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +2 -4
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +5 -5
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedPolyfaceWalker.d.ts","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,sBAAs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332
|
static buildEdgeMateIndices(polyface) {
|
|
333
|
+
if (polyface.isEmpty) {
|
|
334
|
+
polyface.data.edgeMateIndex = undefined;
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
333
337
|
const matcher = new IndexedEdgeMatcher_1.IndexedEdgeMatcher();
|
|
334
338
|
const numFacet = polyface.facetCount;
|
|
335
339
|
for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IndexedPolyfaceWalker.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6DAA+E;AAI/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAa,qBAAqB;IAChC,oCAAoC;IAC5B,SAAS,CAAkB;IACnC,+CAA+C;IACvC,UAAU,CAAqB;IACvC,kBAAkB;IAClB,YAAoB,QAAyB,EAAE,SAA6B;QAC1E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD;;;;OAIG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,0CAA0C;IAC1C,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD;;;OAGG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC;IACvC,CAAC;IACD;;;;;;OAMG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC;IACvC,CAAC;IACD,yEAAyE;IACzE,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,UA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YAC1C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;YAC/F,KAAK,MAAM,QAAQ,IAAI,WAAW,EAAE,CAAC;gBACnC,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC;gBACtC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC,+BAA+B;YACrF,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAxSD,sDAwSC","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\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { IndexedEdgeMatcher, SortableEdgeCluster } from \"./IndexedEdgeMatcher\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { IndexedPolyface } from \"./Polyface\";\n\n/**\n * The `IndexedPolyfaceWalker` class supports navigation around facets, across edges, and around vertices in an\n * [[IndexedPolyface]].\n * * Compare to the [[IndexedPolyfaceVisitor]] class, which supports the iteration of facets in an `IndexedPolyface`.\n * * A one-time call to [[buildEdgeMateIndices]] creates and populates the `data.edgeMateIndex` array on the input.\n * * This array essentially completes the topology of the `IndexedPolyface` by storing facet adjacency.\n * * After this setup, caller code can create `IndexedPolyfaceWalker` objects via:\n * * `walker = IndexedPolyfaceWalker.createAtFacetIndex(polyface, facetIndex, offsetWithinFacet)`\n * * `walker = IndexedPolyfaceWalker.createAtEdgeIndex(polyface, edgeIndex)`\n * * `walker = IndexedPolyfaceWalker.createAtVisitor(visitor, offsetWithinFacet)`\n * * Once you have a walker object, you can traverse the facet, edge, and vertex loops it references. For\n * example, if `walker.edgeIndex === A`, referring to the right edge of the upper left facet pictured below, then\n * the following are true:\n * * `walker.nextAroundFacet().edgeIndex === B`\n * * `walker.previousAroundFacet().edgeIndex === C`\n * * `walker.edgeMate().edgeIndex === F`\n * * `walker.nextAroundVertex().edgeIndex === E`\n * * `walker.previousAroundVertex().edgeIndex === D`\n* ```\n * # --------- # --------- #\n * | < < < B | F |\n * | ^ | v |\n * | ^ | v |\n * | ^ | v |\n * | C > > > A | D > > > |\n * # --------- # --------- #\n * | < < < E | |\n * | | |\n * | | |\n * | | |\n * # --------- # --------- #\n * ```\n* * When facets are viewed so that the face loops stored in the [[PolyfaceData]] `pointIndex` array have\n * counterclockwise ordering, an edge \"from A to B\" has facet area to the left and the edge to the right. Likewise,\n * the edges \"out of\" locations B, C, E, F, D are directed as depicted above.\n * * With this conventional counterclockwise ordering of face loops, \"next\" is counterclockwise, and \"previous\" is\n * clockwise:\n * * The [[nextAroundFacet]] step is counterclockwise around the facet.\n * * The [[previousAroundFacet]] step is clockwise around the facet.\n * * The [[nextAroundVertex]] step is counterclockwise around the vertex.\n * * The [[previousAroundVertex]] step is clockwise around the vertex.\n * * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,\n * when that edge is interior. Thus the `edgeMate` step can be seen to iterate an \"edge loop\" of two locations for an\n * interior edge.\n * * Invalid Walkers:\n * * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]\n * returns false. Traversal operations on an invalid walker return an invalid walker.\n * * Invalid walkers are expected during traversals of a mesh with boundary edges, so calling code must be prepared.\n * Boundary edges have exactly one adjacent facet, so for these edges the `edgeMate` step returns an invalid walker.\n * In the diagram above, the `edgeMate` of boundary edge B is undefined.\n * * Invalid walkers can occur while traversing boundary vertices as well. If an edge lacks an `edgeMate`, then the\n * `previousAroundVertex` step yields an invalid walker, because `previousAroundVertex` is implemented as `edgeMate`\n * followed by `nextAroundFacet`. In the diagram above, the `previousAroundVertex` step at boundary edge B yields\n * undefined walker. Similarly, the `nextAroundVertex` step at edge F yields undefined walker.\n * * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than\n * two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and\n * usually indicate a construction problem.\n * * Note that a null edge, for which the start and end vertex is the same, does not yield an invalid walker.\n * * See [[buildEdgeMateIndices]] for further description of the topological relations.\n * @public\n */\nexport class IndexedPolyfaceWalker {\n /** The polyface being traversed. */\n private _polyface: IndexedPolyface;\n /** The current edgeIndex into the polyface. */\n private _edgeIndex: number | undefined;\n /** Constructor */\n private constructor(polyface: IndexedPolyface, edgeIndex: number | undefined) {\n this._polyface = polyface;\n this._edgeIndex = edgeIndex;\n }\n /**\n * Return the edge index of this walker.\n * * This is an index into the polyface's `data.pointIndex` array.\n * * Can be undefined.\n */\n public get edgeIndex(): number | undefined {\n return this._edgeIndex;\n }\n\n /** Return the polyface of this walker. */\n public get polyface(): IndexedPolyface {\n return this._polyface;\n }\n /**\n * Return true if the walker's edgeIndex is defined.\n * * This method is the opposite of [[isUndefined]].\n */\n public get isValid(): boolean {\n return this._edgeIndex !== undefined;\n }\n /**\n * Return true if the walker's edgeIndex is undefined.\n * * This method is the opposite of [[isValid]].\n * * This can happen during a walk when the walker `w` reaches an exterior edge, for then\n * `w.edgeMate(w).isUndefined === true`.\n * * This can also happen when methods that return a walker receive invalid input.\n */\n public get isUndefined(): boolean {\n return this._edgeIndex === undefined;\n }\n /** Whether the walker is at a null edge, i.e. an edge with no length. */\n public get isNull(): boolean {\n return this.isValid && this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex) === this._edgeIndex;\n }\n /**\n * Create a walker for a given polyface at an optional edge.\n * @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).\n * @param edgeIndex optional indication of where to start the walker within the mesh.\n * * If the edgeIndex is valid for the input polyface, the new walker is started there.\n * * If the edgeIndex is undefined or invalid for the input polyface, the walker returns true for [[isUndefined]].\n */\n public static createAtEdgeIndex(polyface: IndexedPolyface, edgeIndex?: number): IndexedPolyfaceWalker {\n if (!polyface.data.isValidEdgeIndex(edgeIndex))\n edgeIndex = undefined;\n return new IndexedPolyfaceWalker(polyface, edgeIndex);\n }\n /**\n * Create a walker for a given polyface at a specified facet.\n * * If `facetIndex` or `offsetWithinFacet` is invalid for the input polyface, the walker returns true for\n * [[isUndefined]].\n * @param polyface the polyface to reference\n * @param facetIndex index of the facet to reference\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtFacetIndex(polyface: IndexedPolyface, facetIndex: number, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n if (polyface.isValidFacetIndex(facetIndex)) {\n const k0 = polyface.facetIndex0(facetIndex);\n const k1 = polyface.facetIndex1(facetIndex);\n if (0 <= offsetWithinFacet && k0 + offsetWithinFacet < k1)\n return new IndexedPolyfaceWalker(polyface, k0 + offsetWithinFacet);\n }\n return new IndexedPolyfaceWalker(polyface, undefined);\n }\n /**\n * Create a walker at the facet specified by a visitor.\n * @param visitor visitor whose currentReadIndex identifies the facet.\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n const facetIndex = visitor.currentReadIndex();\n return IndexedPolyfaceWalker.createAtFacetIndex(visitor.clientPolyface(), facetIndex, offsetWithinFacet);\n }\n /**\n * Create a new IndexedPolyfaceWalker from the instance.\n * * The returned walker refers to the same polyface and edge as the instance.\n * @param result optional receiver to modify and return.\n */\n public clone(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n if (result) {\n result._polyface = this._polyface;\n result._edgeIndex = this._edgeIndex;\n return result;\n }\n return new IndexedPolyfaceWalker(this._polyface, this._edgeIndex);\n }\n /**\n * Load the walker's facet into the given visitor.\n * @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.\n */\n public loadVisitor(visitor: IndexedPolyfaceVisitor): boolean {\n if (visitor.clientPolyface() !== this._polyface)\n return false;\n const facetIndex = this._polyface.edgeIndexToFacetIndex(this._edgeIndex);\n return (facetIndex !== undefined) ? visitor.moveToReadIndex(facetIndex) : false;\n }\n /**\n * Test if two walkers are at different edges in the same polyface.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return false.\n * * Otherwise return true.\n */\n public isDifferentEdgeInSamePolyface(other: IndexedPolyfaceWalker): boolean {\n if (this.isUndefined || other.isUndefined)\n return false;\n return this._polyface === other._polyface && this._edgeIndex !== other.edgeIndex;\n }\n /**\n * Test if two walkers are in the same polyface at the same edge.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return true.\n */\n public isSameEdge(other: IndexedPolyfaceWalker): boolean {\n return this._polyface === other._polyface && this.isValid && this._edgeIndex === other._edgeIndex;\n }\n\n /**\n * Return a walker with given edgeIndex and polyface from the calling instance.\n * * If `result` is supplied, that walker is filled and returned.\n * * If `result` is not supplied, a new walker is created.\n */\n private createResult(result: undefined | IndexedPolyfaceWalker, edgeIndex: undefined | number): IndexedPolyfaceWalker {\n if (result === undefined)\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n result._polyface = this._polyface;\n result._edgeIndex = edgeIndex;\n return result;\n }\n /**\n * Return a walker (new or reused) at the next edge around the facet.\n * * \"Next\" is in the order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k2 = this._polyface.facetIndex1(facetIndex);\n const k1 = k + 1;\n if (k1 < k2)\n return this.createResult(result, k1);\n return this.createResult(result, this._polyface.facetIndex0(facetIndex));\n }\n /**\n * Return a walker (new or reused) at the previous edge around the facet.\n * * \"Previous\" is in the reverse order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n let k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k0 = this._polyface.facetIndex0(facetIndex);\n if (k === k0)\n k = this._polyface.facetIndex1(facetIndex) - 1;\n else\n k--;\n return this.createResult(result, k);\n }\n /**\n * Return a walker (new or reused) at the edge mate of this walker's edge.\n * * The returned walker has undefined edgeIndex if:\n * * the instance is at a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public edgeMate(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n return this.createResult(result, this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex));\n }\n /**\n * Return a walker (new or reused) at the next outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"next\"\n * outbound edge is counterclockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the previous edge around the facet is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.previousAroundFacet(result);\n return result1.edgeMate(result1);\n }\n /**\n * Return a walker (new or reused) at the previous outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"previous\"\n * outbound edge is clockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the instance edge is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.edgeMate(result);\n return result1.nextAroundFacet(result1);\n }\n\n /**\n * Build the edgeMate index array into the polyface's [[PolyfaceData]].\n * After this method:\n * * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.\n * * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edge index on the other side of the\n * edge in the adjacent facet.\n * * The conditions for edgeMate matching are:\n * * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.\n * * Every edge index k in the face loop of facet f satisfies `k0 <= k < k1`.\n * * The edge with edge index k starts at the point with index `polyface.data.pointIndex[k]`.\n * * Let kA be an edge index in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,\n * `kB === (kA + 1 === k1) ? k0 : kA + 1`.\n * * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the\n * start and end of an edge of that facet.\n * * We call kA the _edge index_ for that edge, and kB the _edge index_ for the next edge around the facet.\n * * If kA is a positive-length interior edge in a 2-manifold mesh with properly oriented facets, then there is\n * an adjacent facet whose face loop contains edge indices kC and kD referencing the same edge vertices in reverse\n * order, i.e.,\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\n * * We call the edge indices kA and kC _edge mates_, denoted in the `edgeMateIndex` array by:\n * * `polyface.data.edgeMateIndex[kA] === kC`\n * * `polyface.data.edgeMateIndex[kC] === kA`\n * * If kA is zero-length interior edge, i.e, it has the same start and end point indices, then we call it a _null\n * edge_, and its edge mate is itself.\n * * A non-interior edge either lies on the boundary of the mesh, or is non-manifold (having more than 2 adjacent\n * facets, or 1 with the wrong orientation). These edges have no edge mate, represented as `undefined` in\n * the `edgeMateIndex` array.\n * * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with\n * opposite orientation in an adjacent facet.\n * * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by\n * walking across edges, around faces, and around vertices. Let walkerA have edge index value kA. Then with the\n * aforementioned edge indices:\n * * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.\n * * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.\n * * `walkerB.previousAroundFacet()` moves from kB back to kA.\n * * `walkerD = walkerA.previousAroundVertex()` moves around the vertex to the next edge kD.\n * * `walkerD1 = walkerC.nextAroundFacet()` also moves to kD.\n * * `walkerD.nextAroundVertex()` moves from kD back to kA.\n */\n public static buildEdgeMateIndices(polyface: IndexedPolyface): void {\n const matcher = new IndexedEdgeMatcher();\n const numFacet = polyface.facetCount;\n for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {\n const kStart = polyface.facetIndex0(facetIndex);\n const kEnd = polyface.facetIndex1(facetIndex);\n let k0 = kEnd - 1;\n // sneaky: addEdge 3rd arg is edge index k0 instead of facetIndex; it gets carried around during matching\n for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)\n matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);\n }\n const matchedPairs: SortableEdgeCluster[] = [];\n const nullEdges: SortableEdgeCluster[] = [];\n matcher.sortAndCollectClusters(matchedPairs, undefined, nullEdges, undefined);\n const numIndex = polyface.data.pointIndex.length;\n polyface.data.edgeMateIndex = new Array<number | undefined>(numIndex);\n for (let i = 0; i < numIndex; i++)\n polyface.data.edgeMateIndex[i] = undefined; // boundary and non-manifold edges have no mate\n for (const pair of matchedPairs) {\n if (Array.isArray(pair) && pair.length === 2) {\n const edgeIndex0 = pair[0].facetIndex;\n const edgeIndex1 = pair[1].facetIndex;\n polyface.data.edgeMateIndex[edgeIndex0] = edgeIndex1; // paired edges point to each other\n polyface.data.edgeMateIndex[edgeIndex1] = edgeIndex0;\n }\n }\n for (const nullEdgeOrCluster of nullEdges) {\n const nullCluster = Array.isArray(nullEdgeOrCluster) ? nullEdgeOrCluster : [nullEdgeOrCluster];\n for (const nullEdge of nullCluster) {\n const edgeIndex = nullEdge.facetIndex;\n polyface.data.edgeMateIndex[edgeIndex] = edgeIndex; // a null edge points to itself\n }\n }\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"IndexedPolyfaceWalker.js","sourceRoot":"","sources":["../../../src/polyface/IndexedPolyfaceWalker.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6DAA+E;AAI/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAa,qBAAqB;IAChC,oCAAoC;IAC5B,SAAS,CAAkB;IACnC,+CAA+C;IACvC,UAAU,CAAqB;IACvC,kBAAkB;IAClB,YAAoB,QAAyB,EAAE,SAA6B;QAC1E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD;;;;OAIG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,0CAA0C;IAC1C,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD;;;OAGG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC;IACvC,CAAC;IACD;;;;;;OAMG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC;IACvC,CAAC;IACD,yEAAyE;IACzE,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,I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AAC,mCAAmC;gBACzF,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;YACvD,CAAC;QACH,CAAC;QACD,KAAK,MAAM,iBAAiB,IAAI,SAAS,EAAE,CAAC;YAC1C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;YAC/F,KAAK,MAAM,QAAQ,IAAI,WAAW,EAAE,CAAC;gBACnC,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC;gBACtC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC,+BAA+B;YACrF,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA5SD,sDA4SC","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\n/** @packageDocumentation\n * @module Polyface\n */\n\nimport { IndexedEdgeMatcher, SortableEdgeCluster } from \"./IndexedEdgeMatcher\";\nimport { IndexedPolyfaceVisitor } from \"./IndexedPolyfaceVisitor\";\nimport { IndexedPolyface } from \"./Polyface\";\n\n/**\n * The `IndexedPolyfaceWalker` class supports navigation around facets, across edges, and around vertices in an\n * [[IndexedPolyface]].\n * * Compare to the [[IndexedPolyfaceVisitor]] class, which supports the iteration of facets in an `IndexedPolyface`.\n * * A one-time call to [[buildEdgeMateIndices]] creates and populates the `data.edgeMateIndex` array on the input.\n * * This array essentially completes the topology of the `IndexedPolyface` by storing facet adjacency.\n * * After this setup, caller code can create `IndexedPolyfaceWalker` objects via:\n * * `walker = IndexedPolyfaceWalker.createAtFacetIndex(polyface, facetIndex, offsetWithinFacet)`\n * * `walker = IndexedPolyfaceWalker.createAtEdgeIndex(polyface, edgeIndex)`\n * * `walker = IndexedPolyfaceWalker.createAtVisitor(visitor, offsetWithinFacet)`\n * * Once you have a walker object, you can traverse the facet, edge, and vertex loops it references. For\n * example, if `walker.edgeIndex === A`, referring to the right edge of the upper left facet pictured below, then\n * the following are true:\n * * `walker.nextAroundFacet().edgeIndex === B`\n * * `walker.previousAroundFacet().edgeIndex === C`\n * * `walker.edgeMate().edgeIndex === F`\n * * `walker.nextAroundVertex().edgeIndex === E`\n * * `walker.previousAroundVertex().edgeIndex === D`\n* ```\n * # --------- # --------- #\n * | < < < B | F |\n * | ^ | v |\n * | ^ | v |\n * | ^ | v |\n * | C > > > A | D > > > |\n * # --------- # --------- #\n * | < < < E | |\n * | | |\n * | | |\n * | | |\n * # --------- # --------- #\n * ```\n* * When facets are viewed so that the face loops stored in the [[PolyfaceData]] `pointIndex` array have\n * counterclockwise ordering, an edge \"from A to B\" has facet area to the left and the edge to the right. Likewise,\n * the edges \"out of\" locations B, C, E, F, D are directed as depicted above.\n * * With this conventional counterclockwise ordering of face loops, \"next\" is counterclockwise, and \"previous\" is\n * clockwise:\n * * The [[nextAroundFacet]] step is counterclockwise around the facet.\n * * The [[previousAroundFacet]] step is clockwise around the facet.\n * * The [[nextAroundVertex]] step is counterclockwise around the vertex.\n * * The [[previousAroundVertex]] step is clockwise around the vertex.\n * * The `nextAroundFacet` steps for a walker and its [[edgeMate]] are in opposite directions along their shared edge,\n * when that edge is interior. Thus the `edgeMate` step can be seen to iterate an \"edge loop\" of two locations for an\n * interior edge.\n * * Invalid Walkers:\n * * An invalid walker has undefined [[edgeIndex]]. For these walkers, [[isUndefined]] returns true, and [[isValid]]\n * returns false. Traversal operations on an invalid walker return an invalid walker.\n * * Invalid walkers are expected during traversals of a mesh with boundary edges, so calling code must be prepared.\n * Boundary edges have exactly one adjacent facet, so for these edges the `edgeMate` step returns an invalid walker.\n * In the diagram above, the `edgeMate` of boundary edge B is undefined.\n * * Invalid walkers can occur while traversing boundary vertices as well. If an edge lacks an `edgeMate`, then the\n * `previousAroundVertex` step yields an invalid walker, because `previousAroundVertex` is implemented as `edgeMate`\n * followed by `nextAroundFacet`. In the diagram above, the `previousAroundVertex` step at boundary edge B yields\n * undefined walker. Similarly, the `nextAroundVertex` step at edge F yields undefined walker.\n * * Invalid walkers can also occur while traversing a non-manifold mesh. Such meshes feature edge(s) with more than\n * two adjacent facets, or with two adjacent facets that have opposite orientations. These meshes are uncommon, and\n * usually indicate a construction problem.\n * * Note that a null edge, for which the start and end vertex is the same, does not yield an invalid walker.\n * * See [[buildEdgeMateIndices]] for further description of the topological relations.\n * @public\n */\nexport class IndexedPolyfaceWalker {\n /** The polyface being traversed. */\n private _polyface: IndexedPolyface;\n /** The current edgeIndex into the polyface. */\n private _edgeIndex: number | undefined;\n /** Constructor */\n private constructor(polyface: IndexedPolyface, edgeIndex: number | undefined) {\n this._polyface = polyface;\n this._edgeIndex = edgeIndex;\n }\n /**\n * Return the edge index of this walker.\n * * This is an index into the polyface's `data.pointIndex` array.\n * * Can be undefined.\n */\n public get edgeIndex(): number | undefined {\n return this._edgeIndex;\n }\n\n /** Return the polyface of this walker. */\n public get polyface(): IndexedPolyface {\n return this._polyface;\n }\n /**\n * Return true if the walker's edgeIndex is defined.\n * * This method is the opposite of [[isUndefined]].\n */\n public get isValid(): boolean {\n return this._edgeIndex !== undefined;\n }\n /**\n * Return true if the walker's edgeIndex is undefined.\n * * This method is the opposite of [[isValid]].\n * * This can happen during a walk when the walker `w` reaches an exterior edge, for then\n * `w.edgeMate(w).isUndefined === true`.\n * * This can also happen when methods that return a walker receive invalid input.\n */\n public get isUndefined(): boolean {\n return this._edgeIndex === undefined;\n }\n /** Whether the walker is at a null edge, i.e. an edge with no length. */\n public get isNull(): boolean {\n return this.isValid && this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex) === this._edgeIndex;\n }\n /**\n * Create a walker for a given polyface at an optional edge.\n * @param polyface reference to the client polyface. This reference is captured (the polyface is not copied).\n * @param edgeIndex optional indication of where to start the walker within the mesh.\n * * If the edgeIndex is valid for the input polyface, the new walker is started there.\n * * If the edgeIndex is undefined or invalid for the input polyface, the walker returns true for [[isUndefined]].\n */\n public static createAtEdgeIndex(polyface: IndexedPolyface, edgeIndex?: number): IndexedPolyfaceWalker {\n if (!polyface.data.isValidEdgeIndex(edgeIndex))\n edgeIndex = undefined;\n return new IndexedPolyfaceWalker(polyface, edgeIndex);\n }\n /**\n * Create a walker for a given polyface at a specified facet.\n * * If `facetIndex` or `offsetWithinFacet` is invalid for the input polyface, the walker returns true for\n * [[isUndefined]].\n * @param polyface the polyface to reference\n * @param facetIndex index of the facet to reference\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtFacetIndex(polyface: IndexedPolyface, facetIndex: number, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n if (polyface.isValidFacetIndex(facetIndex)) {\n const k0 = polyface.facetIndex0(facetIndex);\n const k1 = polyface.facetIndex1(facetIndex);\n if (0 <= offsetWithinFacet && k0 + offsetWithinFacet < k1)\n return new IndexedPolyfaceWalker(polyface, k0 + offsetWithinFacet);\n }\n return new IndexedPolyfaceWalker(polyface, undefined);\n }\n /**\n * Create a walker at the facet specified by a visitor.\n * @param visitor visitor whose currentReadIndex identifies the facet.\n * @param offsetWithinFacet optional 0-based offset within the face loop of the facet (default 0). This allows\n * the caller to start the walker at a particular edge of the facet.\n */\n public static createAtVisitor(visitor: IndexedPolyfaceVisitor, offsetWithinFacet: number = 0): IndexedPolyfaceWalker {\n const facetIndex = visitor.currentReadIndex();\n return IndexedPolyfaceWalker.createAtFacetIndex(visitor.clientPolyface(), facetIndex, offsetWithinFacet);\n }\n /**\n * Create a new IndexedPolyfaceWalker from the instance.\n * * The returned walker refers to the same polyface and edge as the instance.\n * @param result optional receiver to modify and return.\n */\n public clone(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n if (result) {\n result._polyface = this._polyface;\n result._edgeIndex = this._edgeIndex;\n return result;\n }\n return new IndexedPolyfaceWalker(this._polyface, this._edgeIndex);\n }\n /**\n * Load the walker's facet into the given visitor.\n * @returns true if the visitor and walker reference the same polyface and the walker has a valid edge index.\n */\n public loadVisitor(visitor: IndexedPolyfaceVisitor): boolean {\n if (visitor.clientPolyface() !== this._polyface)\n return false;\n const facetIndex = this._polyface.edgeIndexToFacetIndex(this._edgeIndex);\n return (facetIndex !== undefined) ? visitor.moveToReadIndex(facetIndex) : false;\n }\n /**\n * Test if two walkers are at different edges in the same polyface.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return false.\n * * Otherwise return true.\n */\n public isDifferentEdgeInSamePolyface(other: IndexedPolyfaceWalker): boolean {\n if (this.isUndefined || other.isUndefined)\n return false;\n return this._polyface === other._polyface && this._edgeIndex !== other.edgeIndex;\n }\n /**\n * Test if two walkers are in the same polyface at the same edge.\n * * If either has undefined edge, return false.\n * * If they are in different polyfaces, return false.\n * * If they are the same edge in the same polyface, return true.\n */\n public isSameEdge(other: IndexedPolyfaceWalker): boolean {\n return this._polyface === other._polyface && this.isValid && this._edgeIndex === other._edgeIndex;\n }\n\n /**\n * Return a walker with given edgeIndex and polyface from the calling instance.\n * * If `result` is supplied, that walker is filled and returned.\n * * If `result` is not supplied, a new walker is created.\n */\n private createResult(result: undefined | IndexedPolyfaceWalker, edgeIndex: undefined | number): IndexedPolyfaceWalker {\n if (result === undefined)\n return new IndexedPolyfaceWalker(this._polyface, edgeIndex);\n result._polyface = this._polyface;\n result._edgeIndex = edgeIndex;\n return result;\n }\n /**\n * Return a walker (new or reused) at the next edge around the facet.\n * * \"Next\" is in the order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k2 = this._polyface.facetIndex1(facetIndex);\n const k1 = k + 1;\n if (k1 < k2)\n return this.createResult(result, k1);\n return this.createResult(result, this._polyface.facetIndex0(facetIndex));\n }\n /**\n * Return a walker (new or reused) at the previous edge around the facet.\n * * \"Previous\" is in the reverse order of indices in the face loop of this facet.\n * * If the instance has undefined edgeIndex, the result also has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundFacet(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n let k = this._edgeIndex;\n if (k === undefined)\n return this.createResult(result, undefined);\n const facetIndex = this._polyface.edgeIndexToFacetIndex(k);\n if (facetIndex === undefined)\n return this.createResult(result, undefined);\n const k0 = this._polyface.facetIndex0(facetIndex);\n if (k === k0)\n k = this._polyface.facetIndex1(facetIndex) - 1;\n else\n k--;\n return this.createResult(result, k);\n }\n /**\n * Return a walker (new or reused) at the edge mate of this walker's edge.\n * * The returned walker has undefined edgeIndex if:\n * * the instance is at a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public edgeMate(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n return this.createResult(result, this._polyface.data.edgeIndexToEdgeMateIndex(this._edgeIndex));\n }\n /**\n * Return a walker (new or reused) at the next outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"next\"\n * outbound edge is counterclockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the previous edge around the facet is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public nextAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.previousAroundFacet(result);\n return result1.edgeMate(result1);\n }\n /**\n * Return a walker (new or reused) at the previous outbound edge around the vertex at the base of this walker's edge.\n * * If the facet is viewed so that its \"nextAroundFacet\" direction appears counterclockwise, then the \"previous\"\n * outbound edge is clockwise around the base vertex.\n * * The returned walker has undefined edgeIndex if:\n * * the instance edge is a boundary edge, i.e., there is no facet on the other side, or\n * * the instance has undefined edgeIndex.\n * @param result optional receiver to modify and return. May be the same as `this` to move the instance walker\n * to the new location and return it.\n */\n public previousAroundVertex(result?: IndexedPolyfaceWalker): IndexedPolyfaceWalker {\n const result1 = this.edgeMate(result);\n return result1.nextAroundFacet(result1);\n }\n\n /**\n * Build the edgeMate index array into the polyface's [[PolyfaceData]].\n * After this method:\n * * The array `polyface.data.edgeMateIndex` is defined with the same length as the other PolyfaceData index arrays.\n * * For each interior edge, `polyface.data.edgeIndexToEdgeMateIndex` returns the edge index on the other side of the\n * edge in the adjacent facet.\n * * The conditions for edgeMate matching are:\n * * Given facetIndex f, let `k0 = polyface.facetIndex0(f)` and `k1 = polyface.facetIndex1(f)`.\n * * Every edge index k in the face loop of facet f satisfies `k0 <= k < k1`.\n * * The edge with edge index k starts at the point with index `polyface.data.pointIndex[k]`.\n * * Let kA be an edge index in this range [k0,k1), and let kB be its in-range successor with cyclic wrap, i.e.,\n * `kB === (kA + 1 === k1) ? k0 : kA + 1`.\n * * Then `polyface.data.pointIndex[kA]` and `polyface.data.pointIndex[kB]` are the indices of the points at the\n * start and end of an edge of that facet.\n * * We call kA the _edge index_ for that edge, and kB the _edge index_ for the next edge around the facet.\n * * If kA is a positive-length interior edge in a 2-manifold mesh with properly oriented facets, then there is\n * an adjacent facet whose face loop contains edge indices kC and kD referencing the same edge vertices in reverse\n * order, i.e.,\n * * `polyface.data.pointIndex[kA] === polyface.data.pointIndex[kD]`\n * * `polyface.data.pointIndex[kB] === polyface.data.pointIndex[kC]`\n * * We call the edge indices kA and kC _edge mates_, denoted in the `edgeMateIndex` array by:\n * * `polyface.data.edgeMateIndex[kA] === kC`\n * * `polyface.data.edgeMateIndex[kC] === kA`\n * * If kA is zero-length interior edge, i.e, it has the same start and end point indices, then we call it a _null\n * edge_, and its edge mate is itself.\n * * A non-interior edge either lies on the boundary of the mesh, or is non-manifold (having more than 2 adjacent\n * facets, or 1 with the wrong orientation). These edges have no edge mate, represented as `undefined` in\n * the `edgeMateIndex` array.\n * * These conditions define a conventional manifold mesh where each edge of a facet has at most one partner edge with\n * opposite orientation in an adjacent facet.\n * * After calling this method, the caller can construct `IndexedPolyfaceWalker` objects to traverse the mesh by\n * walking across edges, around faces, and around vertices. Let walkerA have edge index value kA. Then with the\n * aforementioned edge indices:\n * * `walkerC = walkerA.edgeMate()` moves across the edge to its other end, at kC.\n * * `walkerB = walkerA.nextAroundFacet()` moves around the facet to the next edge, at kB.\n * * `walkerB.previousAroundFacet()` moves from kB back to kA.\n * * `walkerD = walkerA.previousAroundVertex()` moves around the vertex to the next edge kD.\n * * `walkerD1 = walkerC.nextAroundFacet()` also moves to kD.\n * * `walkerD.nextAroundVertex()` moves from kD back to kA.\n */\n public static buildEdgeMateIndices(polyface: IndexedPolyface): void {\n if (polyface.isEmpty) {\n polyface.data.edgeMateIndex = undefined;\n return;\n }\n const matcher = new IndexedEdgeMatcher();\n const numFacet = polyface.facetCount;\n for (let facetIndex = 0; facetIndex < numFacet; facetIndex++) {\n const kStart = polyface.facetIndex0(facetIndex);\n const kEnd = polyface.facetIndex1(facetIndex);\n let k0 = kEnd - 1;\n // sneaky: addEdge 3rd arg is edge index k0 instead of facetIndex; it gets carried around during matching\n for (let k1 = kStart; k1 < kEnd; k0 = k1, k1++)\n matcher.addEdge(polyface.data.pointIndex[k0], polyface.data.pointIndex[k1], k0);\n }\n const matchedPairs: SortableEdgeCluster[] = [];\n const nullEdges: SortableEdgeCluster[] = [];\n matcher.sortAndCollectClusters(matchedPairs, undefined, nullEdges, undefined);\n const numIndex = polyface.data.pointIndex.length;\n polyface.data.edgeMateIndex = new Array<number | undefined>(numIndex);\n for (let i = 0; i < numIndex; i++)\n polyface.data.edgeMateIndex[i] = undefined; // boundary and non-manifold edges have no mate\n for (const pair of matchedPairs) {\n if (Array.isArray(pair) && pair.length === 2) {\n const edgeIndex0 = pair[0].facetIndex;\n const edgeIndex1 = pair[1].facetIndex;\n polyface.data.edgeMateIndex[edgeIndex0] = edgeIndex1; // paired edges point to each other\n polyface.data.edgeMateIndex[edgeIndex1] = edgeIndex0;\n }\n }\n for (const nullEdgeOrCluster of nullEdges) {\n const nullCluster = Array.isArray(nullEdgeOrCluster) ? nullEdgeOrCluster : [nullEdgeOrCluster];\n for (const nullEdge of nullCluster) {\n const edgeIndex = nullEdge.facetIndex;\n polyface.data.edgeMateIndex[edgeIndex] = edgeIndex; // a null edge points to itself\n }\n }\n }\n}\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BGFBReader.d.ts","sourceRoot":"","sources":["../../../src/serialization/BGFBReader.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAuB,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAY,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAA+B,MAAM,iCAAiC,CAAC;AAEpG,OAAO,EAAe,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMvD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAUxE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,E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qBAAqB,CAAC,QAAQ,EAAE,aAAa,CAAC,iBAAiB,GAAG,SAAS,GAAG,iBAAiB,GAAG,SAAS;IAqBlH;;;OAGG;IACI,uBAAuB,CAAC,OAAO,EAAE,aAAa,CAAC,eAAe,GAAG,eAAe,GAAG,SAAS;IAmG5F,uCAAuC,CAAC,OAAO,EAAE,aAAa,CAAC,WAAW,GAAG,eAAe;IAmBnG;;;KAGC;IACM,sCAAsC,CAAC,OAAO,EAAE,aAAa,CAAC,eAAe,GAAG,eAAe,GAAG,SAAS;IAQlH;;;KAGC;IACM,6BAA6B,CAAC,OAAO,EAAE,aAAa,CAAC,eAAe,GAAG,cAAc,GAAG,SAAS;IAmFxG;;;OAGG;IACI,4BAA4B,CAAC,OAAO,EAAE,aAAa,CAAC,eAAe,GAAG,aAAa,GAAG,aAAa,EAAE,GAAG,SAAS;IAoDxH;;;OAGG;WACW,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,aAAa,GAAG,aAAa,EAAE,GAAG,SAAS;CAezH;AAkBD;;;GAGG;AACH,qBAAa,oBAAoB;IAG/B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAoB9B;IACF,8EAA8E;WAChE,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQpE,uDAAuD;WACzC,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,GAAE,OAAc,GAAG,MAAM,GAAG,SAAS;IAOhG,0DAA0D;WAC5C,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAG5D"}
|
|
@@ -455,10 +455,9 @@ class BGFBReader {
|
|
|
455
455
|
// -2 for "no edgeMate", maps to `undefined` in TypeScript
|
|
456
456
|
if (edgeMateIndexI32) {
|
|
457
457
|
const edgeMateIndex = [];
|
|
458
|
-
if (
|
|
459
|
-
|
|
458
|
+
if (SerializationHelpers_1.SerializationHelpers.announceCompressedZeroBasedReflexiveIndices(edgeMateIndexI32, numPerFace, SerializationHelpers_1.SerializationHelpers.EdgeMateIndex.BlockSeparator, SerializationHelpers_1.SerializationHelpers.EdgeMateIndex.NoEdgeMate, (i) => edgeMateIndex.push(i))) {
|
|
459
|
+
polyface.data.edgeMateIndex = edgeMateIndex;
|
|
460
460
|
}
|
|
461
|
-
polyface.data.edgeMateIndex = edgeMateIndex;
|
|
462
461
|
}
|
|
463
462
|
if (!polyface.validateAllIndices())
|
|
464
463
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BGFBReader.js","sourceRoot":"","sources":["../../../src/serialization/BGFBReader.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,6CAA0C;AAC1C,sDAA6C;AAC7C,0DAA4E;AAC5E,0DAAyD;AACzD,gEAA6D;AAC7D,8DAA0F;AAC1F,0EAAoG;AACpG,0CAAuC;AACvC,8DAAwE;AAExE,0DAAuD;AACvD,0DAAuD;AACvD,wDAAqD;AACrD,wCAAqC;AACrC,wDAAqD;AACrD,wCAAqC;AACrC,0DAAuD;AACvD,mEAAgE;AAChE,2EAAwE;AACxE,2EAAwE;AACxE,sDAAmD;AACnD,0CAAuC;AACvC,+CAA4C;AAC5C,yDAAsD;AACtD,mEAAkE;AAClE,6DAAuE;AACvE,+CAA4C;AAC5C,uDAAoD;AACpD,uDAAoD;AACpD,iDAAkF;AAClF,mDAAuD;AACvD,qEAAkE;AAClE,sCAAmC;AACnC,wCAAqC;AACrC,sDAAmD;AACnD,8DAA2D;AAC3D,oDAAiD;AAEjD,4CAAyC;AACzC,kDAA+C;AAC/C,mDAAgD;AAChD,iEAA8D;AAE9D;;;;GAIG;AACH,MAAa,UAAU;IACrB;IACA,CAAC;IACD;;;OAGG;IACI,6BAA6B,CAAC,aAA4C;QAC/E,IAAI,UAA4D,CAAC;QACjE,MAAM,YAAY,GAAG,aAAa,CAAC,YAAY,EAAE,CAAC;QAClD,IAAI,YAAY,KAAK,6BAAa,CAAC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,KAAK,IAAI,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;YAC3D,IAAI,mBAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAW,CAAC;gBACnD,OAAO,KAAK,CAAC,CAAC,CAAW,CAAC;QAC9B,CAAC;QACD,OAAO,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5C,CAAC;IACD,0DAA0D;IACnD,MAAM,CAAC,kBAAkB,CAAC,QAAgB;QAC/C,OAAO,QAAQ,IAAI,EAAE,CAAC;IACxB,CAAC;;AA5CH,oDA6CC","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*--------------------------------------------------------------------------------------------*/\nimport { flatbuffers } from \"flatbuffers\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { AkimaCurve3d, AkimaCurve3dOptions } from \"../bspline/AkimaCurve3d\";\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\nimport { BSplineSurface3d, BSplineSurface3dH, UVSelect } from \"../bspline/BSplineSurface\";\nimport { InterpolationCurve3d, InterpolationCurve3dOptions } from \"../bspline/InterpolationCurve3d\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { BagOfCurves, CurveCollection } from \"../curve/CurveCollection\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { ParityRegion } from \"../curve/ParityRegion\";\nimport { Path } from \"../curve/Path\";\nimport { PointString3d } from \"../curve/PointString3d\";\nimport { DirectSpiral3d } from \"../curve/spiral/DirectSpiral3d\";\nimport { IntegratedSpiral3d } from \"../curve/spiral/IntegratedSpiral3d\";\nimport { TransitionSpiral3d } from \"../curve/spiral/TransitionSpiral3d\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { NumberArray, Point3dArray } from \"../geometry3d/PointHelpers\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Segment1d } from \"../geometry3d/Segment1d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { AuxChannel, AuxChannelData, PolyfaceAuxData } from \"../polyface/AuxData\";\nimport { IndexedPolyface } from \"../polyface/Polyface\";\nimport { TaggedNumericData } from \"../polyface/TaggedNumericData\";\nimport { Box } from \"../solid/Box\";\nimport { Cone } from \"../solid/Cone\";\nimport { LinearSweep } from \"../solid/LinearSweep\";\nimport { RotationalSweep } from \"../solid/RotationalSweep\";\nimport { RuledSweep } from \"../solid/RuledSweep\";\nimport { SolidPrimitive } from \"../solid/SolidPrimitive\";\nimport { Sphere } from \"../solid/Sphere\";\nimport { TorusPipe } from \"../solid/TorusPipe\";\nimport { BGFBAccessors } from \"./BGFBAccessors\";\nimport { SerializationHelpers } from \"./SerializationHelpers\";\n\n/** * Context to write to a flatbuffer blob.\n * * This class is internal.\n * * Public access is through BentleyGeometryFlatBuffer.geometryToBytes()\n * @internal\n */\nexport class BGFBReader {\n public constructor() {\n }\n /**\n * Extract a bspline surface\n * @param variant read position in the flat buffer.\n */\n public readBSplineSurfaceFromVariant(variantHeader: BGFBAccessors.VariantGeometry): BSplineSurface3d | BSplineSurface3dH | undefined {\n let newSurface: BSplineSurface3d | BSplineSurface3dH | undefined;\n const geometryType = variantHeader.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagBsplineSurface) {\n const bsurfHeader = variantHeader.geometry(new BGFBAccessors.BsplineSurface());\n if (bsurfHeader !== null) {\n const orderU = bsurfHeader.orderU();\n const orderV = bsurfHeader.orderV();\n const numPolesU = bsurfHeader.numPolesU();\n const numPolesV = bsurfHeader.numPolesV();\n const xyzArray = bsurfHeader.polesArray();\n const knotArrayU = bsurfHeader.knotsUArray();\n const knotArrayV = bsurfHeader.knotsVArray();\n const weightArray = bsurfHeader.weightsArray();\n const closedU = bsurfHeader.closedU();\n const closedV = bsurfHeader.closedV();\n\n if (xyzArray !== null && knotArrayU !== null && knotArrayV !== null) {\n const myData = SerializationHelpers.createBSplineSurfaceData(xyzArray, 3, knotArrayU, numPolesU, orderU, knotArrayV, numPolesV, orderV);\n if (weightArray !== null)\n myData.weights = weightArray;\n if (closedU)\n myData.uParams.closed = true;\n if (closedV)\n myData.vParams.closed = true;\n\n if (SerializationHelpers.Import.prepareBSplineSurfaceData(myData, { jsonPoles: false })) {\n if (undefined === myData.weights)\n newSurface = BSplineSurface3d.create(myData.poles as Float64Array, myData.uParams.numPoles, myData.uParams.order, myData.uParams.knots, myData.vParams.numPoles, myData.vParams.order, myData.vParams.knots);\n else\n newSurface = BSplineSurface3dH.create(myData.poles as Float64Array, myData.weights as Float64Array, myData.uParams.numPoles, myData.uParams.order, myData.uParams.knots, myData.vParams.numPoles, myData.vParams.order, myData.vParams.knots);\n\n if (undefined !== newSurface) {\n if (undefined !== myData.uParams.wrapMode)\n newSurface.setWrappable(UVSelect.uDirection, myData.uParams.wrapMode);\n if (undefined !== myData.vParams.wrapMode)\n newSurface.setWrappable(UVSelect.vDirection, myData.vParams.wrapMode);\n }\n }\n }\n }\n }\n return newSurface;\n }\n\n /**\n * Extract an interpolating curve\n * @param header read position in the flat buffer.\n */\n public readInterpolationCurve3d(header: BGFBAccessors.InterpolationCurve): InterpolationCurve3d | undefined {\n const xyzArray = header.fitPointsArray();\n if (xyzArray instanceof Float64Array) {\n const knots = header.knotsArray();\n const options = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(xyzArray), knots ? NumberArray.create(knots) : undefined);\n const startTangent = header.startTangent();\n const endTangent = header.endTangent();\n options.captureOptionalProps(\n header.order(),\n header.closed(),\n header.isChordLenKnots(),\n header.isColinearTangents(),\n header.isChordLenTangents(),\n header.isNaturalTangents(),\n startTangent !== null ? Vector3d.create(startTangent.x(), startTangent.y(), startTangent.z()) : undefined,\n endTangent !== null ? Vector3d.create(endTangent.x(), endTangent.y(), endTangent.z()) : undefined);\n return InterpolationCurve3d.createCapture(options);\n }\n return undefined;\n }\n\n /**\n * Extract an akima curve\n * @param header read position in the flat buffer.\n */\n public readAkimaCurve3d(header: BGFBAccessors.AkimaCurve): AkimaCurve3d | undefined {\n const xyzArray = header.pointsArray();\n if (xyzArray instanceof Float64Array) {\n const options = new AkimaCurve3dOptions(Point3dArray.clonePoint3dArray(xyzArray));\n return AkimaCurve3d.createCapture(options);\n }\n return undefined;\n }\n /**\n * Extract a bspline curve\n * @param variant read position in the flat buffer.\n */\n public readBSplineCurve(header: BGFBAccessors.BsplineCurve): BSplineCurve3d | BSplineCurve3dH | undefined {\n let newCurve: BSplineCurve3d | BSplineCurve3dH | undefined;\n const order = header.order();\n const xyzArray = header.polesArray();\n const knots = header.knotsArray();\n const weightsArray = header.weightsArray();\n const closed = header.closed();\n\n if (xyzArray !== null && knots !== null) {\n const numPoles = Math.floor(xyzArray.length / 3);\n const myData = SerializationHelpers.createBSplineCurveData(xyzArray, 3, knots, numPoles, order);\n if (closed)\n myData.params.closed = true;\n\n if (weightsArray === null) {\n if (SerializationHelpers.Import.prepareBSplineCurveData(myData))\n newCurve = BSplineCurve3d.create(myData.poles, myData.params.knots, myData.params.order);\n } else {\n myData.weights = weightsArray;\n if (SerializationHelpers.Import.prepareBSplineCurveData(myData, { jsonPoles: false }))\n newCurve = BSplineCurve3dH.create({ xyz: myData.poles as Float64Array, weights: myData.weights }, myData.params.knots, myData.params.order);\n }\n\n if (undefined !== newCurve) {\n if (undefined !== myData.params.wrapMode)\n newCurve.setWrappable(myData.params.wrapMode);\n }\n }\n return newCurve;\n }\n /**\n * Extract a bspline curve\n * @param variant read position in the flat buffer.\n */\n public readTransitionSpiral(header: BGFBAccessors.TransitionSpiral): TransitionSpiral3d | undefined {\n const detailHeader = header.detail();\n if (detailHeader) {\n const directDetailHeader = header.directDetail();\n const _extraDataArray = header.extraDataArray();\n const spiralTypeName = DgnSpiralTypeQueries.typeCodeToString(detailHeader.spiralType());\n const curvature0 = detailHeader.curvature0();\n const curvature1 = detailHeader.curvature1();\n const bearing0Radians = detailHeader.bearing0Radians();\n const bearing1Radians = detailHeader.bearing1Radians();\n const fbTransform = detailHeader.transform();\n const localToWorld = fbTransform ? Transform.createRowValues(\n fbTransform.axx(), fbTransform.axy(), fbTransform.axz(), fbTransform.axw(),\n fbTransform.ayx(), fbTransform.ayy(), fbTransform.ayz(), fbTransform.ayw(),\n fbTransform.azx(), fbTransform.azy(), fbTransform.azz(), fbTransform.azw()) :\n Transform.createIdentity();\n\n const activeFractionInterval = Segment1d.create(detailHeader.fractionA(),\n detailHeader.fractionB());\n if (!directDetailHeader) {\n const integratedSpiral = IntegratedSpiral3d.createRadiusRadiusBearingBearing(\n Segment1d.create(IntegratedSpiral3d.curvatureToRadius(curvature0), IntegratedSpiral3d.curvatureToRadius(curvature1)),\n AngleSweep.createStartEndRadians(bearing0Radians, bearing1Radians),\n activeFractionInterval, localToWorld, spiralTypeName);\n if (integratedSpiral)\n return integratedSpiral;\n const radius0 = TransitionSpiral3d.curvatureToRadius(curvature0);\n const radius1 = TransitionSpiral3d.curvatureToRadius(curvature1);\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius0, radius1,\n bearing1Radians - bearing0Radians);\n const directSpiral = DirectSpiral3d.createFromLengthAndRadius(\n spiralTypeName!,\n radius0, radius1,\n Angle.createRadians(bearing0Radians),\n Angle.createRadians(bearing1Radians),\n arcLength,\n activeFractionInterval,\n localToWorld);\n if (directSpiral)\n return directSpiral;\n }\n }\n return undefined;\n }\n /**\n * Extract a curve primitive\n * @param variant read position in the flat buffer.\n */\n public readCurvePrimitiveFromVariant(variant: BGFBAccessors.VariantGeometry): CurvePrimitive | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagLineSegment) {\n const offsetToLineSegment = variant.geometry(new BGFBAccessors.LineSegment());\n const offsetToCoordinates = offsetToLineSegment!.segment();\n return LineSegment3d.createXYZXYZ(\n offsetToCoordinates!.point0X(), offsetToCoordinates!.point0Y(), offsetToCoordinates!.point0Z(),\n offsetToCoordinates!.point1X(), offsetToCoordinates!.point1Y(), offsetToCoordinates!.point1Z());\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagEllipticArc) {\n const offsetToEllipticArc = variant.geometry(new BGFBAccessors.EllipticArc());\n const offsetToCoordinates = offsetToEllipticArc!.arc()!;\n return Arc3d.createXYZXYZXYZ(\n offsetToCoordinates.centerX(), offsetToCoordinates.centerY(), offsetToCoordinates.centerZ(),\n offsetToCoordinates.vector0X(), offsetToCoordinates.vector0Y(), offsetToCoordinates.vector0Z(),\n offsetToCoordinates.vector90X(), offsetToCoordinates.vector90Y(), offsetToCoordinates.vector90Z(),\n AngleSweep.createStartSweepRadians(offsetToCoordinates.startRadians(), offsetToCoordinates?.sweepRadians()));\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagLineString) {\n const offsetToLineString = variant.geometry(new BGFBAccessors.LineString())!;\n const numCoordinates = offsetToLineString.pointsLength();\n const result = LineString3d.create();\n for (let i = 0; i + 2 < numCoordinates; i += 3) {\n result.packedPoints.pushXYZ(offsetToLineString.points(i)!, offsetToLineString.points(i + 1)!, offsetToLineString.points(i + 2)!);\n }\n return result;\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagBsplineCurve) {\n const offsetToBCurve = variant.geometry(new BGFBAccessors.BsplineCurve());\n if (offsetToBCurve !== null)\n return this.readBSplineCurve(offsetToBCurve);\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagTransitionSpiral) {\n const offsetToTransitionSpiralTable = variant.geometry(new BGFBAccessors.TransitionSpiral());\n if (offsetToTransitionSpiralTable !== null)\n return this.readTransitionSpiral(offsetToTransitionSpiralTable);\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagInterpolationCurve) {\n const offsetToInterpolationCurveTable = variant.geometry(new BGFBAccessors.InterpolationCurve());\n if (offsetToInterpolationCurveTable !== null)\n return this.readInterpolationCurve3d(offsetToInterpolationCurveTable);\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagAkimaCurve) {\n const offsetToAkimaCurveTable = variant.geometry(new BGFBAccessors.AkimaCurve());\n if (offsetToAkimaCurveTable !== null)\n return this.readAkimaCurve3d(offsetToAkimaCurveTable);\n }\n return undefined;\n }\n /**\n * Extract a curve primitive\n * @param variant read position in the flat buffer.\n */\n public readPointStringFromVariant(variant: BGFBAccessors.VariantGeometry): PointString3d | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagPointString) {\n const offsetToLineString = variant.geometry(new BGFBAccessors.PointString())!;\n const numCoordinates = offsetToLineString.pointsLength();\n const result = PointString3d.create();\n for (let i = 0; i + 2 < numCoordinates; i += 3) {\n result.points.push(Point3d.create(offsetToLineString.points(i)!, offsetToLineString.points(i + 1)!, offsetToLineString.points(i + 2)!));\n }\n return result;\n }\n return undefined;\n }\n /** Extract auxData channel data for a mesh */\n public readPolyfaceAuxChannelData(channelDataHeader: BGFBAccessors.PolyfaceAuxChannelData | null): AuxChannelData | undefined {\n if (channelDataHeader !== null) {\n const input = channelDataHeader.input();\n const values = channelDataHeader.valuesArray();\n if (values !== null)\n return new AuxChannelData(input, values);\n }\n return undefined;\n }\n\n /** Extract auxData channel for a mesh */\n public readPolyfaceAuxChannel(channelHeader: BGFBAccessors.PolyfaceAuxChannel | null): AuxChannel | undefined {\n if (channelHeader) {\n const dataType = channelHeader.dataType();\n const dataLength = channelHeader.dataLength();\n const channelDataArray: AuxChannelData[] = [];\n const name = channelHeader.name();\n const inputName = channelHeader.inputName();\n for (let i = 0; i < dataLength; i++) {\n const channelData = this.readPolyfaceAuxChannelData(channelHeader.data(i));\n if (channelData)\n channelDataArray.push(channelData);\n }\n return new AuxChannel(channelDataArray, dataType, name ? name : undefined, inputName ? inputName : undefined);\n }\n return undefined;\n }\n\n /** Compute the number of logical entries in every flat data array in the AuxData */\n private static channelDataLength(fbAuxData: BGFBAccessors.PolyfaceAuxData): number {\n if (fbAuxData.channelsLength() <= 0)\n return 0;\n\n const fbChannel0 = nullToUndefined<BGFBAccessors.PolyfaceAuxChannel>(fbAuxData.channels(0));\n if (!fbChannel0)\n return 0;\n\n const numChannel0Data = fbChannel0.dataLength();\n if (numChannel0Data <= 0)\n return 0;\n\n const fbChannel0Data0 = nullToUndefined<BGFBAccessors.PolyfaceAuxChannelData>(fbChannel0.data(0));\n if (!fbChannel0Data0)\n return 0;\n\n const numChannelDataValues = fbChannel0Data0.valuesLength();\n if (numChannelDataValues <= 0)\n return 0;\n\n return numChannelDataValues / AuxChannel.entriesPerValue(fbChannel0.dataType());\n }\n\n /** Examine int array for range and zero count */\n private countIntArray(ints: Int32Array): { min: number, max: number, numZeroes: number } {\n let min = Infinity;\n let max = -Infinity;\n let numZeroes = 0;\n for (const i of ints) {\n if (min > i)\n min = i;\n if (max < i)\n max = i;\n if (0 === i)\n ++numZeroes;\n }\n return { min, max, numZeroes };\n }\n\n /**\n * Extract auxData for a mesh.\n * Typescript object format for Polyface/PolyfaceAuxData indices is 0-based, unterminated.\n * FlatBuffer format for Polyface/PolyfaceAuxData indices is 1-based, 0-terminated/padded.\n * Typescript API previously wrote FlatBuffer PolyfaceAuxData indices as 0-based, unterminated;\n * heuristics are used herein to identify this legacy format so it can still be read.\n */\n public readPolyfaceAuxData(fbPolyface: BGFBAccessors.Polyface | null, fbAuxData: BGFBAccessors.PolyfaceAuxData | null): PolyfaceAuxData | undefined {\n if (!fbPolyface || !fbAuxData)\n return undefined;\n\n const fbPointIndices = nullToUndefined<Int32Array>(fbPolyface.pointIndexArray());\n const fbAuxIndices = nullToUndefined<Int32Array>(fbAuxData.indicesArray());\n const numChannels = fbAuxData.channelsLength();\n const fbNumData = BGFBReader.channelDataLength(fbAuxData);\n if (!fbPointIndices || !fbPointIndices.length || !fbAuxIndices || !fbAuxIndices.length || numChannels <= 0 || fbNumData <= 0)\n return undefined;\n\n const numPerFace = fbPolyface.numPerFace();\n\n // HEURISTICS to detect legacy AuxData indices, previously mistakenly serialized by BGFBWriter.writePolyfaceAsFBVariantGeometry as 0-based unblocked indices\n let isLegacy = false;\n const pointIndicesPadCount = fbPointIndices.filter((index) => index === 0).length;\n if (numPerFace > 1) {\n const auxIndexCounts = this.countIntArray(fbAuxIndices);\n if (auxIndexCounts.max > fbNumData) // auxIndices invalid\n return undefined;\n if (auxIndexCounts.max === fbNumData) // auxIndices 1-based\n isLegacy = false;\n else if (auxIndexCounts.max <= 0 || auxIndexCounts.min < 0) // auxIndices 1-based (signed)\n isLegacy = false;\n else if (auxIndexCounts.min === 0) // auxIndices likely legacy 0-based index, but could be modern with padding\n isLegacy = pointIndicesPadCount !== auxIndexCounts.numZeroes;\n else if (auxIndexCounts.min > 0) // auxIndices likely modern without padding, but could be legacy if first datum not indexed\n isLegacy = pointIndicesPadCount > 0;\n } else {\n isLegacy = (fbAuxIndices.length < fbPointIndices.length) && (fbAuxIndices.length + pointIndicesPadCount === fbPointIndices.length);\n }\n if (!isLegacy && fbAuxIndices.length !== fbPointIndices.length)\n return undefined; // auxIndices invalid\n\n const indices: number[] = [];\n if (isLegacy)\n SerializationHelpers.announceZeroBasedIndicesWithExternalBlocking(fbAuxIndices, fbPointIndices, numPerFace, (i0: number) => { indices.push(i0); });\n else\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(fbAuxIndices, numPerFace, (i0: number) => { indices.push(i0); });\n if (indices.length + pointIndicesPadCount !== fbPointIndices.length)\n return undefined;\n const maxIndex = Math.max(...indices);\n\n const channels: AuxChannel[] = [];\n for (let i = 0; i < numChannels; i++) {\n const channelHeader = fbAuxData.channels(i);\n const channelContent = this.readPolyfaceAuxChannel(channelHeader);\n if (channelContent) {\n if (maxIndex >= channelContent.valueCount)\n return undefined; // invalid index\n channels.push(channelContent);\n }\n }\n if (!channels.length)\n return undefined;\n\n return new PolyfaceAuxData(channels, indices);\n }\n\n /** Extract tagged numeric data for a mesh */\n public readTaggedNumericData(accessor: BGFBAccessors.TaggedNumericData | undefined): TaggedNumericData | undefined {\n if (accessor) {\n const taggedNumericData = new TaggedNumericData(accessor.tagA(), accessor.tagB());\n const intDataArray = nullToUndefined<Int32Array>(accessor.intDataArray());\n const doubleDataArray = nullToUndefined<Float64Array>(accessor.doubleDataArray());\n if (intDataArray) {\n taggedNumericData.intData = [];\n for (const c of intDataArray)\n taggedNumericData.intData.push(c);\n\n }\n if (doubleDataArray) {\n taggedNumericData.doubleData = [];\n for (const c of doubleDataArray)\n taggedNumericData.doubleData.push(c);\n }\n return taggedNumericData;\n }\n return undefined;\n }\n\n /**\n * Extract a mesh\n * @param variant read position in the flat buffer.\n */\n public readPolyfaceFromVariant(variant: BGFBAccessors.VariantGeometry): IndexedPolyface | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagPolyface) {\n const polyfaceHeader = variant.geometry(new BGFBAccessors.Polyface());\n if (polyfaceHeader) {\n const twoSided = polyfaceHeader.twoSided();\n const expectedClosure = polyfaceHeader.expectedClosure();\n const meshStyle = polyfaceHeader.meshStyle();\n const numPerFace = polyfaceHeader.numPerFace();\n\n const pointF64 = nullToUndefined<Float64Array>(polyfaceHeader.pointArray());\n const paramF64 = nullToUndefined<Float64Array>(polyfaceHeader.paramArray());\n const normalF64 = nullToUndefined<Float64Array>(polyfaceHeader.normalArray());\n const intColorU32 = nullToUndefined<Uint32Array>(polyfaceHeader.intColorArray());\n\n const pointIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.pointIndexArray());\n const paramIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.paramIndexArray());\n const normalIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.normalIndexArray());\n const colorIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.colorIndexArray());\n const edgeMateIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.edgeMateIndexArray());\n const taggedNumericDataOffset = polyfaceHeader.taggedNumericData();\n\n // FB polyfaces are always indexed face loop style, but we recognize both variable and fixed-size face loops.\n // (BGFBWriter only writes variable-sized face loops, but native FBWriter can write both.)\n assert(meshStyle === 1, \"Unrecognized flatbuffer mesh style\");\n\n if (meshStyle === 1 && pointF64 && pointIndexI32) {\n const polyface = IndexedPolyface.create();\n polyface.twoSided = twoSided;\n polyface.expectedClosure = expectedClosure;\n\n // Flatbuffer parallel index array values are:\n // * signed 1-based index into the respective data array\n // * 0 indicates variable-sized face loop terminator (numPerFace < 2)\n // * 0 indicates fixed-sized face loop padding (numPerFace >= 2)\n // Native format is the same as flatbuffer.\n // TypeScript format is 0-based indices sans terminator/padding\n if (normalF64 && normalIndexI32) {\n for (let i = 0; i + 2 < normalF64.length; i += 3)\n polyface.addNormalXYZ(normalF64[i], normalF64[i + 1], normalF64[i + 2]);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(normalIndexI32, numPerFace,\n (i: number) => { polyface.addNormalIndex(i); });\n }\n if (paramF64 && paramIndexI32) {\n for (let i = 0; i + 1 < paramF64.length; i += 2)\n polyface.addParamUV(paramF64[i], paramF64[i + 1]);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(paramIndexI32, numPerFace,\n (i: number) => { polyface.addParamIndex(i); });\n }\n if (intColorU32 && colorIndexI32) {\n for (const c of intColorU32)\n polyface.addColor(c);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(colorIndexI32, numPerFace,\n (i: number) => { polyface.addColorIndex(i); });\n }\n\n // the second callback below builds up the facetStart array as we process the main point index array\n for (let i = 0; i + 2 < pointF64.length; i += 3)\n polyface.addPointXYZ(pointF64[i], pointF64[i + 1], pointF64[i + 2]);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(pointIndexI32, numPerFace,\n (i: number, v?: boolean) => { polyface.addPointIndex(i, v); },\n () => { polyface.terminateFacet(false); });\n\n // FB/JSON/native edgeMateIndex array format:\n // 0-based edgeMate indices into the parallel Polyface index arrays (and edgeMateIndex!),\n // -1 terminator/pad, not present in TypeScript,\n // -2 for \"no edgeMate\", maps to `undefined` in TypeScript\n if (edgeMateIndexI32) {\n const edgeMateIndex: Array<number | undefined> = [];\n if (!SerializationHelpers.announceCompressedZeroBasedReflexiveIndices(edgeMateIndexI32, numPerFace,\n SerializationHelpers.EdgeMateIndex.BlockSeparator, SerializationHelpers.EdgeMateIndex.NoEdgeMate,\n (i: number | undefined) => edgeMateIndex.push(i),\n )) {\n assert(false, \"unable to deserialize flatbuffer edgeMateIndex array\")\n }\n polyface.data.edgeMateIndex = edgeMateIndex;\n }\n\n if (!polyface.validateAllIndices())\n return undefined;\n\n polyface.data.auxData = this.readPolyfaceAuxData(polyfaceHeader, polyfaceHeader.auxData());\n\n if (taggedNumericDataOffset) {\n const taggedNumericDataAccessor = nullToUndefined<BGFBAccessors.TaggedNumericData>(taggedNumericDataOffset);\n if (taggedNumericDataAccessor !== undefined) {\n const taggedNumericData = this.readTaggedNumericData(taggedNumericDataAccessor);\n if (taggedNumericData !== undefined)\n polyface.data.setTaggedNumericData(taggedNumericData);\n }\n }\n\n // NOTE: faceData is ignored\n return polyface;\n }\n }\n }\n return undefined;\n }\n\n public readCurveCollectionFromCurveVectorTable(cvTable: BGFBAccessors.CurveVector): CurveCollection {\n const numChildren = cvTable.curvesLength();\n const collectionType = cvTable.type();\n const collection = createTypedCurveCollection(collectionType);\n for (let i = 0; i < numChildren; i++) {\n const childOffset = cvTable.curves(i);\n if (childOffset !== null) {\n const child = this.readCurvePrimitiveFromVariant(childOffset);\n if (child)\n collection.tryAddChild(child);\n else {\n const childCollection = this.readCurveCollectionFromVariantGeometry(childOffset);\n if (childCollection)\n collection.tryAddChild(childCollection);\n }\n }\n }\n return collection;\n }\n /**\n * Extract a curve collection\n * @param variant read position in the flat buffer.\n */\n public readCurveCollectionFromVariantGeometry(variant: BGFBAccessors.VariantGeometry): CurveCollection | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagCurveVector) {\n const cvTable = variant.geometry(new BGFBAccessors.CurveVector())!;\n return this.readCurveCollectionFromCurveVectorTable(cvTable);\n }\n return undefined;\n }\n /**\n * Extract a curve collection\n * @param variant read position in the flat buffer.\n */\n public readSolidPrimitiveFromVariant(variant: BGFBAccessors.VariantGeometry): SolidPrimitive | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnBox) {\n const header = variant.geometry(new BGFBAccessors.DgnBox());\n const detail = header!.detail()!;\n return Box.createDgnBox(\n Point3d.create(detail.baseOriginX(), detail.baseOriginY(), detail.baseOriginZ()),\n Vector3d.create(detail.vectorXX(), detail.vectorXY(), detail.vectorXZ()),\n Vector3d.create(detail.vectorYX(), detail.vectorYY(), detail.vectorYZ()),\n Point3d.create(detail.topOriginX(), detail.topOriginY(), detail.topOriginZ()),\n detail.baseX(), detail.baseY(), detail.topX(), detail.topY(),\n detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnSphere) {\n const header = variant.geometry(new BGFBAccessors.DgnSphere());\n const detail = header!.detail()!;\n const lToWDetail = detail.localToWorld()!;\n const localToWorld = Transform.createRowValues(\n lToWDetail.axx(), lToWDetail.axy(), lToWDetail.axz(), lToWDetail.axw(),\n lToWDetail.ayx(), lToWDetail.ayy(), lToWDetail.ayz(), lToWDetail.ayw(),\n lToWDetail.azx(), lToWDetail.azy(), lToWDetail.azz(), lToWDetail.azw());\n return Sphere.createEllipsoid(localToWorld,\n AngleSweep.createStartSweepRadians(detail.startLatitudeRadians(), detail.latitudeSweepRadians()),\n detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnCone) {\n const header = variant.geometry(new BGFBAccessors.DgnCone());\n const detail = header!.detail()!;\n const centerA = Point3d.create(detail.centerAX(), detail.centerAY(), detail.centerAZ());\n const centerB = Point3d.create(detail.centerBX(), detail.centerBY(), detail.centerBZ());\n const vector0 = Vector3d.create(detail.vector0X(), detail.vector0Y(), detail.vector0Z());\n const vector90 = Vector3d.create(detail.vector90X(), detail.vector90Y(), detail.vector90Z());\n const radiusA = detail.radiusA();\n const radiusB = detail.radiusB();\n return Cone.createBaseAndTarget(centerA, centerB, vector0, vector90, radiusA, radiusB, detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnTorusPipe) {\n const header = variant.geometry(new BGFBAccessors.DgnTorusPipe())!;\n const detail = header.detail()!;\n const center = Point3d.create(detail.centerX(), detail.centerY(), detail.centerZ());\n const vectorX = Vector3d.create(detail.vectorXX(), detail.vectorXY(), detail.vectorXZ());\n const vectorY = Vector3d.create(detail.vectorYX(), detail.vectorYY(), detail.vectorYZ());\n const sweepRadians = detail.sweepRadians();\n const majorRadius = detail.majorRadius();\n const minorRadius = detail.minorRadius();\n return TorusPipe.createDgnTorusPipe(center, vectorX, vectorY, majorRadius, minorRadius, Angle.createRadians(sweepRadians), detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnExtrusion) {\n const header = variant.geometry(new BGFBAccessors.DgnExtrusion())!;\n const dVector = new BGFBAccessors.DVector3d();\n header.extrusionVector(dVector);\n const extrusionVector = Vector3d.create(dVector.x(), dVector.y(), dVector.z());\n const baseCurve = header.baseCurve();\n if (baseCurve !== null) {\n const contour = this.readCurveCollectionFromCurveVectorTable(baseCurve);\n return LinearSweep.create(contour, extrusionVector, header.capped());\n }\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnRotationalSweep) {\n const header = variant.geometry(new BGFBAccessors.DgnRotationalSweep())!;\n const dAxis = new BGFBAccessors.DRay3d();\n header.axis(dAxis);\n const axis = Ray3d.createXYZUVW(dAxis.x(), dAxis.y(), dAxis.z(), dAxis.ux(), dAxis.uy(), dAxis.uz());\n const sweepAngle = Angle.createRadians(header.sweepRadians());\n // const numVRules = header.numVRules();\n const baseCurve = header.baseCurve();\n if (baseCurve !== null) {\n const contour = this.readCurveCollectionFromCurveVectorTable(baseCurve);\n return RotationalSweep.create(contour, axis, sweepAngle, header.capped());\n }\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnRuledSweep) {\n const header = variant.geometry(new BGFBAccessors.DgnRuledSweep())!;\n const numCurves = header.curvesLength();\n const contours: CurveCollection[] = [];\n for (let i = 0; i < numCurves; i++) {\n const contourTable = header.curves(i);\n if (contourTable) {\n const contour = this.readCurveCollectionFromCurveVectorTable(contourTable);\n if (contour)\n contours.push(contour);\n }\n }\n if (contours.length > 0) {\n return RuledSweep.create(contours, header.capped());\n }\n }\n return undefined;\n }\n /**\n * Extract any geometry type or array of geometry.\n * @param variant read position in the flat buffer.\n */\n public readGeometryQueryFromVariant(variant: BGFBAccessors.VariantGeometry): GeometryQuery | GeometryQuery[] | undefined {\n const rootType = variant.geometryType();\n switch (rootType) {\n case BGFBAccessors.VariantGeometryUnion.tagLineSegment:\n case BGFBAccessors.VariantGeometryUnion.tagLineString:\n case BGFBAccessors.VariantGeometryUnion.tagEllipticArc:\n case BGFBAccessors.VariantGeometryUnion.tagBsplineCurve:\n case BGFBAccessors.VariantGeometryUnion.tagTransitionSpiral:\n case BGFBAccessors.VariantGeometryUnion.tagInterpolationCurve:\n case BGFBAccessors.VariantGeometryUnion.tagAkimaCurve: {\n return this.readCurvePrimitiveFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagCurveVector: {\n return this.readCurveCollectionFromVariantGeometry(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagPolyface: {\n return this.readPolyfaceFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagDgnBox:\n case BGFBAccessors.VariantGeometryUnion.tagDgnCone:\n case BGFBAccessors.VariantGeometryUnion.tagDgnTorusPipe:\n case BGFBAccessors.VariantGeometryUnion.tagDgnSphere:\n case BGFBAccessors.VariantGeometryUnion.tagDgnExtrusion:\n case BGFBAccessors.VariantGeometryUnion.tagDgnRotationalSweep:\n case BGFBAccessors.VariantGeometryUnion.tagDgnRuledSweep: {\n return this.readSolidPrimitiveFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagVectorOfVariantGeometry: {\n const geometry: GeometryQuery[] = [];\n const offsetToVectorOfVariantGeometry = variant.geometry(new BGFBAccessors.VectorOfVariantGeometry());\n for (let i = 0; i < offsetToVectorOfVariantGeometry!.membersLength(); i++) {\n const child = offsetToVectorOfVariantGeometry!.members(i);\n if (child !== null) {\n const childGeometry = this.readGeometryQueryFromVariant(child);\n if (childGeometry instanceof GeometryQuery) {\n geometry.push(childGeometry);\n } else if (Array.isArray(childGeometry)) {\n geometry.push(...childGeometry);\n }\n }\n }\n return geometry;\n }\n case BGFBAccessors.VariantGeometryUnion.tagBsplineSurface: {\n return this.readBSplineSurfaceFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagPointString: {\n return this.readPointStringFromVariant(variant);\n }\n }\n return undefined;\n }\n /**\n * Deserialize bytes from a flatbuffer.\n * @param justTheBytes FlatBuffer bytes as created by BGFBWriter.createFlatBuffer (g);\n */\n public static bytesToGeometry(theBytes: Uint8Array, signature?: Uint8Array): GeometryQuery | GeometryQuery[] | undefined {\n const newByteBuffer = new flatbuffers.ByteBuffer(theBytes);\n if (signature) {\n if (theBytes.length < signature.length)\n return undefined;\n for (let i = 0; i < signature.length; i++)\n if (theBytes[i] !== signature[i])\n return undefined;\n newByteBuffer.setPosition(signature.length);\n }\n const root = BGFBAccessors.VariantGeometry.getRootAsVariantGeometry(newByteBuffer);\n const reader = new BGFBReader();\n return reader.readGeometryQueryFromVariant(root);\n }\n\n}\n/**\n * if data is \"null\" (the deprecated javascript idiom!) return undefined. Otherwise return the data as its own type.\n * @param data\n */\nfunction nullToUndefined<T>(data: any): T | undefined {\n if (data === null)\n return undefined;\n return data;\n}\n\nfunction createTypedCurveCollection(collectionType: number): CurveCollection {\n if (collectionType === 1) return new Path();\n if (collectionType === 2 || collectionType === 3) return new Loop();\n if (collectionType === 4) return new ParityRegion();\n if (collectionType === 5) return new UnionRegion();\n return new BagOfCurves();\n}\n/**\n * mappings between typescript spiral type strings and native integers.\n * @internal\n */\nexport class DgnSpiralTypeQueries {\n // remark: this is the full list based on native DSpiral2dBase.h.\n // This does not guarantee all types are supported.\n private static spiralTypeCodeMap = [\n [10, \"clothoid\"],\n [11, \"bloss\"],\n [12, \"biquadratic\"],\n [13, \"cosine\"],\n [14, \"sine\"],\n [15, \"Viennese\"],\n [16, \"weightedViennese\"],\n\n [50, \"WesternAustralian\"],\n [51, \"Czech\"],\n [52, \"AustralianRailCorp\"],\n [53, \"Italian\"],\n [54, \"PolishCubic\"],\n [55, \"Arema\"],\n [56, \"MXCubicAlongArc\"],\n [57, \"MXCubicAlongTangent\"],\n [58, \"ChineseCubic\"],\n [60, \"HalfCosine\"],\n [61, \"JapaneseCubic\"],\n ];\n /** Convert native integer type (e.g. from flatbuffer) to typescript string */\n public static typeCodeToString(typeCode: number): string | undefined {\n for (const entry of DgnSpiralTypeQueries.spiralTypeCodeMap) {\n if (entry[0] === typeCode)\n return entry[1] as string;\n }\n return undefined;\n }\n\n /** Convert typescript string to native integer type */\n public static stringToTypeCode(s: string, defaultToClothoid: boolean = true): number | undefined {\n for (const entry of DgnSpiralTypeQueries.spiralTypeCodeMap) {\n if (Geometry.equalStringNoCase(s, entry[1] as string))\n return entry[0] as number;\n }\n return defaultToClothoid ? 10 : undefined;\n }\n /** Ask if the indicated type code is a \"direct\" spiral */\n public static isDirectSpiralType(typeCode: number): boolean {\n return typeCode >= 50;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BGFBReader.js","sourceRoot":"","sources":["../../../src/serialization/BGFBReader.ts"],"names":[],"mappings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,EAAE,EAAE,mBAAmB,CAAC;QACzB,CAAC,EAAE,EAAE,OAAO,CAAC;QACb,CAAC,EAAE,EAAE,oBAAoB,CAAC;QAC1B,CAAC,EAAE,EAAE,SAAS,CAAC;QACf,CAAC,EAAE,EAAE,aAAa,CAAC;QACnB,CAAC,EAAE,EAAE,OAAO,CAAC;QACb,CAAC,EAAE,EAAE,iBAAiB,CAAC;QACvB,CAAC,EAAE,EAAE,qBAAqB,CAAC;QAC3B,CAAC,EAAE,EAAE,cAAc,CAAC;QACpB,CAAC,EAAE,EAAE,YAAY,CAAC;QAClB,CAAC,EAAE,EAAE,eAAe,CAAC;KACtB,CAAC;IACF,8EAA8E;IACvE,MAAM,CAAC,gBAAgB,CAAC,QAAgB;QAC7C,KAAK,MAAM,KAAK,IAAI,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;YAC3D,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;gBACvB,OAAO,KAAK,CAAC,CAAC,CAAW,CAAC;QAC9B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,uDAAuD;IAChD,MAAM,CAAC,gBAAgB,CAAC,CAAS,EAAE,oBAA6B,IAAI;QACzE,KAAK,MAAM,KAAK,IAAI,oBAAoB,CAAC,iBAAiB,EAAE,CAAC;YAC3D,IAAI,mBAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAW,CAAC;gBACnD,OAAO,KAAK,CAAC,CAAC,CAAW,CAAC;QAC9B,CAAC;QACD,OAAO,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5C,CAAC;IACD,0DAA0D;IACnD,MAAM,CAAC,kBAAkB,CAAC,QAAgB;QAC/C,OAAO,QAAQ,IAAI,EAAE,CAAC;IACxB,CAAC;;AA5CH,oDA6CC","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*--------------------------------------------------------------------------------------------*/\nimport { flatbuffers } from \"flatbuffers\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { AkimaCurve3d, AkimaCurve3dOptions } from \"../bspline/AkimaCurve3d\";\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\nimport { BSplineSurface3d, BSplineSurface3dH, UVSelect } from \"../bspline/BSplineSurface\";\nimport { InterpolationCurve3d, InterpolationCurve3dOptions } from \"../bspline/InterpolationCurve3d\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { BagOfCurves, CurveCollection } from \"../curve/CurveCollection\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { GeometryQuery } from \"../curve/GeometryQuery\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { ParityRegion } from \"../curve/ParityRegion\";\nimport { Path } from \"../curve/Path\";\nimport { PointString3d } from \"../curve/PointString3d\";\nimport { DirectSpiral3d } from \"../curve/spiral/DirectSpiral3d\";\nimport { IntegratedSpiral3d } from \"../curve/spiral/IntegratedSpiral3d\";\nimport { TransitionSpiral3d } from \"../curve/spiral/TransitionSpiral3d\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { NumberArray, Point3dArray } from \"../geometry3d/PointHelpers\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Segment1d } from \"../geometry3d/Segment1d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { AuxChannel, AuxChannelData, PolyfaceAuxData } from \"../polyface/AuxData\";\nimport { IndexedPolyface } from \"../polyface/Polyface\";\nimport { TaggedNumericData } from \"../polyface/TaggedNumericData\";\nimport { Box } from \"../solid/Box\";\nimport { Cone } from \"../solid/Cone\";\nimport { LinearSweep } from \"../solid/LinearSweep\";\nimport { RotationalSweep } from \"../solid/RotationalSweep\";\nimport { RuledSweep } from \"../solid/RuledSweep\";\nimport { SolidPrimitive } from \"../solid/SolidPrimitive\";\nimport { Sphere } from \"../solid/Sphere\";\nimport { TorusPipe } from \"../solid/TorusPipe\";\nimport { BGFBAccessors } from \"./BGFBAccessors\";\nimport { SerializationHelpers } from \"./SerializationHelpers\";\n\n/** * Context to write to a flatbuffer blob.\n * * This class is internal.\n * * Public access is through BentleyGeometryFlatBuffer.geometryToBytes()\n * @internal\n */\nexport class BGFBReader {\n public constructor() {\n }\n /**\n * Extract a bspline surface\n * @param variant read position in the flat buffer.\n */\n public readBSplineSurfaceFromVariant(variantHeader: BGFBAccessors.VariantGeometry): BSplineSurface3d | BSplineSurface3dH | undefined {\n let newSurface: BSplineSurface3d | BSplineSurface3dH | undefined;\n const geometryType = variantHeader.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagBsplineSurface) {\n const bsurfHeader = variantHeader.geometry(new BGFBAccessors.BsplineSurface());\n if (bsurfHeader !== null) {\n const orderU = bsurfHeader.orderU();\n const orderV = bsurfHeader.orderV();\n const numPolesU = bsurfHeader.numPolesU();\n const numPolesV = bsurfHeader.numPolesV();\n const xyzArray = bsurfHeader.polesArray();\n const knotArrayU = bsurfHeader.knotsUArray();\n const knotArrayV = bsurfHeader.knotsVArray();\n const weightArray = bsurfHeader.weightsArray();\n const closedU = bsurfHeader.closedU();\n const closedV = bsurfHeader.closedV();\n\n if (xyzArray !== null && knotArrayU !== null && knotArrayV !== null) {\n const myData = SerializationHelpers.createBSplineSurfaceData(xyzArray, 3, knotArrayU, numPolesU, orderU, knotArrayV, numPolesV, orderV);\n if (weightArray !== null)\n myData.weights = weightArray;\n if (closedU)\n myData.uParams.closed = true;\n if (closedV)\n myData.vParams.closed = true;\n\n if (SerializationHelpers.Import.prepareBSplineSurfaceData(myData, { jsonPoles: false })) {\n if (undefined === myData.weights)\n newSurface = BSplineSurface3d.create(myData.poles as Float64Array, myData.uParams.numPoles, myData.uParams.order, myData.uParams.knots, myData.vParams.numPoles, myData.vParams.order, myData.vParams.knots);\n else\n newSurface = BSplineSurface3dH.create(myData.poles as Float64Array, myData.weights as Float64Array, myData.uParams.numPoles, myData.uParams.order, myData.uParams.knots, myData.vParams.numPoles, myData.vParams.order, myData.vParams.knots);\n\n if (undefined !== newSurface) {\n if (undefined !== myData.uParams.wrapMode)\n newSurface.setWrappable(UVSelect.uDirection, myData.uParams.wrapMode);\n if (undefined !== myData.vParams.wrapMode)\n newSurface.setWrappable(UVSelect.vDirection, myData.vParams.wrapMode);\n }\n }\n }\n }\n }\n return newSurface;\n }\n\n /**\n * Extract an interpolating curve\n * @param header read position in the flat buffer.\n */\n public readInterpolationCurve3d(header: BGFBAccessors.InterpolationCurve): InterpolationCurve3d | undefined {\n const xyzArray = header.fitPointsArray();\n if (xyzArray instanceof Float64Array) {\n const knots = header.knotsArray();\n const options = new InterpolationCurve3dOptions(Point3dArray.clonePoint3dArray(xyzArray), knots ? NumberArray.create(knots) : undefined);\n const startTangent = header.startTangent();\n const endTangent = header.endTangent();\n options.captureOptionalProps(\n header.order(),\n header.closed(),\n header.isChordLenKnots(),\n header.isColinearTangents(),\n header.isChordLenTangents(),\n header.isNaturalTangents(),\n startTangent !== null ? Vector3d.create(startTangent.x(), startTangent.y(), startTangent.z()) : undefined,\n endTangent !== null ? Vector3d.create(endTangent.x(), endTangent.y(), endTangent.z()) : undefined);\n return InterpolationCurve3d.createCapture(options);\n }\n return undefined;\n }\n\n /**\n * Extract an akima curve\n * @param header read position in the flat buffer.\n */\n public readAkimaCurve3d(header: BGFBAccessors.AkimaCurve): AkimaCurve3d | undefined {\n const xyzArray = header.pointsArray();\n if (xyzArray instanceof Float64Array) {\n const options = new AkimaCurve3dOptions(Point3dArray.clonePoint3dArray(xyzArray));\n return AkimaCurve3d.createCapture(options);\n }\n return undefined;\n }\n /**\n * Extract a bspline curve\n * @param variant read position in the flat buffer.\n */\n public readBSplineCurve(header: BGFBAccessors.BsplineCurve): BSplineCurve3d | BSplineCurve3dH | undefined {\n let newCurve: BSplineCurve3d | BSplineCurve3dH | undefined;\n const order = header.order();\n const xyzArray = header.polesArray();\n const knots = header.knotsArray();\n const weightsArray = header.weightsArray();\n const closed = header.closed();\n\n if (xyzArray !== null && knots !== null) {\n const numPoles = Math.floor(xyzArray.length / 3);\n const myData = SerializationHelpers.createBSplineCurveData(xyzArray, 3, knots, numPoles, order);\n if (closed)\n myData.params.closed = true;\n\n if (weightsArray === null) {\n if (SerializationHelpers.Import.prepareBSplineCurveData(myData))\n newCurve = BSplineCurve3d.create(myData.poles, myData.params.knots, myData.params.order);\n } else {\n myData.weights = weightsArray;\n if (SerializationHelpers.Import.prepareBSplineCurveData(myData, { jsonPoles: false }))\n newCurve = BSplineCurve3dH.create({ xyz: myData.poles as Float64Array, weights: myData.weights }, myData.params.knots, myData.params.order);\n }\n\n if (undefined !== newCurve) {\n if (undefined !== myData.params.wrapMode)\n newCurve.setWrappable(myData.params.wrapMode);\n }\n }\n return newCurve;\n }\n /**\n * Extract a bspline curve\n * @param variant read position in the flat buffer.\n */\n public readTransitionSpiral(header: BGFBAccessors.TransitionSpiral): TransitionSpiral3d | undefined {\n const detailHeader = header.detail();\n if (detailHeader) {\n const directDetailHeader = header.directDetail();\n const _extraDataArray = header.extraDataArray();\n const spiralTypeName = DgnSpiralTypeQueries.typeCodeToString(detailHeader.spiralType());\n const curvature0 = detailHeader.curvature0();\n const curvature1 = detailHeader.curvature1();\n const bearing0Radians = detailHeader.bearing0Radians();\n const bearing1Radians = detailHeader.bearing1Radians();\n const fbTransform = detailHeader.transform();\n const localToWorld = fbTransform ? Transform.createRowValues(\n fbTransform.axx(), fbTransform.axy(), fbTransform.axz(), fbTransform.axw(),\n fbTransform.ayx(), fbTransform.ayy(), fbTransform.ayz(), fbTransform.ayw(),\n fbTransform.azx(), fbTransform.azy(), fbTransform.azz(), fbTransform.azw()) :\n Transform.createIdentity();\n\n const activeFractionInterval = Segment1d.create(detailHeader.fractionA(),\n detailHeader.fractionB());\n if (!directDetailHeader) {\n const integratedSpiral = IntegratedSpiral3d.createRadiusRadiusBearingBearing(\n Segment1d.create(IntegratedSpiral3d.curvatureToRadius(curvature0), IntegratedSpiral3d.curvatureToRadius(curvature1)),\n AngleSweep.createStartEndRadians(bearing0Radians, bearing1Radians),\n activeFractionInterval, localToWorld, spiralTypeName);\n if (integratedSpiral)\n return integratedSpiral;\n const radius0 = TransitionSpiral3d.curvatureToRadius(curvature0);\n const radius1 = TransitionSpiral3d.curvatureToRadius(curvature1);\n const arcLength = TransitionSpiral3d.radiusRadiusSweepRadiansToArcLength(radius0, radius1,\n bearing1Radians - bearing0Radians);\n const directSpiral = DirectSpiral3d.createFromLengthAndRadius(\n spiralTypeName!,\n radius0, radius1,\n Angle.createRadians(bearing0Radians),\n Angle.createRadians(bearing1Radians),\n arcLength,\n activeFractionInterval,\n localToWorld);\n if (directSpiral)\n return directSpiral;\n }\n }\n return undefined;\n }\n /**\n * Extract a curve primitive\n * @param variant read position in the flat buffer.\n */\n public readCurvePrimitiveFromVariant(variant: BGFBAccessors.VariantGeometry): CurvePrimitive | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagLineSegment) {\n const offsetToLineSegment = variant.geometry(new BGFBAccessors.LineSegment());\n const offsetToCoordinates = offsetToLineSegment!.segment();\n return LineSegment3d.createXYZXYZ(\n offsetToCoordinates!.point0X(), offsetToCoordinates!.point0Y(), offsetToCoordinates!.point0Z(),\n offsetToCoordinates!.point1X(), offsetToCoordinates!.point1Y(), offsetToCoordinates!.point1Z());\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagEllipticArc) {\n const offsetToEllipticArc = variant.geometry(new BGFBAccessors.EllipticArc());\n const offsetToCoordinates = offsetToEllipticArc!.arc()!;\n return Arc3d.createXYZXYZXYZ(\n offsetToCoordinates.centerX(), offsetToCoordinates.centerY(), offsetToCoordinates.centerZ(),\n offsetToCoordinates.vector0X(), offsetToCoordinates.vector0Y(), offsetToCoordinates.vector0Z(),\n offsetToCoordinates.vector90X(), offsetToCoordinates.vector90Y(), offsetToCoordinates.vector90Z(),\n AngleSweep.createStartSweepRadians(offsetToCoordinates.startRadians(), offsetToCoordinates?.sweepRadians()));\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagLineString) {\n const offsetToLineString = variant.geometry(new BGFBAccessors.LineString())!;\n const numCoordinates = offsetToLineString.pointsLength();\n const result = LineString3d.create();\n for (let i = 0; i + 2 < numCoordinates; i += 3) {\n result.packedPoints.pushXYZ(offsetToLineString.points(i)!, offsetToLineString.points(i + 1)!, offsetToLineString.points(i + 2)!);\n }\n return result;\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagBsplineCurve) {\n const offsetToBCurve = variant.geometry(new BGFBAccessors.BsplineCurve());\n if (offsetToBCurve !== null)\n return this.readBSplineCurve(offsetToBCurve);\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagTransitionSpiral) {\n const offsetToTransitionSpiralTable = variant.geometry(new BGFBAccessors.TransitionSpiral());\n if (offsetToTransitionSpiralTable !== null)\n return this.readTransitionSpiral(offsetToTransitionSpiralTable);\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagInterpolationCurve) {\n const offsetToInterpolationCurveTable = variant.geometry(new BGFBAccessors.InterpolationCurve());\n if (offsetToInterpolationCurveTable !== null)\n return this.readInterpolationCurve3d(offsetToInterpolationCurveTable);\n } else if (geometryType === BGFBAccessors.VariantGeometryUnion.tagAkimaCurve) {\n const offsetToAkimaCurveTable = variant.geometry(new BGFBAccessors.AkimaCurve());\n if (offsetToAkimaCurveTable !== null)\n return this.readAkimaCurve3d(offsetToAkimaCurveTable);\n }\n return undefined;\n }\n /**\n * Extract a curve primitive\n * @param variant read position in the flat buffer.\n */\n public readPointStringFromVariant(variant: BGFBAccessors.VariantGeometry): PointString3d | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagPointString) {\n const offsetToLineString = variant.geometry(new BGFBAccessors.PointString())!;\n const numCoordinates = offsetToLineString.pointsLength();\n const result = PointString3d.create();\n for (let i = 0; i + 2 < numCoordinates; i += 3) {\n result.points.push(Point3d.create(offsetToLineString.points(i)!, offsetToLineString.points(i + 1)!, offsetToLineString.points(i + 2)!));\n }\n return result;\n }\n return undefined;\n }\n /** Extract auxData channel data for a mesh */\n public readPolyfaceAuxChannelData(channelDataHeader: BGFBAccessors.PolyfaceAuxChannelData | null): AuxChannelData | undefined {\n if (channelDataHeader !== null) {\n const input = channelDataHeader.input();\n const values = channelDataHeader.valuesArray();\n if (values !== null)\n return new AuxChannelData(input, values);\n }\n return undefined;\n }\n\n /** Extract auxData channel for a mesh */\n public readPolyfaceAuxChannel(channelHeader: BGFBAccessors.PolyfaceAuxChannel | null): AuxChannel | undefined {\n if (channelHeader) {\n const dataType = channelHeader.dataType();\n const dataLength = channelHeader.dataLength();\n const channelDataArray: AuxChannelData[] = [];\n const name = channelHeader.name();\n const inputName = channelHeader.inputName();\n for (let i = 0; i < dataLength; i++) {\n const channelData = this.readPolyfaceAuxChannelData(channelHeader.data(i));\n if (channelData)\n channelDataArray.push(channelData);\n }\n return new AuxChannel(channelDataArray, dataType, name ? name : undefined, inputName ? inputName : undefined);\n }\n return undefined;\n }\n\n /** Compute the number of logical entries in every flat data array in the AuxData */\n private static channelDataLength(fbAuxData: BGFBAccessors.PolyfaceAuxData): number {\n if (fbAuxData.channelsLength() <= 0)\n return 0;\n\n const fbChannel0 = nullToUndefined<BGFBAccessors.PolyfaceAuxChannel>(fbAuxData.channels(0));\n if (!fbChannel0)\n return 0;\n\n const numChannel0Data = fbChannel0.dataLength();\n if (numChannel0Data <= 0)\n return 0;\n\n const fbChannel0Data0 = nullToUndefined<BGFBAccessors.PolyfaceAuxChannelData>(fbChannel0.data(0));\n if (!fbChannel0Data0)\n return 0;\n\n const numChannelDataValues = fbChannel0Data0.valuesLength();\n if (numChannelDataValues <= 0)\n return 0;\n\n return numChannelDataValues / AuxChannel.entriesPerValue(fbChannel0.dataType());\n }\n\n /** Examine int array for range and zero count */\n private countIntArray(ints: Int32Array): { min: number, max: number, numZeroes: number } {\n let min = Infinity;\n let max = -Infinity;\n let numZeroes = 0;\n for (const i of ints) {\n if (min > i)\n min = i;\n if (max < i)\n max = i;\n if (0 === i)\n ++numZeroes;\n }\n return { min, max, numZeroes };\n }\n\n /**\n * Extract auxData for a mesh.\n * Typescript object format for Polyface/PolyfaceAuxData indices is 0-based, unterminated.\n * FlatBuffer format for Polyface/PolyfaceAuxData indices is 1-based, 0-terminated/padded.\n * Typescript API previously wrote FlatBuffer PolyfaceAuxData indices as 0-based, unterminated;\n * heuristics are used herein to identify this legacy format so it can still be read.\n */\n public readPolyfaceAuxData(fbPolyface: BGFBAccessors.Polyface | null, fbAuxData: BGFBAccessors.PolyfaceAuxData | null): PolyfaceAuxData | undefined {\n if (!fbPolyface || !fbAuxData)\n return undefined;\n\n const fbPointIndices = nullToUndefined<Int32Array>(fbPolyface.pointIndexArray());\n const fbAuxIndices = nullToUndefined<Int32Array>(fbAuxData.indicesArray());\n const numChannels = fbAuxData.channelsLength();\n const fbNumData = BGFBReader.channelDataLength(fbAuxData);\n if (!fbPointIndices || !fbPointIndices.length || !fbAuxIndices || !fbAuxIndices.length || numChannels <= 0 || fbNumData <= 0)\n return undefined;\n\n const numPerFace = fbPolyface.numPerFace();\n\n // HEURISTICS to detect legacy AuxData indices, previously mistakenly serialized by BGFBWriter.writePolyfaceAsFBVariantGeometry as 0-based unblocked indices\n let isLegacy = false;\n const pointIndicesPadCount = fbPointIndices.filter((index) => index === 0).length;\n if (numPerFace > 1) {\n const auxIndexCounts = this.countIntArray(fbAuxIndices);\n if (auxIndexCounts.max > fbNumData) // auxIndices invalid\n return undefined;\n if (auxIndexCounts.max === fbNumData) // auxIndices 1-based\n isLegacy = false;\n else if (auxIndexCounts.max <= 0 || auxIndexCounts.min < 0) // auxIndices 1-based (signed)\n isLegacy = false;\n else if (auxIndexCounts.min === 0) // auxIndices likely legacy 0-based index, but could be modern with padding\n isLegacy = pointIndicesPadCount !== auxIndexCounts.numZeroes;\n else if (auxIndexCounts.min > 0) // auxIndices likely modern without padding, but could be legacy if first datum not indexed\n isLegacy = pointIndicesPadCount > 0;\n } else {\n isLegacy = (fbAuxIndices.length < fbPointIndices.length) && (fbAuxIndices.length + pointIndicesPadCount === fbPointIndices.length);\n }\n if (!isLegacy && fbAuxIndices.length !== fbPointIndices.length)\n return undefined; // auxIndices invalid\n\n const indices: number[] = [];\n if (isLegacy)\n SerializationHelpers.announceZeroBasedIndicesWithExternalBlocking(fbAuxIndices, fbPointIndices, numPerFace, (i0: number) => { indices.push(i0); });\n else\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(fbAuxIndices, numPerFace, (i0: number) => { indices.push(i0); });\n if (indices.length + pointIndicesPadCount !== fbPointIndices.length)\n return undefined;\n const maxIndex = Math.max(...indices);\n\n const channels: AuxChannel[] = [];\n for (let i = 0; i < numChannels; i++) {\n const channelHeader = fbAuxData.channels(i);\n const channelContent = this.readPolyfaceAuxChannel(channelHeader);\n if (channelContent) {\n if (maxIndex >= channelContent.valueCount)\n return undefined; // invalid index\n channels.push(channelContent);\n }\n }\n if (!channels.length)\n return undefined;\n\n return new PolyfaceAuxData(channels, indices);\n }\n\n /** Extract tagged numeric data for a mesh */\n public readTaggedNumericData(accessor: BGFBAccessors.TaggedNumericData | undefined): TaggedNumericData | undefined {\n if (accessor) {\n const taggedNumericData = new TaggedNumericData(accessor.tagA(), accessor.tagB());\n const intDataArray = nullToUndefined<Int32Array>(accessor.intDataArray());\n const doubleDataArray = nullToUndefined<Float64Array>(accessor.doubleDataArray());\n if (intDataArray) {\n taggedNumericData.intData = [];\n for (const c of intDataArray)\n taggedNumericData.intData.push(c);\n\n }\n if (doubleDataArray) {\n taggedNumericData.doubleData = [];\n for (const c of doubleDataArray)\n taggedNumericData.doubleData.push(c);\n }\n return taggedNumericData;\n }\n return undefined;\n }\n\n /**\n * Extract a mesh\n * @param variant read position in the flat buffer.\n */\n public readPolyfaceFromVariant(variant: BGFBAccessors.VariantGeometry): IndexedPolyface | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagPolyface) {\n const polyfaceHeader = variant.geometry(new BGFBAccessors.Polyface());\n if (polyfaceHeader) {\n const twoSided = polyfaceHeader.twoSided();\n const expectedClosure = polyfaceHeader.expectedClosure();\n const meshStyle = polyfaceHeader.meshStyle();\n const numPerFace = polyfaceHeader.numPerFace();\n\n const pointF64 = nullToUndefined<Float64Array>(polyfaceHeader.pointArray());\n const paramF64 = nullToUndefined<Float64Array>(polyfaceHeader.paramArray());\n const normalF64 = nullToUndefined<Float64Array>(polyfaceHeader.normalArray());\n const intColorU32 = nullToUndefined<Uint32Array>(polyfaceHeader.intColorArray());\n\n const pointIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.pointIndexArray());\n const paramIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.paramIndexArray());\n const normalIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.normalIndexArray());\n const colorIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.colorIndexArray());\n const edgeMateIndexI32 = nullToUndefined<Int32Array>(polyfaceHeader.edgeMateIndexArray());\n const taggedNumericDataOffset = polyfaceHeader.taggedNumericData();\n\n // FB polyfaces are always indexed face loop style, but we recognize both variable and fixed-size face loops.\n // (BGFBWriter only writes variable-sized face loops, but native FBWriter can write both.)\n assert(meshStyle === 1, \"Unrecognized flatbuffer mesh style\");\n\n if (meshStyle === 1 && pointF64 && pointIndexI32) {\n const polyface = IndexedPolyface.create();\n polyface.twoSided = twoSided;\n polyface.expectedClosure = expectedClosure;\n\n // Flatbuffer parallel index array values are:\n // * signed 1-based index into the respective data array\n // * 0 indicates variable-sized face loop terminator (numPerFace < 2)\n // * 0 indicates fixed-sized face loop padding (numPerFace >= 2)\n // Native format is the same as flatbuffer.\n // TypeScript format is 0-based indices sans terminator/padding\n if (normalF64 && normalIndexI32) {\n for (let i = 0; i + 2 < normalF64.length; i += 3)\n polyface.addNormalXYZ(normalF64[i], normalF64[i + 1], normalF64[i + 2]);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(normalIndexI32, numPerFace,\n (i: number) => { polyface.addNormalIndex(i); });\n }\n if (paramF64 && paramIndexI32) {\n for (let i = 0; i + 1 < paramF64.length; i += 2)\n polyface.addParamUV(paramF64[i], paramF64[i + 1]);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(paramIndexI32, numPerFace,\n (i: number) => { polyface.addParamIndex(i); });\n }\n if (intColorU32 && colorIndexI32) {\n for (const c of intColorU32)\n polyface.addColor(c);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(colorIndexI32, numPerFace,\n (i: number) => { polyface.addColorIndex(i); });\n }\n\n // the second callback below builds up the facetStart array as we process the main point index array\n for (let i = 0; i + 2 < pointF64.length; i += 3)\n polyface.addPointXYZ(pointF64[i], pointF64[i + 1], pointF64[i + 2]);\n SerializationHelpers.announceZeroBasedIndicesFromSignedOneBasedIndices(pointIndexI32, numPerFace,\n (i: number, v?: boolean) => { polyface.addPointIndex(i, v); },\n () => { polyface.terminateFacet(false); });\n\n // FB/JSON/native edgeMateIndex array format:\n // 0-based edgeMate indices into the parallel Polyface index arrays (and edgeMateIndex!),\n // -1 terminator/pad, not present in TypeScript,\n // -2 for \"no edgeMate\", maps to `undefined` in TypeScript\n if (edgeMateIndexI32) {\n const edgeMateIndex: Array<number | undefined> = [];\n if (SerializationHelpers.announceCompressedZeroBasedReflexiveIndices(edgeMateIndexI32, numPerFace,\n SerializationHelpers.EdgeMateIndex.BlockSeparator, SerializationHelpers.EdgeMateIndex.NoEdgeMate,\n (i: number | undefined) => edgeMateIndex.push(i),\n )) {\n polyface.data.edgeMateIndex = edgeMateIndex;\n }\n }\n\n if (!polyface.validateAllIndices())\n return undefined;\n\n polyface.data.auxData = this.readPolyfaceAuxData(polyfaceHeader, polyfaceHeader.auxData());\n\n if (taggedNumericDataOffset) {\n const taggedNumericDataAccessor = nullToUndefined<BGFBAccessors.TaggedNumericData>(taggedNumericDataOffset);\n if (taggedNumericDataAccessor !== undefined) {\n const taggedNumericData = this.readTaggedNumericData(taggedNumericDataAccessor);\n if (taggedNumericData !== undefined)\n polyface.data.setTaggedNumericData(taggedNumericData);\n }\n }\n\n // NOTE: faceData is ignored\n return polyface;\n }\n }\n }\n return undefined;\n }\n\n public readCurveCollectionFromCurveVectorTable(cvTable: BGFBAccessors.CurveVector): CurveCollection {\n const numChildren = cvTable.curvesLength();\n const collectionType = cvTable.type();\n const collection = createTypedCurveCollection(collectionType);\n for (let i = 0; i < numChildren; i++) {\n const childOffset = cvTable.curves(i);\n if (childOffset !== null) {\n const child = this.readCurvePrimitiveFromVariant(childOffset);\n if (child)\n collection.tryAddChild(child);\n else {\n const childCollection = this.readCurveCollectionFromVariantGeometry(childOffset);\n if (childCollection)\n collection.tryAddChild(childCollection);\n }\n }\n }\n return collection;\n }\n /**\n * Extract a curve collection\n * @param variant read position in the flat buffer.\n */\n public readCurveCollectionFromVariantGeometry(variant: BGFBAccessors.VariantGeometry): CurveCollection | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagCurveVector) {\n const cvTable = variant.geometry(new BGFBAccessors.CurveVector())!;\n return this.readCurveCollectionFromCurveVectorTable(cvTable);\n }\n return undefined;\n }\n /**\n * Extract a curve collection\n * @param variant read position in the flat buffer.\n */\n public readSolidPrimitiveFromVariant(variant: BGFBAccessors.VariantGeometry): SolidPrimitive | undefined {\n const geometryType = variant.geometryType();\n if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnBox) {\n const header = variant.geometry(new BGFBAccessors.DgnBox());\n const detail = header!.detail()!;\n return Box.createDgnBox(\n Point3d.create(detail.baseOriginX(), detail.baseOriginY(), detail.baseOriginZ()),\n Vector3d.create(detail.vectorXX(), detail.vectorXY(), detail.vectorXZ()),\n Vector3d.create(detail.vectorYX(), detail.vectorYY(), detail.vectorYZ()),\n Point3d.create(detail.topOriginX(), detail.topOriginY(), detail.topOriginZ()),\n detail.baseX(), detail.baseY(), detail.topX(), detail.topY(),\n detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnSphere) {\n const header = variant.geometry(new BGFBAccessors.DgnSphere());\n const detail = header!.detail()!;\n const lToWDetail = detail.localToWorld()!;\n const localToWorld = Transform.createRowValues(\n lToWDetail.axx(), lToWDetail.axy(), lToWDetail.axz(), lToWDetail.axw(),\n lToWDetail.ayx(), lToWDetail.ayy(), lToWDetail.ayz(), lToWDetail.ayw(),\n lToWDetail.azx(), lToWDetail.azy(), lToWDetail.azz(), lToWDetail.azw());\n return Sphere.createEllipsoid(localToWorld,\n AngleSweep.createStartSweepRadians(detail.startLatitudeRadians(), detail.latitudeSweepRadians()),\n detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnCone) {\n const header = variant.geometry(new BGFBAccessors.DgnCone());\n const detail = header!.detail()!;\n const centerA = Point3d.create(detail.centerAX(), detail.centerAY(), detail.centerAZ());\n const centerB = Point3d.create(detail.centerBX(), detail.centerBY(), detail.centerBZ());\n const vector0 = Vector3d.create(detail.vector0X(), detail.vector0Y(), detail.vector0Z());\n const vector90 = Vector3d.create(detail.vector90X(), detail.vector90Y(), detail.vector90Z());\n const radiusA = detail.radiusA();\n const radiusB = detail.radiusB();\n return Cone.createBaseAndTarget(centerA, centerB, vector0, vector90, radiusA, radiusB, detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnTorusPipe) {\n const header = variant.geometry(new BGFBAccessors.DgnTorusPipe())!;\n const detail = header.detail()!;\n const center = Point3d.create(detail.centerX(), detail.centerY(), detail.centerZ());\n const vectorX = Vector3d.create(detail.vectorXX(), detail.vectorXY(), detail.vectorXZ());\n const vectorY = Vector3d.create(detail.vectorYX(), detail.vectorYY(), detail.vectorYZ());\n const sweepRadians = detail.sweepRadians();\n const majorRadius = detail.majorRadius();\n const minorRadius = detail.minorRadius();\n return TorusPipe.createDgnTorusPipe(center, vectorX, vectorY, majorRadius, minorRadius, Angle.createRadians(sweepRadians), detail.capped());\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnExtrusion) {\n const header = variant.geometry(new BGFBAccessors.DgnExtrusion())!;\n const dVector = new BGFBAccessors.DVector3d();\n header.extrusionVector(dVector);\n const extrusionVector = Vector3d.create(dVector.x(), dVector.y(), dVector.z());\n const baseCurve = header.baseCurve();\n if (baseCurve !== null) {\n const contour = this.readCurveCollectionFromCurveVectorTable(baseCurve);\n return LinearSweep.create(contour, extrusionVector, header.capped());\n }\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnRotationalSweep) {\n const header = variant.geometry(new BGFBAccessors.DgnRotationalSweep())!;\n const dAxis = new BGFBAccessors.DRay3d();\n header.axis(dAxis);\n const axis = Ray3d.createXYZUVW(dAxis.x(), dAxis.y(), dAxis.z(), dAxis.ux(), dAxis.uy(), dAxis.uz());\n const sweepAngle = Angle.createRadians(header.sweepRadians());\n // const numVRules = header.numVRules();\n const baseCurve = header.baseCurve();\n if (baseCurve !== null) {\n const contour = this.readCurveCollectionFromCurveVectorTable(baseCurve);\n return RotationalSweep.create(contour, axis, sweepAngle, header.capped());\n }\n } if (geometryType === BGFBAccessors.VariantGeometryUnion.tagDgnRuledSweep) {\n const header = variant.geometry(new BGFBAccessors.DgnRuledSweep())!;\n const numCurves = header.curvesLength();\n const contours: CurveCollection[] = [];\n for (let i = 0; i < numCurves; i++) {\n const contourTable = header.curves(i);\n if (contourTable) {\n const contour = this.readCurveCollectionFromCurveVectorTable(contourTable);\n if (contour)\n contours.push(contour);\n }\n }\n if (contours.length > 0) {\n return RuledSweep.create(contours, header.capped());\n }\n }\n return undefined;\n }\n /**\n * Extract any geometry type or array of geometry.\n * @param variant read position in the flat buffer.\n */\n public readGeometryQueryFromVariant(variant: BGFBAccessors.VariantGeometry): GeometryQuery | GeometryQuery[] | undefined {\n const rootType = variant.geometryType();\n switch (rootType) {\n case BGFBAccessors.VariantGeometryUnion.tagLineSegment:\n case BGFBAccessors.VariantGeometryUnion.tagLineString:\n case BGFBAccessors.VariantGeometryUnion.tagEllipticArc:\n case BGFBAccessors.VariantGeometryUnion.tagBsplineCurve:\n case BGFBAccessors.VariantGeometryUnion.tagTransitionSpiral:\n case BGFBAccessors.VariantGeometryUnion.tagInterpolationCurve:\n case BGFBAccessors.VariantGeometryUnion.tagAkimaCurve: {\n return this.readCurvePrimitiveFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagCurveVector: {\n return this.readCurveCollectionFromVariantGeometry(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagPolyface: {\n return this.readPolyfaceFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagDgnBox:\n case BGFBAccessors.VariantGeometryUnion.tagDgnCone:\n case BGFBAccessors.VariantGeometryUnion.tagDgnTorusPipe:\n case BGFBAccessors.VariantGeometryUnion.tagDgnSphere:\n case BGFBAccessors.VariantGeometryUnion.tagDgnExtrusion:\n case BGFBAccessors.VariantGeometryUnion.tagDgnRotationalSweep:\n case BGFBAccessors.VariantGeometryUnion.tagDgnRuledSweep: {\n return this.readSolidPrimitiveFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagVectorOfVariantGeometry: {\n const geometry: GeometryQuery[] = [];\n const offsetToVectorOfVariantGeometry = variant.geometry(new BGFBAccessors.VectorOfVariantGeometry());\n for (let i = 0; i < offsetToVectorOfVariantGeometry!.membersLength(); i++) {\n const child = offsetToVectorOfVariantGeometry!.members(i);\n if (child !== null) {\n const childGeometry = this.readGeometryQueryFromVariant(child);\n if (childGeometry instanceof GeometryQuery) {\n geometry.push(childGeometry);\n } else if (Array.isArray(childGeometry)) {\n geometry.push(...childGeometry);\n }\n }\n }\n return geometry;\n }\n case BGFBAccessors.VariantGeometryUnion.tagBsplineSurface: {\n return this.readBSplineSurfaceFromVariant(variant);\n }\n case BGFBAccessors.VariantGeometryUnion.tagPointString: {\n return this.readPointStringFromVariant(variant);\n }\n }\n return undefined;\n }\n /**\n * Deserialize bytes from a flatbuffer.\n * @param justTheBytes FlatBuffer bytes as created by BGFBWriter.createFlatBuffer (g);\n */\n public static bytesToGeometry(theBytes: Uint8Array, signature?: Uint8Array): GeometryQuery | GeometryQuery[] | undefined {\n const newByteBuffer = new flatbuffers.ByteBuffer(theBytes);\n if (signature) {\n if (theBytes.length < signature.length)\n return undefined;\n for (let i = 0; i < signature.length; i++)\n if (theBytes[i] !== signature[i])\n return undefined;\n newByteBuffer.setPosition(signature.length);\n }\n const root = BGFBAccessors.VariantGeometry.getRootAsVariantGeometry(newByteBuffer);\n const reader = new BGFBReader();\n return reader.readGeometryQueryFromVariant(root);\n }\n\n}\n/**\n * if data is \"null\" (the deprecated javascript idiom!) return undefined. Otherwise return the data as its own type.\n * @param data\n */\nfunction nullToUndefined<T>(data: any): T | undefined {\n if (data === null)\n return undefined;\n return data;\n}\n\nfunction createTypedCurveCollection(collectionType: number): CurveCollection {\n if (collectionType === 1) return new Path();\n if (collectionType === 2 || collectionType === 3) return new Loop();\n if (collectionType === 4) return new ParityRegion();\n if (collectionType === 5) return new UnionRegion();\n return new BagOfCurves();\n}\n/**\n * mappings between typescript spiral type strings and native integers.\n * @internal\n */\nexport class DgnSpiralTypeQueries {\n // remark: this is the full list based on native DSpiral2dBase.h.\n // This does not guarantee all types are supported.\n private static spiralTypeCodeMap = [\n [10, \"clothoid\"],\n [11, \"bloss\"],\n [12, \"biquadratic\"],\n [13, \"cosine\"],\n [14, \"sine\"],\n [15, \"Viennese\"],\n [16, \"weightedViennese\"],\n\n [50, \"WesternAustralian\"],\n [51, \"Czech\"],\n [52, \"AustralianRailCorp\"],\n [53, \"Italian\"],\n [54, \"PolishCubic\"],\n [55, \"Arema\"],\n [56, \"MXCubicAlongArc\"],\n [57, \"MXCubicAlongTangent\"],\n [58, \"ChineseCubic\"],\n [60, \"HalfCosine\"],\n [61, \"JapaneseCubic\"],\n ];\n /** Convert native integer type (e.g. from flatbuffer) to typescript string */\n public static typeCodeToString(typeCode: number): string | undefined {\n for (const entry of DgnSpiralTypeQueries.spiralTypeCodeMap) {\n if (entry[0] === typeCode)\n return entry[1] as string;\n }\n return undefined;\n }\n\n /** Convert typescript string to native integer type */\n public static stringToTypeCode(s: string, defaultToClothoid: boolean = true): number | undefined {\n for (const entry of DgnSpiralTypeQueries.spiralTypeCodeMap) {\n if (Geometry.equalStringNoCase(s, entry[1] as string))\n return entry[0] as number;\n }\n return defaultToClothoid ? 10 : undefined;\n }\n /** Ask if the indicated type code is a \"direct\" spiral */\n public static isDirectSpiralType(typeCode: number): boolean {\n return typeCode >= 50;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BGFBWriter.d.ts","sourceRoot":"","sources":["../../../src/serialization/BGFBWriter.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BGFBWriter.d.ts","sourceRoot":"","sources":["../../../src/serialization/BGFBWriter.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAY,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,C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,sCAAsC,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,MAAM,GAAG,SAAS;IA6CvG,uCAAuC,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS;IAsBpF,sCAAsC,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IA+E1F,qCAAqC,CAAC,WAAW,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;IAWrF,sCAAsC,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IA4GjF,8CAA8C,CAAC,WAAW,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IAW/F,0CAA0C,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS;IAkBnF,uCAAuC,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS;IAezG,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,GAAG,SAAS,GAAG,MAAM;IAUxE,gCAAgC,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS;IAqFlF;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAiBvB,qCAAqC,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS;IAoB3E,0CAA0C,CAAC,WAAW,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS;IAiB/H;;OAEG;WACW,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,EAAE,EAAE,cAAc,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS;CA+B1H"}
|
|
@@ -9,7 +9,6 @@ exports.BGFBWriter = void 0;
|
|
|
9
9
|
* @module Serialization
|
|
10
10
|
*/
|
|
11
11
|
const flatbuffers_1 = require("flatbuffers");
|
|
12
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
12
|
const AkimaCurve3d_1 = require("../bspline/AkimaCurve3d");
|
|
14
13
|
const BSplineCurve_1 = require("../bspline/BSplineCurve");
|
|
15
14
|
const BSplineCurve3dH_1 = require("../bspline/BSplineCurve3dH");
|
|
@@ -497,10 +496,9 @@ class BGFBWriter {
|
|
|
497
496
|
const expectedClosure = mesh.expectedClosure;
|
|
498
497
|
if (mesh.data.edgeMateIndex) {
|
|
499
498
|
indexArray.length = 0;
|
|
500
|
-
if (
|
|
501
|
-
|
|
499
|
+
if (SerializationHelpers_1.SerializationHelpers.announceUncompressedZeroBasedReflexiveIndices(mesh.data.edgeMateIndex, mesh.facetStart, SerializationHelpers_1.SerializationHelpers.EdgeMateIndex.BlockSeparator, SerializationHelpers_1.SerializationHelpers.EdgeMateIndex.NoEdgeMate, (i) => indexArray.push(i))) {
|
|
500
|
+
edgeMateIndexOffset = BGFBAccessors_1.BGFBAccessors.Polyface.createEdgeMateIndexVector(this.builder, indexArray);
|
|
502
501
|
}
|
|
503
|
-
edgeMateIndexOffset = BGFBAccessors_1.BGFBAccessors.Polyface.createEdgeMateIndexVector(this.builder, indexArray);
|
|
504
502
|
}
|
|
505
503
|
// NOTE: mesh.data.face is not persistent
|
|
506
504
|
const polyfaceOffset = BGFBAccessors_1.BGFBAccessors.Polyface.createPolyface(this.builder, pointOffset, paramOffset, normalOffset, 0, intColorOffset, pointIndexOffset, paramIndexOffset, normalIndexOffset, colorIndexOffset, 0, numPerFace, 0, meshStyle, twoSided, 0, 0, auxDataOffset, expectedClosure, taggedNumericDataOffset, edgeMateIndexOffset);
|