@loaders.gl/tile-converter 4.2.0-alpha.4 → 4.2.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +4 -4
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +349 -293
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +261 -200
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js +83 -77
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
- package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
- package/dist/constants.js +0 -1
- package/dist/converter-cli.js +257 -234
- package/dist/converter.min.cjs +95 -105
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +78 -59
- package/dist/i3s-converter/helpers/attribute-metadata-info.js +210 -153
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +146 -103
- package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
- package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +170 -105
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js +205 -212
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +17 -3
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +1189 -830
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +109 -97
- package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
- package/dist/i3s-converter/helpers/node-debug.js +98 -54
- package/dist/i3s-converter/helpers/node-index-document.d.ts +11 -4
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +255 -177
- package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +299 -193
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
- package/dist/i3s-converter/helpers/progress.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/progress.js +139 -83
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +9 -2
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js +33 -13
- package/dist/i3s-converter/i3s-converter.d.ts +7 -7
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +1165 -895
- package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
- package/dist/i3s-converter/json-templates/layers.js +120 -121
- package/dist/i3s-converter/json-templates/metadata.js +19 -20
- package/dist/i3s-converter/json-templates/node.js +73 -71
- package/dist/i3s-converter/json-templates/scene-server.js +25 -26
- package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
- package/dist/i3s-converter/json-templates/store.js +96 -94
- package/dist/i3s-converter/types.js +35 -23
- package/dist/i3s-server/app.js +15 -12
- package/dist/i3s-server/bin/i3s-server.min.cjs +69 -69
- package/dist/i3s-server/bin/www.js +16 -7
- package/dist/i3s-server/controllers/index-controller.js +18 -15
- package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
- package/dist/i3s-server/controllers/slpk-controller.js +24 -11
- package/dist/i3s-server/routes/index.js +13 -9
- package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
- package/dist/i3s-server/routes/slpk-router.js +26 -19
- package/dist/i3s-server/utils/create-scene-server.js +15 -10
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
- package/dist/i3s-server/utils/server-utils.js +52 -32
- package/dist/index.cjs +616 -967
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
- package/dist/lib/utils/cli-utils.d.ts.map +1 -1
- package/dist/lib/utils/cli-utils.js +65 -36
- package/dist/lib/utils/compress-util.js +20 -15
- package/dist/lib/utils/conversion-dump.d.ts +10 -2
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +242 -197
- package/dist/lib/utils/file-utils.d.ts +1 -1
- package/dist/lib/utils/file-utils.d.ts.map +1 -1
- package/dist/lib/utils/file-utils.js +120 -74
- package/dist/lib/utils/geometry-utils.js +13 -7
- package/dist/lib/utils/lod-conversion-utils.js +65 -33
- package/dist/lib/utils/queue.js +12 -13
- package/dist/lib/utils/statistic-utills.d.ts +6 -23
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +58 -55
- package/dist/lib/utils/write-queue.d.ts +2 -2
- package/dist/lib/utils/write-queue.d.ts.map +1 -1
- package/dist/lib/utils/write-queue.js +72 -86
- package/dist/pgm-loader.js +17 -13
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
- package/dist/slpk-extractor/slpk-extractor.js +60 -50
- package/dist/slpk-extractor-cli.d.ts.map +1 -1
- package/dist/slpk-extractor-cli.js +90 -59
- package/dist/slpk-extractor.min.cjs +1 -1
- package/package.json +27 -26
- package/src/3d-tiles-converter/3d-tiles-converter.ts +21 -10
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +1 -0
- package/src/3d-tiles-converter/helpers/load-i3s.ts +3 -27
- package/src/converter-cli.ts +4 -2
- package/src/deps-installer/deps-installer.ts +7 -0
- package/src/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -1
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +5 -2
- package/src/i3s-converter/helpers/geometry-attributes.ts +6 -5
- package/src/i3s-converter/helpers/geometry-converter.ts +118 -72
- package/src/i3s-converter/helpers/gltf-attributes.ts +12 -13
- package/src/i3s-converter/helpers/node-index-document.ts +18 -10
- package/src/i3s-converter/helpers/node-pages.ts +27 -29
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +1 -0
- package/src/i3s-converter/helpers/progress.ts +1 -0
- package/src/i3s-converter/helpers/tileset-traversal.ts +22 -13
- package/src/i3s-converter/i3s-converter.ts +173 -114
- package/src/i3s-converter/json-templates/node.ts +1 -1
- package/src/i3s-server/bin/www.ts +6 -4
- package/src/i3s-server/controllers/slpk-controller.ts +4 -2
- package/src/i3s-server/routes/index.ts +10 -7
- package/src/i3s-server/routes/slpk-router.ts +22 -16
- package/src/i3s-server/utils/server-utils.ts +6 -4
- package/src/lib/utils/cli-utils.ts +2 -0
- package/src/lib/utils/conversion-dump.ts +35 -20
- package/src/lib/utils/file-utils.ts +11 -11
- package/src/lib/utils/statistic-utills.ts +5 -6
- package/src/lib/utils/write-queue.ts +2 -2
- package/src/slpk-extractor/slpk-extractor.ts +2 -1
- package/src/slpk-extractor-cli.ts +16 -8
- package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
- package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
- package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/converter-cli.js.map +0 -1
- package/dist/deps-installer/deps-installer.js.map +0 -1
- package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
- package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
- package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
- package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
- package/dist/i3s-converter/helpers/progress.js.map +0 -1
- package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
- package/dist/i3s-converter/i3s-converter.js.map +0 -1
- package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
- package/dist/i3s-converter/json-templates/layers.js.map +0 -1
- package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
- package/dist/i3s-converter/json-templates/node.js.map +0 -1
- package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
- package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
- package/dist/i3s-converter/json-templates/store.js.map +0 -1
- package/dist/i3s-converter/types.js.map +0 -1
- package/dist/i3s-server/README.md +0 -63
- package/dist/i3s-server/app.js.map +0 -1
- package/dist/i3s-server/bin/www.js.map +0 -1
- package/dist/i3s-server/certs/cert.pem +0 -19
- package/dist/i3s-server/certs/key.pem +0 -27
- package/dist/i3s-server/controllers/index-controller.js.map +0 -1
- package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
- package/dist/i3s-server/routes/index.js.map +0 -1
- package/dist/i3s-server/routes/slpk-router.js.map +0 -1
- package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
- package/dist/i3s-server/utils/server-utils.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
- package/dist/lib/utils/cli-utils.js.map +0 -1
- package/dist/lib/utils/compress-util.js.map +0 -1
- package/dist/lib/utils/conversion-dump.js.map +0 -1
- package/dist/lib/utils/file-utils.js.map +0 -1
- package/dist/lib/utils/geometry-utils.js.map +0 -1
- package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
- package/dist/lib/utils/queue.js.map +0 -1
- package/dist/lib/utils/statistic-utills.js.map +0 -1
- package/dist/lib/utils/write-queue.js.map +0 -1
- package/dist/pgm-loader.js.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
- package/dist/slpk-extractor-cli.js.map +0 -1
- package/src/lib/utils/statistic-utills.d.ts +0 -25
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["GLTFPrimitiveModeString","AttributeType","OBJECT_ID_TYPE","STRING_TYPE","DOUBLE_TYPE","SHORT_INT_TYPE","ResourceType"],"sources":["../../src/i3s-converter/types.ts"],"sourcesContent":["import {GLTFImagePostprocessed, GLTFNodePostprocessed} from '@loaders.gl/gltf';\nimport {\n BoundingVolumes,\n I3SMaterialDefinition,\n MaterialDefinitionInfo,\n TextureDefinitionInfo\n} from '@loaders.gl/i3s';\nimport {Matrix4, Vector3} from '@math.gl/core';\n\n/** Converted resources for specific node */\nexport type I3SConvertedResources = {\n /**\n * Node id\n */\n nodeId?: number;\n /** Non-compressed geometry buffer that have structure met\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md\n * (Geometry buffer)\n */\n geometry: ArrayBuffer | null;\n /**\n * Draco compressed geometry\n */\n compressedGeometry?: Promise<ArrayBuffer> | null;\n /**\n * Texture image content\n */\n texture: any | null;\n /**\n * If the resource has uvRegions geometry attribute\n */\n hasUvRegions: boolean;\n /**\n * Shared resources built from GLTF material\n */\n sharedResources: SharedResourcesArrays | null;\n /**\n * Material definition of the node\n */\n meshMaterial?: I3SMaterialDefinition | null;\n /**\n * Number of vertices in the node\n */\n vertexCount: number | null;\n /**\n * Feature attributes contents\n */\n attributes: ArrayBuffer[] | null;\n /**\n * Number of features in the node\n */\n featureCount: number | null;\n /**\n * MBS and/or OBB bounding volumes of the node\n */\n boundingVolumes: BoundingVolumes | null;\n};\n\n/**\n * Geometry and feature attributes converted from GLTF primitives\n */\nexport type ConvertedAttributes = {\n /** POSITION attribute value */\n positions: Float32Array;\n /** NORMAL attribute value */\n normals: Float32Array;\n /** TEXCOORD_0 attribute value */\n texCoords: Float32Array;\n /** COLOR_0 attribute value */\n colors: Uint8Array;\n /** uvRegion attribute for a texture atlas */\n uvRegions: Uint16Array;\n /** Feature indices grouped by ...\n * converted from \"batch ids\" of GLTF\n */\n featureIndicesGroups?: number[][];\n /** Feature indices converted from \"batch ids\" */\n featureIndices: number[];\n /**\n * MBS and/or OBB bounding volumes of the node\n */\n boundingVolumes: null | BoundingVolumes;\n /** merged materials data */\n mergedMaterials: MergedMaterial[];\n};\n\n/** Postprocessed geometry and feature attributes\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.8/defaultGeometrySchema.cmn.md\n */\nexport type GeometryAttributes = {\n /** POSITION attribute value */\n positions: Float32Array;\n /** NORMAL attribute value */\n normals: Float32Array;\n /** TEXCOORD_0 attribute value */\n texCoords: Float32Array;\n /** COLOR_0 attribute value */\n colors: Uint8Array;\n /** uvRegion attribute for a texture atlas */\n uvRegions: Uint16Array;\n /** faceRanges attribute value */\n faceRange: Uint32Array;\n /** feature Ids attribute value */\n featureIds: number[];\n /** number of features in the node */\n featureCount: number;\n};\n\n/** Geometry attributes applicable for reordering by featureId */\nexport type GroupedAttributes = {\n /** POSITION attribute value */\n positions: Float32Array;\n /** NORMAL attribute value */\n normals: Float32Array;\n /** COLOR_0 attribute value */\n colors: Uint8Array;\n /** uvRegion attribute for a texture atlas */\n uvRegions: Uint16Array;\n /** TEXCOORD_0 attribute value */\n texCoords: Float32Array;\n};\n\n/** Geometry attributes specific for the particular feature */\nexport type GroupedByFeatureIdAttributes = GroupedAttributes & {\n /** Feature Id */\n featureId: number;\n};\n\n/** Shared resources made from GLTF material */\nexport type SharedResourcesArrays = {\n /** material definitions list https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitionInfo.cmn.md */\n materialDefinitionInfos?: MaterialDefinitionInfo[];\n /** texture definitions list https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureDefinitionInfo.cmn.md*/\n textureDefinitionInfos?: TextureDefinitionInfo[];\n /** node id to make unique SharedResource ids */\n nodePath?: string;\n};\n\n/** I3S material definition and texture content taken from GLTF material */\nexport type I3SMaterialWithTexture = {\n /** Material definition https://github.com/Esri/i3s-spec/blob/master/docs/1.8/materialDefinitions.cmn.md */\n material: I3SMaterialDefinition;\n /** Texture content (image) */\n texture?: GLTFImagePostprocessed;\n /** Metadata of all merged materials */\n mergedMaterials: MergedMaterial[];\n};\n\n/** Metadata of some original texture */\nexport type MergedMaterial = {\n /** Gltf material Id */\n originalMaterialId: string;\n /** Original texture size */\n textureSize?: {\n width: number;\n height: number;\n };\n /** Uint16Array of 4 elements https://github.com/Esri/i3s-spec/blob/master/docs/1.7/geometryUVRegion.cmn.md */\n uvRegion?: Uint16Array;\n};\n\nexport type TypedArrayConstructor =\n | Uint8ArrayConstructor\n | Int8ArrayConstructor\n | Uint16ArrayConstructor\n | Int16ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Float32ArrayConstructor\n | Float64ArrayConstructor;\n\n/**\n * glTF primitive modes (mesh topology types)\n * @see https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_mesh_primitive_mode\n */\nexport enum GLTFPrimitiveModeString {\n POINTS = 'POINTS',\n LINES = 'LINES',\n LINE_LOOP = 'LINE_LOOP',\n LINE_STRIP = 'LINE_STRIP',\n TRIANGLES = 'TRIANGLES',\n TRIANGLE_STRIP = 'TRIANGLE_STRIP',\n TRIANGLE_FAN = 'TRIANGLE_FAN'\n}\n\n/** Preprocessed data gathered from child tiles binary content */\nexport type PreprocessData = {\n /** Mesh topology types used in gltf primitives of the tileset */\n meshTopologyTypes: Set<GLTFPrimitiveModeString>;\n /**\n * Feature metadata classes found in glTF extensions\n * The tileset might contain multiple metadata classes provided by EXT_feature_metadata and EXT_structural_metadata extensions.\n * Every class is a set of properties. But I3S can consume only one set of properties.\n * On the pre-process we collect all classes from the tileset in order to show the prompt to select one class for conversion to I3S.\n */\n metadataClasses: Set<string>;\n};\n\n/** Texture image properties required for conversion */\nexport type TextureImageProperties = {\n /** Array with image data */\n data: Uint8Array;\n /** Is the texture compressed */\n compressed?: boolean;\n /** Height of the texture's image */\n height?: number;\n /** Width of the texture's image */\n width?: number;\n /** Number of components (3 for RGB, 4 for RGBA) */\n components?: number;\n /** Mime type of the texture's image */\n mimeType?: string;\n};\n\n/** glTF attributes data, prepared for conversion */\nexport type GLTFAttributesData = {\n /** glTF PBR materials (only id is required) */\n gltfMaterials?: {id: string}[];\n /** glTF geometry nodes */\n nodes: GLTFNodePostprocessed[];\n /** glTF texture images (set to null for compressed textures) */\n images: (null | TextureImageProperties)[];\n /** Source tile origin coordinates in cartographic coordinate system */\n cartographicOrigin: Vector3;\n /** Model matrix to convert coordinate system of POSITION and NORMAL attributes from METER_OFFSETS to CARTESIAN */\n cartesianModelMatrix: Matrix4;\n};\n\n/**\n * I3S' types difine the following:\n * type Attribute = 'OBJECTID' | 'string' | 'double' | 'Int32' | string;\n * The AttributeType contains the string values of the Attribute type.\n */\nexport const AttributeType = {\n /** Type of attribute that is linked with feature ids */\n OBJECT_ID_TYPE: 'OBJECTID',\n /** String data type name for feature attributes */\n STRING_TYPE: 'string',\n /** Double data type name for feature attributes */\n DOUBLE_TYPE: 'double',\n /** Integer data type name for feature attributes */\n SHORT_INT_TYPE: 'Int32'\n} as const;\n\nexport enum ResourceType {\n ATTRIBUTES = 'ATTRIBUTES',\n DRACO_GEOMETRY = 'DRACO_GEOMETRY',\n GEOMETRY = 'GEOMETRY',\n SHARED = 'SHARED',\n TEXTURE = 'TEXTURE'\n}\n"],"mappings":"AA+KA,WAAYA,uBAAuB,aAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AA0DnC,OAAO,MAAMC,aAAa,GAAG;EAE3BC,cAAc,EAAE,UAAU;EAE1BC,WAAW,EAAE,QAAQ;EAErBC,WAAW,EAAE,QAAQ;EAErBC,cAAc,EAAE;AAClB,CAAU;AAEV,WAAYC,YAAY,aAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# I3S server
|
|
2
|
-
|
|
3
|
-
The http server run on NodeJS ExpressJS framework.
|
|
4
|
-
The server provides I3S Rest endpoints per specification https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3Dobject_ReadMe.md#http-api-overview-17
|
|
5
|
-
|
|
6
|
-
## Usage
|
|
7
|
-
|
|
8
|
-
### Serve 3DTiles to I3S converted dataset
|
|
9
|
-
|
|
10
|
-
- Convert data set from 3DTiles to I3S without `--slpk` option
|
|
11
|
-
- Serve output folder
|
|
12
|
-
|
|
13
|
-
Example for path `./data/BatchTextured/SceneServer/layers/0/...`:
|
|
14
|
-
|
|
15
|
-
#### Start the server
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
PORT=8080 HTTPS_PORT=4443 I3sLayerPath="./data" DEBUG=i3s-server:* npx i3s-server
|
|
19
|
-
```
|
|
20
|
-
#### Check the layer availability
|
|
21
|
-
|
|
22
|
-
The layer should be available on URLs:
|
|
23
|
-
|
|
24
|
-
- `http://localhost:8080/BatchTextured/SceneServer/layers/0/...`
|
|
25
|
-
- `https://localhost:4443/BatchTextured/SceneServer/layers/0/...`
|
|
26
|
-
|
|
27
|
-
#### Open in ArcGIS
|
|
28
|
-
|
|
29
|
-
`https://www.arcgis.com/home/webscene/viewer.html?url=http://localhost:8080/BatchTextured/SceneServer/layers/0/`
|
|
30
|
-
|
|
31
|
-
#### Open in I3S Explorer
|
|
32
|
-
|
|
33
|
-
`https://i3s.loaders.gl/viewer?tileset=http://localhost:8080/BatchTextured/SceneServer/layers/0`
|
|
34
|
-
|
|
35
|
-
### Serve SLPK
|
|
36
|
-
|
|
37
|
-
Example for path `../datasets/Rancho_Mesh_mesh_v17_1.slpk`:
|
|
38
|
-
|
|
39
|
-
#### Start the server
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
PORT=8080 HTTPS_PORT=4443 I3sLayerPath="../datasets/Rancho_Mesh_mesh_v17_1.slpk" DEBUG=i3s-server:* npx i3s-server
|
|
43
|
-
```
|
|
44
|
-
#### Check the layer availability
|
|
45
|
-
|
|
46
|
-
The layer should be available on URLs:
|
|
47
|
-
|
|
48
|
-
- `http://localhost:8080/SceneServer/layers/0/...`
|
|
49
|
-
- `https://localhost:4443/SceneServer/layers/0/...`
|
|
50
|
-
|
|
51
|
-
#### Open in ArcGIS
|
|
52
|
-
|
|
53
|
-
`https://www.arcgis.com/home/webscene/viewer.html?url=http://localhost:8080/SceneServer`
|
|
54
|
-
|
|
55
|
-
#### Open in I3S Explorer
|
|
56
|
-
|
|
57
|
-
`https://i3s.loaders.gl/viewer?tileset=http://localhost:8080/SceneServer/layers/0`
|
|
58
|
-
|
|
59
|
-
## ENV variables
|
|
60
|
-
|
|
61
|
-
- `I3sLayerPath` - path to converted data or SLPK file.
|
|
62
|
-
- `PORT` - HTTP port. Eg for `PORT = 8080 npx i3s-server` the server will work on host `http://localhost:8080/...`. Default value is `80`;
|
|
63
|
-
- `HTTPS_PORT` - HTTPS port. Eg for `PORT = 4443 npx i3s-server` the server will work on host `https://localhost:4443/...`. Default value is `443`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","names":["express","path","logger","cors","loadArchive","router","indexRouter","sceneServerRouter","I3S_LAYER_PATH","process","env","I3sLayerPath","FULL_LAYER_PATH","join","cwd","app","use","json","urlencoded","extended","static","__dirname","test"],"sources":["../../src/i3s-server/app.ts"],"sourcesContent":["import express from 'express';\nimport path from 'path';\nimport logger from 'morgan';\nimport cors from 'cors';\n// For local debug\n// import {fileURLToPath} from 'url';\nimport {loadArchive} from './controllers/slpk-controller';\nimport {router as indexRouter} from './routes';\nimport {sceneServerRouter, router} from './routes/slpk-router';\n\n// For local debug\n// const __filename = fileURLToPath(import.meta.url);\n// const __dirname = path.dirname(__filename);\n\nconst I3S_LAYER_PATH = process.env.I3sLayerPath || ''; // eslint-disable-line no-process-env, no-undef\nconst FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH); // eslint-disable-line no-undef\n\nexport const app = express();\n\napp.use(logger('dev'));\napp.use(express.json());\napp.use(express.urlencoded({extended: false}));\napp.use(express.static(path.join(__dirname, 'public')));\napp.use(cors());\n\nif (/\\.slpk$/.test(I3S_LAYER_PATH)) {\n loadArchive(FULL_LAYER_PATH);\n app.use('/SceneServer/layers/0', router);\n app.use('/SceneServer', sceneServerRouter);\n} else {\n app.use('/', indexRouter);\n}\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,SAAS;AAC7B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAOC,IAAI,MAAM,MAAM;AAAC,SAGhBC,WAAW;AAAA,SACXC,MAAM,IAAIC,WAAW;AAAA,SACrBC,iBAAiB,EAAEF,MAAM;AAMjC,MAAMG,cAAc,GAAGC,OAAO,CAACC,GAAG,CAACC,YAAY,IAAI,EAAE;AACrD,MAAMC,eAAe,GAAGX,IAAI,CAACY,IAAI,CAACJ,OAAO,CAACK,GAAG,CAAC,CAAC,EAAEN,cAAc,CAAC;AAEhE,OAAO,MAAMO,GAAG,GAAGf,OAAO,CAAC,CAAC;AAE5Be,GAAG,CAACC,GAAG,CAACd,MAAM,CAAC,KAAK,CAAC,CAAC;AACtBa,GAAG,CAACC,GAAG,CAAChB,OAAO,CAACiB,IAAI,CAAC,CAAC,CAAC;AACvBF,GAAG,CAACC,GAAG,CAAChB,OAAO,CAACkB,UAAU,CAAC;EAACC,QAAQ,EAAE;AAAK,CAAC,CAAC,CAAC;AAC9CJ,GAAG,CAACC,GAAG,CAAChB,OAAO,CAACoB,MAAM,CAACnB,IAAI,CAACY,IAAI,CAACQ,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvDN,GAAG,CAACC,GAAG,CAACb,IAAI,CAAC,CAAC,CAAC;AAEf,IAAI,SAAS,CAACmB,IAAI,CAACd,cAAc,CAAC,EAAE;EAClCJ,WAAW,CAACQ,eAAe,CAAC;EAC5BG,GAAG,CAACC,GAAG,CAAC,uBAAuB,EAAEX,MAAM,CAAC;EACxCU,GAAG,CAACC,GAAG,CAAC,cAAc,EAAET,iBAAiB,CAAC;AAC5C,CAAC,MAAM;EACLQ,GAAG,CAACC,GAAG,CAAC,GAAG,EAAEV,WAAW,CAAC;AAC3B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"www.js","names":["app","https","http","fs","path","formErrorHandler","formListeningHandler","normalizePort","httpPort","process","env","PORT","console","error","exit","httpsPort","HTTPS_PORT","options","key","readFileSync","join","__dirname","cert","httpServer","createServer","httpsServer","listen","on"],"sources":["../../../src/i3s-server/bin/www.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport {app} from '../app';\nimport https from 'https';\nimport http from 'http';\nimport fs from 'fs';\nimport path from 'path';\n// For local debug\n// import {fileURLToPath} from 'url';\nimport {formErrorHandler, formListeningHandler, normalizePort} from '../utils/server-utils';\n\n// For local debug\n// const __filename = fileURLToPath(import.meta.url);\n// const __dirname = path.dirname(__filename);\n\n/** Get port from environment and store in Express. */\nconst httpPort = normalizePort(process.env.PORT || '80');\nif (httpPort === false) {\n console.error(`Incorrect HTTP port`);\n process.exit(1);\n}\nconst httpsPort = normalizePort(process.env.HTTPS_PORT || '443');\nif (httpsPort === false) {\n console.error(`Incorrect HTTPs port`);\n process.exit(1);\n}\n\n/** Create HTTP server. */\nconst options = {\n key: fs.readFileSync(path.join(__dirname, '../certs/key.pem')),\n cert: fs.readFileSync(path.join(__dirname, '../certs/cert.pem'))\n};\n\nconst httpServer = http.createServer(app);\nconst httpsServer = https.createServer(options, app);\n\n/** Listen on provided port, on all network interfaces. */\nhttpServer.listen(httpPort);\nhttpServer.on('error', formErrorHandler(httpPort));\nhttpServer.on('listening', formListeningHandler(httpServer));\n\nhttpsServer.listen(httpsPort);\nhttpsServer.on('error', formErrorHandler(httpsPort));\nhttpsServer.on('listening', formListeningHandler(httpsServer));\n"],"mappings":"AAAA;AAAmB,SAEXA,GAAG;AACX,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAAC,SAGhBC,gBAAgB,EAAEC,oBAAoB,EAAEC,aAAa;AAO7D,MAAMC,QAAQ,GAAGD,aAAa,CAACE,OAAO,CAACC,GAAG,CAACC,IAAI,IAAI,IAAI,CAAC;AACxD,IAAIH,QAAQ,KAAK,KAAK,EAAE;EACtBI,OAAO,CAACC,KAAK,CAAE,qBAAoB,CAAC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SE9+t0
|
|
14
|
-
CTquZMnpGfAqq6Cftmfy+TOepGiYMldQrYrCZKLwU+cqH/XnCOwwQzLOYhNwWiuk
|
|
15
|
-
6XTYPnSedGpwkMG+F4uPjEfx034tn6nSaEUqDAb3JuRP67NduCi2VoQpAoGBAO3Z
|
|
16
|
-
tBxlXKMn+JvhQDCLbYYTN6++tA4xUeptcqxiEcGBitn2Q1DVvcwHx7Uz8kL9Nfqj
|
|
17
|
-
IABirj+XwPZaqpSfgr+ltzQmhy1f2TUWUW0lVIkNetzlq/VLrL4T04euiy+TF+Zt
|
|
18
|
-
lBCfPcvhhXYz3OhOumf5y2DU0gKhmi4dUPAb4RyTAoGBAJnpkQB7HdxDAVDm8mlU
|
|
19
|
-
qdCdp3ZRPccddnJuu6lsGse4LmSud69JjdJ1f1f/xUCJc7eJpTvGvhOUY7shObMv
|
|
20
|
-
tcDWqhcDduQTVNE/UK65mHhWto5W3mVKNvyYpSM1LMVY4r/mZBGBvCTEYZP+YlSy
|
|
21
|
-
KdQLrKodJ4HmbpGDN+h5+EpxAoGANj8Xv/4yMZf1MIAgJrI2CYUqhy+kWzRObXwG
|
|
22
|
-
0mAPkqWb6HgtBCurfPQtTRuK3lJn1EEOFGhtO12+CbHGA92ZcWI3NXKwE94vaNct
|
|
23
|
-
PQptjFCBvA25uVlIDZXyAZkCb5hJtCk7wsq+ylgmGz5a3LTP+NTU2MHRH/6BbpEL
|
|
24
|
-
G6gQIHcCgYEAyLlYgrVBEbfb25eli8UTFKR/30n/BPLKef+WziKq2AunL5nJkQYX
|
|
25
|
-
9z+N6hVLq61+A1Xzp/LtWbfUH163jlT+hgPSthfAfzp7OXAYts9d9hd2r+GFVCR2
|
|
26
|
-
t1RAIqOUW5z+OHzuUO+DGiSuV9yG5vCfVZK7dn5aoAeQwixw01u+iww=
|
|
27
|
-
-----END RSA PRIVATE KEY-----
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-controller.js","names":["path","fs","promises","I3S_LAYER_PATH","process","env","I3sLayerPath","getFileNameByUrl","url","extensions","FULL_LAYER_PATH","join","cwd","ext","fileName","access"],"sources":["../../../src/i3s-server/controllers/index-controller.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\nconst {promises} = fs;\n\nconst I3S_LAYER_PATH = process.env.I3sLayerPath || '';\n\n/**\n * Get local file name by input HTTP URL\n * @param url - I3S HTTP service url\n * @returns - local file name\n */\nexport async function getFileNameByUrl(url: string): Promise<string | null> {\n const extensions = ['json', 'bin', 'jpg', 'jpeg', 'png', 'bin.dds', 'ktx2'];\n const FULL_LAYER_PATH = path.join(process.cwd(), I3S_LAYER_PATH);\n for (const ext of extensions) {\n const fileName = `${FULL_LAYER_PATH}${url}/index.${ext}`;\n try {\n await promises.access(fileName);\n return fileName;\n } catch {\n continue; // eslint-disable-line no-continue\n }\n }\n return null;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AAEnB,MAAM;EAACC;AAAQ,CAAC,GAAGD,EAAE;AAErB,MAAME,cAAc,GAAGC,OAAO,CAACC,GAAG,CAACC,YAAY,IAAI,EAAE;AAOrD,OAAO,eAAeC,gBAAgBA,CAACC,GAAW,EAA0B;EAC1E,MAAMC,UAAU,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC;EAC3E,MAAMC,eAAe,GAAGV,IAAI,CAACW,IAAI,CAACP,OAAO,CAACQ,GAAG,CAAC,CAAC,EAAET,cAAc,CAAC;EAChE,KAAK,MAAMU,GAAG,IAAIJ,UAAU,EAAE;IAC5B,MAAMK,QAAQ,GAAI,GAAEJ,eAAgB,GAAEF,GAAI,UAASK,GAAI,EAAC;IACxD,IAAI;MACF,MAAMX,QAAQ,CAACa,MAAM,CAACD,QAAQ,CAAC;MAC/B,OAAOA,QAAQ;IACjB,CAAC,CAAC,MAAM;MACN;IACF;EACF;EACA,OAAO,IAAI;AACb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slpk-controller.js","names":["parseSLPKArchive","FileHandleFile","slpkArchive","loadArchive","fullLayerPath","msg","console","log","getFileByUrl","url","trimmedPath","exec","uncompressedFile","getFile"],"sources":["../../../src/i3s-server/controllers/slpk-controller.ts"],"sourcesContent":["import '@loaders.gl/polyfills';\nimport {parseSLPKArchive, SLPKArchive} from '@loaders.gl/i3s';\nimport {FileHandleFile} from '@loaders.gl/loader-utils';\n\nlet slpkArchive: SLPKArchive;\n\n/**\n * Open SLPK file for reading and load HASH file\n * @param fullLayerPath - full path to SLPK file\n */\nexport async function loadArchive(fullLayerPath: string): Promise<void> {\n slpkArchive = await parseSLPKArchive(new FileHandleFile(fullLayerPath), (msg) =>\n console.log(msg)\n );\n console.log('The server is ready to use');\n}\n\n/**\n * Get a file from SLPK\n * @param url - I3S HTTP URL\n * @returns - file content\n */\nexport async function getFileByUrl(url: string): Promise<ArrayBuffer | null> {\n const trimmedPath = /^\\/?(.*)\\/?$/.exec(url);\n if (trimmedPath) {\n try {\n const uncompressedFile = await slpkArchive.getFile(trimmedPath[1], 'http');\n return uncompressedFile;\n } catch {\n // TODO - log error?\n }\n }\n return null;\n}\n"],"mappings":"AAAA,OAAO,uBAAuB;AAC9B,SAAQA,gBAAgB,QAAoB,iBAAiB;AAC7D,SAAQC,cAAc,QAAO,0BAA0B;AAEvD,IAAIC,WAAwB;AAM5B,OAAO,eAAeC,WAAWA,CAACC,aAAqB,EAAiB;EACtEF,WAAW,GAAG,MAAMF,gBAAgB,CAAC,IAAIC,cAAc,CAACG,aAAa,CAAC,EAAGC,GAAG,IAC1EC,OAAO,CAACC,GAAG,CAACF,GAAG,CACjB,CAAC;EACDC,OAAO,CAACC,GAAG,CAAC,4BAA4B,CAAC;AAC3C;AAOA,OAAO,eAAeC,YAAYA,CAACC,GAAW,EAA+B;EAC3E,MAAMC,WAAW,GAAG,cAAc,CAACC,IAAI,CAACF,GAAG,CAAC;EAC5C,IAAIC,WAAW,EAAE;IACf,IAAI;MACF,MAAME,gBAAgB,GAAG,MAAMV,WAAW,CAACW,OAAO,CAACH,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;MAC1E,OAAOE,gBAAgB;IACzB,CAAC,CAAC,MAAM,CAER;EACF;EACA,OAAO,IAAI;AACb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["express","getFileNameByUrl","router","Router","get","req","res","next","fileName","path","sendFile","status","send"],"sources":["../../../src/i3s-server/routes/index.ts"],"sourcesContent":["import express from 'express';\nimport {getFileNameByUrl} from '../controllers/index-controller';\n\nexport const router = express.Router();\n\n/* GET home page. */\nrouter.get('*', async function (req, res, next) {\n const fileName = await getFileNameByUrl(req.path);\n if (fileName) {\n res.sendFile(fileName);\n } else {\n res.status(404);\n res.send('File not found');\n }\n});\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,SAAS;AAAC,SACtBC,gBAAgB;AAExB,OAAO,MAAMC,MAAM,GAAGF,OAAO,CAACG,MAAM,CAAC,CAAC;AAGtCD,MAAM,CAACE,GAAG,CAAC,GAAG,EAAE,gBAAgBC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAE;EAC9C,MAAMC,QAAQ,GAAG,MAAMP,gBAAgB,CAACI,GAAG,CAACI,IAAI,CAAC;EACjD,IAAID,QAAQ,EAAE;IACZF,GAAG,CAACI,QAAQ,CAACF,QAAQ,CAAC;EACxB,CAAC,MAAM;IACLF,GAAG,CAACK,MAAM,CAAC,GAAG,CAAC;IACfL,GAAG,CAACM,IAAI,CAAC,gBAAgB,CAAC;EAC5B;AACF,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slpk-router.js","names":["express","getFileByUrl","createSceneServer","textDecoder","TextDecoder","sceneServerRouter","Router","get","req","res","next","file","layer","JSON","parse","decode","sceneServerResponse","name","send","status","router","path","replace","Buffer","from"],"sources":["../../../src/i3s-server/routes/slpk-router.ts"],"sourcesContent":["import express from 'express';\nimport {getFileByUrl} from '../controllers/slpk-controller';\nimport {createSceneServer} from '../utils/create-scene-server';\n\nconst textDecoder = new TextDecoder();\n\nexport const sceneServerRouter = express.Router();\nsceneServerRouter.get('*', async function (req, res, next) {\n const file = await getFileByUrl('/');\n if (file) {\n const layer = JSON.parse(textDecoder.decode(file));\n const sceneServerResponse = createSceneServer(layer.name, layer);\n res.send(sceneServerResponse);\n } else {\n res.status(404);\n res.send('File not found');\n }\n});\n\nexport const router = express.Router();\nrouter.get('*', async function (req, res, next) {\n const file = await getFileByUrl(req.path.replace(/\\/+$/, ''));\n if (file) {\n res.send(Buffer.from(file));\n } else {\n res.status(404);\n res.send('File not found');\n }\n});\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,SAAS;AAAC,SACtBC,YAAY;AAAA,SACZC,iBAAiB;AAEzB,MAAMC,WAAW,GAAG,IAAIC,WAAW,CAAC,CAAC;AAErC,OAAO,MAAMC,iBAAiB,GAAGL,OAAO,CAACM,MAAM,CAAC,CAAC;AACjDD,iBAAiB,CAACE,GAAG,CAAC,GAAG,EAAE,gBAAgBC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAE;EACzD,MAAMC,IAAI,GAAG,MAAMV,YAAY,CAAC,GAAG,CAAC;EACpC,IAAIU,IAAI,EAAE;IACR,MAAMC,KAAK,GAAGC,IAAI,CAACC,KAAK,CAACX,WAAW,CAACY,MAAM,CAACJ,IAAI,CAAC,CAAC;IAClD,MAAMK,mBAAmB,GAAGd,iBAAiB,CAACU,KAAK,CAACK,IAAI,EAAEL,KAAK,CAAC;IAChEH,GAAG,CAACS,IAAI,CAACF,mBAAmB,CAAC;EAC/B,CAAC,MAAM;IACLP,GAAG,CAACU,MAAM,CAAC,GAAG,CAAC;IACfV,GAAG,CAACS,IAAI,CAAC,gBAAgB,CAAC;EAC5B;AACF,CAAC,CAAC;AAEF,OAAO,MAAME,MAAM,GAAGpB,OAAO,CAACM,MAAM,CAAC,CAAC;AACtCc,MAAM,CAACb,GAAG,CAAC,GAAG,EAAE,gBAAgBC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAE;EAC9C,MAAMC,IAAI,GAAG,MAAMV,YAAY,CAACO,GAAG,CAACa,IAAI,CAACC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;EAC7D,IAAIX,IAAI,EAAE;IACRF,GAAG,CAACS,IAAI,CAACK,MAAM,CAACC,IAAI,CAACb,IAAI,CAAC,CAAC;EAC7B,CAAC,MAAM;IACLF,GAAG,CAACU,MAAM,CAAC,GAAG,CAAC;IACfV,GAAG,CAACS,IAAI,CAAC,gBAAgB,CAAC;EAC5B;AACF,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-scene-server.js","names":["v4","uuidv4","createSceneServer","name","layer","serviceItemId","replace","serviceName","currentVersion","serviceVersion","supportedBindings","layers"],"sources":["../../../src/i3s-server/utils/create-scene-server.ts"],"sourcesContent":["import {SceneLayer3D} from '@loaders.gl/i3s';\nimport {v4 as uuidv4} from 'uuid';\n\n/**\n * Create `/SceneServer` response\n * @param name - service name, custom user-friendly name of the service\n * @param layer - I3S layer JSON\n * @returns reponse JSON for `/SceneServer` route\n */\nexport const createSceneServer = (name: string, layer: SceneLayer3D) => {\n return {\n serviceItemId: uuidv4().replace(/-/gi, ''),\n serviceName: name,\n name,\n currentVersion: '10.7',\n serviceVersion: '1.8',\n supportedBindings: ['REST'],\n layers: [layer]\n };\n};\n"],"mappings":"AACA,SAAQA,EAAE,IAAIC,MAAM,QAAO,MAAM;AAQjC,OAAO,MAAMC,iBAAiB,GAAGA,CAACC,IAAY,EAAEC,KAAmB,KAAK;EACtE,OAAO;IACLC,aAAa,EAAEJ,MAAM,CAAC,CAAC,CAACK,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAC1CC,WAAW,EAAEJ,IAAI;IACjBA,IAAI;IACJK,cAAc,EAAE,MAAM;IACtBC,cAAc,EAAE,KAAK;IACrBC,iBAAiB,EAAE,CAAC,MAAM,CAAC;IAC3BC,MAAM,EAAE,CAACP,KAAK;EAChB,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.js","names":["debugFactory","debug","normalizePort","val","chkPort","parseInt","Number","isNaN","formErrorHandler","optionalPort","onError","error","syscall","bind","code","console","process","exit","formListeningHandler","optionalServer","onListening","addr","address","port"],"sources":["../../../src/i3s-server/utils/server-utils.ts"],"sourcesContent":["import type {Server as HttpsServer} from 'https';\nimport type {Server as HttpServer} from 'http';\n\nimport debugFactory from 'debug';\nconst debug = debugFactory('i3s-server:server');\n\n/**\n * Normalize a port into a number, string, or false.\n * @param val - port value from env variables\n * @returns - `number` for port, `string` for a named pipe, or `false` if the port number is not correct\n */\nexport function normalizePort(val: string): number | string | false {\n const chkPort = parseInt(val, 10);\n\n if (Number.isNaN(chkPort)) {\n // named pipe\n return val;\n }\n\n if (chkPort >= 0) {\n // port number\n return chkPort;\n }\n\n return false;\n}\n\n/**\n * Event listener creator for HTTP/HTTPS server \"error\" event.\n * @param optionalPort - the port/named pipe the server is started on\n * @return callback to handle server errors\n */\nexport function formErrorHandler(\n optionalPort: string | number\n): (error: NodeJS.ErrnoException) => void {\n return function onError(error: NodeJS.ErrnoException) {\n if (error.syscall !== 'listen') {\n throw error;\n }\n\n const bind = typeof optionalPort === 'string' ? `Pipe ${optionalPort}` : `Port ${optionalPort}`;\n\n // handle specific listen errors with friendly messages\n switch (error.code) {\n case 'EACCES':\n console.error(`${bind} requires elevated privileges`); // eslint-disable-line no-console, no-undef\n process.exit(1); // eslint-disable-line no-process-exit, no-undef\n break;\n case 'EADDRINUSE':\n console.error(`${bind} is already in use`); // eslint-disable-line no-console, no-undef\n process.exit(1); // eslint-disable-line no-process-exit, no-undef\n break;\n default:\n throw error;\n }\n };\n}\n\n/**\n * Event listener for HTTP/HTTPS server \"listening\" event.\n * @param optionalServer - http or https NodeJS server\n * @return callback that is triggered when the server has started\n */\nexport function formListeningHandler(optionalServer: HttpsServer | HttpServer): () => void {\n return function onListening() {\n const addr = optionalServer.address();\n const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr?.port}`;\n debug(`Listening on ${bind}`);\n };\n}\n"],"mappings":"AAGA,OAAOA,YAAY,MAAM,OAAO;AAChC,MAAMC,KAAK,GAAGD,YAAY,CAAC,mBAAmB,CAAC;AAO/C,OAAO,SAASE,aAAaA,CAACC,GAAW,EAA2B;EAClE,MAAMC,OAAO,GAAGC,QAAQ,CAACF,GAAG,EAAE,EAAE,CAAC;EAEjC,IAAIG,MAAM,CAACC,KAAK,CAACH,OAAO,CAAC,EAAE;IAEzB,OAAOD,GAAG;EACZ;EAEA,IAAIC,OAAO,IAAI,CAAC,EAAE;IAEhB,OAAOA,OAAO;EAChB;EAEA,OAAO,KAAK;AACd;AAOA,OAAO,SAASI,gBAAgBA,CAC9BC,YAA6B,EACW;EACxC,OAAO,SAASC,OAAOA,CAACC,KAA4B,EAAE;IACpD,IAAIA,KAAK,CAACC,OAAO,KAAK,QAAQ,EAAE;MAC9B,MAAMD,KAAK;IACb;IAEA,MAAME,IAAI,GAAG,OAAOJ,YAAY,KAAK,QAAQ,GAAI,QAAOA,YAAa,EAAC,GAAI,QAAOA,YAAa,EAAC;IAG/F,QAAQE,KAAK,CAACG,IAAI;MAChB,KAAK,QAAQ;QACXC,OAAO,CAACJ,KAAK,CAAE,GAAEE,IAAK,+BAA8B,CAAC;QACrDG,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;QACf;MACF,KAAK,YAAY;QACfF,OAAO,CAACJ,KAAK,CAAE,GAAEE,IAAK,oBAAmB,CAAC;QAC1CG,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;QACf;MACF;QACE,MAAMN,KAAK;IACf;EACF,CAAC;AACH;AAOA,OAAO,SAASO,oBAAoBA,CAACC,cAAwC,EAAc;EACzF,OAAO,SAASC,WAAWA,CAAA,EAAG;IAC5B,MAAMC,IAAI,GAAGF,cAAc,CAACG,OAAO,CAAC,CAAC;IACrC,MAAMT,IAAI,GAAG,OAAOQ,IAAI,KAAK,QAAQ,GAAI,QAAOA,IAAK,EAAC,GAAI,QAAOA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,IAAK,EAAC;IAC7EtB,KAAK,CAAE,gBAAeY,IAAK,EAAC,CAAC;EAC/B,CAAC;AACH"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","I3SConverter","Tiles3DConverter"],"sources":["../src/index.ts"],"sourcesContent":["export {default as I3SConverter} from './i3s-converter/i3s-converter';\nexport {default as Tiles3DConverter} from './3d-tiles-converter/3d-tiles-converter';\n"],"mappings":"SAAQA,OAAO,IAAIC,YAAY;AAAA,SACvBD,OAAO,IAAIE,gBAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversion-dump-json-schema.js","names":["dumpJsonSchema","type","properties","options","inputUrl","outputPath","tilesetName","maxDepth","slpk","egmFilePath","token","draco","mergeMaterials","generateTextures","generateBoundingVolumes","metadataClass","analyze","required","tilesConverted","patternProperties","nodes","items","nodeId","done","progress","dumpMetadata","boundingVolumes","mbs","minItems","maxItems","obb","center","halfSize","quaternion","attributesCount","featureCount","geometry","hasUvRegions","materialId","texelCountHint","vertexCount","textureSetDefinitions","formats","name","format","enum","atlas","attributeMetadataInfo","attributeStorageInfo","key","header","property","valueType","ordering","attributeValues","$ref","attributeByteCounts","objectIds","fields","alias","domain","popupInfo","title","description","expressionInfos","fieldInfos","mediaInfos","popupElements","text","materialDefinitions","pbrMetallicRoughness","baseColorFactor","baseColorTexture","metallicFactor","roughnessFactor","metallicRoughnessTexture","normalTexture","occlusionTexture","emissiveTexture","emissiveFactor","alphaMode","alphaCutoff","doubleSided","cullFace","$defs","AttributeValue","encoding","valuesPerElement","ESRIField","Domain","fieldType","range","codedValues","code","mergePolicy","splitPolicy","FieldInfo","fieldName","visible","isEditable","label","I3SMaterialTexture","textureSetDefinitionId","texCoord","factor"],"sources":["../../../src/lib/json-schemas/conversion-dump-json-schema.ts"],"sourcesContent":["export const dumpJsonSchema = {\n type: 'object',\n properties: {\n options: {\n type: 'object',\n properties: {\n inputUrl: {type: 'string'},\n outputPath: {type: 'string'},\n tilesetName: {type: 'string'},\n maxDepth: {type: 'number'},\n slpk: {type: 'boolean'},\n egmFilePath: {type: 'string'},\n token: {type: 'string'},\n draco: {type: 'boolean'},\n mergeMaterials: {type: 'boolean'},\n generateTextures: {type: 'boolean'},\n generateBoundingVolumes: {type: 'boolean'},\n metadataClass: {type: 'string'},\n analyze: {type: 'boolean'}\n },\n required: ['inputUrl', 'outputPath', 'tilesetName']\n },\n tilesConverted: {\n type: 'object',\n patternProperties: {\n '.*': {\n type: 'object',\n properties: {\n nodes: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n nodeId: {type: ['number', 'string']},\n done: {type: 'boolean'},\n progress: {type: 'object', patternProperties: {'.*': {type: 'boolean'}}},\n dumpMetadata: {\n type: 'object',\n properties: {\n boundingVolumes: {\n type: ['object', 'null'],\n properties: {\n mbs: {\n type: 'array',\n minItems: 4,\n maxItems: 4,\n items: {type: 'number'}\n },\n obb: {\n type: 'object',\n properties: {\n center: {\n type: 'array',\n minItems: 3,\n maxItems: 3,\n items: {type: 'number'}\n },\n halfSize: {\n type: 'array',\n minItems: 3,\n maxItems: 3,\n items: {type: 'number'}\n },\n quaternion: {\n type: 'array',\n minItems: 4,\n maxItems: 4,\n items: {type: 'number'}\n }\n },\n required: ['center', 'halfSize', 'quaternion']\n }\n },\n required: ['mbs', 'obb']\n },\n attributesCount: {type: 'number'},\n featureCount: {type: 'number'},\n geometry: {type: 'boolean'},\n hasUvRegions: {type: 'boolean'},\n materialId: {type: 'number'},\n texelCountHint: {type: 'number'},\n vertexCount: {type: 'number'}\n },\n required: [\n 'boundingVolumes',\n 'featureCount',\n 'geometry',\n 'hasUvRegions',\n 'materialId',\n 'vertexCount'\n ]\n }\n },\n required: ['nodeId', 'done']\n }\n }\n },\n required: ['nodes']\n }\n }\n },\n textureSetDefinitions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n formats: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: {type: 'string'},\n format: {enum: ['jpg', 'png', 'ktx-etc2', 'dds', 'ktx2']}\n },\n required: ['name', 'format']\n }\n },\n atlas: {type: 'boolean'}\n },\n required: ['formats']\n }\n },\n attributeMetadataInfo: {\n type: 'object',\n properties: {\n attributeStorageInfo: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n key: {type: 'string'},\n name: {type: 'string'},\n header: {\n type: 'array',\n items: {\n type: 'object',\n properties: {property: {type: 'string'}, valueType: {type: 'string'}},\n required: ['property', 'valueType']\n }\n },\n ordering: {type: 'array', items: {type: 'string'}},\n attributeValues: {$ref: '#/$defs/AttributeValue'},\n attributeByteCounts: {$ref: '#/$defs/AttributeValue'},\n objectIds: {$ref: '#/$defs/AttributeValue'}\n },\n required: ['key', 'name', 'header']\n }\n },\n fields: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n name: {type: 'string'},\n type: {$ref: '#/$defs/ESRIField'},\n alias: {type: 'string'},\n domain: {$ref: '#/$defs/Domain'}\n },\n required: ['name', 'type']\n }\n },\n popupInfo: {\n type: 'object',\n properties: {\n title: {type: 'string'},\n description: {type: 'string'},\n expressionInfos: {type: 'array', items: {}},\n fieldInfos: {type: 'array', items: {$ref: '#/$defs/FieldInfo'}},\n mediaInfos: {type: 'array', items: {}},\n popupElements: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n text: {type: 'string'},\n type: {type: 'string'},\n fieldInfos: {type: 'array', items: {$ref: '#/$defs/FieldInfo'}}\n }\n }\n }\n }\n }\n },\n required: ['attributeStorageInfo', 'fields']\n },\n materialDefinitions: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n pbrMetallicRoughness: {\n type: 'object',\n properties: {\n baseColorFactor: {\n type: 'array',\n minItems: 4,\n maxItems: 4,\n items: {type: 'number'}\n },\n baseColorTexture: {$ref: '#/$defs/I3SMaterialTexture'},\n metallicFactor: {type: 'number'},\n roughnessFactor: {type: 'number'},\n metallicRoughnessTexture: {$ref: '#/$defs/I3SMaterialTexture'}\n },\n required: ['metallicFactor', 'roughnessFactor']\n },\n normalTexture: {$ref: '#/$defs/I3SMaterialTexture'},\n occlusionTexture: {$ref: '#/$defs/I3SMaterialTexture'},\n emissiveTexture: {$ref: '#/$defs/I3SMaterialTexture'},\n emissiveFactor: {type: 'array', minItems: 3, maxItems: 3, items: {type: 'number'}},\n alphaMode: {enum: ['opaque', 'mask', 'blend']},\n alphaCutoff: {type: 'number'},\n doubleSided: {type: 'boolean'},\n cullFace: {enum: ['none', 'front', 'back']}\n },\n required: ['pbrMetallicRoughness', 'alphaMode']\n }\n }\n },\n required: ['options', 'tilesConverted'],\n $defs: {\n AttributeValue: {\n type: 'object',\n properties: {\n valueType: {type: 'string'},\n encoding: {type: 'string'},\n valuesPerElement: {type: 'number'}\n },\n required: ['valueType']\n },\n ESRIField: {\n enum: [\n 'esriFieldTypeDate',\n 'esriFieldTypeSingle',\n 'esriFieldTypeDouble',\n 'esriFieldTypeGUID',\n 'esriFieldTypeGlobalID',\n 'esriFieldTypeInteger',\n 'esriFieldTypeOID',\n 'esriFieldTypeSmallInteger',\n 'esriFieldTypeString'\n ]\n },\n Domain: {\n type: 'object',\n properties: {\n type: {type: 'string'},\n name: {type: 'string'},\n description: {type: 'string'},\n fieldType: {type: 'string'},\n range: {type: 'array', items: {type: 'number'}},\n codedValues: {\n type: 'array',\n items: {\n type: 'object',\n properties: {name: {type: 'string'}, code: {type: ['string', 'number']}},\n required: ['name', 'code']\n }\n },\n mergePolicy: {type: 'string'},\n splitPolicy: {type: 'string'}\n },\n required: ['type', 'name']\n },\n FieldInfo: {\n type: 'object',\n properties: {\n fieldName: {type: 'string'},\n visible: {type: 'boolean'},\n isEditable: {type: 'boolean'},\n label: {type: 'string'}\n },\n required: ['fieldName', 'visible', 'isEditable', 'label']\n },\n I3SMaterialTexture: {\n type: 'object',\n properties: {\n textureSetDefinitionId: {type: 'number'},\n texCoord: {type: 'number'},\n factor: {type: 'number'}\n },\n required: ['textureSetDefinitionId']\n }\n }\n};\n"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GAAG;EAC5BC,IAAI,EAAE,QAAQ;EACdC,UAAU,EAAE;IACVC,OAAO,EAAE;MACPF,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAE;QACVE,QAAQ,EAAE;UAACH,IAAI,EAAE;QAAQ,CAAC;QAC1BI,UAAU,EAAE;UAACJ,IAAI,EAAE;QAAQ,CAAC;QAC5BK,WAAW,EAAE;UAACL,IAAI,EAAE;QAAQ,CAAC;QAC7BM,QAAQ,EAAE;UAACN,IAAI,EAAE;QAAQ,CAAC;QAC1BO,IAAI,EAAE;UAACP,IAAI,EAAE;QAAS,CAAC;QACvBQ,WAAW,EAAE;UAACR,IAAI,EAAE;QAAQ,CAAC;QAC7BS,KAAK,EAAE;UAACT,IAAI,EAAE;QAAQ,CAAC;QACvBU,KAAK,EAAE;UAACV,IAAI,EAAE;QAAS,CAAC;QACxBW,cAAc,EAAE;UAACX,IAAI,EAAE;QAAS,CAAC;QACjCY,gBAAgB,EAAE;UAACZ,IAAI,EAAE;QAAS,CAAC;QACnCa,uBAAuB,EAAE;UAACb,IAAI,EAAE;QAAS,CAAC;QAC1Cc,aAAa,EAAE;UAACd,IAAI,EAAE;QAAQ,CAAC;QAC/Be,OAAO,EAAE;UAACf,IAAI,EAAE;QAAS;MAC3B,CAAC;MACDgB,QAAQ,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa;IACpD,CAAC;IACDC,cAAc,EAAE;MACdjB,IAAI,EAAE,QAAQ;MACdkB,iBAAiB,EAAE;QACjB,IAAI,EAAE;UACJlB,IAAI,EAAE,QAAQ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F,IAAI,EAAE;QAAQ,CAAC;QAC7B8F,WAAW,EAAE;UAAC9F,IAAI,EAAE;QAAQ;MAC9B,CAAC;MACDgB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM;IAC3B,CAAC;IACD+E,SAAS,EAAE;MACT/F,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAE;QACV+F,SAAS,EAAE;UAAChG,IAAI,EAAE;QAAQ,CAAC;QAC3BiG,OAAO,EAAE;UAACjG,IAAI,EAAE;QAAS,CAAC;QAC1BkG,UAAU,EAAE;UAAClG,IAAI,EAAE;QAAS,CAAC;QAC7BmG,KAAK,EAAE;UAACnG,IAAI,EAAE;QAAQ;MACxB,CAAC;MACDgB,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO;IAC1D,CAAC;IACDoF,kBAAkB,EAAE;MAClBpG,IAAI,EAAE,QAAQ;MACdC,UAAU,EAAE;QACVoG,sBAAsB,EAAE;UAACrG,IAAI,EAAE;QAAQ,CAAC;QACxCsG,QAAQ,EAAE;UAACtG,IAAI,EAAE;QAAQ,CAAC;QAC1BuG,MAAM,EAAE;UAACvG,IAAI,EAAE;QAAQ;MACzB,CAAC;MACDgB,QAAQ,EAAE,CAAC,wBAAwB;IACrC;EACF;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-utils.js","names":["getStringValue","index","args","length","value","indexOf","getURLValue","console","log","replace","validateOptionsWithEqual","reduce","acc","curr","equalSignIndex","beforeEqual","slice","afterEqual","condition","includes","startsWith","concat","getIntegerValue","stringValue","result","Number","parseInt","isFinite","NaN","getBooleanValue","toLowerCase","trim"],"sources":["../../../src/lib/utils/cli-utils.ts"],"sourcesContent":["/**\n * Get string option value from cli arguments\n * @param index - option's name index in the argument's array.\n * The value of the option should be next to name of the option.\n * @param args - cli arguments array\n * @returns - string value of the option\n */\nexport function getStringValue(index: number, args: string[]): string {\n if (index + 1 >= args.length) {\n return '';\n }\n const value = args[index + 1];\n if (value.indexOf('--') === 0) {\n return '';\n }\n return value;\n}\n\n/**\n * Modyfy URL path to be compatible with fetch\n * @param index - option's name index in the argument's array.\n * The value of the option should be next to name of the option.\n * @param args - cli arguments array\n * @returns - string value of the option\n */\nexport function getURLValue(index: number, args: string[]): string {\n const value = getStringValue(index, args);\n console.log(`Input tileset value: ${value}`);\n console.log(`Modified tileset value: ${value.replace(/\\\\/g, '/')}`);\n return value.replace(/\\\\/g, '/');\n}\n\nexport function validateOptionsWithEqual(args: string[]): string[] {\n return args.reduce((acc: string[], curr) => {\n const equalSignIndex = curr.indexOf('=');\n const beforeEqual = curr.slice(0, equalSignIndex);\n const afterEqual = curr.slice(equalSignIndex + 1, curr.length);\n const condition = curr.includes('=') && curr.startsWith('--') && afterEqual;\n if (condition) {\n return acc.concat(beforeEqual, afterEqual);\n }\n return acc.concat(curr);\n }, []);\n}\n\n/**\n * Get integer option value from cli arguments\n * @param index - option's name index in the argument's array\n * The value of the option should be next to name of the option.\n * @param args - cli arguments array\n * @returns - number value of the option\n */\nexport function getIntegerValue(index: number, args: string[]): number {\n const stringValue: string = getStringValue(index, args);\n const result: number = Number.parseInt(stringValue);\n if (isFinite(result)) {\n return result;\n }\n return NaN;\n}\n\n/**\n * Get boolean option value from cli arguments\n * @param index - option's name index in the argument's array\n * The value of the option should be next to name of the option.\n * @param args - cli arguments array\n * @returns - boolean value of the option\n */\nexport function getBooleanValue(index: number, args: string[]): boolean {\n const stringValue: string = getStringValue(index, args).toLowerCase().trim();\n if (['--no-draco', '--split-nodes'].includes(args[index]) && !stringValue) {\n return false;\n }\n if (!stringValue || stringValue === 'true') {\n return true;\n }\n return false;\n}\n"],"mappings":"AAOA,OAAO,SAASA,cAAcA,CAACC,KAAa,EAAEC,IAAc,EAAU;EACpE,IAAID,KAAK,GAAG,CAAC,IAAIC,IAAI,CAACC,MAAM,EAAE;IAC5B,OAAO,EAAE;EACX;EACA,MAAMC,KAAK,GAAGF,IAAI,CAAC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AAc,CAACC,KAAK,EAAEC,IAAI,CAAC;EACvD,MAAMsB,MAAc,GAAGC,MAAM,CAACC,QAAQ,CAACH,WAAW,CAAC;EACnD,IAAII,QAAQ,CAACH,MAAM,CAAC,EAAE;IACpB,OAAOA,MAAM;EACf;EACA,OAAOI,GAAG;AACZ;AASA,OAAO,SAASC,eAAeA,CAAC5B,KAAa,EAAEC,IAAc,EAAW;EACtE,MAAMqB,WAAmB,GAAGvB,cAAc,CAACC,KAAK,EAAEC,IAAI,CAAC,CAAC4B,WAAW,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC;EAC5E,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAACZ,QAAQ,CAACjB,IAAI,CAACD,KAAK,CAAC,CAAC,IAAI,CAACsB,WAAW,EAAE;IACzE,OAAO,KAAK;EACd;EACA,IAAI,CAACA,WAAW,IAAIA,WAAW,KAAK,MAAM,EAAE;IAC1C,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compress-util.js","names":["createGzip","createReadStream","createWriteStream","compressFileWithGzip","pathFile","compressedPathFile","gzip","input","output","Promise","resolve","reject","on","console","log","error","pipe"],"sources":["../../../src/lib/utils/compress-util.ts"],"sourcesContent":["import {createGzip} from 'zlib';\nimport {createReadStream, createWriteStream} from 'fs';\n\n/**\n * Compress file to gzip file\n *\n * @param pathFile - the path to the file\n * @return the path to the gzip file\n */\nexport function compressFileWithGzip(pathFile: string): Promise<string> {\n const compressedPathFile = `${pathFile}.gz`;\n const gzip = createGzip();\n const input = createReadStream(pathFile);\n const output = createWriteStream(compressedPathFile);\n\n return new Promise((resolve, reject) => {\n input.on('end', () => {\n console.log(`${compressedPathFile} compressed and saved.`); // eslint-disable-line no-undef,no-console\n resolve(compressedPathFile);\n });\n input.on('error', (error) => {\n console.log(`${compressedPathFile}: compression error!`); // eslint-disable-line no-undef,no-console\n reject(error);\n });\n input.pipe(gzip).pipe(output);\n });\n}\n"],"mappings":"AAAA,SAAQA,UAAU,QAAO,MAAM;AAC/B,SAAQC,gBAAgB,EAAEC,iBAAiB,QAAO,IAAI;AAQtD,OAAO,SAASC,oBAAoBA,CAACC,QAAgB,EAAmB;EACtE,MAAMC,kBAAkB,GAAI,GAAED,QAAS,KAAI;EAC3C,MAAME,IAAI,GAAGN,UAAU,CAAC,CAAC;EACzB,MAAMO,KAAK,GAAGN,gBAAgB,CAACG,QAAQ,CAAC;EACxC,MAAMI,MAAM,GAAGN,iBAAiB,CAACG,kBAAkB,CAAC;EAEpD,OAAO,IAAII,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCJ,KAAK,CAACK,EAAE,CAAC,KAAK,EAAE,MAAM;MACpBC,OAAO,CAACC,GAAG,CAAE,GAAET,kBAAmB,wBAAuB,CAAC;MAC1DK,OAAO,CAACL,kBAAkB,CAAC;IAC7B,CAAC,CAAC;IACFE,KAAK,CAACK,EAAE,CAAC,OAAO,EAAGG,KAAK,IAAK;MAC3BF,OAAO,CAACC,GAAG,CAAE,GAAET,kBAAmB,sBAAqB,CAAC;MACxDM,MAAM,CAACI,KAAK,CAAC;IACf,CAAC,CAAC;IACFR,KAAK,CAACS,IAAI,CAACV,IAAI,CAAC,CAACU,IAAI,CAACR,MAAM,CAAC;EAC/B,CAAC,CAAC;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversion-dump.js","names":["isDeepStrictEqual","DUMP_FILE_SUFFIX","isFileExists","openJson","removeFile","renameFile","writeFile","join","process","Ajv","dumpJsonSchema","ConversionDump","constructor","restored","options","tilesConverted","textureSetDefinitions","attributeMetadataInfo","materialDefinitions","createDump","currentOptions","tilesetName","slpk","egmFilePath","inputUrl","outputPath","draco","maxDepth","token","generateTextures","generateBoundingVolumes","mergeMaterials","metadataClass","analyze","dumpFilename","dump","ajv","dumpJsonValidate","compile","isDumpValid","JSON","parse","stringify","error","console","log","deleteDumpFile","reset","updateDumpFile","_this$options","time","hrtime","_this$options2","getRecord","fileName","setRecord","object","addNode","filename","nodeId","dumpMetadata","nodes","push","done","length","clearDumpRecord","addTexturesDefinitions","textureDefinitions","updateDoneStatus","resourceType","value","_this$tilesConverted$","nodeDump","find","element","progress","updateConvertedTilesDump","changedRecords","writeResults","i","sourceId","outputId","node","key","updateConvertedNodesDumpFile","_this$tilesConverted$2","isFileConversionComplete","_this$tilesConverted$4","_this$tilesConverted$5","result","_this$tilesConverted$3","setMaterialsDefinitions"],"sources":["../../../src/lib/utils/conversion-dump.ts"],"sourcesContent":["import {isDeepStrictEqual} from 'util';\nimport {DUMP_FILE_SUFFIX} from '../../constants';\nimport {isFileExists, openJson, removeFile, renameFile, writeFile} from './file-utils';\nimport {join} from 'path';\nimport {BoundingVolumes, I3SMaterialDefinition, TextureSetDefinitionFormats} from '@loaders.gl/i3s';\nimport {AttributeMetadataInfoObject} from '../../i3s-converter/helpers/attribute-metadata-info';\nimport process from 'process';\nimport Ajv from 'ajv';\nimport {dumpJsonSchema} from '../json-schemas/conversion-dump-json-schema';\n\nexport type ConversionDumpOptions = {\n inputUrl: string;\n outputPath: string;\n tilesetName: string;\n maxDepth: number;\n slpk: boolean;\n egmFilePath: string;\n token: string;\n draco: boolean;\n mergeMaterials: boolean;\n generateTextures: boolean;\n generateBoundingVolumes: boolean;\n metadataClass: string;\n analyze: boolean;\n};\n\ntype NodeDoneStatus = {\n nodeId: number | string;\n done: boolean;\n progress?: Record<string, boolean>;\n dumpMetadata?: DumpMetadata;\n};\n\ntype TilesConverted = {\n nodes: NodeDoneStatus[];\n};\n\nexport type DumpMetadata = {\n boundingVolumes: BoundingVolumes | null;\n attributesCount?: number;\n featureCount: number | null;\n geometry: boolean;\n hasUvRegions: boolean;\n materialId: number | null;\n texelCountHint?: number;\n vertexCount: number | null;\n};\n\nexport type TextureSetDefinition = {\n formats: TextureSetDefinitionFormats;\n atlas?: boolean;\n};\n\nexport class ConversionDump {\n /**Restored/resumed dump indicator */\n restored: boolean = false;\n /** Conversion options */\n private options?: ConversionDumpOptions;\n /** Tiles conversion progress status map */\n tilesConverted: Record<string, TilesConverted>;\n /** Textures formats definitions */\n textureSetDefinitions?: TextureSetDefinition[];\n /** Attributes Metadata */\n attributeMetadataInfo?: AttributeMetadataInfoObject;\n /** Array of materials definitions */\n materialDefinitions?: I3SMaterialDefinition[];\n\n constructor() {\n this.tilesConverted = {};\n }\n\n /**\n * Create a dump with convertion options\n * @param currentOptions - converter options\n */\n async createDump(currentOptions: ConversionDumpOptions): Promise<void> {\n const {\n tilesetName,\n slpk,\n egmFilePath,\n inputUrl,\n outputPath,\n draco = true,\n maxDepth,\n token,\n generateTextures,\n generateBoundingVolumes,\n mergeMaterials = true,\n metadataClass,\n analyze = false\n } = currentOptions;\n this.options = {\n tilesetName,\n slpk,\n egmFilePath,\n inputUrl,\n outputPath,\n draco,\n maxDepth,\n token,\n generateTextures,\n generateBoundingVolumes,\n mergeMaterials,\n metadataClass,\n analyze\n };\n\n const dumpFilename = join(\n this.options.outputPath,\n this.options.tilesetName,\n `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`\n );\n if (await isFileExists(dumpFilename)) {\n try {\n const dump = await openJson(\n join(this.options.outputPath, this.options.tilesetName),\n `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`\n );\n\n const {\n options,\n tilesConverted,\n textureSetDefinitions,\n attributeMetadataInfo,\n materialDefinitions\n } = dump;\n\n const ajv = new Ajv();\n const dumpJsonValidate = ajv.compile(dumpJsonSchema);\n const isDumpValid = dumpJsonValidate(dump);\n\n if (isDumpValid && isDeepStrictEqual(options, JSON.parse(JSON.stringify(this.options)))) {\n this.tilesConverted = tilesConverted;\n this.textureSetDefinitions = textureSetDefinitions;\n this.attributeMetadataInfo = attributeMetadataInfo;\n this.materialDefinitions = materialDefinitions;\n this.restored = true;\n return;\n }\n } catch (error) {\n console.log(\"Can't open dump file\", error);\n }\n }\n await this.deleteDumpFile();\n }\n\n /**\n * Reset a dump\n */\n reset(): void {\n this.restored = false;\n this.tilesConverted = {};\n if (this.textureSetDefinitions) {\n delete this.textureSetDefinitions;\n }\n if (this.attributeMetadataInfo) {\n delete this.attributeMetadataInfo;\n }\n if (this.materialDefinitions) {\n delete this.materialDefinitions;\n }\n }\n\n /**\n * Update conversion status in the dump file\n */\n private async updateDumpFile(): Promise<void> {\n if (this.options?.outputPath && this.options.tilesetName) {\n try {\n const time = process.hrtime();\n await writeFile(\n join(this.options.outputPath, this.options.tilesetName),\n JSON.stringify({\n options: this.options,\n tilesConverted: this.tilesConverted,\n textureSetDefinitions: this.textureSetDefinitions,\n attributeMetadataInfo: this.attributeMetadataInfo,\n materialDefinitions: this.materialDefinitions\n }),\n `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`\n );\n await renameFile(\n join(\n this.options.outputPath,\n this.options.tilesetName,\n `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`\n ),\n join(\n this.options.outputPath,\n this.options.tilesetName,\n `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`\n )\n );\n } catch (error) {\n console.log(\"Can't update dump file\", error);\n }\n }\n }\n\n /**\n * Delete a dump file\n */\n async deleteDumpFile(): Promise<void> {\n if (\n this.options?.outputPath &&\n this.options.tilesetName &&\n (await isFileExists(\n join(\n this.options.outputPath,\n this.options.tilesetName,\n `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`\n )\n ))\n ) {\n await removeFile(\n join(\n this.options.outputPath,\n this.options.tilesetName,\n `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`\n )\n );\n }\n }\n\n /**\n * Get record from the tilesConverted Map\n * @param fileName - source filename\n * @returns existing object from the tilesConverted Map\n */\n private getRecord(fileName: string) {\n return this.tilesConverted[fileName];\n }\n\n /**\n * Set a record for the dump file\n * @param fileName - key - source filename\n * @param object - value\n */\n private setRecord(fileName: string, object: any) {\n this.tilesConverted[fileName] = object;\n }\n\n /**\n * Add a node into the dump file for the source file record\n * @param fileName - source filename\n * @param nodeId - nodeId of the node\n */\n async addNode(filename: string, nodeId: number | string, dumpMetadata?: DumpMetadata) {\n const {nodes} = this.getRecord(filename) || {nodes: []};\n nodes.push({nodeId, done: false, dumpMetadata});\n if (nodes.length === 1) {\n this.setRecord(filename, {nodes});\n }\n await this.updateDumpFile();\n }\n\n /**\n * Clear dump record got the source filename\n * @param fileName - source filename\n */\n clearDumpRecord(filename: string) {\n this.setRecord(filename, {nodes: []});\n }\n\n /**\n * Add textures definitions into the dump file\n * @param textureDefinitions - textures definitions array\n */\n addTexturesDefinitions(textureDefinitions: TextureSetDefinition[]) {\n this.textureSetDefinitions = textureDefinitions;\n }\n\n /**\n * Update done status object for the writing resources\n * @param fileName - key - source filename\n * @param nodeId - nodeId for the source filename\n * @param resourceType - resource type to update status\n * @param value - value\n */\n updateDoneStatus(\n filename: string,\n nodeId: number | string,\n resourceType: string,\n value: boolean\n ) {\n const nodeDump = this.tilesConverted[filename]?.nodes.find(\n (element) => element.nodeId === nodeId\n );\n if (nodeDump) {\n if (!nodeDump.progress) {\n nodeDump.progress = {};\n }\n nodeDump.progress[resourceType] = value;\n if (!value) {\n nodeDump.done = false;\n }\n }\n }\n\n /**\n * Update dump file according to writing results\n * @param changedRecords - array of parameters ids for the written resources\n * @param writeResults - array of writing resource files results\n */\n async updateConvertedTilesDump(\n changedRecords: {outputId?: number | string; sourceId?: string; resourceType?: string}[],\n writeResults: PromiseSettledResult<string | null>[]\n ) {\n for (let i = 0; i < changedRecords.length; i++) {\n if (changedRecords[i] && 'value' in writeResults[i]) {\n const {sourceId, resourceType, outputId} = changedRecords[i];\n if (!sourceId || !resourceType || !outputId) continue;\n for (const node of this.tilesConverted[sourceId].nodes) {\n if (node.nodeId === outputId && node.progress) {\n node.progress[resourceType] = true;\n\n let done = false;\n for (const key in node.progress) {\n done = node.progress[key];\n if (!done) break;\n }\n node.done = done;\n if (node.done) {\n delete node.progress;\n }\n break;\n }\n }\n }\n }\n await this.updateDumpFile();\n }\n\n /**\n * Update 3d-tiles-converter dump file\n * @param filename - source filename\n * @param nodeId - nodeId\n * @param done - conversion status\n */\n async updateConvertedNodesDumpFile(\n filename: string,\n nodeId: number | string,\n done: boolean\n ): Promise<void> {\n const nodeDump = this.tilesConverted[filename]?.nodes.find(\n (element) => element.nodeId === nodeId\n );\n if (nodeDump) {\n nodeDump.done = done;\n await this.updateDumpFile();\n }\n }\n\n /**\n * Check is source file conversion complete\n * @param filename - source filename\n * @returns true if source file conversion complete\n */\n isFileConversionComplete(filename: string): boolean {\n let result = true;\n for (const node of this.tilesConverted[filename]?.nodes || []) {\n if (!node.done) {\n result = false;\n break;\n }\n }\n return result && this.tilesConverted[filename]?.nodes?.length > 0;\n }\n\n /**\n * Set materialDefinitions into a dump\n * @param materialDefinitions - Array materialDefinitions\n */\n setMaterialsDefinitions(materialDefinitions: I3SMaterialDefinition[]): void {\n this.materialDefinitions = materialDefinitions;\n }\n}\n"],"mappings":"AAAA,SAAQA,iBAAiB,QAAO,MAAM;AAAC,SAC/BC,gBAAgB;AAAA,SAChBC,YAAY,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,UAAU,EAAEC,SAAS;AACjE,SAAQC,IAAI,QAAO,MAAM;AAGzB,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,GAAG,MAAM,KAAK;AAAC,SACdC,cAAc;AA6CtB,OAAO,MAAMC,cAAc,CAAC;EAc1BC,WAAWA,CAAA,EAAG;IAAA,KAZdC,QAAQ,GAAY,KAAK;IAAA,KAEjBC,OAAO;IAAA,KAEfC,cAAc;IAAA,KAEdC,qBAAqB;IAAA,KAErBC,qBAAqB;IAAA,KAErBC,mBAAmB;IAGjB,IAAI,CAACH,cAAc,GAAG,CAAC,CAAC;EAC1B;EAMA,MAAMI,UAAUA,CAACC,cAAqC,EAAiB;IACrE,MAAM;MACJC,WAAW;MACXC,IAAI;MACJC,WAAW;MACXC,QAAQ;MACRC,UAAU;MACVC,KAAK,GAAG,IAA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,4BAA4BA,CAChC1B,QAAgB,EAChBC,MAAuB,EACvBI,IAAa,EACE;IAAA,IAAAsB,sBAAA;IACf,MAAMb,QAAQ,IAAAa,sBAAA,GAAG,IAAI,CAACtE,cAAc,CAAC2C,QAAQ,CAAC,cAAA2B,sBAAA,uBAA7BA,sBAAA,CAA+BxB,KAAK,CAACY,IAAI,CACvDC,OAAO,IAAKA,OAAO,CAACf,MAAM,KAAKA,MAClC,CAAC;IACD,IAAIa,QAAQ,EAAE;MACZA,QAAQ,CAACT,IAAI,GAAGA,IAAI;MACpB,MAAM,IAAI,CAACf,cAAc,CAAC,CAAC;IAC7B;EACF;EAOAsC,wBAAwBA,CAAC5B,QAAgB,EAAW;IAAA,IAAA6B,sBAAA,EAAAC,sBAAA;IAClD,IAAIC,MAAM,GAAG,IAAI;IACjB,KAAK,MAAMP,IAAI,IAAI,EAAAQ,sBAAA,OAAI,CAAC3E,cAAc,CAAC2C,QAAQ,CAAC,cAAAgC,sBAAA,uBAA7BA,sBAAA,CAA+B7B,KAAK,KAAI,EAAE,EAAE;MAAA,IAAA6B,sBAAA;MAC7D,IAAI,CAACR,IAAI,CAACnB,IAAI,EAAE;QACd0B,MAAM,GAAG,KAAK;QACd;MACF;IACF;IACA,OAAOA,MAAM,IAAI,EAAAF,sBAAA,OAAI,CAACxE,cAAc,CAAC2C,QAAQ,CAAC,cAAA6B,sBAAA,wBAAAC,sBAAA,GAA7BD,sBAAA,CAA+B1B,KAAK,cAAA2B,sBAAA,uBAApCA,sBAAA,CAAsCxB,MAAM,IAAG,CAAC;EACnE;EAMA2B,uBAAuBA,CAACzE,mBAA4C,EAAQ;IAC1E,IAAI,CAACA,mBAAmB,GAAGA,mBAAmB;EAChD;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-utils.js","names":["load","JSONLoader","promises","fs","isAbsolute","join","compressFileWithGzip","writeFile","path","data","fileName","arguments","length","undefined","toWriteData","Promise","Uint8Array","ArrayBuffer","mkdir","recursive","pathFile","err","console","log","writeFileForSlpk","compress","compressList","includes","push","pathGzFile","removeFile","openJson","resolve","reject","count","intervalId","setInterval","then","result","clearInterval","catch","Error","isFileExists","stat","removeDir","rm","unlink","getAbsoluteFilePath","filePath","process","cwd","renameFile","oldPath","newPath","rename"],"sources":["../../../src/lib/utils/file-utils.ts"],"sourcesContent":["import {load} from '@loaders.gl/core';\nimport {JSONLoader} from '@loaders.gl/loader-utils';\nimport {promises as fs} from 'fs';\nimport {isAbsolute, join} from 'path';\nimport {compressFileWithGzip} from './compress-util';\n\n/**\n * Write a file with data and name fileName to path\n *\n * @param path - output path\n * @param data - file content\n * @param fileName - name of output file (default: index.json)\n */\nexport async function writeFile(\n path: string,\n data: string | Uint8Array | ArrayBuffer | Promise<ArrayBuffer>,\n fileName: string = 'index.json'\n): Promise<string> {\n let toWriteData: string | Uint8Array;\n if (data instanceof Promise) {\n toWriteData = new Uint8Array(await data);\n } else if (data instanceof ArrayBuffer) {\n toWriteData = new Uint8Array(data as ArrayBuffer);\n } else {\n toWriteData = data;\n }\n await fs.mkdir(path, {recursive: true});\n const pathFile = join(path, fileName);\n try {\n await fs.writeFile(pathFile, toWriteData);\n } catch (err) {\n throw err;\n }\n console.log(`${pathFile} saved.`); // eslint-disable-line\n return pathFile;\n}\n\n/**\n * Write a file with data and name fileName to path - specific one for further packaging into slpk\n *\n * @param path - output path\n * @param data - file content\n * @param fileName - name of output file (default: index.json)\n * @param compress - if need to compress file with gzip (default: true)\n * @param compressList - if set - the file should be added to this list and compressed in the end of conversion\n */\nexport async function writeFileForSlpk(\n path: string,\n data: string | Uint8Array | ArrayBuffer | Promise<ArrayBuffer>,\n fileName: string = 'index.json',\n compress: boolean = true,\n compressList?: string[] | null\n): Promise<string | null> {\n const pathFile = await writeFile(path, data, fileName);\n if (compress) {\n if (compressList) {\n if (!compressList.includes(pathFile)) {\n compressList.push(pathFile);\n return `${pathFile}.gz`;\n } else {\n return null;\n }\n } else {\n const pathGzFile = await compressFileWithGzip(pathFile);\n // After compression, we don't need an uncompressed file\n await removeFile(pathFile);\n return pathGzFile;\n }\n }\n return pathFile;\n}\n\n/**\n * Open json file\n * @param path - path to the file\n * @param fileName - file name\n * @returns object\n */\nexport async function openJson(path: string, fileName: string): Promise<{[key: string]: any}> {\n return new Promise((resolve, reject) => {\n let count = 0;\n console.log(`load ${path}/${fileName}.`); // eslint-disable-line\n const intervalId = setInterval(() => {\n const pathFile = join(path, fileName);\n load(pathFile, JSONLoader)\n .then((result) => {\n clearInterval(intervalId);\n resolve(result);\n })\n .catch(() => {\n count++;\n if (count > 100) {\n clearInterval(intervalId);\n reject(new Error(`Cannon load ${path}/${fileName}.`));\n }\n });\n }, 200);\n });\n}\n\n/**\n * Check if the file exists\n * @param fileName - full name of file\n * @returns true if file exists, otherwise - false\n */\nexport async function isFileExists(fileName: string): Promise<boolean> {\n try {\n await fs.stat(fileName);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Remove dir with path\n *\n * @param path\n */\nexport function removeDir(path: string) {\n // (node:35607) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead\n return fs.rm(path, {recursive: true});\n}\n\n/**\n * Remove file with path\n *\n * @param path\n */\nexport function removeFile(path: string) {\n return fs.unlink(path);\n}\n\n/**\n * Generates absolute file path\n * @param filePath\n */\nexport function getAbsoluteFilePath(filePath: string) {\n return isAbsolute(filePath) ? filePath : join(process.cwd(), filePath);\n}\n\n/**\n * Rename file with old path by new path\n * @param oldPath\n * @param newPath\n */\nexport async function renameFile(oldPath: string, newPath: string): Promise<void> {\n try {\n await fs.rename(oldPath, newPath);\n } catch (err) {\n console.log(\"Can't rename file\", err);\n }\n}\n"],"mappings":"AAAA,SAAQA,IAAI,QAAO,kBAAkB;AACrC,SAAQC,UAAU,QAAO,0BAA0B;AACnD,SAAQC,QAAQ,IAAIC,EAAE,QAAO,IAAI;AACjC,SAAQC,UAAU,EAAEC,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,YAAYA,CAAChC,QAAgB,EAAoB;EACrE,IAAI;IACF,MAAMP,EAAE,CAACwC,IAAI,CAACjC,QAAQ,CAAC;IACvB,OAAO,IAAI;EACb,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF;AAOA,OAAO,SAASkC,SAASA,CAACpC,IAAY,EAAE;EAEtC,OAAOL,EAAE,CAAC0C,EAAE,CAACrC,IAAI,EAAE;IAACW,SAAS,EAAE;EAAI,CAAC,CAAC;AACvC;AAOA,OAAO,SAASW,UAAUA,CAACtB,IAAY,EAAE;EACvC,OAAOL,EAAE,CAAC2C,MAAM,CAACtC,IAAI,CAAC;AACxB;AAMA,OAAO,SAASuC,mBAAmBA,CAACC,QAAgB,EAAE;EACpD,OAAO5C,UAAU,CAAC4C,QAAQ,CAAC,GAAGA,QAAQ,GAAG3C,IAAI,CAAC4C,OAAO,CAACC,GAAG,CAAC,CAAC,EAAEF,QAAQ,CAAC;AACxE;AAOA,OAAO,eAAeG,UAAUA,CAACC,OAAe,EAAEC,OAAe,EAAiB;EAChF,IAAI;IACF,MAAMlD,EAAE,CAACmD,MAAM,CAACF,OAAO,EAAEC,OAAO,CAAC;EACnC,CAAC,CAAC,OAAOhC,GAAG,EAAE;IACZC,OAAO,CAACC,GAAG,CAAC,mBAAmB,EAAEF,GAAG,CAAC;EACvC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-utils.js","names":["generateSyntheticIndices","vertexCount","result","Uint32Array","index"],"sources":["../../../src/lib/utils/geometry-utils.ts"],"sourcesContent":["/**\n * luma.gl can not work without indices now:\n * https://github.com/visgl/luma.gl/blob/d8cad75b9f8ca3e578cf078ed9d19e619c2ddbc9/modules/experimental/src/gltf/gltf-instantiator.js#L115\n * This method generates syntetic indices array: [0, 1, 2, 3, .... , vertexCount-1]\n * @param {number} vertexCount - vertex count in the geometry\n * @returns {Uint32Array} indices array.\n */\nexport const generateSyntheticIndices = (vertexCount: number): Uint32Array => {\n const result = new Uint32Array(vertexCount);\n for (let index = 0; index < vertexCount; index++) {\n result[index] = index;\n }\n return result;\n};\n"],"mappings":"AAOA,OAAO,MAAMA,wBAAwB,GAAIC,WAAmB,IAAkB;EAC5E,MAAMC,MAAM,GAAG,IAAIC,WAAW,CAACF,WAAW,CAAC;EAC3C,KAAK,IAAIG,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGH,WAAW,EAAEG,KAAK,EAAE,EAAE;IAChDF,MAAM,CAACE,KAAK,CAAC,GAAGA,KAAK;EACvB;EACA,OAAOF,MAAM;AACf,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lod-conversion-utils.js","names":["DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR","convertGeometricErrorToScreenThreshold","tile","coordinates","lodSelection","boundingVolume","lodMetricValue","maxScreenThreshold","metricType","maxError","mbs","maxScreenThresholdSQ","Math","PI","constructor","name","push","convertScreenThresholdToGeometricError","node","_node$lodSelection","metricData","find","metric","_node$lodSelection2","sqMetricData","sqrt"],"sources":["../../../src/lib/utils/lod-conversion-utils.ts"],"sourcesContent":["import {Tiles3DTileJSONPostprocessed} from '@loaders.gl/3d-tiles';\nimport {BoundingVolumes} from '@loaders.gl/i3s';\nimport {I3STileHeader} from '@loaders.gl/i3s/src/types';\n\n// https://cesium.com/docs/cesiumjs-ref-doc/Cesium3DTileset.html\nconst DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;\n/**\n * Do conversion from geometric error to screen threshold\n * \n * In 3DTiles we have HLOD logic and parent tile also has bigger lodMetric value then its children.\n * In I3s we have reverse logic related to maxError. Parent has lower maxError than its child.\n * In nodes where are no children tile.lodMetricValue is 0. This is because of logic of HLOD in 3DTiles\n * 3DTiles spec:\n * https://github.com/CesiumGS/3d-tiles/tree/master/specification#geometric-error\n * I3S spec:\n * https://github.com/Esri/i3s-spec/blob/master/docs/1.7/lodSelection.cmn.md\n * To avoid infinity values when we do calculations of maxError we shold replace 0 with value which allows us\n * to make child maxError bigger than his parent maxError.\n * \n * @param tile - 3d-tiles tile JSON\n * @param coordinates - node converted coordinates\n * @returns An array of LOD metrics in format compatible with i3s 3DNodeIndexDocument.lodSelection\n * @example \n * [\n {\n \"metricType\": \"maxScreenThresholdSQ\",\n \"maxError\": 870638.071285568\n },\n {\n \"metricType\": \"maxScreenThreshold\",\n \"maxError\": 1052.8679031638949\n }\n ]\n */\nexport function convertGeometricErrorToScreenThreshold(\n tile: Tiles3DTileJSONPostprocessed,\n coordinates: BoundingVolumes\n) {\n const lodSelection: {metricType: string; maxError: number}[] = [];\n const boundingVolume = tile.boundingVolume;\n const lodMetricValue = tile.lodMetricValue || 0.1;\n const maxScreenThreshold = {\n metricType: 'maxScreenThreshold',\n maxError: (coordinates.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR) / lodMetricValue\n };\n const maxScreenThresholdSQ = {\n metricType: 'maxScreenThresholdSQ',\n maxError: Math.PI * 0.25 * maxScreenThreshold.maxError * maxScreenThreshold.maxError\n };\n\n if (boundingVolume.constructor.name === 'OrientedBoundingBox') {\n lodSelection.push(maxScreenThresholdSQ);\n lodSelection.push(maxScreenThreshold);\n } else {\n lodSelection.push(maxScreenThreshold);\n lodSelection.push(maxScreenThresholdSQ);\n }\n\n return lodSelection;\n}\n\n/**\n * Convert LOD metric from \"Screen Threshold\" to \"Screen Space Error\"\n * @param node - i3s node data\n * @returns lod metric in 3d-tiles format\n */\nexport function convertScreenThresholdToGeometricError(node: I3STileHeader): number {\n const metricData = node.lodSelection?.find(\n (metric) => metric.metricType === 'maxScreenThreshold'\n );\n let maxError = metricData?.maxError;\n if (!maxError) {\n const sqMetricData = node.lodSelection?.find(\n (metric) => metric.metricType === 'maxScreenThresholdSQ'\n );\n if (sqMetricData) {\n maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));\n }\n }\n\n if (!maxError) {\n maxError = DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR;\n }\n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CAAEX,QAAQ;EACnC,IAAI,CAACA,QAAQ,EAAE;IAAA,IAAAc,mBAAA;IACb,MAAMC,YAAY,IAAAD,mBAAA,GAAGL,IAAI,CAACd,YAAY,cAAAmB,mBAAA,uBAAjBA,mBAAA,CAAmBF,IAAI,CACzCC,MAAM,IAAKA,MAAM,CAACd,UAAU,KAAK,sBACpC,CAAC;IACD,IAAIgB,YAAY,EAAE;MAChBf,QAAQ,GAAGG,IAAI,CAACa,IAAI,CAACD,YAAY,CAACf,QAAQ,IAAIG,IAAI,CAACC,EAAE,GAAG,IAAI,CAAC,CAAC;IAChE;EACF;EAEA,IAAI,CAACJ,QAAQ,EAAE;IACbA,QAAQ,GAAGT,kCAAkC;EAC/C;EAEA,OAAQkB,IAAI,CAACR,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGV,kCAAkC,GAAIS,QAAQ;AAC1E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","names":["Queue","Array","enqueue","val","push","dequeue","shift","peek","isEmpty","length"],"sources":["../../../src/lib/utils/queue.ts"],"sourcesContent":["export class Queue<T> extends Array<T> {\n enqueue(val: T) {\n this.push(val);\n }\n\n dequeue(): T | undefined {\n return this.shift();\n }\n\n peek(): T {\n return this[0];\n }\n\n isEmpty() {\n return this.length === 0;\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,KAAK,SAAYC,KAAK,CAAI;EACrCC,OAAOA,CAACC,GAAM,EAAE;IACd,IAAI,CAACC,IAAI,CAACD,GAAG,CAAC;EAChB;EAEAE,OAAOA,CAAA,EAAkB;IACvB,OAAO,IAAI,CAACC,KAAK,CAAC,CAAC;EACrB;EAEAC,IAAIA,CAAA,EAAM;IACR,OAAO,IAAI,CAAC,CAAC,CAAC;EAChB;EAEAC,OAAOA,CAAA,EAAG;IACR,OAAO,IAAI,CAACC,MAAM,KAAK,CAAC;EAC1B;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"statistic-utills.js","names":["join","promises","fs","getAbsoluteFilePath","timeConverter","time","milliSecondsInSecond","timeInSeconds","Math","floor","milliseconds","timeConverterFromSecondsAndMilliseconds","nanoSecondsInMillisecond","hours","minutes","seconds","result","calculateFilesSize","params","slpk","outputPath","tilesetName","fullOutputPath","slpkPath","stat","size","directoryPath","totalSize","getTotalFilesSize","error","console","log","dirPath","totalFileSize","files","readdir","file","fileStat","isDirectory"],"sources":["../../../src/lib/utils/statistic-utills.ts"],"sourcesContent":["import {join} from 'path';\nimport {promises as fs} from 'fs';\nimport {getAbsoluteFilePath} from './file-utils';\n\n/**\n * Converts time value to string.\n * @param time - high-resolution real time in a [seconds, nanoseconds] tuple Array, or a value on milliseconds.\n * @returns string representation of the time\n */\nexport function timeConverter(time: number | [number, number]): string {\n if (typeof time === 'number') {\n // time - real time in milli-seconds\n const milliSecondsInSecond = 1e3;\n const timeInSeconds = Math.floor(time / milliSecondsInSecond);\n const milliseconds = time - timeInSeconds * milliSecondsInSecond;\n return timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds);\n } else {\n // time - high-resolution real time in a [seconds, nanoseconds] tuple Array\n const nanoSecondsInMillisecond = 1e6;\n const timeInSeconds = time[0];\n const milliseconds = time[1] / nanoSecondsInMillisecond;\n return timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds);\n }\n}\n\nfunction timeConverterFromSecondsAndMilliseconds(timeInSeconds: number, milliseconds: number) {\n const hours = Math.floor(timeInSeconds / 3600);\n timeInSeconds = timeInSeconds - hours * 3600;\n const minutes = Math.floor(timeInSeconds / 60);\n timeInSeconds = timeInSeconds - minutes * 60;\n const seconds = Math.floor(timeInSeconds);\n let result = '';\n\n if (hours) {\n result += `${hours}h `;\n }\n\n if (minutes) {\n result += `${minutes}m `;\n }\n\n if (seconds) {\n result += `${seconds}s`;\n }\n\n if (!result) {\n result += `${Math.floor(milliseconds)}ms`;\n }\n\n return result;\n}\n\nexport async function calculateFilesSize(params) {\n const {slpk, outputPath, tilesetName} = params;\n const fullOutputPath = getAbsoluteFilePath(outputPath);\n\n try {\n if (slpk) {\n const slpkPath = join(fullOutputPath, `${tilesetName}.slpk`);\n const stat = await fs.stat(slpkPath);\n return stat.size;\n }\n\n const directoryPath = join(fullOutputPath, tilesetName);\n const totalSize = await getTotalFilesSize(directoryPath);\n return totalSize;\n } catch (error) {\n console.log('Calculate file sizes error: ', error); // eslint-disable-line\n return null;\n }\n}\n\nasync function getTotalFilesSize(dirPath) {\n let totalFileSize = 0;\n\n const files = await fs.readdir(dirPath);\n\n for (const file of files) {\n const fileStat = await fs.stat(join(dirPath, file));\n if (fileStat.isDirectory()) {\n totalFileSize += await getTotalFilesSize(join(dirPath, file));\n } else {\n totalFileSize += fileStat.size;\n }\n }\n return totalFileSize;\n}\n"],"mappings":"AAAA,SAAQA,IAAI,QAAO,MAAM;AACzB,SAAQC,QAAQ,IAAIC,EAAE,QAAO,IAAI;AAAC,SAC1BC,mBAAmB;AAO3B,OAAO,SAASC,aAAaA,CAACC,IAA+B,EAAU;EACrE,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAE5B,MAAMC,oBAAoB,GAAG,GAAG;IAChC,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK,CAACJ,IAAI,GAAGC,oBAAoB,CAAC;IAC7D,MAAMI,YAAY,GAAGL,IAAI,GAAGE,aAAa,GAAGD,oBAAoB;IAChE,OAAOK,uCAAuC,CAACJ,aAAa,EAAEG,YAAY,CAAC;EAC7E,CAAC,MAAM;IAEL,MAAME,wBAAwB,GAAG,GAAG;IACpC,MAAML,aAAa,GAAGF,IAAI,CAAC,CAAC,CAAC;IAC7B,MAAMK,YAAY,GAAGL,IAAI,CAAC,CAAC,CAAC,GAAGO,wBAAwB;IACvD,OAAOD,uCAAuC,CAACJ,aAAa,EAAEG,YAAY,CAAC;EAC7E;AACF;AAEA,SAASC,uCAAuCA,CAACJ,aAAqB,EAAEG,YAAoB,EAAE;EAC5F,MAAMG,KAAK,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E,KAAK,EAAE;IACdC,OAAO,CAACC,GAAG,CAAC,8BAA8B,EAAEF,KAAK,CAAC;IAClD,OAAO,IAAI;EACb;AACF;AAEA,eAAeD,iBAAiBA,CAACI,OAAO,EAAE;EACxC,IAAIC,aAAa,GAAG,CAAC;EAErB,MAAMC,KAAK,GAAG,MAAMhC,EAAE,CAACiC,OAAO,CAACH,OAAO,CAAC;EAEvC,KAAK,MAAMI,IAAI,IAAIF,KAAK,EAAE;IACxB,MAAMG,QAAQ,GAAG,MAAMnC,EAAE,CAACsB,IAAI,CAACxB,IAAI,CAACgC,OAAO,EAAEI,IAAI,CAAC,CAAC;IACnD,IAAIC,QAAQ,CAACC,WAAW,CAAC,CAAC,EAAE;MAC1BL,aAAa,IAAI,MAAML,iBAAiB,CAAC5B,IAAI,CAACgC,OAAO,EAAEI,IAAI,CAAC,CAAC;IAC/D,CAAC,MAAM;MACLH,aAAa,IAAII,QAAQ,CAACZ,IAAI;IAChC;EACF;EACA,OAAOQ,aAAa;AACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-queue.js","names":["Queue","process","MEMORY_LIMIT","WriteQueue","constructor","conversionDump","listeningInterval","arguments","length","undefined","writeConcurrency","intervalId","writePromise","fileMap","enqueue","val","writeImmediately","archiveKey","result","memoryUsage","rss","startWrite","startListening","setInterval","bind","stopListening","clearInterval","doWrite","finalize","promises","archiveKeys","changedRecords","i","item","dequeue","sourceId","outputId","resourceType","push","promise","writeResults","Promise","allSettled","updateFileMap","updateConvertedTilesDump","value"],"sources":["../../../src/lib/utils/write-queue.ts"],"sourcesContent":["import {Queue} from './queue';\nimport process from 'process';\nimport {ConversionDump} from './conversion-dump';\n\n/** Memory limit size is based on testing */\nconst MEMORY_LIMIT = 4 * 1024 * 1024 * 1024; // 4GB\n\nexport type WriteQueueItem = {\n archiveKey?: string;\n sourceId?: string;\n outputId?: number;\n resourceType?: string;\n /**\n * writePromise() returns a Promise that will be awaited in Promise.allSettled(promises);\n * Arguments for this call are specified in writeQueue.enqueue call like this:\n * await writeQueue.enqueue({\n * archiveKey: `nodePages/xxx.json.gz`,\n * writePromise: () => writeFileForSlpk(slpkPath, data, `xxx.json`)\n * });\n * Note, a function like writeFileForSlpk should NOT be called when initializing the object for enqueue().\n * If he function is called, the promise will be created\n * and the function will allocate resources (file descriptors) for file writing.\n * It will be done for ALL items in the queue, which is not supposed to happen.\n * That's why the function should be passed as\n * writePromise: () => writeFileForSlpk(slpkPath, content, `xxx.json`)\n * instead of\n * writePromise: writeFileForSlpk(slpkPath, content, `xxx.json`) // INCORRECT !\n */\n writePromise: () => Promise<string | null>;\n};\n\nexport default class WriteQueue<T extends WriteQueueItem> extends Queue<T> {\n private intervalId?: NodeJS.Timeout;\n private conversionDump: ConversionDump;\n public writePromise: Promise<void> | null = null;\n public fileMap: {[key: string]: string} = {};\n public listeningInterval: number;\n public writeConcurrency: number;\n\n constructor(\n conversionDump: ConversionDump,\n listeningInterval: number = 2000,\n writeConcurrency: number = 400\n ) {\n super();\n this.conversionDump = conversionDump;\n this.listeningInterval = listeningInterval;\n this.writeConcurrency = writeConcurrency;\n }\n\n async enqueue(val: T, writeImmediately: boolean = false) {\n if (writeImmediately) {\n const {archiveKey, writePromise} = val as WriteQueueItem;\n const result = await writePromise();\n if (archiveKey && result) {\n this.fileMap[archiveKey] = result;\n }\n } else {\n super.enqueue(val);\n /** https://nodejs.org/docs/latest-v14.x/api/process.html#process_process_memoryusage */\n if (process.memoryUsage().rss > MEMORY_LIMIT) {\n await this.startWrite();\n }\n }\n }\n\n startListening() {\n this.intervalId = setInterval(this.startWrite.bind(this), this.listeningInterval);\n }\n\n stopListening() {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n }\n }\n\n async startWrite(): Promise<void> {\n if (!this.writePromise) {\n this.writePromise = this.doWrite();\n }\n await this.writePromise;\n this.writePromise = null;\n }\n\n async finalize(): Promise<void> {\n this.stopListening();\n await this.startWrite();\n }\n\n private async doWrite(): Promise<void> {\n while (this.length) {\n const promises: Promise<string | null>[] = [];\n const archiveKeys: (string | undefined)[] = [];\n const changedRecords: {outputId?: number; sourceId?: string; resourceType?: string}[] = [];\n for (let i = 0; i < this.writeConcurrency; i++) {\n const item = this.dequeue();\n if (!item) {\n break;\n }\n const {archiveKey, sourceId, outputId, resourceType, writePromise} = item as WriteQueueItem;\n archiveKeys.push(archiveKey);\n changedRecords.push({sourceId, outputId, resourceType});\n const promise = writePromise();\n promises.push(promise);\n }\n const writeResults = await Promise.allSettled(promises);\n this.updateFileMap(archiveKeys, writeResults);\n await this.conversionDump.updateConvertedTilesDump(changedRecords, writeResults);\n }\n }\n\n private updateFileMap(\n archiveKeys: (string | undefined)[],\n writeResults: PromiseSettledResult<string | null>[]\n ) {\n for (let i = 0; i < archiveKeys.length; i++) {\n const archiveKey = archiveKeys[i];\n if (archiveKey && 'value' in writeResults[i]) {\n this.fileMap[archiveKey] = (writeResults[i] as PromiseFulfilledResult<string>).value;\n }\n }\n }\n}\n"],"mappings":"SAAQA,KAAK;AACb,OAAOC,OAAO,MAAM,SAAS;AAI7B,MAAMC,YAAY,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;AA0B3C,eAAe,MAAMC,UAAU,SAAmCH,KAAK,CAAI;EAQzEI,WAAWA,CACTC,cAA8B,EAG9B;IAAA,IAFAC,iBAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAA,IAChCG,gBAAwB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;IAE9B,KAAK,CAAC,CAAC;IAAC,KAZFI,UAAU;IAAA,KACVN,cAAc;IAAA,KACfO,YAAY,GAAyB,IAAI;IAAA,KACzCC,OAAO,GAA4B,CAAC,CAAC;IAAA,KACrCP,iBAAiB;IAAA,KACjBI,gBAAgB;IAQrB,IAAI,CAACL,cAAc,GAAGA,cAA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,EAAE;QAC5C,IAAI,CAACnB,OAAO,CAACI,UAAU,CAAC,GAAIuB,YAAY,CAACR,CAAC,CAAC,CAAoCa,KAAK;MACtF;IACF;EACF;AACF"}
|
package/dist/pgm-loader.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,sBAAkB,KAAK,WAAW,qBAAiB,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slpk-extractor.js","names":["isBrowser","BROWSER_ERROR_MESSAGE","path","FileHandleFile","parseZipLocalFileHeader","GZipCompression","writeFile","indexNames","SLPKExtractor","extract","options","console","log","inputUrl","provider","localHeader","_localHeader","unGzip","name","correctIndexNames","fileName","data","slice","fileDataOffset","compressedSize","outputPath","includes","filename","join","dirname","parts","exec","at","file","_file$name","test","_file$name2","compression","decompressedData","decompress","Promise","resolve","finalPath","dirName"],"sources":["../../src/slpk-extractor/slpk-extractor.ts"],"sourcesContent":["import {isBrowser} from '@loaders.gl/core';\n\nimport {BROWSER_ERROR_MESSAGE} from '../constants';\nimport {path} from '@loaders.gl/loader-utils';\nimport {FileHandleFile} from '@loaders.gl/loader-utils';\nimport {parseZipLocalFileHeader} from '@loaders.gl/zip';\nimport {GZipCompression} from '@loaders.gl/compression';\nimport {writeFile} from '../lib/utils/file-utils';\n\nconst indexNames = [\n '3dSceneLayer.json.gz',\n '3dNodeIndexDocument.json.gz',\n 'sharedResource.json.gz'\n];\n\n/**\n * Description of the file in the SLPK\n */\ntype File = {\n name: string | null;\n data: ArrayBuffer;\n};\n\n/**\n * Converter from slpk to i3s\n */\nexport default class SLPKExtractor {\n /**\n * Extract slpk to i3s\n * @param options\n * @param options.inputUrl the url to read SLPK file\n * @param options.outputPath the output filename\n */\n public async extract(options: {inputUrl: string; outputPath: string}): Promise<string> {\n if (isBrowser) {\n console.log(BROWSER_ERROR_MESSAGE);\n return BROWSER_ERROR_MESSAGE;\n }\n const {inputUrl} = options;\n\n const provider = new FileHandleFile(inputUrl);\n\n let localHeader = await parseZipLocalFileHeader(0n, provider);\n while (localHeader) {\n await this.writeFile(\n await this.unGzip({\n name: this.correctIndexNames(localHeader.fileName),\n data: await provider.slice(\n localHeader.fileDataOffset,\n localHeader.fileDataOffset + localHeader.compressedSize\n )\n }),\n options.outputPath\n );\n localHeader = await parseZipLocalFileHeader(\n localHeader.fileDataOffset + localHeader?.compressedSize,\n provider\n );\n }\n\n return 'success';\n }\n\n /**\n * Defines file name and path for i3s format\n * @param fileName initial file name and path\n */\n\n private correctIndexNames(fileName: string): string | null {\n if (indexNames.includes(path.filename(path.join('/', fileName)))) {\n return path.join(path.dirname(fileName), 'index.json.gz');\n }\n // finds path with name part and extention part\n let parts = /^(.*\\/[^\\/\\.]*)(\\..+)$/.exec(fileName);\n if (!parts) {\n return null;\n }\n return `${parts?.at(1)}/index${parts?.at(2)}`;\n }\n\n private async unGzip(file: File): Promise<File> {\n if (/\\.gz$/.test(file.name ?? '')) {\n const compression = new GZipCompression();\n\n const decompressedData = await compression.decompress(file.data);\n\n return {data: decompressedData, name: (file.name ?? '').slice(0, -3)};\n }\n return Promise.resolve(file);\n }\n\n private async writeFile(options: File, outputPath: string): Promise<void> {\n if (!options.name) {\n return;\n }\n const finalPath = path.join(outputPath, options.name);\n const dirName = path.dirname(finalPath);\n const fileName = path.filename(finalPath);\n await writeFile(dirName, options.data, fileName);\n }\n}\n"],"mappings":"AAAA,SAAQA,SAAS,QAAO,kBAAkB;AAAC,SAEnCC,qBAAqB;AAC7B,SAAQC,IAAI,QAAO,0BAA0B;AAC7C,SAAQC,cAAc,QAAO,0BAA0B;AACvD,SAAQC,uBAAuB,QAAO,iBAAiB;AACvD,SAAQC,eAAe,QAAO,yBAAyB;AAAC,SAChDC,SAAS;AAEjB,MAAMC,UAAU,GAAG,CACjB,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,CACzB;AAaD,eAAe,MAAMC,a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1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slpk-extractor-cli.js","names":["SLPKExtractor","getURLValue","validateOptionsWithEqual","main","args","process","argv","length","printHelp","validatedOptionsArr","options","parseOptions","validatedOptions","validateOptions","convert","catch","error","console","log","exit","slpkExtractor","extract","inputUrl","tileset","outputPath","output","mandatoryOptionsWithExceptions","exceptions","mandatoryOption","optionValue","push","forEach","exeption","opts","arg","index","indexOf","warn"],"sources":["../src/slpk-extractor-cli.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport '@loaders.gl/polyfills';\nimport SLPKExtractor from './slpk-extractor/slpk-extractor';\nimport {getURLValue, validateOptionsWithEqual} from './lib/utils/cli-utils';\n\ntype SLPKExtractionOptions = {\n /** \"tileset.json\" file (3DTiles) / \"http://..../SceneServer/layers/0\" resource (I3S) */\n tileset?: string;\n /** Output folder. This folder will be created by converter if doesn't exist. It is relative to the converter path.\n * Default: \"data\" folder */\n output?: string;\n};\n\n/* During validation we check that particular options are defined so they can't be undefined */\nexport type ValidatedSLPKExtractionOptions = SLPKExtractionOptions & {\n /** slpk file */\n tileset: string;\n /** Output folder. This folder will be created by converter if doesn't exist. It is relative to the converter path.\n * Default: \"data\" folder */\n output: string;\n};\n\n/**\n * CLI entry\n * @returns\n */\nasync function main() {\n const [, , ...args] = process.argv;\n\n if (args.length === 0) {\n printHelp();\n }\n\n const validatedOptionsArr = validateOptionsWithEqual(args);\n\n const options: SLPKExtractionOptions = parseOptions(validatedOptionsArr);\n\n const validatedOptions: ValidatedSLPKExtractionOptions = validateOptions(options);\n\n await convert(validatedOptions);\n}\n\nmain().catch((error) => {\n console.log(error);\n process.exit(1); // eslint-disable-line\n});\n\n/**\n * Output for `npx slpk-extractor --help`\n */\nfunction printHelp(): void {\n console.log('cli: converter slpk to I3S...');\n console.log('--output [Output folder, default: \"data\" folder]');\n console.log('--tileset [SLPK file]');\n process.exit(0); // eslint-disable-line\n}\n\n/**\n * Run extraction process\n * @param options validated slpk-extractor options\n */\nasync function convert(options: ValidatedSLPKExtractionOptions) {\n console.log(`------------------------------------------------`); // eslint-disable-line\n console.log(`Starting conversion of SLPK`); // eslint-disable-line\n console.log(`------------------------------------------------`); // eslint-disable-line\n const slpkExtractor = new SLPKExtractor();\n slpkExtractor.extract({\n inputUrl: options.tileset,\n outputPath: options.output\n });\n}\n\n// OPTIONS\n/**\n * Validate input options of the CLI command\n * @param options - input options of the CLI command\n * @returns validated options\n */\nfunction validateOptions(options: SLPKExtractionOptions): ValidatedSLPKExtractionOptions {\n const mandatoryOptionsWithExceptions: {\n [key: string]: () => void;\n } = {\n output: () => console.log('Missed: --output [Output path name]'),\n tileset: () => console.log('Missed: --tileset [SLPK file]')\n };\n const exceptions: (() => void)[] = [];\n for (const mandatoryOption in mandatoryOptionsWithExceptions) {\n const optionValue = options[mandatoryOption];\n if (!optionValue) {\n exceptions.push(mandatoryOptionsWithExceptions[mandatoryOption]);\n }\n }\n if (exceptions.length) {\n exceptions.forEach((exeption) => exeption());\n process.exit(1);\n }\n return <ValidatedSLPKExtractionOptions>options;\n}\n\n/**\n * Parse option from the cli arguments array\n * @param args\n * @returns\n */\nfunction parseOptions(args: string[]): SLPKExtractionOptions {\n const opts: SLPKExtractionOptions = {};\n\n // eslint-disable-next-line complexity\n args.forEach((arg, index) => {\n if (arg.indexOf('--') === 0) {\n switch (arg) {\n case '--tileset':\n opts.tileset = getURLValue(index, args);\n break;\n case '--output':\n opts.output = getURLValue(index, args);\n break;\n case '--help':\n printHelp();\n break;\n default:\n console.warn(`Unknown option ${arg}`);\n process.exit(0); // eslint-disable-line\n }\n }\n });\n return opts;\n}\n"],"mappings":"AACA,OAAO,uBAAuB;AAAC,OACxBA,aAAa;AAAA,SACZC,WAAW,EAAEC,wBAAwB;AAuB7C,eAAeC,IAAIA,CAAA,EAAG;EACpB,MAAM,IAAK,GAAGC,IAAI,CAAC,GAAGC,OAAO,CAACC,IAAI;EAElC,IAAIF,IAAI,CAACG,MAAM,KAAK,CAAC,EAAE;I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;EACrC,KAAK,MAAMC,eAAe,IAAIF,8BAA8B,EAAE;IAC5D,MAAMG,WAAW,GAAGnB,OAAO,CAACkB,eAAe,CAAC;IAC5C,IAAI,CAACC,WAAW,EAAE;MAChBF,UAAU,CAACG,IAAI,CAACJ,8BAA8B,CAACE,eAAe,CAAC,CAAC;IAClE;EACF;EACA,IAAID,UAAU,CAACpB,MAAM,EAAE;IACrBoB,UAAU,CAACI,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAAC,CAAC,CAAC;IAC5C3B,OAAO,CAACc,IAAI,CAAC,CAAC,CAAC;EACjB;EACA,OAAuCT,OAAO;AAChD;AAOA,SAASC,YAAYA,CAACP,IAAc,EAAyB;EAC3D,MAAM6B,IAA2B,GAAG,CAAC,CAAC;EAGtC7B,IAAI,CAAC2B,OAAO,CAAC,CAACG,GAAG,EAAEC,KAAK,KAAK;IAC3B,IAAID,GAAG,CAACE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;MAC3B,QAAQF,GAAG;QACT,KAAK,WAAW;UACdD,IAAI,CAACV,OAAO,GAAGtB,WAAW,CAACkC,KAAK,EAAE/B,IAAI,CAAC;UACvC;QACF,KAAK,UAAU;UACb6B,IAAI,CAACR,MAAM,GAAGxB,WAAW,CAACkC,KAAK,EAAE/B,IAAI,CAAC;UACtC;QACF,KAAK,QAAQ;UACXI,SAAS,CAAC,CAAC;UACX;QACF;UACES,OAAO,CAACoB,IAAI,CAAE,kBAAiBH,GAAI,EAAC,CAAC;UACrC7B,OAAO,CAACc,IAAI,CAAC,CAAC,CAAC;MACnB;IACF;EACF,CAAC,CAAC;EACF,OAAOc,IAAI;AACb"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Do milliseconds time conversion to readable time string.
|
|
3
|
-
* @param tile - 3d-tiles tile Object
|
|
4
|
-
* @param coordinates - node converted coordinates
|
|
5
|
-
* @returns String which characterizes conversion time period
|
|
6
|
-
*/
|
|
7
|
-
export function timeConverter(time: [number, number]): String;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Calculate files sizes after conversion.
|
|
11
|
-
* @param params - Object with params of conversion.
|
|
12
|
-
* @returns Promise with generated files size in bytes.
|
|
13
|
-
*/
|
|
14
|
-
export function calculateFilesSize(params: {
|
|
15
|
-
slpk: boolean;
|
|
16
|
-
outputPath: string;
|
|
17
|
-
tilesetName: string;
|
|
18
|
-
}): Number;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Reqursivelly calculate files sizes in directory.
|
|
22
|
-
* @param dirPath - Directory path.
|
|
23
|
-
* @returns Promise with files size in directory.
|
|
24
|
-
*/
|
|
25
|
-
export function getTotalFilesSize(dirPath: string): Number;
|