@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.
Files changed (192) hide show
  1. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +4 -4
  2. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  3. package/dist/3d-tiles-converter/3d-tiles-converter.js +349 -293
  4. package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
  5. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +261 -200
  6. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
  7. package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
  8. package/dist/3d-tiles-converter/helpers/load-i3s.js +83 -77
  9. package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
  10. package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
  11. package/dist/constants.js +0 -1
  12. package/dist/converter-cli.js +257 -234
  13. package/dist/converter.min.cjs +95 -105
  14. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  15. package/dist/deps-installer/deps-installer.js +78 -59
  16. package/dist/i3s-converter/helpers/attribute-metadata-info.js +210 -153
  17. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
  18. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
  19. package/dist/i3s-converter/helpers/batch-ids-extensions.js +146 -103
  20. package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
  21. package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
  22. package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
  23. package/dist/i3s-converter/helpers/feature-attributes.js +170 -105
  24. package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
  25. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  26. package/dist/i3s-converter/helpers/geometry-attributes.js +205 -212
  27. package/dist/i3s-converter/helpers/geometry-converter.d.ts +17 -3
  28. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  29. package/dist/i3s-converter/helpers/geometry-converter.js +1189 -830
  30. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +1 -1
  31. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  32. package/dist/i3s-converter/helpers/gltf-attributes.js +109 -97
  33. package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
  34. package/dist/i3s-converter/helpers/node-debug.js +98 -54
  35. package/dist/i3s-converter/helpers/node-index-document.d.ts +11 -4
  36. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
  37. package/dist/i3s-converter/helpers/node-index-document.js +255 -177
  38. package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
  39. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  40. package/dist/i3s-converter/helpers/node-pages.js +299 -193
  41. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
  42. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
  43. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
  44. package/dist/i3s-converter/helpers/progress.d.ts.map +1 -1
  45. package/dist/i3s-converter/helpers/progress.js +139 -83
  46. package/dist/i3s-converter/helpers/tileset-traversal.d.ts +9 -2
  47. package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
  48. package/dist/i3s-converter/helpers/tileset-traversal.js +33 -13
  49. package/dist/i3s-converter/i3s-converter.d.ts +7 -7
  50. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  51. package/dist/i3s-converter/i3s-converter.js +1165 -895
  52. package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
  53. package/dist/i3s-converter/json-templates/layers.js +120 -121
  54. package/dist/i3s-converter/json-templates/metadata.js +19 -20
  55. package/dist/i3s-converter/json-templates/node.js +73 -71
  56. package/dist/i3s-converter/json-templates/scene-server.js +25 -26
  57. package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
  58. package/dist/i3s-converter/json-templates/store.js +96 -94
  59. package/dist/i3s-converter/types.js +35 -23
  60. package/dist/i3s-server/app.js +15 -12
  61. package/dist/i3s-server/bin/i3s-server.min.cjs +69 -69
  62. package/dist/i3s-server/bin/www.js +16 -7
  63. package/dist/i3s-server/controllers/index-controller.js +18 -15
  64. package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -1
  65. package/dist/i3s-server/controllers/slpk-controller.js +24 -11
  66. package/dist/i3s-server/routes/index.js +13 -9
  67. package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -1
  68. package/dist/i3s-server/routes/slpk-router.js +26 -19
  69. package/dist/i3s-server/utils/create-scene-server.js +15 -10
  70. package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
  71. package/dist/i3s-server/utils/server-utils.js +52 -32
  72. package/dist/index.cjs +616 -967
  73. package/dist/index.cjs.map +7 -0
  74. package/dist/index.d.ts +2 -2
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +0 -1
  77. package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
  78. package/dist/lib/utils/cli-utils.d.ts.map +1 -1
  79. package/dist/lib/utils/cli-utils.js +65 -36
  80. package/dist/lib/utils/compress-util.js +20 -15
  81. package/dist/lib/utils/conversion-dump.d.ts +10 -2
  82. package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
  83. package/dist/lib/utils/conversion-dump.js +242 -197
  84. package/dist/lib/utils/file-utils.d.ts +1 -1
  85. package/dist/lib/utils/file-utils.d.ts.map +1 -1
  86. package/dist/lib/utils/file-utils.js +120 -74
  87. package/dist/lib/utils/geometry-utils.js +13 -7
  88. package/dist/lib/utils/lod-conversion-utils.js +65 -33
  89. package/dist/lib/utils/queue.js +12 -13
  90. package/dist/lib/utils/statistic-utills.d.ts +6 -23
  91. package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
  92. package/dist/lib/utils/statistic-utills.js +58 -55
  93. package/dist/lib/utils/write-queue.d.ts +2 -2
  94. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  95. package/dist/lib/utils/write-queue.js +72 -86
  96. package/dist/pgm-loader.js +17 -13
  97. package/dist/slpk-extractor/slpk-extractor.d.ts.map +1 -1
  98. package/dist/slpk-extractor/slpk-extractor.js +60 -50
  99. package/dist/slpk-extractor-cli.d.ts.map +1 -1
  100. package/dist/slpk-extractor-cli.js +90 -59
  101. package/dist/slpk-extractor.min.cjs +1 -1
  102. package/package.json +27 -26
  103. package/src/3d-tiles-converter/3d-tiles-converter.ts +21 -10
  104. package/src/3d-tiles-converter/helpers/b3dm-converter.ts +1 -0
  105. package/src/3d-tiles-converter/helpers/load-i3s.ts +3 -27
  106. package/src/converter-cli.ts +4 -2
  107. package/src/deps-installer/deps-installer.ts +7 -0
  108. package/src/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
  109. package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -1
  110. package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
  111. package/src/i3s-converter/helpers/feature-attributes.ts +5 -2
  112. package/src/i3s-converter/helpers/geometry-attributes.ts +6 -5
  113. package/src/i3s-converter/helpers/geometry-converter.ts +118 -72
  114. package/src/i3s-converter/helpers/gltf-attributes.ts +12 -13
  115. package/src/i3s-converter/helpers/node-index-document.ts +18 -10
  116. package/src/i3s-converter/helpers/node-pages.ts +27 -29
  117. package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +1 -0
  118. package/src/i3s-converter/helpers/progress.ts +1 -0
  119. package/src/i3s-converter/helpers/tileset-traversal.ts +22 -13
  120. package/src/i3s-converter/i3s-converter.ts +173 -114
  121. package/src/i3s-converter/json-templates/node.ts +1 -1
  122. package/src/i3s-server/bin/www.ts +6 -4
  123. package/src/i3s-server/controllers/slpk-controller.ts +4 -2
  124. package/src/i3s-server/routes/index.ts +10 -7
  125. package/src/i3s-server/routes/slpk-router.ts +22 -16
  126. package/src/i3s-server/utils/server-utils.ts +6 -4
  127. package/src/lib/utils/cli-utils.ts +2 -0
  128. package/src/lib/utils/conversion-dump.ts +35 -20
  129. package/src/lib/utils/file-utils.ts +11 -11
  130. package/src/lib/utils/statistic-utills.ts +5 -6
  131. package/src/lib/utils/write-queue.ts +2 -2
  132. package/src/slpk-extractor/slpk-extractor.ts +2 -1
  133. package/src/slpk-extractor-cli.ts +16 -8
  134. package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
  135. package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
  136. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
  137. package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
  138. package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
  139. package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
  140. package/dist/constants.js.map +0 -1
  141. package/dist/converter-cli.js.map +0 -1
  142. package/dist/deps-installer/deps-installer.js.map +0 -1
  143. package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
  144. package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
  145. package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
  146. package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
  147. package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
  148. package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
  149. package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
  150. package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
  151. package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
  152. package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
  153. package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
  154. package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
  155. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
  156. package/dist/i3s-converter/helpers/progress.js.map +0 -1
  157. package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
  158. package/dist/i3s-converter/i3s-converter.js.map +0 -1
  159. package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
  160. package/dist/i3s-converter/json-templates/layers.js.map +0 -1
  161. package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
  162. package/dist/i3s-converter/json-templates/node.js.map +0 -1
  163. package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
  164. package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
  165. package/dist/i3s-converter/json-templates/store.js.map +0 -1
  166. package/dist/i3s-converter/types.js.map +0 -1
  167. package/dist/i3s-server/README.md +0 -63
  168. package/dist/i3s-server/app.js.map +0 -1
  169. package/dist/i3s-server/bin/www.js.map +0 -1
  170. package/dist/i3s-server/certs/cert.pem +0 -19
  171. package/dist/i3s-server/certs/key.pem +0 -27
  172. package/dist/i3s-server/controllers/index-controller.js.map +0 -1
  173. package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
  174. package/dist/i3s-server/routes/index.js.map +0 -1
  175. package/dist/i3s-server/routes/slpk-router.js.map +0 -1
  176. package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
  177. package/dist/i3s-server/utils/server-utils.js.map +0 -1
  178. package/dist/index.js.map +0 -1
  179. package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
  180. package/dist/lib/utils/cli-utils.js.map +0 -1
  181. package/dist/lib/utils/compress-util.js.map +0 -1
  182. package/dist/lib/utils/conversion-dump.js.map +0 -1
  183. package/dist/lib/utils/file-utils.js.map +0 -1
  184. package/dist/lib/utils/geometry-utils.js.map +0 -1
  185. package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
  186. package/dist/lib/utils/queue.js.map +0 -1
  187. package/dist/lib/utils/statistic-utills.js.map +0 -1
  188. package/dist/lib/utils/write-queue.js.map +0 -1
  189. package/dist/pgm-loader.js.map +0 -1
  190. package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
  191. package/dist/slpk-extractor-cli.js.map +0 -1
  192. package/src/lib/utils/statistic-utills.d.ts +0 -25
