@loaders.gl/tile-converter 3.2.0-alpha.1 → 3.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-attributes-worker.d.ts +28 -0
- package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/3d-tiles-attributes-worker.js +4 -0
- package/dist/3d-tiles-attributes-worker.js.map +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +5 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +34 -3
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -4
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +10 -10
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/converter-cli.d.ts +2 -0
- package/dist/converter-cli.d.ts.map +1 -0
- package/dist/converter-cli.js +232 -0
- package/dist/converter.min.js +68 -68
- package/dist/deps-installer/deps-installer.d.ts +11 -1
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +10 -0
- package/dist/dist.min.js +910 -790
- package/dist/es5/3d-tiles-attributes-worker.js +29 -0
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +116 -46
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +21 -23
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/constants.js +9 -0
- package/dist/es5/constants.js.map +1 -0
- package/dist/es5/converter-cli.js +306 -0
- package/dist/es5/converter-cli.js.map +1 -0
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +29 -0
- package/dist/es5/i3s-attributes-worker.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +271 -182
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +71 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js +47 -99
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +293 -223
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js +29 -0
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/index.js +0 -16
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +14 -17
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +39 -14
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +61 -0
- package/dist/es5/lib/utils/queue.js.map +1 -0
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +225 -0
- package/dist/es5/lib/utils/write-queue.js.map +1 -0
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +37 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/workers/i3s-attributes-worker.js +40 -0
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-attributes-worker.js +16 -0
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +36 -4
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +16 -18
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/converter-cli.js +230 -0
- package/dist/esm/converter-cli.js.map +1 -0
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +16 -0
- package/dist/esm/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +121 -62
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +54 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js +12 -4
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +157 -52
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/layers.js +25 -0
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +6 -8
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +11 -1
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js +19 -0
- package/dist/esm/lib/utils/queue.js.map +1 -0
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +88 -0
- package/dist/esm/lib/utils/write-queue.js.map +1 -0
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +5 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/workers/i3s-attributes-worker.js +4 -0
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/i3s-attributes-worker.d.ts +33 -0
- package/dist/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/i3s-attributes-worker.js +10 -0
- package/dist/i3s-attributes-worker.js.map +7 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +7 -7
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +25 -21
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +2 -2
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +2 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +28 -11
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +223 -113
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/gltf-attributes.js +56 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +6 -5
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +13 -8
- package/dist/i3s-converter/i3s-converter.d.ts +7 -5
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +126 -40
- package/dist/i3s-converter/json-templates/layers.d.ts +4 -0
- package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
- package/dist/i3s-converter/json-templates/layers.js +24 -0
- package/dist/i3s-converter/types.d.ts +83 -8
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/lib/utils/compress-util.d.ts +44 -5
- package/dist/lib/utils/compress-util.d.ts.map +1 -1
- package/dist/lib/utils/compress-util.js +73 -6
- package/dist/lib/utils/file-utils.d.ts +34 -5
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +40 -1
- package/dist/lib/utils/lod-conversion-utils.d.ts +25 -4
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
- package/dist/lib/utils/lod-conversion-utils.js +21 -2
- package/dist/lib/utils/queue.d.ts +7 -0
- package/dist/lib/utils/queue.d.ts.map +1 -0
- package/dist/lib/utils/queue.js +18 -0
- package/dist/lib/utils/statistic-utills.d.ts +2 -2
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.d.ts +22 -0
- package/dist/lib/utils/write-queue.d.ts.map +1 -0
- package/dist/lib/utils/write-queue.js +62 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/workers/3d-tiles-attributes-worker.js +9 -0
- package/dist/workers/i3s-attributes-worker.d.ts +2 -0
- package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/workers/i3s-attributes-worker.js +5 -0
- package/package.json +23 -18
- package/src/3d-tiles-attributes-worker.ts +43 -0
- package/src/3d-tiles-converter/3d-tiles-converter.ts +50 -5
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +15 -13
- package/src/constants.ts +2 -0
- package/src/converter-cli.ts +310 -0
- package/src/deps-installer/{deps-installer.js → deps-installer.ts} +11 -1
- package/src/i3s-attributes-worker.ts +46 -0
- package/src/i3s-converter/helpers/coordinate-converter.ts +29 -24
- package/src/i3s-converter/helpers/geometry-attributes.ts +4 -3
- package/src/i3s-converter/helpers/{geometry-converter.js → geometry-converter.ts} +425 -179
- package/src/i3s-converter/helpers/gltf-attributes.ts +68 -0
- package/src/i3s-converter/helpers/node-pages.ts +25 -17
- package/src/i3s-converter/i3s-converter.ts +150 -90
- package/src/i3s-converter/json-templates/layers.ts +25 -0
- package/src/i3s-converter/types.ts +90 -8
- package/src/index.ts +0 -4
- package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
- package/src/lib/utils/file-utils.ts +84 -0
- package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
- package/src/lib/utils/queue.ts +17 -0
- package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
- package/src/lib/utils/write-queue.ts +75 -0
- package/src/workers/3d-tiles-attributes-worker.ts +6 -0
- package/src/workers/i3s-attributes-worker.ts +6 -0
- package/dist/es5/deps-installer/deps-installer.d.ts +0 -10
- package/dist/es5/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/es5/lib/utils/compress-util.d.ts +0 -53
- package/dist/es5/lib/utils/file-utils.d.ts +0 -43
- package/dist/es5/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/dist/esm/deps-installer/deps-installer.d.ts +0 -10
- package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/esm/lib/utils/compress-util.d.ts +0 -53
- package/dist/esm/lib/utils/file-utils.d.ts +0 -43
- package/dist/esm/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/src/deps-installer/deps-installer.d.ts +0 -10
- package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/src/lib/utils/compress-util.d.ts +0 -53
- package/src/lib/utils/file-utils.d.ts +0 -43
- package/src/lib/utils/file-utils.js +0 -38
- package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
|
@@ -1,39 +1,114 @@
|
|
|
1
|
-
import { BoundingVolumes, I3SMaterialDefinition,
|
|
1
|
+
import { BoundingVolumes, I3SMaterialDefinition, MaterialDefinitionInfo, TextureDefinitionInfo } from '@loaders.gl/i3s';
|
|
2
|
+
import { ImageDataType } from '@loaders.gl/images';
|
|
3
|
+
/** Converted resources for specific node */
|
|
2
4
|
export declare type I3SConvertedResources = {
|
|
5
|
+
/** Non-compressed geometry buffer that have structure met
|
|
6
|
+
* https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md
|
|
7
|
+
* (Geometry buffer)
|
|
8
|
+
*/
|
|
3
9
|
geometry: ArrayBuffer | null;
|
|
4
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Draco compressed geometry
|
|
12
|
+
*/
|
|
13
|
+
compressedGeometry?: Promise<ArrayBuffer> | null;
|
|
14
|
+
/**
|
|
15
|
+
* Texture image content
|
|
16
|
+
*/
|
|
5
17
|
texture: any | null;
|
|
6
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Shared resources built from GLTF material
|
|
20
|
+
*/
|
|
21
|
+
sharedResources: SharedResourcesArrays | null;
|
|
22
|
+
/**
|
|
23
|
+
* Material definition of the node
|
|
24
|
+
*/
|
|
7
25
|
meshMaterial?: I3SMaterialDefinition | null;
|
|
26
|
+
/**
|
|
27
|
+
* Number of vertices in the node
|
|
28
|
+
*/
|
|
8
29
|
vertexCount: number | null;
|
|
9
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Feature attributes contents
|
|
32
|
+
*/
|
|
33
|
+
attributes: ArrayBuffer[] | null;
|
|
34
|
+
/**
|
|
35
|
+
* Number of features in the node
|
|
36
|
+
*/
|
|
10
37
|
featureCount: number | null;
|
|
11
|
-
|
|
38
|
+
/**
|
|
39
|
+
* MBS and/or OBB bounding volumes of the node
|
|
40
|
+
*/
|
|
12
41
|
boundingVolumes: BoundingVolumes | null;
|
|
13
42
|
};
|
|
14
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Geometry and feature attributes converted from GLTF primitives
|
|
45
|
+
*/
|
|
46
|
+
export declare type ConvertedAttributes = {
|
|
47
|
+
/** POSITION attribute value */
|
|
15
48
|
positions: Float32Array;
|
|
49
|
+
/** NORMAL attribute value */
|
|
16
50
|
normals: Float32Array;
|
|
51
|
+
/** TEXCOORD_0 attribute value */
|
|
17
52
|
texCoords: Float32Array;
|
|
53
|
+
/** COLOR_0 attribute value */
|
|
18
54
|
colors: Uint8Array;
|
|
55
|
+
/** Feature indices grouped by ...
|
|
56
|
+
* converted from "batch ids" of GLTF
|
|
57
|
+
*/
|
|
58
|
+
featureIndicesGroups?: number[][];
|
|
59
|
+
/** Feature indices converted from "batch ids" */
|
|
19
60
|
featureIndices: number[];
|
|
20
|
-
|
|
21
|
-
|
|
61
|
+
/**
|
|
62
|
+
* MBS and/or OBB bounding volumes of the node
|
|
63
|
+
*/
|
|
64
|
+
boundingVolumes: null | BoundingVolumes;
|
|
22
65
|
};
|
|
66
|
+
/** Postprocessed geometry and feature attributes
|
|
67
|
+
* https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md
|
|
68
|
+
*/
|
|
23
69
|
export declare type GeometryAttributes = {
|
|
70
|
+
/** POSITION attribute value */
|
|
24
71
|
positions: Float32Array;
|
|
72
|
+
/** NORMAL attribute value */
|
|
25
73
|
normals: Float32Array;
|
|
74
|
+
/** TEXCOORD_0 attribute value */
|
|
26
75
|
texCoords: Float32Array;
|
|
76
|
+
/** COLOR_0 attribute value */
|
|
27
77
|
colors: Uint8Array;
|
|
78
|
+
/** faceRanges attribute value */
|
|
28
79
|
faceRange: Uint32Array;
|
|
80
|
+
/** feature Ids attribute value */
|
|
29
81
|
featureIds: number[];
|
|
82
|
+
/** number of features in the node */
|
|
30
83
|
featureCount: number;
|
|
31
84
|
};
|
|
85
|
+
/** Geometry attributes specific for the particular feature */
|
|
32
86
|
export declare type GroupedByFeatureIdAttributes = {
|
|
87
|
+
/** Feature Id */
|
|
33
88
|
featureId: number;
|
|
89
|
+
/** POSITION attribute value */
|
|
34
90
|
positions: Float32Array;
|
|
91
|
+
/** NORMAL attribute value */
|
|
35
92
|
normals: Float32Array;
|
|
93
|
+
/** COLOR_0 attribute value */
|
|
36
94
|
colors: Uint8Array;
|
|
95
|
+
/** TEXCOORD_0 attribute value */
|
|
37
96
|
texCoords: Float32Array;
|
|
38
97
|
};
|
|
98
|
+
/** Shared resources made from GLTF material */
|
|
99
|
+
export declare type SharedResourcesArrays = {
|
|
100
|
+
/** material definitions list https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md */
|
|
101
|
+
materialDefinitionInfos?: MaterialDefinitionInfo[];
|
|
102
|
+
/** texture definitions list https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureDefinitionInfo.cmn.md*/
|
|
103
|
+
textureDefinitionInfos?: TextureDefinitionInfo[];
|
|
104
|
+
/** node id to make unique SharedResource ids */
|
|
105
|
+
nodePath?: string;
|
|
106
|
+
};
|
|
107
|
+
/** I3S material definition and texture content taken from GLTF material */
|
|
108
|
+
export declare type I3SMaterialWithTexture = {
|
|
109
|
+
/** Material definition https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */
|
|
110
|
+
material: I3SMaterialDefinition;
|
|
111
|
+
/** Texture content (image) */
|
|
112
|
+
texture?: ImageDataType;
|
|
113
|
+
};
|
|
39
114
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i3s-converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD,4CAA4C;AAC5C,oBAAY,qBAAqB,GAAG;IAClC;;;OAGG;IACH,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IACjD;;OAEG;IACH,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACpB;;OAEG;IACH,eAAe,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC5C;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;OAEG;IACH,UAAU,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;OAEG;IACH,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,oBAAY,mBAAmB,GAAG;IAChC,+BAA+B;IAC/B,SAAS,EAAE,YAAY,CAAC;IACxB,6BAA6B;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,iCAAiC;IACjC,SAAS,EAAE,YAAY,CAAC;IACxB,8BAA8B;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAClC,iDAAiD;IACjD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,eAAe,EAAE,IAAI,GAAG,eAAe,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,oBAAY,kBAAkB,GAAG;IAC/B,+BAA+B;IAC/B,SAAS,EAAE,YAAY,CAAC;IACxB,6BAA6B;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,iCAAiC;IACjC,SAAS,EAAE,YAAY,CAAC;IACxB,8BAA8B;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,kCAAkC;IAClC,SAAS,EAAE,WAAW,CAAC;IACvB,kCAAkC;IAClC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,8DAA8D;AAC9D,oBAAY,4BAA4B,GAAG;IACzC,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,SAAS,EAAE,YAAY,CAAC;IACxB,6BAA6B;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,8BAA8B;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,iCAAiC;IACjC,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,+CAA+C;AAC/C,oBAAY,qBAAqB,GAAG;IAClC,oHAAoH;IACpH,uBAAuB,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACnD,kHAAkH;IAClH,sBAAsB,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACjD,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,2EAA2E;AAC3E,oBAAY,sBAAsB,GAAG;IACnC,2GAA2G;IAC3G,QAAQ,EAAE,qBAAqB,CAAC;IAChC,8BAA8B;IAC9B,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export { default as I3SConverter } from './i3s-converter/i3s-converter';
|
|
2
|
-
export { default as NodePages } from './i3s-converter/helpers/node-pages';
|
|
3
2
|
export { default as Tiles3DConverter } from './3d-tiles-converter/3d-tiles-converter';
|
|
4
|
-
export { DepsInstaller } from './deps-installer/deps-installer';
|
|
5
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAC,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,yCAAyC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,12 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.Tiles3DConverter = exports.I3SConverter = void 0;
|
|
7
7
|
var i3s_converter_1 = require("./i3s-converter/i3s-converter");
|
|
8
8
|
Object.defineProperty(exports, "I3SConverter", { enumerable: true, get: function () { return __importDefault(i3s_converter_1).default; } });
|
|
9
|
-
var node_pages_1 = require("./i3s-converter/helpers/node-pages");
|
|
10
|
-
Object.defineProperty(exports, "NodePages", { enumerable: true, get: function () { return __importDefault(node_pages_1).default; } });
|
|
11
9
|
var _3d_tiles_converter_1 = require("./3d-tiles-converter/3d-tiles-converter");
|
|
12
10
|
Object.defineProperty(exports, "Tiles3DConverter", { enumerable: true, get: function () { return __importDefault(_3d_tiles_converter_1).default; } });
|
|
13
|
-
var deps_installer_1 = require("./deps-installer/deps-installer");
|
|
14
|
-
Object.defineProperty(exports, "DepsInstaller", { enumerable: true, get: function () { return deps_installer_1.DepsInstaller; } });
|
|
@@ -1,6 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Compress file to gzip file
|
|
3
|
+
*
|
|
4
|
+
* @param pathFile - the path to the file
|
|
5
|
+
* @return the path to the gzip file
|
|
6
|
+
*/
|
|
7
|
+
export declare function compressFileWithGzip(pathFile: string): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Compress files from map into slpk file
|
|
10
|
+
*
|
|
11
|
+
* @param fileMap - map with file paths (key: output path, value: input path)
|
|
12
|
+
* @param outputFile - output slpk file
|
|
13
|
+
* @param level - compression level
|
|
14
|
+
*/
|
|
15
|
+
export declare function compressFilesWithZip(fileMap: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
}, outputFile: string, level?: number): Promise<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Compress files using external tool 'zip'/'7z'
|
|
20
|
+
*
|
|
21
|
+
* @param inputFolder - folder to archive - for cwd option
|
|
22
|
+
* @param outputFile - output slpk file
|
|
23
|
+
* @param level - compression level
|
|
24
|
+
* @param inputFiles - input files path to pass to the executable as option
|
|
25
|
+
* @param sevenZipExe - path to 7z.exe executable
|
|
26
|
+
*/
|
|
27
|
+
export declare function compressWithChildProcess(inputFolder: string, outputFile: string, level: number, inputFiles: string, sevenZipExe: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Generate hash file from zip archive
|
|
30
|
+
* https://github.com/Esri/i3s-spec/blob/master/docs/1.7/slpk_hashtable.cmn.md
|
|
31
|
+
*
|
|
32
|
+
* @param inputZipFile
|
|
33
|
+
* @param outputFile
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateHash128FromZip(inputZipFile: string, outputFile: string): Promise<unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Add file to zip archive
|
|
38
|
+
*
|
|
39
|
+
* @param inputFile
|
|
40
|
+
* @param fileName
|
|
41
|
+
* @param zipFile
|
|
42
|
+
* @param sevenZipExe
|
|
43
|
+
*/
|
|
44
|
+
export declare function addFileToZip(inputFolder: string, fileName: string, zipFile: string, sevenZipExe: string): Promise<void>;
|
|
6
45
|
//# sourceMappingURL=compress-util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress-util.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/compress-util.
|
|
1
|
+
{"version":3,"file":"compress-util.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/compress-util.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBtE;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,EAChC,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,MAAU,oBAqDlB;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,iBAQpB;AAgED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBA6CpF;AAeD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,iBAIpB"}
|
|
@@ -14,6 +14,12 @@ const jszip_1 = __importDefault(require("jszip"));
|
|
|
14
14
|
const crypto_1 = require("@loaders.gl/crypto");
|
|
15
15
|
const crypt_1 = __importDefault(require("crypt"));
|
|
16
16
|
const file_utils_2 = require("./file-utils");
|
|
17
|
+
/**
|
|
18
|
+
* Compress file to gzip file
|
|
19
|
+
*
|
|
20
|
+
* @param pathFile - the path to the file
|
|
21
|
+
* @return the path to the gzip file
|
|
22
|
+
*/
|
|
17
23
|
function compressFileWithGzip(pathFile) {
|
|
18
24
|
const compressedPathFile = `${pathFile}.gz`;
|
|
19
25
|
const gzip = (0, zlib_1.createGzip)();
|
|
@@ -32,6 +38,13 @@ function compressFileWithGzip(pathFile) {
|
|
|
32
38
|
});
|
|
33
39
|
}
|
|
34
40
|
exports.compressFileWithGzip = compressFileWithGzip;
|
|
41
|
+
/**
|
|
42
|
+
* Compress files from map into slpk file
|
|
43
|
+
*
|
|
44
|
+
* @param fileMap - map with file paths (key: output path, value: input path)
|
|
45
|
+
* @param outputFile - output slpk file
|
|
46
|
+
* @param level - compression level
|
|
47
|
+
*/
|
|
35
48
|
async function compressFilesWithZip(fileMap, outputFile, level = 0) {
|
|
36
49
|
// Before creating a new file, we need to delete the old file
|
|
37
50
|
try {
|
|
@@ -79,16 +92,33 @@ async function compressFilesWithZip(fileMap, outputFile, level = 0) {
|
|
|
79
92
|
});
|
|
80
93
|
}
|
|
81
94
|
exports.compressFilesWithZip = compressFilesWithZip;
|
|
82
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Compress files using external tool 'zip'/'7z'
|
|
97
|
+
*
|
|
98
|
+
* @param inputFolder - folder to archive - for cwd option
|
|
99
|
+
* @param outputFile - output slpk file
|
|
100
|
+
* @param level - compression level
|
|
101
|
+
* @param inputFiles - input files path to pass to the executable as option
|
|
102
|
+
* @param sevenZipExe - path to 7z.exe executable
|
|
103
|
+
*/
|
|
104
|
+
async function compressWithChildProcess(inputFolder, outputFile, level, inputFiles, sevenZipExe) {
|
|
83
105
|
// eslint-disable-next-line no-undef
|
|
84
106
|
if (process.platform === 'win32') {
|
|
85
|
-
await compressWithChildProcessWindows(
|
|
107
|
+
await compressWithChildProcessWindows(inputFolder, outputFile, level, inputFiles, sevenZipExe);
|
|
86
108
|
}
|
|
87
109
|
else {
|
|
88
|
-
await compressWithChildProcessUnix(
|
|
110
|
+
await compressWithChildProcessUnix(inputFolder, outputFile, level, inputFiles);
|
|
89
111
|
}
|
|
90
112
|
}
|
|
91
113
|
exports.compressWithChildProcess = compressWithChildProcess;
|
|
114
|
+
/**
|
|
115
|
+
* Compress files using external linux tool 'zip'
|
|
116
|
+
*
|
|
117
|
+
* @param inputFolder - folder to archive - for cwd option
|
|
118
|
+
* @param outputFile - output slpk file
|
|
119
|
+
* @param level - compression level
|
|
120
|
+
* @param inputFiles - input files path to pass to the executable as option
|
|
121
|
+
*/
|
|
92
122
|
async function compressWithChildProcessUnix(inputFolder, outputFile, level = 0, inputFiles = '.') {
|
|
93
123
|
const fullOutputFile = (0, file_utils_2.getAbsoluteFilePath)(outputFile);
|
|
94
124
|
const args = [`-${level}`, '-r', fullOutputFile, inputFiles];
|
|
@@ -102,6 +132,15 @@ async function compressWithChildProcessUnix(inputFolder, outputFile, level = 0,
|
|
|
102
132
|
wait: 0
|
|
103
133
|
});
|
|
104
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Compress files using windows external tool '7z'
|
|
137
|
+
*
|
|
138
|
+
* @param inputFolder - folder to archive - for cwd option
|
|
139
|
+
* @param outputFile - output slpk file
|
|
140
|
+
* @param level - compression level
|
|
141
|
+
* @param inputFiles - input files path to pass to the executable as option
|
|
142
|
+
* @param sevenZipExe - path to 7z.exe executable
|
|
143
|
+
*/
|
|
105
144
|
async function compressWithChildProcessWindows(inputFolder, outputFile, level = 0, inputFiles = (0, path_1.join)('.', '*'), sevenZipExe) {
|
|
106
145
|
// Workaround for @listfile issue. In 7z.exe @-leading files are handled as listfiles
|
|
107
146
|
// https://sevenzip.osdn.jp/chm/cmdline/syntax.htm
|
|
@@ -120,6 +159,13 @@ async function compressWithChildProcessWindows(inputFolder, outputFile, level =
|
|
|
120
159
|
wait: 0
|
|
121
160
|
});
|
|
122
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Generate hash file from zip archive
|
|
164
|
+
* https://github.com/Esri/i3s-spec/blob/master/docs/1.7/slpk_hashtable.cmn.md
|
|
165
|
+
*
|
|
166
|
+
* @param inputZipFile
|
|
167
|
+
* @param outputFile
|
|
168
|
+
*/
|
|
123
169
|
async function generateHash128FromZip(inputZipFile, outputFile) {
|
|
124
170
|
const input = await fs_1.promises.readFile(inputZipFile);
|
|
125
171
|
const zip = await jszip_1.default.loadAsync(input);
|
|
@@ -157,7 +203,7 @@ async function generateHash128FromZip(inputZipFile, outputFile) {
|
|
|
157
203
|
});
|
|
158
204
|
for (const key in hashTable) {
|
|
159
205
|
const item = hashTable[key];
|
|
160
|
-
const value =
|
|
206
|
+
const value = longToByteArray(item.value);
|
|
161
207
|
// TODO: perhaps you need to wait for the 'drain' event if the write returns 'false'
|
|
162
208
|
// eslint-disable-next-line no-undef
|
|
163
209
|
output.write(Buffer.from(crypt_1.default.hexToBytes(item.key).concat(value)));
|
|
@@ -166,17 +212,38 @@ async function generateHash128FromZip(inputZipFile, outputFile) {
|
|
|
166
212
|
});
|
|
167
213
|
}
|
|
168
214
|
exports.generateHash128FromZip = generateHash128FromZip;
|
|
169
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Encode 64 bit value to byte array
|
|
217
|
+
*
|
|
218
|
+
* @param long - stringified number
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
221
|
+
function longToByteArray(long) {
|
|
170
222
|
const buffer = new ArrayBuffer(8); // JS numbers are 8 bytes long, or 64 bits
|
|
171
223
|
const longNum = new Float64Array(buffer); // so equivalent to Float64
|
|
172
|
-
longNum[0] = long;
|
|
224
|
+
longNum[0] = parseInt(long);
|
|
173
225
|
return Array.from(new Uint8Array(buffer)).reverse(); // reverse to get little endian
|
|
174
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Add file to zip archive
|
|
229
|
+
*
|
|
230
|
+
* @param inputFile
|
|
231
|
+
* @param fileName
|
|
232
|
+
* @param zipFile
|
|
233
|
+
* @param sevenZipExe
|
|
234
|
+
*/
|
|
175
235
|
async function addFileToZip(inputFolder, fileName, zipFile, sevenZipExe) {
|
|
176
236
|
await compressWithChildProcess(inputFolder, zipFile, 0, fileName, sevenZipExe);
|
|
177
237
|
console.log(`${fileName} added to ${zipFile}.`); // eslint-disable-line
|
|
178
238
|
}
|
|
179
239
|
exports.addFileToZip = addFileToZip;
|
|
240
|
+
/**
|
|
241
|
+
*
|
|
242
|
+
* @param archive zip archive instance
|
|
243
|
+
* @param subFileName file path inside archive
|
|
244
|
+
* @param subFileData source file path
|
|
245
|
+
* @returns
|
|
246
|
+
*/
|
|
180
247
|
function appendFileToArchive(archive, subFileName, subFileData) {
|
|
181
248
|
return new Promise((resolve) => {
|
|
182
249
|
const fileStream = (0, fs_1.createReadStream)(subFileData);
|
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Write a file with data and name fileName to path
|
|
3
|
+
*
|
|
4
|
+
* @param path - output path
|
|
5
|
+
* @param data - file content
|
|
6
|
+
* @param fileName - name of output file (default: index.json)
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeFile(path: string, data: string | Uint8Array | ArrayBuffer | Promise<ArrayBuffer>, fileName?: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Write a file with data and name fileName to path - specific one for further packaging into slpk
|
|
11
|
+
*
|
|
12
|
+
* @param path - output path
|
|
13
|
+
* @param data - file content
|
|
14
|
+
* @param fileName - name of output file (default: index.json)
|
|
15
|
+
* @param compress - if need to compress file with gzip (default: true)
|
|
16
|
+
*/
|
|
17
|
+
export declare function writeFileForSlpk(path: string, data: string | Uint8Array | ArrayBuffer | Promise<ArrayBuffer>, fileName?: string, compress?: boolean): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Remove dir with path
|
|
20
|
+
*
|
|
21
|
+
* @param path
|
|
22
|
+
*/
|
|
23
|
+
export declare function removeDir(path: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Remove file with path
|
|
26
|
+
*
|
|
27
|
+
* @param path
|
|
28
|
+
*/
|
|
29
|
+
export declare function removeFile(path: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Generates absolute file path
|
|
32
|
+
* @param filePath
|
|
33
|
+
*/
|
|
34
|
+
export declare function getAbsoluteFilePath(filePath: string): string;
|
|
6
35
|
//# sourceMappingURL=file-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/file-utils.
|
|
1
|
+
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/file-utils.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,EAC9D,QAAQ,GAAE,MAAqB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,EAC9D,QAAQ,GAAE,MAAqB,EAC/B,QAAQ,GAAE,OAAc,GACvB,OAAO,CAAC,MAAM,CAAC,CASjB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,iBAErC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,iBAEtC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,UAEnD"}
|
|
@@ -4,11 +4,28 @@ exports.getAbsoluteFilePath = exports.removeFile = exports.removeDir = exports.w
|
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const compress_util_1 = require("./compress-util");
|
|
7
|
+
/**
|
|
8
|
+
* Write a file with data and name fileName to path
|
|
9
|
+
*
|
|
10
|
+
* @param path - output path
|
|
11
|
+
* @param data - file content
|
|
12
|
+
* @param fileName - name of output file (default: index.json)
|
|
13
|
+
*/
|
|
7
14
|
async function writeFile(path, data, fileName = 'index.json') {
|
|
15
|
+
let toWriteData;
|
|
16
|
+
if (data instanceof Promise) {
|
|
17
|
+
toWriteData = new Uint8Array(await data);
|
|
18
|
+
}
|
|
19
|
+
else if (data instanceof ArrayBuffer) {
|
|
20
|
+
toWriteData = new Uint8Array(data);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
toWriteData = data;
|
|
24
|
+
}
|
|
8
25
|
await fs_1.promises.mkdir(path, { recursive: true });
|
|
9
26
|
const pathFile = (0, path_1.join)(path, fileName);
|
|
10
27
|
try {
|
|
11
|
-
await fs_1.promises.writeFile(pathFile,
|
|
28
|
+
await fs_1.promises.writeFile(pathFile, toWriteData);
|
|
12
29
|
}
|
|
13
30
|
catch (err) {
|
|
14
31
|
throw err;
|
|
@@ -17,6 +34,14 @@ async function writeFile(path, data, fileName = 'index.json') {
|
|
|
17
34
|
return pathFile;
|
|
18
35
|
}
|
|
19
36
|
exports.writeFile = writeFile;
|
|
37
|
+
/**
|
|
38
|
+
* Write a file with data and name fileName to path - specific one for further packaging into slpk
|
|
39
|
+
*
|
|
40
|
+
* @param path - output path
|
|
41
|
+
* @param data - file content
|
|
42
|
+
* @param fileName - name of output file (default: index.json)
|
|
43
|
+
* @param compress - if need to compress file with gzip (default: true)
|
|
44
|
+
*/
|
|
20
45
|
async function writeFileForSlpk(path, data, fileName = 'index.json', compress = true) {
|
|
21
46
|
const pathFile = await writeFile(path, data, fileName);
|
|
22
47
|
if (compress) {
|
|
@@ -28,14 +53,28 @@ async function writeFileForSlpk(path, data, fileName = 'index.json', compress =
|
|
|
28
53
|
return pathFile;
|
|
29
54
|
}
|
|
30
55
|
exports.writeFileForSlpk = writeFileForSlpk;
|
|
56
|
+
/**
|
|
57
|
+
* Remove dir with path
|
|
58
|
+
*
|
|
59
|
+
* @param path
|
|
60
|
+
*/
|
|
31
61
|
function removeDir(path) {
|
|
32
62
|
return fs_1.promises.rmdir(path, { recursive: true });
|
|
33
63
|
}
|
|
34
64
|
exports.removeDir = removeDir;
|
|
65
|
+
/**
|
|
66
|
+
* Remove file with path
|
|
67
|
+
*
|
|
68
|
+
* @param path
|
|
69
|
+
*/
|
|
35
70
|
function removeFile(path) {
|
|
36
71
|
return fs_1.promises.unlink(path);
|
|
37
72
|
}
|
|
38
73
|
exports.removeFile = removeFile;
|
|
74
|
+
/**
|
|
75
|
+
* Generates absolute file path
|
|
76
|
+
* @param filePath
|
|
77
|
+
*/
|
|
39
78
|
function getAbsoluteFilePath(filePath) {
|
|
40
79
|
return (0, path_1.isAbsolute)(filePath) ? filePath : (0, path_1.join)(process.cwd(), filePath); // eslint-disable-line no-undef
|
|
41
80
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { BoundingVolumes } from '@loaders.gl/i3s';
|
|
2
|
+
import { Tile3D } from '@loaders.gl/tiles';
|
|
1
3
|
/**
|
|
2
4
|
* Do conversion from geometric error to screen threshold
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} coordinates
|
|
5
|
+
*
|
|
5
6
|
* In 3DTiles we have HLOD logic and parent tile also has bigger lodMetric value then its children.
|
|
6
7
|
* In I3s we have reverse logic related to maxError. Parent has lower maxError than its child.
|
|
7
8
|
* In nodes where are no children tile.lodMetricValue is 0. This is because of logic of HLOD in 3DTiles
|
|
@@ -11,10 +12,30 @@
|
|
|
11
12
|
* https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md
|
|
12
13
|
* To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us
|
|
13
14
|
* to make child maxError bigger than his parent maxError.
|
|
15
|
+
*
|
|
16
|
+
* @param tile - 3d-tiles tile Object
|
|
17
|
+
* @param coordinates - node converted coordinates
|
|
18
|
+
* @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection
|
|
19
|
+
* @example
|
|
20
|
+
* [
|
|
21
|
+
{
|
|
22
|
+
"metricType": "maxScreenThresholdSQ",
|
|
23
|
+
"maxError": 870638.071285568
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"metricType": "maxScreenThreshold",
|
|
27
|
+
"maxError": 1052.8679031638949
|
|
28
|
+
}
|
|
29
|
+
]
|
|
14
30
|
*/
|
|
15
|
-
export function convertGeometricErrorToScreenThreshold(tile:
|
|
31
|
+
export declare function convertGeometricErrorToScreenThreshold(tile: Tile3D, coordinates: BoundingVolumes): {
|
|
16
32
|
metricType: string;
|
|
17
33
|
maxError: number;
|
|
18
34
|
}[];
|
|
19
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Convert LOD metric from "Screen Threshold" to "Screen Space Error"
|
|
37
|
+
* @param node - i3s node data
|
|
38
|
+
* @returns lod metric in 3d-tiles format
|
|
39
|
+
*/
|
|
40
|
+
export declare function convertScreenThresholdToGeometricError(node: Tile3D): number;
|
|
20
41
|
//# sourceMappingURL=lod-conversion-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lod-conversion-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/lod-conversion-utils.
|
|
1
|
+
{"version":3,"file":"lod-conversion-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/lod-conversion-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAIzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe;gBAC9D,MAAM;cAAY,MAAM;IAqB1D;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAe3E"}
|
|
@@ -5,8 +5,7 @@ exports.convertScreenThresholdToGeometricError = exports.convertGeometricErrorTo
|
|
|
5
5
|
const DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;
|
|
6
6
|
/**
|
|
7
7
|
* Do conversion from geometric error to screen threshold
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} coordinates
|
|
8
|
+
*
|
|
10
9
|
* In 3DTiles we have HLOD logic and parent tile also has bigger lodMetric value then its children.
|
|
11
10
|
* In I3s we have reverse logic related to maxError. Parent has lower maxError than its child.
|
|
12
11
|
* In nodes where are no children tile.lodMetricValue is 0. This is because of logic of HLOD in 3DTiles
|
|
@@ -16,6 +15,21 @@ const DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;
|
|
|
16
15
|
* https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md
|
|
17
16
|
* To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us
|
|
18
17
|
* to make child maxError bigger than his parent maxError.
|
|
18
|
+
*
|
|
19
|
+
* @param tile - 3d-tiles tile Object
|
|
20
|
+
* @param coordinates - node converted coordinates
|
|
21
|
+
* @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection
|
|
22
|
+
* @example
|
|
23
|
+
* [
|
|
24
|
+
{
|
|
25
|
+
"metricType": "maxScreenThresholdSQ",
|
|
26
|
+
"maxError": 870638.071285568
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"metricType": "maxScreenThreshold",
|
|
30
|
+
"maxError": 1052.8679031638949
|
|
31
|
+
}
|
|
32
|
+
]
|
|
19
33
|
*/
|
|
20
34
|
function convertGeometricErrorToScreenThreshold(tile, coordinates) {
|
|
21
35
|
const lodSelection = [];
|
|
@@ -40,6 +54,11 @@ function convertGeometricErrorToScreenThreshold(tile, coordinates) {
|
|
|
40
54
|
return lodSelection;
|
|
41
55
|
}
|
|
42
56
|
exports.convertGeometricErrorToScreenThreshold = convertGeometricErrorToScreenThreshold;
|
|
57
|
+
/**
|
|
58
|
+
* Convert LOD metric from "Screen Threshold" to "Screen Space Error"
|
|
59
|
+
* @param node - i3s node data
|
|
60
|
+
* @returns lod metric in 3d-tiles format
|
|
61
|
+
*/
|
|
43
62
|
function convertScreenThresholdToGeometricError(node) {
|
|
44
63
|
const metricData = node.header.lodSelection.maxScreenThreshold || {};
|
|
45
64
|
let maxError = metricData.maxError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/queue.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,CAAC;IAId,OAAO,IAAI,CAAC,GAAG,SAAS;IAIxB,IAAI,IAAI,CAAC;IAIT,OAAO;CAGR"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Queue = void 0;
|
|
4
|
+
class Queue extends Array {
|
|
5
|
+
enqueue(val) {
|
|
6
|
+
this.push(val);
|
|
7
|
+
}
|
|
8
|
+
dequeue() {
|
|
9
|
+
return this.shift();
|
|
10
|
+
}
|
|
11
|
+
peek() {
|
|
12
|
+
return this[0];
|
|
13
|
+
}
|
|
14
|
+
isEmpty() {
|
|
15
|
+
return this.length === 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Queue = Queue;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function timeConverter(time: any): string;
|
|
2
|
-
export function calculateFilesSize(params: any): Promise<number | null>;
|
|
1
|
+
export declare function timeConverter(time: any): string;
|
|
2
|
+
export declare function calculateFilesSize(params: any): Promise<number | null>;
|
|
3
3
|
//# sourceMappingURL=statistic-utills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statistic-utills.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/statistic-utills.
|
|
1
|
+
{"version":3,"file":"statistic-utills.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/statistic-utills.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa,CAAC,IAAI,KAAA,UA4BjC;AAED,wBAAsB,kBAAkB,CAAC,MAAM,KAAA,0BAkB9C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Queue } from './queue';
|
|
2
|
+
export declare type WriteQueueItem = {
|
|
3
|
+
archiveKey?: string;
|
|
4
|
+
writePromise: Promise<string>;
|
|
5
|
+
};
|
|
6
|
+
export default class WriteQueue<T extends WriteQueueItem> extends Queue<T> {
|
|
7
|
+
private intervalId?;
|
|
8
|
+
writePromise: Promise<void> | null;
|
|
9
|
+
fileMap: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
12
|
+
listeningInterval: number;
|
|
13
|
+
writeConcurrency: number;
|
|
14
|
+
constructor(listeningInterval?: number, writeConcurrency?: number);
|
|
15
|
+
startListening(): void;
|
|
16
|
+
stopListening(): void;
|
|
17
|
+
startWrite(): Promise<void>;
|
|
18
|
+
finalize(): Promise<void>;
|
|
19
|
+
private doWrite;
|
|
20
|
+
private updateFileMap;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=write-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-queue.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/write-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,oBAAY,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,UAAU,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,UAAU,CAAC,CAAiB;IAC7B,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAQ;IAC1C,OAAO,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAM;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;gBAEpB,iBAAiB,GAAE,MAAa,EAAE,gBAAgB,GAAE,MAAY;IAM5E,cAAc;IAId,aAAa;IAMP,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAKjB,OAAO;IAmBrB,OAAO,CAAC,aAAa;CAStB"}
|