@itwin/map-layers-formats 4.0.0-dev.48 → 4.0.0-dev.51

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 (174) 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 +36 -0
  5. package/.rush/temp/package-deps_cover.json +2 -2
  6. package/.rush/temp/package-deps_docs.json +2 -2
  7. package/.rush/temp/shrinkwrap-deps.json +1 -1
  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/ArcGisFeatureJSON.js.map +1 -1
  14. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
  15. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.js +200 -200
  16. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.js.map +1 -1
  17. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
  18. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +421 -421
  19. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  20. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
  21. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js +82 -82
  22. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
  23. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
  24. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +33 -33
  25. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
  26. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
  27. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.js +142 -142
  28. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.js.map +1 -1
  29. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
  30. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js +42 -42
  31. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
  32. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
  33. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +189 -189
  34. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  35. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
  36. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js +2270 -2270
  37. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
  38. package/lib/cjs/map-layers-formats.d.ts +8 -8
  39. package/lib/cjs/map-layers-formats.js +24 -24
  40. package/lib/cjs/map-layers-formats.js.map +1 -1
  41. package/lib/cjs/mapLayersFormats.d.ts +10 -10
  42. package/lib/cjs/mapLayersFormats.js +28 -28
  43. package/lib/cjs/mapLayersFormats.js.map +1 -1
  44. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
  45. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +34 -34
  46. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js.map +1 -1
  47. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
  48. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.js +161 -161
  49. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.js.map +1 -1
  50. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
  51. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.js +167 -167
  52. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.js.map +1 -1
  53. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
  54. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js +679 -679
  55. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
  56. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
  57. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.js +103 -103
  58. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.js.map +1 -1
  59. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
  60. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +214 -214
  61. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.js.map +1 -1
  62. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
  63. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js +94 -94
  64. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js.map +1 -1
  65. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
  66. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +59 -59
  67. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js.map +1 -1
  68. package/lib/cjs/test/ArcGisFeature/Mocks.d.ts +6 -6
  69. package/lib/cjs/test/ArcGisFeature/Mocks.js +18 -18
  70. package/lib/cjs/test/ArcGisFeature/Mocks.js.map +1 -1
  71. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
  72. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js +419 -419
  73. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
  74. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
  75. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js +426 -426
  76. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
  77. package/lib/cjs/test/coverage/.nyc_output/b5bab329-e30c-4d54-833d-0f3805415aca.json +1 -0
  78. package/lib/cjs/test/coverage/.nyc_output/processinfo/b5bab329-e30c-4d54-833d-0f3805415aca.json +1 -0
  79. package/lib/cjs/test/coverage/.nyc_output/processinfo/eb18b24f-e841-458a-a146-1d39857d2964.json +1 -0
  80. package/lib/cjs/test/coverage/.nyc_output/processinfo/index.json +1 -1
  81. package/lib/cjs/test/coverage/cobertura-coverage.xml +2 -2
  82. package/lib/cjs/test/coverage/lcov-report/index.html +1 -1
  83. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureFormat.ts.html +1 -1
  84. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureJSON.ts.html +1 -1
  85. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeaturePBF.ts.html +1 -1
  86. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureProvider.ts.html +1 -1
  87. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureQuery.ts.html +1 -1
  88. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureReader.ts.html +1 -1
  89. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureRenderer.ts.html +1 -1
  90. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureResponse.ts.html +1 -1
  91. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisSymbologyRenderer.ts.html +1 -1
  92. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/index.html +1 -1
  93. package/lib/cjs/test/coverage/lcov-report/src/index.html +1 -1
  94. package/lib/cjs/test/coverage/lcov-report/src/map-layers-formats.ts.html +1 -1
  95. package/lib/cjs/test/coverage/lcov-report/src/mapLayersFormats.ts.html +1 -1
  96. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  97. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.d.ts +8 -8
  98. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js +10 -10
  99. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
  100. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.d.ts +14 -14
  101. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js +128 -128
  102. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js.map +1 -1
  103. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.d.ts +14 -14
  104. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.js +196 -196
  105. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.js.map +1 -1
  106. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +44 -44
  107. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +417 -417
  108. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  109. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts +92 -92
  110. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js +78 -78
  111. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
  112. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +17 -17
  113. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +29 -29
  114. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
  115. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.d.ts +32 -32
  116. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.js +138 -138
  117. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.js.map +1 -1
  118. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.d.ts +16 -16
  119. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js +38 -38
  120. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
  121. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.d.ts +85 -85
  122. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +182 -182
  123. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  124. package/lib/esm/ArcGisFeature/esriPBuffer.gen.d.ts +1063 -1063
  125. package/lib/esm/ArcGisFeature/esriPBuffer.gen.js +2267 -2267
  126. package/lib/esm/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
  127. package/lib/esm/map-layers-formats.d.ts +8 -8
  128. package/lib/esm/map-layers-formats.js +12 -12
  129. package/lib/esm/map-layers-formats.js.map +1 -1
  130. package/lib/esm/mapLayersFormats.d.ts +10 -10
  131. package/lib/esm/mapLayersFormats.js +24 -24
  132. package/lib/esm/mapLayersFormats.js.map +1 -1
  133. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +1 -1
  134. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +32 -32
  135. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js.map +1 -1
  136. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +1 -1
  137. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.js +159 -159
  138. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.js.map +1 -1
  139. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +1 -1
  140. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.js +165 -165
  141. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.js.map +1 -1
  142. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +1 -1
  143. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js +677 -677
  144. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
  145. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +1 -1
  146. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.js +101 -101
  147. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.js.map +1 -1
  148. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +1 -1
  149. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +212 -212
  150. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.js.map +1 -1
  151. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +1 -1
  152. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js +92 -92
  153. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js.map +1 -1
  154. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +1 -1
  155. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +57 -57
  156. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js.map +1 -1
  157. package/lib/esm/test/ArcGisFeature/Mocks.d.ts +6 -6
  158. package/lib/esm/test/ArcGisFeature/Mocks.js +15 -15
  159. package/lib/esm/test/ArcGisFeature/Mocks.js.map +1 -1
  160. package/lib/esm/test/ArcGisFeature/NewYorkDataset.d.ts +55 -55
  161. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js +415 -415
  162. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js.map +1 -1
  163. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +1042 -1042
  164. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js +422 -422
  165. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js.map +1 -1
  166. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  167. package/lib/test/junit_results.xml +45 -45
  168. package/map-layers-formats.build.log +2 -2
  169. package/package.json +11 -11
  170. package/.rush/temp/8bff29d08b86f148ce24ab9a3ab9851766ca18f7.log +0 -10
  171. package/lib/cjs/test/coverage/.nyc_output/b643b26c-8393-414a-a1f5-85ec76eac15b.json +0 -1
  172. package/lib/cjs/test/coverage/.nyc_output/processinfo/3a013ea8-427a-43ec-a667-b7a0c921d50d.json +0 -1
  173. package/lib/cjs/test/coverage/.nyc_output/processinfo/b643b26c-8393-414a-a1f5-85ec76eac15b.json +0 -1
  174. /package/lib/cjs/test/coverage/.nyc_output/{3a013ea8-427a-43ec-a667-b7a0c921d50d.json → eb18b24f-e841-458a-a146-1d39857d2964.json} +0 -0
