@loaders.gl/tile-converter 3.3.0-alpha.1 → 3.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-attributes-worker.js +3 -3
- package/dist/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/converter.min.js +10 -10
- package/dist/dist.min.js +791 -554
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +15 -4
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +60 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +39 -7
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +161 -49
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +102 -46
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +235 -141
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +66 -28
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +15 -4
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +34 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +23 -7
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +132 -30
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +3 -3
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +32 -42
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +10 -0
- package/dist/esm/lib/utils/write-queue.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-attributes-worker.js +3 -3
- package/dist/i3s-attributes-worker.js.map +2 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +12 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +24 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/feature-attributes.js +55 -0
- package/dist/i3s-converter/helpers/geometry-attributes.js +26 -7
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -2
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +124 -33
- package/dist/i3s-converter/helpers/node-pages.js +3 -3
- package/dist/i3s-converter/i3s-converter.d.ts +7 -14
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +56 -50
- package/dist/i3s-converter/types.d.ts +0 -48
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.d.ts +1 -0
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +13 -0
- package/package.json +15 -15
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +22 -5
- package/src/i3s-converter/helpers/feature-attributes.ts +65 -0
- package/src/i3s-converter/helpers/geometry-attributes.ts +30 -7
- package/src/i3s-converter/helpers/geometry-converter.ts +161 -37
- package/src/i3s-converter/helpers/node-pages.ts +3 -3
- package/src/i3s-converter/i3s-converter.ts +41 -51
- package/src/i3s-converter/types.ts +0 -51
- package/src/lib/utils/write-queue.ts +12 -0
|
@@ -121,7 +121,7 @@ export default class NodePages {
|
|
|
121
121
|
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
122
122
|
const nodePageStr = JSON.stringify(nodePage);
|
|
123
123
|
const slpkPath = join(layers0Path, 'nodepages');
|
|
124
|
-
writeQueue.enqueue({
|
|
124
|
+
await writeQueue.enqueue({
|
|
125
125
|
archiveKey: "nodePages/".concat(index.toString(), ".json.gz"),
|
|
126
126
|
writePromise: this.writeFile(slpkPath, nodePageStr, "".concat(index.toString(), ".json"))
|
|
127
127
|
});
|
|
@@ -131,7 +131,7 @@ export default class NodePages {
|
|
|
131
131
|
nodeCount: this.nodesCounter
|
|
132
132
|
}, metadataTemplate());
|
|
133
133
|
const compress = false;
|
|
134
|
-
writeQueue.enqueue({
|
|
134
|
+
await writeQueue.enqueue({
|
|
135
135
|
archiveKey: 'metadata.json',
|
|
136
136
|
writePromise: this.writeFile(layers0Path, JSON.stringify(metadata), 'metadata.json', compress)
|
|
137
137
|
});
|
|
@@ -139,7 +139,7 @@ export default class NodePages {
|
|
|
139
139
|
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
140
140
|
const nodePageStr = JSON.stringify(nodePage);
|
|
141
141
|
const nodePagePath = join(layers0Path, 'nodepages', index.toString());
|
|
142
|
-
writeQueue.enqueue({
|
|
142
|
+
await writeQueue.enqueue({
|
|
143
143
|
writePromise: this.writeFile(nodePagePath, nodePageStr)
|
|
144
144
|
});
|
|
145
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/i3s-converter/helpers/node-pages.ts"],"names":["join","transform","METADATA","metadataTemplate","NodePages","constructor","writeFileFunc","nodesPerPage","nodesCounter","nodePages","nodes","writeFile","useWriteFunction","func","getNodeById","id","pageIndex","Math","floor","nodeIndex","updateMaterialByNodeId","materialId","node","mesh","material","definition","resource","index","updateVertexCountByNodeId","vertexCount","geometry","updateNodeAttributeByNodeId","attribute","updateFeatureCountByNodeId","featureCount","updateTexelCountHintByNodeId","texelCountHint","addChildRelation","parentId","childId","undefined","parentNode","children","push","updateResourceInMesh","currentNodePage","length","save","layers0Path","writeQueue","slpk","nodePage","entries","nodePageStr","JSON","stringify","slpkPath","enqueue","archiveKey","toString","writePromise","metadata","nodeCount","compress","nodePagePath"],"mappings":";AAEA,SAAQA,IAAR,QAAmB,MAAnB;AACA,OAAOC,SAAP,MAAsB,oBAAtB;AACA,SAAQC,QAAQ,IAAIC,gBAApB,QAA2C,4BAA3C;AAqCA,eAAe,MAAMC,SAAN,CAAgB;AAY7BC,EAAAA,WAAW,CAACC,aAAD,EAAgBC,YAAhB,EAA8B;AAAA;;AAAA;;AAAA;;AAAA;;AACvC,SAAKA,YAAL,GAAoBA,YAApB;AACA,SAAKC,YAAL,GAAoB,CAApB;AAEA,SAAKC,SAAL,GAAiB,CAAC,EAAD,CAAjB;AACA,SAAKA,SAAL,CAAe,CAAf,EAAkBC,KAAlB,GAA0B,EAA1B;AACA,SAAKC,SAAL,GAAiBL,aAAjB;AACD;;AAMDM,EAAAA,gBAAgB,CAACC,IAAD,EAAuB;AACrC,SAAKF,SAAL,GAAiBE,IAAjB;AACD;;AAODC,EAAAA,WAAW,CAACC,EAAD,EAAyB;AAClC,UAAMC,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWH,EAAE,GAAG,KAAKR,YAArB,CAAlB;AACA,UAAMY,SAAS,GAAGJ,EAAE,GAAG,KAAKR,YAA5B;AACA,WAAO,KAAKE,SAAL,CAAeO,SAAf,EAA0BN,KAA1B,CAAgCS,SAAhC,CAAP;AACD;;AAODC,EAAAA,sBAAsB,CAACL,EAAD,EAAaM,UAAb,EAAuC;AAC3D,UAAMC,IAAI,GAAG,KAAKR,WAAL,CAAiBC,EAAjB,CAAb;;AACA,QAAI,CAACO,IAAI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write-queue';\n\nimport {join} from 'path';\nimport transform from 'json-map-transform';\nimport {METADATA as metadataTemplate} from '../json-templates/metadata';\nimport {NodeInPage} from '@loaders.gl/i3s';\nimport WriteQueue from '../../lib/utils/write-queue';\n\n// @ts-nocheck\n/**\n * class NodePages - wrapper of nodePages array\n *\n * @example\n * import {writeFile} from './helpers/write-file';\n *\n * // create an instance of the class\n * const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);\n * ...\n * // push root node\n * const parentId = nodePages.push({\n lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,\n obb: coordinates.obb,\n children: []\n });\n * ...\n * // push node with parent relation\n * const nodeInPage = {\n lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,\n obb: coordinates.obb,\n children: [],\n mesh: {\n geometry: {\n definition: 0\n }\n }\n };\n * const nodeId = this.nodePages.push(nodeInPage, parentId);\n * ...\n * // save all the nodePages in the end of pushing all the nodes\n * await this.nodePages.save(layers0path);\n */\nexport default class NodePages {\n readonly nodesPerPage: number;\n nodesCounter: number;\n writeFile: Function;\n readonly nodePages: {nodes: NodeInPage[]}[];\n\n /**\n * @constructs\n * Create a nodePages instance.\n * @param writeFileFunc - function to save one nodePage into a file\n * @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met\n */\n constructor(writeFileFunc, nodesPerPage) {\n this.nodesPerPage = nodesPerPage;\n this.nodesCounter = 0;\n // @ts-expect-error\n this.nodePages = [{}];\n this.nodePages[0].nodes = [];\n this.writeFile = writeFileFunc;\n }\n\n /**\n * Setup function to save node pages\n * @param func - function which should be used to save node pages\n */\n useWriteFunction(func: Function): void {\n this.writeFile = func;\n }\n\n /**\n * Get the node by its end-to-end index\n * @param id - end-to-end index of the node\n * @return the node object\n */\n getNodeById(id: number): NodeInPage {\n const pageIndex = Math.floor(id / this.nodesPerPage);\n const nodeIndex = id % this.nodesPerPage;\n return this.nodePages[pageIndex].nodes[nodeIndex];\n }\n\n /**\n * Update material in node.mesh object by node id\n * @param id - end-to-end index of the node\n * @param materialId - id from scene layer materialDefinitions\n */\n updateMaterialByNodeId(id: number, materialId: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.material = {\n definition: materialId,\n resource: node.index\n };\n }\n\n /**\n * Update vertexCount in node.mesh.geometry object by node id\n * @param id - end-to-end index of the node\n * @param vertexCount - vertex count for particular node\n */\n updateVertexCountByNodeId(id: number, vertexCount: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.geometry.vertexCount = vertexCount;\n }\n\n /**\n * Update resource in node.mesh.attribute object by node id\n * @param id - end-to-end index of the node\n */\n updateNodeAttributeByNodeId(id: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.attribute.resource = node.index;\n }\n\n /**\n * Update featureCount in node.mesh.geometry object by node id\n * @param id - end-to-end index of the node\n * @param featureCount - features count of the node\n */\n updateFeatureCountByNodeId(id: number, featureCount: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.geometry.featureCount = featureCount;\n }\n\n /**\n * Update texelCountHint in node.mesh.material object by node id\n * @param id - end-to-end index of the node\n * @param texelCountHint - texelCountHint of particular node\n */\n updateTexelCountHintByNodeId(id: number, texelCountHint: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh || !node.mesh.material) {\n return;\n }\n node.mesh.material.texelCountHint = texelCountHint;\n }\n\n /**\n * Add a child id into the parent node.children array\n * @param parentId - end-to-end parent node index\n * @param childId - end-to-end child node index\n */\n addChildRelation(parentId: number | undefined, childId: number): void {\n if (parentId === null || parentId === undefined) {\n return;\n }\n const parentNode = this.getNodeById(parentId);\n parentNode.children?.push(childId);\n }\n\n /**\n * Update resource index in node.mesh object\n * @param node - node object\n */\n updateResourceInMesh(node: NodeInPage): void {\n if (node.mesh) {\n node.mesh.geometry.resource = node.index;\n }\n }\n\n /**\n * Put new node in nodePages array\n * @param node - node object\n * @param parentId - index of parent node\n * @return\n */\n push(node: NodeInPage, parentId?: number): number {\n let currentNodePage = this.nodePages[this.nodePages.length - 1];\n if (currentNodePage.nodes.length === this.nodesPerPage) {\n currentNodePage = {nodes: []};\n this.nodePages.push(currentNodePage);\n }\n node.index = this.nodesCounter++;\n currentNodePage.nodes.push(node);\n this.addChildRelation(parentId, node.index);\n this.updateResourceInMesh(node);\n return node.index;\n }\n\n /**\n * Save all the node pages\n * Run this method when all nodes is pushed in nodePages\n * @param layers0Path - path of layer\n * @param writeQueue - write queue that controlls files write concurrency\n * @param slpk\n */\n async save(\n layers0Path: string,\n writeQueue: WriteQueue<WriteQueueItem>,\n slpk: boolean = false\n ): Promise<void> {\n if (slpk) {\n for (const [index, nodePage] of this.nodePages.entries()) {\n const nodePageStr = JSON.stringify(nodePage);\n const slpkPath = join(layers0Path, 'nodepages');\n writeQueue.enqueue({\n archiveKey: `nodePages/${index.toString()}.json.gz`,\n writePromise: this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)\n });\n }\n const metadata = transform({nodeCount: this.nodesCounter}, metadataTemplate());\n const compress = false;\n writeQueue.enqueue({\n archiveKey: 'metadata.json',\n writePromise: this.writeFile(\n layers0Path,\n JSON.stringify(metadata),\n 'metadata.json',\n compress\n )\n });\n } else {\n for (const [index, nodePage] of this.nodePages.entries()) {\n const nodePageStr = JSON.stringify(nodePage);\n const nodePagePath = join(layers0Path, 'nodepages', index.toString());\n writeQueue.enqueue({writePromise: this.writeFile(nodePagePath, nodePageStr)});\n }\n }\n }\n}\n"],"file":"node-pages.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/i3s-converter/helpers/node-pages.ts"],"names":["join","transform","METADATA","metadataTemplate","NodePages","constructor","writeFileFunc","nodesPerPage","nodesCounter","nodePages","nodes","writeFile","useWriteFunction","func","getNodeById","id","pageIndex","Math","floor","nodeIndex","updateMaterialByNodeId","materialId","node","mesh","material","definition","resource","index","updateVertexCountByNodeId","vertexCount","geometry","updateNodeAttributeByNodeId","attribute","updateFeatureCountByNodeId","featureCount","updateTexelCountHintByNodeId","texelCountHint","addChildRelation","parentId","childId","undefined","parentNode","children","push","updateResourceInMesh","currentNodePage","length","save","layers0Path","writeQueue","slpk","nodePage","entries","nodePageStr","JSON","stringify","slpkPath","enqueue","archiveKey","toString","writePromise","metadata","nodeCount","compress","nodePagePath"],"mappings":";AAEA,SAAQA,IAAR,QAAmB,MAAnB;AACA,OAAOC,SAAP,MAAsB,oBAAtB;AACA,SAAQC,QAAQ,IAAIC,gBAApB,QAA2C,4BAA3C;AAqCA,eAAe,MAAMC,SAAN,CAAgB;AAY7BC,EAAAA,WAAW,CAACC,aAAD,EAAgBC,YAAhB,EAA8B;AAAA;;AAAA;;AAAA;;AAAA;;AACvC,SAAKA,YAAL,GAAoBA,YAApB;AACA,SAAKC,YAAL,GAAoB,CAApB;AAEA,SAAKC,SAAL,GAAiB,CAAC,EAAD,CAAjB;AACA,SAAKA,SAAL,CAAe,CAAf,EAAkBC,KAAlB,GAA0B,EAA1B;AACA,SAAKC,SAAL,GAAiBL,aAAjB;AACD;;AAMDM,EAAAA,gBAAgB,CAACC,IAAD,EAAuB;AACrC,SAAKF,SAAL,GAAiBE,IAAjB;AACD;;AAODC,EAAAA,WAAW,CAACC,EAAD,EAAyB;AAClC,UAAMC,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWH,EAAE,GAAG,KAAKR,YAArB,CAAlB;AACA,UAAMY,SAAS,GAAGJ,EAAE,GAAG,KAAKR,YAA5B;AACA,WAAO,KAAKE,SAAL,CAAeO,SAAf,EAA0BN,KAA1B,CAAgCS,SAAhC,CAAP;AACD;;AAODC,EAAAA,sBAAsB,CAACL,EAAD,EAAaM,UAAb,EAAuC;AAC3D,UAAMC,IAAI,GAAG,KAAKR,WAAL,CAAiBC,EAAjB,CAAb;;AACA,QAAI,CAACO,IAAI,CAACC,IAAV,EAAgB;AACd;AACD;;AACDD,IAAAA,IAAI,CAACC,IAAL,CAAUC,QAAV,GAAqB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,SAAL,CAAeJ,QAAf,CAApB;AACA,cAAMK,QAAQ,GAAGxD,IAAI,CAACgD,WAAD,EAAc,WAAd,CAArB;AACA,cAAMC,UAAU,CAACQ,OAAX,CAAmB;AACvBC,UAAAA,UAAU,sBAAe/B,KAAK,CAACgC,QAAN,EAAf,aADa;AAEvBC,UAAAA,YAAY,EAAE,KAAKjD,SAAL,CAAe6C,QAAf,EAAyBH,WAAzB,YAAyC1B,KAAK,CAACgC,QAAN,EAAzC;AAFS,SAAnB,CAAN;AAID;;AACD,YAAME,QAAQ,GAAG5D,SAAS,CAAC;AAAC6D,QAAAA,SAAS,EAAE,KAAKtD;AAAjB,OAAD,EAAiCL,gBAAgB,EAAjD,CAA1B;AACA,YAAM4D,QAAQ,GAAG,KAAjB;AACA,YAAMd,UAAU,CAACQ,OAAX,CAAmB;AACvBC,QAAAA,UAAU,EAAE,eADW;AAEvBE,QAAAA,YAAY,EAAE,KAAKjD,SAAL,CACZqC,WADY,EAEZM,IAAI,CAACC,SAAL,CAAeM,QAAf,CAFY,EAGZ,eAHY,EAIZE,QAJY;AAFS,OAAnB,CAAN;AASD,KApBD,MAoBO;AACL,WAAK,MAAM,CAACpC,KAAD,EAAQwB,QAAR,CAAX,IAAgC,KAAK1C,SAAL,CAAe2C,OAAf,EAAhC,EAA0D;AACxD,cAAMC,WAAW,GAAGC,IAAI,CAACC,SAAL,CAAeJ,QAAf,CAApB;AACA,cAAMa,YAAY,GAAGhE,IAAI,CAACgD,WAAD,EAAc,WAAd,EAA2BrB,KAAK,CAACgC,QAAN,EAA3B,CAAzB;AACA,cAAMV,UAAU,CAACQ,OAAX,CAAmB;AAACG,UAAAA,YAAY,EAAE,KAAKjD,SAAL,CAAeqD,YAAf,EAA6BX,WAA7B;AAAf,SAAnB,CAAN;AACD;AACF;AACF;;AA5L4B","sourcesContent":["import type {WriteQueueItem} from '../../lib/utils/write-queue';\n\nimport {join} from 'path';\nimport transform from 'json-map-transform';\nimport {METADATA as metadataTemplate} from '../json-templates/metadata';\nimport {NodeInPage} from '@loaders.gl/i3s';\nimport WriteQueue from '../../lib/utils/write-queue';\n\n// @ts-nocheck\n/**\n * class NodePages - wrapper of nodePages array\n *\n * @example\n * import {writeFile} from './helpers/write-file';\n *\n * // create an instance of the class\n * const nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);\n * ...\n * // push root node\n * const parentId = nodePages.push({\n lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,\n obb: coordinates.obb,\n children: []\n });\n * ...\n * // push node with parent relation\n * const nodeInPage = {\n lodThreshold: HARDCODED_MAX_SCREEN_THRESHOLD_SQ,\n obb: coordinates.obb,\n children: [],\n mesh: {\n geometry: {\n definition: 0\n }\n }\n };\n * const nodeId = this.nodePages.push(nodeInPage, parentId);\n * ...\n * // save all the nodePages in the end of pushing all the nodes\n * await this.nodePages.save(layers0path);\n */\nexport default class NodePages {\n readonly nodesPerPage: number;\n nodesCounter: number;\n writeFile: Function;\n readonly nodePages: {nodes: NodeInPage[]}[];\n\n /**\n * @constructs\n * Create a nodePages instance.\n * @param writeFileFunc - function to save one nodePage into a file\n * @param nodesPerPage - length limit for one nodePage. An additional nodePage is created when this limit is met\n */\n constructor(writeFileFunc, nodesPerPage) {\n this.nodesPerPage = nodesPerPage;\n this.nodesCounter = 0;\n // @ts-expect-error\n this.nodePages = [{}];\n this.nodePages[0].nodes = [];\n this.writeFile = writeFileFunc;\n }\n\n /**\n * Setup function to save node pages\n * @param func - function which should be used to save node pages\n */\n useWriteFunction(func: Function): void {\n this.writeFile = func;\n }\n\n /**\n * Get the node by its end-to-end index\n * @param id - end-to-end index of the node\n * @return the node object\n */\n getNodeById(id: number): NodeInPage {\n const pageIndex = Math.floor(id / this.nodesPerPage);\n const nodeIndex = id % this.nodesPerPage;\n return this.nodePages[pageIndex].nodes[nodeIndex];\n }\n\n /**\n * Update material in node.mesh object by node id\n * @param id - end-to-end index of the node\n * @param materialId - id from scene layer materialDefinitions\n */\n updateMaterialByNodeId(id: number, materialId: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.material = {\n definition: materialId,\n resource: node.index\n };\n }\n\n /**\n * Update vertexCount in node.mesh.geometry object by node id\n * @param id - end-to-end index of the node\n * @param vertexCount - vertex count for particular node\n */\n updateVertexCountByNodeId(id: number, vertexCount: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.geometry.vertexCount = vertexCount;\n }\n\n /**\n * Update resource in node.mesh.attribute object by node id\n * @param id - end-to-end index of the node\n */\n updateNodeAttributeByNodeId(id: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.attribute.resource = node.index;\n }\n\n /**\n * Update featureCount in node.mesh.geometry object by node id\n * @param id - end-to-end index of the node\n * @param featureCount - features count of the node\n */\n updateFeatureCountByNodeId(id: number, featureCount: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh) {\n return;\n }\n node.mesh.geometry.featureCount = featureCount;\n }\n\n /**\n * Update texelCountHint in node.mesh.material object by node id\n * @param id - end-to-end index of the node\n * @param texelCountHint - texelCountHint of particular node\n */\n updateTexelCountHintByNodeId(id: number, texelCountHint: number): void {\n const node = this.getNodeById(id);\n if (!node.mesh || !node.mesh.material) {\n return;\n }\n node.mesh.material.texelCountHint = texelCountHint;\n }\n\n /**\n * Add a child id into the parent node.children array\n * @param parentId - end-to-end parent node index\n * @param childId - end-to-end child node index\n */\n addChildRelation(parentId: number | undefined, childId: number): void {\n if (parentId === null || parentId === undefined) {\n return;\n }\n const parentNode = this.getNodeById(parentId);\n parentNode.children?.push(childId);\n }\n\n /**\n * Update resource index in node.mesh object\n * @param node - node object\n */\n updateResourceInMesh(node: NodeInPage): void {\n if (node.mesh) {\n node.mesh.geometry.resource = node.index;\n }\n }\n\n /**\n * Put new node in nodePages array\n * @param node - node object\n * @param parentId - index of parent node\n * @return\n */\n push(node: NodeInPage, parentId?: number): number {\n let currentNodePage = this.nodePages[this.nodePages.length - 1];\n if (currentNodePage.nodes.length === this.nodesPerPage) {\n currentNodePage = {nodes: []};\n this.nodePages.push(currentNodePage);\n }\n node.index = this.nodesCounter++;\n currentNodePage.nodes.push(node);\n this.addChildRelation(parentId, node.index);\n this.updateResourceInMesh(node);\n return node.index;\n }\n\n /**\n * Save all the node pages\n * Run this method when all nodes is pushed in nodePages\n * @param layers0Path - path of layer\n * @param writeQueue - write queue that controlls files write concurrency\n * @param slpk\n */\n async save(\n layers0Path: string,\n writeQueue: WriteQueue<WriteQueueItem>,\n slpk: boolean = false\n ): Promise<void> {\n if (slpk) {\n for (const [index, nodePage] of this.nodePages.entries()) {\n const nodePageStr = JSON.stringify(nodePage);\n const slpkPath = join(layers0Path, 'nodepages');\n await writeQueue.enqueue({\n archiveKey: `nodePages/${index.toString()}.json.gz`,\n writePromise: this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)\n });\n }\n const metadata = transform({nodeCount: this.nodesCounter}, metadataTemplate());\n const compress = false;\n await writeQueue.enqueue({\n archiveKey: 'metadata.json',\n writePromise: this.writeFile(\n layers0Path,\n JSON.stringify(metadata),\n 'metadata.json',\n compress\n )\n });\n } else {\n for (const [index, nodePage] of this.nodePages.entries()) {\n const nodePageStr = JSON.stringify(nodePage);\n const nodePagePath = join(layers0Path, 'nodepages', index.toString());\n await writeQueue.enqueue({writePromise: this.writeFile(nodePagePath, nodePageStr)});\n }\n }\n }\n}\n"],"file":"node-pages.js"}
|
|
@@ -14,7 +14,7 @@ import NodePages from './helpers/node-pages';
|
|
|
14
14
|
import { writeFile, removeDir, writeFileForSlpk } from '../lib/utils/file-utils';
|
|
15
15
|
import { compressWithChildProcess } from '../lib/utils/compress-util';
|
|
16
16
|
import { calculateFilesSize, timeConverter } from '../lib/utils/statistic-utills';
|
|
17
|
-
import convertB3dmToI3sGeometry from './helpers/geometry-converter';
|
|
17
|
+
import convertB3dmToI3sGeometry, { getPropertyTable } from './helpers/geometry-converter';
|
|
18
18
|
import { createBoundingVolumes, convertBoundingVolumeToI3SFullExtent } from './helpers/coordinate-converter';
|
|
19
19
|
import { createSceneServerPath } from './helpers/create-scene-server-path';
|
|
20
20
|
import { convertGeometricErrorToScreenThreshold } from '../lib/utils/lod-conversion-utils';
|
|
@@ -277,12 +277,12 @@ export default class I3SConverter {
|
|
|
277
277
|
const childPath = join(this.layers0Path, 'nodes', child.path);
|
|
278
278
|
|
|
279
279
|
if (this.options.slpk) {
|
|
280
|
-
this.writeQueue.enqueue({
|
|
280
|
+
await this.writeQueue.enqueue({
|
|
281
281
|
archiveKey: 'nodes/1/3dNodeIndexDocument.json.gz',
|
|
282
282
|
writePromise: writeFileForSlpk(childPath, JSON.stringify(child), '3dNodeIndexDocument.json')
|
|
283
283
|
});
|
|
284
284
|
} else {
|
|
285
|
-
this.writeQueue.enqueue({
|
|
285
|
+
await this.writeQueue.enqueue({
|
|
286
286
|
writePromise: writeFile(childPath, JSON.stringify(child))
|
|
287
287
|
});
|
|
288
288
|
}
|
|
@@ -300,12 +300,12 @@ export default class I3SConverter {
|
|
|
300
300
|
|
|
301
301
|
async _writeLayers0() {
|
|
302
302
|
if (this.options.slpk) {
|
|
303
|
-
this.writeQueue.enqueue({
|
|
303
|
+
await this.writeQueue.enqueue({
|
|
304
304
|
archiveKey: '3dSceneLayer.json.gz',
|
|
305
305
|
writePromise: writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), '3dSceneLayer.json')
|
|
306
306
|
});
|
|
307
307
|
} else {
|
|
308
|
-
this.writeQueue.enqueue({
|
|
308
|
+
await this.writeQueue.enqueue({
|
|
309
309
|
writePromise: writeFile(this.layers0Path, JSON.stringify(this.layers0))
|
|
310
310
|
});
|
|
311
311
|
}
|
|
@@ -313,12 +313,12 @@ export default class I3SConverter {
|
|
|
313
313
|
|
|
314
314
|
async _writeNodeIndexDocument(root0, nodePath, rootPath) {
|
|
315
315
|
if (this.options.slpk) {
|
|
316
|
-
this.writeQueue.enqueue({
|
|
316
|
+
await this.writeQueue.enqueue({
|
|
317
317
|
archiveKey: "nodes/".concat(nodePath, "/3dNodeIndexDocument.json.gz"),
|
|
318
318
|
writePromise: writeFileForSlpk(rootPath, JSON.stringify(root0), '3dNodeIndexDocument.json')
|
|
319
319
|
});
|
|
320
320
|
} else {
|
|
321
|
-
this.writeQueue.enqueue({
|
|
321
|
+
await this.writeQueue.enqueue({
|
|
322
322
|
writePromise: writeFile(rootPath, JSON.stringify(root0))
|
|
323
323
|
});
|
|
324
324
|
}
|
|
@@ -419,7 +419,7 @@ export default class I3SConverter {
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
async _createNode(parentTile, sourceTile, parentId, level) {
|
|
422
|
-
var
|
|
422
|
+
var _this$layers, _this$layers$attribut;
|
|
423
423
|
|
|
424
424
|
if (this.validate) {
|
|
425
425
|
this._checkAddRefinementTypeForTile(sourceTile);
|
|
@@ -428,13 +428,13 @@ export default class I3SConverter {
|
|
|
428
428
|
await this._updateTilesetOptions();
|
|
429
429
|
await this.sourceTileset._loadTile(sourceTile);
|
|
430
430
|
let boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);
|
|
431
|
-
const
|
|
431
|
+
const propertyTable = getPropertyTable(sourceTile);
|
|
432
432
|
|
|
433
|
-
if (
|
|
434
|
-
this.
|
|
433
|
+
if (propertyTable && !((_this$layers = this.layers0) !== null && _this$layers !== void 0 && (_this$layers$attribut = _this$layers.attributeStorageInfo) !== null && _this$layers$attribut !== void 0 && _this$layers$attribut.length)) {
|
|
434
|
+
this._convertPropertyTableToNodeAttributes(propertyTable);
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
const resourcesData = await this._convertResources(sourceTile);
|
|
437
|
+
const resourcesData = await this._convertResources(sourceTile, propertyTable);
|
|
438
438
|
const nodes = [];
|
|
439
439
|
const nodesInPage = [];
|
|
440
440
|
const emptyResources = {
|
|
@@ -491,24 +491,14 @@ export default class I3SConverter {
|
|
|
491
491
|
return nodes;
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
-
|
|
495
|
-
var _this$layers, _this$layers$attribut;
|
|
496
|
-
|
|
497
|
-
const batchTable = sourceTileContent && sourceTileContent.batchTableJson;
|
|
498
|
-
|
|
499
|
-
if (batchTable && !((_this$layers = this.layers0) !== null && _this$layers !== void 0 && (_this$layers$attribut = _this$layers.attributeStorageInfo) !== null && _this$layers$attribut !== void 0 && _this$layers$attribut.length)) {
|
|
500
|
-
this._convertBatchTableInfoToNodeAttributes(batchTable);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
async _convertResources(sourceTile) {
|
|
494
|
+
async _convertResources(sourceTile, propertyTable) {
|
|
505
495
|
var _this$layers2;
|
|
506
496
|
|
|
507
497
|
if (!this.isContentSupported(sourceTile)) {
|
|
508
498
|
return null;
|
|
509
499
|
}
|
|
510
500
|
|
|
511
|
-
const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, Number(this.nodePages.nodesCounter), this.featuresHashArray, (_this$layers2 = this.layers0) === null || _this$layers2 === void 0 ? void 0 : _this$layers2.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel, this.workerSource);
|
|
501
|
+
const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, Number(this.nodePages.nodesCounter), propertyTable, this.featuresHashArray, (_this$layers2 = this.layers0) === null || _this$layers2 === void 0 ? void 0 : _this$layers2.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel, this.workerSource);
|
|
512
502
|
return resourcesData;
|
|
513
503
|
}
|
|
514
504
|
|
|
@@ -643,13 +633,13 @@ export default class I3SConverter {
|
|
|
643
633
|
async _writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath) {
|
|
644
634
|
if (this.options.slpk) {
|
|
645
635
|
const slpkGeometryPath = join(childPath, 'geometries');
|
|
646
|
-
this.writeQueue.enqueue({
|
|
636
|
+
await this.writeQueue.enqueue({
|
|
647
637
|
archiveKey: "".concat(slpkChildPath, "/geometries/0.bin.gz"),
|
|
648
638
|
writePromise: writeFileForSlpk(slpkGeometryPath, geometryBuffer, '0.bin')
|
|
649
639
|
});
|
|
650
640
|
} else {
|
|
651
641
|
const geometryPath = join(childPath, 'geometries/0/');
|
|
652
|
-
this.writeQueue.enqueue({
|
|
642
|
+
await this.writeQueue.enqueue({
|
|
653
643
|
writePromise: writeFile(geometryPath, geometryBuffer, 'index.bin')
|
|
654
644
|
});
|
|
655
645
|
}
|
|
@@ -657,13 +647,13 @@ export default class I3SConverter {
|
|
|
657
647
|
if (this.options.draco) {
|
|
658
648
|
if (this.options.slpk) {
|
|
659
649
|
const slpkCompressedGeometryPath = join(childPath, 'geometries');
|
|
660
|
-
this.writeQueue.enqueue({
|
|
650
|
+
await this.writeQueue.enqueue({
|
|
661
651
|
archiveKey: "".concat(slpkChildPath, "/geometries/1.bin.gz"),
|
|
662
652
|
writePromise: writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, '1.bin')
|
|
663
653
|
});
|
|
664
654
|
} else {
|
|
665
655
|
const compressedGeometryPath = join(childPath, 'geometries/1/');
|
|
666
|
-
this.writeQueue.enqueue({
|
|
656
|
+
await this.writeQueue.enqueue({
|
|
667
657
|
writePromise: writeFile(compressedGeometryPath, compressedGeometry, 'index.bin')
|
|
668
658
|
});
|
|
669
659
|
}
|
|
@@ -681,13 +671,13 @@ export default class I3SConverter {
|
|
|
681
671
|
|
|
682
672
|
if (this.options.slpk) {
|
|
683
673
|
const slpkSharedPath = join(childPath, 'shared');
|
|
684
|
-
this.writeQueue.enqueue({
|
|
674
|
+
await this.writeQueue.enqueue({
|
|
685
675
|
archiveKey: "".concat(slpkChildPath, "/shared/sharedResource.json.gz"),
|
|
686
676
|
writePromise: writeFileForSlpk(slpkSharedPath, sharedDataStr, 'sharedResource.json')
|
|
687
677
|
});
|
|
688
678
|
} else {
|
|
689
679
|
const sharedPath = join(childPath, 'shared/');
|
|
690
|
-
this.writeQueue.enqueue({
|
|
680
|
+
await this.writeQueue.enqueue({
|
|
691
681
|
writePromise: writeFile(sharedPath, sharedDataStr)
|
|
692
682
|
});
|
|
693
683
|
}
|
|
@@ -761,13 +751,13 @@ export default class I3SConverter {
|
|
|
761
751
|
if (this.options.slpk) {
|
|
762
752
|
const slpkTexturePath = join(childPath, 'textures');
|
|
763
753
|
const compress = false;
|
|
764
|
-
this.writeQueue.enqueue({
|
|
754
|
+
await this.writeQueue.enqueue({
|
|
765
755
|
archiveKey: "".concat(slpkChildPath, "/textures/").concat(name, ".").concat(format),
|
|
766
756
|
writePromise: writeFileForSlpk(slpkTexturePath, textureData, "".concat(name, ".").concat(format), compress)
|
|
767
757
|
});
|
|
768
758
|
} else {
|
|
769
759
|
const texturePath = join(childPath, "textures/".concat(name, "/"));
|
|
770
|
-
this.writeQueue.enqueue({
|
|
760
|
+
await this.writeQueue.enqueue({
|
|
771
761
|
writePromise: writeFile(texturePath, textureData, "index.".concat(format))
|
|
772
762
|
});
|
|
773
763
|
}
|
|
@@ -783,13 +773,13 @@ export default class I3SConverter {
|
|
|
783
773
|
|
|
784
774
|
if (this.options.slpk) {
|
|
785
775
|
const slpkAttributesPath = join(childPath, 'attributes', folderName);
|
|
786
|
-
this.writeQueue.enqueue({
|
|
776
|
+
await this.writeQueue.enqueue({
|
|
787
777
|
archiveKey: "".concat(slpkChildPath, "/attributes/").concat(folderName, ".bin.gz"),
|
|
788
778
|
writePromise: writeFileForSlpk(slpkAttributesPath, fileBuffer, '0.bin')
|
|
789
779
|
});
|
|
790
780
|
} else {
|
|
791
781
|
const attributesPath = join(childPath, "attributes/".concat(folderName, "/0"));
|
|
792
|
-
this.writeQueue.enqueue({
|
|
782
|
+
await this.writeQueue.enqueue({
|
|
793
783
|
writePromise: writeFile(attributesPath, fileBuffer, 'index.bin')
|
|
794
784
|
});
|
|
795
785
|
}
|
|
@@ -920,15 +910,15 @@ export default class I3SConverter {
|
|
|
920
910
|
};
|
|
921
911
|
}
|
|
922
912
|
|
|
923
|
-
|
|
913
|
+
_convertPropertyTableToNodeAttributes(propertyTable) {
|
|
924
914
|
let attributeIndex = 0;
|
|
925
|
-
const
|
|
915
|
+
const propertyTableWithObjectId = {
|
|
926
916
|
OBJECTID: [0],
|
|
927
|
-
...
|
|
917
|
+
...propertyTable
|
|
928
918
|
};
|
|
929
919
|
|
|
930
|
-
for (const key in
|
|
931
|
-
const firstAttribute =
|
|
920
|
+
for (const key in propertyTableWithObjectId) {
|
|
921
|
+
const firstAttribute = propertyTableWithObjectId[key][0];
|
|
932
922
|
const attributeType = this.getAttributeType(key, firstAttribute);
|
|
933
923
|
|
|
934
924
|
const storageAttribute = this._createdStorageAttribute(attributeIndex, key, attributeType);
|
|
@@ -937,7 +927,7 @@ export default class I3SConverter {
|
|
|
937
927
|
|
|
938
928
|
const fieldAttribute = this._createFieldAttribute(key, fieldAttributeType);
|
|
939
929
|
|
|
940
|
-
const popupInfo = this._createPopupInfo(
|
|
930
|
+
const popupInfo = this._createPopupInfo(propertyTableWithObjectId);
|
|
941
931
|
|
|
942
932
|
this.layers0.attributeStorageInfo.push(storageAttribute);
|
|
943
933
|
this.layers0.fields.push(fieldAttribute);
|
|
@@ -966,14 +956,14 @@ export default class I3SConverter {
|
|
|
966
956
|
}
|
|
967
957
|
}
|
|
968
958
|
|
|
969
|
-
_createPopupInfo(
|
|
959
|
+
_createPopupInfo(propertyTable) {
|
|
970
960
|
const title = '{OBJECTID}';
|
|
971
961
|
const mediaInfos = [];
|
|
972
962
|
const fieldInfos = [];
|
|
973
963
|
const popupElements = [];
|
|
974
964
|
const expressionInfos = [];
|
|
975
965
|
|
|
976
|
-
for (const key in
|
|
966
|
+
for (const key in propertyTable) {
|
|
977
967
|
fieldInfos.push({
|
|
978
968
|
fieldName: key,
|
|
979
969
|
visible: true,
|