@itwin/map-layers-formats 4.0.0-dev.52 → 4.0.0-dev.55

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 (148) hide show
  1. package/.rush/temp/operation/build_ci/state.json +1 -1
  2. package/.rush/temp/operation/cover/state.json +1 -1
  3. package/.rush/temp/operation/docs/state.json +1 -1
  4. package/.rush/temp/package-deps_build_ci.json +3 -3
  5. package/.rush/temp/package-deps_cover.json +3 -3
  6. package/.rush/temp/package-deps_docs.json +3 -3
  7. package/.rush/temp/shrinkwrap-deps.json +44 -51
  8. package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.d.ts +8 -8
  9. package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js +14 -14
  10. package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
  11. package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.d.ts +14 -14
  12. package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.js +132 -132
  13. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
  14. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.js +200 -200
  15. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
  16. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +421 -421
  17. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  18. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
  19. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
  20. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js +82 -82
  21. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
  22. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +33 -33
  23. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
  24. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.js +142 -142
  25. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
  26. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
  27. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js +42 -42
  28. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
  29. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
  30. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +189 -189
  31. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  32. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
  33. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js +2270 -2270
  34. package/lib/cjs/map-layers-formats.d.ts +8 -8
  35. package/lib/cjs/map-layers-formats.js +28 -24
  36. package/lib/cjs/map-layers-formats.js.map +1 -1
  37. package/lib/cjs/mapLayersFormats.d.ts +10 -10
  38. package/lib/cjs/mapLayersFormats.js +28 -28
  39. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
  40. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +34 -34
  41. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
  42. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.js +161 -161
  43. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
  44. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.js +167 -167
  45. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
  46. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js +679 -679
  47. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
  48. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
  49. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.js +103 -103
  50. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
  51. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +214 -214
  52. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
  53. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js +94 -94
  54. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
  55. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +59 -59
  56. package/lib/cjs/test/ArcGisFeature/Mocks.d.ts +6 -6
  57. package/lib/cjs/test/ArcGisFeature/Mocks.js +18 -18
  58. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
  59. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js +419 -419
  60. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
  61. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
  62. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js +426 -426
  63. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
  64. package/lib/cjs/test/coverage/.nyc_output/186e5c44-6980-4d7a-9c52-bb4c9af0ad82.json +1 -0
  65. package/lib/cjs/test/coverage/.nyc_output/processinfo/186e5c44-6980-4d7a-9c52-bb4c9af0ad82.json +1 -0
  66. package/lib/cjs/test/coverage/.nyc_output/processinfo/a4fe7565-9b86-4573-8375-3819c82246d8.json +1 -0
  67. package/lib/cjs/test/coverage/.nyc_output/processinfo/index.json +1 -1
  68. package/lib/cjs/test/coverage/cobertura-coverage.xml +39 -39
  69. package/lib/cjs/test/coverage/lcov-report/index.html +1 -1
  70. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureFormat.ts.html +1 -1
  71. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureJSON.ts.html +1 -1
  72. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeaturePBF.ts.html +1 -1
  73. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureProvider.ts.html +1 -1
  74. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureQuery.ts.html +1 -1
  75. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureReader.ts.html +1 -1
  76. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureRenderer.ts.html +1 -1
  77. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureResponse.ts.html +1 -1
  78. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisSymbologyRenderer.ts.html +1 -1
  79. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/index.html +1 -1
  80. package/lib/cjs/test/coverage/lcov-report/src/index.html +1 -1
  81. package/lib/cjs/test/coverage/lcov-report/src/map-layers-formats.ts.html +1 -1
  82. package/lib/cjs/test/coverage/lcov-report/src/mapLayersFormats.ts.html +1 -1
  83. package/lib/cjs/test/coverage/lcov.info +47 -47
  84. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  85. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.d.ts +8 -8
  86. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js +11 -10
  87. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
  88. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.d.ts +14 -14
  89. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js +128 -128
  90. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
  91. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.js +196 -196
  92. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
  93. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +418 -417
  94. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  95. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
  96. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
  97. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js +78 -78
  98. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
  99. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +29 -29
  100. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
  101. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.js +138 -138
  102. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
  103. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts.map +1 -1
  104. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js +38 -38
  105. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
  106. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts.map +1 -1
  107. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +183 -182
  108. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  109. package/lib/esm/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
  110. package/lib/esm/ArcGisFeature/esriPBuffer.gen.js +2267 -2267
  111. package/lib/esm/map-layers-formats.d.ts +8 -8
  112. package/lib/esm/map-layers-formats.js +12 -12
  113. package/lib/esm/mapLayersFormats.d.ts +10 -10
  114. package/lib/esm/mapLayersFormats.js +24 -24
  115. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
  116. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +32 -32
  117. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
  118. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.js +159 -159
  119. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
  120. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.js +165 -165
  121. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
  122. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js +677 -677
  123. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
  124. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
  125. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.js +101 -101
  126. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
  127. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +212 -212
  128. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
  129. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js +92 -92
  130. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
  131. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +57 -57
  132. package/lib/esm/test/ArcGisFeature/Mocks.d.ts +6 -6
  133. package/lib/esm/test/ArcGisFeature/Mocks.js +15 -15
  134. package/lib/esm/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
  135. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js +416 -415
  136. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
  137. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
  138. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js +423 -422
  139. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
  140. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  141. package/lib/test/junit_results.xml +52 -52
  142. package/map-layers-formats.build.log +2 -2
  143. package/package.json +13 -13
  144. package/src/test/ArcGisFeature/ArcGisFeatureProvider.test.ts +21 -21
  145. package/lib/cjs/test/coverage/.nyc_output/579ba75b-0cfc-4b77-82ad-4f939b76443a.json +0 -1
  146. package/lib/cjs/test/coverage/.nyc_output/processinfo/579ba75b-0cfc-4b77-82ad-4f939b76443a.json +0 -1
  147. package/lib/cjs/test/coverage/.nyc_output/processinfo/f0a37b08-29bc-49a6-a608-b82501dccee7.json +0 -1
  148. /package/lib/cjs/test/coverage/.nyc_output/{f0a37b08-29bc-49a6-a608-b82501dccee7.json → a4fe7565-9b86-4573-8375-3819c82246d8.json} +0 -0