@@ -1,18 +1,18 @@
1
- import { Primitives, StandardTypeNames } from "@itwin/appui-abstract";
2
- import { ImageMapLayerSettings } from "@itwin/core-common";
3
- import { MapLayerFeatureInfo } from "@itwin/core-frontend";
4
- import { ArcGisFeatureRenderer } from "./ArcGisFeatureRenderer";
5
- import { ArcGisResponseData } from "./ArcGisFeatureResponse";
6
- /** @internal */
7
- export declare abstract class ArcGisFeatureReader {
8
- floatPrecision: number | undefined;
9
- forceDateDisplayValueToIso: boolean;
10
- protected _settings: ImageMapLayerSettings;
11
- protected _layerMetadata: any;
12
- constructor(settings: ImageMapLayerSettings, layerMetadata: any);
13
- abstract readAndRender(response: ArcGisResponseData, _renderer: ArcGisFeatureRenderer): void;
14
- abstract readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[]): void;
15
- protected toFixedWithoutPadding: (value: number) => number;
16
- protected getDisplayValue: (typename: StandardTypeNames, value: Primitives.Value | undefined) => string;
17
- }
1
+ import { Primitives, StandardTypeNames } from "@itwin/appui-abstract";
2
+ import { ImageMapLayerSettings } from "@itwin/core-common";
3
+ import { MapLayerFeatureInfo } from "@itwin/core-frontend";
4
+ import { ArcGisFeatureRenderer } from "./ArcGisFeatureRenderer";
5
+ import { ArcGisResponseData } from "./ArcGisFeatureResponse";
6
+ /** @internal */
7
+ export declare abstract class ArcGisFeatureReader {
8
+ floatPrecision: number | undefined;
9
+ forceDateDisplayValueToIso: boolean;
10
+ protected _settings: ImageMapLayerSettings;
11
+ protected _layerMetadata: any;
12
+ constructor(settings: ImageMapLayerSettings, layerMetadata: any);
13
+ abstract readAndRender(response: ArcGisResponseData, _renderer: ArcGisFeatureRenderer): void;
14
+ abstract readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[]): void;
15
+ protected toFixedWithoutPadding: (value: number) => number;
16
+ protected getDisplayValue: (typename: StandardTypeNames, value: Primitives.Value | undefined) => string;
17
+ }
18
18
  //# sourceMappingURL=ArcGisFeatureReader.d.ts.map
