@loaders.gl/tile-converter 3.4.13 → 3.4.15
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 +1 -1
- package/dist/converter.min.js +78 -77
- package/dist/dist.min.js +2081 -1557
- package/dist/es5/3d-tiles-attributes-worker.js +3 -3
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +203 -417
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +197 -266
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +4 -6
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +12 -12
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +35 -51
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/constants.js +1 -1
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/converter-cli.js +78 -133
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +38 -110
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +3 -3
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +31 -36
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +23 -23
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +9 -27
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +27 -42
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +97 -114
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +524 -799
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +24 -25
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +27 -25
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-index-document.js +165 -461
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +169 -474
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +663 -1401
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +82 -92
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js +130 -152
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js +21 -23
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js +78 -89
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js +27 -31
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +110 -152
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js +2 -4
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-server/app.js +6 -6
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +20 -49
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +14 -33
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js +2 -2
- package/dist/es5/lib/utils/compress-util.js +127 -295
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +65 -174
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +9 -9
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +13 -38
- package/dist/es5/lib/utils/queue.js.map +1 -1
- package/dist/es5/lib/utils/statistic-utills.js +39 -117
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +74 -195
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +3 -22
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +5 -22
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/workers/i3s-attributes-worker.js +4 -25
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-attributes-worker.js +2 -2
- package/dist/i3s-attributes-worker.js.map +3 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +1 -1
- package/src/i3s-converter/helpers/geometry-converter.ts +14 -14
|
@@ -5,22 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
9
|
var _path = require("path");
|
|
15
10
|
var _jsonMapTransform = _interopRequireDefault(require("json-map-transform"));
|
|
16
11
|
var _metadata = require("../json-templates/metadata");
|
|
17
12
|
var _fileUtils = require("../../lib/utils/file-utils");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
|
-
var NodePages = function () {
|
|
22
|
-
function NodePages(writeFileFunc, nodesPerPage, converter) {
|
|
23
|
-
(0, _classCallCheck2.default)(this, NodePages);
|
|
13
|
+
class NodePages {
|
|
14
|
+
constructor(writeFileFunc, nodesPerPage, converter) {
|
|
24
15
|
(0, _defineProperty2.default)(this, "nodesPerPage", void 0);
|
|
25
16
|
(0, _defineProperty2.default)(this, "nodesCounter", void 0);
|
|
26
17
|
(0, _defineProperty2.default)(this, "writeFile", void 0);
|
|
@@ -35,485 +26,189 @@ var NodePages = function () {
|
|
|
35
26
|
this.converter = converter;
|
|
36
27
|
this.length = 0;
|
|
37
28
|
}
|
|
38
|
-
(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
useWriteFunction(func) {
|
|
30
|
+
this.writeFile = func;
|
|
31
|
+
}
|
|
32
|
+
getNodePageFileName(nodePageId) {
|
|
33
|
+
let filePath;
|
|
34
|
+
let fileName;
|
|
35
|
+
if (this.converter.options.slpk) {
|
|
36
|
+
filePath = (0, _path.join)(this.converter.layers0Path, 'nodepages');
|
|
37
|
+
fileName = "".concat(nodePageId.toString(), ".json");
|
|
38
|
+
} else {
|
|
39
|
+
filePath = (0, _path.join)(this.converter.layers0Path, 'nodepages', nodePageId.toString());
|
|
40
|
+
fileName = 'index.json';
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
return {
|
|
43
|
+
filePath,
|
|
44
|
+
fileName
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async loadNodePage(nodePageId) {
|
|
48
|
+
const {
|
|
49
|
+
filePath,
|
|
50
|
+
fileName
|
|
51
|
+
} = this.getNodePageFileName(nodePageId);
|
|
52
|
+
const fullName = (0, _path.join)(filePath, fileName);
|
|
53
|
+
if (await (0, _fileUtils.isFileExists)(fullName)) {
|
|
54
|
+
console.log("load ".concat(fullName, "."));
|
|
55
|
+
return await (0, _fileUtils.openJson)(filePath, fileName);
|
|
56
|
+
} else {
|
|
55
57
|
return {
|
|
56
|
-
|
|
57
|
-
fileName: fileName
|
|
58
|
+
nodes: []
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
_this$getNodePageFile = this.getNodePageFileName(nodePageId), filePath = _this$getNodePageFile.filePath, fileName = _this$getNodePageFile.fileName;
|
|
69
|
-
fullName = (0, _path.join)(filePath, fileName);
|
|
70
|
-
_context.next = 4;
|
|
71
|
-
return (0, _fileUtils.isFileExists)(fullName);
|
|
72
|
-
case 4:
|
|
73
|
-
if (!_context.sent) {
|
|
74
|
-
_context.next = 11;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
console.log("load ".concat(fullName, "."));
|
|
78
|
-
_context.next = 8;
|
|
79
|
-
return (0, _fileUtils.openJson)(filePath, fileName);
|
|
80
|
-
case 8:
|
|
81
|
-
return _context.abrupt("return", _context.sent);
|
|
82
|
-
case 11:
|
|
83
|
-
return _context.abrupt("return", {
|
|
84
|
-
nodes: []
|
|
85
|
-
});
|
|
86
|
-
case 12:
|
|
87
|
-
case "end":
|
|
88
|
-
return _context.stop();
|
|
89
|
-
}
|
|
90
|
-
}, _callee, this);
|
|
91
|
-
}));
|
|
92
|
-
function loadNodePage(_x) {
|
|
93
|
-
return _loadNodePage.apply(this, arguments);
|
|
94
|
-
}
|
|
95
|
-
return loadNodePage;
|
|
96
|
-
}()
|
|
97
|
-
}, {
|
|
98
|
-
key: "getPageIndexByNodeId",
|
|
99
|
-
value: function getPageIndexByNodeId(id) {
|
|
100
|
-
return Math.floor(id / this.nodesPerPage);
|
|
61
|
+
}
|
|
62
|
+
getPageIndexByNodeId(id) {
|
|
63
|
+
return Math.floor(id / this.nodesPerPage);
|
|
64
|
+
}
|
|
65
|
+
async getPageByNodeId(id) {
|
|
66
|
+
const pageIndex = this.getPageIndexByNodeId(id);
|
|
67
|
+
if (this.converter.options.instantNodeWriting) {
|
|
68
|
+
return await this.loadNodePage(pageIndex);
|
|
101
69
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function getPageByNodeId(_x2) {
|
|
128
|
-
return _getPageByNodeId.apply(this, arguments);
|
|
129
|
-
}
|
|
130
|
-
return getPageByNodeId;
|
|
131
|
-
}()
|
|
132
|
-
}, {
|
|
133
|
-
key: "getNodeById",
|
|
134
|
-
value: function () {
|
|
135
|
-
var _getNodeById = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(id, nodePage) {
|
|
136
|
-
var nodeIndex;
|
|
137
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
138
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
139
|
-
case 0:
|
|
140
|
-
nodeIndex = id % this.nodesPerPage;
|
|
141
|
-
_context3.t0 = nodePage;
|
|
142
|
-
if (_context3.t0) {
|
|
143
|
-
_context3.next = 6;
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
_context3.next = 5;
|
|
147
|
-
return this.getPageByNodeId(id);
|
|
148
|
-
case 5:
|
|
149
|
-
_context3.t0 = _context3.sent;
|
|
150
|
-
case 6:
|
|
151
|
-
nodePage = _context3.t0;
|
|
152
|
-
return _context3.abrupt("return", nodePage.nodes[nodeIndex]);
|
|
153
|
-
case 8:
|
|
154
|
-
case "end":
|
|
155
|
-
return _context3.stop();
|
|
156
|
-
}
|
|
157
|
-
}, _callee3, this);
|
|
158
|
-
}));
|
|
159
|
-
function getNodeById(_x3, _x4) {
|
|
160
|
-
return _getNodeById.apply(this, arguments);
|
|
161
|
-
}
|
|
162
|
-
return getNodeById;
|
|
163
|
-
}()
|
|
164
|
-
}, {
|
|
165
|
-
key: "addChildRelation",
|
|
166
|
-
value: function () {
|
|
167
|
-
var _addChildRelation = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(parentId, childId) {
|
|
168
|
-
var _parentNode$children;
|
|
169
|
-
var parentNode;
|
|
170
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
171
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
172
|
-
case 0:
|
|
173
|
-
if (!(parentId === null || parentId === undefined)) {
|
|
174
|
-
_context4.next = 2;
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
return _context4.abrupt("return");
|
|
178
|
-
case 2:
|
|
179
|
-
_context4.next = 4;
|
|
180
|
-
return this.getNodeById(parentId);
|
|
181
|
-
case 4:
|
|
182
|
-
parentNode = _context4.sent;
|
|
183
|
-
(_parentNode$children = parentNode.children) === null || _parentNode$children === void 0 ? void 0 : _parentNode$children.push(childId);
|
|
184
|
-
_context4.next = 8;
|
|
185
|
-
return this.saveNode(parentNode);
|
|
186
|
-
case 8:
|
|
187
|
-
case "end":
|
|
188
|
-
return _context4.stop();
|
|
189
|
-
}
|
|
190
|
-
}, _callee4, this);
|
|
191
|
-
}));
|
|
192
|
-
function addChildRelation(_x5, _x6) {
|
|
193
|
-
return _addChildRelation.apply(this, arguments);
|
|
194
|
-
}
|
|
195
|
-
return addChildRelation;
|
|
196
|
-
}()
|
|
197
|
-
}, {
|
|
198
|
-
key: "push",
|
|
199
|
-
value: function () {
|
|
200
|
-
var _push = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(node, parentId) {
|
|
201
|
-
var currentNodePage;
|
|
202
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
203
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
204
|
-
case 0:
|
|
205
|
-
node.index = this.nodesCounter++;
|
|
206
|
-
if (!this.converter.options.instantNodeWriting) {
|
|
207
|
-
currentNodePage = this.nodePages[this.nodePages.length - 1];
|
|
208
|
-
if (currentNodePage.nodes.length === this.nodesPerPage) {
|
|
209
|
-
currentNodePage = {
|
|
210
|
-
nodes: []
|
|
211
|
-
};
|
|
212
|
-
this.nodePages.push(currentNodePage);
|
|
213
|
-
}
|
|
214
|
-
currentNodePage.nodes.push(node);
|
|
215
|
-
}
|
|
216
|
-
_context5.next = 4;
|
|
217
|
-
return this.addChildRelation(parentId, node.index);
|
|
218
|
-
case 4:
|
|
219
|
-
NodePages.updateResourceInMesh(node);
|
|
220
|
-
_context5.next = 7;
|
|
221
|
-
return this.saveNode(node);
|
|
222
|
-
case 7:
|
|
223
|
-
return _context5.abrupt("return", node);
|
|
224
|
-
case 8:
|
|
225
|
-
case "end":
|
|
226
|
-
return _context5.stop();
|
|
227
|
-
}
|
|
228
|
-
}, _callee5, this);
|
|
229
|
-
}));
|
|
230
|
-
function push(_x7, _x8) {
|
|
231
|
-
return _push.apply(this, arguments);
|
|
70
|
+
return this.nodePages[pageIndex];
|
|
71
|
+
}
|
|
72
|
+
async getNodeById(id, nodePage) {
|
|
73
|
+
const nodeIndex = id % this.nodesPerPage;
|
|
74
|
+
nodePage = nodePage || (await this.getPageByNodeId(id));
|
|
75
|
+
return nodePage.nodes[nodeIndex];
|
|
76
|
+
}
|
|
77
|
+
async addChildRelation(parentId, childId) {
|
|
78
|
+
var _parentNode$children;
|
|
79
|
+
if (parentId === null || parentId === undefined) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const parentNode = await this.getNodeById(parentId);
|
|
83
|
+
(_parentNode$children = parentNode.children) === null || _parentNode$children === void 0 ? void 0 : _parentNode$children.push(childId);
|
|
84
|
+
await this.saveNode(parentNode);
|
|
85
|
+
}
|
|
86
|
+
async push(node, parentId) {
|
|
87
|
+
node.index = this.nodesCounter++;
|
|
88
|
+
if (!this.converter.options.instantNodeWriting) {
|
|
89
|
+
let currentNodePage = this.nodePages[this.nodePages.length - 1];
|
|
90
|
+
if (currentNodePage.nodes.length === this.nodesPerPage) {
|
|
91
|
+
currentNodePage = {
|
|
92
|
+
nodes: []
|
|
93
|
+
};
|
|
94
|
+
this.nodePages.push(currentNodePage);
|
|
232
95
|
}
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
_this$getNodePageFile2 = this.getNodePageFileName(nodePageIndex), filePath = _this$getNodePageFile2.filePath, fileName = _this$getNodePageFile2.fileName;
|
|
256
|
-
_context6.next = 11;
|
|
257
|
-
return this.getNodeById(node.index, nodePage);
|
|
258
|
-
case 11:
|
|
259
|
-
nodeToUpdate = _context6.sent;
|
|
260
|
-
if (nodeToUpdate) {
|
|
261
|
-
NodePages.updateAll(nodeToUpdate, node);
|
|
262
|
-
} else {
|
|
263
|
-
nodePage.nodes.push(node);
|
|
264
|
-
}
|
|
265
|
-
nodePageStr = JSON.stringify(nodePage);
|
|
266
|
-
if (!this.converter.options.slpk) {
|
|
267
|
-
_context6.next = 19;
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
_context6.next = 17;
|
|
271
|
-
return this.converter.writeQueue.enqueue({
|
|
272
|
-
archiveKey: "nodePages/".concat(nodePageIndex.toString(), ".json.gz"),
|
|
273
|
-
writePromise: function writePromise() {
|
|
274
|
-
return _this.writeFile(filePath, nodePageStr, fileName, true, _this.converter.compressList);
|
|
275
|
-
}
|
|
276
|
-
}, true);
|
|
277
|
-
case 17:
|
|
278
|
-
_context6.next = 21;
|
|
279
|
-
break;
|
|
280
|
-
case 19:
|
|
281
|
-
_context6.next = 21;
|
|
282
|
-
return this.converter.writeQueue.enqueue({
|
|
283
|
-
writePromise: function writePromise() {
|
|
284
|
-
return _this.writeFile(filePath, nodePageStr);
|
|
285
|
-
}
|
|
286
|
-
}, true);
|
|
287
|
-
case 21:
|
|
288
|
-
case "end":
|
|
289
|
-
return _context6.stop();
|
|
290
|
-
}
|
|
291
|
-
}, _callee6, this);
|
|
292
|
-
}));
|
|
293
|
-
function saveNode(_x9) {
|
|
294
|
-
return _saveNode.apply(this, arguments);
|
|
96
|
+
currentNodePage.nodes.push(node);
|
|
97
|
+
}
|
|
98
|
+
await this.addChildRelation(parentId, node.index);
|
|
99
|
+
NodePages.updateResourceInMesh(node);
|
|
100
|
+
await this.saveNode(node);
|
|
101
|
+
return node;
|
|
102
|
+
}
|
|
103
|
+
async saveNode(node) {
|
|
104
|
+
if (!this.converter.options.instantNodeWriting) {
|
|
105
|
+
return;
|
|
106
|
+
} else {
|
|
107
|
+
const nodePageIndex = this.getPageIndexByNodeId(node.index);
|
|
108
|
+
const nodePage = await this.getPageByNodeId(node.index);
|
|
109
|
+
const {
|
|
110
|
+
filePath,
|
|
111
|
+
fileName
|
|
112
|
+
} = this.getNodePageFileName(nodePageIndex);
|
|
113
|
+
const nodeToUpdate = await this.getNodeById(node.index, nodePage);
|
|
114
|
+
if (nodeToUpdate) {
|
|
115
|
+
NodePages.updateAll(nodeToUpdate, node);
|
|
116
|
+
} else {
|
|
117
|
+
nodePage.nodes.push(node);
|
|
295
118
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
case 0:
|
|
307
|
-
metadata = (0, _jsonMapTransform.default)({
|
|
308
|
-
nodeCount: this.nodesCounter
|
|
309
|
-
}, (0, _metadata.METADATA)());
|
|
310
|
-
compress = false;
|
|
311
|
-
_context7.next = 4;
|
|
312
|
-
return this.converter.writeQueue.enqueue({
|
|
313
|
-
archiveKey: 'metadata.json',
|
|
314
|
-
writePromise: function writePromise() {
|
|
315
|
-
return _this2.writeFile(_this2.converter.layers0Path, JSON.stringify(metadata), 'metadata.json', compress);
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
case 4:
|
|
319
|
-
case "end":
|
|
320
|
-
return _context7.stop();
|
|
321
|
-
}
|
|
322
|
-
}, _callee7, this);
|
|
323
|
-
}));
|
|
324
|
-
function saveMetadata() {
|
|
325
|
-
return _saveMetadata.apply(this, arguments);
|
|
119
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
120
|
+
if (this.converter.options.slpk) {
|
|
121
|
+
await this.converter.writeQueue.enqueue({
|
|
122
|
+
archiveKey: "nodePages/".concat(nodePageIndex.toString(), ".json.gz"),
|
|
123
|
+
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
124
|
+
}, true);
|
|
125
|
+
} else {
|
|
126
|
+
await this.converter.writeQueue.enqueue({
|
|
127
|
+
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
128
|
+
}, true);
|
|
326
129
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
_context10.prev = 6;
|
|
353
|
-
_loop = _regenerator.default.mark(function _loop() {
|
|
354
|
-
var _step$value, index, nodePage, nodePageStr, slpkPath;
|
|
355
|
-
return _regenerator.default.wrap(function _loop$(_context8) {
|
|
356
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
357
|
-
case 0:
|
|
358
|
-
_step$value = (0, _slicedToArray2.default)(_step.value, 2), index = _step$value[0], nodePage = _step$value[1];
|
|
359
|
-
nodePageStr = JSON.stringify(nodePage);
|
|
360
|
-
slpkPath = (0, _path.join)(_this3.converter.layers0Path, 'nodepages');
|
|
361
|
-
_context8.next = 5;
|
|
362
|
-
return _this3.converter.writeQueue.enqueue({
|
|
363
|
-
archiveKey: "nodePages/".concat(index.toString(), ".json.gz"),
|
|
364
|
-
writePromise: function writePromise() {
|
|
365
|
-
return _this3.writeFile(slpkPath, nodePageStr, "".concat(index.toString(), ".json"));
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
case 5:
|
|
369
|
-
case "end":
|
|
370
|
-
return _context8.stop();
|
|
371
|
-
}
|
|
372
|
-
}, _loop);
|
|
373
|
-
});
|
|
374
|
-
_iterator.s();
|
|
375
|
-
case 9:
|
|
376
|
-
if ((_step = _iterator.n()).done) {
|
|
377
|
-
_context10.next = 13;
|
|
378
|
-
break;
|
|
379
|
-
}
|
|
380
|
-
return _context10.delegateYield(_loop(), "t0", 11);
|
|
381
|
-
case 11:
|
|
382
|
-
_context10.next = 9;
|
|
383
|
-
break;
|
|
384
|
-
case 13:
|
|
385
|
-
_context10.next = 18;
|
|
386
|
-
break;
|
|
387
|
-
case 15:
|
|
388
|
-
_context10.prev = 15;
|
|
389
|
-
_context10.t1 = _context10["catch"](6);
|
|
390
|
-
_iterator.e(_context10.t1);
|
|
391
|
-
case 18:
|
|
392
|
-
_context10.prev = 18;
|
|
393
|
-
_iterator.f();
|
|
394
|
-
return _context10.finish(18);
|
|
395
|
-
case 21:
|
|
396
|
-
_context10.next = 23;
|
|
397
|
-
return this.saveMetadata();
|
|
398
|
-
case 23:
|
|
399
|
-
_context10.next = 41;
|
|
400
|
-
break;
|
|
401
|
-
case 25:
|
|
402
|
-
_iterator2 = _createForOfIteratorHelper(this.nodePages.entries());
|
|
403
|
-
_context10.prev = 26;
|
|
404
|
-
_loop2 = _regenerator.default.mark(function _loop2() {
|
|
405
|
-
var _step2$value, index, nodePage, nodePageStr, nodePagePath;
|
|
406
|
-
return _regenerator.default.wrap(function _loop2$(_context9) {
|
|
407
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
408
|
-
case 0:
|
|
409
|
-
_step2$value = (0, _slicedToArray2.default)(_step2.value, 2), index = _step2$value[0], nodePage = _step2$value[1];
|
|
410
|
-
nodePageStr = JSON.stringify(nodePage);
|
|
411
|
-
nodePagePath = (0, _path.join)(_this3.converter.layers0Path, 'nodepages', index.toString());
|
|
412
|
-
_context9.next = 5;
|
|
413
|
-
return _this3.converter.writeQueue.enqueue({
|
|
414
|
-
writePromise: function writePromise() {
|
|
415
|
-
return _this3.writeFile(nodePagePath, nodePageStr);
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
case 5:
|
|
419
|
-
case "end":
|
|
420
|
-
return _context9.stop();
|
|
421
|
-
}
|
|
422
|
-
}, _loop2);
|
|
423
|
-
});
|
|
424
|
-
_iterator2.s();
|
|
425
|
-
case 29:
|
|
426
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
427
|
-
_context10.next = 33;
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
return _context10.delegateYield(_loop2(), "t2", 31);
|
|
431
|
-
case 31:
|
|
432
|
-
_context10.next = 29;
|
|
433
|
-
break;
|
|
434
|
-
case 33:
|
|
435
|
-
_context10.next = 38;
|
|
436
|
-
break;
|
|
437
|
-
case 35:
|
|
438
|
-
_context10.prev = 35;
|
|
439
|
-
_context10.t3 = _context10["catch"](26);
|
|
440
|
-
_iterator2.e(_context10.t3);
|
|
441
|
-
case 38:
|
|
442
|
-
_context10.prev = 38;
|
|
443
|
-
_iterator2.f();
|
|
444
|
-
return _context10.finish(38);
|
|
445
|
-
case 41:
|
|
446
|
-
case "end":
|
|
447
|
-
return _context10.stop();
|
|
448
|
-
}
|
|
449
|
-
}, _callee8, this, [[6, 15, 18, 21], [26, 35, 38, 41]]);
|
|
450
|
-
}));
|
|
451
|
-
function save() {
|
|
452
|
-
return _save.apply(this, arguments);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async saveMetadata() {
|
|
133
|
+
const metadata = (0, _jsonMapTransform.default)({
|
|
134
|
+
nodeCount: this.nodesCounter
|
|
135
|
+
}, (0, _metadata.METADATA)());
|
|
136
|
+
const compress = false;
|
|
137
|
+
await this.converter.writeQueue.enqueue({
|
|
138
|
+
archiveKey: 'metadata.json',
|
|
139
|
+
writePromise: () => this.writeFile(this.converter.layers0Path, JSON.stringify(metadata), 'metadata.json', compress)
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async save() {
|
|
143
|
+
if (this.converter.options.instantNodeWriting) {
|
|
144
|
+
await this.saveMetadata();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (this.converter.options.slpk) {
|
|
148
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
149
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
150
|
+
const slpkPath = (0, _path.join)(this.converter.layers0Path, 'nodepages');
|
|
151
|
+
await this.converter.writeQueue.enqueue({
|
|
152
|
+
archiveKey: "nodePages/".concat(index.toString(), ".json.gz"),
|
|
153
|
+
writePromise: () => this.writeFile(slpkPath, nodePageStr, "".concat(index.toString(), ".json"))
|
|
154
|
+
});
|
|
453
155
|
}
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
156
|
+
await this.saveMetadata();
|
|
157
|
+
} else {
|
|
158
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
159
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
160
|
+
const nodePagePath = (0, _path.join)(this.converter.layers0Path, 'nodepages', index.toString());
|
|
161
|
+
await this.converter.writeQueue.enqueue({
|
|
162
|
+
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
163
|
+
});
|
|
461
164
|
}
|
|
462
165
|
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
index: node.index
|
|
468
|
-
});
|
|
469
|
-
NodePages.updateResourceInMesh(node);
|
|
470
|
-
return node;
|
|
166
|
+
}
|
|
167
|
+
static updateResourceInMesh(node) {
|
|
168
|
+
if (node.mesh && isFinite(node.index)) {
|
|
169
|
+
node.mesh.geometry.resource = node.index;
|
|
471
170
|
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
171
|
+
}
|
|
172
|
+
static updateAll(node, data) {
|
|
173
|
+
Object.assign(node, data, {
|
|
174
|
+
index: node.index
|
|
175
|
+
});
|
|
176
|
+
NodePages.updateResourceInMesh(node);
|
|
177
|
+
return node;
|
|
178
|
+
}
|
|
179
|
+
static updateMaterialByNodeId(node, materialId) {
|
|
180
|
+
if (!node.mesh) {
|
|
181
|
+
return;
|
|
482
182
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
183
|
+
node.mesh.material = {
|
|
184
|
+
definition: materialId,
|
|
185
|
+
resource: node.index
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
static updateVertexCountByNodeId(node, vertexCount) {
|
|
189
|
+
if (!node.mesh) {
|
|
190
|
+
return;
|
|
490
191
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
node.mesh.attribute.resource = node.index;
|
|
192
|
+
node.mesh.geometry.vertexCount = vertexCount;
|
|
193
|
+
}
|
|
194
|
+
static updateNodeAttributeByNodeId(node) {
|
|
195
|
+
if (!node.mesh || !node.index) {
|
|
196
|
+
return;
|
|
498
197
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
node.mesh.geometry.featureCount = featureCount;
|
|
198
|
+
node.mesh.attribute.resource = node.index;
|
|
199
|
+
}
|
|
200
|
+
static updateFeatureCountByNodeId(node, featureCount) {
|
|
201
|
+
if (!node.mesh) {
|
|
202
|
+
return;
|
|
506
203
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
node.mesh.material.texelCountHint = texelCountHint;
|
|
204
|
+
node.mesh.geometry.featureCount = featureCount;
|
|
205
|
+
}
|
|
206
|
+
static updateTexelCountHintByNodeId(node, texelCountHint) {
|
|
207
|
+
if (!node.mesh || !node.mesh.material) {
|
|
208
|
+
return;
|
|
514
209
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
210
|
+
node.mesh.material.texelCountHint = texelCountHint;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
518
213
|
exports.default = NodePages;
|
|
519
214
|
//# sourceMappingURL=node-pages.js.map
|