@loaders.gl/tile-converter 3.4.13 → 3.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-attributes-worker.js +1 -1
- package/dist/converter.min.js +78 -77
- package/dist/dist.min.js +2081 -1557
- package/dist/es5/3d-tiles-attributes-worker.js +3 -3
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +203 -417
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +197 -266
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +4 -6
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +12 -12
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +35 -51
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/constants.js +1 -1
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/converter-cli.js +78 -133
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +38 -110
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +3 -3
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +31 -36
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +23 -23
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +9 -27
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +27 -42
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +97 -114
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +524 -799
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +24 -25
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +27 -25
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-index-document.js +165 -461
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +169 -474
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +663 -1401
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +82 -92
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js +130 -152
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js +21 -23
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js +78 -89
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js +27 -31
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +110 -152
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js +2 -4
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-server/app.js +6 -6
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +20 -49
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +14 -33
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js +2 -2
- package/dist/es5/lib/utils/compress-util.js +127 -295
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +65 -174
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +9 -9
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +13 -38
- package/dist/es5/lib/utils/queue.js.map +1 -1
- package/dist/es5/lib/utils/statistic-utills.js +39 -117
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +74 -195
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +3 -22
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +5 -22
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/workers/i3s-attributes-worker.js +4 -25
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-attributes-worker.js +2 -2
- package/dist/i3s-attributes-worker.js.map +3 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +1 -1
- package/src/i3s-converter/helpers/geometry-converter.ts +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":["STORE","id","path","transform","val","toUpperCase","profile","default","version","resourcePattern","rootNode","extent","indexCRS","vertexCRS","normalReferenceFrame","attributeEncoding","textureEncoding","lodType","lodModel","defaultGeometrySchema","geometryType","header","property","type","topology","ordering","vertexAttributes","position","valueType","valuesPerElement","normal","uv0","color","featureAttributeOrder","featureAttributes","faceRange","exports"],"sources":["../../../../src/i3s-converter/json-templates/store.ts"],"sourcesContent":["export const STORE = {\n id: {\n path: 'id',\n transform: (val) => val.toUpperCase()\n },\n profile: {\n path: 'profile',\n default: 'meshpyramids'\n },\n version: {\n path: 'version',\n default: '1.8'\n },\n resourcePattern: {\n path: 'resourcePattern',\n default: ['3dNodeIndexDocument', 'Attributes', 'SharedResource', 'Geometry']\n },\n rootNode: {\n path: 'rootNode',\n default: './nodes/root'\n },\n extent: {\n path: 'extent'\n },\n indexCRS: {\n path: 'indexCRS',\n default: 'http://www.opengis.net/def/crs/EPSG/0/4326'\n },\n vertexCRS: {\n path: 'vertexCRS',\n default: 'http://www.opengis.net/def/crs/EPSG/0/4326'\n },\n normalReferenceFrame: {\n path: 'normalReferenceFrame',\n default: 'east-north-up'\n },\n attributeEncoding: {\n path: 'attributeEncoding',\n default: 'application/octet-stream; version=1.6'\n },\n textureEncoding: {\n path: 'textureEncoding',\n default: ['image/jpeg', 'image/ktx2']\n },\n lodType: {\n path: 'lodType',\n default: 'MeshPyramid'\n },\n lodModel: {\n path: 'lodModel',\n default: 'node-switching'\n },\n defaultGeometrySchema: {\n path: 'defaultGeometrySchema',\n default: {\n geometryType: 'triangles',\n header: [\n {\n property: 'vertexCount',\n type: 'UInt32'\n },\n {\n property: 'featureCount',\n type: 'UInt32'\n }\n ],\n topology: 'PerAttributeArray',\n ordering: ['position', 'normal', 'uv0', 'color'],\n vertexAttributes: {\n position: {\n valueType: 'Float32',\n valuesPerElement: 3\n },\n normal: {\n valueType: 'Float32',\n valuesPerElement: 3\n },\n uv0: {\n valueType: 'Float32',\n valuesPerElement: 2\n },\n color: {\n valueType: 'UInt8',\n valuesPerElement: 4\n }\n },\n featureAttributeOrder: ['id', 'faceRange'],\n featureAttributes: {\n id: {\n valueType: 'UInt64',\n valuesPerElement: 1\n },\n faceRange: {\n valueType: 'UInt32',\n valuesPerElement: 2\n }\n }\n }\n }\n};\n"],"mappings":";;;;;;AAAO,
|
|
1
|
+
{"version":3,"file":"store.js","names":["STORE","id","path","transform","val","toUpperCase","profile","default","version","resourcePattern","rootNode","extent","indexCRS","vertexCRS","normalReferenceFrame","attributeEncoding","textureEncoding","lodType","lodModel","defaultGeometrySchema","geometryType","header","property","type","topology","ordering","vertexAttributes","position","valueType","valuesPerElement","normal","uv0","color","featureAttributeOrder","featureAttributes","faceRange","exports"],"sources":["../../../../src/i3s-converter/json-templates/store.ts"],"sourcesContent":["export const STORE = {\n id: {\n path: 'id',\n transform: (val) => val.toUpperCase()\n },\n profile: {\n path: 'profile',\n default: 'meshpyramids'\n },\n version: {\n path: 'version',\n default: '1.8'\n },\n resourcePattern: {\n path: 'resourcePattern',\n default: ['3dNodeIndexDocument', 'Attributes', 'SharedResource', 'Geometry']\n },\n rootNode: {\n path: 'rootNode',\n default: './nodes/root'\n },\n extent: {\n path: 'extent'\n },\n indexCRS: {\n path: 'indexCRS',\n default: 'http://www.opengis.net/def/crs/EPSG/0/4326'\n },\n vertexCRS: {\n path: 'vertexCRS',\n default: 'http://www.opengis.net/def/crs/EPSG/0/4326'\n },\n normalReferenceFrame: {\n path: 'normalReferenceFrame',\n default: 'east-north-up'\n },\n attributeEncoding: {\n path: 'attributeEncoding',\n default: 'application/octet-stream; version=1.6'\n },\n textureEncoding: {\n path: 'textureEncoding',\n default: ['image/jpeg', 'image/ktx2']\n },\n lodType: {\n path: 'lodType',\n default: 'MeshPyramid'\n },\n lodModel: {\n path: 'lodModel',\n default: 'node-switching'\n },\n defaultGeometrySchema: {\n path: 'defaultGeometrySchema',\n default: {\n geometryType: 'triangles',\n header: [\n {\n property: 'vertexCount',\n type: 'UInt32'\n },\n {\n property: 'featureCount',\n type: 'UInt32'\n }\n ],\n topology: 'PerAttributeArray',\n ordering: ['position', 'normal', 'uv0', 'color'],\n vertexAttributes: {\n position: {\n valueType: 'Float32',\n valuesPerElement: 3\n },\n normal: {\n valueType: 'Float32',\n valuesPerElement: 3\n },\n uv0: {\n valueType: 'Float32',\n valuesPerElement: 2\n },\n color: {\n valueType: 'UInt8',\n valuesPerElement: 4\n }\n },\n featureAttributeOrder: ['id', 'faceRange'],\n featureAttributes: {\n id: {\n valueType: 'UInt64',\n valuesPerElement: 1\n },\n faceRange: {\n valueType: 'UInt32',\n valuesPerElement: 2\n }\n }\n }\n }\n};\n"],"mappings":";;;;;;AAAO,MAAMA,KAAK,GAAG;EACnBC,EAAE,EAAE;IACFC,IAAI,EAAE,IAAI;IACVC,SAAS,EAAGC,GAAG,IAAKA,GAAG,CAACC,WAAW,CAAC;EACtC,CAAC;EACDC,OAAO,EAAE;IACPJ,IAAI,EAAE,SAAS;IACfK,OAAO,EAAE;EACX,CAAC;EACDC,OAAO,EAAE;IACPN,IAAI,EAAE,SAAS;IACfK,OAAO,EAAE;EACX,CAAC;EACDE,eAAe,EAAE;IACfP,IAAI,EAAE,iBAAiB;IACvBK,OAAO,EAAE,CAAC,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU;EAC7E,CAAC;EACDG,QAAQ,EAAE;IACRR,IAAI,EAAE,UAAU;IAChBK,OAAO,EAAE;EACX,CAAC;EACDI,MAAM,EAAE;IACNT,IAAI,EAAE;EACR,CAAC;EACDU,QAAQ,EAAE;IACRV,IAAI,EAAE,UAAU;IAChBK,OAAO,EAAE;EACX,CAAC;EACDM,SAAS,EAAE;IACTX,IAAI,EAAE,WAAW;IACjBK,OAAO,EAAE;EACX,CAAC;EACDO,oBAAoB,EAAE;IACpBZ,IAAI,EAAE,sBAAsB;IAC5BK,OAAO,EAAE;EACX,CAAC;EACDQ,iBAAiB,EAAE;IACjBb,IAAI,EAAE,mBAAmB;IACzBK,OAAO,EAAE;EACX,CAAC;EACDS,eAAe,EAAE;IACfd,IAAI,EAAE,iBAAiB;IACvBK,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY;EACtC,CAAC;EACDU,OAAO,EAAE;IACPf,IAAI,EAAE,SAAS;IACfK,OAAO,EAAE;EACX,CAAC;EACDW,QAAQ,EAAE;IACRhB,IAAI,EAAE,UAAU;IAChBK,OAAO,EAAE;EACX,CAAC;EACDY,qBAAqB,EAAE;IACrBjB,IAAI,EAAE,uBAAuB;IAC7BK,OAAO,EAAE;MACPa,YAAY,EAAE,WAAW;MACzBC,MAAM,EAAE,CACN;QACEC,QAAQ,EAAE,aAAa;QACvBC,IAAI,EAAE;MACR,CAAC,EACD;QACED,QAAQ,EAAE,cAAc;QACxBC,IAAI,EAAE;MACR,CAAC,CACF;MACDC,QAAQ,EAAE,mBAAmB;MAC7BC,QAAQ,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC;MAChDC,gBAAgB,EAAE;QAChBC,QAAQ,EAAE;UACRC,SAAS,EAAE,SAAS;UACpBC,gBAAgB,EAAE;QACpB,CAAC;QACDC,MAAM,EAAE;UACNF,SAAS,EAAE,SAAS;UACpBC,gBAAgB,EAAE;QACpB,CAAC;QACDE,GAAG,EAAE;UACHH,SAAS,EAAE,SAAS;UACpBC,gBAAgB,EAAE;QACpB,CAAC;QACDG,KAAK,EAAE;UACLJ,SAAS,EAAE,OAAO;UAClBC,gBAAgB,EAAE;QACpB;MACF,CAAC;MACDI,qBAAqB,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC;MAC1CC,iBAAiB,EAAE;QACjBjC,EAAE,EAAE;UACF2B,SAAS,EAAE,QAAQ;UACnBC,gBAAgB,EAAE;QACpB,CAAC;QACDM,SAAS,EAAE;UACTP,SAAS,EAAE,QAAQ;UACnBC,gBAAgB,EAAE;QACpB;MACF;IACF;EACF;AACF,CAAC;AAACO,OAAA,CAAApC,KAAA,GAAAA,KAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const express = require('express');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const logger = require('morgan');
|
|
6
|
+
const cors = require('cors');
|
|
7
|
+
const indexRouter = require('./routes/index');
|
|
8
|
+
const app = express();
|
|
9
9
|
app.use(logger('dev'));
|
|
10
10
|
app.use(express.json());
|
|
11
11
|
app.use(express.urlencoded({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","names":["express","require","path","logger","cors","indexRouter","app","use","json","urlencoded","extended","static","join","__dirname","module","exports"],"sources":["../../../src/i3s-server/app.js"],"sourcesContent":["const express = require('express');\nconst path = require('path');\nconst logger = require('morgan');\nconst cors = require('cors');\n\nconst indexRouter = require('./routes/index');\n\nconst app = express();\n\napp.use(logger('dev'));\napp.use(express.json());\napp.use(express.urlencoded({extended: false}));\napp.use(express.static(path.join(__dirname, 'public')));\napp.use(cors());\n\napp.use('/', indexRouter);\n\nmodule.exports = app;\n"],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"app.js","names":["express","require","path","logger","cors","indexRouter","app","use","json","urlencoded","extended","static","join","__dirname","module","exports"],"sources":["../../../src/i3s-server/app.js"],"sourcesContent":["const express = require('express');\nconst path = require('path');\nconst logger = require('morgan');\nconst cors = require('cors');\n\nconst indexRouter = require('./routes/index');\n\nconst app = express();\n\napp.use(logger('dev'));\napp.use(express.json());\napp.use(express.urlencoded({extended: false}));\napp.use(express.static(path.join(__dirname, 'public')));\napp.use(cors());\n\napp.use('/', indexRouter);\n\nmodule.exports = app;\n"],"mappings":";;AAAA,MAAMA,OAAO,GAAGC,OAAO,CAAC,SAAS,CAAC;AAClC,MAAMC,IAAI,GAAGD,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAME,MAAM,GAAGF,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAMG,IAAI,GAAGH,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAMI,WAAW,GAAGJ,OAAO,CAAC,gBAAgB,CAAC;AAE7C,MAAMK,GAAG,GAAGN,OAAO,CAAC,CAAC;AAErBM,GAAG,CAACC,GAAG,CAACJ,MAAM,CAAC,KAAK,CAAC,CAAC;AACtBG,GAAG,CAACC,GAAG,CAACP,OAAO,CAACQ,IAAI,CAAC,CAAC,CAAC;AACvBF,GAAG,CAACC,GAAG,CAACP,OAAO,CAACS,UAAU,CAAC;EAACC,QAAQ,EAAE;AAAK,CAAC,CAAC,CAAC;AAC9CJ,GAAG,CAACC,GAAG,CAACP,OAAO,CAACW,MAAM,CAACT,IAAI,CAACU,IAAI,CAACC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvDP,GAAG,CAACC,GAAG,CAACH,IAAI,CAAC,CAAC,CAAC;AAEfE,GAAG,CAACC,GAAG,CAAC,GAAG,EAAEF,WAAW,CAAC;AAEzBS,MAAM,CAACC,OAAO,GAAGT,GAAG"}
|
|
@@ -1,55 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
case 2:
|
|
23
|
-
if (!(_i < _extensions.length)) {
|
|
24
|
-
_context.next = 17;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
ext = _extensions[_i];
|
|
28
|
-
fileName = "".concat(FULL_LAYER_PATH).concat(url, "/index.").concat(ext);
|
|
29
|
-
_context.prev = 5;
|
|
30
|
-
_context.next = 8;
|
|
31
|
-
return promises.access(fileName);
|
|
32
|
-
case 8:
|
|
33
|
-
return _context.abrupt("return", fileName);
|
|
34
|
-
case 11:
|
|
35
|
-
_context.prev = 11;
|
|
36
|
-
_context.t0 = _context["catch"](5);
|
|
37
|
-
return _context.abrupt("continue", 14);
|
|
38
|
-
case 14:
|
|
39
|
-
_i++;
|
|
40
|
-
_context.next = 2;
|
|
41
|
-
break;
|
|
42
|
-
case 17:
|
|
43
|
-
return _context.abrupt("return", null);
|
|
44
|
-
case 18:
|
|
45
|
-
case "end":
|
|
46
|
-
return _context.stop();
|
|
47
|
-
}
|
|
48
|
-
}, _callee, null, [[5, 11]]);
|
|
49
|
-
}));
|
|
50
|
-
return _getFileNameByUrl.apply(this, arguments);
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const {
|
|
6
|
+
promises
|
|
7
|
+
} = fs;
|
|
8
|
+
const I3S_LAYER_PATH = process.env.I3sLayerPath || '';
|
|
9
|
+
const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH);
|
|
10
|
+
async function getFileNameByUrl(url) {
|
|
11
|
+
const extensions = ['json', 'bin', 'jpg', 'jpeg', 'png', 'bin.dds', 'ktx2'];
|
|
12
|
+
for (const ext of extensions) {
|
|
13
|
+
const fileName = "".concat(FULL_LAYER_PATH).concat(url, "/index.").concat(ext);
|
|
14
|
+
try {
|
|
15
|
+
await promises.access(fileName);
|
|
16
|
+
return fileName;
|
|
17
|
+
} catch {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
51
22
|
}
|
|
52
23
|
module.exports = {
|
|
53
|
-
getFileNameByUrl
|
|
24
|
+
getFileNameByUrl
|
|
54
25
|
};
|
|
55
26
|
//# sourceMappingURL=index-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-controller.js","names":["path","require","fs","promises","I3S_LAYER_PATH","process","env","I3sLayerPath","FULL_LAYER_PATH","join","cwd","getFileNameByUrl","
|
|
1
|
+
{"version":3,"file":"index-controller.js","names":["path","require","fs","promises","I3S_LAYER_PATH","process","env","I3sLayerPath","FULL_LAYER_PATH","join","cwd","getFileNameByUrl","url","extensions","ext","fileName","concat","access","module","exports"],"sources":["../../../../src/i3s-server/controllers/index-controller.js"],"sourcesContent":["const path = require('path');\nconst fs = require('fs');\n\nconst {promises} = fs;\n\nconst I3S_LAYER_PATH = process.env.I3sLayerPath || ''; // eslint-disable-line no-process-env, no-undef\nconst FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH); // eslint-disable-line no-undef\n\nasync function getFileNameByUrl(url) {\n const extensions = ['json', 'bin', 'jpg', 'jpeg', 'png', 'bin.dds', 'ktx2'];\n for (const ext of extensions) {\n const fileName = `${FULL_LAYER_PATH}${url}/index.${ext}`;\n try {\n await promises.access(fileName);\n return fileName;\n } catch {\n continue; // eslint-disable-line no-continue\n }\n }\n return null;\n}\n\nmodule.exports = {\n getFileNameByUrl\n};\n"],"mappings":";;AAAA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAMC,EAAE,GAAGD,OAAO,CAAC,IAAI,CAAC;AAExB,MAAM;EAACE;AAAQ,CAAC,GAAGD,EAAE;AAErB,MAAME,cAAc,GAAGC,OAAO,CAACC,GAAG,CAACC,YAAY,IAAI,EAAE;AACrD,MAAMC,eAAe,GAAGR,IAAI,CAACS,IAAI,CAACJ,OAAO,CAACK,GAAG,CAAC,CAAC,EAAEN,cAAc,CAAC;AAEhE,eAAeO,gBAAgBA,CAACC,GAAG,EAAE;EACnC,MAAMC,UAAU,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC;EAC3E,KAAK,MAAMC,GAAG,IAAID,UAAU,EAAE;IAC5B,MAAME,QAAQ,MAAAC,MAAA,CAAMR,eAAe,EAAAQ,MAAA,CAAGJ,GAAG,aAAAI,MAAA,CAAUF,GAAG,CAAE;IACxD,IAAI;MACF,MAAMX,QAAQ,CAACc,MAAM,CAACF,QAAQ,CAAC;MAC/B,OAAOA,QAAQ;IACjB,CAAC,CAAC,MAAM;MACN;IACF;EACF;EACA,OAAO,IAAI;AACb;AAEAG,MAAM,CAACC,OAAO,GAAG;EACfR;AACF,CAAC"}
|
|
@@ -1,37 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return getFileNameByUrl(req.path);
|
|
18
|
-
case 2:
|
|
19
|
-
fileName = _context.sent;
|
|
20
|
-
if (fileName) {
|
|
21
|
-
res.sendFile(fileName);
|
|
22
|
-
} else {
|
|
23
|
-
res.status(404);
|
|
24
|
-
res.send('File not found');
|
|
25
|
-
}
|
|
26
|
-
case 4:
|
|
27
|
-
case "end":
|
|
28
|
-
return _context.stop();
|
|
29
|
-
}
|
|
30
|
-
}, _callee);
|
|
31
|
-
}));
|
|
32
|
-
return function (_x, _x2, _x3) {
|
|
33
|
-
return _ref.apply(this, arguments);
|
|
34
|
-
};
|
|
35
|
-
}());
|
|
3
|
+
const express = require('express');
|
|
4
|
+
const router = express.Router();
|
|
5
|
+
const {
|
|
6
|
+
getFileNameByUrl
|
|
7
|
+
} = require('../controllers/index-controller');
|
|
8
|
+
router.get('*', async function (req, res, next) {
|
|
9
|
+
const fileName = await getFileNameByUrl(req.path);
|
|
10
|
+
if (fileName) {
|
|
11
|
+
res.sendFile(fileName);
|
|
12
|
+
} else {
|
|
13
|
+
res.status(404);
|
|
14
|
+
res.send('File not found');
|
|
15
|
+
}
|
|
16
|
+
});
|
|
36
17
|
module.exports = router;
|
|
37
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["express","require","router","Router","
|
|
1
|
+
{"version":3,"file":"index.js","names":["express","require","router","Router","getFileNameByUrl","get","req","res","next","fileName","path","sendFile","status","send","module","exports"],"sources":["../../../../src/i3s-server/routes/index.js"],"sourcesContent":["const express = require('express');\nconst router = express.Router();\nconst {getFileNameByUrl} = require('../controllers/index-controller');\n\n/* GET home page. */\nrouter.get('*', async function (req, res, next) {\n const fileName = await getFileNameByUrl(req.path);\n if (fileName) {\n res.sendFile(fileName);\n } else {\n res.status(404);\n res.send('File not found');\n }\n});\n\nmodule.exports = router;\n"],"mappings":";;AAAA,MAAMA,OAAO,GAAGC,OAAO,CAAC,SAAS,CAAC;AAClC,MAAMC,MAAM,GAAGF,OAAO,CAACG,MAAM,CAAC,CAAC;AAC/B,MAAM;EAACC;AAAgB,CAAC,GAAGH,OAAO,CAAC,iCAAiC,CAAC;AAGrEC,MAAM,CAACG,GAAG,CAAC,GAAG,EAAE,gBAAgBC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAE;EAC9C,MAAMC,QAAQ,GAAG,MAAML,gBAAgB,CAACE,GAAG,CAACI,IAAI,CAAC;EACjD,IAAID,QAAQ,EAAE;IACZF,GAAG,CAACI,QAAQ,CAACF,QAAQ,CAAC;EACxB,CAAC,MAAM;IACLF,GAAG,CAACK,MAAM,CAAC,GAAG,CAAC;IACfL,GAAG,CAACM,IAAI,CAAC,gBAAgB,CAAC;EAC5B;AACF,CAAC,CAAC;AAEFC,MAAM,CAACC,OAAO,GAAGb,MAAM"}
|
package/dist/es5/index.js
CHANGED
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
Object.defineProperty(exports, "I3SConverter", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function
|
|
9
|
+
get: function () {
|
|
10
10
|
return _i3sConverter.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "Tiles3DConverter", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function
|
|
15
|
+
get: function () {
|
|
16
16
|
return _dTilesConverter.default;
|
|
17
17
|
}
|
|
18
18
|
});
|