@loaders.gl/tile-converter 4.2.0-alpha.3 → 4.2.0-alpha.5
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-converter/3d-tiles-converter.d.ts +3 -3
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +329 -293
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +257 -200
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
- package/dist/3d-tiles-converter/helpers/load-i3s.js +106 -75
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
- package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
- package/dist/constants.js +0 -1
- package/dist/converter-cli.js +255 -234
- package/dist/converter.min.cjs +80 -90
- package/dist/deps-installer/deps-installer.js +73 -59
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +207 -153
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +145 -103
- package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
- package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
- package/dist/i3s-converter/helpers/feature-attributes.js +168 -105
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +204 -212
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -2
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +1148 -829
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +111 -97
- package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
- package/dist/i3s-converter/helpers/node-debug.js +98 -54
- package/dist/i3s-converter/helpers/node-index-document.d.ts +3 -3
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +248 -177
- package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +299 -194
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
- package/dist/i3s-converter/helpers/progress.js +134 -83
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +24 -13
- package/dist/i3s-converter/i3s-converter.d.ts +7 -7
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +1044 -898
- package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
- package/dist/i3s-converter/json-templates/layers.js +120 -121
- package/dist/i3s-converter/json-templates/metadata.js +19 -20
- package/dist/i3s-converter/json-templates/node.js +73 -71
- package/dist/i3s-converter/json-templates/scene-server.js +25 -26
- package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
- package/dist/i3s-converter/json-templates/store.js +96 -94
- package/dist/i3s-converter/types.js +35 -23
- package/dist/i3s-server/app.js +15 -12
- package/dist/i3s-server/bin/www.js +14 -7
- package/dist/i3s-server/controllers/index-controller.js +18 -15
- package/dist/i3s-server/controllers/slpk-controller.js +22 -11
- package/dist/i3s-server/routes/index.js +9 -8
- package/dist/i3s-server/routes/slpk-router.js +18 -17
- package/dist/i3s-server/utils/create-scene-server.js +15 -10
- package/dist/i3s-server/utils/server-utils.js +49 -32
- package/dist/index.cjs +292 -851
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
- package/dist/lib/utils/cli-utils.js +63 -36
- package/dist/lib/utils/compress-util.js +20 -15
- package/dist/lib/utils/conversion-dump.d.ts +1 -1
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +209 -187
- package/dist/lib/utils/file-utils.js +122 -74
- package/dist/lib/utils/geometry-utils.js +13 -7
- package/dist/lib/utils/lod-conversion-utils.js +65 -33
- package/dist/lib/utils/queue.js +12 -13
- package/dist/lib/utils/statistic-utills.d.ts +6 -23
- package/dist/lib/utils/statistic-utills.js +64 -59
- package/dist/lib/utils/write-queue.d.ts +2 -2
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +68 -86
- package/dist/pgm-loader.js +17 -13
- package/dist/slpk-extractor/slpk-extractor.js +59 -50
- package/dist/slpk-extractor-cli.js +82 -59
- package/package.json +18 -18
- package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/converter-cli.js.map +0 -1
- package/dist/deps-installer/deps-installer.js.map +0 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/progress.js.map +0 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
- package/dist/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/i3s-converter/types.js.map +0 -1
- package/dist/i3s-server/README.md +0 -63
- package/dist/i3s-server/app.js.map +0 -1
- package/dist/i3s-server/bin/www.js.map +0 -1
- package/dist/i3s-server/certs/cert.pem +0 -19
- package/dist/i3s-server/certs/key.pem +0 -27
- package/dist/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
- package/dist/i3s-server/routes/index.js.map +0 -1
- package/dist/i3s-server/routes/slpk-router.js.map +0 -1
- package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
- package/dist/i3s-server/utils/server-utils.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
- package/dist/lib/utils/cli-utils.js.map +0 -1
- package/dist/lib/utils/compress-util.js.map +0 -1
- package/dist/lib/utils/conversion-dump.js.map +0 -1
- package/dist/lib/utils/file-utils.js.map +0 -1
- package/dist/lib/utils/geometry-utils.js.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/lib/utils/queue.js.map +0 -1
- package/dist/lib/utils/statistic-utills.js.map +0 -1
- package/dist/lib/utils/write-queue.js.map +0 -1
- package/dist/pgm-loader.js.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
- package/dist/slpk-extractor-cli.js.map +0 -1
|
@@ -3,197 +3,268 @@ import transform from 'json-map-transform';
|
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { openJson, writeFile, writeFileForSlpk } from "../../lib/utils/file-utils.js";
|
|
5
5
|
import { NODE as nodeTemplate } from "../json-templates/node.js";
|
|
6
|
+
/**
|
|
7
|
+
* Wrapper for https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md data
|
|
8
|
+
* The class allows working with 3DNodeIndexDocument in 2 modes:
|
|
9
|
+
* in memory: the data is stored in `data` field
|
|
10
|
+
* on disk: the data is written on disk in a file. The file can be rewritten when new childrend or neighbors have to be added
|
|
11
|
+
*/
|
|
6
12
|
export class NodeIndexDocument {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
constructor(id, converter) {
|
|
11
|
-
this.id = void 0;
|
|
12
|
-
this.inPageId = void 0;
|
|
13
|
-
this.data = null;
|
|
14
|
-
this.children = [];
|
|
15
|
-
this.converter = void 0;
|
|
16
|
-
this._finalized = false;
|
|
17
|
-
this.inPageId = id;
|
|
18
|
-
this.id = id === 0 ? 'root' : id.toString();
|
|
19
|
-
this.converter = converter;
|
|
20
|
-
}
|
|
21
|
-
async addData(data) {
|
|
22
|
-
if (this.converter.options.instantNodeWriting) {
|
|
23
|
-
await this.write(data);
|
|
24
|
-
} else {
|
|
25
|
-
this.data = data;
|
|
13
|
+
get finalized() {
|
|
14
|
+
return this._finalized;
|
|
26
15
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
* @param id - id of the node in node pages
|
|
19
|
+
* @param converter - converter instance
|
|
20
|
+
*/
|
|
21
|
+
constructor(id, converter) {
|
|
22
|
+
/** 3DNodeIndexDocument data */
|
|
23
|
+
this.data = null;
|
|
24
|
+
/** children */
|
|
25
|
+
this.children = [];
|
|
26
|
+
/**
|
|
27
|
+
* Finalized property. It means that all child nodes are saved and their data
|
|
28
|
+
* is unloaded
|
|
29
|
+
*/
|
|
30
|
+
this._finalized = false;
|
|
31
|
+
this.inPageId = id;
|
|
32
|
+
this.id = id === 0 ? 'root' : id.toString();
|
|
33
|
+
this.converter = converter;
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Add Node3DIndexDocument data to the node
|
|
37
|
+
* @param data Node3DIndexDocument data
|
|
38
|
+
* @returns this NodeIndexDocument instance (to recurring with constructor)
|
|
39
|
+
*/
|
|
40
|
+
async addData(data) {
|
|
41
|
+
if (this.converter.options.instantNodeWriting) {
|
|
42
|
+
await this.write(data);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.data = data;
|
|
46
|
+
}
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Add child node references
|
|
51
|
+
* @param childNodes - child NodeIndexDocument instances
|
|
52
|
+
*/
|
|
53
|
+
async addChildren(childNodes) {
|
|
54
|
+
const newChildren = [];
|
|
55
|
+
for (const node of childNodes) {
|
|
56
|
+
const nodeData = await node.load();
|
|
57
|
+
newChildren.push({
|
|
58
|
+
id: node.id,
|
|
59
|
+
href: `../${node.id}`,
|
|
60
|
+
obb: nodeData.obb,
|
|
61
|
+
mbs: nodeData.mbs
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
this.children = this.children.concat(childNodes);
|
|
65
|
+
let data = this.data;
|
|
66
|
+
if (this.converter.options.instantNodeWriting) {
|
|
67
|
+
data = (await this.load());
|
|
68
|
+
}
|
|
69
|
+
if (data) {
|
|
70
|
+
data.children = data.children ?? [];
|
|
71
|
+
data.children = data.children.concat(newChildren);
|
|
72
|
+
}
|
|
73
|
+
if (this.converter.options.instantNodeWriting && data) {
|
|
74
|
+
await this.write(data);
|
|
75
|
+
}
|
|
44
76
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Add neighbors to child nodes of this node
|
|
79
|
+
*/
|
|
80
|
+
async addNeighbors() {
|
|
81
|
+
if (this.finalized) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const nodeData = await this.load();
|
|
85
|
+
for (const childNode of this.children) {
|
|
86
|
+
const childNodeData = await childNode.load();
|
|
87
|
+
childNodeData.neighbors = childNodeData.neighbors ?? [];
|
|
88
|
+
// Don't do large amount of "neightbors" to avoid big memory consumption
|
|
89
|
+
if (Number(nodeData?.children?.length) < 1000) {
|
|
90
|
+
for (const neighbor of nodeData.children || []) {
|
|
91
|
+
if (childNode.id === neighbor.id) {
|
|
92
|
+
continue; // eslint-disable-line
|
|
93
|
+
}
|
|
94
|
+
childNodeData.neighbors.push({ ...neighbor });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// eslint-disable-next-line no-console, no-undef
|
|
99
|
+
console.warn(`Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`);
|
|
100
|
+
delete childNodeData.neighbors;
|
|
101
|
+
}
|
|
102
|
+
if (this.converter.options.instantNodeWriting && childNodeData) {
|
|
103
|
+
await childNode.write(childNodeData);
|
|
104
|
+
}
|
|
105
|
+
await childNode.save();
|
|
106
|
+
}
|
|
107
|
+
// The save after adding neighbors is the last one. Finalize the the node
|
|
108
|
+
this.finalize();
|
|
49
109
|
}
|
|
50
|
-
|
|
51
|
-
|
|
110
|
+
/** Save 3DNodeIndexDocument in file on disk */
|
|
111
|
+
async save() {
|
|
112
|
+
if (this.data) {
|
|
113
|
+
await this.write(this.data);
|
|
114
|
+
}
|
|
52
115
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
116
|
+
/** Finalize the node */
|
|
117
|
+
finalize() {
|
|
118
|
+
this._finalized = true;
|
|
119
|
+
for (const child of this.children) {
|
|
120
|
+
child.flush();
|
|
121
|
+
}
|
|
57
122
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Write 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
|
|
125
|
+
* @param node - Node3DIndexDocument object
|
|
126
|
+
*/
|
|
127
|
+
async write(node) {
|
|
128
|
+
const path = join(this.converter.layers0Path, 'nodes', this.id);
|
|
129
|
+
if (this.converter.options.slpk) {
|
|
130
|
+
await this.converter.writeQueue.enqueue({
|
|
131
|
+
archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
|
|
132
|
+
writePromise: () => writeFileForSlpk(path, JSON.stringify(node), '3dNodeIndexDocument.json', true, this.converter.compressList)
|
|
133
|
+
}, true);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
await this.converter.writeQueue.enqueue({ writePromise: () => writeFile(path, JSON.stringify(node)) }, true);
|
|
71
137
|
}
|
|
72
|
-
} else {
|
|
73
|
-
console.warn(`Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`);
|
|
74
|
-
delete childNodeData.neighbors;
|
|
75
|
-
}
|
|
76
|
-
if (this.converter.options.instantNodeWriting && childNodeData) {
|
|
77
|
-
await childNode.write(childNodeData);
|
|
78
|
-
}
|
|
79
|
-
await childNode.save();
|
|
80
138
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Load 3DNodeIndexDocument data from file on disk
|
|
141
|
+
* @returns 3DNodeIndexDocument object
|
|
142
|
+
*/
|
|
143
|
+
async load() {
|
|
144
|
+
if (this.data) {
|
|
145
|
+
return this.data;
|
|
146
|
+
}
|
|
147
|
+
const path = this.id;
|
|
148
|
+
const parentNodePath = join(this.converter.layers0Path, 'nodes', path);
|
|
149
|
+
let parentNodeFileName = 'index.json';
|
|
150
|
+
if (this.converter.options.slpk) {
|
|
151
|
+
parentNodeFileName = '3dNodeIndexDocument.json';
|
|
152
|
+
}
|
|
153
|
+
return (await openJson(parentNodePath, parentNodeFileName));
|
|
86
154
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Unload the Node data
|
|
157
|
+
*/
|
|
158
|
+
flush() {
|
|
159
|
+
this.data = null;
|
|
92
160
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
writePromise: () => writeFile(path, JSON.stringify(node))
|
|
104
|
-
}, true);
|
|
161
|
+
/**
|
|
162
|
+
* Create root node of the tree
|
|
163
|
+
* @param boundingVolumes - MBS and OOB bounding volumes data
|
|
164
|
+
* @param converter - I3SConverter instance
|
|
165
|
+
* @returns instance of NodeIndexDocument
|
|
166
|
+
*/
|
|
167
|
+
static async createRootNode(boundingVolumes, converter) {
|
|
168
|
+
const rootData = NodeIndexDocument.createRootNodeIndexDocument(boundingVolumes);
|
|
169
|
+
const rootNode = await new NodeIndexDocument(0, converter).addData(rootData);
|
|
170
|
+
return rootNode;
|
|
105
171
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Create NodeIndexDocument instance
|
|
174
|
+
* @param parentNode - parent NodeIndexDocument
|
|
175
|
+
* @param boundingVolumes - MBS and OOB bounding volumes data
|
|
176
|
+
* @param lodSelection - LOD metrics data
|
|
177
|
+
* @param nodeInPage - node data in node pages
|
|
178
|
+
* @param resources - resources extracted from gltf/b3dm file
|
|
179
|
+
* @param converter - I3SConverter instance
|
|
180
|
+
* @returns NodeIndexDocument instance
|
|
181
|
+
*/
|
|
182
|
+
static async createNode(parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter) {
|
|
183
|
+
const data = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
|
|
184
|
+
const node = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);
|
|
185
|
+
return node;
|
|
110
186
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Form 3DNodeIndexDocument data for the root node
|
|
189
|
+
* @param boundingVolumes - mbs and obb data about node's bounding volume
|
|
190
|
+
* @return 3DNodeIndexDocument data https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md
|
|
191
|
+
*/
|
|
192
|
+
static createRootNodeIndexDocument(boundingVolumes) {
|
|
193
|
+
const root0data = {
|
|
194
|
+
version: `{${uuidv4().toUpperCase()}}`,
|
|
195
|
+
id: 'root',
|
|
196
|
+
level: 0,
|
|
197
|
+
lodSelection: [
|
|
198
|
+
{
|
|
199
|
+
metricType: 'maxScreenThresholdSQ',
|
|
200
|
+
maxError: 0
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
metricType: 'maxScreenThreshold',
|
|
204
|
+
maxError: 0
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
...boundingVolumes,
|
|
208
|
+
children: []
|
|
209
|
+
};
|
|
210
|
+
return transform(root0data, nodeTemplate());
|
|
116
211
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}];
|
|
173
|
-
node.sharedResource = {
|
|
174
|
-
href: './shared'
|
|
175
|
-
};
|
|
176
|
-
if ('texture' in resources && resources.texture || 'texelCountHint' in resources && resources.texelCountHint) {
|
|
177
|
-
node.textureData = [{
|
|
178
|
-
href: './textures/0'
|
|
179
|
-
}, {
|
|
180
|
-
href: './textures/1'
|
|
181
|
-
}];
|
|
182
|
-
}
|
|
183
|
-
if ('attributes' in resources && resources.attributes && resources.attributes.length && (_parentNode$converter = parentNode.converter.layers0) !== null && _parentNode$converter !== void 0 && (_parentNode$converter2 = _parentNode$converter.attributeStorageInfo) !== null && _parentNode$converter2 !== void 0 && _parentNode$converter2.length || 'attributesCount' in resources && resources.attributesCount && (_parentNode$converter3 = parentNode.converter.layers0) !== null && _parentNode$converter3 !== void 0 && (_parentNode$converter4 = _parentNode$converter3.attributeStorageInfo) !== null && _parentNode$converter4 !== void 0 && _parentNode$converter4.length) {
|
|
184
|
-
var _resources$attributes;
|
|
185
|
-
const attributesLength = ('attributes' in resources ? (_resources$attributes = resources.attributes) === null || _resources$attributes === void 0 ? void 0 : _resources$attributes.length : resources.attributesCount) || 0;
|
|
186
|
-
node.attributeData = [];
|
|
187
|
-
const minimumLength = attributesLength < parentNode.converter.layers0.attributeStorageInfo.length ? attributesLength : parentNode.converter.layers0.attributeStorageInfo.length;
|
|
188
|
-
for (let index = 0; index < minimumLength; index++) {
|
|
189
|
-
const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;
|
|
190
|
-
node.attributeData.push({
|
|
191
|
-
href: `./attributes/${folderName}/0`
|
|
192
|
-
});
|
|
212
|
+
/**
|
|
213
|
+
* Create a new Node3DIndexDocument
|
|
214
|
+
* @param parentNode - 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object of the parent node
|
|
215
|
+
* @param boundingVolumes - Bounding volumes
|
|
216
|
+
* @param lodSelection - Level of Details (LOD) metrics
|
|
217
|
+
* @param nodeInPage - corresponding node object in a node page
|
|
218
|
+
* @param resources - the node resources data
|
|
219
|
+
* @param resources.texture - texture image
|
|
220
|
+
* @param resources.attributes - feature attributes
|
|
221
|
+
* @return 3DNodeIndexDocument https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DNodeIndexDocument.cmn.md object
|
|
222
|
+
*/
|
|
223
|
+
static async createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
|
|
224
|
+
const nodeId = nodeInPage.index;
|
|
225
|
+
const parentNodeData = await parentNode.load();
|
|
226
|
+
const nodeData = {
|
|
227
|
+
version: parentNodeData.version,
|
|
228
|
+
id: nodeId.toString(),
|
|
229
|
+
level: parentNodeData.level + 1,
|
|
230
|
+
...boundingVolumes,
|
|
231
|
+
lodSelection,
|
|
232
|
+
parentNode: {
|
|
233
|
+
id: parentNode.id,
|
|
234
|
+
href: `../${parentNode.id}`,
|
|
235
|
+
mbs: parentNodeData.mbs,
|
|
236
|
+
obb: parentNodeData.obb
|
|
237
|
+
},
|
|
238
|
+
children: [],
|
|
239
|
+
neighbors: []
|
|
240
|
+
};
|
|
241
|
+
const node = transform(nodeData, nodeTemplate());
|
|
242
|
+
if (nodeInPage.mesh) {
|
|
243
|
+
node.geometryData = [{ href: './geometries/0' }];
|
|
244
|
+
node.sharedResource = { href: './shared' };
|
|
245
|
+
if (('texture' in resources && resources.texture) ||
|
|
246
|
+
('texelCountHint' in resources && resources.texelCountHint)) {
|
|
247
|
+
node.textureData = [{ href: './textures/0' }, { href: './textures/1' }];
|
|
248
|
+
}
|
|
249
|
+
if (('attributes' in resources &&
|
|
250
|
+
resources.attributes &&
|
|
251
|
+
resources.attributes.length &&
|
|
252
|
+
parentNode.converter.layers0?.attributeStorageInfo?.length) ||
|
|
253
|
+
('attributesCount' in resources &&
|
|
254
|
+
resources.attributesCount &&
|
|
255
|
+
parentNode.converter.layers0?.attributeStorageInfo?.length)) {
|
|
256
|
+
const attributesLength = ('attributes' in resources ? resources.attributes?.length : resources.attributesCount) ||
|
|
257
|
+
0;
|
|
258
|
+
node.attributeData = [];
|
|
259
|
+
const minimumLength = attributesLength < parentNode.converter.layers0.attributeStorageInfo.length
|
|
260
|
+
? attributesLength
|
|
261
|
+
: parentNode.converter.layers0.attributeStorageInfo.length;
|
|
262
|
+
for (let index = 0; index < minimumLength; index++) {
|
|
263
|
+
const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;
|
|
264
|
+
node.attributeData.push({ href: `./attributes/${folderName}/0` });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
193
267
|
}
|
|
194
|
-
|
|
268
|
+
return node;
|
|
195
269
|
}
|
|
196
|
-
return node;
|
|
197
|
-
}
|
|
198
270
|
}
|
|
199
|
-
//# sourceMappingURL=node-index-document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,YAAY,
|
|
1
|
+
{"version":3,"file":"node-pages.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/node-pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,YAAY,4BAAyB;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAC/C,SAAS,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAC,EAAE,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAK;IAE5B;;;;;OAKG;gBACS,aAAa,KAAA,EAAE,YAAY,KAAA,EAAE,SAAS,EAAE,YAAY;IAWhE;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,OAAA,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,IAAI;IAIjE;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;OAIG;YACW,YAAY;IAW1B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;;;OAIG;YACW,eAAe;IAQ7B;;;;OAIG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAMpF;;;;OAIG;YACW,gBAAgB;IAS9B;;;;;OAKG;IACG,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBpE;;;OAGG;IACG,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC/C;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAenC;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA0B3B;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAMnD;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU;IAMhE;;;;OAIG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAUzE;;;;OAIG;IACH,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAO7E;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAO1D;;;;OAIG;IACH,MAAM,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAO/E;;;;OAIG;IACH,MAAM,CAAC,4BAA4B,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI;CAMpF"}
|