@loaders.gl/tile-converter 3.1.0-beta.7 → 3.1.0
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/bundle.js +1267 -1174
- package/dist/converter.min.js +20 -20
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +429 -189
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +306 -209
- 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 +8 -4
- 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 +13 -13
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +51 -32
- 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/deps-installer/deps-installer.js +61 -17
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +55 -16
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +33 -9
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +103 -93
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.d.ts +5 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +547 -336
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +27 -31
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +209 -101
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +1645 -700
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js +213 -177
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js +24 -20
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js +92 -74
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js +34 -28
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +162 -107
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js +4 -2
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-converter/types.js +2 -0
- package/dist/es5/i3s-converter/types.js.map +1 -0
- 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 +60 -20
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +41 -14
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js +4 -4
- package/dist/es5/lib/utils/{compress-utils.d.ts → compress-util.d.ts} +0 -0
- package/dist/es5/lib/utils/compress-util.js +345 -123
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +98 -20
- 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/statistic-utills.js +152 -41
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/pgm-loader.js +31 -4
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +7 -6
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +7 -0
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +1 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js +12 -9
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +2 -6
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +35 -3
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +2 -2
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +5 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +50 -16
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-debug.js +2 -4
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +15 -4
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +147 -62
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/layers.js +37 -27
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js +2 -2
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/node.js +16 -12
- package/dist/esm/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js +2 -2
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/shared-resources.js +19 -14
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/esm/i3s-converter/types.js +2 -0
- package/dist/esm/i3s-converter/types.js.map +1 -0
- package/dist/esm/lib/utils/{compress-utils.d.ts → compress-util.d.ts} +0 -0
- package/dist/esm/pgm-loader.js +3 -3
- package/dist/esm/pgm-loader.js.map +1 -1
- package/package.json +15 -13
- package/src/3d-tiles-converter/3d-tiles-converter.ts +21 -20
- package/src/3d-tiles-converter/helpers/{b3dm-converter.js → b3dm-converter.ts} +19 -2
- package/src/3d-tiles-converter/helpers/{i3s-obb-to-3d-tiles-obb.js → i3s-obb-to-3d-tiles-obb.ts} +16 -1
- package/src/3d-tiles-converter/helpers/texture-atlas.ts +4 -4
- package/src/3d-tiles-converter/json-templates/{tileset.js → tileset.ts} +9 -9
- package/src/deps-installer/deps-installer.js +2 -2
- package/src/i3s-converter/helpers/coordinate-converter.ts +62 -9
- package/src/i3s-converter/helpers/{create-scene-server-path.js → create-scene-server-path.ts} +2 -2
- package/src/i3s-converter/helpers/{geometry-attributes.js → geometry-attributes.ts} +4 -4
- package/src/i3s-converter/helpers/geometry-converter.d.ts +5 -1
- package/src/i3s-converter/helpers/geometry-converter.js +63 -13
- package/src/i3s-converter/helpers/{node-debug.js → node-debug.ts} +3 -2
- package/src/i3s-converter/helpers/{node-pages.js → node-pages.ts} +41 -26
- package/src/i3s-converter/i3s-converter.ts +204 -133
- package/src/i3s-converter/json-templates/{layers.js → layers.ts} +29 -27
- package/src/i3s-converter/json-templates/{metadata.js → metadata.ts} +2 -2
- package/src/i3s-converter/json-templates/{node.js → node.ts} +12 -12
- package/src/i3s-converter/json-templates/{scene-server.js → scene-server.ts} +2 -2
- package/src/i3s-converter/json-templates/{shared-resources.js → shared-resources.ts} +14 -14
- package/src/i3s-converter/json-templates/{store.js → store.ts} +0 -0
- package/src/i3s-converter/types.ts +14 -0
- package/src/lib/utils/{compress-utils.d.ts → compress-util.d.ts} +0 -0
- package/src/pgm-loader.ts +2 -2
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -23
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -16
- package/dist/es5/i3s-converter/helpers/node-pages.d.ts +0 -144
- package/dist/es5/lib/geoid-height-model.d.ts +0 -41
- package/dist/es5/lib/geoid-height-model.js +0 -149
- package/dist/es5/lib/geoid-height-model.js.map +0 -1
- package/dist/es5/lib/pgm-parser.d.ts +0 -14
- package/dist/es5/lib/pgm-parser.js +0 -192
- package/dist/es5/lib/pgm-parser.js.map +0 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -23
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -16
- package/dist/esm/i3s-converter/helpers/node-pages.d.ts +0 -144
- package/dist/esm/lib/geoid-height-model.d.ts +0 -41
- package/dist/esm/lib/geoid-height-model.js +0 -140
- package/dist/esm/lib/geoid-height-model.js.map +0 -1
- package/dist/esm/lib/pgm-parser.d.ts +0 -14
- package/dist/esm/lib/pgm-parser.js +0 -183
- package/dist/esm/lib/pgm-parser.js.map +0 -1
- package/src/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -23
- package/src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -16
- package/src/i3s-converter/helpers/node-pages.d.ts +0 -144
- package/src/lib/geoid-height-model.d.ts +0 -41
- package/src/lib/geoid-height-model.js +0 -239
- package/src/lib/pgm-parser.d.ts +0 -14
- package/src/lib/pgm-parser.js +0 -179
|
@@ -7,6 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
+
|
|
20
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
21
|
+
|
|
22
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
|
+
|
|
10
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
25
|
|
|
12
26
|
var _core = require("@loaders.gl/core");
|
|
@@ -53,19 +67,32 @@ var _nodeDebug = require("./helpers/node-debug");
|
|
|
53
67
|
|
|
54
68
|
var _textures = require("@loaders.gl/textures");
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
var _images = require("@loaders.gl/images");
|
|
71
|
+
|
|
72
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
73
|
+
|
|
74
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
75
|
+
|
|
76
|
+
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; }
|
|
77
|
+
|
|
78
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
79
|
+
|
|
80
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
81
|
+
|
|
82
|
+
var ION_DEFAULT_TOKEN = _process.default.env.IonToken || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ';
|
|
83
|
+
var HARDCODED_NODES_PER_PAGE = 64;
|
|
84
|
+
var _3D_TILES = '3DTILES';
|
|
85
|
+
var _3D_OBJECT_LAYER_TYPE = '3DObject';
|
|
86
|
+
var STRING_TYPE = 'string';
|
|
87
|
+
var SHORT_INT_TYPE = 'Int32';
|
|
88
|
+
var DOUBLE_TYPE = 'double';
|
|
89
|
+
var OBJECT_ID_TYPE = 'OBJECTID';
|
|
90
|
+
var REFRESH_TOKEN_TIMEOUT = 1800;
|
|
91
|
+
var CESIUM_DATASET_PREFIX = 'https://';
|
|
92
|
+
|
|
93
|
+
var I3SConverter = function () {
|
|
94
|
+
function I3SConverter() {
|
|
95
|
+
(0, _classCallCheck2.default)(this, I3SConverter);
|
|
69
96
|
(0, _defineProperty2.default)(this, "nodePages", void 0);
|
|
70
97
|
(0, _defineProperty2.default)(this, "fileMap", void 0);
|
|
71
98
|
(0, _defineProperty2.default)(this, "options", void 0);
|
|
@@ -77,12 +104,14 @@ class I3SConverter {
|
|
|
77
104
|
(0, _defineProperty2.default)(this, "featuresHashArray", void 0);
|
|
78
105
|
(0, _defineProperty2.default)(this, "refinementCounter", void 0);
|
|
79
106
|
(0, _defineProperty2.default)(this, "validate", void 0);
|
|
80
|
-
(0, _defineProperty2.default)(this, "boundingVolumeWarnings",
|
|
81
|
-
(0, _defineProperty2.default)(this, "conversionStartTime",
|
|
82
|
-
(0, _defineProperty2.default)(this, "refreshTokenTime",
|
|
83
|
-
(0, _defineProperty2.default)(this, "sourceTileset",
|
|
84
|
-
(0, _defineProperty2.default)(this, "geoidHeightModel",
|
|
107
|
+
(0, _defineProperty2.default)(this, "boundingVolumeWarnings", []);
|
|
108
|
+
(0, _defineProperty2.default)(this, "conversionStartTime", [0, 0]);
|
|
109
|
+
(0, _defineProperty2.default)(this, "refreshTokenTime", [0, 0]);
|
|
110
|
+
(0, _defineProperty2.default)(this, "sourceTileset", null);
|
|
111
|
+
(0, _defineProperty2.default)(this, "geoidHeightModel", null);
|
|
85
112
|
(0, _defineProperty2.default)(this, "Loader", _dTiles.Tiles3DLoader);
|
|
113
|
+
(0, _defineProperty2.default)(this, "generateTextures", void 0);
|
|
114
|
+
(0, _defineProperty2.default)(this, "generateBoundingVolumes", void 0);
|
|
86
115
|
this.nodePages = new _nodePages.default(_fileUtils.writeFile, HARDCODED_NODES_PER_PAGE);
|
|
87
116
|
this.fileMap = {};
|
|
88
117
|
this.options = {};
|
|
@@ -97,819 +126,1735 @@ class I3SConverter {
|
|
|
97
126
|
tilesWithAddRefineCount: 0
|
|
98
127
|
};
|
|
99
128
|
this.validate = false;
|
|
100
|
-
this.
|
|
129
|
+
this.generateTextures = false;
|
|
130
|
+
this.generateBoundingVolumes = false;
|
|
101
131
|
}
|
|
102
132
|
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
(0, _createClass2.default)(I3SConverter, [{
|
|
134
|
+
key: "convert",
|
|
135
|
+
value: function () {
|
|
136
|
+
var _convert = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(options) {
|
|
137
|
+
var tilesetName, slpk, egmFilePath, inputUrl, validate, outputPath, draco, sevenZipExe, maxDepth, token, generateTextures, generateBoundingVolumes, preloadOptions, tilesetOptions, sourceTilesetJson;
|
|
138
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
139
|
+
while (1) {
|
|
140
|
+
switch (_context.prev = _context.next) {
|
|
141
|
+
case 0:
|
|
142
|
+
this.conversionStartTime = _process.default.hrtime();
|
|
143
|
+
tilesetName = options.tilesetName, slpk = options.slpk, egmFilePath = options.egmFilePath, inputUrl = options.inputUrl, validate = options.validate, outputPath = options.outputPath, draco = options.draco, sevenZipExe = options.sevenZipExe, maxDepth = options.maxDepth, token = options.token, generateTextures = options.generateTextures, generateBoundingVolumes = options.generateBoundingVolumes;
|
|
144
|
+
this.options = {
|
|
145
|
+
maxDepth: maxDepth,
|
|
146
|
+
slpk: slpk,
|
|
147
|
+
sevenZipExe: sevenZipExe,
|
|
148
|
+
egmFilePath: egmFilePath,
|
|
149
|
+
draco: draco,
|
|
150
|
+
token: token,
|
|
151
|
+
inputUrl: inputUrl
|
|
152
|
+
};
|
|
153
|
+
this.validate = Boolean(validate);
|
|
154
|
+
this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? _dTiles.CesiumIonLoader : _dTiles.Tiles3DLoader;
|
|
155
|
+
this.generateTextures = Boolean(generateTextures);
|
|
156
|
+
this.generateBoundingVolumes = Boolean(generateBoundingVolumes);
|
|
157
|
+
console.log('Loading egm file...');
|
|
158
|
+
_context.next = 10;
|
|
159
|
+
return (0, _core.load)(egmFilePath, _pgmLoader.PGMLoader);
|
|
160
|
+
|
|
161
|
+
case 10:
|
|
162
|
+
this.geoidHeightModel = _context.sent;
|
|
163
|
+
console.log('Loading egm file completed!');
|
|
164
|
+
|
|
165
|
+
if (slpk) {
|
|
166
|
+
this.nodePages.useWriteFunction(_fileUtils.writeFileForSlpk);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
_context.next = 15;
|
|
170
|
+
return this._fetchPreloadOptions();
|
|
171
|
+
|
|
172
|
+
case 15:
|
|
173
|
+
preloadOptions = _context.sent;
|
|
174
|
+
tilesetOptions = {
|
|
175
|
+
loadOptions: {
|
|
176
|
+
basis: {
|
|
177
|
+
format: 'rgba32'
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
if (preloadOptions.headers) {
|
|
183
|
+
tilesetOptions.loadOptions.fetch = {
|
|
184
|
+
headers: preloadOptions.headers
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
Object.assign(tilesetOptions, preloadOptions);
|
|
189
|
+
_context.next = 21;
|
|
190
|
+
return (0, _core.load)(inputUrl, this.Loader, tilesetOptions.loadOptions);
|
|
191
|
+
|
|
192
|
+
case 21:
|
|
193
|
+
sourceTilesetJson = _context.sent;
|
|
194
|
+
this.sourceTileset = new _tiles.Tileset3D(sourceTilesetJson, tilesetOptions);
|
|
195
|
+
_context.next = 25;
|
|
196
|
+
return this._createAndSaveTileset(outputPath, tilesetName);
|
|
197
|
+
|
|
198
|
+
case 25:
|
|
199
|
+
_context.next = 27;
|
|
200
|
+
return this._finishConversion({
|
|
201
|
+
slpk: Boolean(slpk),
|
|
202
|
+
outputPath: outputPath,
|
|
203
|
+
tilesetName: tilesetName
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
case 27:
|
|
207
|
+
return _context.abrupt("return", sourceTilesetJson);
|
|
208
|
+
|
|
209
|
+
case 28:
|
|
210
|
+
case "end":
|
|
211
|
+
return _context.stop();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}, _callee, this);
|
|
215
|
+
}));
|
|
135
216
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
217
|
+
function convert(_x) {
|
|
218
|
+
return _convert.apply(this, arguments);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return convert;
|
|
222
|
+
}()
|
|
223
|
+
}, {
|
|
224
|
+
key: "_createAndSaveTileset",
|
|
225
|
+
value: function () {
|
|
226
|
+
var _createAndSaveTileset2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(outputPath, tilesetName) {
|
|
227
|
+
var tilesetPath, sourceRootTile, boundingVolumes, parentId, isCreateSlpk, root0;
|
|
228
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
229
|
+
while (1) {
|
|
230
|
+
switch (_context2.prev = _context2.next) {
|
|
231
|
+
case 0:
|
|
232
|
+
tilesetPath = (0, _path.join)("".concat(outputPath), "".concat(tilesetName));
|
|
233
|
+
_context2.prev = 1;
|
|
234
|
+
_context2.next = 4;
|
|
235
|
+
return (0, _fileUtils.removeDir)(tilesetPath);
|
|
236
|
+
|
|
237
|
+
case 4:
|
|
238
|
+
_context2.next = 8;
|
|
239
|
+
break;
|
|
240
|
+
|
|
241
|
+
case 6:
|
|
242
|
+
_context2.prev = 6;
|
|
243
|
+
_context2.t0 = _context2["catch"](1);
|
|
244
|
+
|
|
245
|
+
case 8:
|
|
246
|
+
this.layers0Path = (0, _path.join)(tilesetPath, 'SceneServer', 'layers', '0');
|
|
247
|
+
|
|
248
|
+
this._formLayers0(tilesetName);
|
|
249
|
+
|
|
250
|
+
this.materialDefinitions = [];
|
|
251
|
+
this.materialMap = new Map();
|
|
252
|
+
sourceRootTile = this.sourceTileset.root;
|
|
253
|
+
boundingVolumes = (0, _coordinateConverter.createBoundingVolumes)(sourceRootTile, this.geoidHeightModel);
|
|
254
|
+
parentId = this.nodePages.push({
|
|
255
|
+
index: 0,
|
|
256
|
+
lodThreshold: 0,
|
|
257
|
+
obb: boundingVolumes.obb,
|
|
258
|
+
children: []
|
|
259
|
+
});
|
|
260
|
+
isCreateSlpk = this.options.slpk;
|
|
261
|
+
root0 = this._formRootNodeIndexDocument(boundingVolumes);
|
|
262
|
+
_context2.next = 19;
|
|
263
|
+
return this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);
|
|
264
|
+
|
|
265
|
+
case 19:
|
|
266
|
+
this.layers0.materialDefinitions = this.materialDefinitions;
|
|
267
|
+
_context2.next = 22;
|
|
268
|
+
return this._writeLayers0();
|
|
269
|
+
|
|
270
|
+
case 22:
|
|
271
|
+
(0, _createSceneServerPath.createSceneServerPath)(tilesetName, this.layers0, tilesetPath);
|
|
272
|
+
_context2.next = 25;
|
|
273
|
+
return this._writeNodeIndexDocument(root0, 'root', (0, _path.join)(this.layers0Path, 'nodes', 'root'));
|
|
274
|
+
|
|
275
|
+
case 25:
|
|
276
|
+
_context2.next = 27;
|
|
277
|
+
return this.nodePages.save(this.layers0Path, this.fileMap, isCreateSlpk);
|
|
278
|
+
|
|
279
|
+
case 27:
|
|
280
|
+
_context2.next = 29;
|
|
281
|
+
return this._createSlpk(tilesetPath);
|
|
282
|
+
|
|
283
|
+
case 29:
|
|
284
|
+
case "end":
|
|
285
|
+
return _context2.stop();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}, _callee2, this, [[1, 6]]);
|
|
289
|
+
}));
|
|
290
|
+
|
|
291
|
+
function _createAndSaveTileset(_x2, _x3) {
|
|
292
|
+
return _createAndSaveTileset2.apply(this, arguments);
|
|
293
|
+
}
|
|
140
294
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
295
|
+
return _createAndSaveTileset;
|
|
296
|
+
}()
|
|
297
|
+
}, {
|
|
298
|
+
key: "_formLayers0",
|
|
299
|
+
value: function _formLayers0(tilesetName) {
|
|
300
|
+
var extent = (0, _coordinateConverter.convertCommonToI3SExtentCoordinate)(this.sourceTileset);
|
|
301
|
+
var layers0data = {
|
|
302
|
+
version: "{".concat((0, _uuid.v4)().toUpperCase(), "}"),
|
|
303
|
+
id: 0,
|
|
304
|
+
name: tilesetName,
|
|
305
|
+
href: './layers/0',
|
|
306
|
+
store: {
|
|
307
|
+
id: "{".concat((0, _uuid.v4)().toUpperCase(), "}"),
|
|
308
|
+
extent: extent
|
|
309
|
+
},
|
|
310
|
+
nodePages: {
|
|
311
|
+
nodesPerPage: HARDCODED_NODES_PER_PAGE
|
|
312
|
+
},
|
|
313
|
+
compressGeometry: this.options.draco
|
|
144
314
|
};
|
|
315
|
+
this.layers0 = (0, _jsonMapTransform.default)(layers0data, (0, _layers.LAYERS)());
|
|
145
316
|
}
|
|
317
|
+
}, {
|
|
318
|
+
key: "_formRootNodeIndexDocument",
|
|
319
|
+
value: function _formRootNodeIndexDocument(boundingVolumes) {
|
|
320
|
+
var root0data = _objectSpread(_objectSpread({
|
|
321
|
+
version: "{".concat((0, _uuid.v4)().toUpperCase(), "}"),
|
|
322
|
+
id: 'root',
|
|
323
|
+
level: 0,
|
|
324
|
+
lodSelection: [{
|
|
325
|
+
metricType: 'maxScreenThresholdSQ',
|
|
326
|
+
maxError: 0
|
|
327
|
+
}, {
|
|
328
|
+
metricType: 'maxScreenThreshold',
|
|
329
|
+
maxError: 0
|
|
330
|
+
}]
|
|
331
|
+
}, boundingVolumes), {}, {
|
|
332
|
+
children: []
|
|
333
|
+
});
|
|
146
334
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
335
|
+
return (0, _jsonMapTransform.default)(root0data, (0, _node.NODE)());
|
|
336
|
+
}
|
|
337
|
+
}, {
|
|
338
|
+
key: "_convertNodesTree",
|
|
339
|
+
value: function () {
|
|
340
|
+
var _convertNodesTree2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(root0, sourceRootTile, parentId, boundingVolumes) {
|
|
341
|
+
var _yield$this$_createNo, _yield$this$_createNo2, child, childPath;
|
|
342
|
+
|
|
343
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
344
|
+
while (1) {
|
|
345
|
+
switch (_context3.prev = _context3.next) {
|
|
346
|
+
case 0:
|
|
347
|
+
_context3.next = 2;
|
|
348
|
+
return this.sourceTileset._loadTile(sourceRootTile);
|
|
349
|
+
|
|
350
|
+
case 2:
|
|
351
|
+
if (!this.isContentSupported(sourceRootTile)) {
|
|
352
|
+
_context3.next = 21;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
root0.children = root0.children || [];
|
|
357
|
+
root0.children.push(_objectSpread({
|
|
358
|
+
id: '1',
|
|
359
|
+
href: './1'
|
|
360
|
+
}, boundingVolumes));
|
|
361
|
+
_context3.next = 7;
|
|
362
|
+
return this._createNode(root0, sourceRootTile, parentId, 0);
|
|
363
|
+
|
|
364
|
+
case 7:
|
|
365
|
+
_yield$this$_createNo = _context3.sent;
|
|
366
|
+
_yield$this$_createNo2 = (0, _slicedToArray2.default)(_yield$this$_createNo, 1);
|
|
367
|
+
child = _yield$this$_createNo2[0];
|
|
368
|
+
childPath = (0, _path.join)(this.layers0Path, 'nodes', child.path);
|
|
369
|
+
|
|
370
|
+
if (!this.options.slpk) {
|
|
371
|
+
_context3.next = 17;
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
_context3.next = 14;
|
|
376
|
+
return (0, _fileUtils.writeFileForSlpk)(childPath, JSON.stringify(child), '3dNodeIndexDocument.json');
|
|
377
|
+
|
|
378
|
+
case 14:
|
|
379
|
+
this.fileMap['nodes/1/3dNodeIndexDocument.json.gz'] = _context3.sent;
|
|
380
|
+
_context3.next = 19;
|
|
381
|
+
break;
|
|
382
|
+
|
|
383
|
+
case 17:
|
|
384
|
+
_context3.next = 19;
|
|
385
|
+
return (0, _fileUtils.writeFile)(childPath, JSON.stringify(child));
|
|
386
|
+
|
|
387
|
+
case 19:
|
|
388
|
+
_context3.next = 23;
|
|
389
|
+
break;
|
|
390
|
+
|
|
391
|
+
case 21:
|
|
392
|
+
_context3.next = 23;
|
|
393
|
+
return this._addChildrenWithNeighborsAndWriteFile({
|
|
394
|
+
parentNode: root0,
|
|
395
|
+
sourceTiles: sourceRootTile.children,
|
|
396
|
+
parentId: parentId,
|
|
397
|
+
level: 1
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
case 23:
|
|
401
|
+
_context3.next = 25;
|
|
402
|
+
return sourceRootTile.unloadContent();
|
|
403
|
+
|
|
404
|
+
case 25:
|
|
405
|
+
case "end":
|
|
406
|
+
return _context3.stop();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}, _callee3, this);
|
|
410
|
+
}));
|
|
158
411
|
|
|
159
|
-
|
|
160
|
-
|
|
412
|
+
function _convertNodesTree(_x4, _x5, _x6, _x7) {
|
|
413
|
+
return _convertNodesTree2.apply(this, arguments);
|
|
414
|
+
}
|
|
161
415
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
416
|
+
return _convertNodesTree;
|
|
417
|
+
}()
|
|
418
|
+
}, {
|
|
419
|
+
key: "_writeLayers0",
|
|
420
|
+
value: function () {
|
|
421
|
+
var _writeLayers = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4() {
|
|
422
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
423
|
+
while (1) {
|
|
424
|
+
switch (_context4.prev = _context4.next) {
|
|
425
|
+
case 0:
|
|
426
|
+
if (!this.options.slpk) {
|
|
427
|
+
_context4.next = 6;
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
_context4.next = 3;
|
|
432
|
+
return (0, _fileUtils.writeFileForSlpk)(this.layers0Path, JSON.stringify(this.layers0), '3dSceneLayer.json');
|
|
433
|
+
|
|
434
|
+
case 3:
|
|
435
|
+
this.fileMap['3dSceneLayer.json.gz'] = _context4.sent;
|
|
436
|
+
_context4.next = 8;
|
|
437
|
+
break;
|
|
438
|
+
|
|
439
|
+
case 6:
|
|
440
|
+
_context4.next = 8;
|
|
441
|
+
return (0, _fileUtils.writeFile)(this.layers0Path, JSON.stringify(this.layers0));
|
|
442
|
+
|
|
443
|
+
case 8:
|
|
444
|
+
case "end":
|
|
445
|
+
return _context4.stop();
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}, _callee4, this);
|
|
449
|
+
}));
|
|
165
450
|
|
|
166
|
-
|
|
451
|
+
function _writeLayers0() {
|
|
452
|
+
return _writeLayers.apply(this, arguments);
|
|
453
|
+
}
|
|
167
454
|
|
|
168
|
-
|
|
455
|
+
return _writeLayers0;
|
|
456
|
+
}()
|
|
457
|
+
}, {
|
|
458
|
+
key: "_writeNodeIndexDocument",
|
|
459
|
+
value: function () {
|
|
460
|
+
var _writeNodeIndexDocument2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(root0, nodePath, rootPath) {
|
|
461
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
462
|
+
while (1) {
|
|
463
|
+
switch (_context5.prev = _context5.next) {
|
|
464
|
+
case 0:
|
|
465
|
+
if (!this.options.slpk) {
|
|
466
|
+
_context5.next = 6;
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
_context5.next = 3;
|
|
471
|
+
return (0, _fileUtils.writeFileForSlpk)(rootPath, JSON.stringify(root0), '3dNodeIndexDocument.json');
|
|
472
|
+
|
|
473
|
+
case 3:
|
|
474
|
+
this.fileMap["nodes/".concat(nodePath, "/3dNodeIndexDocument.json.gz")] = _context5.sent;
|
|
475
|
+
_context5.next = 8;
|
|
476
|
+
break;
|
|
477
|
+
|
|
478
|
+
case 6:
|
|
479
|
+
_context5.next = 8;
|
|
480
|
+
return (0, _fileUtils.writeFile)(rootPath, JSON.stringify(root0));
|
|
481
|
+
|
|
482
|
+
case 8:
|
|
483
|
+
case "end":
|
|
484
|
+
return _context5.stop();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}, _callee5, this);
|
|
488
|
+
}));
|
|
169
489
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const boundingVolumes = (0, _coordinateConverter.createBoundingVolumes)(sourceRootTile, this.geoidHeightModel);
|
|
174
|
-
const parentId = this.nodePages.push({
|
|
175
|
-
lodThreshold: 0,
|
|
176
|
-
obb: boundingVolumes.obb,
|
|
177
|
-
children: []
|
|
178
|
-
});
|
|
179
|
-
const isCreateSlpk = this.options.slpk;
|
|
180
|
-
|
|
181
|
-
const root0 = this._formRootNodeIndexDocument(boundingVolumes);
|
|
182
|
-
|
|
183
|
-
await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);
|
|
184
|
-
this.layers0.materialDefinitions = this.materialDefinitions;
|
|
185
|
-
await this._writeLayers0();
|
|
186
|
-
(0, _createSceneServerPath.createSceneServerPath)(tilesetName, this.layers0, tilesetPath);
|
|
187
|
-
await this._writeNodeIndexDocument(root0, 'root', (0, _path.join)(this.layers0Path, 'nodes', 'root'));
|
|
188
|
-
await this.nodePages.save(this.layers0Path, this.fileMap, isCreateSlpk);
|
|
189
|
-
await this._createSlpk(tilesetPath);
|
|
190
|
-
}
|
|
490
|
+
function _writeNodeIndexDocument(_x8, _x9, _x10) {
|
|
491
|
+
return _writeNodeIndexDocument2.apply(this, arguments);
|
|
492
|
+
}
|
|
191
493
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
494
|
+
return _writeNodeIndexDocument;
|
|
495
|
+
}()
|
|
496
|
+
}, {
|
|
497
|
+
key: "_createSlpk",
|
|
498
|
+
value: function () {
|
|
499
|
+
var _createSlpk2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(tilesetPath) {
|
|
500
|
+
var slpkTilesetPath, slpkFileName;
|
|
501
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
502
|
+
while (1) {
|
|
503
|
+
switch (_context6.prev = _context6.next) {
|
|
504
|
+
case 0:
|
|
505
|
+
if (!this.options.slpk) {
|
|
506
|
+
_context6.next = 12;
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
slpkTilesetPath = (0, _path.join)(tilesetPath, 'SceneServer', 'layers', '0');
|
|
511
|
+
slpkFileName = "".concat(tilesetPath, ".slpk");
|
|
512
|
+
_context6.next = 5;
|
|
513
|
+
return (0, _compressUtil.compressWithChildProcess)(slpkTilesetPath, slpkFileName, 0, '.', this.options.sevenZipExe);
|
|
514
|
+
|
|
515
|
+
case 5:
|
|
516
|
+
_context6.prev = 5;
|
|
517
|
+
_context6.next = 8;
|
|
518
|
+
return (0, _fileUtils.removeDir)(tilesetPath);
|
|
519
|
+
|
|
520
|
+
case 8:
|
|
521
|
+
_context6.next = 12;
|
|
522
|
+
break;
|
|
523
|
+
|
|
524
|
+
case 10:
|
|
525
|
+
_context6.prev = 10;
|
|
526
|
+
_context6.t0 = _context6["catch"](5);
|
|
527
|
+
|
|
528
|
+
case 12:
|
|
529
|
+
case "end":
|
|
530
|
+
return _context6.stop();
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}, _callee6, this, [[5, 10]]);
|
|
534
|
+
}));
|
|
210
535
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
id: 'root',
|
|
215
|
-
level: 0,
|
|
216
|
-
lodSelection: [{
|
|
217
|
-
metricType: 'maxScreenThresholdSQ',
|
|
218
|
-
maxError: 0
|
|
219
|
-
}, {
|
|
220
|
-
metricType: 'maxScreenThreshold',
|
|
221
|
-
maxError: 0
|
|
222
|
-
}],
|
|
223
|
-
...boundingVolumes,
|
|
224
|
-
children: []
|
|
225
|
-
};
|
|
226
|
-
return (0, _jsonMapTransform.default)(root0data, _node.NODE);
|
|
227
|
-
}
|
|
536
|
+
function _createSlpk(_x11) {
|
|
537
|
+
return _createSlpk2.apply(this, arguments);
|
|
538
|
+
}
|
|
228
539
|
|
|
229
|
-
|
|
230
|
-
|
|
540
|
+
return _createSlpk;
|
|
541
|
+
}()
|
|
542
|
+
}, {
|
|
543
|
+
key: "_addChildrenWithNeighborsAndWriteFile",
|
|
544
|
+
value: function () {
|
|
545
|
+
var _addChildrenWithNeighborsAndWriteFile2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee7(data) {
|
|
546
|
+
var childNodes;
|
|
547
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
548
|
+
while (1) {
|
|
549
|
+
switch (_context7.prev = _context7.next) {
|
|
550
|
+
case 0:
|
|
551
|
+
childNodes = [];
|
|
552
|
+
_context7.next = 3;
|
|
553
|
+
return this._addChildren(_objectSpread(_objectSpread({}, data), {}, {
|
|
554
|
+
childNodes: childNodes
|
|
555
|
+
}));
|
|
556
|
+
|
|
557
|
+
case 3:
|
|
558
|
+
_context7.next = 5;
|
|
559
|
+
return this._addNeighborsAndWriteFile(data.parentNode, childNodes);
|
|
560
|
+
|
|
561
|
+
case 5:
|
|
562
|
+
case "end":
|
|
563
|
+
return _context7.stop();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}, _callee7, this);
|
|
567
|
+
}));
|
|
231
568
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
href: './1',
|
|
236
|
-
...boundingVolumes
|
|
237
|
-
});
|
|
238
|
-
const [child] = await this._createNode(root0, sourceRootTile, parentId, 0);
|
|
239
|
-
const childPath = (0, _path.join)(this.layers0Path, 'nodes', child.path);
|
|
240
|
-
|
|
241
|
-
if (this.options.slpk) {
|
|
242
|
-
this.fileMap['nodes/1/3dNodeIndexDocument.json.gz'] = await (0, _fileUtils.writeFileForSlpk)(childPath, JSON.stringify(child), '3dNodeIndexDocument.json');
|
|
243
|
-
} else {
|
|
244
|
-
await (0, _fileUtils.writeFile)(childPath, JSON.stringify(child));
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
await this._addChildrenWithNeighborsAndWriteFile({
|
|
248
|
-
parentNode: root0,
|
|
249
|
-
sourceTiles: sourceRootTile.children,
|
|
250
|
-
parentId,
|
|
251
|
-
level: 1
|
|
252
|
-
});
|
|
253
|
-
}
|
|
569
|
+
function _addChildrenWithNeighborsAndWriteFile(_x12) {
|
|
570
|
+
return _addChildrenWithNeighborsAndWriteFile2.apply(this, arguments);
|
|
571
|
+
}
|
|
254
572
|
|
|
255
|
-
|
|
256
|
-
|
|
573
|
+
return _addChildrenWithNeighborsAndWriteFile;
|
|
574
|
+
}()
|
|
575
|
+
}, {
|
|
576
|
+
key: "_addChildren",
|
|
577
|
+
value: function () {
|
|
578
|
+
var _addChildren2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee8(data) {
|
|
579
|
+
var childNodes, sourceTiles, parentNode, parentId, level, _iterator, _step, sourceTile, children, _iterator2, _step2, child;
|
|
580
|
+
|
|
581
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
582
|
+
while (1) {
|
|
583
|
+
switch (_context8.prev = _context8.next) {
|
|
584
|
+
case 0:
|
|
585
|
+
childNodes = data.childNodes, sourceTiles = data.sourceTiles, parentNode = data.parentNode, parentId = data.parentId, level = data.level;
|
|
586
|
+
|
|
587
|
+
if (!(this.options.maxDepth && level > this.options.maxDepth)) {
|
|
588
|
+
_context8.next = 3;
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return _context8.abrupt("return");
|
|
593
|
+
|
|
594
|
+
case 3:
|
|
595
|
+
_iterator = _createForOfIteratorHelper(sourceTiles);
|
|
596
|
+
_context8.prev = 4;
|
|
597
|
+
|
|
598
|
+
_iterator.s();
|
|
599
|
+
|
|
600
|
+
case 6:
|
|
601
|
+
if ((_step = _iterator.n()).done) {
|
|
602
|
+
_context8.next = 26;
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
sourceTile = _step.value;
|
|
607
|
+
|
|
608
|
+
if (!(sourceTile.type === 'json')) {
|
|
609
|
+
_context8.next = 17;
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
_context8.next = 11;
|
|
614
|
+
return this.sourceTileset._loadTile(sourceTile);
|
|
615
|
+
|
|
616
|
+
case 11:
|
|
617
|
+
_context8.next = 13;
|
|
618
|
+
return this._addChildren({
|
|
619
|
+
parentNode: parentNode,
|
|
620
|
+
sourceTiles: sourceTile.children,
|
|
621
|
+
childNodes: childNodes,
|
|
622
|
+
parentId: parentId,
|
|
623
|
+
level: level + 1
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
case 13:
|
|
627
|
+
_context8.next = 15;
|
|
628
|
+
return sourceTile.unloadContent();
|
|
629
|
+
|
|
630
|
+
case 15:
|
|
631
|
+
_context8.next = 23;
|
|
632
|
+
break;
|
|
633
|
+
|
|
634
|
+
case 17:
|
|
635
|
+
_context8.next = 19;
|
|
636
|
+
return this._createNode(parentNode, sourceTile, parentId, level);
|
|
637
|
+
|
|
638
|
+
case 19:
|
|
639
|
+
children = _context8.sent;
|
|
640
|
+
parentNode.children = parentNode.children || [];
|
|
641
|
+
_iterator2 = _createForOfIteratorHelper(children);
|
|
642
|
+
|
|
643
|
+
try {
|
|
644
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
645
|
+
child = _step2.value;
|
|
646
|
+
parentNode.children.push({
|
|
647
|
+
id: child.id,
|
|
648
|
+
href: "../".concat(child.path),
|
|
649
|
+
obb: child.obb,
|
|
650
|
+
mbs: child.mbs
|
|
651
|
+
});
|
|
652
|
+
childNodes.push(child);
|
|
653
|
+
}
|
|
654
|
+
} catch (err) {
|
|
655
|
+
_iterator2.e(err);
|
|
656
|
+
} finally {
|
|
657
|
+
_iterator2.f();
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
case 23:
|
|
661
|
+
if (sourceTile.id) {
|
|
662
|
+
console.log(sourceTile.id);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
case 24:
|
|
666
|
+
_context8.next = 6;
|
|
667
|
+
break;
|
|
668
|
+
|
|
669
|
+
case 26:
|
|
670
|
+
_context8.next = 31;
|
|
671
|
+
break;
|
|
672
|
+
|
|
673
|
+
case 28:
|
|
674
|
+
_context8.prev = 28;
|
|
675
|
+
_context8.t0 = _context8["catch"](4);
|
|
676
|
+
|
|
677
|
+
_iterator.e(_context8.t0);
|
|
678
|
+
|
|
679
|
+
case 31:
|
|
680
|
+
_context8.prev = 31;
|
|
681
|
+
|
|
682
|
+
_iterator.f();
|
|
683
|
+
|
|
684
|
+
return _context8.finish(31);
|
|
685
|
+
|
|
686
|
+
case 34:
|
|
687
|
+
case "end":
|
|
688
|
+
return _context8.stop();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}, _callee8, this, [[4, 28, 31, 34]]);
|
|
692
|
+
}));
|
|
257
693
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
} else {
|
|
262
|
-
await (0, _fileUtils.writeFile)(this.layers0Path, JSON.stringify(this.layers0));
|
|
263
|
-
}
|
|
264
|
-
}
|
|
694
|
+
function _addChildren(_x13) {
|
|
695
|
+
return _addChildren2.apply(this, arguments);
|
|
696
|
+
}
|
|
265
697
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
698
|
+
return _addChildren;
|
|
699
|
+
}()
|
|
700
|
+
}, {
|
|
701
|
+
key: "_addNeighborsAndWriteFile",
|
|
702
|
+
value: function () {
|
|
703
|
+
var _addNeighborsAndWriteFile2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee9(parentNode, childNodes) {
|
|
704
|
+
var _iterator3, _step3, _parentNode$children, node, childPath, nodePath, _iterator4, _step4, neighbor;
|
|
273
705
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
706
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
707
|
+
while (1) {
|
|
708
|
+
switch (_context9.prev = _context9.next) {
|
|
709
|
+
case 0:
|
|
710
|
+
_iterator3 = _createForOfIteratorHelper(childNodes);
|
|
711
|
+
_context9.prev = 1;
|
|
279
712
|
|
|
280
|
-
|
|
281
|
-
await (0, _fileUtils.removeDir)(tilesetPath);
|
|
282
|
-
} catch (e) {}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
713
|
+
_iterator3.s();
|
|
285
714
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
await this._addNeighborsAndWriteFile(data.parentNode, childNodes);
|
|
292
|
-
}
|
|
715
|
+
case 3:
|
|
716
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
717
|
+
_context9.next = 36;
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
293
720
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
parentNode,
|
|
299
|
-
parentId,
|
|
300
|
-
level
|
|
301
|
-
} = data;
|
|
302
|
-
|
|
303
|
-
if (this.options.maxDepth && level > this.options.maxDepth) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
721
|
+
node = _step3.value;
|
|
722
|
+
childPath = (0, _path.join)(this.layers0Path, 'nodes', node.path);
|
|
723
|
+
nodePath = node.path;
|
|
724
|
+
delete node.path;
|
|
306
725
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
parentNode,
|
|
312
|
-
sourceTiles: sourceTile.children,
|
|
313
|
-
childNodes,
|
|
314
|
-
parentId,
|
|
315
|
-
level: level + 1
|
|
316
|
-
});
|
|
317
|
-
await sourceTile.unloadContent();
|
|
318
|
-
} else {
|
|
319
|
-
const boundingVolumes = (0, _coordinateConverter.createBoundingVolumes)(sourceTile, this.geoidHeightModel);
|
|
320
|
-
const children = await this._createNode(parentNode, sourceTile, parentId, level);
|
|
321
|
-
|
|
322
|
-
for (const child of children) {
|
|
323
|
-
parentNode.children.push({
|
|
324
|
-
id: child.id,
|
|
325
|
-
href: "../".concat(child.path),
|
|
326
|
-
...boundingVolumes
|
|
327
|
-
});
|
|
328
|
-
childNodes.push(child);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
726
|
+
if (!(Number(parentNode === null || parentNode === void 0 ? void 0 : (_parentNode$children = parentNode.children) === null || _parentNode$children === void 0 ? void 0 : _parentNode$children.length) < 1000)) {
|
|
727
|
+
_context9.next = 29;
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
331
730
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
731
|
+
_iterator4 = _createForOfIteratorHelper(parentNode.children || []);
|
|
732
|
+
_context9.prev = 10;
|
|
337
733
|
|
|
338
|
-
|
|
339
|
-
for (const node of childNodes) {
|
|
340
|
-
const childPath = (0, _path.join)(this.layers0Path, 'nodes', node.path);
|
|
341
|
-
const nodePath = node.path;
|
|
342
|
-
delete node.path;
|
|
734
|
+
_iterator4.s();
|
|
343
735
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
736
|
+
case 12:
|
|
737
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
738
|
+
_context9.next = 19;
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
349
741
|
|
|
350
|
-
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
} else {
|
|
354
|
-
console.warn("Node ".concat(node.id, ": neighbors attribute is omited because of large number of neigbors"));
|
|
355
|
-
delete node.neighbors;
|
|
356
|
-
}
|
|
742
|
+
neighbor = _step4.value;
|
|
357
743
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
744
|
+
if (!(node.id === neighbor.id)) {
|
|
745
|
+
_context9.next = 16;
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
362
748
|
|
|
363
|
-
|
|
364
|
-
var _sourceTile$content;
|
|
749
|
+
return _context9.abrupt("continue", 17);
|
|
365
750
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
751
|
+
case 16:
|
|
752
|
+
if (node.neighbors) {
|
|
753
|
+
node.neighbors.push(_objectSpread({}, neighbor));
|
|
754
|
+
}
|
|
369
755
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const lodSelection = (0, _lodConversionUtils.convertGeometricErrorToScreenThreshold)(sourceTile, boundingVolumes);
|
|
374
|
-
const maxScreenThresholdSQ = lodSelection.find(val => val.metricType === 'maxScreenThresholdSQ') || {
|
|
375
|
-
maxError: 0
|
|
376
|
-
};
|
|
377
|
-
const batchTable = sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content = sourceTile.content) === null || _sourceTile$content === void 0 ? void 0 : _sourceTile$content.batchTableJson;
|
|
756
|
+
case 17:
|
|
757
|
+
_context9.next = 12;
|
|
758
|
+
break;
|
|
378
759
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
760
|
+
case 19:
|
|
761
|
+
_context9.next = 24;
|
|
762
|
+
break;
|
|
382
763
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
geometry: null,
|
|
387
|
-
compressedGeometry: null,
|
|
388
|
-
texture: null,
|
|
389
|
-
sharedResources: null,
|
|
390
|
-
meshMaterial: null,
|
|
391
|
-
vertexCount: null,
|
|
392
|
-
attributes: null,
|
|
393
|
-
featureCount: null
|
|
394
|
-
};
|
|
764
|
+
case 21:
|
|
765
|
+
_context9.prev = 21;
|
|
766
|
+
_context9.t0 = _context9["catch"](10);
|
|
395
767
|
|
|
396
|
-
|
|
397
|
-
const nodeInPage = this._createNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources);
|
|
768
|
+
_iterator4.e(_context9.t0);
|
|
398
769
|
|
|
399
|
-
|
|
770
|
+
case 24:
|
|
771
|
+
_context9.prev = 24;
|
|
400
772
|
|
|
401
|
-
|
|
402
|
-
await this._writeResources(resources, node.path);
|
|
403
|
-
}
|
|
773
|
+
_iterator4.f();
|
|
404
774
|
|
|
405
|
-
|
|
406
|
-
this.boundingVolumeWarnings = (0, _nodeDebug.validateNodeBoundingVolumes)(node);
|
|
775
|
+
return _context9.finish(24);
|
|
407
776
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
777
|
+
case 27:
|
|
778
|
+
_context9.next = 31;
|
|
779
|
+
break;
|
|
412
780
|
|
|
413
|
-
|
|
414
|
-
|
|
781
|
+
case 29:
|
|
782
|
+
console.warn("Node ".concat(node.id, ": neighbors attribute is omited because of large number of neigbors"));
|
|
783
|
+
delete node.neighbors;
|
|
415
784
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
parentNode: firstNode,
|
|
420
|
-
sourceTiles: sourceTile.children,
|
|
421
|
-
parentId: firstNode.id,
|
|
422
|
-
level: level + 1
|
|
423
|
-
});
|
|
424
|
-
return nodes;
|
|
425
|
-
}
|
|
785
|
+
case 31:
|
|
786
|
+
_context9.next = 33;
|
|
787
|
+
return this._writeNodeIndexDocument(node, nodePath, childPath);
|
|
426
788
|
|
|
427
|
-
|
|
428
|
-
|
|
789
|
+
case 33:
|
|
790
|
+
node.neighbors = [];
|
|
429
791
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
792
|
+
case 34:
|
|
793
|
+
_context9.next = 3;
|
|
794
|
+
break;
|
|
434
795
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
796
|
+
case 36:
|
|
797
|
+
_context9.next = 41;
|
|
798
|
+
break;
|
|
439
799
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
800
|
+
case 38:
|
|
801
|
+
_context9.prev = 38;
|
|
802
|
+
_context9.t1 = _context9["catch"](1);
|
|
443
803
|
|
|
444
|
-
|
|
445
|
-
const {
|
|
446
|
-
meshMaterial,
|
|
447
|
-
texture,
|
|
448
|
-
vertexCount,
|
|
449
|
-
featureCount,
|
|
450
|
-
geometry
|
|
451
|
-
} = resources;
|
|
452
|
-
const nodeInPage = {
|
|
453
|
-
lodThreshold: maxScreenThresholdSQ.maxError,
|
|
454
|
-
obb: boundingVolumes.obb,
|
|
455
|
-
children: [],
|
|
456
|
-
mesh: null
|
|
457
|
-
};
|
|
804
|
+
_iterator3.e(_context9.t1);
|
|
458
805
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
geometry: {
|
|
462
|
-
definition: texture ? 0 : 1
|
|
463
|
-
},
|
|
464
|
-
attribute: {}
|
|
465
|
-
};
|
|
466
|
-
}
|
|
806
|
+
case 41:
|
|
807
|
+
_context9.prev = 41;
|
|
467
808
|
|
|
468
|
-
|
|
809
|
+
_iterator3.f();
|
|
469
810
|
|
|
470
|
-
|
|
471
|
-
this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));
|
|
472
|
-
}
|
|
811
|
+
return _context9.finish(41);
|
|
473
812
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
813
|
+
case 44:
|
|
814
|
+
case "end":
|
|
815
|
+
return _context9.stop();
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}, _callee9, this, [[1, 38, 41, 44], [10, 21, 24, 27]]);
|
|
819
|
+
}));
|
|
478
820
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
821
|
+
function _addNeighborsAndWriteFile(_x14, _x15) {
|
|
822
|
+
return _addNeighborsAndWriteFile2.apply(this, arguments);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
return _addNeighborsAndWriteFile;
|
|
826
|
+
}()
|
|
827
|
+
}, {
|
|
828
|
+
key: "_createNode",
|
|
829
|
+
value: function () {
|
|
830
|
+
var _createNode2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee10(parentTile, sourceTile, parentId, level) {
|
|
831
|
+
var _sourceTile$content;
|
|
832
|
+
|
|
833
|
+
var boundingVolumes, batchTable, resourcesData, nodes, nodesInPage, emptyResources, _iterator5, _step5, resources, lodSelection, maxScreenThresholdSQ, nodeInPage, node, _console;
|
|
834
|
+
|
|
835
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
836
|
+
while (1) {
|
|
837
|
+
switch (_context10.prev = _context10.next) {
|
|
838
|
+
case 0:
|
|
839
|
+
if (this.validate) {
|
|
840
|
+
this._checkAddRefinementTypeForTile(sourceTile);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
_context10.next = 3;
|
|
844
|
+
return this._updateTilesetOptions();
|
|
845
|
+
|
|
846
|
+
case 3:
|
|
847
|
+
_context10.next = 5;
|
|
848
|
+
return this.sourceTileset._loadTile(sourceTile);
|
|
849
|
+
|
|
850
|
+
case 5:
|
|
851
|
+
boundingVolumes = (0, _coordinateConverter.createBoundingVolumes)(sourceTile, this.geoidHeightModel);
|
|
852
|
+
batchTable = sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content = sourceTile.content) === null || _sourceTile$content === void 0 ? void 0 : _sourceTile$content.batchTableJson;
|
|
853
|
+
|
|
854
|
+
if (batchTable) {
|
|
855
|
+
this._convertAttributeStorageInfo(sourceTile.content);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
_context10.next = 10;
|
|
859
|
+
return this._convertResources(sourceTile);
|
|
860
|
+
|
|
861
|
+
case 10:
|
|
862
|
+
resourcesData = _context10.sent;
|
|
863
|
+
nodes = [];
|
|
864
|
+
nodesInPage = [];
|
|
865
|
+
emptyResources = {
|
|
866
|
+
geometry: null,
|
|
867
|
+
compressedGeometry: null,
|
|
868
|
+
texture: null,
|
|
869
|
+
sharedResources: null,
|
|
870
|
+
meshMaterial: null,
|
|
871
|
+
vertexCount: null,
|
|
872
|
+
attributes: null,
|
|
873
|
+
featureCount: null,
|
|
874
|
+
boundingVolumes: null
|
|
875
|
+
};
|
|
876
|
+
_iterator5 = _createForOfIteratorHelper(resourcesData || [emptyResources]);
|
|
877
|
+
_context10.prev = 15;
|
|
878
|
+
|
|
879
|
+
_iterator5.s();
|
|
880
|
+
|
|
881
|
+
case 17:
|
|
882
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
883
|
+
_context10.next = 32;
|
|
884
|
+
break;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
resources = _step5.value;
|
|
888
|
+
|
|
889
|
+
if (this.generateBoundingVolumes && resources.boundingVolumes) {
|
|
890
|
+
boundingVolumes = resources.boundingVolumes;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
lodSelection = (0, _lodConversionUtils.convertGeometricErrorToScreenThreshold)(sourceTile, boundingVolumes);
|
|
894
|
+
maxScreenThresholdSQ = lodSelection.find(function (val) {
|
|
895
|
+
return val.metricType === 'maxScreenThresholdSQ';
|
|
896
|
+
}) || {
|
|
897
|
+
maxError: 0
|
|
898
|
+
};
|
|
899
|
+
nodeInPage = this._createNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources);
|
|
900
|
+
node = this._createNodeIndexDocument(parentTile, boundingVolumes, lodSelection, nodeInPage, resources);
|
|
901
|
+
|
|
902
|
+
if (!nodeInPage.mesh) {
|
|
903
|
+
_context10.next = 27;
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
_context10.next = 27;
|
|
908
|
+
return this._writeResources(resources, node.path);
|
|
909
|
+
|
|
910
|
+
case 27:
|
|
911
|
+
if (this.validate) {
|
|
912
|
+
this.boundingVolumeWarnings = (0, _nodeDebug.validateNodeBoundingVolumes)(node);
|
|
913
|
+
|
|
914
|
+
if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {
|
|
915
|
+
(_console = console).warn.apply(_console, ['Bounding Volume Warnings: '].concat((0, _toConsumableArray2.default)(this.boundingVolumeWarnings)));
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
nodes.push(node);
|
|
920
|
+
nodesInPage.push(nodeInPage);
|
|
921
|
+
|
|
922
|
+
case 30:
|
|
923
|
+
_context10.next = 17;
|
|
924
|
+
break;
|
|
925
|
+
|
|
926
|
+
case 32:
|
|
927
|
+
_context10.next = 37;
|
|
928
|
+
break;
|
|
929
|
+
|
|
930
|
+
case 34:
|
|
931
|
+
_context10.prev = 34;
|
|
932
|
+
_context10.t0 = _context10["catch"](15);
|
|
933
|
+
|
|
934
|
+
_iterator5.e(_context10.t0);
|
|
935
|
+
|
|
936
|
+
case 37:
|
|
937
|
+
_context10.prev = 37;
|
|
938
|
+
|
|
939
|
+
_iterator5.f();
|
|
940
|
+
|
|
941
|
+
return _context10.finish(37);
|
|
942
|
+
|
|
943
|
+
case 40:
|
|
944
|
+
sourceTile.unloadContent();
|
|
945
|
+
_context10.next = 43;
|
|
946
|
+
return this._addChildrenWithNeighborsAndWriteFile({
|
|
947
|
+
parentNode: nodes[0],
|
|
948
|
+
sourceTiles: sourceTile.children,
|
|
949
|
+
parentId: nodesInPage[0].index,
|
|
950
|
+
level: level + 1
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
case 43:
|
|
954
|
+
return _context10.abrupt("return", nodes);
|
|
955
|
+
|
|
956
|
+
case 44:
|
|
957
|
+
case "end":
|
|
958
|
+
return _context10.stop();
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}, _callee10, this, [[15, 34, 37, 40]]);
|
|
962
|
+
}));
|
|
483
963
|
|
|
484
|
-
|
|
964
|
+
function _createNode(_x16, _x17, _x18, _x19) {
|
|
965
|
+
return _createNode2.apply(this, arguments);
|
|
966
|
+
}
|
|
485
967
|
|
|
486
|
-
|
|
487
|
-
|
|
968
|
+
return _createNode;
|
|
969
|
+
}()
|
|
970
|
+
}, {
|
|
971
|
+
key: "_convertAttributeStorageInfo",
|
|
972
|
+
value: function _convertAttributeStorageInfo(sourceTileContent) {
|
|
973
|
+
var _this$layers, _this$layers$attribut;
|
|
974
|
+
|
|
975
|
+
var batchTable = sourceTileContent && sourceTileContent.batchTableJson;
|
|
976
|
+
|
|
977
|
+
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)) {
|
|
978
|
+
this._convertBatchTableInfoToNodeAttributes(batchTable);
|
|
979
|
+
}
|
|
488
980
|
}
|
|
981
|
+
}, {
|
|
982
|
+
key: "_convertResources",
|
|
983
|
+
value: function () {
|
|
984
|
+
var _convertResources2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee11(sourceTile) {
|
|
985
|
+
var _this$layers2;
|
|
986
|
+
|
|
987
|
+
var resourcesData;
|
|
988
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
989
|
+
while (1) {
|
|
990
|
+
switch (_context11.prev = _context11.next) {
|
|
991
|
+
case 0:
|
|
992
|
+
if (this.isContentSupported(sourceTile)) {
|
|
993
|
+
_context11.next = 2;
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
return _context11.abrupt("return", null);
|
|
998
|
+
|
|
999
|
+
case 2:
|
|
1000
|
+
_context11.next = 4;
|
|
1001
|
+
return (0, _geometryConverter.default)(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);
|
|
1002
|
+
|
|
1003
|
+
case 4:
|
|
1004
|
+
resourcesData = _context11.sent;
|
|
1005
|
+
return _context11.abrupt("return", resourcesData);
|
|
1006
|
+
|
|
1007
|
+
case 6:
|
|
1008
|
+
case "end":
|
|
1009
|
+
return _context11.stop();
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}, _callee11, this);
|
|
1013
|
+
}));
|
|
489
1014
|
|
|
490
|
-
|
|
491
|
-
|
|
1015
|
+
function _convertResources(_x20) {
|
|
1016
|
+
return _convertResources2.apply(this, arguments);
|
|
1017
|
+
}
|
|
492
1018
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
href: "../".concat(parentNode.id),
|
|
509
|
-
mbs: parentNode.mbs,
|
|
510
|
-
obb: parentNode.obb
|
|
511
|
-
},
|
|
512
|
-
children: [],
|
|
513
|
-
neighbors: []
|
|
514
|
-
};
|
|
515
|
-
const node = (0, _jsonMapTransform.default)(nodeData, _node.NODE);
|
|
516
|
-
|
|
517
|
-
if (nodeInPage.mesh) {
|
|
518
|
-
node.geometryData = [{
|
|
519
|
-
href: './geometries/0'
|
|
520
|
-
}];
|
|
521
|
-
node.sharedResource = {
|
|
522
|
-
href: './shared'
|
|
1019
|
+
return _convertResources;
|
|
1020
|
+
}()
|
|
1021
|
+
}, {
|
|
1022
|
+
key: "_createNodeInNodePages",
|
|
1023
|
+
value: function _createNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
|
|
1024
|
+
var meshMaterial = resources.meshMaterial,
|
|
1025
|
+
texture = resources.texture,
|
|
1026
|
+
vertexCount = resources.vertexCount,
|
|
1027
|
+
featureCount = resources.featureCount,
|
|
1028
|
+
geometry = resources.geometry;
|
|
1029
|
+
var nodeInPage = {
|
|
1030
|
+
index: 0,
|
|
1031
|
+
lodThreshold: maxScreenThresholdSQ.maxError,
|
|
1032
|
+
obb: boundingVolumes.obb,
|
|
1033
|
+
children: []
|
|
523
1034
|
};
|
|
524
1035
|
|
|
525
|
-
if (
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
1036
|
+
if (geometry && this.isContentSupported(sourceTile)) {
|
|
1037
|
+
nodeInPage.mesh = {
|
|
1038
|
+
geometry: {
|
|
1039
|
+
definition: texture ? 0 : 1,
|
|
1040
|
+
resource: 0
|
|
1041
|
+
},
|
|
1042
|
+
attribute: {
|
|
1043
|
+
resource: 0
|
|
1044
|
+
},
|
|
1045
|
+
material: {
|
|
1046
|
+
definition: 0
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
531
1049
|
}
|
|
532
1050
|
|
|
533
|
-
|
|
534
|
-
node.attributeData = [];
|
|
1051
|
+
var nodeId = this.nodePages.push(nodeInPage, parentId);
|
|
535
1052
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
node.attributeData.push({
|
|
539
|
-
href: "./attributes/".concat(folderName, "/0")
|
|
540
|
-
});
|
|
541
|
-
}
|
|
1053
|
+
if (meshMaterial) {
|
|
1054
|
+
this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));
|
|
542
1055
|
}
|
|
543
|
-
}
|
|
544
1056
|
|
|
545
|
-
|
|
546
|
-
|
|
1057
|
+
if (texture) {
|
|
1058
|
+
var texelCountHint = texture.image.height * texture.image.width;
|
|
1059
|
+
this.nodePages.updateTexelCountHintByNodeId(nodeId, texelCountHint);
|
|
1060
|
+
}
|
|
547
1061
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
texture,
|
|
553
|
-
sharedResources,
|
|
554
|
-
attributes
|
|
555
|
-
} = resources;
|
|
556
|
-
const childPath = (0, _path.join)(this.layers0Path, 'nodes', nodePath);
|
|
557
|
-
const slpkChildPath = (0, _path.join)('nodes', nodePath);
|
|
558
|
-
await this._writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath);
|
|
559
|
-
await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);
|
|
560
|
-
await this._writeTexture(texture, childPath, slpkChildPath);
|
|
561
|
-
await this._writeAttributes(attributes, childPath, slpkChildPath);
|
|
562
|
-
}
|
|
1062
|
+
if (vertexCount) {
|
|
1063
|
+
this.vertexCounter += vertexCount;
|
|
1064
|
+
this.nodePages.updateVertexCountByNodeId(nodeId, vertexCount);
|
|
1065
|
+
}
|
|
563
1066
|
|
|
564
|
-
|
|
565
|
-
if (this.options.slpk) {
|
|
566
|
-
const slpkGeometryPath = (0, _path.join)(childPath, 'geometries');
|
|
567
|
-
this.fileMap["".concat(slpkChildPath, "/geometries/0.bin.gz")] = await (0, _fileUtils.writeFileForSlpk)(slpkGeometryPath, geometryBuffer, '0.bin');
|
|
568
|
-
} else {
|
|
569
|
-
const geometryPath = (0, _path.join)(childPath, 'geometries/0/');
|
|
570
|
-
await (0, _fileUtils.writeFile)(geometryPath, geometryBuffer, 'index.bin');
|
|
571
|
-
}
|
|
1067
|
+
this.nodePages.updateNodeAttributeByNodeId(nodeId);
|
|
572
1068
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
const slpkCompressedGeometryPath = (0, _path.join)(childPath, 'geometries');
|
|
576
|
-
this.fileMap["".concat(slpkChildPath, "/geometries/1.bin.gz")] = await (0, _fileUtils.writeFileForSlpk)(slpkCompressedGeometryPath, compressedGeometry, '1.bin');
|
|
577
|
-
} else {
|
|
578
|
-
const compressedGeometryPath = (0, _path.join)(childPath, 'geometries/1/');
|
|
579
|
-
await (0, _fileUtils.writeFile)(compressedGeometryPath, compressedGeometry, 'index.bin');
|
|
1069
|
+
if (featureCount) {
|
|
1070
|
+
this.nodePages.updateFeatureCountByNodeId(nodeId, featureCount);
|
|
580
1071
|
}
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
1072
|
|
|
584
|
-
|
|
585
|
-
sharedResources.nodePath = nodePath;
|
|
586
|
-
const sharedData = (0, _jsonMapTransform.default)(sharedResources, _sharedResources.SHARED_RESOURCES_TEMPLATE);
|
|
587
|
-
const sharedDataStr = JSON.stringify(sharedData);
|
|
588
|
-
|
|
589
|
-
if (this.options.slpk) {
|
|
590
|
-
const slpkSharedPath = (0, _path.join)(childPath, 'shared');
|
|
591
|
-
this.fileMap["".concat(slpkChildPath, "/shared/sharedResource.json.gz")] = await (0, _fileUtils.writeFileForSlpk)(slpkSharedPath, sharedDataStr, 'sharedResource.json');
|
|
592
|
-
} else {
|
|
593
|
-
const sharedPath = (0, _path.join)(childPath, 'shared/');
|
|
594
|
-
await (0, _fileUtils.writeFile)(sharedPath, sharedDataStr);
|
|
1073
|
+
return nodeInPage;
|
|
595
1074
|
}
|
|
596
|
-
}
|
|
1075
|
+
}, {
|
|
1076
|
+
key: "_createNodeIndexDocument",
|
|
1077
|
+
value: function _createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
|
|
1078
|
+
var texture = resources.texture,
|
|
1079
|
+
attributes = resources.attributes;
|
|
1080
|
+
var nodeId = nodeInPage.index;
|
|
1081
|
+
|
|
1082
|
+
var nodeData = _objectSpread(_objectSpread({
|
|
1083
|
+
version: parentNode.version,
|
|
1084
|
+
id: nodeId.toString(),
|
|
1085
|
+
path: nodeId.toString(),
|
|
1086
|
+
level: parentNode.level + 1
|
|
1087
|
+
}, boundingVolumes), {}, {
|
|
1088
|
+
lodSelection: lodSelection,
|
|
1089
|
+
parentNode: {
|
|
1090
|
+
id: parentNode.id,
|
|
1091
|
+
href: "../".concat(parentNode.id),
|
|
1092
|
+
mbs: parentNode.mbs,
|
|
1093
|
+
obb: parentNode.obb
|
|
1094
|
+
},
|
|
1095
|
+
children: [],
|
|
1096
|
+
neighbors: []
|
|
1097
|
+
});
|
|
597
1098
|
|
|
598
|
-
|
|
599
|
-
if (texture) {
|
|
600
|
-
const format = this._getFormatByMimeType(texture.mimeType);
|
|
1099
|
+
var node = (0, _jsonMapTransform.default)(nodeData, (0, _node.NODE)());
|
|
601
1100
|
|
|
602
|
-
if (
|
|
603
|
-
|
|
604
|
-
formats: [{
|
|
605
|
-
name: '0',
|
|
606
|
-
format
|
|
607
|
-
}, {
|
|
608
|
-
name: '1',
|
|
609
|
-
format: 'ktx2'
|
|
610
|
-
}]
|
|
611
|
-
});
|
|
612
|
-
}
|
|
1101
|
+
if (nodeInPage.mesh) {
|
|
1102
|
+
var _this$layers3, _this$layers3$attribu;
|
|
613
1103
|
|
|
614
|
-
|
|
615
|
-
|
|
1104
|
+
node.geometryData = [{
|
|
1105
|
+
href: './geometries/0'
|
|
1106
|
+
}];
|
|
1107
|
+
node.sharedResource = {
|
|
1108
|
+
href: './shared'
|
|
1109
|
+
};
|
|
616
1110
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
await (0, _fileUtils.writeFile)(texturePath, textureData, "index.".concat(format));
|
|
625
|
-
const ktx2TexturePath = (0, _path.join)(childPath, 'textures/1/');
|
|
626
|
-
await (0, _fileUtils.writeFile)(ktx2TexturePath, ktx2TextureData, "index.ktx2");
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
}
|
|
1111
|
+
if (texture) {
|
|
1112
|
+
node.textureData = [{
|
|
1113
|
+
href: './textures/0'
|
|
1114
|
+
}, {
|
|
1115
|
+
href: './textures/1'
|
|
1116
|
+
}];
|
|
1117
|
+
}
|
|
630
1118
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
} else {
|
|
641
|
-
const attributesPath = (0, _path.join)(childPath, "attributes/".concat(folderName, "/0"));
|
|
642
|
-
await (0, _fileUtils.writeFile)(attributesPath, fileBuffer, 'index.bin');
|
|
1119
|
+
if (attributes && attributes.length && (_this$layers3 = this.layers0) !== null && _this$layers3 !== void 0 && (_this$layers3$attribu = _this$layers3.attributeStorageInfo) !== null && _this$layers3$attribu !== void 0 && _this$layers3$attribu.length) {
|
|
1120
|
+
node.attributeData = [];
|
|
1121
|
+
|
|
1122
|
+
for (var index = 0; index < attributes.length; index++) {
|
|
1123
|
+
var folderName = this.layers0.attributeStorageInfo[index].key;
|
|
1124
|
+
node.attributeData.push({
|
|
1125
|
+
href: "./attributes/".concat(folderName, "/0")
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
643
1128
|
}
|
|
644
1129
|
}
|
|
1130
|
+
|
|
1131
|
+
return node;
|
|
645
1132
|
}
|
|
646
|
-
}
|
|
1133
|
+
}, {
|
|
1134
|
+
key: "_writeResources",
|
|
1135
|
+
value: function () {
|
|
1136
|
+
var _writeResources2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee12(resources, nodePath) {
|
|
1137
|
+
var geometryBuffer, compressedGeometry, texture, sharedResources, attributes, childPath, slpkChildPath;
|
|
1138
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1139
|
+
while (1) {
|
|
1140
|
+
switch (_context12.prev = _context12.next) {
|
|
1141
|
+
case 0:
|
|
1142
|
+
geometryBuffer = resources.geometry, compressedGeometry = resources.compressedGeometry, texture = resources.texture, sharedResources = resources.sharedResources, attributes = resources.attributes;
|
|
1143
|
+
childPath = (0, _path.join)(this.layers0Path, 'nodes', nodePath);
|
|
1144
|
+
slpkChildPath = (0, _path.join)('nodes', nodePath);
|
|
1145
|
+
_context12.next = 5;
|
|
1146
|
+
return this._writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath);
|
|
1147
|
+
|
|
1148
|
+
case 5:
|
|
1149
|
+
_context12.next = 7;
|
|
1150
|
+
return this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);
|
|
1151
|
+
|
|
1152
|
+
case 7:
|
|
1153
|
+
_context12.next = 9;
|
|
1154
|
+
return this._writeTexture(texture, childPath, slpkChildPath);
|
|
1155
|
+
|
|
1156
|
+
case 9:
|
|
1157
|
+
_context12.next = 11;
|
|
1158
|
+
return this._writeAttributes(attributes, childPath, slpkChildPath);
|
|
1159
|
+
|
|
1160
|
+
case 11:
|
|
1161
|
+
case "end":
|
|
1162
|
+
return _context12.stop();
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}, _callee12, this);
|
|
1166
|
+
}));
|
|
647
1167
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return 'jpg';
|
|
1168
|
+
function _writeResources(_x21, _x22) {
|
|
1169
|
+
return _writeResources2.apply(this, arguments);
|
|
1170
|
+
}
|
|
652
1171
|
|
|
653
|
-
|
|
654
|
-
|
|
1172
|
+
return _writeResources;
|
|
1173
|
+
}()
|
|
1174
|
+
}, {
|
|
1175
|
+
key: "_writeGeometries",
|
|
1176
|
+
value: function () {
|
|
1177
|
+
var _writeGeometries2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee13(geometryBuffer, compressedGeometry, childPath, slpkChildPath) {
|
|
1178
|
+
var slpkGeometryPath, geometryPath, slpkCompressedGeometryPath, compressedGeometryPath;
|
|
1179
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1180
|
+
while (1) {
|
|
1181
|
+
switch (_context13.prev = _context13.next) {
|
|
1182
|
+
case 0:
|
|
1183
|
+
if (!this.options.slpk) {
|
|
1184
|
+
_context13.next = 7;
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
slpkGeometryPath = (0, _path.join)(childPath, 'geometries');
|
|
1189
|
+
_context13.next = 4;
|
|
1190
|
+
return (0, _fileUtils.writeFileForSlpk)(slpkGeometryPath, geometryBuffer, '0.bin');
|
|
1191
|
+
|
|
1192
|
+
case 4:
|
|
1193
|
+
this.fileMap["".concat(slpkChildPath, "/geometries/0.bin.gz")] = _context13.sent;
|
|
1194
|
+
_context13.next = 10;
|
|
1195
|
+
break;
|
|
1196
|
+
|
|
1197
|
+
case 7:
|
|
1198
|
+
geometryPath = (0, _path.join)(childPath, 'geometries/0/');
|
|
1199
|
+
_context13.next = 10;
|
|
1200
|
+
return (0, _fileUtils.writeFile)(geometryPath, geometryBuffer, 'index.bin');
|
|
1201
|
+
|
|
1202
|
+
case 10:
|
|
1203
|
+
if (!this.options.draco) {
|
|
1204
|
+
_context13.next = 21;
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
if (!this.options.slpk) {
|
|
1209
|
+
_context13.next = 18;
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
slpkCompressedGeometryPath = (0, _path.join)(childPath, 'geometries');
|
|
1214
|
+
_context13.next = 15;
|
|
1215
|
+
return (0, _fileUtils.writeFileForSlpk)(slpkCompressedGeometryPath, compressedGeometry, '1.bin');
|
|
1216
|
+
|
|
1217
|
+
case 15:
|
|
1218
|
+
this.fileMap["".concat(slpkChildPath, "/geometries/1.bin.gz")] = _context13.sent;
|
|
1219
|
+
_context13.next = 21;
|
|
1220
|
+
break;
|
|
1221
|
+
|
|
1222
|
+
case 18:
|
|
1223
|
+
compressedGeometryPath = (0, _path.join)(childPath, 'geometries/1/');
|
|
1224
|
+
_context13.next = 21;
|
|
1225
|
+
return (0, _fileUtils.writeFile)(compressedGeometryPath, compressedGeometry, 'index.bin');
|
|
1226
|
+
|
|
1227
|
+
case 21:
|
|
1228
|
+
case "end":
|
|
1229
|
+
return _context13.stop();
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
}, _callee13, this);
|
|
1233
|
+
}));
|
|
655
1234
|
|
|
656
|
-
|
|
657
|
-
return
|
|
658
|
-
|
|
659
|
-
}
|
|
1235
|
+
function _writeGeometries(_x23, _x24, _x25, _x26) {
|
|
1236
|
+
return _writeGeometries2.apply(this, arguments);
|
|
1237
|
+
}
|
|
660
1238
|
|
|
661
|
-
|
|
662
|
-
|
|
1239
|
+
return _writeGeometries;
|
|
1240
|
+
}()
|
|
1241
|
+
}, {
|
|
1242
|
+
key: "_writeShared",
|
|
1243
|
+
value: function () {
|
|
1244
|
+
var _writeShared2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee14(sharedResources, childPath, slpkChildPath, nodePath) {
|
|
1245
|
+
var sharedData, sharedDataStr, slpkSharedPath, sharedPath;
|
|
1246
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1247
|
+
while (1) {
|
|
1248
|
+
switch (_context14.prev = _context14.next) {
|
|
1249
|
+
case 0:
|
|
1250
|
+
sharedResources.nodePath = nodePath;
|
|
1251
|
+
sharedData = (0, _jsonMapTransform.default)(sharedResources, (0, _sharedResources.SHARED_RESOURCES)());
|
|
1252
|
+
sharedDataStr = JSON.stringify(sharedData);
|
|
1253
|
+
|
|
1254
|
+
if (!this.options.slpk) {
|
|
1255
|
+
_context14.next = 10;
|
|
1256
|
+
break;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
slpkSharedPath = (0, _path.join)(childPath, 'shared');
|
|
1260
|
+
_context14.next = 7;
|
|
1261
|
+
return (0, _fileUtils.writeFileForSlpk)(slpkSharedPath, sharedDataStr, 'sharedResource.json');
|
|
1262
|
+
|
|
1263
|
+
case 7:
|
|
1264
|
+
this.fileMap["".concat(slpkChildPath, "/shared/sharedResource.json.gz")] = _context14.sent;
|
|
1265
|
+
_context14.next = 13;
|
|
1266
|
+
break;
|
|
1267
|
+
|
|
1268
|
+
case 10:
|
|
1269
|
+
sharedPath = (0, _path.join)(childPath, 'shared/');
|
|
1270
|
+
_context14.next = 13;
|
|
1271
|
+
return (0, _fileUtils.writeFile)(sharedPath, sharedDataStr);
|
|
1272
|
+
|
|
1273
|
+
case 13:
|
|
1274
|
+
case "end":
|
|
1275
|
+
return _context14.stop();
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}, _callee14, this);
|
|
1279
|
+
}));
|
|
663
1280
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
1281
|
+
function _writeShared(_x27, _x28, _x29, _x30) {
|
|
1282
|
+
return _writeShared2.apply(this, arguments);
|
|
1283
|
+
}
|
|
667
1284
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
1285
|
+
return _writeShared;
|
|
1286
|
+
}()
|
|
1287
|
+
}, {
|
|
1288
|
+
key: "_writeTexture",
|
|
1289
|
+
value: function () {
|
|
1290
|
+
var _writeTexture2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee15(texture, childPath, slpkChildPath) {
|
|
1291
|
+
var format, formats, textureData, ktx2TextureData, decodedFromKTX2TextureData;
|
|
1292
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1293
|
+
while (1) {
|
|
1294
|
+
switch (_context15.prev = _context15.next) {
|
|
1295
|
+
case 0:
|
|
1296
|
+
if (!texture) {
|
|
1297
|
+
_context15.next = 33;
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
format = this._getFormatByMimeType(texture === null || texture === void 0 ? void 0 : texture.mimeType);
|
|
1302
|
+
formats = [];
|
|
1303
|
+
textureData = texture.bufferView.data;
|
|
1304
|
+
_context15.t0 = format;
|
|
1305
|
+
_context15.next = _context15.t0 === 'jpg' ? 7 : _context15.t0 === 'png' ? 7 : _context15.t0 === 'ktx2' ? 20 : 32;
|
|
1306
|
+
break;
|
|
1307
|
+
|
|
1308
|
+
case 7:
|
|
1309
|
+
formats.push({
|
|
1310
|
+
name: '0',
|
|
1311
|
+
format: format
|
|
1312
|
+
});
|
|
1313
|
+
_context15.next = 10;
|
|
1314
|
+
return this.writeTextureFile(textureData, '0', format, childPath, slpkChildPath);
|
|
1315
|
+
|
|
1316
|
+
case 10:
|
|
1317
|
+
if (!this.generateTextures) {
|
|
1318
|
+
_context15.next = 19;
|
|
1319
|
+
break;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
formats.push({
|
|
1323
|
+
name: '1',
|
|
1324
|
+
format: 'ktx2'
|
|
1325
|
+
});
|
|
1326
|
+
_context15.t1 = Uint8Array;
|
|
1327
|
+
_context15.next = 15;
|
|
1328
|
+
return (0, _core.encode)(texture.image, _textures.KTX2BasisUniversalTextureWriter);
|
|
1329
|
+
|
|
1330
|
+
case 15:
|
|
1331
|
+
_context15.t2 = _context15.sent;
|
|
1332
|
+
ktx2TextureData = new _context15.t1(_context15.t2);
|
|
1333
|
+
_context15.next = 19;
|
|
1334
|
+
return this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);
|
|
1335
|
+
|
|
1336
|
+
case 19:
|
|
1337
|
+
return _context15.abrupt("break", 32);
|
|
1338
|
+
|
|
1339
|
+
case 20:
|
|
1340
|
+
formats.push({
|
|
1341
|
+
name: '1',
|
|
1342
|
+
format: format
|
|
1343
|
+
});
|
|
1344
|
+
_context15.next = 23;
|
|
1345
|
+
return this.writeTextureFile(textureData, '1', format, childPath, slpkChildPath);
|
|
1346
|
+
|
|
1347
|
+
case 23:
|
|
1348
|
+
if (!this.generateTextures) {
|
|
1349
|
+
_context15.next = 32;
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
formats.push({
|
|
1354
|
+
name: '0',
|
|
1355
|
+
format: 'jpg'
|
|
1356
|
+
});
|
|
1357
|
+
_context15.t3 = Uint8Array;
|
|
1358
|
+
_context15.next = 28;
|
|
1359
|
+
return (0, _core.encode)(texture.image.data[0], _images.ImageWriter);
|
|
1360
|
+
|
|
1361
|
+
case 28:
|
|
1362
|
+
_context15.t4 = _context15.sent;
|
|
1363
|
+
decodedFromKTX2TextureData = new _context15.t3(_context15.t4);
|
|
1364
|
+
_context15.next = 32;
|
|
1365
|
+
return this.writeTextureFile(decodedFromKTX2TextureData, '0', 'jpg', childPath, slpkChildPath);
|
|
1366
|
+
|
|
1367
|
+
case 32:
|
|
1368
|
+
if (!this.layers0.textureSetDefinitions.length) {
|
|
1369
|
+
this.layers0.textureSetDefinitions.push({
|
|
1370
|
+
formats: formats
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
case 33:
|
|
1375
|
+
case "end":
|
|
1376
|
+
return _context15.stop();
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
}, _callee15, this);
|
|
1380
|
+
}));
|
|
672
1381
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
key: "f_".concat(attributeIndex),
|
|
676
|
-
name: key,
|
|
677
|
-
ordering: ['attributeValues'],
|
|
678
|
-
header: [{
|
|
679
|
-
property: 'count',
|
|
680
|
-
valueType: 'UInt32'
|
|
681
|
-
}],
|
|
682
|
-
attributeValues: {
|
|
683
|
-
valueType: 'Int32',
|
|
684
|
-
valuesPerElement: 1
|
|
1382
|
+
function _writeTexture(_x31, _x32, _x33) {
|
|
1383
|
+
return _writeTexture2.apply(this, arguments);
|
|
685
1384
|
}
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
switch (attributeType) {
|
|
689
|
-
case OBJECT_ID_TYPE:
|
|
690
|
-
this._setupIdAttribute(storageAttribute);
|
|
691
1385
|
|
|
692
|
-
|
|
1386
|
+
return _writeTexture;
|
|
1387
|
+
}()
|
|
1388
|
+
}, {
|
|
1389
|
+
key: "writeTextureFile",
|
|
1390
|
+
value: function () {
|
|
1391
|
+
var _writeTextureFile = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee16(textureData, name, format, childPath, slpkChildPath) {
|
|
1392
|
+
var texturePath, slpkTexturePath, compress;
|
|
1393
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1394
|
+
while (1) {
|
|
1395
|
+
switch (_context16.prev = _context16.next) {
|
|
1396
|
+
case 0:
|
|
1397
|
+
texturePath = (0, _path.join)(childPath, "textures/".concat(name, "/"));
|
|
1398
|
+
_context16.next = 3;
|
|
1399
|
+
return (0, _fileUtils.writeFile)(texturePath, textureData, "index.".concat(format));
|
|
1400
|
+
|
|
1401
|
+
case 3:
|
|
1402
|
+
if (!this.options.slpk) {
|
|
1403
|
+
_context16.next = 9;
|
|
1404
|
+
break;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
slpkTexturePath = (0, _path.join)(childPath, 'textures');
|
|
1408
|
+
compress = false;
|
|
1409
|
+
_context16.next = 8;
|
|
1410
|
+
return (0, _fileUtils.writeFileForSlpk)(slpkTexturePath, textureData, "".concat(name, ".").concat(format), compress);
|
|
1411
|
+
|
|
1412
|
+
case 8:
|
|
1413
|
+
this.fileMap["".concat(slpkChildPath, "/textures/").concat(name, ".").concat(format)] = _context16.sent;
|
|
1414
|
+
|
|
1415
|
+
case 9:
|
|
1416
|
+
case "end":
|
|
1417
|
+
return _context16.stop();
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}, _callee16, this);
|
|
1421
|
+
}));
|
|
693
1422
|
|
|
694
|
-
|
|
695
|
-
|
|
1423
|
+
function writeTextureFile(_x34, _x35, _x36, _x37, _x38) {
|
|
1424
|
+
return _writeTextureFile.apply(this, arguments);
|
|
1425
|
+
}
|
|
696
1426
|
|
|
697
|
-
|
|
1427
|
+
return writeTextureFile;
|
|
1428
|
+
}()
|
|
1429
|
+
}, {
|
|
1430
|
+
key: "_writeAttributes",
|
|
1431
|
+
value: function () {
|
|
1432
|
+
var _writeAttributes2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee17(attributes, childPath, slpkChildPath) {
|
|
1433
|
+
var _this$layers4, _this$layers4$attribu;
|
|
1434
|
+
|
|
1435
|
+
var index, folderName, fileBuffer, slpkAttributesPath, attributesPath;
|
|
1436
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1437
|
+
while (1) {
|
|
1438
|
+
switch (_context17.prev = _context17.next) {
|
|
1439
|
+
case 0:
|
|
1440
|
+
if (!(attributes.length && (_this$layers4 = this.layers0) !== null && _this$layers4 !== void 0 && (_this$layers4$attribu = _this$layers4.attributeStorageInfo) !== null && _this$layers4$attribu !== void 0 && _this$layers4$attribu.length)) {
|
|
1441
|
+
_context17.next = 18;
|
|
1442
|
+
break;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
index = 0;
|
|
1446
|
+
|
|
1447
|
+
case 2:
|
|
1448
|
+
if (!(index < attributes.length)) {
|
|
1449
|
+
_context17.next = 18;
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
folderName = this.layers0.attributeStorageInfo[index].key;
|
|
1454
|
+
fileBuffer = new Uint8Array(attributes[index]);
|
|
1455
|
+
|
|
1456
|
+
if (!this.options.slpk) {
|
|
1457
|
+
_context17.next = 12;
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
slpkAttributesPath = (0, _path.join)(childPath, 'attributes', folderName);
|
|
1462
|
+
_context17.next = 9;
|
|
1463
|
+
return (0, _fileUtils.writeFileForSlpk)(slpkAttributesPath, fileBuffer, '0.bin');
|
|
1464
|
+
|
|
1465
|
+
case 9:
|
|
1466
|
+
this.fileMap["".concat(slpkChildPath, "/attributes/").concat(folderName, ".bin.gz")] = _context17.sent;
|
|
1467
|
+
_context17.next = 15;
|
|
1468
|
+
break;
|
|
1469
|
+
|
|
1470
|
+
case 12:
|
|
1471
|
+
attributesPath = (0, _path.join)(childPath, "attributes/".concat(folderName, "/0"));
|
|
1472
|
+
_context17.next = 15;
|
|
1473
|
+
return (0, _fileUtils.writeFile)(attributesPath, fileBuffer, 'index.bin');
|
|
1474
|
+
|
|
1475
|
+
case 15:
|
|
1476
|
+
index++;
|
|
1477
|
+
_context17.next = 2;
|
|
1478
|
+
break;
|
|
1479
|
+
|
|
1480
|
+
case 18:
|
|
1481
|
+
case "end":
|
|
1482
|
+
return _context17.stop();
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
}, _callee17, this);
|
|
1486
|
+
}));
|
|
698
1487
|
|
|
699
|
-
|
|
700
|
-
|
|
1488
|
+
function _writeAttributes(_x39, _x40, _x41) {
|
|
1489
|
+
return _writeAttributes2.apply(this, arguments);
|
|
1490
|
+
}
|
|
701
1491
|
|
|
702
|
-
|
|
1492
|
+
return _writeAttributes;
|
|
1493
|
+
}()
|
|
1494
|
+
}, {
|
|
1495
|
+
key: "_getFormatByMimeType",
|
|
1496
|
+
value: function _getFormatByMimeType(mimeType) {
|
|
1497
|
+
switch (mimeType) {
|
|
1498
|
+
case 'image/jpeg':
|
|
1499
|
+
return 'jpg';
|
|
703
1500
|
|
|
704
|
-
|
|
705
|
-
|
|
1501
|
+
case 'image/png':
|
|
1502
|
+
return 'png';
|
|
706
1503
|
|
|
707
|
-
|
|
708
|
-
|
|
1504
|
+
case 'image/ktx2':
|
|
1505
|
+
return 'ktx2';
|
|
709
1506
|
|
|
1507
|
+
default:
|
|
1508
|
+
return 'jpg';
|
|
1509
|
+
}
|
|
710
1510
|
}
|
|
1511
|
+
}, {
|
|
1512
|
+
key: "_findOrCreateMaterial",
|
|
1513
|
+
value: function _findOrCreateMaterial(material) {
|
|
1514
|
+
var hash = (0, _md.default)(JSON.stringify(material));
|
|
711
1515
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
getAttributeType(key, attribute) {
|
|
716
|
-
if (key === OBJECT_ID_TYPE) {
|
|
717
|
-
return OBJECT_ID_TYPE;
|
|
718
|
-
}
|
|
1516
|
+
if (this.materialMap.has(hash)) {
|
|
1517
|
+
return this.materialMap.get(hash);
|
|
1518
|
+
}
|
|
719
1519
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
|
|
1520
|
+
var newMaterialId = this.materialDefinitions.push(material) - 1;
|
|
1521
|
+
this.materialMap.set(hash, newMaterialId);
|
|
1522
|
+
return newMaterialId;
|
|
724
1523
|
}
|
|
1524
|
+
}, {
|
|
1525
|
+
key: "_createdStorageAttribute",
|
|
1526
|
+
value: function _createdStorageAttribute(attributeIndex, key, attributeType) {
|
|
1527
|
+
var storageAttribute = {
|
|
1528
|
+
key: "f_".concat(attributeIndex),
|
|
1529
|
+
name: key,
|
|
1530
|
+
ordering: ['attributeValues'],
|
|
1531
|
+
header: [{
|
|
1532
|
+
property: 'count',
|
|
1533
|
+
valueType: 'UInt32'
|
|
1534
|
+
}],
|
|
1535
|
+
attributeValues: {
|
|
1536
|
+
valueType: 'Int32',
|
|
1537
|
+
valuesPerElement: 1
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
725
1540
|
|
|
726
|
-
|
|
727
|
-
|
|
1541
|
+
switch (attributeType) {
|
|
1542
|
+
case OBJECT_ID_TYPE:
|
|
1543
|
+
this._setupIdAttribute(storageAttribute);
|
|
728
1544
|
|
|
729
|
-
|
|
730
|
-
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
731
|
-
storageAttribute.header.push({
|
|
732
|
-
property: 'attributeValuesByteCount',
|
|
733
|
-
valueType: 'UInt32'
|
|
734
|
-
});
|
|
735
|
-
storageAttribute.attributeValues = {
|
|
736
|
-
valueType: 'String',
|
|
737
|
-
encoding: 'UTF-8',
|
|
738
|
-
valuesPerElement: 1
|
|
739
|
-
};
|
|
740
|
-
storageAttribute.attributeByteCounts = {
|
|
741
|
-
valueType: 'UInt32',
|
|
742
|
-
valuesPerElement: 1
|
|
743
|
-
};
|
|
744
|
-
}
|
|
1545
|
+
break;
|
|
745
1546
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
valueType: 'Oid32',
|
|
749
|
-
valuesPerElement: 1
|
|
750
|
-
};
|
|
751
|
-
}
|
|
1547
|
+
case STRING_TYPE:
|
|
1548
|
+
this._setupStringAttribute(storageAttribute);
|
|
752
1549
|
|
|
753
|
-
|
|
754
|
-
storageAttribute.attributeValues = {
|
|
755
|
-
valueType: 'Float64',
|
|
756
|
-
valuesPerElement: 1
|
|
757
|
-
};
|
|
758
|
-
}
|
|
1550
|
+
break;
|
|
759
1551
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
name: key,
|
|
763
|
-
type: fieldAttributeType,
|
|
764
|
-
alias: key
|
|
765
|
-
};
|
|
766
|
-
}
|
|
1552
|
+
case DOUBLE_TYPE:
|
|
1553
|
+
this._setupDoubleAttribute(storageAttribute);
|
|
767
1554
|
|
|
768
|
-
|
|
769
|
-
let attributeIndex = 0;
|
|
770
|
-
const batchTableWithObjectId = {
|
|
771
|
-
OBJECTID: [0],
|
|
772
|
-
...batchTable
|
|
773
|
-
};
|
|
1555
|
+
break;
|
|
774
1556
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
const attributeType = this.getAttributeType(key, firstAttribute);
|
|
1557
|
+
case SHORT_INT_TYPE:
|
|
1558
|
+
break;
|
|
778
1559
|
|
|
779
|
-
|
|
1560
|
+
default:
|
|
1561
|
+
this._setupStringAttribute(storageAttribute);
|
|
780
1562
|
|
|
781
|
-
|
|
1563
|
+
}
|
|
782
1564
|
|
|
783
|
-
|
|
1565
|
+
return storageAttribute;
|
|
1566
|
+
}
|
|
1567
|
+
}, {
|
|
1568
|
+
key: "getAttributeType",
|
|
1569
|
+
value: function getAttributeType(key, attribute) {
|
|
1570
|
+
if (key === OBJECT_ID_TYPE) {
|
|
1571
|
+
return OBJECT_ID_TYPE;
|
|
1572
|
+
}
|
|
784
1573
|
|
|
785
|
-
|
|
1574
|
+
if ((0, _typeof2.default)(attribute) === STRING_TYPE) {
|
|
1575
|
+
return STRING_TYPE;
|
|
1576
|
+
} else if (typeof attribute === 'number') {
|
|
1577
|
+
return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
|
|
1578
|
+
}
|
|
786
1579
|
|
|
787
|
-
|
|
788
|
-
this.layers0.fields.push(fieldAttribute);
|
|
789
|
-
this.layers0.popupInfo = popupInfo;
|
|
790
|
-
this.layers0.layerType = _3D_OBJECT_LAYER_TYPE;
|
|
791
|
-
attributeIndex += 1;
|
|
1580
|
+
return STRING_TYPE;
|
|
792
1581
|
}
|
|
793
|
-
}
|
|
1582
|
+
}, {
|
|
1583
|
+
key: "_setupStringAttribute",
|
|
1584
|
+
value: function _setupStringAttribute(storageAttribute) {
|
|
1585
|
+
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
1586
|
+
storageAttribute.header.push({
|
|
1587
|
+
property: 'attributeValuesByteCount',
|
|
1588
|
+
valueType: 'UInt32'
|
|
1589
|
+
});
|
|
1590
|
+
storageAttribute.attributeValues = {
|
|
1591
|
+
valueType: 'String',
|
|
1592
|
+
encoding: 'UTF-8',
|
|
1593
|
+
valuesPerElement: 1
|
|
1594
|
+
};
|
|
1595
|
+
storageAttribute.attributeByteCounts = {
|
|
1596
|
+
valueType: 'UInt32',
|
|
1597
|
+
valuesPerElement: 1
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
}, {
|
|
1601
|
+
key: "_setupIdAttribute",
|
|
1602
|
+
value: function _setupIdAttribute(storageAttribute) {
|
|
1603
|
+
storageAttribute.attributeValues = {
|
|
1604
|
+
valueType: 'Oid32',
|
|
1605
|
+
valuesPerElement: 1
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
}, {
|
|
1609
|
+
key: "_setupDoubleAttribute",
|
|
1610
|
+
value: function _setupDoubleAttribute(storageAttribute) {
|
|
1611
|
+
storageAttribute.attributeValues = {
|
|
1612
|
+
valueType: 'Float64',
|
|
1613
|
+
valuesPerElement: 1
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1616
|
+
}, {
|
|
1617
|
+
key: "_createFieldAttribute",
|
|
1618
|
+
value: function _createFieldAttribute(key, fieldAttributeType) {
|
|
1619
|
+
return {
|
|
1620
|
+
name: key,
|
|
1621
|
+
type: fieldAttributeType,
|
|
1622
|
+
alias: key
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
}, {
|
|
1626
|
+
key: "_convertBatchTableInfoToNodeAttributes",
|
|
1627
|
+
value: function _convertBatchTableInfoToNodeAttributes(batchTable) {
|
|
1628
|
+
var attributeIndex = 0;
|
|
794
1629
|
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
return 'esriFieldTypeOID';
|
|
1630
|
+
var batchTableWithObjectId = _objectSpread({
|
|
1631
|
+
OBJECTID: [0]
|
|
1632
|
+
}, batchTable);
|
|
799
1633
|
|
|
800
|
-
|
|
801
|
-
|
|
1634
|
+
for (var _key in batchTableWithObjectId) {
|
|
1635
|
+
var firstAttribute = batchTableWithObjectId[_key][0];
|
|
1636
|
+
var attributeType = this.getAttributeType(_key, firstAttribute);
|
|
802
1637
|
|
|
803
|
-
|
|
804
|
-
return 'esriFieldTypeInteger';
|
|
1638
|
+
var storageAttribute = this._createdStorageAttribute(attributeIndex, _key, attributeType);
|
|
805
1639
|
|
|
806
|
-
|
|
807
|
-
return 'esriFieldTypeDouble';
|
|
1640
|
+
var fieldAttributeType = this._getFieldAttributeType(attributeType);
|
|
808
1641
|
|
|
809
|
-
|
|
810
|
-
return 'esriFieldTypeString';
|
|
811
|
-
}
|
|
812
|
-
}
|
|
1642
|
+
var fieldAttribute = this._createFieldAttribute(_key, fieldAttributeType);
|
|
813
1643
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
fieldInfos.push({
|
|
823
|
-
fieldName: key,
|
|
824
|
-
visible: true,
|
|
825
|
-
isEditable: false,
|
|
826
|
-
label: key
|
|
827
|
-
});
|
|
1644
|
+
var popupInfo = this._createPopupInfo(batchTableWithObjectId);
|
|
1645
|
+
|
|
1646
|
+
this.layers0.attributeStorageInfo.push(storageAttribute);
|
|
1647
|
+
this.layers0.fields.push(fieldAttribute);
|
|
1648
|
+
this.layers0.popupInfo = popupInfo;
|
|
1649
|
+
this.layers0.layerType = _3D_OBJECT_LAYER_TYPE;
|
|
1650
|
+
attributeIndex += 1;
|
|
1651
|
+
}
|
|
828
1652
|
}
|
|
1653
|
+
}, {
|
|
1654
|
+
key: "_getFieldAttributeType",
|
|
1655
|
+
value: function _getFieldAttributeType(attributeType) {
|
|
1656
|
+
switch (attributeType) {
|
|
1657
|
+
case OBJECT_ID_TYPE:
|
|
1658
|
+
return 'esriFieldTypeOID';
|
|
829
1659
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
type: 'fields'
|
|
833
|
-
});
|
|
834
|
-
return {
|
|
835
|
-
title,
|
|
836
|
-
mediaInfos,
|
|
837
|
-
popupElements,
|
|
838
|
-
fieldInfos,
|
|
839
|
-
expressionInfos
|
|
840
|
-
};
|
|
841
|
-
}
|
|
1660
|
+
case STRING_TYPE:
|
|
1661
|
+
return 'esriFieldTypeString';
|
|
842
1662
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1663
|
+
case SHORT_INT_TYPE:
|
|
1664
|
+
return 'esriFieldTypeInteger';
|
|
1665
|
+
|
|
1666
|
+
case DOUBLE_TYPE:
|
|
1667
|
+
return 'esriFieldTypeDouble';
|
|
1668
|
+
|
|
1669
|
+
default:
|
|
1670
|
+
return 'esriFieldTypeString';
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
}, {
|
|
1674
|
+
key: "_createPopupInfo",
|
|
1675
|
+
value: function _createPopupInfo(batchTable) {
|
|
1676
|
+
var title = '{OBJECTID}';
|
|
1677
|
+
var mediaInfos = [];
|
|
1678
|
+
var fieldInfos = [];
|
|
1679
|
+
var popupElements = [];
|
|
1680
|
+
var expressionInfos = [];
|
|
1681
|
+
|
|
1682
|
+
for (var _key2 in batchTable) {
|
|
1683
|
+
fieldInfos.push({
|
|
1684
|
+
fieldName: _key2,
|
|
1685
|
+
visible: true,
|
|
1686
|
+
isEditable: false,
|
|
1687
|
+
label: _key2
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
862
1690
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1691
|
+
popupElements.push({
|
|
1692
|
+
fieldInfos: fieldInfos,
|
|
1693
|
+
type: 'fields'
|
|
1694
|
+
});
|
|
1695
|
+
return {
|
|
1696
|
+
title: title,
|
|
1697
|
+
mediaInfos: mediaInfos,
|
|
1698
|
+
popupElements: popupElements,
|
|
1699
|
+
fieldInfos: fieldInfos,
|
|
1700
|
+
expressionInfos: expressionInfos
|
|
1701
|
+
};
|
|
866
1702
|
}
|
|
1703
|
+
}, {
|
|
1704
|
+
key: "_finishConversion",
|
|
1705
|
+
value: function () {
|
|
1706
|
+
var _finishConversion2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee18(params) {
|
|
1707
|
+
var _this$refinementCount, tilesCount, tilesWithAddRefineCount, addRefinementPercentage, filesSize, diff, conversionTime;
|
|
1708
|
+
|
|
1709
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1710
|
+
while (1) {
|
|
1711
|
+
switch (_context18.prev = _context18.next) {
|
|
1712
|
+
case 0:
|
|
1713
|
+
_this$refinementCount = this.refinementCounter, tilesCount = _this$refinementCount.tilesCount, tilesWithAddRefineCount = _this$refinementCount.tilesWithAddRefineCount;
|
|
1714
|
+
addRefinementPercentage = tilesWithAddRefineCount ? tilesWithAddRefineCount / tilesCount * 100 : 0;
|
|
1715
|
+
_context18.next = 4;
|
|
1716
|
+
return (0, _statisticUtills.calculateFilesSize)(params);
|
|
1717
|
+
|
|
1718
|
+
case 4:
|
|
1719
|
+
filesSize = _context18.sent;
|
|
1720
|
+
diff = _process.default.hrtime(this.conversionStartTime);
|
|
1721
|
+
conversionTime = (0, _statisticUtills.timeConverter)(diff);
|
|
1722
|
+
console.log("------------------------------------------------");
|
|
1723
|
+
console.log("Finishing conversion of ".concat(_3D_TILES));
|
|
1724
|
+
console.log("Total conversion time: ".concat(conversionTime));
|
|
1725
|
+
console.log("Vertex count: ", this.vertexCounter);
|
|
1726
|
+
console.log("File(s) size: ", filesSize, ' bytes');
|
|
1727
|
+
console.log("Percentage of tiles with \"ADD\" refinement type:", addRefinementPercentage, '%');
|
|
1728
|
+
console.log("------------------------------------------------");
|
|
1729
|
+
|
|
1730
|
+
case 14:
|
|
1731
|
+
case "end":
|
|
1732
|
+
return _context18.stop();
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
}, _callee18, this);
|
|
1736
|
+
}));
|
|
867
1737
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
accessToken: this.options.token || ION_DEFAULT_TOKEN
|
|
1738
|
+
function _finishConversion(_x42) {
|
|
1739
|
+
return _finishConversion2.apply(this, arguments);
|
|
871
1740
|
}
|
|
872
|
-
};
|
|
873
|
-
const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);
|
|
874
|
-
this.refreshTokenTime = _process.default.hrtime();
|
|
875
|
-
return { ...options,
|
|
876
|
-
...preloadOptions
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
1741
|
|
|
880
|
-
|
|
881
|
-
|
|
1742
|
+
return _finishConversion;
|
|
1743
|
+
}()
|
|
1744
|
+
}, {
|
|
1745
|
+
key: "_fetchPreloadOptions",
|
|
1746
|
+
value: function () {
|
|
1747
|
+
var _fetchPreloadOptions2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee19() {
|
|
1748
|
+
var options, preloadOptions;
|
|
1749
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
1750
|
+
while (1) {
|
|
1751
|
+
switch (_context19.prev = _context19.next) {
|
|
1752
|
+
case 0:
|
|
1753
|
+
if (this.Loader.preload) {
|
|
1754
|
+
_context19.next = 2;
|
|
1755
|
+
break;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
return _context19.abrupt("return", {});
|
|
1759
|
+
|
|
1760
|
+
case 2:
|
|
1761
|
+
options = {
|
|
1762
|
+
'cesium-ion': {
|
|
1763
|
+
accessToken: this.options.token || ION_DEFAULT_TOKEN
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
_context19.next = 5;
|
|
1767
|
+
return this.Loader.preload(this.options.inputUrl, options);
|
|
1768
|
+
|
|
1769
|
+
case 5:
|
|
1770
|
+
preloadOptions = _context19.sent;
|
|
1771
|
+
this.refreshTokenTime = _process.default.hrtime();
|
|
1772
|
+
return _context19.abrupt("return", _objectSpread(_objectSpread({}, options), preloadOptions));
|
|
1773
|
+
|
|
1774
|
+
case 8:
|
|
1775
|
+
case "end":
|
|
1776
|
+
return _context19.stop();
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
}, _callee19, this);
|
|
1780
|
+
}));
|
|
882
1781
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1782
|
+
function _fetchPreloadOptions() {
|
|
1783
|
+
return _fetchPreloadOptions2.apply(this, arguments);
|
|
1784
|
+
}
|
|
886
1785
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
1786
|
+
return _fetchPreloadOptions;
|
|
1787
|
+
}()
|
|
1788
|
+
}, {
|
|
1789
|
+
key: "_updateTilesetOptions",
|
|
1790
|
+
value: function () {
|
|
1791
|
+
var _updateTilesetOptions2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee20() {
|
|
1792
|
+
var diff, preloadOptions;
|
|
1793
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1794
|
+
while (1) {
|
|
1795
|
+
switch (_context20.prev = _context20.next) {
|
|
1796
|
+
case 0:
|
|
1797
|
+
diff = _process.default.hrtime(this.refreshTokenTime);
|
|
1798
|
+
|
|
1799
|
+
if (!(diff[0] < REFRESH_TOKEN_TIMEOUT)) {
|
|
1800
|
+
_context20.next = 3;
|
|
1801
|
+
break;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
return _context20.abrupt("return");
|
|
1805
|
+
|
|
1806
|
+
case 3:
|
|
1807
|
+
this.refreshTokenTime = _process.default.hrtime();
|
|
1808
|
+
_context20.next = 6;
|
|
1809
|
+
return this._fetchPreloadOptions();
|
|
1810
|
+
|
|
1811
|
+
case 6:
|
|
1812
|
+
preloadOptions = _context20.sent;
|
|
1813
|
+
this.sourceTileset.options = _objectSpread(_objectSpread({}, this.sourceTileset.options), preloadOptions);
|
|
1814
|
+
|
|
1815
|
+
if (preloadOptions.headers) {
|
|
1816
|
+
this.sourceTileset.loadOptions.fetch = _objectSpread(_objectSpread({}, this.sourceTileset.loadOptions.fetch), {}, {
|
|
1817
|
+
headers: preloadOptions.headers
|
|
1818
|
+
});
|
|
1819
|
+
console.log('Authorization Bearer token has been updated');
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
case 9:
|
|
1823
|
+
case "end":
|
|
1824
|
+
return _context20.stop();
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
}, _callee20, this);
|
|
1828
|
+
}));
|
|
892
1829
|
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
};
|
|
897
|
-
console.log('Authorization Bearer token has been updated');
|
|
898
|
-
}
|
|
899
|
-
}
|
|
1830
|
+
function _updateTilesetOptions() {
|
|
1831
|
+
return _updateTilesetOptions2.apply(this, arguments);
|
|
1832
|
+
}
|
|
900
1833
|
|
|
901
|
-
|
|
902
|
-
|
|
1834
|
+
return _updateTilesetOptions;
|
|
1835
|
+
}()
|
|
1836
|
+
}, {
|
|
1837
|
+
key: "_checkAddRefinementTypeForTile",
|
|
1838
|
+
value: function _checkAddRefinementTypeForTile(tile) {
|
|
1839
|
+
var ADD_TILE_REFINEMENT = 1;
|
|
903
1840
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1841
|
+
if (tile.refine === ADD_TILE_REFINEMENT) {
|
|
1842
|
+
this.refinementCounter.tilesWithAddRefineCount += 1;
|
|
1843
|
+
console.warn('This tile uses "ADD" type of refinement');
|
|
1844
|
+
}
|
|
908
1845
|
|
|
909
|
-
|
|
910
|
-
|
|
1846
|
+
this.refinementCounter.tilesCount += 1;
|
|
1847
|
+
}
|
|
1848
|
+
}, {
|
|
1849
|
+
key: "isContentSupported",
|
|
1850
|
+
value: function isContentSupported(sourceRootTile) {
|
|
1851
|
+
var _sourceRootTile$conte;
|
|
911
1852
|
|
|
912
|
-
|
|
1853
|
+
return ['b3dm', 'glTF'].includes(sourceRootTile === null || sourceRootTile === void 0 ? void 0 : (_sourceRootTile$conte = sourceRootTile.content) === null || _sourceRootTile$conte === void 0 ? void 0 : _sourceRootTile$conte.type);
|
|
1854
|
+
}
|
|
1855
|
+
}]);
|
|
1856
|
+
return I3SConverter;
|
|
1857
|
+
}();
|
|
913
1858
|
|
|
914
1859
|
exports.default = I3SConverter;
|
|
915
1860
|
//# sourceMappingURL=i3s-converter.js.map
|