@loaders.gl/tile-converter 4.0.0-alpha.23 → 4.0.0-alpha.24
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/helpers/load-i3s.d.ts.map +1 -1
- package/dist/converter.min.js +97 -97
- package/dist/dist.min.js +237 -182
- package/dist/es5/3d-tiles-converter/helpers/load-i3s.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +6 -18
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +83 -44
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +9 -7
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/pgm-loader.js +11 -3
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/load-i3s.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +5 -5
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +76 -34
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +7 -5
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/pgm-loader.js +7 -4
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +6 -6
- 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.map +1 -1
- package/dist/i3s-converter/types.d.ts +7 -4
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/pgm-loader.d.ts +9 -2
- package/dist/pgm-loader.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/3d-tiles-converter/helpers/load-i3s.ts +1 -0
- package/src/i3s-converter/helpers/feature-attributes.ts +14 -11
- package/src/i3s-converter/helpers/geometry-attributes.ts +80 -50
- package/src/i3s-converter/helpers/geometry-converter.ts +18 -9
- package/src/i3s-converter/types.ts +8 -4
- package/src/pgm-loader.ts +15 -7
- package/dist/3d-tiles-converter/3d-tiles-converter.js +0 -279
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +0 -271
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -23
- package/dist/3d-tiles-converter/helpers/load-i3s.js +0 -42
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +0 -54
- 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 -222
- package/dist/deps-installer/deps-installer.js +0 -89
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +0 -179
- package/dist/i3s-converter/helpers/coordinate-converter.js +0 -122
- package/dist/i3s-converter/helpers/create-scene-server-path.js +0 -28
- package/dist/i3s-converter/helpers/feature-attributes.js +0 -218
- package/dist/i3s-converter/helpers/geometry-attributes.js +0 -203
- package/dist/i3s-converter/helpers/geometry-converter.js +0 -1321
- package/dist/i3s-converter/helpers/gltf-attributes.js +0 -129
- package/dist/i3s-converter/helpers/load-3d-tiles.js +0 -99
- package/dist/i3s-converter/helpers/node-debug.js +0 -120
- package/dist/i3s-converter/helpers/node-index-document.js +0 -271
- package/dist/i3s-converter/helpers/node-pages.js +0 -316
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +0 -100
- package/dist/i3s-converter/helpers/tileset-traversal.js +0 -29
- package/dist/i3s-converter/i3s-converter.js +0 -964
- 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 -29
- package/dist/i3s-server/bin/www.js +0 -37
- package/dist/i3s-server/controllers/index-controller.js +0 -31
- package/dist/i3s-server/controllers/slpk-controller.js +0 -33
- package/dist/i3s-server/routes/index.js +0 -20
- package/dist/i3s-server/routes/slpk-router.js +0 -34
- package/dist/i3s-server/utils/create-scene-server.js +0 -22
- package/dist/i3s-server/utils/server-utils.js +0 -66
- package/dist/index.js +0 -10
- package/dist/lib/utils/cli-utils.js +0 -82
- 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/slpk-extractor/slpk-extractor.js +0 -75
- package/dist/slpk-extractor-cli.js +0 -102
package/dist/esm/pgm-loader.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { parsePGM } from '@math.gl/geoid';
|
|
2
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
1
|
+
import { Geoid, parsePGM } from '@math.gl/geoid';
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'latest';
|
|
3
|
+
export { Geoid };
|
|
3
4
|
export const PGMLoader = {
|
|
4
5
|
name: 'PGM - Netpbm grayscale image format',
|
|
5
6
|
id: 'pgm',
|
|
6
7
|
module: 'tile-converter',
|
|
7
8
|
version: VERSION,
|
|
8
9
|
mimeTypes: ['image/x-portable-graymap'],
|
|
9
|
-
parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), options),
|
|
10
|
+
parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), (options === null || options === void 0 ? void 0 : options.pgm) || {}),
|
|
10
11
|
extensions: ['pgm'],
|
|
11
12
|
options: {
|
|
12
|
-
|
|
13
|
+
pgm: {
|
|
14
|
+
cubic: false
|
|
15
|
+
}
|
|
13
16
|
}
|
|
14
17
|
};
|
|
15
18
|
//# sourceMappingURL=pgm-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgm-loader.js","names":["parsePGM","VERSION","PGMLoader","name","id","module","version","mimeTypes","parse","arrayBuffer","options","Uint8Array","extensions","cubic"],"sources":["../../src/pgm-loader.ts"],"sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {parsePGM} from '@math.gl/geoid';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Loader for PGM - Netpbm grayscale image format\n */\nexport const PGMLoader: LoaderWithParser = {\n name: 'PGM - Netpbm grayscale image format',\n id: 'pgm',\n module: 'tile-converter',\n version: VERSION,\n mimeTypes: ['image/x-portable-graymap'],\n
|
|
1
|
+
{"version":3,"file":"pgm-loader.js","names":["Geoid","parsePGM","VERSION","PGMLoader","name","id","module","version","mimeTypes","parse","arrayBuffer","options","Uint8Array","pgm","extensions","cubic"],"sources":["../../src/pgm-loader.ts"],"sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {Geoid, parsePGM} from '@math.gl/geoid';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport {Geoid};\n\nexport type PGMLoaderOptions = LoaderOptions & {\n pgm?: {\n cubic?: boolean;\n };\n};\n\n/**\n * Loader for PGM - Netpbm grayscale image format\n */\nexport const PGMLoader: LoaderWithParser<Geoid, never, PGMLoaderOptions> = {\n name: 'PGM - Netpbm grayscale image format',\n id: 'pgm',\n module: 'tile-converter',\n version: VERSION,\n mimeTypes: ['image/x-portable-graymap'],\n parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), options?.pgm || {}),\n extensions: ['pgm'],\n options: {\n pgm: {\n cubic: false\n }\n }\n};\n"],"mappings":"AACA,SAAQA,KAAK,EAAEC,QAAQ,QAAO,gBAAgB;AAI9C,MAAMC,OAAO,GAAG,uBAAkB,KAAK,WAAW,sBAAiB,QAAQ;AAE3E,SAAQF,KAAK;AAWb,OAAO,MAAMG,SAA2D,GAAG;EACzEC,IAAI,EAAE,qCAAqC;EAC3CC,EAAE,EAAE,KAAK;EACTC,MAAM,EAAE,gBAAgB;EACxBC,OAAO,EAAEL,OAAO;EAChBM,SAAS,EAAE,CAAC,0BAA0B,CAAC;EACvCC,KAAK,EAAE,MAAAA,CAAOC,WAAW,EAAEC,OAAO,KAAKV,QAAQ,CAAC,IAAIW,UAAU,CAACF,WAAW,CAAC,EAAE,CAAAC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,KAAI,CAAC,CAAC,CAAC;EAChGC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBH,OAAO,EAAE;IACPE,GAAG,EAAE;MACHE,KAAK,EAAE;IACT;EACF;AACF,CAAC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { FeatureTableJson } from '@loaders.gl/3d-tiles';
|
|
2
2
|
import { Attribute, AttributeStorageInfo, ESRIField, Field, PopupInfo } from '@loaders.gl/i3s';
|
|
3
3
|
/**
|
|
4
|
-
* Takes attributes from property table based on
|
|
4
|
+
* Takes attributes from property table based on featureIdsMap.
|
|
5
5
|
* If there is no property value for particular featureId (index) the property will be null.
|
|
6
6
|
* Example:
|
|
7
7
|
* Initial data:
|
|
8
|
-
* OBJECTID:
|
|
8
|
+
* OBJECTID: {0: 0, 3: 33, 4: 333}
|
|
9
9
|
* component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']
|
|
10
10
|
* Result:
|
|
11
|
-
* OBJECTID: [0,
|
|
12
|
-
* component: ['Windows', '
|
|
13
|
-
* @param
|
|
11
|
+
* OBJECTID: [0, 33, 333]
|
|
12
|
+
* component: ['Windows', 'Roof', 'Skylight']
|
|
13
|
+
* @param featureIdsMap
|
|
14
14
|
* @param propertyTable
|
|
15
15
|
*/
|
|
16
|
-
export declare function flattenPropertyTableByFeatureIds(
|
|
16
|
+
export declare function flattenPropertyTableByFeatureIds(featureIdsMap: Record<string, number>, propertyTable: FeatureTableJson): FeatureTableJson;
|
|
17
17
|
/**
|
|
18
18
|
* Check that all attributes in propertyTable have the same length as FeatureIds.
|
|
19
19
|
* If there are differencies between lengths we should flatten property table based on exiesting featureIds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,KAAK,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC9C,
|
|
1
|
+
{"version":3,"file":"feature-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/feature-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,KAAK,EAEL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,aAAa,EAAE,gBAAgB,GAC9B,gBAAgB,CAQlB;AAuBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAAE,EACpB,aAAa,EAAE,gBAAgB,GAC9B,OAAO,CAUT;AAUD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAUvE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,SAAS,GACvB,oBAAoB,CA0BtB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,CAazE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,SAAS,GAAG,KAAK,CAMtF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,gBAAgB,GAAG,SAAS,CA8B1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"geometry-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAMlB;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,mBAAmB,GAAG,kBAAkB,CAyBtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAa/E,OAAO,EAAU,OAAO,EAAU,MAAM,eAAe,CAAC;AAUxD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,oBAAoB,EAIrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAWrC,OAAO,KAAK,EAAC,kBAAkB,EAAgD,MAAM,UAAU,CAAC;AAEhG,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAyBrE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAA8B,wBAAwB,CACpD,WAAW,EAAE,kBAAkB,EAC/B,aAAa,EAAE,OAAO,EACtB,kBAAkB,EAAE,mBAAmB,GAAG,cAAc,EACxD,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACxC,aAAa,EAAE,gBAAgB,GAAG,IAAI,EACtC,iBAAiB,EAAE,MAAM,EAAE,EAC3B,oBAAoB,EAAE,oBAAoB,EAAE,GAAG,SAAS,EACxD,KAAK,EAAE,OAAO,EACd,uBAAuB,EAAE,OAAO,EAChC,oBAAoB,EAAE,OAAO,EAC7B,gBAAgB,EAAE,KAAK,EACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACjC,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CAgEzC;
|
|
1
|
+
{"version":3,"file":"geometry-converter.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-converter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gB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G;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,kBAAkB,GAAG,IAAI,EACtC,aAAa,CAAC,EAAE,MAAM,GACrB,gBAAgB,GAAG,IAAI,CAsCzB"}
|
|
@@ -97,10 +97,8 @@ export type GeometryAttributes = {
|
|
|
97
97
|
/** number of features in the node */
|
|
98
98
|
featureCount: number;
|
|
99
99
|
};
|
|
100
|
-
/** Geometry attributes
|
|
101
|
-
export type
|
|
102
|
-
/** Feature Id */
|
|
103
|
-
featureId: number;
|
|
100
|
+
/** Geometry attributes applicable for reordering by featureId */
|
|
101
|
+
export type GroupedAttributes = {
|
|
104
102
|
/** POSITION attribute value */
|
|
105
103
|
positions: Float32Array;
|
|
106
104
|
/** NORMAL attribute value */
|
|
@@ -112,6 +110,11 @@ export type GroupedByFeatureIdAttributes = {
|
|
|
112
110
|
/** TEXCOORD_0 attribute value */
|
|
113
111
|
texCoords: Float32Array;
|
|
114
112
|
};
|
|
113
|
+
/** Geometry attributes specific for the particular feature */
|
|
114
|
+
export type GroupedByFeatureIdAttributes = GroupedAttributes & {
|
|
115
|
+
/** Feature Id */
|
|
116
|
+
featureId: number;
|
|
117
|
+
};
|
|
115
118
|
/** Shared resources made from GLTF material */
|
|
116
119
|
export type SharedResourcesArrays = {
|
|
117
120
|
/** material definitions list https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE/C,4CAA4C;AAC5C,MAAM,MAAM,qBAAqB,G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AAY,iBAAiB;CAC9B;AAED,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG;IAC3B,iEAAiE;IACjE,iBAAiB,EAAE,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAChD,wDAAwD;IACxD,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,sBAAsB,GAAG;IACnC,4BAA4B;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,gCAAgC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+CAA+C;IAC/C,aAAa,CAAC,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAC/B,0BAA0B;IAC1B,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,gEAAgE;IAChE,MAAM,EAAE,CAAC,IAAI,GAAG,sBAAsB,CAAC,EAAE,CAAC;IAC1C,uEAAuE;IACvE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mHAAmH;IACnH,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC"}
|
package/dist/pgm-loader.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type { LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
1
|
+
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import { Geoid } from '@math.gl/geoid';
|
|
3
|
+
export { Geoid };
|
|
4
|
+
export type PGMLoaderOptions = LoaderOptions & {
|
|
5
|
+
pgm?: {
|
|
6
|
+
cubic?: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
2
9
|
/**
|
|
3
10
|
* Loader for PGM - Netpbm grayscale image format
|
|
4
11
|
*/
|
|
5
|
-
export declare const PGMLoader: LoaderWithParser
|
|
12
|
+
export declare const PGMLoader: LoaderWithParser<Geoid, never, PGMLoaderOptions>;
|
|
6
13
|
//# sourceMappingURL=pgm-loader.d.ts.map
|
package/dist/pgm-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgm-loader.d.ts","sourceRoot":"","sources":["../src/pgm-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"pgm-loader.d.ts","sourceRoot":"","sources":["../src/pgm-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAC,KAAK,EAAW,MAAM,gBAAgB,CAAC;AAM/C,OAAO,EAAC,KAAK,EAAC,CAAC;AAEf,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAatE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tile-converter",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.24",
|
|
4
4
|
"description": "Converter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -45,18 +45,18 @@
|
|
|
45
45
|
"build-i3s-server-bundle": "esbuild src/i3s-server/bin/www.ts --outfile=dist/esm/i3s-server/bin/i3s-server.min.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@loaders.gl/3d-tiles": "4.0.0-alpha.
|
|
49
|
-
"@loaders.gl/crypto": "4.0.0-alpha.
|
|
50
|
-
"@loaders.gl/draco": "4.0.0-alpha.
|
|
51
|
-
"@loaders.gl/gltf": "4.0.0-alpha.
|
|
52
|
-
"@loaders.gl/i3s": "4.0.0-alpha.
|
|
53
|
-
"@loaders.gl/images": "4.0.0-alpha.
|
|
54
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
55
|
-
"@loaders.gl/polyfills": "4.0.0-alpha.
|
|
56
|
-
"@loaders.gl/textures": "4.0.0-alpha.
|
|
57
|
-
"@loaders.gl/tiles": "4.0.0-alpha.
|
|
58
|
-
"@loaders.gl/worker-utils": "4.0.0-alpha.
|
|
59
|
-
"@loaders.gl/zip": "4.0.0-alpha.
|
|
48
|
+
"@loaders.gl/3d-tiles": "4.0.0-alpha.24",
|
|
49
|
+
"@loaders.gl/crypto": "4.0.0-alpha.24",
|
|
50
|
+
"@loaders.gl/draco": "4.0.0-alpha.24",
|
|
51
|
+
"@loaders.gl/gltf": "4.0.0-alpha.24",
|
|
52
|
+
"@loaders.gl/i3s": "4.0.0-alpha.24",
|
|
53
|
+
"@loaders.gl/images": "4.0.0-alpha.24",
|
|
54
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.24",
|
|
55
|
+
"@loaders.gl/polyfills": "4.0.0-alpha.24",
|
|
56
|
+
"@loaders.gl/textures": "4.0.0-alpha.24",
|
|
57
|
+
"@loaders.gl/tiles": "4.0.0-alpha.24",
|
|
58
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.24",
|
|
59
|
+
"@loaders.gl/zip": "4.0.0-alpha.24",
|
|
60
60
|
"@math.gl/core": "^3.5.1",
|
|
61
61
|
"@math.gl/culling": "^3.5.1",
|
|
62
62
|
"@math.gl/geoid": "^3.5.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"join-images": "^1.1.3",
|
|
81
81
|
"sharp": "^0.31.3"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05",
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/express": "^4.17.17",
|
|
86
86
|
"@types/node": "^20.4.2"
|
|
@@ -9,26 +9,26 @@ import {
|
|
|
9
9
|
} from '@loaders.gl/i3s';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Takes attributes from property table based on
|
|
12
|
+
* Takes attributes from property table based on featureIdsMap.
|
|
13
13
|
* If there is no property value for particular featureId (index) the property will be null.
|
|
14
14
|
* Example:
|
|
15
15
|
* Initial data:
|
|
16
|
-
* OBJECTID:
|
|
16
|
+
* OBJECTID: {0: 0, 3: 33, 4: 333}
|
|
17
17
|
* component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']
|
|
18
18
|
* Result:
|
|
19
|
-
* OBJECTID: [0,
|
|
20
|
-
* component: ['Windows', '
|
|
21
|
-
* @param
|
|
19
|
+
* OBJECTID: [0, 33, 333]
|
|
20
|
+
* component: ['Windows', 'Roof', 'Skylight']
|
|
21
|
+
* @param featureIdsMap
|
|
22
22
|
* @param propertyTable
|
|
23
23
|
*/
|
|
24
24
|
export function flattenPropertyTableByFeatureIds(
|
|
25
|
-
|
|
25
|
+
featureIdsMap: Record<string, number>,
|
|
26
26
|
propertyTable: FeatureTableJson
|
|
27
27
|
): FeatureTableJson {
|
|
28
28
|
const resultPropertyTable: FeatureTableJson = {};
|
|
29
29
|
for (const propertyName in propertyTable) {
|
|
30
30
|
const properties = propertyTable[propertyName];
|
|
31
|
-
resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties,
|
|
31
|
+
resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIdsMap);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return resultPropertyTable;
|
|
@@ -37,14 +37,17 @@ export function flattenPropertyTableByFeatureIds(
|
|
|
37
37
|
/**
|
|
38
38
|
* Getting properties by featureId index
|
|
39
39
|
* @param properties
|
|
40
|
-
* @param
|
|
40
|
+
* @param featureIdsMap
|
|
41
41
|
*/
|
|
42
|
-
function getPropertiesByFeatureIds(
|
|
42
|
+
function getPropertiesByFeatureIds(
|
|
43
|
+
properties: unknown[],
|
|
44
|
+
featureIdsMap: Record<string, number>
|
|
45
|
+
): unknown[] {
|
|
43
46
|
const resultProperties: unknown[] = [];
|
|
44
47
|
|
|
45
48
|
if (properties) {
|
|
46
|
-
for (const
|
|
47
|
-
const property = properties[
|
|
49
|
+
for (const featureIdKey in featureIdsMap) {
|
|
50
|
+
const property = properties[featureIdKey] || null;
|
|
48
51
|
resultProperties.push(property);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
GeometryAttributes,
|
|
3
|
+
ConvertedAttributes,
|
|
4
|
+
GroupedByFeatureIdAttributes,
|
|
5
|
+
GroupedAttributes
|
|
6
|
+
} from '../types';
|
|
2
7
|
import {concatenateTypedArrays} from '@loaders.gl/loader-utils';
|
|
3
8
|
|
|
4
9
|
const VALUES_PER_VERTEX = 3;
|
|
@@ -125,6 +130,11 @@ function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureI
|
|
|
125
130
|
let colorsList = new Uint8Array(colors);
|
|
126
131
|
let texCoordsList = new Float32Array(texCoords);
|
|
127
132
|
let uvRegionsList = new Uint16Array(uvRegions);
|
|
133
|
+
let positionsOffset = 0;
|
|
134
|
+
let normalsOffset = 0;
|
|
135
|
+
let colorsOffset = 0;
|
|
136
|
+
let uvRegionsOffset = 0;
|
|
137
|
+
let texCoordsOffset = 0;
|
|
128
138
|
|
|
129
139
|
for (let index = 0; index < featureIds.length; index++) {
|
|
130
140
|
const startIndex = faceRange[index * 2];
|
|
@@ -138,21 +148,21 @@ function makeAttributeObjects(attributes: GeometryAttributes): GroupedByFeatureI
|
|
|
138
148
|
|
|
139
149
|
groupedData.push({
|
|
140
150
|
featureId: featureIds[index],
|
|
141
|
-
positions: positionsList.
|
|
142
|
-
normals: normalsList.
|
|
143
|
-
colors: colorsList.
|
|
144
|
-
uvRegions: uvRegionsList.
|
|
145
|
-
texCoords: texCoordsList.
|
|
151
|
+
positions: positionsList.subarray(positionsOffset, positionsOffset + positionsCount),
|
|
152
|
+
normals: normalsList.subarray(normalsOffset, normalsOffset + normalsCount),
|
|
153
|
+
colors: colorsList.subarray(colorsOffset, colorsOffset + colorsCount),
|
|
154
|
+
uvRegions: uvRegionsList.subarray(uvRegionsOffset, uvRegionsOffset + uvRegionsCount),
|
|
155
|
+
texCoords: texCoordsList.subarray(texCoordsOffset, texCoordsOffset + texCoordsCount)
|
|
146
156
|
});
|
|
147
157
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
158
|
+
positionsOffset += positionsCount;
|
|
159
|
+
normalsOffset += normalsCount;
|
|
160
|
+
colorsOffset += colorsCount;
|
|
161
|
+
uvRegionsOffset += uvRegionsCount;
|
|
162
|
+
texCoordsOffset += texCoordsCount;
|
|
153
163
|
}
|
|
154
164
|
|
|
155
|
-
return groupedData
|
|
165
|
+
return groupedData;
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
/**
|
|
@@ -195,35 +205,32 @@ function getSliceAttributeCount(
|
|
|
195
205
|
function unifyObjectsByFeatureId(
|
|
196
206
|
sortedData: GroupedByFeatureIdAttributes[]
|
|
197
207
|
): GroupedByFeatureIdAttributes[] {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
208
|
+
const groupedMetadata: {
|
|
209
|
+
featureId: number;
|
|
210
|
+
attributes: GroupedByFeatureIdAttributes[];
|
|
211
|
+
}[] = [];
|
|
212
|
+
for (const data of sortedData) {
|
|
213
|
+
const existingObject = groupedMetadata.find((obj) => obj.featureId === data.featureId);
|
|
204
214
|
if (existingObject) {
|
|
205
|
-
existingObject.
|
|
206
|
-
existingObject.positions,
|
|
207
|
-
currentObject.positions
|
|
208
|
-
);
|
|
209
|
-
existingObject.normals = concatenateTypedArrays(
|
|
210
|
-
existingObject.normals,
|
|
211
|
-
currentObject.normals
|
|
212
|
-
);
|
|
213
|
-
existingObject.colors = concatenateTypedArrays(existingObject.colors, currentObject.colors);
|
|
214
|
-
existingObject.texCoords = concatenateTypedArrays(
|
|
215
|
-
existingObject.texCoords,
|
|
216
|
-
currentObject.texCoords
|
|
217
|
-
);
|
|
218
|
-
existingObject.uvRegions = concatenateTypedArrays(
|
|
219
|
-
existingObject.uvRegions,
|
|
220
|
-
currentObject.uvRegions
|
|
221
|
-
);
|
|
215
|
+
existingObject.attributes.push(data);
|
|
222
216
|
} else {
|
|
223
|
-
|
|
217
|
+
groupedMetadata.push({
|
|
218
|
+
featureId: data.featureId,
|
|
219
|
+
attributes: [data]
|
|
220
|
+
});
|
|
224
221
|
}
|
|
225
222
|
}
|
|
226
223
|
|
|
224
|
+
const uniqueObjects: GroupedByFeatureIdAttributes[] = [];
|
|
225
|
+
for (const metatada of groupedMetadata) {
|
|
226
|
+
const attributes = concatenateAttributes(metatada.attributes);
|
|
227
|
+
|
|
228
|
+
uniqueObjects.push({
|
|
229
|
+
featureId: metatada.featureId,
|
|
230
|
+
...attributes
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
227
234
|
return uniqueObjects;
|
|
228
235
|
}
|
|
229
236
|
|
|
@@ -238,12 +245,6 @@ function groupAttributesAndRangesByFeatureId(
|
|
|
238
245
|
): GeometryAttributes {
|
|
239
246
|
const firstAttributeObject = unifiedObjects[0];
|
|
240
247
|
const featureIds = [firstAttributeObject.featureId || 0];
|
|
241
|
-
|
|
242
|
-
let positions = new Float32Array(firstAttributeObject.positions);
|
|
243
|
-
let normals = new Float32Array(firstAttributeObject.normals);
|
|
244
|
-
let colors = new Uint8Array(firstAttributeObject.colors);
|
|
245
|
-
let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
|
|
246
|
-
let texCoords = new Float32Array(firstAttributeObject.texCoords);
|
|
247
248
|
const range = [0];
|
|
248
249
|
|
|
249
250
|
let objIndex = 0;
|
|
@@ -253,12 +254,6 @@ function groupAttributesAndRangesByFeatureId(
|
|
|
253
254
|
const currentAttributesObject = unifiedObjects[index];
|
|
254
255
|
featureIds.push(currentAttributesObject.featureId || 0);
|
|
255
256
|
|
|
256
|
-
positions = concatenateTypedArrays(positions, currentAttributesObject.positions);
|
|
257
|
-
normals = concatenateTypedArrays(normals, currentAttributesObject.normals);
|
|
258
|
-
colors = concatenateTypedArrays(colors, currentAttributesObject.colors);
|
|
259
|
-
uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);
|
|
260
|
-
texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);
|
|
261
|
-
|
|
262
257
|
const groupedObject = unifiedObjects[objIndex];
|
|
263
258
|
range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);
|
|
264
259
|
range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE + sum);
|
|
@@ -267,8 +262,43 @@ function groupAttributesAndRangesByFeatureId(
|
|
|
267
262
|
objIndex += 1;
|
|
268
263
|
}
|
|
269
264
|
|
|
270
|
-
|
|
265
|
+
const attributes = concatenateAttributes(unifiedObjects);
|
|
266
|
+
|
|
267
|
+
range.push(attributes.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
|
|
271
268
|
|
|
272
269
|
const faceRange = new Uint32Array(range);
|
|
273
|
-
return {faceRange, featureIds,
|
|
270
|
+
return {faceRange, featureIds, featureCount, ...attributes};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Concatenate attributes typed arrays
|
|
275
|
+
* @param attributes - grouped by featureId typed arrays
|
|
276
|
+
* @returns - concatenated typed array list
|
|
277
|
+
*/
|
|
278
|
+
function concatenateAttributes(attributes: GroupedByFeatureIdAttributes[]): GroupedAttributes {
|
|
279
|
+
const positionGroups = attributes.map(({positions}) => positions);
|
|
280
|
+
const positions =
|
|
281
|
+
positionGroups.length > 1 ? concatenateTypedArrays(...positionGroups) : positionGroups[0];
|
|
282
|
+
|
|
283
|
+
const normalGroups = attributes.map(({normals}) => normals);
|
|
284
|
+
const normals =
|
|
285
|
+
normalGroups.length > 1 ? concatenateTypedArrays(...normalGroups) : normalGroups[0];
|
|
286
|
+
|
|
287
|
+
const colorGroups = attributes.map(({colors}) => colors);
|
|
288
|
+
const colors = colorGroups.length > 1 ? concatenateTypedArrays(...colorGroups) : colorGroups[0];
|
|
289
|
+
|
|
290
|
+
const texCoordGroups = attributes.map(({texCoords}) => texCoords);
|
|
291
|
+
const texCoords =
|
|
292
|
+
texCoordGroups.length > 1 ? concatenateTypedArrays(...texCoordGroups) : texCoordGroups[0];
|
|
293
|
+
|
|
294
|
+
const uvRegionGroups = attributes.map(({uvRegions}) => uvRegions);
|
|
295
|
+
const uvRegions =
|
|
296
|
+
uvRegionGroups.length > 1 ? concatenateTypedArrays(...uvRegionGroups) : uvRegionGroups[0];
|
|
297
|
+
return {
|
|
298
|
+
positions,
|
|
299
|
+
normals,
|
|
300
|
+
colors,
|
|
301
|
+
texCoords,
|
|
302
|
+
uvRegions
|
|
303
|
+
};
|
|
274
304
|
}
|
|
@@ -244,12 +244,18 @@ async function _makeNodeResources({
|
|
|
244
244
|
const {faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount} =
|
|
245
245
|
generateAttributes(convertedAttributes);
|
|
246
246
|
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
let featureIdsMap: Record<string, number> = {};
|
|
248
|
+
if (propertyTable) {
|
|
249
|
+
/**
|
|
250
|
+
* 3DTiles has featureIndices unique only for one tile.
|
|
251
|
+
* In I3S featureIds are unique layer-wide. We create featureIds from all feature properties.
|
|
252
|
+
* If 3DTiles features has equal set of properties they are considered as same feature in I3S.
|
|
253
|
+
*/
|
|
254
|
+
featureIdsMap = makeFeatureIdsUnique(
|
|
249
255
|
featureIds,
|
|
250
256
|
convertedAttributes.featureIndices,
|
|
251
257
|
featuresHashArray,
|
|
252
|
-
|
|
258
|
+
propertyTable
|
|
253
259
|
);
|
|
254
260
|
}
|
|
255
261
|
|
|
@@ -291,6 +297,7 @@ async function _makeNodeResources({
|
|
|
291
297
|
if (attributeStorageInfo && propertyTable) {
|
|
292
298
|
attributes = convertPropertyTableToAttributeBuffers(
|
|
293
299
|
featureIds,
|
|
300
|
+
featureIdsMap,
|
|
294
301
|
propertyTable,
|
|
295
302
|
attributeStorageInfo
|
|
296
303
|
);
|
|
@@ -1252,17 +1259,18 @@ function generateImageId(texture: GLTFTexturePostprocessed, nodeId: number) {
|
|
|
1252
1259
|
* @param featureIndices
|
|
1253
1260
|
* @param featuresHashArray
|
|
1254
1261
|
* @param batchTable
|
|
1255
|
-
* @returns
|
|
1262
|
+
* @returns propertyTable indices to map featureIds
|
|
1256
1263
|
*/
|
|
1257
1264
|
function makeFeatureIdsUnique(
|
|
1258
1265
|
featureIds: number[],
|
|
1259
1266
|
featureIndices: number[],
|
|
1260
1267
|
featuresHashArray: string[],
|
|
1261
1268
|
batchTable: {[key: string]: any}
|
|
1262
|
-
) {
|
|
1269
|
+
): Record<string, number> {
|
|
1263
1270
|
const replaceMap = getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray);
|
|
1264
1271
|
replaceIndicesByUnique(featureIndices, replaceMap);
|
|
1265
1272
|
replaceIndicesByUnique(featureIds, replaceMap);
|
|
1273
|
+
return replaceMap;
|
|
1266
1274
|
}
|
|
1267
1275
|
|
|
1268
1276
|
/**
|
|
@@ -1276,8 +1284,8 @@ function getFeaturesReplaceMap(
|
|
|
1276
1284
|
featureIds: any[],
|
|
1277
1285
|
batchTable: object,
|
|
1278
1286
|
featuresHashArray: any[]
|
|
1279
|
-
): Record<string,
|
|
1280
|
-
const featureMap: Record<string,
|
|
1287
|
+
): Record<string, number> {
|
|
1288
|
+
const featureMap: Record<string, number> = {};
|
|
1281
1289
|
|
|
1282
1290
|
for (let index = 0; index < featureIds.length; index++) {
|
|
1283
1291
|
const oldFeatureId = featureIds[index];
|
|
@@ -1329,7 +1337,7 @@ function getOrCreateUniqueFeatureId(
|
|
|
1329
1337
|
* @param featureMap
|
|
1330
1338
|
* @returns
|
|
1331
1339
|
*/
|
|
1332
|
-
function replaceIndicesByUnique(indicesArray:
|
|
1340
|
+
function replaceIndicesByUnique(indicesArray: number[], featureMap: Record<string, number>) {
|
|
1333
1341
|
for (let index = 0; index < indicesArray.length; index++) {
|
|
1334
1342
|
indicesArray[index] = featureMap[indicesArray[index]];
|
|
1335
1343
|
}
|
|
@@ -1344,6 +1352,7 @@ function replaceIndicesByUnique(indicesArray: any[], featureMap: Record<string,
|
|
|
1344
1352
|
*/
|
|
1345
1353
|
function convertPropertyTableToAttributeBuffers(
|
|
1346
1354
|
featureIds: number[],
|
|
1355
|
+
featureIdsMap: Record<string, number>,
|
|
1347
1356
|
propertyTable: FeatureTableJson,
|
|
1348
1357
|
attributeStorageInfo: AttributeStorageInfo[]
|
|
1349
1358
|
): any[] {
|
|
@@ -1351,7 +1360,7 @@ function convertPropertyTableToAttributeBuffers(
|
|
|
1351
1360
|
|
|
1352
1361
|
const needFlattenPropertyTable = checkPropertiesLength(featureIds, propertyTable);
|
|
1353
1362
|
const properties = needFlattenPropertyTable
|
|
1354
|
-
? flattenPropertyTableByFeatureIds(
|
|
1363
|
+
? flattenPropertyTableByFeatureIds(featureIdsMap, propertyTable)
|
|
1355
1364
|
: propertyTable;
|
|
1356
1365
|
|
|
1357
1366
|
const propertyTableWithObjectIds = {
|
|
@@ -106,10 +106,8 @@ export type GeometryAttributes = {
|
|
|
106
106
|
featureCount: number;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
/** Geometry attributes
|
|
110
|
-
export type
|
|
111
|
-
/** Feature Id */
|
|
112
|
-
featureId: number;
|
|
109
|
+
/** Geometry attributes applicable for reordering by featureId */
|
|
110
|
+
export type GroupedAttributes = {
|
|
113
111
|
/** POSITION attribute value */
|
|
114
112
|
positions: Float32Array;
|
|
115
113
|
/** NORMAL attribute value */
|
|
@@ -122,6 +120,12 @@ export type GroupedByFeatureIdAttributes = {
|
|
|
122
120
|
texCoords: Float32Array;
|
|
123
121
|
};
|
|
124
122
|
|
|
123
|
+
/** Geometry attributes specific for the particular feature */
|
|
124
|
+
export type GroupedByFeatureIdAttributes = GroupedAttributes & {
|
|
125
|
+
/** Feature Id */
|
|
126
|
+
featureId: number;
|
|
127
|
+
};
|
|
128
|
+
|
|
125
129
|
/** Shared resources made from GLTF material */
|
|
126
130
|
export type SharedResourcesArrays = {
|
|
127
131
|
/** material definitions list https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md */
|
package/src/pgm-loader.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
import type {LoaderWithParser} from '@loaders.gl/loader-utils';
|
|
2
|
-
import {parsePGM} from '@math.gl/geoid';
|
|
1
|
+
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
|
+
import {Geoid, parsePGM} from '@math.gl/geoid';
|
|
3
3
|
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
6
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
7
7
|
|
|
8
|
+
export {Geoid};
|
|
9
|
+
|
|
10
|
+
export type PGMLoaderOptions = LoaderOptions & {
|
|
11
|
+
pgm?: {
|
|
12
|
+
cubic?: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* Loader for PGM - Netpbm grayscale image format
|
|
10
18
|
*/
|
|
11
|
-
export const PGMLoader: LoaderWithParser = {
|
|
19
|
+
export const PGMLoader: LoaderWithParser<Geoid, never, PGMLoaderOptions> = {
|
|
12
20
|
name: 'PGM - Netpbm grayscale image format',
|
|
13
21
|
id: 'pgm',
|
|
14
22
|
module: 'tile-converter',
|
|
15
23
|
version: VERSION,
|
|
16
24
|
mimeTypes: ['image/x-portable-graymap'],
|
|
17
|
-
|
|
18
|
-
parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), options),
|
|
25
|
+
parse: async (arrayBuffer, options) => parsePGM(new Uint8Array(arrayBuffer), options?.pgm || {}),
|
|
19
26
|
extensions: ['pgm'],
|
|
20
27
|
options: {
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
pgm: {
|
|
29
|
+
cubic: false
|
|
30
|
+
}
|
|
23
31
|
}
|
|
24
32
|
};
|