@@ -1,30 +1,30 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import { StandardTypeNames } from "@itwin/appui-abstract";
6
- /** @internal */
7
- export class ArcGisFeatureReader {
8
- constructor(settings, layerMetadata) {
9
- // Force display value of date to ISO 8601 format.
10
- // Turning this ON, will disable display value in end-user's locale
11
- this.forceDateDisplayValueToIso = false;
12
- this.toFixedWithoutPadding = (value) => {
13
- return (this.floatPrecision === undefined ? value : parseFloat(value.toFixed(this.floatPrecision)));
14
- };
15
- this.getDisplayValue = (typename, value) => {
16
- if (value === undefined) {
17
- return "";
18
- }
19
- else if (typename === StandardTypeNames.DateTime && this.forceDateDisplayValueToIso) {
20
- return value.toISOString();
21
- }
22
- else {
23
- return `${value}`;
24
- }
25
- };
26
- this._settings = settings;
27
- this._layerMetadata = layerMetadata;
28
- }
29
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { StandardTypeNames } from "@itwin/appui-abstract";
6
+ /** @internal */
7
+ export class ArcGisFeatureReader {
8
+ constructor(settings, layerMetadata) {
9
+ // Force display value of date to ISO 8601 format.
10
+ // Turning this ON, will disable display value in end-user's locale
11
+ this.forceDateDisplayValueToIso = false;
12
+ this.toFixedWithoutPadding = (value) => {
13
+ return (this.floatPrecision === undefined ? value : parseFloat(value.toFixed(this.floatPrecision)));
14
+ };
15
+ this.getDisplayValue = (typename, value) => {
16
+ if (value === undefined) {
17
+ return "";
18
+ }
19
+ else if (typename === StandardTypeNames.DateTime && this.forceDateDisplayValueToIso) {
20
+ return value.toISOString();
21
+ }
22
+ else {
23
+ return `${value}`;
24
+ }
25
+ };
26
+ this._settings = settings;
27
+ this._layerMetadata = layerMetadata;
28
+ }
29
+ }
30
30
  //# sourceMappingURL=ArcGisFeatureReader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGisFeatureReader.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisFeatureReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAc,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAMtE,gBAAgB;AAChB,MAAM,OAAgB,mBAAmB;IAWvC,YAAmB,QAA+B,EAAE,aAAkB;QAPtE,kDAAkD;QAClD,mEAAmE;QAC5D,+BAA0B,GAAG,KAAK,CAAC;QAc/B,0BAAqB,GAAG,CAAC,KAAa,EAAE,EAAE;YACnD,OAAO,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QACtG,CAAC,CAAC;QAEQ,oBAAe,GAAG,CAAC,QAA2B,EAAE,KAAiC,EAAE,EAAE;YAC7F,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,OAAQ,EAAE,CAAC;aACZ;iBAAM,IAAK,QAAQ,KAAK,iBAAiB,CAAC,QAAQ,IAAI,IAAI,CAAC,0BAA0B,EAAE;gBACtF,OAAQ,KAAc,CAAC,WAAW,EAAE,CAAC;aACtC;iBAAM;gBACL,OAAO,GAAG,KAAK,EAAE,CAAC;aACnB;QACH,CAAC,CAAC;QApBA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;CAmBF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { Primitives, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\nimport { MapLayerFeatureInfo } from \"@itwin/core-frontend\";\nimport { ArcGisFeatureRenderer } from \"./ArcGisFeatureRenderer\";\nimport { ArcGisResponseData } from \"./ArcGisFeatureResponse\";\n\n/** @internal */\nexport abstract class ArcGisFeatureReader {\n // Optionally you can set the floating precision\n public floatPrecision: number|undefined;\n\n // Force display value of date to ISO 8601 format.\n // Turning this ON, will disable display value in end-user's locale\n public forceDateDisplayValueToIso = false;\n\n protected _settings: ImageMapLayerSettings;\n protected _layerMetadata: any;\n\n public constructor(settings: ImageMapLayerSettings, layerMetadata: any) {\n this._settings = settings;\n this._layerMetadata = layerMetadata;\n }\n\n public abstract readAndRender(response: ArcGisResponseData, _renderer: ArcGisFeatureRenderer): void;\n\n public abstract readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[]): void;\n\n protected toFixedWithoutPadding = (value: number) => {\n return (this.floatPrecision === undefined ? value : parseFloat(value.toFixed(this.floatPrecision)));\n };\n\n protected getDisplayValue = (typename: StandardTypeNames, value: Primitives.Value|undefined) => {\n if (value === undefined) {\n return \"\";\n } else if ( typename === StandardTypeNames.DateTime && this.forceDateDisplayValueToIso) {\n return (value as Date).toISOString();\n } else {\n return `${value}`;\n }\n };\n}\n"]}
1
+ {"version":3,"file":"ArcGisFeatureReader.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisFeatureReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAc,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAMtE,gBAAgB;AAChB,MAAM,OAAgB,mBAAmB;IAWvC,YAAmB,QAA+B,EAAE,aAAkB;QAPtE,kDAAkD;QAClD,mEAAmE;QAC5D,+BAA0B,GAAG,KAAK,CAAC;QAc/B,0BAAqB,GAAG,CAAC,KAAa,EAAE,EAAE;YACnD,OAAO,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QACtG,CAAC,CAAC;QAEQ,oBAAe,GAAG,CAAC,QAA2B,EAAE,KAAiC,EAAE,EAAE;YAC7F,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,OAAQ,EAAE,CAAC;aACZ;iBAAM,IAAK,QAAQ,KAAK,iBAAiB,CAAC,QAAQ,IAAI,IAAI,CAAC,0BAA0B,EAAE;gBACtF,OAAQ,KAAc,CAAC,WAAW,EAAE,CAAC;aACtC;iBAAM;gBACL,OAAO,GAAG,KAAK,EAAE,CAAC;aACnB;QACH,CAAC,CAAC;QApBA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;CAmBF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { Primitives, StandardTypeNames } from \"@itwin/appui-abstract\";\r\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\r\nimport { MapLayerFeatureInfo } from \"@itwin/core-frontend\";\r\nimport { ArcGisFeatureRenderer } from \"./ArcGisFeatureRenderer\";\r\nimport { ArcGisResponseData } from \"./ArcGisFeatureResponse\";\r\n\r\n/** @internal */\r\nexport abstract class ArcGisFeatureReader {\r\n // Optionally you can set the floating precision\r\n public floatPrecision: number|undefined;\r\n\r\n // Force display value of date to ISO 8601 format.\r\n // Turning this ON, will disable display value in end-user's locale\r\n public forceDateDisplayValueToIso = false;\r\n\r\n protected _settings: ImageMapLayerSettings;\r\n protected _layerMetadata: any;\r\n\r\n public constructor(settings: ImageMapLayerSettings, layerMetadata: any) {\r\n this._settings = settings;\r\n this._layerMetadata = layerMetadata;\r\n }\r\n\r\n public abstract readAndRender(response: ArcGisResponseData, _renderer: ArcGisFeatureRenderer): void;\r\n\r\n public abstract readFeatureInfo(response: ArcGisResponseData, featureInfos: MapLayerFeatureInfo[]): void;\r\n\r\n protected toFixedWithoutPadding = (value: number) => {\r\n return (this.floatPrecision === undefined ? value : parseFloat(value.toFixed(this.floatPrecision)));\r\n };\r\n\r\n protected getDisplayValue = (typename: StandardTypeNames, value: Primitives.Value|undefined) => {\r\n if (value === undefined) {\r\n return \"\";\r\n } else if ( typename === StandardTypeNames.DateTime && this.forceDateDisplayValueToIso) {\r\n return (value as Date).toISOString();\r\n } else {\r\n return `${value}`;\r\n }\r\n };\r\n}\r\n"]}
@@ -1,33 +1,33 @@
1
- import { Transform } from "@itwin/core-geometry";
2
- import { ArcGisSymbologyRenderer } from "./ArcGisSymbologyRenderer";
3
- /** @internal */
4
- export declare class ArcGisFeatureRenderer {
5
- private _symbol;
6
- private _transform;
7
- private _context;
8
- constructor(context: CanvasRenderingContext2D, symbol: ArcGisSymbologyRenderer, world2PixelTransform?: Transform);
9
- get transform(): Transform | undefined;
10
- private closePath;
11
- private lineTo;
12
- private moveTo;
13
- private fill;
14
- private stroke;
15
- /**
16
- * Render a path on the renderer's context.
17
- * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
18
- * @param geometryLengths Array be used to determine the start and end of each sub-path / rings. (i.e. [5,5] = two rings of 5 vertices)
19
- * @param geometryCoords Array that linearly encodes the vertices of each sub-path of a polyline / ring of a polygon
20
- * @param fill Indicates if the path should be filled or not.
21
- * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
22
- */
23
- renderPath(geometryLengths: number[], geometryCoords: number[], fill: boolean, stride: number, relativeCoords: boolean): void;
24
- /**
25
- * Render a point on the renderer's context.
26
- * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
27
- * @param geometryLengths Array be used to determine the start and end of each multi-point array, empty for single point.
28
- * @param geometryCoords Array that linearly encodes vertices.
29
- * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
30
- */
31
- renderPoint(geometryLengths: number[], geometryCoords: number[], stride: number, relativeCoords: boolean): void;
32
- }
1
+ import { Transform } from "@itwin/core-geometry";
2
+ import { ArcGisSymbologyRenderer } from "./ArcGisSymbologyRenderer";
3
+ /** @internal */
4
+ export declare class ArcGisFeatureRenderer {
5
+ private _symbol;
6
+ private _transform;
7
+ private _context;
8
+ constructor(context: CanvasRenderingContext2D, symbol: ArcGisSymbologyRenderer, world2PixelTransform?: Transform);
9
+ get transform(): Transform | undefined;
10
+ private closePath;
11
+ private lineTo;
12
+ private moveTo;
13
+ private fill;
14
+ private stroke;
15
+ /**
16
+ * Render a path on the renderer's context.
17
+ * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
18
+ * @param geometryLengths Array be used to determine the start and end of each sub-path / rings. (i.e. [5,5] = two rings of 5 vertices)
19
+ * @param geometryCoords Array that linearly encodes the vertices of each sub-path of a polyline / ring of a polygon
20
+ * @param fill Indicates if the path should be filled or not.
21
+ * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
22
+ */
23
+ renderPath(geometryLengths: number[], geometryCoords: number[], fill: boolean, stride: number, relativeCoords: boolean): void;
24
+ /**
25
+ * Render a point on the renderer's context.
26
+ * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
27
+ * @param geometryLengths Array be used to determine the start and end of each multi-point array, empty for single point.
28
+ * @param geometryCoords Array that linearly encodes vertices.
29
+ * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
30
+ */
31
+ renderPoint(geometryLengths: number[], geometryCoords: number[], stride: number, relativeCoords: boolean): void;
32
+ }
33
33
  //# sourceMappingURL=ArcGisFeatureRenderer.d.ts.map
