@loaders.gl/tile-converter 4.0.0-alpha.9 → 4.0.0-beta.2
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/bin/i3s-server.js +4 -0
- package/bin/slpk-extractor.js +4 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +5 -5
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +10 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts +10 -0
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +2 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -1
- package/dist/converter.min.js +172 -103
- package/dist/deps-installer/deps-installer.d.ts +3 -2
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/dist.min.js +32715 -32567
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +97 -117
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +24 -22
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/load-i3s.js +63 -0
- package/dist/es5/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/converter-cli.js +25 -65
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +113 -39
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +45 -15
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +8 -18
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +83 -43
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +100 -102
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js +70 -4
- package/dist/es5/i3s-converter/helpers/load-3d-tiles.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-index-document.js +3 -2
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js +47 -12
- package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +187 -174
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/types.js +11 -11
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/i3s-server/README.md +46 -2
- package/dist/es5/i3s-server/app.js +23 -15
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/bin/www.js +33 -0
- package/dist/es5/i3s-server/bin/www.js.map +1 -0
- package/dist/es5/i3s-server/controllers/index-controller.js +23 -22
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/controllers/slpk-controller.js +35 -38
- package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +2 -2
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/i3s-server/routes/slpk-router.js +14 -13
- package/dist/es5/i3s-server/routes/slpk-router.js.map +1 -1
- package/dist/es5/i3s-server/utils/create-scene-server.js +7 -4
- package/dist/es5/i3s-server/utils/create-scene-server.js.map +1 -1
- package/dist/es5/i3s-server/utils/server-utils.js +49 -0
- package/dist/es5/i3s-server/utils/server-utils.js.map +1 -0
- package/dist/es5/lib/utils/cli-utils.js +57 -0
- package/dist/es5/lib/utils/cli-utils.js.map +1 -0
- package/dist/es5/lib/utils/compress-util.js +1 -1
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +10 -4
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/pgm-loader.js +11 -3
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/slpk-extractor/slpk-extractor.js +171 -0
- package/dist/es5/slpk-extractor/slpk-extractor.js.map +1 -0
- package/dist/es5/slpk-extractor-cli.js +117 -0
- package/dist/es5/slpk-extractor-cli.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +51 -58
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +12 -11
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/load-i3s.js +32 -0
- package/dist/esm/3d-tiles-converter/helpers/load-i3s.js.map +1 -0
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/converter-cli.js +8 -48
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +38 -12
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +28 -11
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +10 -8
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +77 -34
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +60 -61
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js +33 -4
- package/dist/esm/i3s-converter/helpers/load-3d-tiles.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js +2 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js +37 -12
- package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +101 -73
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/types.js +9 -9
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/i3s-server/README.md +46 -2
- package/dist/esm/i3s-server/app.js +13 -11
- package/dist/esm/i3s-server/app.js.map +1 -1
- package/dist/esm/i3s-server/bin/i3s-server.min.js +516 -0
- package/dist/esm/i3s-server/bin/www.js +30 -0
- package/dist/esm/i3s-server/bin/www.js.map +1 -0
- package/dist/esm/i3s-server/controllers/index-controller.js +4 -7
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/esm/i3s-server/controllers/slpk-controller.js +9 -26
- package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -1
- package/dist/esm/i3s-server/routes/index.js +1 -1
- package/dist/esm/i3s-server/routes/index.js.map +1 -1
- package/dist/esm/i3s-server/routes/slpk-router.js +5 -11
- package/dist/esm/i3s-server/routes/slpk-router.js.map +1 -1
- package/dist/esm/i3s-server/utils/create-scene-server.js +2 -5
- package/dist/esm/i3s-server/utils/create-scene-server.js.map +1 -1
- package/dist/esm/i3s-server/utils/server-utils.js +40 -0
- package/dist/esm/i3s-server/utils/server-utils.js.map +1 -0
- package/dist/esm/lib/utils/cli-utils.js +47 -0
- package/dist/esm/lib/utils/cli-utils.js.map +1 -0
- package/dist/esm/lib/utils/compress-util.js +1 -1
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js +6 -4
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/pgm-loader.js +7 -4
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/slpk-extractor/slpk-extractor.js +63 -0
- package/dist/esm/slpk-extractor/slpk-extractor.js.map +1 -0
- package/dist/esm/slpk-extractor-cli.js +74 -0
- package/dist/esm/slpk-extractor-cli.js.map +1 -0
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +15 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +1 -2
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +8 -8
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -9
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +3 -3
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +15 -0
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +4 -5
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts +3 -2
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/types.d.ts +48 -7
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/i3s-server/app.d.ts +1 -2
- package/dist/i3s-server/app.d.ts.map +1 -1
- package/dist/i3s-server/bin/www.d.ts +3 -0
- package/dist/i3s-server/bin/www.d.ts.map +1 -0
- package/dist/i3s-server/controllers/index-controller.d.ts +6 -1
- package/dist/i3s-server/controllers/index-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.d.ts +13 -2
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/routes/index.d.ts +1 -2
- package/dist/i3s-server/routes/index.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.d.ts +2 -2
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/utils/create-scene-server.d.ts +11 -5
- package/dist/i3s-server/utils/create-scene-server.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.d.ts +24 -0
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -0
- package/dist/lib/utils/cli-utils.d.ts +34 -0
- package/dist/lib/utils/cli-utils.d.ts.map +1 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts +2 -2
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/pgm-loader.d.ts +9 -2
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.d.ts +23 -0
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -0
- package/dist/slpk-extractor-cli.d.ts +17 -0
- package/dist/slpk-extractor-cli.d.ts.map +1 -0
- package/dist/slpk-extractor.min.js +189 -0
- package/package.json +27 -21
- package/src/3d-tiles-converter/3d-tiles-converter.ts +65 -69
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +23 -19
- package/src/3d-tiles-converter/helpers/load-i3s.ts +52 -0
- package/src/3d-tiles-converter/helpers/texture-atlas.ts +6 -2
- package/src/converter-cli.ts +16 -74
- package/src/deps-installer/deps-installer.ts +56 -11
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +77 -32
- package/src/i3s-converter/helpers/coordinate-converter.ts +1 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +23 -18
- package/src/i3s-converter/helpers/geometry-attributes.ts +81 -44
- package/src/i3s-converter/helpers/geometry-converter.ts +149 -126
- package/src/i3s-converter/helpers/gltf-attributes.ts +9 -10
- package/src/i3s-converter/helpers/load-3d-tiles.ts +61 -5
- package/src/i3s-converter/helpers/node-index-document.ts +5 -1
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +70 -21
- package/src/i3s-converter/i3s-converter.ts +145 -73
- package/src/i3s-converter/types.ts +49 -7
- package/src/i3s-server/README.md +46 -2
- package/src/i3s-server/{app.js → app.ts} +11 -9
- package/src/i3s-server/bin/www.ts +38 -0
- package/src/i3s-server/controllers/{index-controller.js → index-controller.ts} +10 -9
- package/src/i3s-server/controllers/slpk-controller.ts +32 -0
- package/src/i3s-server/routes/{index.js → index.ts} +2 -1
- package/src/i3s-server/routes/{slpk-router.js → slpk-router.ts} +5 -10
- package/src/i3s-server/utils/create-scene-server.ts +20 -0
- package/src/i3s-server/utils/server-utils.ts +70 -0
- package/src/lib/utils/cli-utils.ts +78 -0
- package/src/lib/utils/compress-util.ts +1 -1
- package/src/lib/utils/lod-conversion-utils.ts +10 -6
- package/src/pgm-loader.ts +15 -7
- package/src/slpk-extractor/slpk-extractor.ts +101 -0
- package/src/slpk-extractor-cli.ts +128 -0
- package/dist/3d-tiles-attributes-worker.d.ts +0 -28
- package/dist/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/3d-tiles-attributes-worker.js +0 -3
- package/dist/3d-tiles-attributes-worker.js.map +0 -7
- package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -288
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +0 -269
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -23
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -52
- package/dist/3d-tiles-converter/json-templates/tileset.js +0 -43
- package/dist/bundle.js +0 -5
- package/dist/constants.js +0 -4
- package/dist/converter-cli.js +0 -280
- package/dist/deps-installer/deps-installer.js +0 -63
- package/dist/es5/3d-tiles-attributes-worker.js +0 -25
- package/dist/es5/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/i3s-attributes-worker.js +0 -25
- package/dist/es5/i3s-attributes-worker.js.map +0 -1
- package/dist/es5/i3s-server/bin/www +0 -102
- package/dist/es5/workers/3d-tiles-attributes-worker.js +0 -28
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/es5/workers/i3s-attributes-worker.js +0 -30
- package/dist/es5/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/3d-tiles-attributes-worker.js +0 -16
- package/dist/esm/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-attributes-worker.js +0 -16
- package/dist/esm/i3s-attributes-worker.js.map +0 -1
- package/dist/esm/i3s-server/bin/www +0 -102
- package/dist/esm/workers/3d-tiles-attributes-worker.js +0 -8
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +0 -1
- package/dist/esm/workers/i3s-attributes-worker.js +0 -7
- package/dist/esm/workers/i3s-attributes-worker.js.map +0 -1
- package/dist/i3s-attributes-worker.d.ts +0 -45
- package/dist/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/i3s-attributes-worker.js +0 -9
- package/dist/i3s-attributes-worker.js.map +0 -7
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -138
- package/dist/i3s-converter/helpers/coordinate-converter.js +0 -123
- package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -28
- package/dist/i3s-converter/helpers/feature-attributes.js +0 -216
- package/dist/i3s-converter/helpers/geometry-attributes.js +0 -202
- package/dist/i3s-converter/helpers/geometry-converter.js +0 -1225
- package/dist/i3s-converter/helpers/gltf-attributes.js +0 -128
- package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -53
- package/dist/i3s-converter/helpers/node-debug.js +0 -120
- package/dist/i3s-converter/helpers/node-index-document.js +0 -268
- package/dist/i3s-converter/helpers/node-pages.js +0 -316
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -76
- package/dist/i3s-converter/helpers/tileset-traversal.js +0 -29
- package/dist/i3s-converter/i3s-converter.js +0 -911
- package/dist/i3s-converter/json-templates/geometry-definitions.js +0 -87
- package/dist/i3s-converter/json-templates/layers.js +0 -139
- package/dist/i3s-converter/json-templates/metadata.js +0 -25
- package/dist/i3s-converter/json-templates/node.js +0 -89
- package/dist/i3s-converter/json-templates/scene-server.js +0 -31
- package/dist/i3s-converter/json-templates/shared-resources.js +0 -129
- package/dist/i3s-converter/json-templates/store.js +0 -103
- package/dist/i3s-converter/types.js +0 -17
- package/dist/i3s-server/app.js +0 -22
- package/dist/i3s-server/controllers/index-controller.js +0 -23
- package/dist/i3s-server/controllers/slpk-controller.js +0 -32
- package/dist/i3s-server/routes/index.js +0 -16
- package/dist/i3s-server/routes/slpk-router.js +0 -33
- package/dist/i3s-server/utils/create-scene-server.js +0 -14
- package/dist/index.js +0 -10
- package/dist/lib/utils/compress-util.js +0 -257
- package/dist/lib/utils/file-utils.js +0 -139
- package/dist/lib/utils/geometry-utils.js +0 -18
- package/dist/lib/utils/lod-conversion-utils.js +0 -76
- package/dist/lib/utils/queue.js +0 -18
- package/dist/lib/utils/statistic-utills.js +0 -64
- package/dist/lib/utils/write-queue.js +0 -80
- package/dist/pgm-loader.js +0 -24
- package/dist/workers/3d-tiles-attributes-worker.d.ts +0 -2
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +0 -1
- package/dist/workers/3d-tiles-attributes-worker.js +0 -9
- package/dist/workers/i3s-attributes-worker.d.ts +0 -2
- package/dist/workers/i3s-attributes-worker.d.ts.map +0 -1
- package/dist/workers/i3s-attributes-worker.js +0 -5
- package/src/3d-tiles-attributes-worker.ts +0 -43
- package/src/i3s-attributes-worker.ts +0 -59
- package/src/i3s-server/bin/www +0 -102
- package/src/i3s-server/controllers/slpk-controller.js +0 -38
- package/src/i3s-server/utils/create-scene-server.js +0 -15
- package/src/workers/3d-tiles-attributes-worker.ts +0 -6
- package/src/workers/i3s-attributes-worker.ts +0 -7
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleBatchIdsExtensions = void 0;
|
|
4
|
-
const EXT_MESH_FEATURES = 'EXT_mesh_features';
|
|
5
|
-
const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
|
|
6
|
-
/**
|
|
7
|
-
* Getting batchIds from 3DTilesNext extensions.
|
|
8
|
-
* @param attributes - gltf accessors
|
|
9
|
-
* @param primitive - gltf primitive data
|
|
10
|
-
* @param images - gltf texture images
|
|
11
|
-
*/
|
|
12
|
-
function handleBatchIdsExtensions(attributes, primitive, images) {
|
|
13
|
-
const extensions = primitive?.extensions;
|
|
14
|
-
if (!extensions) {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
for (const [extensionName, extensionData] of Object.entries(extensions || {})) {
|
|
18
|
-
switch (extensionName) {
|
|
19
|
-
case EXT_FEATURE_METADATA:
|
|
20
|
-
return handleExtFeatureMetadataExtension(attributes, extensionData, images);
|
|
21
|
-
case EXT_MESH_FEATURES:
|
|
22
|
-
console.warn('EXT_mesh_features extension is not supported yet');
|
|
23
|
-
return [];
|
|
24
|
-
default:
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
exports.handleBatchIdsExtensions = handleBatchIdsExtensions;
|
|
31
|
-
/**
|
|
32
|
-
* Get batchIds from EXT_feature_metadata extension.
|
|
33
|
-
* Docs - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata
|
|
34
|
-
* @param attributes
|
|
35
|
-
* @param extFeatureMetadata
|
|
36
|
-
* @param textures
|
|
37
|
-
*/
|
|
38
|
-
function handleExtFeatureMetadataExtension(attributes, extFeatureMetadata, images) {
|
|
39
|
-
// Take only first extension object to get batchIds attribute name.
|
|
40
|
-
const featureIdAttribute = extFeatureMetadata?.featureIdAttributes?.[0];
|
|
41
|
-
if (featureIdAttribute?.featureIds?.attribute) {
|
|
42
|
-
const batchIdsAttribute = attributes[featureIdAttribute.featureIds.attribute];
|
|
43
|
-
return batchIdsAttribute.value;
|
|
44
|
-
}
|
|
45
|
-
if (featureIdAttribute?.featureIds?.hasOwnProperty('constant') &&
|
|
46
|
-
featureIdAttribute?.featureIds?.hasOwnProperty('divisor')) {
|
|
47
|
-
const featuresCount = attributes?.POSITIONS?.value.length / 3 || 0;
|
|
48
|
-
return generateImplicitFeatureIds(featuresCount, featureIdAttribute.featureIds.constant, featureIdAttribute.featureIds.divisor);
|
|
49
|
-
}
|
|
50
|
-
// Take only first extension object to get batchIds attribute name.
|
|
51
|
-
const featureIdTexture = extFeatureMetadata?.featureIdTextures && extFeatureMetadata?.featureIdTextures[0];
|
|
52
|
-
if (featureIdTexture) {
|
|
53
|
-
const textureAttributeIndex = featureIdTexture?.featureIds?.texture?.texCoord || 0;
|
|
54
|
-
const textCoordAttribute = `TEXCOORD_${textureAttributeIndex}`;
|
|
55
|
-
const textureCoordinates = attributes[textCoordAttribute].value;
|
|
56
|
-
return generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images);
|
|
57
|
-
}
|
|
58
|
-
// Take only first extension texture to get batchIds from the root EXT_feature_metadata object.
|
|
59
|
-
const featureTexture = extFeatureMetadata?.featureTextures && extFeatureMetadata?.featureTextures[0];
|
|
60
|
-
if (featureTexture) {
|
|
61
|
-
const batchIdsAttribute = attributes[featureTexture];
|
|
62
|
-
return batchIdsAttribute.value;
|
|
63
|
-
}
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Generates implicit feature ids
|
|
68
|
-
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#implicit-feature-ids
|
|
69
|
-
* @param featuresCount
|
|
70
|
-
* @param constant
|
|
71
|
-
* @param devisor
|
|
72
|
-
*/
|
|
73
|
-
function generateImplicitFeatureIds(featuresCount, constant = 0, divisor = 0) {
|
|
74
|
-
let featureIds = [];
|
|
75
|
-
if (divisor > 0) {
|
|
76
|
-
let currentValue = constant;
|
|
77
|
-
let devisorCounter = divisor;
|
|
78
|
-
for (let index = 0; index < featuresCount; index++) {
|
|
79
|
-
featureIds.push(currentValue);
|
|
80
|
-
devisorCounter -= 1;
|
|
81
|
-
if (devisorCounter === 0) {
|
|
82
|
-
currentValue++;
|
|
83
|
-
devisorCounter = divisor;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
featureIds = Array(featuresCount).fill(constant, 0, featuresCount);
|
|
89
|
-
}
|
|
90
|
-
return featureIds;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Get batchIds from texture.
|
|
94
|
-
* @param primitive
|
|
95
|
-
* @param featureIdTextures
|
|
96
|
-
*/
|
|
97
|
-
function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, images) {
|
|
98
|
-
if (!images?.length) {
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
const CHANNELS_MAP = {
|
|
102
|
-
r: 0,
|
|
103
|
-
g: 1,
|
|
104
|
-
b: 2,
|
|
105
|
-
a: 3
|
|
106
|
-
};
|
|
107
|
-
const textureIndex = featureIdTexture?.featureIds?.texture?.index;
|
|
108
|
-
const featureChannel = featureIdTexture?.featureIds?.channels;
|
|
109
|
-
if (!featureChannel || textureIndex === undefined) {
|
|
110
|
-
return [];
|
|
111
|
-
}
|
|
112
|
-
const image = images[textureIndex];
|
|
113
|
-
const batchIds = [];
|
|
114
|
-
const channels = CHANNELS_MAP[featureChannel];
|
|
115
|
-
if (image && image?.width && image?.height && image?.components) {
|
|
116
|
-
for (let index = 0; index < textureCoordinates.length; index += 2) {
|
|
117
|
-
const u = textureCoordinates[index];
|
|
118
|
-
const v = textureCoordinates[index + 1];
|
|
119
|
-
const tx = Math.min((emod(u) * image.width) | 0, image.width - 1);
|
|
120
|
-
const ty = Math.min((emod(v) * image.height) | 0, image.height - 1);
|
|
121
|
-
const offset = (ty * image.width + tx) * image.components + channels;
|
|
122
|
-
const batchId = new Uint8Array(image.data)[offset];
|
|
123
|
-
batchIds.push(batchId);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
console.warn(`Can't get batch Ids from ${image?.mimeType || ''} compressed texture`);
|
|
128
|
-
}
|
|
129
|
-
return batchIds;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Handle UVs if they are out of range [0,1].
|
|
133
|
-
* @param n
|
|
134
|
-
* @param m
|
|
135
|
-
*/
|
|
136
|
-
function emod(n) {
|
|
137
|
-
return ((n % 1) + 1) % 1;
|
|
138
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createObbFromMbs = exports.convertBoundingVolumeToI3SFullExtent = exports.convertPositionsToVectors = exports.createBoundingVolumesFromGeometry = exports.createBoundingVolumes = void 0;
|
|
4
|
-
const core_1 = require("@math.gl/core");
|
|
5
|
-
const geospatial_1 = require("@math.gl/geospatial");
|
|
6
|
-
const culling_1 = require("@math.gl/culling");
|
|
7
|
-
/**
|
|
8
|
-
* Create bounding volumes object from tile and geoid height model.
|
|
9
|
-
* @param sourceBoundingVolume - initialized bounding volume of the source tile
|
|
10
|
-
* @param geoidHeightModel - instance of Geoid class that converts elevation from geoidal to ellipsoidal and back
|
|
11
|
-
* @returns - Bounding volumes object
|
|
12
|
-
*/
|
|
13
|
-
function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
14
|
-
let radius;
|
|
15
|
-
let halfSize;
|
|
16
|
-
let quaternion;
|
|
17
|
-
const cartographicCenter = geospatial_1.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new core_1.Vector3());
|
|
18
|
-
cartographicCenter[2] =
|
|
19
|
-
cartographicCenter[2] -
|
|
20
|
-
geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
21
|
-
if (sourceBoundingVolume instanceof culling_1.OrientedBoundingBox) {
|
|
22
|
-
halfSize = sourceBoundingVolume.halfSize;
|
|
23
|
-
radius = new core_1.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
24
|
-
quaternion = sourceBoundingVolume.quaternion;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
radius = sourceBoundingVolume.radius;
|
|
28
|
-
halfSize = [radius, radius, radius];
|
|
29
|
-
quaternion = new core_1.Quaternion()
|
|
30
|
-
.fromMatrix3(new core_1.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]]))
|
|
31
|
-
.normalize();
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
|
|
35
|
-
obb: {
|
|
36
|
-
center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],
|
|
37
|
-
halfSize,
|
|
38
|
-
quaternion
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
exports.createBoundingVolumes = createBoundingVolumes;
|
|
43
|
-
/**
|
|
44
|
-
* Generates bounding volumes from geometry positions
|
|
45
|
-
* @param cartesianPositions
|
|
46
|
-
* @param geoidHeightModel
|
|
47
|
-
*/
|
|
48
|
-
function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel) {
|
|
49
|
-
const positionVectors = convertPositionsToVectors(cartesianPositions);
|
|
50
|
-
const geometryObb = (0, culling_1.makeOrientedBoundingBoxFromPoints)(positionVectors);
|
|
51
|
-
const geometryMbs = (0, culling_1.makeBoundingSphereFromPoints)(positionVectors);
|
|
52
|
-
let mbsCenter = geospatial_1.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new core_1.Vector3());
|
|
53
|
-
let obbCenter = geospatial_1.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new core_1.Vector3());
|
|
54
|
-
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
55
|
-
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
56
|
-
return {
|
|
57
|
-
mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],
|
|
58
|
-
obb: {
|
|
59
|
-
center: obbCenter,
|
|
60
|
-
halfSize: geometryObb.halfSize,
|
|
61
|
-
quaternion: geometryObb.quaternion
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
exports.createBoundingVolumesFromGeometry = createBoundingVolumesFromGeometry;
|
|
66
|
-
/**
|
|
67
|
-
* Create array of posisitons where each vertex is vector
|
|
68
|
-
* @param {array} positions
|
|
69
|
-
* @returns {Vector3[]}
|
|
70
|
-
*/
|
|
71
|
-
function convertPositionsToVectors(positions) {
|
|
72
|
-
const result = [];
|
|
73
|
-
for (let i = 0; i < positions.length; i += 3) {
|
|
74
|
-
// TODO: (perf) new Vector3 is not optimal but required in `makeOrientedBoundingBoxFromPoints`.
|
|
75
|
-
// modify `makeOrientedBoundingBoxFromPoints` to use scratch vectors
|
|
76
|
-
const positionVector = new core_1.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
|
|
77
|
-
result.push(positionVector);
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
exports.convertPositionsToVectors = convertPositionsToVectors;
|
|
82
|
-
/**
|
|
83
|
-
* Convert common coordinate to fullExtent https://github.com/Esri/i3s-spec/blob/master/docs/1.8/fullExtent.cmn.md
|
|
84
|
-
* @param
|
|
85
|
-
* @param boundingVolume
|
|
86
|
-
* @returns - fullExtent object
|
|
87
|
-
*/
|
|
88
|
-
function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
|
|
89
|
-
let sphere;
|
|
90
|
-
if (boundingVolume instanceof culling_1.BoundingSphere) {
|
|
91
|
-
sphere = boundingVolume;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
sphere = boundingVolume.getBoundingSphere();
|
|
95
|
-
}
|
|
96
|
-
const center = sphere.center;
|
|
97
|
-
const radius = sphere.radius;
|
|
98
|
-
const vertexMax = geospatial_1.Ellipsoid.WGS84.cartesianToCartographic(new core_1.Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new core_1.Vector3());
|
|
99
|
-
const vertexMin = geospatial_1.Ellipsoid.WGS84.cartesianToCartographic(new core_1.Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new core_1.Vector3());
|
|
100
|
-
// Converter sometimes returns min values that are bigger then max,
|
|
101
|
-
// so we should check and take bigger value from max and smaller for nim
|
|
102
|
-
return {
|
|
103
|
-
xmin: Math.min(vertexMin[0], vertexMax[0]),
|
|
104
|
-
xmax: Math.max(vertexMin[0], vertexMax[0]),
|
|
105
|
-
ymin: Math.min(vertexMin[1], vertexMax[1]),
|
|
106
|
-
ymax: Math.max(vertexMin[1], vertexMax[1]),
|
|
107
|
-
zmin: Math.min(vertexMin[2], vertexMax[2]),
|
|
108
|
-
zmax: Math.max(vertexMin[2], vertexMax[2])
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
exports.convertBoundingVolumeToI3SFullExtent = convertBoundingVolumeToI3SFullExtent;
|
|
112
|
-
/**
|
|
113
|
-
* Creates oriented boundinb box from mbs.
|
|
114
|
-
* @param mbs - Minimum Bounding Sphere
|
|
115
|
-
* @returns - Oriented BOunding Box
|
|
116
|
-
*/
|
|
117
|
-
function createObbFromMbs(mbs) {
|
|
118
|
-
const radius = mbs[3];
|
|
119
|
-
const center = new core_1.Vector3(mbs[0], mbs[1], mbs[2]);
|
|
120
|
-
const halfAxex = new core_1.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
|
|
121
|
-
return new culling_1.OrientedBoundingBox(center, halfAxex);
|
|
122
|
-
}
|
|
123
|
-
exports.createObbFromMbs = createObbFromMbs;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createSceneServerPath = void 0;
|
|
7
|
-
const uuid_1 = require("uuid");
|
|
8
|
-
const json_map_transform_1 = __importDefault(require("json-map-transform"));
|
|
9
|
-
const path_1 = require("path");
|
|
10
|
-
const scene_server_1 = require("../json-templates/scene-server");
|
|
11
|
-
const file_utils_1 = require("../../lib/utils/file-utils");
|
|
12
|
-
/**
|
|
13
|
-
* Form and save sceneServer meta data into a file
|
|
14
|
-
* @param layerName - layer name to display
|
|
15
|
-
* @param layers0 - layer object embedded into sceneServer meta data
|
|
16
|
-
* @param rootPath - root path of new converted tileset
|
|
17
|
-
*/
|
|
18
|
-
async function createSceneServerPath(layerName, layers0, rootPath) {
|
|
19
|
-
const sceneServerData = {
|
|
20
|
-
serviceItemId: (0, uuid_1.v4)().replace(/-/gi, ''),
|
|
21
|
-
layerName,
|
|
22
|
-
layers0
|
|
23
|
-
};
|
|
24
|
-
const sceneServer = (0, json_map_transform_1.default)(sceneServerData, (0, scene_server_1.SCENE_SERVER)());
|
|
25
|
-
const nodePagePath = (0, path_1.join)(rootPath, 'SceneServer');
|
|
26
|
-
await (0, file_utils_1.writeFile)(nodePagePath, JSON.stringify(sceneServer));
|
|
27
|
-
}
|
|
28
|
-
exports.createSceneServerPath = createSceneServerPath;
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPopupInfo = exports.createFieldAttribute = exports.getFieldAttributeType = exports.createdStorageAttribute = exports.getAttributeType = exports.checkPropertiesLength = exports.flattenPropertyTableByFeatureIds = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Takes attributes from property table based on featureIds.
|
|
6
|
-
* If there is no property value for particular featureId (index) the property will be null.
|
|
7
|
-
* Example:
|
|
8
|
-
* Initial data:
|
|
9
|
-
* OBJECTID: [0, 1, 5]
|
|
10
|
-
* component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']
|
|
11
|
-
* Result:
|
|
12
|
-
* OBJECTID: [0, 1, 5]
|
|
13
|
-
* component: ['Windows', 'Frames', 'null']
|
|
14
|
-
* @param featureIds
|
|
15
|
-
* @param propertyTable
|
|
16
|
-
*/
|
|
17
|
-
function flattenPropertyTableByFeatureIds(featureIds, propertyTable) {
|
|
18
|
-
const resultPropertyTable = {};
|
|
19
|
-
for (const propertyName in propertyTable) {
|
|
20
|
-
const properties = propertyTable[propertyName];
|
|
21
|
-
resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIds);
|
|
22
|
-
}
|
|
23
|
-
return resultPropertyTable;
|
|
24
|
-
}
|
|
25
|
-
exports.flattenPropertyTableByFeatureIds = flattenPropertyTableByFeatureIds;
|
|
26
|
-
/**
|
|
27
|
-
* Getting properties by featureId index
|
|
28
|
-
* @param properties
|
|
29
|
-
* @param featureIds
|
|
30
|
-
*/
|
|
31
|
-
function getPropertiesByFeatureIds(properties, featureIds) {
|
|
32
|
-
const resultProperties = [];
|
|
33
|
-
for (const featureId of featureIds) {
|
|
34
|
-
const property = properties[featureId] || null;
|
|
35
|
-
resultProperties.push(property);
|
|
36
|
-
}
|
|
37
|
-
return resultProperties;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Check that all attributes in propertyTable have the same length as FeatureIds.
|
|
41
|
-
* If there are differencies between lengths we should flatten property table based on exiesting featureIds.
|
|
42
|
-
* @param featureIds
|
|
43
|
-
* @param propertyTable
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
function checkPropertiesLength(featureIds, propertyTable) {
|
|
47
|
-
let needFlatten = false;
|
|
48
|
-
for (const attribute of Object.values(propertyTable)) {
|
|
49
|
-
if (featureIds.length !== attribute.length) {
|
|
50
|
-
needFlatten = true;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return needFlatten;
|
|
54
|
-
}
|
|
55
|
-
exports.checkPropertiesLength = checkPropertiesLength;
|
|
56
|
-
/** String data type name for feature attributes */
|
|
57
|
-
const STRING_TYPE = 'string';
|
|
58
|
-
/** Integer data type name for feature attributes */
|
|
59
|
-
const SHORT_INT_TYPE = 'Int32';
|
|
60
|
-
/** Double data type name for feature attributes */
|
|
61
|
-
const DOUBLE_TYPE = 'double';
|
|
62
|
-
/** Type of attribute that is linked with feature ids */
|
|
63
|
-
const OBJECT_ID_TYPE = 'OBJECTID';
|
|
64
|
-
/**
|
|
65
|
-
* Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
|
|
66
|
-
* @param key - attribute's key
|
|
67
|
-
* @param attribute - attribute's type in propertyTable
|
|
68
|
-
*/
|
|
69
|
-
function getAttributeType(key, attribute) {
|
|
70
|
-
if (key === OBJECT_ID_TYPE) {
|
|
71
|
-
return OBJECT_ID_TYPE;
|
|
72
|
-
}
|
|
73
|
-
if (typeof attribute === STRING_TYPE) {
|
|
74
|
-
return STRING_TYPE;
|
|
75
|
-
}
|
|
76
|
-
else if (typeof attribute === 'number') {
|
|
77
|
-
return Number.isInteger(attribute) ? SHORT_INT_TYPE : DOUBLE_TYPE;
|
|
78
|
-
}
|
|
79
|
-
return STRING_TYPE;
|
|
80
|
-
}
|
|
81
|
-
exports.getAttributeType = getAttributeType;
|
|
82
|
-
/**
|
|
83
|
-
* Generate storage attribute for map segmentation.
|
|
84
|
-
* @param attributeIndex - order index of attribute (f_0, f_1 ...).
|
|
85
|
-
* @param key - attribute key from propertyTable.
|
|
86
|
-
* @param attributeType - attribute type.
|
|
87
|
-
* @return Updated storageAttribute.
|
|
88
|
-
*/
|
|
89
|
-
function createdStorageAttribute(attributeIndex, key, attributeType) {
|
|
90
|
-
const storageAttribute = {
|
|
91
|
-
key: `f_${attributeIndex}`,
|
|
92
|
-
name: key,
|
|
93
|
-
ordering: ['attributeValues'],
|
|
94
|
-
header: [{ property: 'count', valueType: 'UInt32' }],
|
|
95
|
-
attributeValues: { valueType: 'Int32', valuesPerElement: 1 }
|
|
96
|
-
};
|
|
97
|
-
switch (attributeType) {
|
|
98
|
-
case OBJECT_ID_TYPE:
|
|
99
|
-
setupIdAttribute(storageAttribute);
|
|
100
|
-
break;
|
|
101
|
-
case STRING_TYPE:
|
|
102
|
-
setupStringAttribute(storageAttribute);
|
|
103
|
-
break;
|
|
104
|
-
case DOUBLE_TYPE:
|
|
105
|
-
setupDoubleAttribute(storageAttribute);
|
|
106
|
-
break;
|
|
107
|
-
case SHORT_INT_TYPE:
|
|
108
|
-
break;
|
|
109
|
-
default:
|
|
110
|
-
setupStringAttribute(storageAttribute);
|
|
111
|
-
}
|
|
112
|
-
return storageAttribute;
|
|
113
|
-
}
|
|
114
|
-
exports.createdStorageAttribute = createdStorageAttribute;
|
|
115
|
-
/**
|
|
116
|
-
* Find and return attribute type based on key form propertyTable.
|
|
117
|
-
* @param attributeType
|
|
118
|
-
*/
|
|
119
|
-
function getFieldAttributeType(attributeType) {
|
|
120
|
-
switch (attributeType) {
|
|
121
|
-
case OBJECT_ID_TYPE:
|
|
122
|
-
return 'esriFieldTypeOID';
|
|
123
|
-
case STRING_TYPE:
|
|
124
|
-
return 'esriFieldTypeString';
|
|
125
|
-
case SHORT_INT_TYPE:
|
|
126
|
-
return 'esriFieldTypeInteger';
|
|
127
|
-
case DOUBLE_TYPE:
|
|
128
|
-
return 'esriFieldTypeDouble';
|
|
129
|
-
default:
|
|
130
|
-
return 'esriFieldTypeString';
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.getFieldAttributeType = getFieldAttributeType;
|
|
134
|
-
/**
|
|
135
|
-
* Setup field attribute for map segmentation.
|
|
136
|
-
* @param key - attribute for map segmentation.
|
|
137
|
-
* @param fieldAttributeType - esri attribute type ('esriFieldTypeString' or 'esriFieldTypeOID').
|
|
138
|
-
*/
|
|
139
|
-
function createFieldAttribute(key, fieldAttributeType) {
|
|
140
|
-
return {
|
|
141
|
-
name: key,
|
|
142
|
-
type: fieldAttributeType,
|
|
143
|
-
alias: key
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
exports.createFieldAttribute = createFieldAttribute;
|
|
147
|
-
/**
|
|
148
|
-
* Generate popup info to show metadata on the map.
|
|
149
|
-
* @param propertyTable - table data with OBJECTID.
|
|
150
|
-
* @return data for correct rendering of popup.
|
|
151
|
-
*/
|
|
152
|
-
function createPopupInfo(propertyTable) {
|
|
153
|
-
const title = '{OBJECTID}';
|
|
154
|
-
const mediaInfos = [];
|
|
155
|
-
const fieldInfos = [];
|
|
156
|
-
const popupElements = [];
|
|
157
|
-
const expressionInfos = [];
|
|
158
|
-
for (const key in propertyTable) {
|
|
159
|
-
fieldInfos.push({
|
|
160
|
-
fieldName: key,
|
|
161
|
-
visible: true,
|
|
162
|
-
isEditable: false,
|
|
163
|
-
label: key
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
popupElements.push({
|
|
167
|
-
fieldInfos,
|
|
168
|
-
type: 'fields'
|
|
169
|
-
});
|
|
170
|
-
return {
|
|
171
|
-
title,
|
|
172
|
-
mediaInfos,
|
|
173
|
-
popupElements,
|
|
174
|
-
fieldInfos,
|
|
175
|
-
expressionInfos
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
exports.createPopupInfo = createPopupInfo;
|
|
179
|
-
/**
|
|
180
|
-
* Setup storage attribute as string.
|
|
181
|
-
* @param storageAttribute - attribute for map segmentation.
|
|
182
|
-
*/
|
|
183
|
-
function setupStringAttribute(storageAttribute) {
|
|
184
|
-
// @ts-expect-error
|
|
185
|
-
storageAttribute.ordering.unshift('attributeByteCounts');
|
|
186
|
-
storageAttribute.header.push({ property: 'attributeValuesByteCount', valueType: 'UInt32' });
|
|
187
|
-
storageAttribute.attributeValues = {
|
|
188
|
-
valueType: 'String',
|
|
189
|
-
encoding: 'UTF-8',
|
|
190
|
-
valuesPerElement: 1
|
|
191
|
-
};
|
|
192
|
-
storageAttribute.attributeByteCounts = {
|
|
193
|
-
valueType: 'UInt32',
|
|
194
|
-
valuesPerElement: 1
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Setup Id attribute for map segmentation.
|
|
199
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
200
|
-
*/
|
|
201
|
-
function setupIdAttribute(storageAttribute) {
|
|
202
|
-
storageAttribute.attributeValues = {
|
|
203
|
-
valueType: 'Oid32',
|
|
204
|
-
valuesPerElement: 1
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Setup double attribute for map segmentation.
|
|
209
|
-
* @param storageAttribute - attribute for map segmentation .
|
|
210
|
-
*/
|
|
211
|
-
function setupDoubleAttribute(storageAttribute) {
|
|
212
|
-
storageAttribute.attributeValues = {
|
|
213
|
-
valueType: 'Float64',
|
|
214
|
-
valuesPerElement: 1
|
|
215
|
-
};
|
|
216
|
-
}
|