@@ -1,128 +1,193 @@
1
1
  import { AttributeType } from "../types.js";
2
2
  import { EXT_FEATURE_METADATA, EXT_STRUCTURAL_METADATA } from '@loaders.gl/gltf';
3
+ /**
4
+ * Takes attributes from property table based on featureIdsMap.
5
+ * If there is no property value for particular featureId (index) the property will be null.
6
+ * Example:
7
+ * Initial data:
8
+ * OBJECTID: {0: 0, 3: 33, 4: 333}
9
+ * component: ['Windows', 'Frames', 'Wall', 'Roof', 'Skylight']
10
+ * Result:
11
+ * OBJECTID: [0, 33, 333]
12
+ * component: ['Windows', 'Roof', 'Skylight']
13
+ * @param featureIdsMap
14
+ * @param propertyTable
15
+ */
3
16
  export function flattenPropertyTableByFeatureIds(featureIdsMap, propertyTable) {
4
- const resultPropertyTable = {};
5
- for (const propertyName in propertyTable) {
6
- const properties = propertyTable[propertyName];
7
- resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIdsMap);
8
- }
9
- return resultPropertyTable;
17
+ const resultPropertyTable = {};
18
+ for (const propertyName in propertyTable) {
19
+ const properties = propertyTable[propertyName];
20
+ resultPropertyTable[propertyName] = getPropertiesByFeatureIds(properties, featureIdsMap);
21
+ }
22
+ return resultPropertyTable;
10
23
  }