@@ -1,201 +1,201 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ArcGisFeaturePBF = void 0;
8
- const esriPBuffer_gen_1 = require("../ArcGisFeature/esriPBuffer.gen");
9
- const core_frontend_1 = require("@itwin/core-frontend");
10
- const appui_abstract_1 = require("@itwin/appui-abstract");
11
- const ArcGisFeatureReader_1 = require("./ArcGisFeatureReader");
12
- const core_bentley_1 = require("@itwin/core-bentley");
13
- const esriGeometryType = esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType;
14
- const loggerCategory = "MapLayersFormats.ArcGISFeature";
15
- /** @internal */
16
- class ArcGisFeaturePBF extends ArcGisFeatureReader_1.ArcGisFeatureReader {
17
- constructor(settings, layerMetadata) {
18
- super(settings, layerMetadata);
19
- }
20
- static getArcGisFeatureGeometryType(geomType) {
21
- switch (geomType) {
22
- case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipatch:
23
- return "esriGeometryMultiPatch";
24
- case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipoint:
25
- return "esriGeometryMultipoint";
26
- case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePoint:
27
- return "esriGeometryPoint";
28
- case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolygon:
29
- return "esriGeometryPolygon";
30
- case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolyline:
31
- return "esriGeometryPolyline";
32
- default:
33
- return "esriGeometryNull";
34
- }
35
- }
36
- readAndRender(response, renderer) {
37
- if (!(response.data instanceof esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer)) {
38
- const msg = "Response was not in PBF format";
39
- core_bentley_1.Logger.logError(loggerCategory, msg);
40
- return;
41
- }
42
- const collection = response.data;
43
- if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)
44
- return;
45
- const geomType = collection.queryResult.featureResult.geometryType;
46
- const stride = (collection.queryResult.featureResult.hasM || collection.queryResult.featureResult.hasZ) ? 3 : 2;
47
- // console.log(`Nb Feature: ${collection.queryResult.featureResult.features.length}`);
48
- if (geomType === esriGeometryType.esriGeometryTypePoint ||
49
- geomType === esriGeometryType.esriGeometryTypeMultipoint) {
50
- for (const feature of collection.queryResult.featureResult.features)
51
- renderer.renderPoint(feature.geometry.lengths, feature.geometry.coords, stride, renderer.transform === undefined);
52
- }
53
- else if (geomType === esriGeometryType.esriGeometryTypePolyline || geomType === esriGeometryType.esriGeometryTypePolygon) {
54
- const fill = (geomType === esriGeometryType.esriGeometryTypePolygon);
55
- for (const feature of collection.queryResult.featureResult.features)
56
- if (feature?.has_geometry)
57
- renderer.renderPath(feature.geometry.lengths, feature.geometry.coords, fill, stride, renderer.transform === undefined);
58
- }
59
- }
60
- readFeatureInfo(response, featureInfos) {
61
- if (!(response.data instanceof esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer)) {
62
- core_bentley_1.Logger.logError(loggerCategory, "Response was not in PBF format");
63
- }
64
- const collection = response.data;
65
- if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)
66
- return;
67
- const layerInfo = { layerName: this._settings.name, info: [] };
68
- // Fields metadata is stored outside feature results, create dedicated array first
69
- const fields = [];
70
- for (const field of collection.queryResult.featureResult.fields)
71
- fields.push({ name: field.name, type: field.fieldType });
72
- const getNumericValue = (attrValue) => {
73
- const propertyValue = { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive };
74
- let typename = appui_abstract_1.StandardTypeNames.Number;
75
- if (attrValue.has_double_value) {
76
- const value = this.toFixedWithoutPadding(attrValue.double_value);
77
- propertyValue.value = value;
78
- typename = appui_abstract_1.StandardTypeNames.Double;
79
- }
80
- else if (attrValue.has_float_value) {
81
- const value = this.toFixedWithoutPadding(attrValue.float_value);
82
- propertyValue.value = value;
83
- typename = appui_abstract_1.StandardTypeNames.Float;
84
- }
85
- else if (attrValue.has_int64_value) {
86
- propertyValue.value = attrValue.int64_value;
87
- typename = appui_abstract_1.StandardTypeNames.Integer;
88
- }
89
- else if (attrValue.has_sint64_value) {
90
- propertyValue.value = attrValue.sint64_value;
91
- typename = appui_abstract_1.StandardTypeNames.Integer;
92
- }
93
- else if (attrValue.has_sint_value) {
94
- propertyValue.value = attrValue.sint_value;
95
- typename = appui_abstract_1.StandardTypeNames.Integer;
96
- }
97
- else if (attrValue.has_uint64_value) {
98
- propertyValue.value = attrValue.uint64_value;
99
- typename = appui_abstract_1.StandardTypeNames.Integer;
100
- }
101
- else if (attrValue.has_uint_value) {
102
- propertyValue.value = attrValue.uint_value;
103
- typename = appui_abstract_1.StandardTypeNames.Integer;
104
- }
105
- else {
106
- propertyValue.value = undefined;
107
- }
108
- return { propertyValue, typename };
109
- };
110
- const getRecordInfo = (fieldInfo, attrValue) => {
111
- let propertyValue = { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive };
112
- let typename = appui_abstract_1.StandardTypeNames.String;
113
- if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDouble
114
- || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeInteger
115
- || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSmallInteger
116
- || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeOID
117
- || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSingle
118
- || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate) {
119
- const value = getNumericValue(attrValue);
120
- if (value.propertyValue === undefined) {
121
- core_bentley_1.Logger.logError(loggerCategory, `Could not read numeric value for field ${fieldInfo.name}`);
122
- return undefined;
123
- }
124
- if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate) {
125
- const test = value.propertyValue.value;
126
- propertyValue.value = new Date(test);
127
- typename = appui_abstract_1.StandardTypeNames.DateTime;
128
- }
129
- else {
130
- typename = value.typename;
131
- propertyValue = value.propertyValue;
132
- }
133
- }
134
- else if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeString) {
135
- if (attrValue.has_string_value) {
136
- propertyValue.value = attrValue.string_value;
137
- typename = appui_abstract_1.StandardTypeNames.String;
138
- }
139
- }
140
- else if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeGlobalID) {
141
- if (attrValue.has_string_value) {
142
- propertyValue.value = attrValue.string_value;
143
- typename = appui_abstract_1.StandardTypeNames.String;
144
- }
145
- else {
146
- const value = getNumericValue(attrValue);
147
- if (value.propertyValue === undefined) {
148
- core_bentley_1.Logger.logError(loggerCategory, `Could not read GlobalId value for field ${fieldInfo.name}`);
149
- return undefined;
150
- }
151
- }
152
- }
153
- else if (attrValue.has_string_value) {
154
- // If we reach this case that probably mean we don't support the field type, simply try to output string value
155
- typename = appui_abstract_1.StandardTypeNames.String;
156
- propertyValue.value = attrValue.string_value;
157
- }
158
- else if (attrValue.value_type === "none") {
159
- // Sometimes fields are just empty, use an empty string
160
- typename = appui_abstract_1.StandardTypeNames.String;
161
- propertyValue.value = undefined;
162
- }
163
- else {
164
- core_bentley_1.Logger.logError(loggerCategory, `Could not read value for field ${fieldInfo.name}`);
165
- return undefined;
166
- }
167
- propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);
168
- return new core_frontend_1.MapFeatureInfoRecord(propertyValue, { name: fieldInfo.name, displayLabel: fieldInfo.name, typename });
169
- };
170
- // Read feature values
171
- for (const feature of collection.queryResult.featureResult.features) {
172
- const subLayerInfo = {
173
- subLayerName: this._layerMetadata.name,
174
- displayFieldName: this._layerMetadata.name,
175
- records: [],
176
- };
177
- let i = 0;
178
- for (const attrValue of feature.attributes) {
179
- if (i > fields.length) {
180
- core_bentley_1.Logger.logError(loggerCategory, "Error while read feature info data: fields metadata missing");
181
- break;
182
- }
183
- // Convert everything to string for now
184
- const info = getRecordInfo(fields[i], attrValue);
185
- if (info) {
186
- subLayerInfo.records?.push(info);
187
- }
188
- i++;
189
- }
190
- if (layerInfo.info === undefined) {
191
- layerInfo.info = [];
192
- }
193
- if (!(layerInfo.info instanceof HTMLElement)) {
194
- layerInfo.info.push(subLayerInfo);
195
- }
196
- }
197
- featureInfos.push(layerInfo);
198
- }
199
- }
200
- exports.ArcGisFeaturePBF = ArcGisFeaturePBF;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ArcGisFeaturePBF = void 0;
8
+ const esriPBuffer_gen_1 = require("../ArcGisFeature/esriPBuffer.gen");
9
+ const core_frontend_1 = require("@itwin/core-frontend");
10
+ const appui_abstract_1 = require("@itwin/appui-abstract");
11
+ const ArcGisFeatureReader_1 = require("./ArcGisFeatureReader");
12
+ const core_bentley_1 = require("@itwin/core-bentley");
13
+ const esriGeometryType = esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType;
14
+ const loggerCategory = "MapLayersFormats.ArcGISFeature";
15
+ /** @internal */
16
+ class ArcGisFeaturePBF extends ArcGisFeatureReader_1.ArcGisFeatureReader {
17
+ constructor(settings, layerMetadata) {
18
+ super(settings, layerMetadata);
19
+ }
20
+ static getArcGisFeatureGeometryType(geomType) {
21
+ switch (geomType) {
22
+ case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipatch:
23
+ return "esriGeometryMultiPatch";
24
+ case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypeMultipoint:
25
+ return "esriGeometryMultipoint";
26
+ case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePoint:
27
+ return "esriGeometryPoint";
28
+ case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolygon:
29
+ return "esriGeometryPolygon";
30
+ case esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.GeometryType.esriGeometryTypePolyline:
31
+ return "esriGeometryPolyline";
32
+ default:
33
+ return "esriGeometryNull";
34
+ }
35
+ }
36
+ readAndRender(response, renderer) {
37
+ if (!(response.data instanceof esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer)) {
38
+ const msg = "Response was not in PBF format";
39
+ core_bentley_1.Logger.logError(loggerCategory, msg);
40
+ return;
41
+ }
42
+ const collection = response.data;
43
+ if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)
44
+ return;
45
+ const geomType = collection.queryResult.featureResult.geometryType;
46
+ const stride = (collection.queryResult.featureResult.hasM || collection.queryResult.featureResult.hasZ) ? 3 : 2;
47
+ // console.log(`Nb Feature: ${collection.queryResult.featureResult.features.length}`);
48
+ if (geomType === esriGeometryType.esriGeometryTypePoint ||
49
+ geomType === esriGeometryType.esriGeometryTypeMultipoint) {
50
+ for (const feature of collection.queryResult.featureResult.features)
51
+ renderer.renderPoint(feature.geometry.lengths, feature.geometry.coords, stride, renderer.transform === undefined);
52
+ }
53
+ else if (geomType === esriGeometryType.esriGeometryTypePolyline || geomType === esriGeometryType.esriGeometryTypePolygon) {
54
+ const fill = (geomType === esriGeometryType.esriGeometryTypePolygon);
55
+ for (const feature of collection.queryResult.featureResult.features)
56
+ if (feature?.has_geometry)
57
+ renderer.renderPath(feature.geometry.lengths, feature.geometry.coords, fill, stride, renderer.transform === undefined);
58
+ }
59
+ }
60
+ readFeatureInfo(response, featureInfos) {
61
+ if (!(response.data instanceof esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer)) {
62
+ core_bentley_1.Logger.logError(loggerCategory, "Response was not in PBF format");
63
+ }
64
+ const collection = response.data;
65
+ if (!collection.has_queryResult || !collection.queryResult.has_featureResult || collection?.queryResult?.featureResult?.features === undefined)
66
+ return;
67
+ const layerInfo = { layerName: this._settings.name, info: [] };
68
+ // Fields metadata is stored outside feature results, create dedicated array first
69
+ const fields = [];
70
+ for (const field of collection.queryResult.featureResult.fields)
71
+ fields.push({ name: field.name, type: field.fieldType });
72
+ const getNumericValue = (attrValue) => {
73
+ const propertyValue = { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive };
74
+ let typename = appui_abstract_1.StandardTypeNames.Number;
75
+ if (attrValue.has_double_value) {
76
+ const value = this.toFixedWithoutPadding(attrValue.double_value);
77
+ propertyValue.value = value;
78
+ typename = appui_abstract_1.StandardTypeNames.Double;
79
+ }
80
+ else if (attrValue.has_float_value) {
81
+ const value = this.toFixedWithoutPadding(attrValue.float_value);
82
+ propertyValue.value = value;
83
+ typename = appui_abstract_1.StandardTypeNames.Float;
84
+ }
85
+ else if (attrValue.has_int64_value) {
86
+ propertyValue.value = attrValue.int64_value;
87
+ typename = appui_abstract_1.StandardTypeNames.Integer;
88
+ }
89
+ else if (attrValue.has_sint64_value) {
90
+ propertyValue.value = attrValue.sint64_value;
91
+ typename = appui_abstract_1.StandardTypeNames.Integer;
92
+ }
93
+ else if (attrValue.has_sint_value) {
94
+ propertyValue.value = attrValue.sint_value;
95
+ typename = appui_abstract_1.StandardTypeNames.Integer;
96
+ }
97
+ else if (attrValue.has_uint64_value) {
98
+ propertyValue.value = attrValue.uint64_value;
99
+ typename = appui_abstract_1.StandardTypeNames.Integer;
100
+ }
101
+ else if (attrValue.has_uint_value) {
102
+ propertyValue.value = attrValue.uint_value;
103
+ typename = appui_abstract_1.StandardTypeNames.Integer;
104
+ }
105
+ else {
106
+ propertyValue.value = undefined;
107
+ }
108
+ return { propertyValue, typename };
109
+ };
110
+ const getRecordInfo = (fieldInfo, attrValue) => {
111
+ let propertyValue = { valueFormat: appui_abstract_1.PropertyValueFormat.Primitive };
112
+ let typename = appui_abstract_1.StandardTypeNames.String;
113
+ if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDouble
114
+ || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeInteger
115
+ || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSmallInteger
116
+ || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeOID
117
+ || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeSingle
118
+ || fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate) {
119
+ const value = getNumericValue(attrValue);
120
+ if (value.propertyValue === undefined) {
121
+ core_bentley_1.Logger.logError(loggerCategory, `Could not read numeric value for field ${fieldInfo.name}`);
122
+ return undefined;
123
+ }
124
+ if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeDate) {
125
+ const test = value.propertyValue.value;
126
+ propertyValue.value = new Date(test);
127
+ typename = appui_abstract_1.StandardTypeNames.DateTime;
128
+ }
129
+ else {
130
+ typename = value.typename;
131
+ propertyValue = value.propertyValue;
132
+ }
133
+ }
134
+ else if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeString) {
135
+ if (attrValue.has_string_value) {
136
+ propertyValue.value = attrValue.string_value;
137
+ typename = appui_abstract_1.StandardTypeNames.String;
138
+ }
139
+ }
140
+ else if (fieldInfo.type === esriPBuffer_gen_1.esriPBuffer.FeatureCollectionPBuffer.FieldType.esriFieldTypeGlobalID) {
141
+ if (attrValue.has_string_value) {
142
+ propertyValue.value = attrValue.string_value;
143
+ typename = appui_abstract_1.StandardTypeNames.String;
144
+ }
145
+ else {
146
+ const value = getNumericValue(attrValue);
147
+ if (value.propertyValue === undefined) {
148
+ core_bentley_1.Logger.logError(loggerCategory, `Could not read GlobalId value for field ${fieldInfo.name}`);
149
+ return undefined;
150
+ }
151
+ }
152
+ }
153
+ else if (attrValue.has_string_value) {
154
+ // If we reach this case that probably mean we don't support the field type, simply try to output string value
155
+ typename = appui_abstract_1.StandardTypeNames.String;
156
+ propertyValue.value = attrValue.string_value;
157
+ }
158
+ else if (attrValue.value_type === "none") {
159
+ // Sometimes fields are just empty, use an empty string
160
+ typename = appui_abstract_1.StandardTypeNames.String;
161
+ propertyValue.value = undefined;
162
+ }
163
+ else {
164
+ core_bentley_1.Logger.logError(loggerCategory, `Could not read value for field ${fieldInfo.name}`);
165
+ return undefined;
166
+ }
167
+ propertyValue.displayValue = this.getDisplayValue(typename, propertyValue.value);
168
+ return new core_frontend_1.MapFeatureInfoRecord(propertyValue, { name: fieldInfo.name, displayLabel: fieldInfo.name, typename });
169
+ };
170
+ // Read feature values
171
+ for (const feature of collection.queryResult.featureResult.features) {
172
+ const subLayerInfo = {
173
+ subLayerName: this._layerMetadata.name,
174
+ displayFieldName: this._layerMetadata.name,
175
+ records: [],
176
+ };
177
+ let i = 0;
178
+ for (const attrValue of feature.attributes) {
179
+ if (i > fields.length) {
180
+ core_bentley_1.Logger.logError(loggerCategory, "Error while read feature info data: fields metadata missing");
181
+ break;
182
+ }
183
+ // Convert everything to string for now
184
+ const info = getRecordInfo(fields[i], attrValue);
185
+ if (info) {
186
+ subLayerInfo.records?.push(info);
187
+ }
188
+ i++;
189
+ }
190
+ if (layerInfo.info === undefined) {
191
+ layerInfo.info = [];
192
+ }
193
+ if (!(layerInfo.info instanceof HTMLElement)) {
194
+ layerInfo.info.push(subLayerInfo);
195
+ }
196
+ }
197
+ featureInfos.push(layerInfo);
198
+ }
199
+ }
200
+ exports.ArcGisFeaturePBF = ArcGisFeaturePBF;
201
201
  //# sourceMappingURL=ArcGisFeaturePBF.js.map