@@ -1,139 +1,139 @@
1
- /** @internal */
2
- export class ArcGisFeatureRenderer {
3
- constructor(context, symbol, world2PixelTransform) {
4
- this._symbol = symbol;
5
- this._context = context;
6
- this._transform = world2PixelTransform;
7
- }
8
- get transform() { return this._transform; }
9
- // Utility functions to make ease testing.
10
- closePath() {
11
- this._context.closePath();
12
- }
13
- lineTo(x, y) {
14
- this._context.lineTo(x, y);
15
- }
16
- moveTo(x, y) {
17
- this._context.moveTo(x, y);
18
- }
19
- fill() {
20
- this._context.fill();
21
- }
22
- stroke() {
23
- this._context.stroke();
24
- }
25
- /**
26
- * Render a path on the renderer's context.
27
- * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
28
- * @param geometryLengths Array be used to determine the start and end of each sub-path / rings. (i.e. [5,5] = two rings of 5 vertices)
29
- * @param geometryCoords Array that linearly encodes the vertices of each sub-path of a polyline / ring of a polygon
30
- * @param fill Indicates if the path should be filled or not.
31
- * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
32
- */
33
- renderPath(geometryLengths, geometryCoords, fill, stride, relativeCoords) {
34
- if (stride < 2 || stride > 3) {
35
- return;
36
- }
37
- // Keep track of our position in the in the 'coords' array:
38
- // Every time we loop on the 'lengths' array, the position
39
- // to start reading vertices in the 'coords' must be the sum of all previously read vertices.
40
- let coordsOffset = 0;
41
- // Begin the path here.
42
- // Note: Even though path is closed inside the 'geometryLengths' loop,
43
- // it's import to begin the path only once.
44
- this._context.beginPath();
45
- for (const vertexCount of geometryLengths) {
46
- let lastPtX = 0, lastPtY = 0;
47
- for (let vertexIdx = 0; vertexIdx < vertexCount; vertexIdx++) {
48
- let pX = geometryCoords[coordsOffset + (vertexIdx * stride)];
49
- let pY = geometryCoords[coordsOffset + (vertexIdx * stride) + 1];
50
- if (vertexIdx === 0) {
51
- // first vertex is always "absolute" and must be drawn as 'moveTo' (i.e. not lineTo)
52
- if (relativeCoords) {
53
- lastPtX = pX;
54
- lastPtY = pY;
55
- }
56
- if (this._transform) {
57
- const transformedPoint = this._transform.multiplyPoint2d({ x: pX, y: pY });
58
- pX = transformedPoint.x;
59
- pY = transformedPoint.y;
60
- }
61
- this.moveTo(pX, pY);
62
- }
63
- else {
64
- // Following vertices are relative to the previous one (sadly not really well documented by ESRI)
65
- // typically this happens when 'coordinates quantization' is active (i.e. no client side transformation is needed)
66
- if (relativeCoords) {
67
- pX = lastPtX = lastPtX + pX;
68
- pY = lastPtY = lastPtY + pY;
69
- }
70
- if (this._transform) {
71
- const transformedPoint = this._transform.multiplyPoint2d({ x: pX, y: pY });
72
- pX = transformedPoint.x;
73
- pY = transformedPoint.y;
74
- }
75
- this.lineTo(pX, pY);
76
- }
77
- }
78
- coordsOffset += stride * vertexCount;
79
- if (fill) {
80
- // ClosePath but do not 'fill' here, only at the very end (otherwise it will mess up holes)
81
- this.closePath();
82
- }
83
- }
84
- if (fill) {
85
- this._symbol.applyFillStyle(this._context);
86
- this.fill();
87
- }
88
- this._symbol.applyStrokeStyle(this._context);
89
- this.stroke(); // draw line path or polygon outline
90
- }
91
- /**
92
- * Render a point on the renderer's context.
93
- * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
94
- * @param geometryLengths Array be used to determine the start and end of each multi-point array, empty for single point.
95
- * @param geometryCoords Array that linearly encodes vertices.
96
- * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
97
- */
98
- renderPoint(geometryLengths, geometryCoords, stride, relativeCoords) {
99
- if (stride < 2 || stride > 3) {
100
- return;
101
- }
102
- let coordsOffset = 0;
103
- if (geometryLengths.length === 0) {
104
- // Strangely, for points, 'lengths' array is empty, so we assume there is a single vertex in 'coords' array.
105
- if (geometryCoords.length >= stride) {
106
- if (this._transform) {
107
- const transformedPoint = this._transform.multiplyPoint2d({ x: geometryCoords[0], y: geometryCoords[1] });
108
- this._symbol.drawPoint(this._context, transformedPoint.x, transformedPoint.y);
109
- }
110
- else {
111
- this._symbol.drawPoint(this._context, geometryCoords[0], geometryCoords[1]);
112
- }
113
- }
114
- }
115
- else {
116
- // MULTI-POINTS: Needs testing
117
- // I assume 'lengths' array will get populated and 'coords' array will look similar to line/polygons.
118
- for (const vertexCount of geometryLengths) {
119
- let lastPtX = 0, lastPtY = 0;
120
- for (let vertexIdx = 0; vertexIdx < vertexCount; vertexIdx++) {
121
- let pX = geometryCoords[coordsOffset + (vertexIdx * stride)];
122
- let pY = geometryCoords[coordsOffset + (vertexIdx * stride) + 1];
123
- if (relativeCoords) {
124
- pX = lastPtX = lastPtX + pX;
125
- pY = lastPtY = lastPtY + pY;
126
- }
127
- if (this._transform) {
128
- const transformedPoint = this._transform.multiplyPoint2d({ x: pX, y: pY });
129
- pX = transformedPoint.x;
130
- pY = transformedPoint.y;
131
- }
132
- this._symbol.drawPoint(this._context, pX, pY);
133
- }
134
- coordsOffset += stride * vertexCount;
135
- }
136
- }
137
- }
138
- }
1
+ /** @internal */
2
+ export class ArcGisFeatureRenderer {
3
+ constructor(context, symbol, world2PixelTransform) {
4
+ this._symbol = symbol;
5
+ this._context = context;
6
+ this._transform = world2PixelTransform;
7
+ }
8
+ get transform() { return this._transform; }
9
+ // Utility functions to make ease testing.
10
+ closePath() {
11
+ this._context.closePath();
12
+ }
13
+ lineTo(x, y) {
14
+ this._context.lineTo(x, y);
15
+ }
16
+ moveTo(x, y) {
17
+ this._context.moveTo(x, y);
18
+ }
19
+ fill() {
20
+ this._context.fill();
21
+ }
22
+ stroke() {
23
+ this._context.stroke();
24
+ }
25
+ /**
26
+ * Render a path on the renderer's context.
27
+ * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
28
+ * @param geometryLengths Array be used to determine the start and end of each sub-path / rings. (i.e. [5,5] = two rings of 5 vertices)
29
+ * @param geometryCoords Array that linearly encodes the vertices of each sub-path of a polyline / ring of a polygon
30
+ * @param fill Indicates if the path should be filled or not.
31
+ * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
32
+ */
33
+ renderPath(geometryLengths, geometryCoords, fill, stride, relativeCoords) {
34
+ if (stride < 2 || stride > 3) {
35
+ return;
36
+ }
37
+ // Keep track of our position in the in the 'coords' array:
38
+ // Every time we loop on the 'lengths' array, the position
39
+ // to start reading vertices in the 'coords' must be the sum of all previously read vertices.
40
+ let coordsOffset = 0;
41
+ // Begin the path here.
42
+ // Note: Even though path is closed inside the 'geometryLengths' loop,
43
+ // it's import to begin the path only once.
44
+ this._context.beginPath();
45
+ for (const vertexCount of geometryLengths) {
46
+ let lastPtX = 0, lastPtY = 0;
47
+ for (let vertexIdx = 0; vertexIdx < vertexCount; vertexIdx++) {
48
+ let pX = geometryCoords[coordsOffset + (vertexIdx * stride)];
49
+ let pY = geometryCoords[coordsOffset + (vertexIdx * stride) + 1];
50
+ if (vertexIdx === 0) {
51
+ // first vertex is always "absolute" and must be drawn as 'moveTo' (i.e. not lineTo)
52
+ if (relativeCoords) {
53
+ lastPtX = pX;
54
+ lastPtY = pY;
55
+ }
56
+ if (this._transform) {
57
+ const transformedPoint = this._transform.multiplyPoint2d({ x: pX, y: pY });
58
+ pX = transformedPoint.x;
59
+ pY = transformedPoint.y;
60
+ }
61
+ this.moveTo(pX, pY);
62
+ }
63
+ else {
64
+ // Following vertices are relative to the previous one (sadly not really well documented by ESRI)
65
+ // typically this happens when 'coordinates quantization' is active (i.e. no client side transformation is needed)
66
+ if (relativeCoords) {
67
+ pX = lastPtX = lastPtX + pX;
68
+ pY = lastPtY = lastPtY + pY;
69
+ }
70
+ if (this._transform) {
71
+ const transformedPoint = this._transform.multiplyPoint2d({ x: pX, y: pY });
72
+ pX = transformedPoint.x;
73
+ pY = transformedPoint.y;
74
+ }
75
+ this.lineTo(pX, pY);
76
+ }
77
+ }
78
+ coordsOffset += stride * vertexCount;
79
+ if (fill) {
80
+ // ClosePath but do not 'fill' here, only at the very end (otherwise it will mess up holes)
81
+ this.closePath();
82
+ }
83
+ }
84
+ if (fill) {
85
+ this._symbol.applyFillStyle(this._context);
86
+ this.fill();
87
+ }
88
+ this._symbol.applyStrokeStyle(this._context);
89
+ this.stroke(); // draw line path or polygon outline
90
+ }
91
+ /**
92
+ * Render a point on the renderer's context.
93
+ * Note: Inputs are designed based on the PBF format, to avoid any data transformation.
94
+ * @param geometryLengths Array be used to determine the start and end of each multi-point array, empty for single point.
95
+ * @param geometryCoords Array that linearly encodes vertices.
96
+ * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.
97
+ */
98
+ renderPoint(geometryLengths, geometryCoords, stride, relativeCoords) {
99
+ if (stride < 2 || stride > 3) {
100
+ return;
101
+ }
102
+ let coordsOffset = 0;
103
+ if (geometryLengths.length === 0) {
104
+ // Strangely, for points, 'lengths' array is empty, so we assume there is a single vertex in 'coords' array.
105
+ if (geometryCoords.length >= stride) {
106
+ if (this._transform) {
107
+ const transformedPoint = this._transform.multiplyPoint2d({ x: geometryCoords[0], y: geometryCoords[1] });
108
+ this._symbol.drawPoint(this._context, transformedPoint.x, transformedPoint.y);
109
+ }
110
+ else {
111
+ this._symbol.drawPoint(this._context, geometryCoords[0], geometryCoords[1]);
112
+ }
113
+ }
114
+ }
115
+ else {
116
+ // MULTI-POINTS: Needs testing
117
+ // I assume 'lengths' array will get populated and 'coords' array will look similar to line/polygons.
118
+ for (const vertexCount of geometryLengths) {
119
+ let lastPtX = 0, lastPtY = 0;
120
+ for (let vertexIdx = 0; vertexIdx < vertexCount; vertexIdx++) {
121
+ let pX = geometryCoords[coordsOffset + (vertexIdx * stride)];
122
+ let pY = geometryCoords[coordsOffset + (vertexIdx * stride) + 1];
123
+ if (relativeCoords) {
124
+ pX = lastPtX = lastPtX + pX;
125
+ pY = lastPtY = lastPtY + pY;
126
+ }
127
+ if (this._transform) {
128
+ const transformedPoint = this._transform.multiplyPoint2d({ x: pX, y: pY });
129
+ pX = transformedPoint.x;
130
+ pY = transformedPoint.y;
131
+ }
132
+ this._symbol.drawPoint(this._context, pX, pY);
133
+ }
134
+ coordsOffset += stride * vertexCount;
135
+ }
136
+ }
137
+ }
138
+ }
139
139
  //# sourceMappingURL=ArcGisFeatureRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGisFeatureRenderer.js","sourceRoot":"","sources":["../../../src/ArcGisFeature/ArcGisFeatureRenderer.ts"],"names":[],"mappings":"AAOA,gBAAgB;AAChB,MAAM,OAAO,qBAAqB;IAKhC,YAAY,OAAiC,EAAE,MAA+B,EAAE,oBAAgC;QAC9G,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC;IACzC,CAAC;IAED,IAAW,SAAS,KAAI,OAAO,IAAI,CAAC,UAAU,CAAC,CAAA,CAAC;IAEhD,0CAA0C;IAClC,SAAS;QACf,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC;IAEO,MAAM,CAAC,CAAS,EAAE,CAAS;QACjC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IAEO,MAAM,CAAC,CAAS,EAA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E,GAAG,OAAO,GAAG,OAAO,GAAC,EAAE,CAAC;qBAC3B;oBAED,IAAI,IAAI,CAAC,UAAU,EAAE;wBACnB,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;wBACxE,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC;wBACxB,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC;qBACzB;oBAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;iBAE/C;gBACD,YAAY,IAAE,MAAM,GAAC,WAAW,CAAC;aAClC;SACF;IAEH,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Transform } from \"@itwin/core-geometry\";\nimport { ArcGisSymbologyRenderer } from \"./ArcGisSymbologyRenderer\";\n\n/** @internal */\nexport class ArcGisFeatureRenderer {\n private _symbol: ArcGisSymbologyRenderer;\n private _transform: Transform|undefined;\n private _context: CanvasRenderingContext2D;\n\n constructor(context: CanvasRenderingContext2D, symbol: ArcGisSymbologyRenderer, world2PixelTransform?: Transform) {\n this._symbol = symbol;\n this._context = context;\n this._transform = world2PixelTransform;\n }\n\n public get transform() {return this._transform;}\n\n // Utility functions to make ease testing.\n private closePath() {\n this._context.closePath();\n }\n\n private lineTo(x: number, y: number) {\n this._context.lineTo(x,y);\n }\n\n private moveTo(x: number, y: number) {\n this._context.moveTo(x,y);\n }\n\n private fill() {\n this._context.fill();\n }\n\n private stroke() {\n this._context.stroke();\n }\n\n /**\n * Render a path on the renderer's context.\n * Note: Inputs are designed based on the PBF format, to avoid any data transformation.\n * @param geometryLengths Array be used to determine the start and end of each sub-path / rings. (i.e. [5,5] = two rings of 5 vertices)\n * @param geometryCoords Array that linearly encodes the vertices of each sub-path of a polyline / ring of a polygon\n * @param fill Indicates if the path should be filled or not.\n * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.\n */\n public renderPath(geometryLengths: number[], geometryCoords: number[], fill: boolean, stride: number, relativeCoords: boolean) {\n if (stride < 2 || stride > 3) {\n return;\n }\n\n // Keep track of our position in the in the 'coords' array:\n // Every time we loop on the 'lengths' array, the position\n // to start reading vertices in the 'coords' must be the sum of all previously read vertices.\n let coordsOffset = 0;\n\n // Begin the path here.\n // Note: Even though path is closed inside the 'geometryLengths' loop,\n // it's import to begin the path only once.\n this._context.beginPath();\n for (const vertexCount of geometryLengths) {\n let lastPtX = 0, lastPtY = 0;\n for (let vertexIdx=0 ; vertexIdx <vertexCount; vertexIdx++) {\n let pX = geometryCoords[coordsOffset+(vertexIdx*stride)];\n let pY = geometryCoords[coordsOffset+(vertexIdx*stride)+1];\n if (vertexIdx === 0) {\n // first vertex is always \"absolute\" and must be drawn as 'moveTo' (i.e. not lineTo)\n if (relativeCoords) {\n lastPtX = pX;\n lastPtY = pY;\n }\n\n if (this._transform) {\n const transformedPoint = this._transform.multiplyPoint2d({x: pX, y:pY});\n pX = transformedPoint.x;\n pY = transformedPoint.y;\n }\n\n this.moveTo(pX, pY);\n } else {\n\n // Following vertices are relative to the previous one (sadly not really well documented by ESRI)\n // typically this happens when 'coordinates quantization' is active (i.e. no client side transformation is needed)\n if (relativeCoords) {\n pX = lastPtX = lastPtX+pX;\n pY = lastPtY = lastPtY+pY;\n }\n\n if (this._transform) {\n const transformedPoint = this._transform.multiplyPoint2d({x: pX, y:pY});\n pX = transformedPoint.x;\n pY = transformedPoint.y;\n }\n this.lineTo(pX, pY);\n }\n\n }\n coordsOffset+=stride*vertexCount;\n if (fill) {\n // ClosePath but do not 'fill' here, only at the very end (otherwise it will mess up holes)\n this.closePath();\n }\n }\n\n if (fill) {\n this._symbol.applyFillStyle(this._context);\n this.fill();\n }\n\n this._symbol.applyStrokeStyle(this._context);\n this.stroke(); // draw line path or polygon outline\n }\n\n /**\n * Render a point on the renderer's context.\n * Note: Inputs are designed based on the PBF format, to avoid any data transformation.\n * @param geometryLengths Array be used to determine the start and end of each multi-point array, empty for single point.\n * @param geometryCoords Array that linearly encodes vertices.\n * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.\n */\n public renderPoint(geometryLengths: number[], geometryCoords: number[], stride: number, relativeCoords: boolean) {\n\n if (stride < 2 || stride > 3) {\n return;\n }\n let coordsOffset = 0;\n if (geometryLengths.length === 0) {\n // Strangely, for points, 'lengths' array is empty, so we assume there is a single vertex in 'coords' array.\n if (geometryCoords.length >= stride) {\n\n if (this._transform) {\n const transformedPoint = this._transform.multiplyPoint2d({x: geometryCoords[0], y:geometryCoords[1]});\n this._symbol.drawPoint(this._context, transformedPoint.x, transformedPoint.y);\n } else {\n this._symbol.drawPoint(this._context, geometryCoords[0], geometryCoords[1]);\n }\n }\n } else {\n // MULTI-POINTS: Needs testing\n // I assume 'lengths' array will get populated and 'coords' array will look similar to line/polygons.\n for (const vertexCount of geometryLengths) {\n let lastPtX = 0, lastPtY = 0;\n for (let vertexIdx=0 ; vertexIdx <vertexCount; vertexIdx++) {\n let pX = geometryCoords[coordsOffset+(vertexIdx*stride)];\n let pY = geometryCoords[coordsOffset+(vertexIdx*stride)+1];\n\n if (relativeCoords) {\n pX = lastPtX = lastPtX+pX;\n pY = lastPtY = lastPtY+pY;\n }\n\n if (this._transform) {\n const transformedPoint = this._transform.multiplyPoint2d({x: pX, y:pY});\n pX = transformedPoint.x;\n pY = transformedPoint.y;\n }\n\n this._symbol.drawPoint(this._context, pX, pY);\n\n }\n coordsOffset+=stride*vertexCount;\n }\n }\n\n }\n\n}\n"]}