24
+ /**
25
+ * Getting properties by featureId index
26
+ * @param properties
27
+ * @param featureIdsMap
28
+ */
11
29
  function getPropertiesByFeatureIds(properties, featureIdsMap) {
12
- const resultProperties = [];
13
- if (properties) {
14
- for (const featureIdKey in featureIdsMap) {
15
- const property = properties[featureIdKey] || null;
16
- resultProperties.push(property);
30
+ const resultProperties = [];
31
+ if (properties) {
32
+ for (const featureIdKey in featureIdsMap) {
33
+ const property = properties[featureIdKey] || null;
34
+ resultProperties.push(property);
35
+ }
17
36
  }
18
- }
19
- return resultProperties;
37
+ return resultProperties;
20
38
  }
39
+ /**
40
+ * Check that all attributes in propertyTable have the same length as FeatureIds.
41
+ * If there are differencies between lengths we should flatten property table based on exiesting featureIds.
42
+ * @param featureIds
43
+ * @param propertyTable
44
+ * @returns
45
+ */
21
46
  export function checkPropertiesLength(featureIds, propertyTable) {
22
- let needFlatten = false;
23
- for (const attribute of Object.values(propertyTable)) {
24
- if (!featureIds || !attribute || featureIds.length !== attribute.length) {
25
- needFlatten = true;
47
+ let needFlatten = false;
48
+ for (const attribute of Object.values(propertyTable)) {
49
+ if (!featureIds || !attribute || featureIds.length !== attribute.length) {
50
+ needFlatten = true;
51
+ }
26
52
  }
27
- }
28
- return needFlatten;
53
+ return needFlatten;
29
54
  }
55
+ /**
56
+ * Get the attribute type for attributeStorageInfo https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
57
+ * @param attribute - attribute taken from propertyTable
58
+ */
30
59
  export function getAttributeType(attribute) {
31
- if (typeof attribute === 'string' || typeof attribute === 'bigint') {
60
+ if (typeof attribute === 'string' || typeof attribute === 'bigint') {
61
+ return AttributeType.STRING_TYPE;
62
+ }
63
+ else if (typeof attribute === 'number') {
64
+ return Number.isInteger(attribute) ? AttributeType.SHORT_INT_TYPE : AttributeType.DOUBLE_TYPE;
65
+ }
32
66
  return AttributeType.STRING_TYPE;
33
- } else if (typeof attribute === 'number') {
34
- return Number.isInteger(attribute) ? AttributeType.SHORT_INT_TYPE : AttributeType.DOUBLE_TYPE;
35
- }
36
- return AttributeType.STRING_TYPE;
37
67
  }
68
+ /**
69
+ * Gets attribute's types based on the property table records.
70
+ * @param propertyTable - Table with layer meta data.
71
+ * @returns set of attribute types
72
+ * @example of returned object:
73
+ * {
74
+ * "opt_uint8": "Int32",
75
+ * "opt_uint64": "string"
76
+ * }
77
+ */
38
78
  export function getAttributeTypesMapFromPropertyTable(propertyTable) {
39
- const attributeTypesMap = {};
40
- for (const key in propertyTable) {
41
- const firstAttribute = propertyTable[key][0];
42
- const attributeType = getAttributeType(firstAttribute);
43
- attributeTypesMap[key] = attributeType;
44
- }
45
- return attributeTypesMap;
79
+ const attributeTypesMap = {};
80
+ for (const key in propertyTable) {
81
+ // Get attribute type based on the first element of each property.
82
+ const firstAttribute = propertyTable[key][0];
83
+ const attributeType = getAttributeType(firstAttribute);
84
+ attributeTypesMap[key] = attributeType;
85
+ }
86
+ return attributeTypesMap;
46
87
  }
88
+ /**
89
+ * Gets attribute's types from the extension schema selected by the class name 'metadataClass'.
90
+ * @param gltfJson - JSON part of GLB content
91
+ * @param metadataClass - name of the schema class
92
+ * @returns set of attribute's types
93
+ * @example of returned object:
94
+ * {
95
+ * "opt_uint8": "Int32",
96
+ * "opt_uint64": "string"
97
+ * }
98
+ */
47
99
  export const getAttributeTypesMapFromSchema = (gltfJson, metadataClass) => {
48
- var _gltfJson$extensions, _gltfJson$extensions$, _gltfJson$extensions$2, _gltfJson$extensions$3, _gltfJson$extensions2, _gltfJson$extensions3, _gltfJson$extensions4, _gltfJson$extensions5;
49
- const attributeTypesMap = {};
50
- const extFeatureMetadataSchemaClass = (_gltfJson$extensions = gltfJson.extensions) === null || _gltfJson$extensions === void 0 ? void 0 : (_gltfJson$extensions$ = _gltfJson$extensions[EXT_FEATURE_METADATA]) === null || _gltfJson$extensions$ === void 0 ? void 0 : (_gltfJson$extensions$2 = _gltfJson$extensions$.schema) === null || _gltfJson$extensions$2 === void 0 ? void 0 : (_gltfJson$extensions$3 = _gltfJson$extensions$2.classes) === null || _gltfJson$extensions$3 === void 0 ? void 0 : _gltfJson$extensions$3[metadataClass];
51
- if (extFeatureMetadataSchemaClass) {
52
- for (let propertyName in extFeatureMetadataSchemaClass.properties) {
53
- const property = extFeatureMetadataSchemaClass.properties[propertyName];
54
- const attributeProperty = getAttributeTypeFromExtFeatureMetadata(property);
55
- attributeTypesMap[propertyName] = attributeProperty;
100
+ const attributeTypesMap = {};
101
+ const extFeatureMetadataSchemaClass = gltfJson.extensions?.[EXT_FEATURE_METADATA]?.schema?.classes?.[metadataClass];
102
+ if (extFeatureMetadataSchemaClass) {
103
+ for (const propertyName in extFeatureMetadataSchemaClass.properties) {
104
+ const property = extFeatureMetadataSchemaClass.properties[propertyName];
105
+ const attributeProperty = getAttributeTypeFromExtFeatureMetadata(property);
106
+ attributeTypesMap[propertyName] = attributeProperty;
107
+ }
108
+ return attributeTypesMap;
56
109
  }
57
- return attributeTypesMap;
58
- }
59
- const extStructuralMetadataSchemaClass = (_gltfJson$extensions2 = gltfJson.extensions) === null || _gltfJson$extensions2 === void 0 ? void 0 : (_gltfJson$extensions3 = _gltfJson$extensions2[EXT_STRUCTURAL_METADATA]) === null || _gltfJson$extensions3 === void 0 ? void 0 : (_gltfJson$extensions4 = _gltfJson$extensions3.schema) === null || _gltfJson$extensions4 === void 0 ? void 0 : (_gltfJson$extensions5 = _gltfJson$extensions4.classes) === null || _gltfJson$extensions5 === void 0 ? void 0 : _gltfJson$extensions5[metadataClass];
60
- if (extStructuralMetadataSchemaClass) {
61
- for (let propertyName in extStructuralMetadataSchemaClass.properties) {
62
- const property = extStructuralMetadataSchemaClass.properties[propertyName];
63
- const attributeProperty = getAttributeTypeFromExtStructuralMetadata(property);
64
- attributeTypesMap[propertyName] = attributeProperty;
110
+ const extStructuralMetadataSchemaClass = gltfJson.extensions?.[EXT_STRUCTURAL_METADATA]?.schema?.classes?.[metadataClass];
111
+ if (extStructuralMetadataSchemaClass) {
112
+ for (const propertyName in extStructuralMetadataSchemaClass.properties) {
113
+ const property = extStructuralMetadataSchemaClass.properties[propertyName];
114
+ const attributeProperty = getAttributeTypeFromExtStructuralMetadata(property);
115
+ attributeTypesMap[propertyName] = attributeProperty;
116
+ }
117
+ return attributeTypesMap;
65
118
  }
66
- return attributeTypesMap;
67
- }
68
- return null;
119
+ return null;
69
120
  };
70
- const getAttributeTypeFromExtFeatureMetadata = property => {
71
- let attributeType;
72
- switch (property.type) {
73
- case 'INT8':
74
- case 'UINT8':
75
- case 'INT16':
76
- case 'UINT16':
77
- case 'INT32':
78
- case 'UINT32':
79
- attributeType = AttributeType.SHORT_INT_TYPE;
80
- break;
81
- case 'FLOAT32':
82
- case 'FLOAT64':
83
- attributeType = AttributeType.DOUBLE_TYPE;
84
- break;
85
- case 'INT64':
86
- case 'UINT64':
87
- case 'BOOLEAN':
88
- case 'ENUM':
89
- case 'STRING':
90
- case 'ARRAY':
91
- attributeType = AttributeType.STRING_TYPE;
92
- break;
93
- default:
94
- attributeType = AttributeType.STRING_TYPE;
95
- break;
96
- }
97
- return attributeType;
121
+ /**
122
+ * Gets the attribute type according to the Ext_feature_metadata extension class schema
123
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
124
+ * @param property - schema of the class property for Ext_feature_metadata
125
+ * @returns attribute's type
126
+ */
127
+ // eslint-disable-next-line complexity
128
+ const getAttributeTypeFromExtFeatureMetadata = (property) => {
129
+ let attributeType;
130
+ switch (property.type) {
131
+ case 'INT8':
132
+ case 'UINT8':
133
+ case 'INT16':
134
+ case 'UINT16':
135
+ case 'INT32':
136
+ case 'UINT32':
137
+ attributeType = AttributeType.SHORT_INT_TYPE;
138
+ break;
139
+ case 'FLOAT32':
140
+ case 'FLOAT64':
141
+ attributeType = AttributeType.DOUBLE_TYPE;
142
+ break;
143
+ case 'INT64':
144
+ case 'UINT64':
145
+ case 'BOOLEAN':
146
+ case 'ENUM':
147
+ case 'STRING':
148
+ case 'ARRAY':
149
+ attributeType = AttributeType.STRING_TYPE;
150
+ break;
151
+ default:
152
+ attributeType = AttributeType.STRING_TYPE;
153
+ break;
154
+ }
155
+ return attributeType;
98
156
  };
99
- const getAttributeTypeFromExtStructuralMetadata = property => {
100
- let attributeType;
101
- if (property.array) {
102
- attributeType = AttributeType.STRING_TYPE;
103
- } else {
104
- switch (property.componentType) {
105
- case 'INT8':
106
- case 'UINT8':
107
- case 'INT16':
108
- case 'UINT16':
109
- case 'INT32':
110
- case 'UINT32':
111
- attributeType = AttributeType.SHORT_INT_TYPE;
112
- break;
113
- case 'FLOAT32':
114
- case 'FLOAT64':
115
- attributeType = AttributeType.DOUBLE_TYPE;
116
- break;
117
- case 'INT64':
118
- case 'UINT64':
157
+ /**
158
+ * Gets the attribute type according to the Ext_structural_metadata extension class schema
159
+ * @see https://github.com/Esri/i3s-spec/blob/master/docs/1.7/attributeStorageInfo.cmn.md
160
+ * @param property - schema of the class property for Ext_structural_metadata
161
+ * @returns attribute's type
162
+ */
163
+ // eslint-disable-next-line complexity
164
+ const getAttributeTypeFromExtStructuralMetadata = (property) => {
165
+ let attributeType;
166
+ if (property.array) {
119
167
  attributeType = AttributeType.STRING_TYPE;
120
- break;
121
- default:
122
- attributeType = AttributeType.STRING_TYPE;
123
- break;
124
168
  }
125
- }
126
- return attributeType;
169
+ else {
170
+ switch (property.componentType) {
171
+ case 'INT8':
172
+ case 'UINT8':
173
+ case 'INT16':
174
+ case 'UINT16':
175
+ case 'INT32':
176
+ case 'UINT32':
177
+ attributeType = AttributeType.SHORT_INT_TYPE;
178
+ break;
179
+ case 'FLOAT32':
180
+ case 'FLOAT64':
181
+ attributeType = AttributeType.DOUBLE_TYPE;
182
+ break;
183
+ case 'INT64':
184
+ case 'UINT64':
185
+ attributeType = AttributeType.STRING_TYPE;
186
+ break;
187
+ default:
188
+ attributeType = AttributeType.STRING_TYPE;
189
+ break;
190
+ }
191
+ }
192
+ return attributeType;
127
193
  };
128
- //# sourceMappingURL=feature-attributes.js.map
@@ -1,4 +1,4 @@
1
- import type { GeometryAttributes, ConvertedAttributes } from '../types';
1
+ import type { GeometryAttributes, ConvertedAttributes } from "../types.js";
2
2
  /**
3
3
  * Generate geometry attributes with faceRange and featureCount
4
4
  * @param attributes
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAMlB;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,mBAAmB,GAAG,kBAAkB,CAyBtF"}
1
+ {"version":3,"file":"geometry-attributes.d.ts","sourceRoot":"","sources":["../../../src/i3s-converter/helpers/geometry-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EAGpB,oBAAiB;AAMlB;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,mBAAmB,GAAG,kBAAkB,CAyBtF"}