@@ -1,45 +1,45 @@
1
- import { Cartographic, ImageMapLayerSettings, ImageSource } from "@itwin/core-common";
2
- import { Transform } from "@itwin/core-geometry";
3
- import { ArcGISImageryProvider, ImageryMapTileTree, MapLayerFeatureInfo, QuadId } from "@itwin/core-frontend";
4
- import { ArcGisExtent, ArcGisFeatureFormat, ArcGisGeometry } from "./ArcGisFeatureQuery";
5
- /**
6
- * @internal
7
- */
8
- interface ArcGisFeatureUrl {
9
- url: string;
10
- envelope?: ArcGisExtent;
11
- }
12
- /** Provide tiles from a ESRI ArcGIS Feature service
13
- * @internal
14
- */
15
- export declare class ArcGisFeatureProvider extends ArcGISImageryProvider {
16
- private _drawDebugInfo;
17
- private _debugFeatureGeom;
18
- private _supportsCoordinatesQuantization;
19
- private _querySupported;
20
- private _layerId;
21
- private _layerMetadata;
22
- private _format;
23
- serviceJson: any;
24
- private _symbologyRenderer;
25
- private static readonly _nbSubTiles;
26
- private _outSR;
27
- private _maxDepthFromLod;
28
- private _minDepthFromLod;
29
- get minimumZoomLevel(): number;
30
- get maximumZoomLevel(): number;
31
- constructor(settings: ImageMapLayerSettings);
32
- initialize(): Promise<void>;
33
- protected getLayerMetadata(layerId: number): Promise<any>;
34
- get tileSize(): number;
35
- get format(): ArcGisFeatureFormat | undefined;
36
- constructUrl(_row: number, _column: number, _zoomLevel: number): Promise<string>;
37
- constructFeatureUrl(row: number, column: number, zoomLevel: number, format: ArcGisFeatureFormat, geomOverride?: ArcGisGeometry, outFields?: string, tolerance?: number, returnGeometry?: boolean): ArcGisFeatureUrl | undefined;
38
- getFeatureInfo(featureInfos: MapLayerFeatureInfo[], quadId: QuadId, carto: Cartographic, _tree: ImageryMapTileTree): Promise<void>;
39
- private fetchTile;
40
- drawTileDebugInfo(row: number, column: number, zoomLevel: number, context: CanvasRenderingContext2D): void;
41
- protected computeTileWorld2CanvasTransform(row: number, column: number, zoomLevel: number): Transform | undefined;
42
- loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined>;
43
- }
44
- export {};
1
+ import { Cartographic, ImageMapLayerSettings, ImageSource } from "@itwin/core-common";
2
+ import { Transform } from "@itwin/core-geometry";
3
+ import { ArcGISImageryProvider, ImageryMapTileTree, MapLayerFeatureInfo, QuadId } from "@itwin/core-frontend";
4
+ import { ArcGisExtent, ArcGisFeatureFormat, ArcGisGeometry } from "./ArcGisFeatureQuery";
5
+ /**
6
+ * @internal
7
+ */
8
+ interface ArcGisFeatureUrl {
9
+ url: string;
10
+ envelope?: ArcGisExtent;
11
+ }
12
+ /** Provide tiles from a ESRI ArcGIS Feature service
13
+ * @internal
14
+ */
15
+ export declare class ArcGisFeatureProvider extends ArcGISImageryProvider {
16
+ private _drawDebugInfo;
17
+ private _debugFeatureGeom;
18
+ private _supportsCoordinatesQuantization;
19
+ private _querySupported;
20
+ private _layerId;
21
+ private _layerMetadata;
22
+ private _format;
23
+ serviceJson: any;
24
+ private _symbologyRenderer;
25
+ private static readonly _nbSubTiles;
26
+ private _outSR;
27
+ private _maxDepthFromLod;
28
+ private _minDepthFromLod;
29
+ get minimumZoomLevel(): number;
30
+ get maximumZoomLevel(): number;
31
+ constructor(settings: ImageMapLayerSettings);
32
+ initialize(): Promise<void>;
33
+ protected getLayerMetadata(layerId: number): Promise<any>;
34
+ get tileSize(): number;
35
+ get format(): ArcGisFeatureFormat | undefined;
36
+ constructUrl(_row: number, _column: number, _zoomLevel: number): Promise<string>;
37
+ constructFeatureUrl(row: number, column: number, zoomLevel: number, format: ArcGisFeatureFormat, geomOverride?: ArcGisGeometry, outFields?: string, tolerance?: number, returnGeometry?: boolean): ArcGisFeatureUrl | undefined;
38
+ getFeatureInfo(featureInfos: MapLayerFeatureInfo[], quadId: QuadId, carto: Cartographic, _tree: ImageryMapTileTree): Promise<void>;
39
+ private fetchTile;
40
+ drawTileDebugInfo(row: number, column: number, zoomLevel: number, context: CanvasRenderingContext2D): void;
41
+ protected computeTileWorld2CanvasTransform(row: number, column: number, zoomLevel: number): Transform | undefined;
42
+ loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined>;
43
+ }
44
+ export {};
45
45
  //# sourceMappingURL=ArcGisFeatureProvider.d.ts.map