1
+ {"version":3,"file":"ArcGisFeatureRenderer.js","sourceRoot":"","sources":["../../../src/ArcGisFeature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AE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC7E;aACF;SACF;aAAM;YACL,8BAA8B;YAC9B,qGAAqG;YACrG,KAAK,MAAM,WAAW,IAAI,eAAe,EAAE;gBACzC,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC;gBAC7B,KAAK,IAAI,SAAS,GAAC,CAAC,EAAG,SAAS,GAAE,WAAW,EAAE,SAAS,EAAE,EAAE;oBAC1D,IAAI,EAAE,GAAG,cAAc,CAAC,YAAY,GAAC,CAAC,SAAS,GAAC,MAAM,CAAC,CAAC,CAAC;oBACzD,IAAI,EAAE,GAAG,cAAc,CAAC,YAAY,GAAC,CAAC,SAAS,GAAC,MAAM,CAAC,GAAC,CAAC,CAAC,CAAC;oBAE3D,IAAI,cAAc,EAAE;wBAClB,EAAE,GAAG,OAAO,GAAG,OAAO,GAAC,EAAE,CAAC;wBAC1B,EAAE,GAAG,OAAO,GAAG,OAAO,GAAC,EAAE,CAAC;qBAC3B;oBAED,IAAI,IAAI,CAAC,UAAU,EAAE;wBACnB,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAC,EAAE,EAAC,CAAC,CAAC;wBACxE,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC;wBACxB,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC;qBACzB;oBAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;iBAE/C;gBACD,YAAY,IAAE,MAAM,GAAC,WAAW,CAAC;aAClC;SACF;IAEH,CAAC;CAEF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { Transform } from \"@itwin/core-geometry\";\r\nimport { ArcGisSymbologyRenderer } from \"./ArcGisSymbologyRenderer\";\r\n\r\n/** @internal */\r\nexport class ArcGisFeatureRenderer {\r\n private _symbol: ArcGisSymbologyRenderer;\r\n private _transform: Transform|undefined;\r\n private _context: CanvasRenderingContext2D;\r\n\r\n constructor(context: CanvasRenderingContext2D, symbol: ArcGisSymbologyRenderer, world2PixelTransform?: Transform) {\r\n this._symbol = symbol;\r\n this._context = context;\r\n this._transform = world2PixelTransform;\r\n }\r\n\r\n public get transform() {return this._transform;}\r\n\r\n // Utility functions to make ease testing.\r\n private closePath() {\r\n this._context.closePath();\r\n }\r\n\r\n private lineTo(x: number, y: number) {\r\n this._context.lineTo(x,y);\r\n }\r\n\r\n private moveTo(x: number, y: number) {\r\n this._context.moveTo(x,y);\r\n }\r\n\r\n private fill() {\r\n this._context.fill();\r\n }\r\n\r\n private stroke() {\r\n this._context.stroke();\r\n }\r\n\r\n /**\r\n * Render a path on the renderer's context.\r\n * Note: Inputs are designed based on the PBF format, to avoid any data transformation.\r\n * @param geometryLengths Array be used to determine the start and end of each sub-path / rings. (i.e. [5,5] = two rings of 5 vertices)\r\n * @param geometryCoords Array that linearly encodes the vertices of each sub-path of a polyline / ring of a polygon\r\n * @param fill Indicates if the path should be filled or not.\r\n * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.\r\n */\r\n public renderPath(geometryLengths: number[], geometryCoords: number[], fill: boolean, stride: number, relativeCoords: boolean) {\r\n if (stride < 2 || stride > 3) {\r\n return;\r\n }\r\n\r\n // Keep track of our position in the in the 'coords' array:\r\n // Every time we loop on the 'lengths' array, the position\r\n // to start reading vertices in the 'coords' must be the sum of all previously read vertices.\r\n let coordsOffset = 0;\r\n\r\n // Begin the path here.\r\n // Note: Even though path is closed inside the 'geometryLengths' loop,\r\n // it's import to begin the path only once.\r\n this._context.beginPath();\r\n for (const vertexCount of geometryLengths) {\r\n let lastPtX = 0, lastPtY = 0;\r\n for (let vertexIdx=0 ; vertexIdx <vertexCount; vertexIdx++) {\r\n let pX = geometryCoords[coordsOffset+(vertexIdx*stride)];\r\n let pY = geometryCoords[coordsOffset+(vertexIdx*stride)+1];\r\n if (vertexIdx === 0) {\r\n // first vertex is always \"absolute\" and must be drawn as 'moveTo' (i.e. not lineTo)\r\n if (relativeCoords) {\r\n lastPtX = pX;\r\n lastPtY = pY;\r\n }\r\n\r\n if (this._transform) {\r\n const transformedPoint = this._transform.multiplyPoint2d({x: pX, y:pY});\r\n pX = transformedPoint.x;\r\n pY = transformedPoint.y;\r\n }\r\n\r\n this.moveTo(pX, pY);\r\n } else {\r\n\r\n // Following vertices are relative to the previous one (sadly not really well documented by ESRI)\r\n // typically this happens when 'coordinates quantization' is active (i.e. no client side transformation is needed)\r\n if (relativeCoords) {\r\n pX = lastPtX = lastPtX+pX;\r\n pY = lastPtY = lastPtY+pY;\r\n }\r\n\r\n if (this._transform) {\r\n const transformedPoint = this._transform.multiplyPoint2d({x: pX, y:pY});\r\n pX = transformedPoint.x;\r\n pY = transformedPoint.y;\r\n }\r\n this.lineTo(pX, pY);\r\n }\r\n\r\n }\r\n coordsOffset+=stride*vertexCount;\r\n if (fill) {\r\n // ClosePath but do not 'fill' here, only at the very end (otherwise it will mess up holes)\r\n this.closePath();\r\n }\r\n }\r\n\r\n if (fill) {\r\n this._symbol.applyFillStyle(this._context);\r\n this.fill();\r\n }\r\n\r\n this._symbol.applyStrokeStyle(this._context);\r\n this.stroke(); // draw line path or polygon outline\r\n }\r\n\r\n /**\r\n * Render a point on the renderer's context.\r\n * Note: Inputs are designed based on the PBF format, to avoid any data transformation.\r\n * @param geometryLengths Array be used to determine the start and end of each multi-point array, empty for single point.\r\n * @param geometryCoords Array that linearly encodes vertices.\r\n * @param stride Dimension of each vertices (i.e. 2 or 3. 3 could be X,Y,Z, X,YM) Currently 3rd dimension is ignored.\r\n */\r\n public renderPoint(geometryLengths: number[], geometryCoords: number[], stride: number, relativeCoords: boolean) {\r\n\r\n if (stride < 2 || stride > 3) {\r\n return;\r\n }\r\n let coordsOffset = 0;\r\n if (geometryLengths.length === 0) {\r\n // Strangely, for points, 'lengths' array is empty, so we assume there is a single vertex in 'coords' array.\r\n if (geometryCoords.length >= stride) {\r\n\r\n if (this._transform) {\r\n const transformedPoint = this._transform.multiplyPoint2d({x: geometryCoords[0], y:geometryCoords[1]});\r\n this._symbol.drawPoint(this._context, transformedPoint.x, transformedPoint.y);\r\n } else {\r\n this._symbol.drawPoint(this._context, geometryCoords[0], geometryCoords[1]);\r\n }\r\n }\r\n } else {\r\n // MULTI-POINTS: Needs testing\r\n // I assume 'lengths' array will get populated and 'coords' array will look similar to line/polygons.\r\n for (const vertexCount of geometryLengths) {\r\n let lastPtX = 0, lastPtY = 0;\r\n for (let vertexIdx=0 ; vertexIdx <vertexCount; vertexIdx++) {\r\n let pX = geometryCoords[coordsOffset+(vertexIdx*stride)];\r\n let pY = geometryCoords[coordsOffset+(vertexIdx*stride)+1];\r\n\r\n if (relativeCoords) {\r\n pX = lastPtX = lastPtX+pX;\r\n pY = lastPtY = lastPtY+pY;\r\n }\r\n\r\n if (this._transform) {\r\n const transformedPoint = this._transform.multiplyPoint2d({x: pX, y:pY});\r\n pX = transformedPoint.x;\r\n pY = transformedPoint.y;\r\n }\r\n\r\n this._symbol.drawPoint(this._context, pX, pY);\r\n\r\n }\r\n coordsOffset+=stride*vertexCount;\r\n }\r\n }\r\n\r\n }\r\n\r\n}\r\n"]}
@@ -1,17 +1,17 @@
1
- import { ArcGisExtent, ArcGisFeatureFormat } from "./ArcGisFeatureQuery";
2
- /** @internal */
3
- export interface ArcGisResponseData {
4
- data: any;
5
- exceedTransferLimit: boolean;
6
- }
7
- /** @internal */
8
- export declare type ArcGisFieldType = "esriFieldTypeInteger" | "esriFieldTypeSmallInteger" | "esriFieldTypeDouble" | "esriFieldTypeSingle" | "esriFieldTypeString" | "esriFieldTypeDate" | "esriFieldTypeGeometry" | "esriFieldTypeOID" | "esriFieldTypeBlob" | "esriFieldTypeGlobalID" | "esriFieldTypeRaster" | "esriFieldTypeGUID" | "esriFieldTypeXML";
9
- /** @internal */
10
- export declare class ArcGisFeatureResponse {
11
- readonly format: ArcGisFeatureFormat;
12
- readonly envelope: ArcGisExtent | undefined;
13
- private _response;
14
- constructor(format: ArcGisFeatureFormat, response: Promise<Response>, envelope?: ArcGisExtent);
15
- getResponseData(): Promise<ArcGisResponseData | undefined>;
16
- }
1
+ import { ArcGisExtent, ArcGisFeatureFormat } from "./ArcGisFeatureQuery";
2
+ /** @internal */
3
+ export interface ArcGisResponseData {
4
+ data: any;
5
+ exceedTransferLimit: boolean;
6
+ }
7
+ /** @internal */
8
+ export declare type ArcGisFieldType = "esriFieldTypeInteger" | "esriFieldTypeSmallInteger" | "esriFieldTypeDouble" | "esriFieldTypeSingle" | "esriFieldTypeString" | "esriFieldTypeDate" | "esriFieldTypeGeometry" | "esriFieldTypeOID" | "esriFieldTypeBlob" | "esriFieldTypeGlobalID" | "esriFieldTypeRaster" | "esriFieldTypeGUID" | "esriFieldTypeXML";
9
+ /** @internal */
10
+ export declare class ArcGisFeatureResponse {
11
+ readonly format: ArcGisFeatureFormat;
12
+ readonly envelope: ArcGisExtent | undefined;
13
+ private _response;
14
+ constructor(format: ArcGisFeatureFormat, response: Promise<Response>, envelope?: ArcGisExtent);
15
+ getResponseData(): Promise<ArcGisResponseData | undefined>;
16
+ }
17
17
  //# sourceMappingURL=ArcGisFeatureResponse.d.ts.map
