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