@loaders.gl/potree 4.3.0-alpha.6 → 4.3.0-alpha.7
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/dist.dev.js +4 -2
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +2 -2
- package/dist/lib/potree-node-source.d.ts +2 -2
- package/dist/lib/potree-node-source.d.ts.map +1 -1
- package/dist/lib/potree-node-source.js +2 -3
- package/dist/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree-loader.js +1 -1
- package/package.json +5 -5
- package/src/lib/potree-node-source.ts +6 -5
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ __export(dist_exports, {
|
|
|
28
28
|
module.exports = __toCommonJS(dist_exports);
|
|
29
29
|
|
|
30
30
|
// dist/potree-loader.js
|
|
31
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
31
|
+
var VERSION = true ? "4.3.0-alpha.6" : "latest";
|
|
32
32
|
var PotreeLoader = {
|
|
33
33
|
dataType: null,
|
|
34
34
|
batchType: null,
|
|
@@ -113,7 +113,7 @@ function buildHierarchy(flatNodes, options = {}) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// dist/potree-hierarchy-chunk-loader.js
|
|
116
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
116
|
+
var VERSION2 = true ? "4.3.0-alpha.6" : "latest";
|
|
117
117
|
var PotreeHierarchyChunkLoader = {
|
|
118
118
|
dataType: null,
|
|
119
119
|
batchType: null,
|
|
@@ -213,7 +213,7 @@ var PotreeNodesSource = class extends import_loader_utils.DataSource {
|
|
|
213
213
|
isSupported() {
|
|
214
214
|
var _a, _b, _c;
|
|
215
215
|
const { minor, major } = parseVersion(((_a = this.metadata) == null ? void 0 : _a.version) ?? "");
|
|
216
|
-
return this.isReady && major === 1 && minor
|
|
216
|
+
return this.isReady && major === 1 && minor <= 8 && typeof ((_b = this.metadata) == null ? void 0 : _b.pointAttributes) === "string" && ["LAS", "LAZ"].includes((_c = this.metadata) == null ? void 0 : _c.pointAttributes);
|
|
217
217
|
}
|
|
218
218
|
/** Get content files extension */
|
|
219
219
|
getContentExtension() {
|
|
@@ -243,7 +243,7 @@ var PotreeNodesSource = class extends import_loader_utils.DataSource {
|
|
|
243
243
|
}
|
|
244
244
|
const isAvailable = await this.isNodeAvailable(path);
|
|
245
245
|
if (isAvailable) {
|
|
246
|
-
return (0, import_core.load)(`${this.baseUrl}/${(_a = this.metadata) == null ? void 0 : _a.octreeDir}/r/r${path.join()}.${this.getContentExtension()}`, import_las.LASLoader);
|
|
246
|
+
return (0, import_core.load)(`${this.baseUrl}/${(_a = this.metadata) == null ? void 0 : _a.octreeDir}/r/r${path.join("")}.${this.getContentExtension()}`, import_las.LASLoader);
|
|
247
247
|
}
|
|
248
248
|
return null;
|
|
249
249
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.js", "potree-loader.js", "parsers/parse-potree-hierarchy-chunk.js", "potree-hierarchy-chunk-loader.js", "parsers/parse-potree-bin.js", "potree-bin-loader.js", "lib/potree-node-source.js", "utils/parse-version.js", "potree-source.js"],
|
|
4
|
-
"sourcesContent": ["export { PotreeLoader } from \"./potree-loader.js\";\nexport { PotreeHierarchyChunkLoader } from \"./potree-hierarchy-chunk-loader.js\";\nexport { PotreeBinLoader } from \"./potree-bin-loader.js\";\nexport { PotreeSource } from \"./potree-source.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0-alpha.5\" !== 'undefined' ? \"4.3.0-alpha.5\" : 'latest';\n/** Potree loader */\nexport const PotreeLoader = {\n dataType: null,\n batchType: null,\n name: 'potree metadata',\n id: 'potree',\n module: 'potree',\n version: VERSION,\n extensions: ['js'],\n mimeTypes: ['application/json'],\n testText: (text) => text.indexOf('octreeDir') >= 0,\n parse: (data) => JSON.parse(new TextDecoder().decode(data)),\n parseTextSync: (text) => JSON.parse(text),\n options: {\n potree: {}\n }\n};\n", "// This file is derived from the Cesium code base under BSD 2-clause license\n// See LICENSE.md and https://github.com/potree/potree/blob/develop/LICENSE\n/**\n * load hierarchy\n * @param arrayBuffer - binary index data\n * @returns root node\n **/\nexport function parsePotreeHierarchyChunk(arrayBuffer) {\n const tileHeaders = parseBinaryChunk(arrayBuffer);\n return buildHierarchy(tileHeaders);\n}\n/**\n * Parses the binary rows\n * @param arrayBuffer - binary index data to parse\n * @param byteOffset - byte offset to start from\n * @returns flat nodes array\n * */\nfunction parseBinaryChunk(arrayBuffer, byteOffset = 0) {\n const dataView = new DataView(arrayBuffer);\n const stack = [];\n // Get root mask\n // @ts-expect-error\n const topTileHeader = {};\n byteOffset = decodeRow(dataView, byteOffset, topTileHeader);\n stack.push(topTileHeader);\n const tileHeaders = [topTileHeader];\n while (stack.length > 0) {\n const snode = stack.shift();\n let mask = 1;\n for (let i = 0; i < 8; i++) {\n if (snode && (snode.header.childMask & mask) !== 0) {\n // @ts-expect-error\n const tileHeader = {};\n byteOffset = decodeRow(dataView, byteOffset, tileHeader);\n tileHeader.name = snode.name + i;\n stack.push(tileHeader);\n tileHeaders.push(tileHeader);\n snode.header.childCount++;\n }\n mask = mask * 2;\n }\n if (byteOffset === dataView.byteLength) {\n break;\n }\n }\n return tileHeaders;\n}\n/**\n * Reads next row from binary index file\n * @param dataView - index data\n * @param byteOffset - current offset in the index data\n * @param tileHeader - container to read to\n * @returns new offset\n */\nfunction decodeRow(dataView, byteOffset, tileHeader) {\n tileHeader.header = tileHeader.header || {};\n tileHeader.header.childMask = dataView.getUint8(byteOffset);\n tileHeader.header.childCount = 0;\n tileHeader.pointCount = dataView.getUint32(byteOffset + 1, true);\n tileHeader.name = '';\n byteOffset += 5;\n return byteOffset;\n}\n/** Resolves the binary rows into a hierarchy (tree structure) */\nfunction buildHierarchy(flatNodes, options = {}) {\n const DEFAULT_OPTIONS = { spacing: 100 }; // TODO assert instead of default?\n options = { ...DEFAULT_OPTIONS, ...options };\n const topNode = flatNodes[0];\n const nodes = {};\n for (const node of flatNodes) {\n const { name } = node;\n const index = parseInt(name.charAt(name.length - 1), 10);\n const parentName = name.substring(0, name.length - 1);\n const parentNode = nodes[parentName];\n const level = name.length - 1;\n // assert(parentNode && level >= 0);\n node.level = level;\n node.hasChildren = Boolean(node.header.childCount);\n node.children = [];\n node.childrenByIndex = new Array(8).fill(null);\n node.spacing = (options?.spacing || 0) / Math.pow(2, level);\n // tileHeader.boundingVolume = Utils.createChildAABB(parentNode.boundingBox, index);\n if (parentNode) {\n parentNode.children.push(node);\n parentNode.childrenByIndex[index] = node;\n }\n // Add the node to the map\n nodes[name] = node;\n }\n // First node is the root\n return topNode;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parsePotreeHierarchyChunk } from \"./parsers/parse-potree-hierarchy-chunk.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0-alpha.5\" !== 'undefined' ? \"4.3.0-alpha.5\" : 'latest';\n/** Potree hierarchy chunk loader */\nexport const PotreeHierarchyChunkLoader = {\n dataType: null,\n batchType: null,\n name: 'potree Hierarchy Chunk',\n id: 'potree-hrc',\n module: 'potree',\n version: VERSION,\n extensions: ['hrc'],\n mimeTypes: ['application/octet-stream'],\n // binary potree files have no header bytes, no content test function possible\n // test: ['...'],\n parse: async (arrayBuffer, options) => parsePotreeHierarchyChunk(arrayBuffer),\n parseSync: (arrayBuffer, options) => parsePotreeHierarchyChunk(arrayBuffer),\n options: {\n potree: {}\n },\n binary: true\n};\n", "export function parsePotreeBin(arrayBuffer, byteOffset, options, index) {\n return null;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parsePotreeBin } from \"./parsers/parse-potree-bin.js\";\n/**\n * Loader for potree Binary Point Attributes\n * */\nexport const PotreeBinLoader = {\n dataType: null,\n batchType: null,\n name: 'potree Binary Point Attributes',\n id: 'potree',\n extensions: ['bin'],\n mimeTypes: ['application/octet-stream'],\n // Unfortunately binary potree files have no header bytes, no test possible\n // test: ['...'],\n parseSync,\n binary: true,\n options: {}\n // @ts-ignore\n};\nfunction parseSync(arrayBuffer, options) {\n const index = {};\n const byteOffset = 0;\n parsePotreeBin(arrayBuffer, byteOffset, options, index);\n return index;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { load } from '@loaders.gl/core';\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { LASLoader } from '@loaders.gl/las';\nimport { PotreeHierarchyChunkLoader } from \"../potree-hierarchy-chunk-loader.js\";\nimport { PotreeLoader } from \"../potree-loader.js\";\nimport { parseVersion } from \"../utils/parse-version.js\";\n/**\n * A Potree data source\n * @version 1.0 - https://github.com/potree/potree/blob/1.0RC/docs/file_format.md\n * @version 1.7 - https://github.com/potree/potree/blob/1.7/docs/potree-file-format.md\n * @note Point cloud nodes tile source\n */\nexport class PotreeNodesSource extends DataSource {\n /** Dataset base URL */\n baseUrl = '';\n /** Input data: string - dataset url, blob - single file data */\n data;\n /** Input props */\n props;\n /** Meta information from `cloud.js` */\n metadata = null;\n /** Root node */\n root = null;\n /** Is data source ready to use after initial loading */\n isReady = false;\n initPromise = null;\n /**\n * @constructor\n * @param data - if string - data set path url or path to `cloud.js` metadata file\n * - if Blob - single file data\n * @param props - data source properties\n */\n constructor(data, props) {\n super(props);\n this.props = props;\n this.data = data;\n this.makeBaseUrl(this.data);\n this.initPromise = this.init();\n }\n /** Initial data source loading */\n async init() {\n if (this.initPromise) {\n await this.initPromise;\n return;\n }\n this.metadata = await load(`${this.baseUrl}/cloud.js`, PotreeLoader);\n await this.loadHierarchy();\n this.isReady = true;\n }\n /** Is data set supported */\n isSupported() {\n const { minor, major } = parseVersion(this.metadata?.version ?? '');\n return (this.isReady &&\n major === 1 &&\n minor < 2 &&\n typeof this.metadata?.pointAttributes === 'string' &&\n ['LAS', 'LAZ'].includes(this.metadata?.pointAttributes));\n }\n /** Get content files extension */\n getContentExtension() {\n if (!this.isReady) {\n return null;\n }\n switch (this.metadata?.pointAttributes) {\n case 'LAS':\n return 'las';\n case 'LAZ':\n return 'laz';\n default:\n return 'bin';\n }\n }\n /**\n * Load octree node content\n * @param path array of numbers between 0-7 specifying successive octree divisions.\n * @return node content geometry or null if the node doesn't exist\n */\n async loadNodeContent(path) {\n await this.initPromise;\n if (!this.isSupported()) {\n return null;\n }\n const isAvailable = await this.isNodeAvailable(path);\n if (isAvailable) {\n return load(`${this.baseUrl}/${this.metadata\n ?.octreeDir}/r/r${path.join()}.${this.getContentExtension()}`, LASLoader);\n }\n return null;\n }\n /**\n * Check if a node exists in the octree\n * @param path array of numbers between 0-7 specifying successive octree divisions\n * @returns true - the node does exist, false - the nodes doesn't exist\n */\n async isNodeAvailable(path) {\n if (this.metadata?.hierarchy) {\n return this.metadata.hierarchy.findIndex((item) => item[0] === `r${path.join()}`) !== -1;\n }\n if (!this.root) {\n return false;\n }\n let currentParent = this.root;\n let name = '';\n let result = true;\n for (const nodeLevel of path) {\n const newName = `${name}${nodeLevel}`;\n const node = currentParent.children.find((child) => child.name === newName);\n if (node) {\n currentParent = node;\n name = newName;\n }\n else {\n result = false;\n break;\n }\n }\n return result;\n }\n /**\n * Load data source hierarchy into tree of available nodes\n */\n async loadHierarchy() {\n this.root = await load(`${this.baseUrl}/${this.metadata?.octreeDir}/r/r.hrc`, PotreeHierarchyChunkLoader);\n }\n /**\n * Deduce base url from the input url sring\n * @param data - data source input data\n */\n makeBaseUrl(data) {\n this.baseUrl = typeof data === 'string' ? resolvePath(data) : '';\n if (this.baseUrl.endsWith('cloud.js')) {\n this.baseUrl = this.baseUrl.substring(0, -8);\n }\n if (this.baseUrl.endsWith('/')) {\n this.baseUrl = this.baseUrl.substring(0, -1);\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function parseVersion(version) {\n const parts = version.split('.').map(Number);\n return { major: parts[0], minor: parts[1] };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { PotreeNodesSource } from \"./lib/potree-node-source.js\";\nconst VERSION = '1.7';\n/**\n * Creates point cloud data sources for Potree urls\n */\nexport const PotreeSource = {\n name: 'Potree',\n id: 'potree',\n module: 'potree',\n version: VERSION,\n extensions: ['bin', 'las', 'laz'],\n mimeTypes: ['application/octet-stream'],\n options: { url: undefined, potree: {} },\n type: 'potree',\n fromUrl: true,\n fromBlob: true,\n testURL: (url) => url.endsWith('.js'),\n createDataSource: (url, props) => new PotreeNodesSource(url, props)\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,UAAU,OAAyC,kBAAkB;AAEpE,IAAM,eAAe;AAAA,EACxB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY,CAAC,IAAI;AAAA,EACjB,WAAW,CAAC,kBAAkB;AAAA,EAC9B,UAAU,CAAC,SAAS,KAAK,QAAQ,WAAW,KAAK;AAAA,EACjD,OAAO,CAAC,SAAS,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,IAAI,CAAC;AAAA,EAC1D,eAAe,CAAC,SAAS,KAAK,MAAM,IAAI;AAAA,EACxC,SAAS;AAAA,IACL,QAAQ,CAAC;AAAA,EACb;AACJ;;;ACfO,SAAS,0BAA0B,aAAa;AACnD,QAAM,cAAc,iBAAiB,WAAW;AAChD,SAAO,eAAe,WAAW;AACr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AM,aAAa;AACnB,iBAAe,aAAa,YAAY,SAAS,KAAK;AACtD,SAAO;AACX;;;ACvBA,kBAAqB;AACrB,0BAAwC;AACxC,iBAA0B;;;ACFnB,SAAS,aAAa,SAAS;AAClC,QAAM,QAAQ,QAAQ,MAAM,GAAG,EAAE,IAAI,MAAM;AAC3C,SAAO,EAAE,OAAO,MAAM,CAAC,GAAG,OAAO,MAAM,CAAC,EAAE;AAC9C;;;ADSO,IAAM,oBAAN,cAAgC,+BAAW;AAAA;AAAA,EAE9C,UAAU;AAAA;AAAA,EAEV;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA,WAAW;AAAA;AAAA,EAEX,OAAO;AAAA;AAAA,EAEP,UAAU;AAAA,EACV,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,YAAY,MAAM,OAAO;AACrB,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,YAAY,KAAK,IAAI;AAC1B,SAAK,cAAc,KAAK,KAAK;AAAA,EACjC;AAAA;AAAA,EAEA,MAAM,OAAO;AACT,QAAI,KAAK,aAAa;AAClB,YAAM,KAAK;AACX;AAAA,IACJ;AACA,SAAK,WAAW,UAAM,kBAAK,GAAG,KAAK,oBAAoB,YAAY;AACnE,UAAM,KAAK,cAAc;AACzB,SAAK,UAAU;AAAA,EACnB;AAAA;AAAA,EAEA,cAAc;AArDlB;AAsDQ,UAAM,EAAE,OAAO,MAAM,IAAI,eAAa,UAAK,aAAL,mBAAe,YAAW,EAAE;AAClE,WAAQ,KAAK,WACT,UAAU,KACV,
|
|
4
|
+
"sourcesContent": ["export { PotreeLoader } from \"./potree-loader.js\";\nexport { PotreeHierarchyChunkLoader } from \"./potree-hierarchy-chunk-loader.js\";\nexport { PotreeBinLoader } from \"./potree-bin-loader.js\";\nexport { PotreeSource } from \"./potree-source.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0-alpha.6\" !== 'undefined' ? \"4.3.0-alpha.6\" : 'latest';\n/** Potree loader */\nexport const PotreeLoader = {\n dataType: null,\n batchType: null,\n name: 'potree metadata',\n id: 'potree',\n module: 'potree',\n version: VERSION,\n extensions: ['js'],\n mimeTypes: ['application/json'],\n testText: (text) => text.indexOf('octreeDir') >= 0,\n parse: (data) => JSON.parse(new TextDecoder().decode(data)),\n parseTextSync: (text) => JSON.parse(text),\n options: {\n potree: {}\n }\n};\n", "// This file is derived from the Cesium code base under BSD 2-clause license\n// See LICENSE.md and https://github.com/potree/potree/blob/develop/LICENSE\n/**\n * load hierarchy\n * @param arrayBuffer - binary index data\n * @returns root node\n **/\nexport function parsePotreeHierarchyChunk(arrayBuffer) {\n const tileHeaders = parseBinaryChunk(arrayBuffer);\n return buildHierarchy(tileHeaders);\n}\n/**\n * Parses the binary rows\n * @param arrayBuffer - binary index data to parse\n * @param byteOffset - byte offset to start from\n * @returns flat nodes array\n * */\nfunction parseBinaryChunk(arrayBuffer, byteOffset = 0) {\n const dataView = new DataView(arrayBuffer);\n const stack = [];\n // Get root mask\n // @ts-expect-error\n const topTileHeader = {};\n byteOffset = decodeRow(dataView, byteOffset, topTileHeader);\n stack.push(topTileHeader);\n const tileHeaders = [topTileHeader];\n while (stack.length > 0) {\n const snode = stack.shift();\n let mask = 1;\n for (let i = 0; i < 8; i++) {\n if (snode && (snode.header.childMask & mask) !== 0) {\n // @ts-expect-error\n const tileHeader = {};\n byteOffset = decodeRow(dataView, byteOffset, tileHeader);\n tileHeader.name = snode.name + i;\n stack.push(tileHeader);\n tileHeaders.push(tileHeader);\n snode.header.childCount++;\n }\n mask = mask * 2;\n }\n if (byteOffset === dataView.byteLength) {\n break;\n }\n }\n return tileHeaders;\n}\n/**\n * Reads next row from binary index file\n * @param dataView - index data\n * @param byteOffset - current offset in the index data\n * @param tileHeader - container to read to\n * @returns new offset\n */\nfunction decodeRow(dataView, byteOffset, tileHeader) {\n tileHeader.header = tileHeader.header || {};\n tileHeader.header.childMask = dataView.getUint8(byteOffset);\n tileHeader.header.childCount = 0;\n tileHeader.pointCount = dataView.getUint32(byteOffset + 1, true);\n tileHeader.name = '';\n byteOffset += 5;\n return byteOffset;\n}\n/** Resolves the binary rows into a hierarchy (tree structure) */\nfunction buildHierarchy(flatNodes, options = {}) {\n const DEFAULT_OPTIONS = { spacing: 100 }; // TODO assert instead of default?\n options = { ...DEFAULT_OPTIONS, ...options };\n const topNode = flatNodes[0];\n const nodes = {};\n for (const node of flatNodes) {\n const { name } = node;\n const index = parseInt(name.charAt(name.length - 1), 10);\n const parentName = name.substring(0, name.length - 1);\n const parentNode = nodes[parentName];\n const level = name.length - 1;\n // assert(parentNode && level >= 0);\n node.level = level;\n node.hasChildren = Boolean(node.header.childCount);\n node.children = [];\n node.childrenByIndex = new Array(8).fill(null);\n node.spacing = (options?.spacing || 0) / Math.pow(2, level);\n // tileHeader.boundingVolume = Utils.createChildAABB(parentNode.boundingBox, index);\n if (parentNode) {\n parentNode.children.push(node);\n parentNode.childrenByIndex[index] = node;\n }\n // Add the node to the map\n nodes[name] = node;\n }\n // First node is the root\n return topNode;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parsePotreeHierarchyChunk } from \"./parsers/parse-potree-hierarchy-chunk.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0-alpha.6\" !== 'undefined' ? \"4.3.0-alpha.6\" : 'latest';\n/** Potree hierarchy chunk loader */\nexport const PotreeHierarchyChunkLoader = {\n dataType: null,\n batchType: null,\n name: 'potree Hierarchy Chunk',\n id: 'potree-hrc',\n module: 'potree',\n version: VERSION,\n extensions: ['hrc'],\n mimeTypes: ['application/octet-stream'],\n // binary potree files have no header bytes, no content test function possible\n // test: ['...'],\n parse: async (arrayBuffer, options) => parsePotreeHierarchyChunk(arrayBuffer),\n parseSync: (arrayBuffer, options) => parsePotreeHierarchyChunk(arrayBuffer),\n options: {\n potree: {}\n },\n binary: true\n};\n", "export function parsePotreeBin(arrayBuffer, byteOffset, options, index) {\n return null;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { parsePotreeBin } from \"./parsers/parse-potree-bin.js\";\n/**\n * Loader for potree Binary Point Attributes\n * */\nexport const PotreeBinLoader = {\n dataType: null,\n batchType: null,\n name: 'potree Binary Point Attributes',\n id: 'potree',\n extensions: ['bin'],\n mimeTypes: ['application/octet-stream'],\n // Unfortunately binary potree files have no header bytes, no test possible\n // test: ['...'],\n parseSync,\n binary: true,\n options: {}\n // @ts-ignore\n};\nfunction parseSync(arrayBuffer, options) {\n const index = {};\n const byteOffset = 0;\n parsePotreeBin(arrayBuffer, byteOffset, options, index);\n return index;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { load } from '@loaders.gl/core';\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { LASLoader } from '@loaders.gl/las';\nimport { PotreeHierarchyChunkLoader } from \"../potree-hierarchy-chunk-loader.js\";\nimport { PotreeLoader } from \"../potree-loader.js\";\nimport { parseVersion } from \"../utils/parse-version.js\";\n/**\n * A Potree data source\n * @version 1.0 - https://github.com/potree/potree/blob/1.0RC/docs/file_format.md\n * @version 1.7 - https://github.com/potree/potree/blob/1.7/docs/potree-file-format.md\n * @note Point cloud nodes tile source\n */\nexport class PotreeNodesSource extends DataSource {\n /** Dataset base URL */\n baseUrl = '';\n /** Input data: string - dataset url, blob - single file data */\n data;\n /** Input props */\n props;\n /** Meta information from `cloud.js` */\n metadata = null;\n /** Root node */\n root = null;\n /** Is data source ready to use after initial loading */\n isReady = false;\n initPromise = null;\n /**\n * @constructor\n * @param data - if string - data set path url or path to `cloud.js` metadata file\n * - if Blob - single file data\n * @param props - data source properties\n */\n constructor(data, props) {\n super(props);\n this.props = props;\n this.data = data;\n this.makeBaseUrl(this.data);\n this.initPromise = this.init();\n }\n /** Initial data source loading */\n async init() {\n if (this.initPromise) {\n await this.initPromise;\n return;\n }\n this.metadata = await load(`${this.baseUrl}/cloud.js`, PotreeLoader);\n await this.loadHierarchy();\n this.isReady = true;\n }\n /** Is data set supported */\n isSupported() {\n const { minor, major } = parseVersion(this.metadata?.version ?? '');\n return (this.isReady &&\n major === 1 &&\n minor <= 8 &&\n typeof this.metadata?.pointAttributes === 'string' &&\n ['LAS', 'LAZ'].includes(this.metadata?.pointAttributes));\n }\n /** Get content files extension */\n getContentExtension() {\n if (!this.isReady) {\n return null;\n }\n switch (this.metadata?.pointAttributes) {\n case 'LAS':\n return 'las';\n case 'LAZ':\n return 'laz';\n default:\n return 'bin';\n }\n }\n /**\n * Load octree node content\n * @param path array of numbers between 0-7 specifying successive octree divisions.\n * @return node content geometry or null if the node doesn't exist\n */\n async loadNodeContent(path) {\n await this.initPromise;\n if (!this.isSupported()) {\n return null;\n }\n const isAvailable = await this.isNodeAvailable(path);\n if (isAvailable) {\n return load(`${this.baseUrl}/${this.metadata?.octreeDir}/r/r${path.join('')}.${this.getContentExtension()}`, LASLoader);\n }\n return null;\n }\n /**\n * Check if a node exists in the octree\n * @param path array of numbers between 0-7 specifying successive octree divisions\n * @returns true - the node does exist, false - the nodes doesn't exist\n */\n async isNodeAvailable(path) {\n if (this.metadata?.hierarchy) {\n return this.metadata.hierarchy.findIndex((item) => item[0] === `r${path.join()}`) !== -1;\n }\n if (!this.root) {\n return false;\n }\n let currentParent = this.root;\n let name = '';\n let result = true;\n for (const nodeLevel of path) {\n const newName = `${name}${nodeLevel}`;\n const node = currentParent.children.find((child) => child.name === newName);\n if (node) {\n currentParent = node;\n name = newName;\n }\n else {\n result = false;\n break;\n }\n }\n return result;\n }\n /**\n * Load data source hierarchy into tree of available nodes\n */\n async loadHierarchy() {\n this.root = await load(`${this.baseUrl}/${this.metadata?.octreeDir}/r/r.hrc`, PotreeHierarchyChunkLoader);\n }\n /**\n * Deduce base url from the input url sring\n * @param data - data source input data\n */\n makeBaseUrl(data) {\n this.baseUrl = typeof data === 'string' ? resolvePath(data) : '';\n if (this.baseUrl.endsWith('cloud.js')) {\n this.baseUrl = this.baseUrl.substring(0, -8);\n }\n if (this.baseUrl.endsWith('/')) {\n this.baseUrl = this.baseUrl.substring(0, -1);\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function parseVersion(version) {\n const parts = version.split('.').map(Number);\n return { major: parts[0], minor: parts[1] };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { PotreeNodesSource } from \"./lib/potree-node-source.js\";\nconst VERSION = '1.7';\n/**\n * Creates point cloud data sources for Potree urls\n */\nexport const PotreeSource = {\n name: 'Potree',\n id: 'potree',\n module: 'potree',\n version: VERSION,\n extensions: ['bin', 'las', 'laz'],\n mimeTypes: ['application/octet-stream'],\n options: { url: undefined, potree: {} },\n type: 'potree',\n fromUrl: true,\n fromBlob: true,\n testURL: (url) => url.endsWith('.js'),\n createDataSource: (url, props) => new PotreeNodesSource(url, props)\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,UAAU,OAAyC,kBAAkB;AAEpE,IAAM,eAAe;AAAA,EACxB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY,CAAC,IAAI;AAAA,EACjB,WAAW,CAAC,kBAAkB;AAAA,EAC9B,UAAU,CAAC,SAAS,KAAK,QAAQ,WAAW,KAAK;AAAA,EACjD,OAAO,CAAC,SAAS,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,IAAI,CAAC;AAAA,E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EACX;AAAA;AAAA;AAAA;AAAA,EAIA,MAAM,gBAAgB;AA3H1B;AA4HQ,SAAK,OAAO,UAAM,kBAAK,GAAG,KAAK,YAAW,UAAK,aAAL,mBAAe,qBAAqB,0BAA0B;AAAA,EAC5G;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY,MAAM;AACd,SAAK,UAAU,OAAO,SAAS,eAAW,iCAAY,IAAI,IAAI;AAC9D,QAAI,KAAK,QAAQ,SAAS,UAAU,GAAG;AACnC,WAAK,UAAU,KAAK,QAAQ,UAAU,GAAG,EAAE;AAAA,IAC/C;AACA,QAAI,KAAK,QAAQ,SAAS,GAAG,GAAG;AAC5B,WAAK,UAAU,KAAK,QAAQ,UAAU,GAAG,EAAE;AAAA,IAC/C;AAAA,EACJ;AACJ;;;AEvIA,IAAMC,WAAU;AAIT,IAAM,eAAe;AAAA,EACxB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAASA;AAAA,EACT,YAAY,CAAC,OAAO,OAAO,KAAK;AAAA,EAChC,WAAW,CAAC,0BAA0B;AAAA,EACtC,SAAS,EAAE,KAAK,QAAW,QAAQ,CAAC,EAAE;AAAA,EACtC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,QAAQ,IAAI,SAAS,KAAK;AAAA,EACpC,kBAAkB,CAAC,KAAK,UAAU,IAAI,kBAAkB,KAAK,KAAK;AACtE;",
|
|
6
6
|
"names": ["VERSION", "VERSION"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mesh } from '@loaders.gl/schema';
|
|
2
2
|
import { DataSource, DataSourceProps, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
3
3
|
import { PotreeMetadata } from "../types/potree-metadata.js";
|
|
4
4
|
import { POTreeNode } from "../parsers/parse-potree-hierarchy-chunk.js";
|
|
@@ -46,7 +46,7 @@ export declare class PotreeNodesSource extends DataSource {
|
|
|
46
46
|
* @param path array of numbers between 0-7 specifying successive octree divisions.
|
|
47
47
|
* @return node content geometry or null if the node doesn't exist
|
|
48
48
|
*/
|
|
49
|
-
loadNodeContent(path: number[]): Promise<
|
|
49
|
+
loadNodeContent(path: number[]): Promise<Mesh | null>;
|
|
50
50
|
/**
|
|
51
51
|
* Check if a node exists in the octree
|
|
52
52
|
* @param path array of numbers between 0-7 specifying successive octree divisions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"potree-node-source.d.ts","sourceRoot":"","sources":["../../src/lib/potree-node-source.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"potree-node-source.d.ts","sourceRoot":"","sources":["../../src/lib/potree-node-source.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,aAAa,EAAc,MAAM,0BAA0B,CAAC;AAEjG,OAAO,EAAC,cAAc,EAAC,oCAAiC;AACxD,OAAO,EAAC,UAAU,EAAC,mDAAgD;AAKnE,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IACrD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,aAAa,CAAC;KAE7B,CAAC;CACH,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAM;IACrB,gEAAgE;IAChE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,kBAAkB;IAClB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,uCAAuC;IACvC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAQ;IACvC,gBAAgB;IAChB,IAAI,EAAE,UAAU,GAAG,IAAI,CAAQ;IAC/B,wDAAwD;IACxD,OAAO,UAAS;IAEhB,OAAO,CAAC,WAAW,CAA8B;IAEjD;;;;;OAKG;gBACS,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,sBAAsB;IAS9D,kCAAkC;IAC5B,IAAI;IAUV,4BAA4B;IAC5B,WAAW,IAAI,OAAO;IAWtB,kCAAkC;IAClC,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAcpC;;;;OAIG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAmB3D;;;;OAIG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBvD;;OAEG;YACW,aAAa;IAO3B;;;OAGG;IACH,OAAO,CAAC,WAAW;CASpB"}
|
|
@@ -55,7 +55,7 @@ export class PotreeNodesSource extends DataSource {
|
|
|
55
55
|
const { minor, major } = parseVersion(this.metadata?.version ?? '');
|
|
56
56
|
return (this.isReady &&
|
|
57
57
|
major === 1 &&
|
|
58
|
-
minor
|
|
58
|
+
minor <= 8 &&
|
|
59
59
|
typeof this.metadata?.pointAttributes === 'string' &&
|
|
60
60
|
['LAS', 'LAZ'].includes(this.metadata?.pointAttributes));
|
|
61
61
|
}
|
|
@@ -85,8 +85,7 @@ export class PotreeNodesSource extends DataSource {
|
|
|
85
85
|
}
|
|
86
86
|
const isAvailable = await this.isNodeAvailable(path);
|
|
87
87
|
if (isAvailable) {
|
|
88
|
-
return load(`${this.baseUrl}/${this.metadata
|
|
89
|
-
?.octreeDir}/r/r${path.join()}.${this.getContentExtension()}`, LASLoader);
|
|
88
|
+
return load(`${this.baseUrl}/${this.metadata?.octreeDir}/r/r${path.join('')}.${this.getContentExtension()}`, LASLoader);
|
|
90
89
|
}
|
|
91
90
|
return null;
|
|
92
91
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { parsePotreeHierarchyChunk } from "./parsers/parse-potree-hierarchy-chunk.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
7
|
+
const VERSION = typeof "4.3.0-alpha.6" !== 'undefined' ? "4.3.0-alpha.6" : 'latest';
|
|
8
8
|
/** Potree hierarchy chunk loader */
|
|
9
9
|
export const PotreeHierarchyChunkLoader = {
|
|
10
10
|
dataType: null,
|
package/dist/potree-loader.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
6
|
+
const VERSION = typeof "4.3.0-alpha.6" !== 'undefined' ? "4.3.0-alpha.6" : 'latest';
|
|
7
7
|
/** Potree loader */
|
|
8
8
|
export const PotreeLoader = {
|
|
9
9
|
dataType: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/potree",
|
|
3
|
-
"version": "4.3.0-alpha.
|
|
3
|
+
"version": "4.3.0-alpha.7",
|
|
4
4
|
"description": "potree loaders for large point clouds.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@loaders.gl/las": "4.3.0-alpha.
|
|
48
|
-
"@loaders.gl/math": "4.3.0-alpha.
|
|
49
|
-
"@loaders.gl/schema": "4.3.0-alpha.
|
|
47
|
+
"@loaders.gl/las": "4.3.0-alpha.7",
|
|
48
|
+
"@loaders.gl/math": "4.3.0-alpha.7",
|
|
49
|
+
"@loaders.gl/schema": "4.3.0-alpha.7",
|
|
50
50
|
"@math.gl/core": "^4.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@loaders.gl/core": "^4.0.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "73fb27872d89f3804dca37ebd568c6ba9609a98f"
|
|
56
56
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {load} from '@loaders.gl/core';
|
|
6
|
-
import {
|
|
6
|
+
import {Mesh} from '@loaders.gl/schema';
|
|
7
7
|
import {DataSource, DataSourceProps, LoaderOptions, resolvePath} from '@loaders.gl/loader-utils';
|
|
8
8
|
import {LASLoader} from '@loaders.gl/las';
|
|
9
9
|
import {PotreeMetadata} from '../types/potree-metadata';
|
|
@@ -74,7 +74,7 @@ export class PotreeNodesSource extends DataSource {
|
|
|
74
74
|
return (
|
|
75
75
|
this.isReady &&
|
|
76
76
|
major === 1 &&
|
|
77
|
-
minor
|
|
77
|
+
minor <= 8 &&
|
|
78
78
|
typeof this.metadata?.pointAttributes === 'string' &&
|
|
79
79
|
['LAS', 'LAZ'].includes(this.metadata?.pointAttributes)
|
|
80
80
|
);
|
|
@@ -100,7 +100,7 @@ export class PotreeNodesSource extends DataSource {
|
|
|
100
100
|
* @param path array of numbers between 0-7 specifying successive octree divisions.
|
|
101
101
|
* @return node content geometry or null if the node doesn't exist
|
|
102
102
|
*/
|
|
103
|
-
async loadNodeContent(path: number[]): Promise<
|
|
103
|
+
async loadNodeContent(path: number[]): Promise<Mesh | null> {
|
|
104
104
|
await this.initPromise;
|
|
105
105
|
|
|
106
106
|
if (!this.isSupported()) {
|
|
@@ -110,8 +110,9 @@ export class PotreeNodesSource extends DataSource {
|
|
|
110
110
|
const isAvailable = await this.isNodeAvailable(path);
|
|
111
111
|
if (isAvailable) {
|
|
112
112
|
return load(
|
|
113
|
-
`${this.baseUrl}/${this.metadata
|
|
114
|
-
|
|
113
|
+
`${this.baseUrl}/${this.metadata?.octreeDir}/r/r${path.join(
|
|
114
|
+
''
|
|
115
|
+
)}.${this.getContentExtension()}`,
|
|
115
116
|
LASLoader
|
|
116
117
|
);
|
|
117
118
|
}
|