@loaders.gl/tile-converter 3.1.3 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +78 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -0
- package/dist/{esm/3d-tiles-converter → 3d-tiles-converter}/3d-tiles-converter.js +2 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js.map +1 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +83 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -0
- package/dist/{esm/3d-tiles-converter → 3d-tiles-converter}/helpers/b3dm-converter.js +7 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +13 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +1 -0
- package/dist/{esm/3d-tiles-converter → 3d-tiles-converter}/helpers/i3s-obb-to-3d-tiles-obb.js +0 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +9 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -0
- package/dist/{esm/3d-tiles-converter → 3d-tiles-converter}/helpers/texture-atlas.js +0 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +1 -0
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts +15 -0
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +1 -0
- package/dist/{esm/3d-tiles-converter → 3d-tiles-converter}/json-templates/tileset.js +0 -0
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +1 -0
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/{esm/bundle.js → bundle.js} +0 -0
- package/dist/bundle.js.map +1 -0
- package/dist/converter.min.js +21 -21
- package/dist/{es5/deps-installer → deps-installer}/deps-installer.d.ts +0 -0
- package/dist/deps-installer/deps-installer.d.ts.map +1 -0
- package/dist/{esm/deps-installer → deps-installer}/deps-installer.js +0 -0
- package/dist/deps-installer/deps-installer.js.map +1 -0
- package/dist/dist.min.js +201 -445
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +41 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/helpers/coordinate-converter.js +0 -0
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +1 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +9 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/helpers/create-scene-server-path.js +0 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +1 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +23 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/helpers/geometry-attributes.js +0 -0
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +1 -0
- package/dist/{es5/i3s-converter → i3s-converter}/helpers/geometry-converter.d.ts +0 -0
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/helpers/geometry-converter.js +31 -4
- package/dist/i3s-converter/helpers/geometry-converter.js.map +1 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts +2 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/helpers/node-debug.js +0 -0
- package/dist/i3s-converter/helpers/node-debug.js.map +1 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +116 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/helpers/node-pages.js +0 -0
- package/dist/i3s-converter/helpers/node-pages.js.map +1 -0
- package/dist/i3s-converter/i3s-converter.d.ts +320 -0
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/i3s-converter.js +0 -0
- package/dist/i3s-converter/i3s-converter.js.map +1 -0
- package/dist/i3s-converter/json-templates/layers.d.ts +95 -0
- package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/json-templates/layers.js +0 -0
- package/dist/i3s-converter/json-templates/layers.js.map +1 -0
- package/dist/i3s-converter/json-templates/metadata.d.ts +22 -0
- package/dist/i3s-converter/json-templates/metadata.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/json-templates/metadata.js +0 -0
- package/dist/i3s-converter/json-templates/metadata.js.map +1 -0
- package/dist/i3s-converter/json-templates/node.d.ts +61 -0
- package/dist/i3s-converter/json-templates/node.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/json-templates/node.js +0 -0
- package/dist/i3s-converter/json-templates/node.js.map +1 -0
- package/dist/i3s-converter/json-templates/scene-server.d.ts +28 -0
- package/dist/i3s-converter/json-templates/scene-server.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/json-templates/scene-server.js +0 -0
- package/dist/i3s-converter/json-templates/scene-server.js.map +1 -0
- package/dist/i3s-converter/json-templates/shared-resources.d.ts +14 -0
- package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/json-templates/shared-resources.js +0 -0
- package/dist/i3s-converter/json-templates/shared-resources.js.map +1 -0
- package/dist/i3s-converter/json-templates/store.d.ts +95 -0
- package/dist/i3s-converter/json-templates/store.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/json-templates/store.js +0 -0
- package/dist/i3s-converter/json-templates/store.js.map +1 -0
- package/dist/i3s-converter/types.d.ts +14 -0
- package/dist/i3s-converter/types.d.ts.map +1 -0
- package/dist/{esm/i3s-converter → i3s-converter}/types.js +0 -0
- package/dist/{es5/i3s-converter → i3s-converter}/types.js.map +0 -0
- package/dist/i3s-server/app.d.ts +3 -0
- package/dist/i3s-server/app.d.ts.map +1 -0
- package/dist/{esm/i3s-server → i3s-server}/app.js +0 -0
- package/dist/i3s-server/app.js.map +1 -0
- package/dist/{es5/i3s-server → i3s-server}/bin/www +0 -0
- package/dist/{es5/i3s-server → i3s-server}/certs/cert.pem +0 -0
- package/dist/{es5/i3s-server → i3s-server}/certs/key.pem +0 -0
- package/dist/i3s-server/controllers/index-controller.d.ts +2 -0
- package/dist/i3s-server/controllers/index-controller.d.ts.map +1 -0
- package/dist/{esm/i3s-server → i3s-server}/controllers/index-controller.js +0 -0
- package/dist/i3s-server/controllers/index-controller.js.map +1 -0
- package/dist/i3s-server/routes/index.d.ts +3 -0
- package/dist/i3s-server/routes/index.d.ts.map +1 -0
- package/dist/{esm/i3s-server → i3s-server}/routes/index.js +0 -0
- package/dist/i3s-server/routes/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/{esm/index.js → index.js} +0 -0
- package/dist/index.js.map +1 -0
- package/dist/{es5/lib → lib}/utils/compress-util.d.ts +0 -0
- package/dist/lib/utils/compress-util.d.ts.map +1 -0
- package/dist/{esm/lib → lib}/utils/compress-util.js +0 -0
- package/dist/lib/utils/compress-util.js.map +1 -0
- package/dist/{es5/lib → lib}/utils/file-utils.d.ts +0 -0
- package/dist/lib/utils/file-utils.d.ts.map +1 -0
- package/dist/{esm/lib → lib}/utils/file-utils.js +0 -0
- package/dist/lib/utils/file-utils.js.map +1 -0
- package/dist/{es5/lib → lib}/utils/lod-conversion-utils.d.ts +0 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -0
- package/dist/{esm/lib → lib}/utils/lod-conversion-utils.js +0 -0
- package/dist/lib/utils/lod-conversion-utils.js.map +1 -0
- package/dist/{es5/lib → lib}/utils/statistic-utills.d.ts +0 -0
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -0
- package/dist/{esm/lib → lib}/utils/statistic-utills.js +0 -0
- package/dist/lib/utils/statistic-utills.js.map +1 -0
- package/dist/pgm-loader.d.ts +6 -0
- package/dist/pgm-loader.d.ts.map +1 -0
- package/dist/{esm/pgm-loader.js → pgm-loader.js} +1 -1
- package/dist/pgm-loader.js.map +1 -0
- package/package.json +18 -19
- package/src/3d-tiles-converter/3d-tiles-converter.ts +4 -1
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +6 -5
- package/src/i3s-converter/helpers/geometry-converter.js +39 -4
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +0 -507
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +0 -366
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -26
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +0 -40
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +0 -67
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/es5/bundle.js +0 -7
- package/dist/es5/bundle.js.map +0 -1
- package/dist/es5/deps-installer/deps-installer.js +0 -83
- package/dist/es5/deps-installer/deps-installer.js.map +0 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +0 -104
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +0 -54
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +0 -218
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +0 -911
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +0 -99
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +0 -258
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/es5/i3s-converter/i3s-converter.js +0 -1860
- package/dist/es5/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/es5/i3s-converter/json-templates/layers.js +0 -239
- package/dist/es5/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js +0 -33
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/es5/i3s-converter/json-templates/node.js +0 -109
- package/dist/es5/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js +0 -41
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +0 -196
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/es5/i3s-converter/json-templates/store.js +0 -107
- package/dist/es5/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/es5/i3s-converter/types.js +0 -2
- package/dist/es5/i3s-server/app.js +0 -23
- package/dist/es5/i3s-server/app.js.map +0 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +0 -73
- package/dist/es5/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/es5/i3s-server/routes/index.js +0 -49
- package/dist/es5/i3s-server/routes/index.js.map +0 -1
- package/dist/es5/index.js +0 -40
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/lib/utils/compress-util.js +0 -424
- package/dist/es5/lib/utils/compress-util.js.map +0 -1
- package/dist/es5/lib/utils/file-utils.js +0 -137
- package/dist/es5/lib/utils/file-utils.js.map +0 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +0 -52
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/es5/lib/utils/statistic-utills.js +0 -196
- package/dist/es5/lib/utils/statistic-utills.js.map +0 -1
- package/dist/es5/pgm-loader.js +0 -51
- package/dist/es5/pgm-loader.js.map +0 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/esm/bundle.js.map +0 -1
- package/dist/esm/deps-installer/deps-installer.d.ts +0 -10
- package/dist/esm/deps-installer/deps-installer.js.map +0 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/esm/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/esm/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/esm/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/esm/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/esm/i3s-converter/types.js.map +0 -1
- package/dist/esm/i3s-server/app.js.map +0 -1
- package/dist/esm/i3s-server/bin/www +0 -102
- package/dist/esm/i3s-server/certs/cert.pem +0 -19
- package/dist/esm/i3s-server/certs/key.pem +0 -27
- package/dist/esm/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/esm/i3s-server/routes/index.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/utils/compress-util.d.ts +0 -53
- package/dist/esm/lib/utils/compress-util.js.map +0 -1
- package/dist/esm/lib/utils/file-utils.d.ts +0 -43
- package/dist/esm/lib/utils/file-utils.js.map +0 -1
- package/dist/esm/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/esm/lib/utils/statistic-utills.d.ts +0 -25
- package/dist/esm/lib/utils/statistic-utills.js.map +0 -1
- package/dist/esm/pgm-loader.js.map +0 -1
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.DepsInstaller = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _core = require("@loaders.gl/core");
|
|
19
|
-
|
|
20
|
-
var _zip = require("@loaders.gl/zip");
|
|
21
|
-
|
|
22
|
-
var _fileUtils = require("../lib/utils/file-utils");
|
|
23
|
-
|
|
24
|
-
var _path = require("path");
|
|
25
|
-
|
|
26
|
-
var PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';
|
|
27
|
-
|
|
28
|
-
var DepsInstaller = function () {
|
|
29
|
-
function DepsInstaller() {
|
|
30
|
-
(0, _classCallCheck2.default)(this, DepsInstaller);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
(0, _createClass2.default)(DepsInstaller, [{
|
|
34
|
-
key: "install",
|
|
35
|
-
value: function () {
|
|
36
|
-
var _install = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
|
|
37
|
-
var path,
|
|
38
|
-
fileMap,
|
|
39
|
-
depsPath,
|
|
40
|
-
_args = arguments;
|
|
41
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
42
|
-
while (1) {
|
|
43
|
-
switch (_context.prev = _context.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
path = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
|
|
46
|
-
console.log('Installing "EGM2008-5" model...');
|
|
47
|
-
_context.next = 4;
|
|
48
|
-
return (0, _core.load)(PGM_LINK, _zip.ZipLoader, {});
|
|
49
|
-
|
|
50
|
-
case 4:
|
|
51
|
-
fileMap = _context.sent;
|
|
52
|
-
depsPath = process.cwd();
|
|
53
|
-
|
|
54
|
-
if (path) {
|
|
55
|
-
depsPath = (0, _path.join)(depsPath, path);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
_context.next = 9;
|
|
59
|
-
return (0, _fileUtils.writeFile)(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');
|
|
60
|
-
|
|
61
|
-
case 9:
|
|
62
|
-
console.log('All dependencies were installed succesfully.');
|
|
63
|
-
|
|
64
|
-
case 10:
|
|
65
|
-
case "end":
|
|
66
|
-
return _context.stop();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, _callee);
|
|
70
|
-
}));
|
|
71
|
-
|
|
72
|
-
function install() {
|
|
73
|
-
return _install.apply(this, arguments);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return install;
|
|
77
|
-
}()
|
|
78
|
-
}]);
|
|
79
|
-
return DepsInstaller;
|
|
80
|
-
}();
|
|
81
|
-
|
|
82
|
-
exports.DepsInstaller = DepsInstaller;
|
|
83
|
-
//# sourceMappingURL=deps-installer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/deps-installer/deps-installer.js"],"names":["PGM_LINK","DepsInstaller","path","console","log","ZipLoader","fileMap","depsPath","process","cwd","Uint8Array"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,IAAMA,QAAQ,GAAG,+EAAjB;;IAEaC,a;;;;;;;;+EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAcC,gBAAAA,IAAd,2DAAqB,EAArB;AACEC,gBAAAA,OAAO,CAACC,GAAR,CAAY,iCAAZ;AADF;AAAA,uBAEwB,gBAAKJ,QAAL,EAAeK,cAAf,EAA0B,EAA1B,CAFxB;;AAAA;AAEQC,gBAAAA,OAFR;AAIMC,gBAAAA,QAJN,GAIiBC,OAAO,CAACC,GAAR,EAJjB;;AAKE,oBAAIP,IAAJ,EAAU;AACRK,kBAAAA,QAAQ,GAAG,gBAAKA,QAAL,EAAeL,IAAf,CAAX;AACD;;AAPH;AAAA,uBASQ,0BAAUK,QAAV,EAAoB,IAAIG,UAAJ,CAAeJ,OAAO,CAAC,sBAAD,CAAtB,CAApB,EAAqE,eAArE,CATR;;AAAA;AAWEH,gBAAAA,OAAO,CAACC,GAAR,CAAY,8CAAZ;;AAXF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O","sourcesContent":["import {load} from '@loaders.gl/core';\nimport {ZipLoader} from '@loaders.gl/zip';\nimport {writeFile} from '../lib/utils/file-utils';\nimport {join} from 'path';\n\nconst PGM_LINK = 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip';\n\nexport class DepsInstaller {\n async install(path = '') {\n console.log('Installing \"EGM2008-5\" model...'); // eslint-disable-line no-console\n const fileMap = await load(PGM_LINK, ZipLoader, {});\n\n let depsPath = process.cwd();\n if (path) {\n depsPath = join(depsPath, path);\n }\n\n await writeFile(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');\n\n console.log('All dependencies were installed succesfully.'); // eslint-disable-line no-console\n }\n}\n"],"file":"deps-installer.js"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createBoundingVolumes = createBoundingVolumes;
|
|
7
|
-
exports.createBoundingVolumesFromGeometry = createBoundingVolumesFromGeometry;
|
|
8
|
-
exports.convertPositionsToVectors = convertPositionsToVectors;
|
|
9
|
-
exports.convertCommonToI3SExtentCoordinate = convertCommonToI3SExtentCoordinate;
|
|
10
|
-
exports.createObbFromMbs = createObbFromMbs;
|
|
11
|
-
|
|
12
|
-
var _core = require("@math.gl/core");
|
|
13
|
-
|
|
14
|
-
var _geospatial = require("@math.gl/geospatial");
|
|
15
|
-
|
|
16
|
-
var _culling = require("@math.gl/culling");
|
|
17
|
-
|
|
18
|
-
function createBoundingVolumes(tile, geoidHeightModel) {
|
|
19
|
-
var radius;
|
|
20
|
-
var halfSize;
|
|
21
|
-
var quaternion;
|
|
22
|
-
var boundingVolume = tile.boundingVolume;
|
|
23
|
-
|
|
24
|
-
var cartographicCenter = _geospatial.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new _core.Vector3());
|
|
25
|
-
|
|
26
|
-
cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
27
|
-
|
|
28
|
-
if (boundingVolume instanceof _culling.OrientedBoundingBox) {
|
|
29
|
-
halfSize = boundingVolume.halfSize;
|
|
30
|
-
radius = new _core.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
31
|
-
quaternion = boundingVolume.quaternion;
|
|
32
|
-
} else {
|
|
33
|
-
radius = tile.boundingVolume.radius;
|
|
34
|
-
halfSize = [radius, radius, radius];
|
|
35
|
-
quaternion = new _core.Quaternion().fromMatrix3(new _core.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
|
|
40
|
-
obb: {
|
|
41
|
-
center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],
|
|
42
|
-
halfSize: halfSize,
|
|
43
|
-
quaternion: quaternion
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel) {
|
|
49
|
-
var positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
50
|
-
var geometryObb = (0, _culling.makeOrientedBoundingBoxFromPoints)(positionVectors);
|
|
51
|
-
var geometryMbs = (0, _culling.makeBoundingSphereFromPoints)(positionVectors);
|
|
52
|
-
|
|
53
|
-
var mbsCenter = _geospatial.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new _core.Vector3());
|
|
54
|
-
|
|
55
|
-
var obbCenter = _geospatial.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new _core.Vector3());
|
|
56
|
-
|
|
57
|
-
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
58
|
-
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
59
|
-
return {
|
|
60
|
-
mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],
|
|
61
|
-
obb: {
|
|
62
|
-
center: obbCenter,
|
|
63
|
-
halfSize: geometryObb.halfSize,
|
|
64
|
-
quaternion: geometryObb.quaternion
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function convertPositionsToVectors(positions) {
|
|
70
|
-
var result = [];
|
|
71
|
-
|
|
72
|
-
for (var i = 0; i < positions.length; i += 3) {
|
|
73
|
-
var positionVector = new _core.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
|
|
74
|
-
result.push(positionVector);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function convertCommonToI3SExtentCoordinate(tileset) {
|
|
81
|
-
var cartesianCenter = tileset === null || tileset === void 0 ? void 0 : tileset.cartesianCenter;
|
|
82
|
-
|
|
83
|
-
if (!cartesianCenter) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var radius = tileset === null || tileset === void 0 ? void 0 : tileset.lodMetricValue;
|
|
88
|
-
|
|
89
|
-
var rightTop = _geospatial.Ellipsoid.WGS84.cartesianToCartographic(new _core.Vector3(cartesianCenter[0] + radius, cartesianCenter[1] + radius, cartesianCenter[2]), new _core.Vector3());
|
|
90
|
-
|
|
91
|
-
var leftBottom = _geospatial.Ellipsoid.WGS84.cartesianToCartographic(new _core.Vector3(cartesianCenter[0] - radius, cartesianCenter[1] - radius, cartesianCenter[2]), new _core.Vector3());
|
|
92
|
-
|
|
93
|
-
var isFirstRight = rightTop[0] < leftBottom[0];
|
|
94
|
-
var isFirstTop = rightTop[1] < leftBottom[1];
|
|
95
|
-
return [isFirstRight ? rightTop[0] : leftBottom[0], isFirstTop ? rightTop[1] : leftBottom[1], isFirstRight ? leftBottom[0] : rightTop[0], isFirstTop ? leftBottom[1] : rightTop[1]];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function createObbFromMbs(mbs) {
|
|
99
|
-
var radius = mbs[3];
|
|
100
|
-
var center = new _core.Vector3(mbs[0], mbs[1], mbs[2]);
|
|
101
|
-
var halfAxex = new _core.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
|
|
102
|
-
return new _culling.OrientedBoundingBox(center, halfAxex);
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=coordinate-converter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/i3s-converter/helpers/coordinate-converter.ts"],"names":["createBoundingVolumes","tile","geoidHeightModel","radius","halfSize","quaternion","boundingVolume","cartographicCenter","Ellipsoid","WGS84","cartesianToCartographic","center","Vector3","getHeight","OrientedBoundingBox","len","Quaternion","fromMatrix3","Matrix3","normalize","mbs","obb","createBoundingVolumesFromGeometry","cartesianPositions","positionVectors","convertPositionsToVectors","geometryObb","geometryMbs","mbsCenter","obbCenter","positions","result","i","length","positionVector","push","convertCommonToI3SExtentCoordinate","tileset","cartesianCenter","lodMetricValue","rightTop","leftBottom","isFirstRight","isFirstTop","createObbFromMbs","halfAxex"],"mappings":";;;;;;;;;;;AAEA;;AACA;;AACA;;AAeO,SAASA,qBAAT,CAA+BC,IAA/B,EAAiDC,gBAAjD,EAA2F;AAChG,MAAIC,MAAJ;AACA,MAAIC,QAAJ;AACA,MAAIC,UAAJ;AAEA,MAAMC,cAAc,GAAGL,IAAI,CAACK,cAA5B;;AACA,MAAMC,kBAAkB,GAAGC,sBAAUC,KAAV,CAAgBC,uBAAhB,CACzBJ,cAAc,CAACK,MADU,EAEzB,IAAIC,aAAJ,EAFyB,CAA3B;;AAIAL,EAAAA,kBAAkB,CAAC,CAAD,CAAlB,GACEA,kBAAkB,CAAC,CAAD,CAAlB,GACAL,gBAAgB,CAACW,SAAjB,CAA2BN,kBAAkB,CAAC,CAAD,CAA7C,EAAkDA,kBAAkB,CAAC,CAAD,CAApE,CAFF;;AAGA,MAAID,cAAc,YAAYQ,4BAA9B,EAAmD;AACjDV,IAAAA,QAAQ,GAAGE,cAAc,CAACF,QAA1B;AACAD,IAAAA,M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Q,CAAC,CAAD,CAAX,GAAiBC,UAAU,CAAC,CAAD,CAFhC,EAGLC,YAAY,GAAGD,UAAU,CAAC,CAAD,CAAb,GAAmBD,QAAQ,CAAC,CAAD,CAHlC,EAILG,UAAU,GAAGF,UAAU,CAAC,CAAD,CAAb,GAAmBD,QAAQ,CAAC,CAAD,CAJhC,CAAP;AAMD;;AAOM,SAASI,gBAAT,CAA0BxB,GAA1B,EAAyC;AAC9C,MAAMjB,MAAM,GAAGiB,GAAG,CAAC,CAAD,CAAlB;AACA,MAAMT,MAAM,GAAG,IAAIC,aAAJ,CAAYQ,GAAG,CAAC,CAAD,CAAf,EAAoBA,GAAG,CAAC,CAAD,CAAvB,EAA4BA,GAAG,CAAC,CAAD,CAA/B,CAAf;AACA,MAAMyB,QAAQ,GAAG,IAAI3B,aAAJ,CAAY,CAACf,MAAD,EAAS,CAAT,EAAY,CAAZ,EAAe,CAAf,EAAkBA,MAAlB,EAA0B,CAA1B,EAA6B,CAA7B,EAAgC,CAAhC,EAAmCA,MAAnC,CAAZ,CAAjB;AACA,SAAO,IAAIW,4BAAJ,CAAwBH,MAAxB,EAAgCkC,QAAhC,CAAP;AACD","sourcesContent":["import type {BoundingVolumes, Extent, Mbs, Obb} from '@loaders.gl/i3s';\n\nimport {Matrix3, Quaternion, Vector3} from '@math.gl/core';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {\n OrientedBoundingBox,\n makeOrientedBoundingBoxFromPoints,\n makeBoundingSphereFromPoints\n} from '@math.gl/culling';\nimport TileHeader from '@loaders.gl/tiles/src/tileset/tile-3d';\nimport {Geoid} from '@math.gl/geoid';\nimport {Tileset3D} from '@loaders.gl/tiles';\n\n/**\n * Create bounding volumes object from tile and geoid height model.\n * @param tile\n * @param geoidHeightModel\n * @returns - Bounding volumes object\n */\nexport function createBoundingVolumes(tile: TileHeader, geoidHeightModel: Geoid): BoundingVolumes {\n let radius;\n let halfSize;\n let quaternion;\n\n const boundingVolume = tile.boundingVolume;\n const cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(\n boundingVolume.center,\n new Vector3()\n );\n cartographicCenter[2] =\n cartographicCenter[2] -\n geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);\n if (boundingVolume instanceof OrientedBoundingBox) {\n halfSize = boundingVolume.halfSize;\n radius = new Vector3(halfSize[0], halfSize[1], halfSize[2]).len();\n quaternion = boundingVolume.quaternion;\n } else {\n radius = tile.boundingVolume.radius;\n halfSize = [radius, radius, radius];\n quaternion = new Quaternion()\n .fromMatrix3(new Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]]))\n .normalize();\n }\n\n return {\n mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],\n obb: {\n center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],\n halfSize,\n quaternion\n }\n };\n}\n\n/**\n * Generates bounding volumes from geometry positions\n * @param cartesianPositions\n * @param geoidHeightModel\n */\nexport function createBoundingVolumesFromGeometry(\n cartesianPositions: Float32Array,\n geoidHeightModel: Geoid\n): {mbs: Mbs; obb: Obb} {\n const positionVectors = convertPositionsToVectors(cartesianPositions);\n\n const geometryObb = makeOrientedBoundingBoxFromPoints(positionVectors);\n const geometryMbs = makeBoundingSphereFromPoints(positionVectors);\n\n let mbsCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new Vector3());\n let obbCenter = Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new Vector3());\n\n mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);\n obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);\n\n return {\n mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],\n obb: {\n center: obbCenter,\n halfSize: geometryObb.halfSize,\n quaternion: geometryObb.quaternion\n }\n };\n}\n\n/**\n * Create array of posisitons where each vertex is vector\n * @param {array} positions\n * @returns {Vector3[]}\n */\nexport function convertPositionsToVectors(positions: Float32Array): Vector3[] {\n const result: Vector3[] = [];\n\n for (let i = 0; i < positions.length; i += 3) {\n // TODO: (perf) new Vector3 is not optimal but required in `makeOrientedBoundingBoxFromPoints`.\n // modify `makeOrientedBoundingBoxFromPoints` to use scratch vectors\n const positionVector = new Vector3([positions[i], positions[i + 1], positions[i + 2]]);\n result.push(positionVector);\n }\n\n return result;\n}\n\n/**\n * Convert common coordinate to extent coordinate\n * @param tileset\n * @returns - Extent\n * @todo why lodMetricValue is radius? need to check this function\n */\nexport function convertCommonToI3SExtentCoordinate(tileset: Tileset3D | null): Extent | null {\n const cartesianCenter = tileset?.cartesianCenter;\n if (!cartesianCenter) {\n return null;\n }\n const radius = tileset?.lodMetricValue;\n const rightTop = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(cartesianCenter[0] + radius, cartesianCenter[1] + radius, cartesianCenter[2]),\n new Vector3()\n );\n const leftBottom = Ellipsoid.WGS84.cartesianToCartographic(\n new Vector3(cartesianCenter[0] - radius, cartesianCenter[1] - radius, cartesianCenter[2]),\n new Vector3()\n );\n const isFirstRight = rightTop[0] < leftBottom[0];\n const isFirstTop = rightTop[1] < leftBottom[1];\n\n return [\n isFirstRight ? rightTop[0] : leftBottom[0],\n isFirstTop ? rightTop[1] : leftBottom[1],\n isFirstRight ? leftBottom[0] : rightTop[0],\n isFirstTop ? leftBottom[1] : rightTop[1]\n ];\n}\n\n/**\n * Creates oriented boundinb box from mbs.\n * @param mbs - Minimum Bounding Sphere\n * @returns - Oriented BOunding Box\n */\nexport function createObbFromMbs(mbs: Mbs): Obb {\n const radius = mbs[3];\n const center = new Vector3(mbs[0], mbs[1], mbs[2]);\n const halfAxex = new Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);\n return new OrientedBoundingBox(center, halfAxex);\n}\n"],"file":"coordinate-converter.js"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createSceneServerPath = createSceneServerPath;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _uuid = require("uuid");
|
|
15
|
-
|
|
16
|
-
var _jsonMapTransform = _interopRequireDefault(require("json-map-transform"));
|
|
17
|
-
|
|
18
|
-
var _path = require("path");
|
|
19
|
-
|
|
20
|
-
var _sceneServer = require("../json-templates/scene-server");
|
|
21
|
-
|
|
22
|
-
var _fileUtils = require("../../lib/utils/file-utils");
|
|
23
|
-
|
|
24
|
-
function createSceneServerPath(_x, _x2, _x3) {
|
|
25
|
-
return _createSceneServerPath.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _createSceneServerPath() {
|
|
29
|
-
_createSceneServerPath = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(layerName, layers0, rootPath) {
|
|
30
|
-
var sceneServerData, sceneServer, nodePagePath;
|
|
31
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
32
|
-
while (1) {
|
|
33
|
-
switch (_context.prev = _context.next) {
|
|
34
|
-
case 0:
|
|
35
|
-
sceneServerData = {
|
|
36
|
-
serviceItemId: (0, _uuid.v4)().replace(/-/gi, ''),
|
|
37
|
-
layerName: layerName,
|
|
38
|
-
layers0: layers0
|
|
39
|
-
};
|
|
40
|
-
sceneServer = (0, _jsonMapTransform.default)(sceneServerData, (0, _sceneServer.SCENE_SERVER)());
|
|
41
|
-
nodePagePath = (0, _path.join)(rootPath, 'SceneServer');
|
|
42
|
-
_context.next = 5;
|
|
43
|
-
return (0, _fileUtils.writeFile)(nodePagePath, JSON.stringify(sceneServer));
|
|
44
|
-
|
|
45
|
-
case 5:
|
|
46
|
-
case "end":
|
|
47
|
-
return _context.stop();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}, _callee);
|
|
51
|
-
}));
|
|
52
|
-
return _createSceneServerPath.apply(this, arguments);
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=create-scene-server-path.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/i3s-converter/helpers/create-scene-server-path.ts"],"names":["createSceneServerPath","layerName","layers0","rootPath","sceneServerData","serviceItemId","replace","sceneServer","nodePagePath","JSON","stringify"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;SASsBA,qB;;;;;qFAAf,iBAAqCC,SAArC,EAAgDC,OAAhD,EAAyDC,QAAzD;AAAA;AAAA;AAAA;AAAA;AAAA;AACCC,YAAAA,eADD,GACmB;AACtBC,cAAAA,aAAa,EAAE,gBAASC,OAAT,CAAiB,KAAjB,EAAwB,EAAxB,CADO;AAEtBL,cAAAA,SAAS,EAATA,SAFsB;AAGtBC,cAAAA,OAAO,EAAPA;AAHsB,aADnB;AAOCK,YAAAA,WAPD,GAOe,+BAAUH,eAAV,EAA2B,gCAA3B,CAPf;AAQCI,YAAAA,YARD,GAQgB,gBAAKL,QAAL,EAAe,aAAf,CARhB;AAAA;AAAA,mBASC,0BAAUK,YAAV,EAAwBC,IAAI,CAACC,SAAL,CAAeH,WAAf,CAAxB,CATD;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["import {v4 as uuidv4} from 'uuid';\nimport transform from 'json-map-transform';\nimport {join} from 'path';\n\nimport {SCENE_SERVER as sceneServerTemplate} from '../json-templates/scene-server';\nimport {writeFile} from '../../lib/utils/file-utils';\n\n/**\n * Form and save sceneServer meta data into a file\n * @param {string} layerName - layer name to display\n * @param {object} layers0 - layer object embedded into sceneServer meta data\n * @param {string} rootPath - root path of new converted tileset\n * @return {promise}\n */\nexport async function createSceneServerPath(layerName, layers0, rootPath) {\n const sceneServerData = {\n serviceItemId: uuidv4().replace(/-/gi, ''),\n layerName,\n layers0\n };\n\n const sceneServer = transform(sceneServerData, sceneServerTemplate());\n const nodePagePath = join(rootPath, 'SceneServer');\n await writeFile(nodePagePath, JSON.stringify(sceneServer));\n}\n"],"file":"create-scene-server-path.js"}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.generateAttributes = generateAttributes;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _loaderUtils = require("@loaders.gl/loader-utils");
|
|
13
|
-
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
18
|
-
var VALUES_PER_VERTEX = 3;
|
|
19
|
-
var POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
|
|
20
|
-
|
|
21
|
-
function generateAttributes(attributes) {
|
|
22
|
-
var positions = attributes.positions,
|
|
23
|
-
normals = attributes.normals,
|
|
24
|
-
texCoords = attributes.texCoords,
|
|
25
|
-
colors = attributes.colors,
|
|
26
|
-
featureIndices = attributes.featureIndices,
|
|
27
|
-
triangleCount = attributes.triangleCount;
|
|
28
|
-
|
|
29
|
-
if (!featureIndices.length) {
|
|
30
|
-
return {
|
|
31
|
-
faceRange: new Uint32Array([0, triangleCount - 1]),
|
|
32
|
-
featureIds: [0],
|
|
33
|
-
featureCount: 1,
|
|
34
|
-
positions: positions,
|
|
35
|
-
normals: normals,
|
|
36
|
-
texCoords: texCoords,
|
|
37
|
-
colors: colors
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
var _calculateFaceRangesA = calculateFaceRangesAndFeaturesCount(featureIndices),
|
|
42
|
-
faceRange = _calculateFaceRangesA.faceRange,
|
|
43
|
-
featureCount = _calculateFaceRangesA.featureCount,
|
|
44
|
-
featureIds = _calculateFaceRangesA.featureIds;
|
|
45
|
-
|
|
46
|
-
var attributeObjects = makeAttributeObjects(_objectSpread({
|
|
47
|
-
faceRange: faceRange,
|
|
48
|
-
featureIds: featureIds
|
|
49
|
-
}, attributes));
|
|
50
|
-
var unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);
|
|
51
|
-
var groupedAttributes = groupAttributesAndRangesByFeatureId(unifiedAttributeObjectsByFeatureIds);
|
|
52
|
-
return _objectSpread({
|
|
53
|
-
featureCount: featureCount
|
|
54
|
-
}, groupedAttributes);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function calculateFaceRangesAndFeaturesCount(featureIndices) {
|
|
58
|
-
var rangeIndex = 1;
|
|
59
|
-
var featureIndex = 1;
|
|
60
|
-
var currentFeatureId = featureIndices[0];
|
|
61
|
-
var faceRangeList = [];
|
|
62
|
-
var featureIds = [];
|
|
63
|
-
var uniqueFeatureIds = [currentFeatureId];
|
|
64
|
-
faceRangeList[0] = 0;
|
|
65
|
-
featureIds[0] = currentFeatureId;
|
|
66
|
-
|
|
67
|
-
for (var index = 1; index < featureIndices.length; index++) {
|
|
68
|
-
if (currentFeatureId !== featureIndices[index]) {
|
|
69
|
-
faceRangeList[rangeIndex] = index / VALUES_PER_VERTEX - 1;
|
|
70
|
-
faceRangeList[rangeIndex + 1] = index / VALUES_PER_VERTEX;
|
|
71
|
-
featureIds[featureIndex] = featureIndices[index];
|
|
72
|
-
|
|
73
|
-
if (!uniqueFeatureIds.includes(featureIndices[index])) {
|
|
74
|
-
uniqueFeatureIds.push(featureIndices[index]);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
rangeIndex += 2;
|
|
78
|
-
featureIndex += 1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
currentFeatureId = featureIndices[index];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
faceRangeList[rangeIndex] = featureIndices.length / VALUES_PER_VERTEX - 1;
|
|
85
|
-
var faceRange = new Uint32Array(faceRangeList);
|
|
86
|
-
var featureCount = uniqueFeatureIds.length;
|
|
87
|
-
return {
|
|
88
|
-
faceRange: faceRange,
|
|
89
|
-
featureCount: featureCount,
|
|
90
|
-
featureIds: featureIds
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function makeAttributeObjects(attributes) {
|
|
95
|
-
var featureIds = attributes.featureIds,
|
|
96
|
-
positions = attributes.positions,
|
|
97
|
-
normals = attributes.normals,
|
|
98
|
-
colors = attributes.colors,
|
|
99
|
-
texCoords = attributes.texCoords,
|
|
100
|
-
faceRange = attributes.faceRange;
|
|
101
|
-
var groupedData = [];
|
|
102
|
-
var positionsList = new Float32Array(positions);
|
|
103
|
-
var normalsList = new Float32Array(normals);
|
|
104
|
-
var colorsList = new Uint8Array(colors);
|
|
105
|
-
var texCoordsList = new Float32Array(texCoords);
|
|
106
|
-
var faceRangeIndex = 0;
|
|
107
|
-
|
|
108
|
-
for (var index = 0; index < featureIds.length; index++) {
|
|
109
|
-
var startIndex = faceRange[index + faceRangeIndex];
|
|
110
|
-
var endIndex = faceRange[index + faceRangeIndex + 1];
|
|
111
|
-
var positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);
|
|
112
|
-
var normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);
|
|
113
|
-
var colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);
|
|
114
|
-
var texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);
|
|
115
|
-
groupedData.push({
|
|
116
|
-
featureId: featureIds[index],
|
|
117
|
-
positions: positionsList.slice(0, positionsCount),
|
|
118
|
-
normals: normalsList.slice(0, normalsCount),
|
|
119
|
-
colors: colorsList.slice(0, colorsCount),
|
|
120
|
-
texCoords: texCoordsList.slice(0, texCoordsCount)
|
|
121
|
-
});
|
|
122
|
-
positionsList = positionsList.slice(positionsCount);
|
|
123
|
-
normalsList = normalsList.slice(normalsCount);
|
|
124
|
-
colorsList = colorsList.slice(colorsCount);
|
|
125
|
-
texCoordsList = texCoordsList.slice(texCoordsCount);
|
|
126
|
-
faceRangeIndex += 1;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return groupedData.sort(function (first, second) {
|
|
130
|
-
return first.featureId - second.featureId;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function getSliceAttributeCount(attributeName, startIndex, endIndex) {
|
|
135
|
-
var colorsPerVertex = 4;
|
|
136
|
-
var texCoordsPerVertex = 2;
|
|
137
|
-
var trianglesCount = endIndex - startIndex + 1;
|
|
138
|
-
var vertexCount = trianglesCount * 3;
|
|
139
|
-
|
|
140
|
-
switch (attributeName) {
|
|
141
|
-
case 'positions':
|
|
142
|
-
case 'normals':
|
|
143
|
-
return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;
|
|
144
|
-
|
|
145
|
-
case 'colors':
|
|
146
|
-
return vertexCount * colorsPerVertex;
|
|
147
|
-
|
|
148
|
-
case 'texCoords':
|
|
149
|
-
return vertexCount * texCoordsPerVertex;
|
|
150
|
-
|
|
151
|
-
default:
|
|
152
|
-
return 0;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function unifyObjectsByFeatureId(sortedData) {
|
|
157
|
-
var uniqueObjects = [];
|
|
158
|
-
|
|
159
|
-
var _loop = function _loop(index) {
|
|
160
|
-
var currentObject = sortedData[index];
|
|
161
|
-
var existedObject = uniqueObjects.find(function (obj) {
|
|
162
|
-
return obj.featureId === currentObject.featureId;
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
if (existedObject) {
|
|
166
|
-
existedObject.positions = (0, _loaderUtils.concatenateTypedArrays)(existedObject.positions, currentObject.positions);
|
|
167
|
-
existedObject.normals = (0, _loaderUtils.concatenateTypedArrays)(existedObject.normals, currentObject.normals);
|
|
168
|
-
existedObject.colors = (0, _loaderUtils.concatenateTypedArrays)(existedObject.colors, currentObject.colors);
|
|
169
|
-
existedObject.texCoords = (0, _loaderUtils.concatenateTypedArrays)(existedObject.texCoords, currentObject.texCoords);
|
|
170
|
-
} else {
|
|
171
|
-
uniqueObjects.push(currentObject);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
for (var index = 0; index < sortedData.length; index++) {
|
|
176
|
-
_loop(index);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return uniqueObjects;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function groupAttributesAndRangesByFeatureId(unifiedObjects) {
|
|
183
|
-
var firstAttributeObject = unifiedObjects[0];
|
|
184
|
-
var featureIds = [firstAttributeObject.featureId];
|
|
185
|
-
var positions = new Float32Array(firstAttributeObject.positions);
|
|
186
|
-
var normals = new Float32Array(firstAttributeObject.normals);
|
|
187
|
-
var colors = new Uint8Array(firstAttributeObject.colors);
|
|
188
|
-
var texCoords = new Float32Array(firstAttributeObject.texCoords);
|
|
189
|
-
var range = [0];
|
|
190
|
-
var objIndex = 0;
|
|
191
|
-
var sum = 0;
|
|
192
|
-
|
|
193
|
-
for (var index = 1; index < unifiedObjects.length; index++) {
|
|
194
|
-
var currentAttributesObject = unifiedObjects[index];
|
|
195
|
-
featureIds.push(currentAttributesObject.featureId);
|
|
196
|
-
positions = (0, _loaderUtils.concatenateTypedArrays)(positions, currentAttributesObject.positions);
|
|
197
|
-
normals = (0, _loaderUtils.concatenateTypedArrays)(normals, currentAttributesObject.normals);
|
|
198
|
-
colors = (0, _loaderUtils.concatenateTypedArrays)(colors, currentAttributesObject.colors);
|
|
199
|
-
texCoords = (0, _loaderUtils.concatenateTypedArrays)(texCoords, currentAttributesObject.texCoords);
|
|
200
|
-
var groupedObject = unifiedObjects[objIndex];
|
|
201
|
-
range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);
|
|
202
|
-
range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);
|
|
203
|
-
sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
|
|
204
|
-
objIndex += 1;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
|
|
208
|
-
var faceRange = new Uint32Array(range);
|
|
209
|
-
return {
|
|
210
|
-
faceRange: faceRange,
|
|
211
|
-
featureIds: featureIds,
|
|
212
|
-
positions: positions,
|
|
213
|
-
normals: normals,
|
|
214
|
-
colors: colors,
|
|
215
|
-
texCoords: texCoords
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
//# sourceMappingURL=geometry-attributes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/i3s-converter/helpers/geometry-attributes.ts"],"names":["VALUES_PER_VERTEX","POSITIONS_AND_NORMALS_PER_TRIANGLE","generateAttributes","attributes","positions","normals","texCoords","colors","featureIndices","triangleCount","length","faceRange","Uint32Array","featureIds","featureCount","calculateFaceRangesAndFeaturesCount","attributeObjects","makeAttributeObjects","unifiedAttributeObjectsByFeatureIds","unifyObjectsByFeatureId","groupedAttributes","groupAttributesAndRangesByFeatureId","rangeIndex","featureIndex","currentFeatureId","faceRangeList","uniqueFeatureIds","index","includes","push","groupedData","positionsList","Float32Array","normalsList","colorsList","Uint8Array","texCoordsList","faceRangeIndex","startIndex","endIndex","positionsCount","getSliceAttributeCount","normalsCount","colorsCount","texCoordsCount","featureId","slice","sort","first","second","attributeName","colorsPerVertex","texCoordsPerVertex","trianglesCount","vertexCount","sortedData","uniqueObjects","currentObject","existedObject","find","obj","unifiedObjects","firstAttributeObject","range","objIndex","sum","currentAttributesObject","groupedObject"],"mappings":";;;;;;;;;;;AAAA;;;;;;AAEA,IAAMA,iBAAiB,GAAG,CAA1B;AACA,IAAMC,kCAAkC,GAAG,CAA3C;;AAOO,SAASC,kBAAT,CAA4BC,UAA5B,EAAwC;AAC7C,MAAOC,SAAP,GAA+ED,UAA/E,CAAOC,SAAP;AAAA,MAAkBC,OAAlB,GAA+EF,UAA/E,CAAkBE,OAAlB;AAAA,MAA2BC,SAA3B,GAA+EH,UAA/E,CAA2BG,SAA3B;AAAA,MAAsCC,MAAtC,GAA+EJ,UAA/E,CAAsCI,MAAtC;AAAA,MAA8CC,cAA9C,GAA+EL,UAA/E,CAA8CK,cAA9C;AAAA,MAA8DC,aAA9D,GAA+EN,UAA/E,CAA8DM,aAA9D;;AAEA,MAAI,CAACD,cAAc,CAACE,MAApB,EAA4B;AAC1B,WAAO;AACLC,MAAAA,SAAS,EAAE,IAAIC,WAAJ,CAAgB,CAAC,CAAD,EAAIH,aAAa,GAAG,CAApB,CAAhB,CADN;AAELI,MAAAA,UAAU,EAAE,CAAC,CAAD,CAFP;AAGLC,MAAAA,YAAY,EAAE,CAHT;AAILV,MAAAA,SAAS,EAATA,SAJK;AAKLC,MAAAA,OAAO,EAAPA,OALK;AAMLC,MAAAA,SAAS,EAATA,SANK;AAOLC,MAAAA,MAA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CC,IAAAA,OAAO,EAAPA,OAAnC;AAA4CE,IAAAA,MAAM,EAANA,MAA5C;AAAoDD,IAAAA,SAAS,EAATA;AAApD,GAAP;AACD","sourcesContent":["import {concatenateTypedArrays} from '@loaders.gl/loader-utils';\n\nconst VALUES_PER_VERTEX = 3;\nconst POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;\n\n/**\n * Generate geometry attributes with faceRange and featureCount\n * @param {Object} attributes\n * @returns {Object} Object with featureCount, reordered attributes and changed faceRange.\n */\nexport function generateAttributes(attributes) {\n const {positions, normals, texCoords, colors, featureIndices, triangleCount} = attributes;\n\n if (!featureIndices.length) {\n return {\n faceRange: new Uint32Array([0, triangleCount - 1]),\n featureIds: [0],\n featureCount: 1,\n positions,\n normals,\n texCoords,\n colors\n };\n }\n\n const {faceRange, featureCount, featureIds} = calculateFaceRangesAndFeaturesCount(featureIndices);\n const attributeObjects = makeAttributeObjects({faceRange, featureIds, ...attributes});\n const unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);\n const groupedAttributes = groupAttributesAndRangesByFeatureId(\n unifiedAttributeObjectsByFeatureIds\n );\n return {featureCount, ...groupedAttributes};\n}\n\n/**\n * Calculates face Ranges and feature count based on featureIndices.\n * @param {Object} featureIndices\n * @returns {Object} Object with featureCount, reordered attributes and changed faceRange.\n */\nfunction calculateFaceRangesAndFeaturesCount(featureIndices) {\n let rangeIndex = 1;\n let featureIndex = 1;\n let currentFeatureId = featureIndices[0];\n const faceRangeList: any[] = [];\n const featureIds: any[] = [];\n const uniqueFeatureIds = [currentFeatureId];\n\n faceRangeList[0] = 0;\n featureIds[0] = currentFeatureId;\n\n for (let index = 1; index < featureIndices.length; index++) {\n if (currentFeatureId !== featureIndices[index]) {\n faceRangeList[rangeIndex] = index / VALUES_PER_VERTEX - 1;\n faceRangeList[rangeIndex + 1] = index / VALUES_PER_VERTEX;\n featureIds[featureIndex] = featureIndices[index];\n\n if (!uniqueFeatureIds.includes(featureIndices[index])) {\n uniqueFeatureIds.push(featureIndices[index]);\n }\n\n rangeIndex += 2;\n featureIndex += 1;\n }\n currentFeatureId = featureIndices[index];\n }\n\n faceRangeList[rangeIndex] = featureIndices.length / VALUES_PER_VERTEX - 1;\n\n const faceRange = new Uint32Array(faceRangeList);\n const featureCount = uniqueFeatureIds.length;\n\n return {faceRange, featureCount, featureIds};\n}\n\n/**\n * Generate list of attribute object grouped by feature ids.\n * @param {Object} attributes\n * @returns {Array} sorted list of attribute objects.\n */\nfunction makeAttributeObjects(attributes) {\n const {featureIds, positions, normals, colors, texCoords, faceRange} = attributes;\n const groupedData: any[] = [];\n\n let positionsList = new Float32Array(positions);\n let normalsList = new Float32Array(normals);\n let colorsList = new Uint8Array(colors);\n let texCoordsList = new Float32Array(texCoords);\n\n let faceRangeIndex = 0;\n\n for (let index = 0; index < featureIds.length; index++) {\n const startIndex = faceRange[index + faceRangeIndex];\n const endIndex = faceRange[index + faceRangeIndex + 1];\n\n const positionsCount = getSliceAttributeCount('positions', startIndex, endIndex);\n const normalsCount = getSliceAttributeCount('normals', startIndex, endIndex);\n const colorsCount = getSliceAttributeCount('colors', startIndex, endIndex);\n const texCoordsCount = getSliceAttributeCount('texCoords', startIndex, endIndex);\n\n groupedData.push({\n featureId: featureIds[index],\n positions: positionsList.slice(0, positionsCount),\n normals: normalsList.slice(0, normalsCount),\n colors: colorsList.slice(0, colorsCount),\n texCoords: texCoordsList.slice(0, texCoordsCount)\n });\n\n positionsList = positionsList.slice(positionsCount);\n normalsList = normalsList.slice(normalsCount);\n colorsList = colorsList.slice(colorsCount);\n texCoordsList = texCoordsList.slice(texCoordsCount);\n\n faceRangeIndex += 1;\n }\n\n return groupedData.sort((first, second) => first.featureId - second.featureId);\n}\n\n/**\n * Generate sliced count for generating attribute objects depends on attribute name and range.\n * @param {String} attributeName\n * @param {Number} startIndex\n * @param {Number} endIndex\n * @returns {Number} - sliced count\n */\nfunction getSliceAttributeCount(attributeName, startIndex, endIndex) {\n const colorsPerVertex = 4;\n const texCoordsPerVertex = 2;\n\n const trianglesCount = endIndex - startIndex + 1;\n const vertexCount = trianglesCount * 3;\n\n switch (attributeName) {\n case 'positions':\n case 'normals':\n return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;\n case 'colors':\n return vertexCount * colorsPerVertex;\n case 'texCoords':\n return vertexCount * texCoordsPerVertex;\n default:\n return 0;\n }\n}\n\n/**\n * Generates unique object list depends on feature ids and concantenate their attributes.\n * @param {Array} sortedData\n * @returns {Array} - unique list of objects\n */\nfunction unifyObjectsByFeatureId(sortedData) {\n const uniqueObjects: any[] = [];\n\n for (let index = 0; index < sortedData.length; index++) {\n const currentObject = sortedData[index];\n const existedObject = uniqueObjects.find((obj) => obj.featureId === currentObject.featureId);\n\n if (existedObject) {\n existedObject.positions = concatenateTypedArrays(\n existedObject.positions,\n currentObject.positions\n );\n existedObject.normals = concatenateTypedArrays(existedObject.normals, currentObject.normals);\n existedObject.colors = concatenateTypedArrays(existedObject.colors, currentObject.colors);\n existedObject.texCoords = concatenateTypedArrays(\n existedObject.texCoords,\n currentObject.texCoords\n );\n } else {\n uniqueObjects.push(currentObject);\n }\n }\n\n return uniqueObjects;\n}\n\n/**\n * Generates attribute objects with new faceRange and reordered attributes.\n * @param {Array} unifiedObjects\n * @returns {Object} - ugenerated attributes with new faceRange.\n */\nfunction groupAttributesAndRangesByFeatureId(unifiedObjects) {\n const firstAttributeObject = unifiedObjects[0];\n const featureIds = [firstAttributeObject.featureId];\n\n let positions = new Float32Array(firstAttributeObject.positions);\n let normals = new Float32Array(firstAttributeObject.normals);\n let colors = new Uint8Array(firstAttributeObject.colors);\n let texCoords = new Float32Array(firstAttributeObject.texCoords);\n const range = [0];\n\n let objIndex = 0;\n let sum = 0;\n\n for (let index = 1; index < unifiedObjects.length; index++) {\n const currentAttributesObject = unifiedObjects[index];\n featureIds.push(currentAttributesObject.featureId);\n\n positions = concatenateTypedArrays(positions, currentAttributesObject.positions);\n normals = concatenateTypedArrays(normals, currentAttributesObject.normals);\n colors = concatenateTypedArrays(colors, currentAttributesObject.colors);\n texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);\n\n const groupedObject = unifiedObjects[objIndex];\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);\n range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);\n\n sum += groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;\n objIndex += 1;\n }\n\n range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);\n\n const faceRange = new Uint32Array(range);\n return {faceRange, featureIds, positions, normals, colors, texCoords};\n}\n"],"file":"geometry-attributes.js"}
|