@@ -1,39 +1,39 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import { esriPBuffer } from "./esriPBuffer.gen";
6
- /** @internal */
7
- export class ArcGisFeatureResponse {
8
- constructor(format, response, envelope) {
9
- this.format = format;
10
- this._response = response;
11
- this.envelope = envelope;
12
- }
13
- async getResponseData() {
14
- let data;
15
- try {
16
- const tileResponse = await this._response;
17
- if (tileResponse === undefined || tileResponse.status !== 200)
18
- return undefined;
19
- if (this.format === "PBF") {
20
- const byteArray = new Uint8Array(await tileResponse.arrayBuffer());
21
- if (!byteArray || (byteArray.length === 0))
22
- return undefined;
23
- data = esriPBuffer.FeatureCollectionPBuffer.deserialize(byteArray);
24
- const collection = data;
25
- return { data, exceedTransferLimit: collection?.queryResult?.featureResult?.exceededTransferLimit };
26
- }
27
- else {
28
- data = await tileResponse.json();
29
- if (data === undefined || data == null)
30
- return undefined;
31
- return { data, exceedTransferLimit: data.exceededTransferLimit };
32
- }
33
- }
34
- catch (_e) {
35
- return undefined;
36
- }
37
- }
38
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { esriPBuffer } from "./esriPBuffer.gen";
6
+ /** @internal */
7
+ export class ArcGisFeatureResponse {
8
+ constructor(format, response, envelope) {
9
+ this.format = format;
10
+ this._response = response;
11
+ this.envelope = envelope;
12
+ }
13
+ async getResponseData() {
14
+ let data;
15
+ try {
16
+ const tileResponse = await this._response;
17
+ if (tileResponse === undefined || tileResponse.status !== 200)
18
+ return undefined;
19
+ if (this.format === "PBF") {
20
+ const byteArray = new Uint8Array(await tileResponse.arrayBuffer());
21
+ if (!byteArray || (byteArray.length === 0))
22
+ return undefined;
23
+ data = esriPBuffer.FeatureCollectionPBuffer.deserialize(byteArray);
24
+ const collection = data;
25
+ return { data, exceedTransferLimit: collection?.queryResult?.featureResult?.exceededTransferLimit };
26
+ }
27
+ else {
28
+ data = await tileResponse.json();
29
+ if (data === undefined || data == null)
30
+ return undefined;
31
+ return { data, exceedTransferLimit: data.exceededTransferLimit };
32
+ }
33
+ }
34
+ catch (_e) {
35
+ return undefined;
36
+ }
37
+ }
38
+ }
39
39
  //# sourceMappingURL=ArcGisFeatureResponse.js.map