@itwin/map-layers-formats 4.1.0-dev.54 → 4.1.0-dev.56

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 (272) hide show
  1. package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.d.ts +17 -0
  2. package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.d.ts.map +1 -0
  3. package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.js +42 -0
  4. package/lib/cjs/ArcGisFeature/ArcGisCanvasRenderer.js.map +1 -0
  5. package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
  6. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +4 -5
  7. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
  8. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +39 -24
  9. package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  10. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts +5 -0
  11. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
  12. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js +4 -0
  13. package/lib/cjs/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
  14. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts +15 -6
  15. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
  16. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js +6 -4
  17. package/lib/cjs/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
  18. package/lib/cjs/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
  19. package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +13 -0
  20. package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -0
  21. package/lib/cjs/ArcGisFeature/{ArcGisFeatureJSON.js → ArcGisJsonFeatureReader.js} +36 -58
  22. package/lib/cjs/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -0
  23. package/lib/cjs/ArcGisFeature/{ArcGisFeaturePBF.d.ts → ArcGisPbfFeatureReader.d.ts} +6 -7
  24. package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -0
  25. package/lib/cjs/ArcGisFeature/{ArcGisFeaturePBF.js → ArcGisPbfFeatureReader.js} +46 -32
  26. package/lib/cjs/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -0
  27. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +1 -1
  28. package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  29. package/lib/cjs/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
  30. package/lib/cjs/Tools/MapFeatureInfoDecorator.d.ts +34 -0
  31. package/lib/cjs/Tools/MapFeatureInfoDecorator.d.ts.map +1 -0
  32. package/lib/cjs/Tools/MapFeatureInfoDecorator.js +281 -0
  33. package/lib/cjs/Tools/MapFeatureInfoDecorator.js.map +1 -0
  34. package/lib/cjs/Tools/MapFeatureInfoTool.d.ts +38 -0
  35. package/lib/cjs/Tools/MapFeatureInfoTool.d.ts.map +1 -0
  36. package/lib/cjs/Tools/MapFeatureInfoTool.js +113 -0
  37. package/lib/cjs/Tools/MapFeatureInfoTool.js.map +1 -0
  38. package/lib/cjs/map-layers-formats.d.ts +1 -0
  39. package/lib/cjs/map-layers-formats.d.ts.map +1 -1
  40. package/lib/cjs/map-layers-formats.js +1 -0
  41. package/lib/cjs/map-layers-formats.js.map +1 -1
  42. package/lib/cjs/mapLayersFormats.d.ts +12 -1
  43. package/lib/cjs/mapLayersFormats.d.ts.map +1 -1
  44. package/lib/cjs/mapLayersFormats.js +11 -1
  45. package/lib/cjs/mapLayersFormats.js.map +1 -1
  46. package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.d.ts +17 -0
  47. package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.d.ts.map +1 -0
  48. package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.js +38 -0
  49. package/lib/esm/ArcGisFeature/ArcGisCanvasRenderer.js.map +1 -0
  50. package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
  51. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +4 -5
  52. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
  53. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +40 -25
  54. package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
  55. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts +5 -0
  56. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.d.ts.map +1 -1
  57. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js +4 -0
  58. package/lib/esm/ArcGisFeature/ArcGisFeatureQuery.js.map +1 -1
  59. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts +15 -6
  60. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.d.ts.map +1 -1
  61. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js +4 -2
  62. package/lib/esm/ArcGisFeature/ArcGisFeatureReader.js.map +1 -1
  63. package/lib/esm/ArcGisFeature/ArcGisFeatureResponse.js.map +1 -1
  64. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts +13 -0
  65. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.d.ts.map +1 -0
  66. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js +107 -0
  67. package/lib/esm/ArcGisFeature/ArcGisJsonFeatureReader.js.map +1 -0
  68. package/lib/esm/ArcGisFeature/{ArcGisFeaturePBF.d.ts → ArcGisPbfFeatureReader.d.ts} +6 -7
  69. package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.d.ts.map +1 -0
  70. package/lib/esm/ArcGisFeature/{ArcGisFeaturePBF.js → ArcGisPbfFeatureReader.js} +44 -30
  71. package/lib/esm/ArcGisFeature/ArcGisPbfFeatureReader.js.map +1 -0
  72. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +1 -1
  73. package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
  74. package/lib/esm/ArcGisFeature/esriPBuffer.gen.js.map +1 -1
  75. package/lib/esm/Tools/MapFeatureInfoDecorator.d.ts +34 -0
  76. package/lib/esm/Tools/MapFeatureInfoDecorator.d.ts.map +1 -0
  77. package/lib/esm/Tools/MapFeatureInfoDecorator.js +277 -0
  78. package/lib/esm/Tools/MapFeatureInfoDecorator.js.map +1 -0
  79. package/lib/esm/Tools/MapFeatureInfoTool.d.ts +38 -0
  80. package/lib/esm/Tools/MapFeatureInfoTool.d.ts.map +1 -0
  81. package/lib/esm/Tools/MapFeatureInfoTool.js +110 -0
  82. package/lib/esm/Tools/MapFeatureInfoTool.js.map +1 -0
  83. package/lib/esm/map-layers-formats.d.ts +1 -0
  84. package/lib/esm/map-layers-formats.d.ts.map +1 -1
  85. package/lib/esm/map-layers-formats.js +1 -0
  86. package/lib/esm/map-layers-formats.js.map +1 -1
  87. package/lib/esm/mapLayersFormats.d.ts +12 -1
  88. package/lib/esm/mapLayersFormats.d.ts.map +1 -1
  89. package/lib/esm/mapLayersFormats.js +13 -2
  90. package/lib/esm/mapLayersFormats.js.map +1 -1
  91. package/lib/public/locales/en/mapLayersFormats.json +12 -0
  92. package/package.json +15 -12
  93. package/.nycrc +0 -10
  94. package/.rush/temp/operation/build/all.log +0 -1
  95. package/.rush/temp/operation/build/state.json +0 -3
  96. package/.rush/temp/operation/cover/all.log +0 -103
  97. package/.rush/temp/operation/cover/state.json +0 -3
  98. package/.rush/temp/operation/docs/all.log +0 -30
  99. package/.rush/temp/operation/docs/state.json +0 -3
  100. package/.rush/temp/package-deps_build.json +0 -36
  101. package/.rush/temp/package-deps_cover.json +0 -36
  102. package/.rush/temp/package-deps_docs.json +0 -36
  103. package/.rush/temp/shrinkwrap-deps.json +0 -495
  104. package/CHANGELOG.json +0 -176
  105. package/config/rush-project.json +0 -6
  106. package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.d.ts +0 -15
  107. package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.d.ts.map +0 -1
  108. package/lib/cjs/ArcGisFeature/ArcGisFeatureJSON.js.map +0 -1
  109. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.d.ts.map +0 -1
  110. package/lib/cjs/ArcGisFeature/ArcGisFeaturePBF.js.map +0 -1
  111. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.d.ts +0 -33
  112. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.d.ts.map +0 -1
  113. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.js +0 -143
  114. package/lib/cjs/ArcGisFeature/ArcGisFeatureRenderer.js.map +0 -1
  115. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +0 -2
  116. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts.map +0 -1
  117. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +0 -35
  118. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js.map +0 -1
  119. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +0 -2
  120. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts.map +0 -1
  121. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.js +0 -162
  122. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureJSON.test.js.map +0 -1
  123. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +0 -2
  124. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts.map +0 -1
  125. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.js +0 -168
  126. package/lib/cjs/test/ArcGisFeature/ArcGisFeaturePBF.test.js.map +0 -1
  127. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +0 -2
  128. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts.map +0 -1
  129. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js +0 -812
  130. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +0 -1
  131. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +0 -2
  132. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts.map +0 -1
  133. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.js +0 -104
  134. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureQuery.test.js.map +0 -1
  135. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +0 -2
  136. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts.map +0 -1
  137. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +0 -215
  138. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureRenderer.test.js.map +0 -1
  139. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +0 -2
  140. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts.map +0 -1
  141. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js +0 -95
  142. package/lib/cjs/test/ArcGisFeature/ArcGisFeatureResponse.test.js.map +0 -1
  143. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +0 -2
  144. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts.map +0 -1
  145. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +0 -60
  146. package/lib/cjs/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js.map +0 -1
  147. package/lib/cjs/test/ArcGisFeature/Mocks.d.ts +0 -7
  148. package/lib/cjs/test/ArcGisFeature/Mocks.d.ts.map +0 -1
  149. package/lib/cjs/test/ArcGisFeature/Mocks.js +0 -19
  150. package/lib/cjs/test/ArcGisFeature/Mocks.js.map +0 -1
  151. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.d.ts +0 -56
  152. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.d.ts.map +0 -1
  153. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js +0 -420
  154. package/lib/cjs/test/ArcGisFeature/NewYorkDataset.js.map +0 -1
  155. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +0 -1043
  156. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.d.ts.map +0 -1
  157. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js +0 -427
  158. package/lib/cjs/test/ArcGisFeature/PhillyLandmarksDataset.js.map +0 -1
  159. package/lib/cjs/test/coverage/.nyc_output/329513f2-7069-4b0e-a487-c3b48366153a.json +0 -1
  160. package/lib/cjs/test/coverage/.nyc_output/a1ec61a9-c1af-46dd-9c85-a6f85693894b.json +0 -1
  161. package/lib/cjs/test/coverage/.nyc_output/processinfo/329513f2-7069-4b0e-a487-c3b48366153a.json +0 -1
  162. package/lib/cjs/test/coverage/.nyc_output/processinfo/a1ec61a9-c1af-46dd-9c85-a6f85693894b.json +0 -1
  163. package/lib/cjs/test/coverage/.nyc_output/processinfo/index.json +0 -1
  164. package/lib/cjs/test/coverage/cobertura-coverage.xml +0 -1206
  165. package/lib/cjs/test/coverage/lcov-report/base.css +0 -224
  166. package/lib/cjs/test/coverage/lcov-report/block-navigation.js +0 -87
  167. package/lib/cjs/test/coverage/lcov-report/favicon.png +0 -0
  168. package/lib/cjs/test/coverage/lcov-report/index.html +0 -131
  169. package/lib/cjs/test/coverage/lcov-report/prettify.css +0 -1
  170. package/lib/cjs/test/coverage/lcov-report/prettify.js +0 -2
  171. package/lib/cjs/test/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  172. package/lib/cjs/test/coverage/lcov-report/sorter.js +0 -196
  173. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureFormat.ts.html +0 -145
  174. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureJSON.ts.html +0 -550
  175. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeaturePBF.ts.html +0 -730
  176. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureProvider.ts.html +0 -1672
  177. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureQuery.ts.html +0 -763
  178. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureReader.ts.html +0 -223
  179. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureRenderer.ts.html +0 -598
  180. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureResponse.ts.html +0 -301
  181. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisSymbologyRenderer.ts.html +0 -832
  182. package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/index.html +0 -236
  183. package/lib/cjs/test/coverage/lcov-report/src/index.html +0 -131
  184. package/lib/cjs/test/coverage/lcov-report/src/map-layers-formats.ts.html +0 -130
  185. package/lib/cjs/test/coverage/lcov-report/src/mapLayersFormats.ts.html +0 -163
  186. package/lib/cjs/test/coverage/lcov.info +0 -1399
  187. package/lib/cjs/tsconfig.tsbuildinfo +0 -1
  188. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.d.ts +0 -15
  189. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.d.ts.map +0 -1
  190. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js +0 -129
  191. package/lib/esm/ArcGisFeature/ArcGisFeatureJSON.js.map +0 -1
  192. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.d.ts.map +0 -1
  193. package/lib/esm/ArcGisFeature/ArcGisFeaturePBF.js.map +0 -1
  194. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.d.ts +0 -33
  195. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.d.ts.map +0 -1
  196. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.js +0 -139
  197. package/lib/esm/ArcGisFeature/ArcGisFeatureRenderer.js.map +0 -1
  198. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts +0 -2
  199. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.d.ts.map +0 -1
  200. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js +0 -33
  201. package/lib/esm/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.js.map +0 -1
  202. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts +0 -2
  203. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.d.ts.map +0 -1
  204. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.js +0 -160
  205. package/lib/esm/test/ArcGisFeature/ArcGisFeatureJSON.test.js.map +0 -1
  206. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts +0 -2
  207. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.d.ts.map +0 -1
  208. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.js +0 -166
  209. package/lib/esm/test/ArcGisFeature/ArcGisFeaturePBF.test.js.map +0 -1
  210. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts +0 -2
  211. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.d.ts.map +0 -1
  212. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js +0 -810
  213. package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +0 -1
  214. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts +0 -2
  215. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.d.ts.map +0 -1
  216. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.js +0 -102
  217. package/lib/esm/test/ArcGisFeature/ArcGisFeatureQuery.test.js.map +0 -1
  218. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts +0 -2
  219. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.d.ts.map +0 -1
  220. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.js +0 -213
  221. package/lib/esm/test/ArcGisFeature/ArcGisFeatureRenderer.test.js.map +0 -1
  222. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts +0 -2
  223. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.d.ts.map +0 -1
  224. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js +0 -93
  225. package/lib/esm/test/ArcGisFeature/ArcGisFeatureResponse.test.js.map +0 -1
  226. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts +0 -2
  227. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.d.ts.map +0 -1
  228. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js +0 -58
  229. package/lib/esm/test/ArcGisFeature/ArcGisSymbologyRenderer.test.js.map +0 -1
  230. package/lib/esm/test/ArcGisFeature/Mocks.d.ts +0 -7
  231. package/lib/esm/test/ArcGisFeature/Mocks.d.ts.map +0 -1
  232. package/lib/esm/test/ArcGisFeature/Mocks.js +0 -16
  233. package/lib/esm/test/ArcGisFeature/Mocks.js.map +0 -1
  234. package/lib/esm/test/ArcGisFeature/NewYorkDataset.d.ts +0 -56
  235. package/lib/esm/test/ArcGisFeature/NewYorkDataset.d.ts.map +0 -1
  236. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js +0 -417
  237. package/lib/esm/test/ArcGisFeature/NewYorkDataset.js.map +0 -1
  238. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.d.ts +0 -1043
  239. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.d.ts.map +0 -1
  240. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js +0 -424
  241. package/lib/esm/test/ArcGisFeature/PhillyLandmarksDataset.js.map +0 -1
  242. package/lib/esm/tsconfig.tsbuildinfo +0 -1
  243. package/lib/test/junit_results.xml +0 -169
  244. package/map-layers-formats.build.cache.log +0 -2
  245. package/map-layers-formats.cover.log +0 -103
  246. package/map-layers-formats.docs.log +0 -30
  247. package/map-layers-formats.lint.error.log +0 -1
  248. package/map-layers-formats.lint.log +0 -2
  249. package/src/ArcGisFeature/ArcGisFeatureFormat.ts +0 -20
  250. package/src/ArcGisFeature/ArcGisFeatureJSON.ts +0 -155
  251. package/src/ArcGisFeature/ArcGisFeaturePBF.ts +0 -215
  252. package/src/ArcGisFeature/ArcGisFeatureProvider.ts +0 -529
  253. package/src/ArcGisFeature/ArcGisFeatureQuery.ts +0 -226
  254. package/src/ArcGisFeature/ArcGisFeatureReader.ts +0 -46
  255. package/src/ArcGisFeature/ArcGisFeatureRenderer.ts +0 -171
  256. package/src/ArcGisFeature/ArcGisFeatureResponse.ts +0 -72
  257. package/src/ArcGisFeature/ArcGisSymbologyRenderer.ts +0 -249
  258. package/src/ArcGisFeature/esriPBuffer.gen.ts +0 -2612
  259. package/src/map-layers-formats.ts +0 -15
  260. package/src/mapLayersFormats.ts +0 -26
  261. package/src/test/ArcGisFeature/ArcGisFeatureFeatureFormats.test.ts +0 -46
  262. package/src/test/ArcGisFeature/ArcGisFeatureJSON.test.ts +0 -202
  263. package/src/test/ArcGisFeature/ArcGisFeaturePBF.test.ts +0 -227
  264. package/src/test/ArcGisFeature/ArcGisFeatureProvider.test.ts +0 -977
  265. package/src/test/ArcGisFeature/ArcGisFeatureQuery.test.ts +0 -117
  266. package/src/test/ArcGisFeature/ArcGisFeatureRenderer.test.ts +0 -296
  267. package/src/test/ArcGisFeature/ArcGisFeatureResponse.test.ts +0 -109
  268. package/src/test/ArcGisFeature/ArcGisSymbologyRenderer.test.ts +0 -77
  269. package/src/test/ArcGisFeature/Mocks.ts +0 -19
  270. package/src/test/ArcGisFeature/NewYorkDataset.ts +0 -423
  271. package/src/test/ArcGisFeature/PhillyLandmarksDataset.ts +0 -455
  272. package/tsconfig.json +0 -20
@@ -1,810 +0,0 @@
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 { Base64EncodedString, Cartographic, ImageMapLayerSettings, ImageSourceFormat, ServerError } from "@itwin/core-common";
6
- import * as chai from "chai";
7
- import * as chaiAsPromised from "chai-as-promised";
8
- import { ArcGisFeatureMapLayerFormat } from "../../ArcGisFeature/ArcGisFeatureFormat";
9
- import { ArcGisFeatureProvider } from "../../map-layers-formats";
10
- import * as sinon from "sinon";
11
- import { ArcGISImageryProvider, ArcGisUtilities, MapLayerImageryProviderStatus, QuadId } from "@itwin/core-frontend";
12
- import { NewYorkDataset } from "./NewYorkDataset";
13
- import { base64StringToUint8Array, ByteStream, Logger } from "@itwin/core-bentley";
14
- import { PhillyLandmarksDataset } from "./PhillyLandmarksDataset";
15
- import { ArcGisFeatureResponse } from "../../ArcGisFeature/ArcGisFeatureResponse";
16
- import { Angle, Point3d } from "@itwin/core-geometry";
17
- import { ArcGisFeaturePBF } from "../../ArcGisFeature/ArcGisFeaturePBF";
18
- import { ArcGisFeatureJSON } from "../../ArcGisFeature/ArcGisFeatureJSON";
19
- const expect = chai.expect;
20
- chai.use(chaiAsPromised);
21
- const esriFeatureSampleSource = { name: "dummyFeatureLayer", url: "https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer", formatId: ArcGisFeatureMapLayerFormat.formatId };
22
- const pngTransparent1x1 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
23
- describe("ArcGisFeatureProvider", () => {
24
- const sandbox = sinon.createSandbox();
25
- let fetchStub;
26
- beforeEach(async () => {
27
- // Make sure no call to fetch is made, other it creates leaks
28
- fetchStub = sandbox.stub(ArcGISImageryProvider.prototype, "fetch");
29
- });
30
- afterEach(async () => {
31
- sandbox.restore();
32
- });
33
- it("should initialize with valid service metadata", async () => {
34
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
35
- return { accessTokenRequired: false, content: NewYorkDataset.serviceCapabilities };
36
- });
37
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function _(_layerId) {
38
- return NewYorkDataset.streetsLayerCapabilities;
39
- });
40
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
41
- const provider = new ArcGisFeatureProvider(settings);
42
- await provider.initialize();
43
- expect(provider._minDepthFromLod).to.equals(11);
44
- expect(provider._maxDepthFromLod).to.equals(22);
45
- });
46
- it("should initialize and set cartoRange without making extra extent request", async () => {
47
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
48
- return { accessTokenRequired: false, content: NewYorkDataset.serviceCapabilities };
49
- });
50
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function _(_layerId) {
51
- return NewYorkDataset.streetsLayerCapabilities;
52
- });
53
- const setCartoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "setCartoRangeFromExtentJson");
54
- const fetchLayerExtentSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "fetchLayerExtent");
55
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
56
- const provider = new ArcGisFeatureProvider(settings);
57
- await provider.initialize();
58
- expect(setCartoSpy.called).to.be.true;
59
- expect(setCartoSpy.args[0][0]).to.be.equals(NewYorkDataset.streetsLayerCapabilities.extent);
60
- expect(fetchLayerExtentSpy.called).to.be.false;
61
- });
62
- it("should make an extra extent request when none available in layer metadata", async () => {
63
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
64
- return { accessTokenRequired: false, content: NewYorkDataset.serviceCapabilities };
65
- });
66
- const setCartoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "setCartoRangeFromExtentJson");
67
- const layerExtent = { ...NewYorkDataset.streetsLayerCapabilities.extent };
68
- const fetchLayerExtentStub = sandbox.stub(ArcGisFeatureProvider.prototype, "fetchLayerExtent").callsFake(async function _(_layerId) {
69
- return layerExtent;
70
- });
71
- const layerCapabilitiesNoExtent = { ...NewYorkDataset.streetsLayerCapabilities, extent: null };
72
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function _(_layerId) {
73
- return layerCapabilitiesNoExtent;
74
- });
75
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
76
- const provider = new ArcGisFeatureProvider(settings);
77
- await provider.initialize();
78
- expect(fetchLayerExtentStub.called).to.be.true;
79
- expect(setCartoSpy.called).to.be.true;
80
- expect(setCartoSpy.args[0][0]).to.be.equals(layerExtent);
81
- });
82
- it("should make an extra extent request when none available in layer metadata", async () => {
83
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
84
- return { accessTokenRequired: false, content: NewYorkDataset.serviceCapabilities };
85
- });
86
- const setCartoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "setCartoRangeFromExtentJson");
87
- const layerExtent = { ...NewYorkDataset.streetsLayerCapabilities.extent };
88
- const fetchLayerExtentStub = sandbox.stub(ArcGisFeatureProvider.prototype, "fetchLayerExtent").callsFake(async function _(_layerId) {
89
- return layerExtent;
90
- });
91
- const layerExtentBadSrs = { ...NewYorkDataset.streetsLayerCapabilities };
92
- layerExtentBadSrs.extent.spatialReference.wkid = 1234;
93
- layerExtentBadSrs.extent.spatialReference.latestWkid = 1234;
94
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function _(_layerId) {
95
- return layerExtentBadSrs;
96
- });
97
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
98
- const provider = new ArcGisFeatureProvider(settings);
99
- await provider.initialize();
100
- expect(fetchLayerExtentStub.called).to.be.true;
101
- expect(setCartoSpy.called).to.be.true;
102
- expect(setCartoSpy.args[0][0]).to.be.equals(layerExtent);
103
- });
104
- it("should set cartoRange from Extent json", async () => {
105
- const newYorkLayerExtent = NewYorkDataset.streetsLayerCapabilities.extent;
106
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
107
- const provider = new ArcGisFeatureProvider(settings);
108
- const west = provider.getEPSG4326Lon(newYorkLayerExtent.xmin);
109
- const south = provider.getEPSG4326Lat(newYorkLayerExtent.ymin);
110
- const east = provider.getEPSG4326Lon(newYorkLayerExtent.xmax);
111
- const north = provider.getEPSG4326Lat(newYorkLayerExtent.ymax);
112
- provider.setCartoRangeFromExtentJson(newYorkLayerExtent);
113
- expect(provider.cartoRange).to.be.not.undefined;
114
- const delta = 0.0000001;
115
- expect(provider.cartoRange.west * Angle.degreesPerRadian).to.approximately(west, delta);
116
- expect(provider.cartoRange.south * Angle.degreesPerRadian).to.approximately(south, delta);
117
- expect(provider.cartoRange.east * Angle.degreesPerRadian).to.approximately(east, delta);
118
- expect(provider.cartoRange.north * Angle.degreesPerRadian).to.approximately(north, delta);
119
- });
120
- it("should compose proper request to get extent", async () => {
121
- fetchStub.restore(); // fetch is always stubbed by default, restore and provide our own stub
122
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
123
- return { accessTokenRequired: false, content: NewYorkDataset.serviceCapabilities };
124
- });
125
- const layerCapabilitiesNoExtent = { ...NewYorkDataset.streetsLayerCapabilities };
126
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function _(_layerId) {
127
- return layerCapabilitiesNoExtent;
128
- });
129
- const referenceExtent = { extent: NewYorkDataset.streetsLayerCapabilities.extent };
130
- const stub = sandbox.stub(ArcGISImageryProvider.prototype, "fetch").callsFake(async function _(_url, _options) {
131
- const test = {
132
- headers: { "content-type": "json" },
133
- json: async () => {
134
- return referenceExtent;
135
- },
136
- status: 200,
137
- }; // By using unknown type, I can define parts of Response I really need
138
- return test;
139
- });
140
- let layerId = 0;
141
- let expectedUrl = `https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/${layerId}/query?where=1%3D1&outSR=3857&returnExtentOnly=true&f=json`;
142
- let cachedExtent = ArcGisFeatureProvider._extentCache.get(expectedUrl);
143
- expect(cachedExtent).to.be.undefined;
144
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
145
- const provider = new ArcGisFeatureProvider(settings);
146
- await provider.initialize();
147
- let fetchExtent = await provider.fetchLayerExtent();
148
- expect(fetchExtent).to.equals(referenceExtent.extent);
149
- expect(stub.getCalls().length).to.equals(1);
150
- expect(stub.args[0][0].toString()).to.be.equals(expectedUrl);
151
- // Check if entry has been created in cache
152
- cachedExtent = ArcGisFeatureProvider._extentCache.get(expectedUrl);
153
- expect(cachedExtent).to.be.not.undefined;
154
- expect(cachedExtent).to.equals(referenceExtent);
155
- // Make sure cache is used
156
- await provider.fetchLayerExtent();
157
- expect(stub.getCalls().length).to.equals(1);
158
- // Force a different layerId, and check a new request has been made
159
- layerId = 2;
160
- expectedUrl = `https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/${layerId}/query?where=1%3D1&outSR=3857&returnExtentOnly=true&f=json`;
161
- cachedExtent = ArcGisFeatureProvider._extentCache.get(expectedUrl);
162
- expect(cachedExtent).to.be.undefined;
163
- provider._layerId = layerId;
164
- fetchExtent = await provider.fetchLayerExtent();
165
- expect(fetchExtent).to.equals(referenceExtent.extent);
166
- expect(stub.getCalls().length).to.equals(2);
167
- expect(stub.args[1][0].toString()).to.be.equals(expectedUrl);
168
- // check cache has been updated with a new entry
169
- cachedExtent = ArcGisFeatureProvider._extentCache.get(expectedUrl);
170
- expect(cachedExtent).to.be.not.undefined;
171
- expect(cachedExtent).to.equals(referenceExtent);
172
- });
173
- it("should not initialize with no service metadata", async () => {
174
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
175
- return undefined;
176
- });
177
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
178
- const provider = new ArcGisFeatureProvider(settings);
179
- await expect(provider.initialize()).to.be.rejectedWith(ServerError);
180
- });
181
- it("should update status when invalid token error from service", async () => {
182
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
183
- return { accessTokenRequired: false, content: { error: { code: 499 } } };
184
- });
185
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
186
- const provider = new ArcGisFeatureProvider(settings);
187
- const raiseEventSpy = sandbox.spy(provider.onStatusChanged, "raiseEvent");
188
- await provider.initialize();
189
- expect(provider.status).to.equals(MapLayerImageryProviderStatus.RequireAuth);
190
- expect(raiseEventSpy.calledOnceWith(provider)).to.be.true;
191
- });
192
- it("should throw query capability not supported", async () => {
193
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
194
- return { accessTokenRequired: false, content: { capabilities: "Test" } };
195
- });
196
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
197
- const provider = new ArcGisFeatureProvider(settings);
198
- await expect(provider.initialize()).to.be.rejectedWith(ServerError);
199
- });
200
- it("should pick the first visible sub-layer when multiple visible sub-layers", async () => {
201
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
202
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
203
- });
204
- const settings = ImageMapLayerSettings.fromJSON({
205
- ...esriFeatureSampleSource,
206
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
207
- });
208
- const provider = new ArcGisFeatureProvider(settings);
209
- provider._format = "JSON";
210
- await provider.initialize();
211
- expect(provider._layerId).to.equals(settings.subLayers[0].id);
212
- });
213
- it("should pick sub-layers from service metadata if none provided on layer settings", async () => {
214
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
215
- return { accessTokenRequired: false, content: { capabilities: "Query",
216
- layers: [
217
- {
218
- id: 0,
219
- },
220
- {
221
- id: 1,
222
- },
223
- ] },
224
- };
225
- });
226
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (id) {
227
- if (id === 1) {
228
- return { defaultVisibility: true };
229
- }
230
- return undefined;
231
- });
232
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
233
- const provider = new ArcGisFeatureProvider(settings);
234
- provider._format = "JSON";
235
- await provider.initialize();
236
- expect(provider._layerId).to.equals(1);
237
- expect(provider._layerMetadata).to.eql({ defaultVisibility: true });
238
- });
239
- it("should throw error if no layers in capabilities", async () => {
240
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
241
- return { accessTokenRequired: false, content: { capabilities: "Query", layers: [] } };
242
- });
243
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
244
- const provider = new ArcGisFeatureProvider(settings);
245
- await expect(provider.initialize()).to.be.rejectedWith(ServerError);
246
- });
247
- it("should throw if no layer metadata from service", async () => {
248
- const settings = ImageMapLayerSettings.fromJSON({
249
- ...esriFeatureSampleSource,
250
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
251
- });
252
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
253
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
254
- });
255
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
256
- return undefined;
257
- });
258
- const provider = new ArcGisFeatureProvider(settings);
259
- await expect(provider.initialize()).to.be.rejectedWith(ServerError);
260
- });
261
- it("should read supported supported format", async () => {
262
- const settings = ImageMapLayerSettings.fromJSON({
263
- ...esriFeatureSampleSource,
264
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
265
- });
266
- let getLayerMetadataStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
267
- return { defaultVisibility: true, supportedQueryFormats: "PBF, JSON" };
268
- });
269
- const getServiceJsonStub = sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
270
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
271
- });
272
- let provider = new ArcGisFeatureProvider(settings);
273
- await provider.initialize();
274
- expect(provider.format).to.equals("JSON");
275
- // PBF requires 'supportsCoordinatesQuantization'
276
- getServiceJsonStub.restore();
277
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
278
- return { accessTokenRequired: false, content: { currentVersion: 11, capabilities: "Query" } };
279
- });
280
- getLayerMetadataStub.restore();
281
- getLayerMetadataStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
282
- return { defaultVisibility: true, supportsCoordinatesQuantization: true, supportedQueryFormats: "PBF, JSON" };
283
- });
284
- provider = new ArcGisFeatureProvider(settings);
285
- await provider.initialize();
286
- expect(provider.format).to.equals("PBF");
287
- getLayerMetadataStub.restore();
288
- getLayerMetadataStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
289
- return { defaultVisibility: true, supportedQueryFormats: "JSON" };
290
- });
291
- getServiceJsonStub.restore();
292
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
293
- return { accessTokenRequired: false, content: { currentVersion: 10.91, capabilities: "Query", supportsCoordinatesQuantization: true } };
294
- });
295
- provider = new ArcGisFeatureProvider(settings);
296
- await provider.initialize();
297
- expect(provider.format).to.equals("JSON");
298
- getLayerMetadataStub.restore();
299
- getLayerMetadataStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
300
- return { defaultVisibility: true, supportedQueryFormats: "JSON" };
301
- });
302
- provider = new ArcGisFeatureProvider(settings);
303
- await provider.initialize();
304
- expect(provider.format).to.equals("JSON");
305
- getLayerMetadataStub.restore();
306
- getLayerMetadataStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
307
- return { defaultVisibility: true, supportedQueryFormats: "" };
308
- });
309
- provider = new ArcGisFeatureProvider(settings);
310
- await expect(provider.initialize()).to.be.rejectedWith(ServerError);
311
- });
312
- it("should compute minLod/maxLod", async () => {
313
- const settings = ImageMapLayerSettings.fromJSON({
314
- ...esriFeatureSampleSource,
315
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
316
- });
317
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
318
- return {
319
- defaultVisibility: true,
320
- supportedQueryFormats: "PBF, JSON",
321
- minScale: 600000,
322
- maxScale: 5000,
323
- };
324
- });
325
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
326
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
327
- });
328
- const provider = new ArcGisFeatureProvider(settings);
329
- await provider.initialize();
330
- expect(provider._minDepthFromLod).to.equals(9);
331
- expect(provider._maxDepthFromLod).to.equals(15);
332
- });
333
- it("should construct empty url", async () => {
334
- const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
335
- const provider = new ArcGisFeatureProvider(settings);
336
- const url = await provider.constructUrl(0, 0, 0);
337
- expect(url).to.equals("");
338
- });
339
- it("should construct feature query url", async () => {
340
- const settings = ImageMapLayerSettings.fromJSON({
341
- ...esriFeatureSampleSource,
342
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
343
- });
344
- let getLayerMetadataStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
345
- return {
346
- defaultVisibility: true,
347
- supportedQueryFormats: "PBF, JSON",
348
- };
349
- });
350
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
351
- return { accessTokenRequired: false, content: { currentVersion: 11, capabilities: "Query" } };
352
- });
353
- const provider = new ArcGisFeatureProvider(settings);
354
- await provider.initialize();
355
- let url = provider.constructFeatureUrl(0, 0, 0, "PBF");
356
- const extent = {
357
- xmin: -20037508.34,
358
- ymin: -20037508.33,
359
- xmax: 20037508.34,
360
- ymax: 20037508.34,
361
- spatialReference: {
362
- wkid: 102100,
363
- latestWkid: 3857,
364
- },
365
- };
366
- expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100");
367
- expect(url?.envelope?.xmin).to.be.closeTo(extent.xmin, 0.01);
368
- expect(url?.envelope?.ymin).to.be.closeTo(extent.ymin, 0.01);
369
- expect(url?.envelope?.xmax).to.be.closeTo(extent.xmax, 0.01);
370
- expect(url?.envelope?.ymax).to.be.closeTo(extent.ymax, 0.01);
371
- expect(url?.envelope?.spatialReference.wkid).to.be.equal(102100);
372
- expect(url?.envelope?.spatialReference.latestWkid).to.be.equal(3857);
373
- // Now turn ON 'supportsCoordinatesQuantization' to ON
374
- getLayerMetadataStub.restore();
375
- getLayerMetadataStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
376
- return {
377
- defaultVisibility: true,
378
- supportedQueryFormats: "PBF, JSON",
379
- supportsCoordinatesQuantization: true,
380
- };
381
- });
382
- const provider2 = new ArcGisFeatureProvider(settings);
383
- await provider2.initialize();
384
- url = provider2.constructFeatureUrl(0, 0, 0, "PBF");
385
- expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100&quantizationParameters=%7B%22mode%22%3A%22view%22%2C%22originPosition%22%3A%22upperLeft%22%2C%22tolerance%22%3A78271.516953125%2C%22extent%22%3A%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D");
386
- expect(url?.envelope?.xmin).to.be.closeTo(extent.xmin, 0.01);
387
- expect(url?.envelope?.ymin).to.be.closeTo(extent.ymin, 0.01);
388
- expect(url?.envelope?.xmax).to.be.closeTo(extent.xmax, 0.01);
389
- expect(url?.envelope?.ymax).to.be.closeTo(extent.ymax, 0.01);
390
- expect(url?.envelope?.spatialReference.wkid).to.be.equal(extent.spatialReference.wkid);
391
- expect(url?.envelope?.spatialReference.latestWkid).to.be.equal(extent.spatialReference.latestWkid);
392
- // Test passing an override geometry
393
- const overrideGeom = {
394
- type: "esriGeometryEnvelope",
395
- geom: {
396
- xmin: -50,
397
- ymin: -50,
398
- xmax: 50,
399
- ymax: 50,
400
- spatialReference: {
401
- wkid: 102100,
402
- latestWkid: 3857,
403
- },
404
- },
405
- };
406
- const provider3 = new ArcGisFeatureProvider(settings);
407
- await provider3.initialize();
408
- url = provider3.constructFeatureUrl(0, 0, 0, "PBF", overrideGeom);
409
- expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-50%2C%22ymin%22%3A-50%2C%22xmax%22%3A50%2C%22ymax%22%3A50%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100&quantizationParameters=%7B%22mode%22%3A%22view%22%2C%22originPosition%22%3A%22upperLeft%22%2C%22tolerance%22%3A78271.516953125%2C%22extent%22%3A%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D");
410
- expect(url?.envelope?.xmin).to.be.closeTo(overrideGeom.geom.xmin, 0.01);
411
- expect(url?.envelope?.ymin).to.be.closeTo(overrideGeom.geom.ymin, 0.01);
412
- expect(url?.envelope?.xmax).to.be.closeTo(overrideGeom.geom.xmax, 0.01);
413
- expect(url?.envelope?.ymax).to.be.closeTo(overrideGeom.geom.ymax, 0.01);
414
- expect(url?.envelope?.spatialReference.wkid).to.be.equal(overrideGeom.geom.spatialReference.wkid);
415
- expect(url?.envelope?.spatialReference.latestWkid).to.be.equal(overrideGeom.geom.spatialReference.latestWkid);
416
- // Now test with a different tolerance value
417
- url = provider3.constructFeatureUrl(0, 0, 0, "PBF", overrideGeom, undefined, 10);
418
- expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-50%2C%22ymin%22%3A-50%2C%22xmax%22%3A50%2C%22ymax%22%3A50%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100&quantizationParameters=%7B%22mode%22%3A%22view%22%2C%22originPosition%22%3A%22upperLeft%22%2C%22tolerance%22%3A78271.516953125%2C%22extent%22%3A%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D&distance=782715.16953125");
419
- expect(url?.envelope?.xmin).to.be.closeTo(overrideGeom.geom.xmin, 0.01);
420
- expect(url?.envelope?.ymin).to.be.closeTo(overrideGeom.geom.ymin, 0.01);
421
- expect(url?.envelope?.xmax).to.be.closeTo(overrideGeom.geom.xmax, 0.01);
422
- expect(url?.envelope?.ymax).to.be.closeTo(overrideGeom.geom.ymax, 0.01);
423
- expect(url?.envelope?.spatialReference.wkid).to.be.equal(overrideGeom.geom.spatialReference.wkid);
424
- expect(url?.envelope?.spatialReference.latestWkid).to.be.equal(overrideGeom.geom.spatialReference.latestWkid);
425
- });
426
- it("should log error when getFeatureInfo cannot be performed", async () => {
427
- const settings = ImageMapLayerSettings.fromJSON({
428
- ...esriFeatureSampleSource,
429
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
430
- });
431
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
432
- return {
433
- defaultVisibility: true,
434
- supportedQueryFormats: "PBF, JSON",
435
- minScale: 600000,
436
- maxScale: 5000,
437
- };
438
- });
439
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
440
- return { accessTokenRequired: false, content: { currentVersion: 11, capabilities: "Query" } };
441
- });
442
- sandbox.stub(ArcGisFeatureProvider.prototype, "constructFeatureUrl").callsFake(function _(_row, _column, _zoomLevel, _format, _geomOverride, _outFields, _tolerance, _returnGeometry) {
443
- return undefined;
444
- });
445
- const provider = new ArcGisFeatureProvider(settings);
446
- await provider.initialize();
447
- const featureInfos = [];
448
- const logErrorSpy = sandbox.spy(Logger, "logError");
449
- await provider.getFeatureInfo(featureInfos, new QuadId(0, 0, 0), Cartographic.fromDegrees({ latitude: 46, longitude: -71 }), undefined);
450
- expect(featureInfos.length).to.equals(0);
451
- expect(logErrorSpy.called).to.be.true;
452
- });
453
- it("should process data in getFeatureInfo", async () => {
454
- const settings = ImageMapLayerSettings.fromJSON({
455
- ...esriFeatureSampleSource,
456
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
457
- });
458
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
459
- return {
460
- defaultVisibility: true,
461
- supportedQueryFormats: "PBF, JSON",
462
- supportsCoordinatesQuantization: true,
463
- minScale: 600000,
464
- maxScale: 5000,
465
- };
466
- });
467
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
468
- return { accessTokenRequired: false, content: { currentVersion: 11, capabilities: "Query" } };
469
- });
470
- fetchStub.restore(); // fetch is always stubbed by default, restore and provide our own stub
471
- sandbox.stub(ArcGISImageryProvider.prototype, "fetch").callsFake(async function _(_url, _options) {
472
- const test = {
473
- headers: { "content-type": "pbf" },
474
- arrayBuffer: async () => {
475
- const byteArray = Base64EncodedString.toUint8Array(PhillyLandmarksDataset.phillyTransportationGetFeatureInfoQueryEncodedPbf);
476
- return Promise.resolve(byteArray ? ByteStream.fromUint8Array(byteArray).arrayBuffer : undefined);
477
- },
478
- status: 200,
479
- }; // By using unknown type, I can define parts of Response I really need
480
- return test;
481
- });
482
- const provider = new ArcGisFeatureProvider(settings);
483
- await provider.initialize();
484
- const featureInfos = [];
485
- const logErrorSpy = sandbox.spy(Logger, "logError");
486
- await provider.getFeatureInfo(featureInfos, new QuadId(0, 0, 0), Cartographic.fromDegrees({ latitude: 46, longitude: -71 }), undefined);
487
- expect(featureInfos.length).to.equals(1);
488
- expect(logErrorSpy.calledOnce).to.be.false;
489
- });
490
- it("should log error when exceed transfert limit", async () => {
491
- const settings = ImageMapLayerSettings.fromJSON({
492
- ...esriFeatureSampleSource,
493
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
494
- });
495
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
496
- return {
497
- defaultVisibility: true,
498
- supportedQueryFormats: "PBF, JSON",
499
- minScale: 600000,
500
- maxScale: 5000,
501
- };
502
- });
503
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
504
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
505
- });
506
- sandbox.stub(ArcGisFeatureResponse.prototype, "getResponseData").callsFake(async function _() {
507
- return { exceedTransferLimit: true, data: undefined };
508
- });
509
- const provider = new ArcGisFeatureProvider(settings);
510
- await provider.initialize();
511
- const featureInfos = [];
512
- const logErrorSpy = sandbox.spy(Logger, "logError");
513
- await provider.getFeatureInfo(featureInfos, new QuadId(0, 0, 0), Cartographic.fromDegrees({ latitude: 46, longitude: -71 }), undefined);
514
- expect(featureInfos.length).to.equals(0);
515
- expect(logErrorSpy.calledOnce).to.be.true;
516
- });
517
- it("should log error when exceed exception thrown limit", async () => {
518
- const settings = ImageMapLayerSettings.fromJSON({
519
- ...esriFeatureSampleSource,
520
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
521
- });
522
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
523
- return {
524
- defaultVisibility: true,
525
- supportedQueryFormats: "PBF, JSON",
526
- minScale: 600000,
527
- maxScale: 5000,
528
- };
529
- });
530
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
531
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
532
- });
533
- sandbox.stub(ArcGisFeatureResponse.prototype, "getResponseData").callsFake(async function _() {
534
- throw new Error();
535
- });
536
- const provider = new ArcGisFeatureProvider(settings);
537
- await provider.initialize();
538
- const featureInfos = [];
539
- const logErrorSpy = sandbox.spy(Logger, "logError");
540
- await provider.getFeatureInfo(featureInfos, new QuadId(0, 0, 0), Cartographic.fromDegrees({ latitude: 46, longitude: -71 }), undefined);
541
- expect(featureInfos.length).to.equals(0);
542
- expect(logErrorSpy.calledOnce).to.be.true;
543
- });
544
- it("should debug Feature Geom", async () => {
545
- const settings = ImageMapLayerSettings.fromJSON({
546
- ...esriFeatureSampleSource,
547
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
548
- });
549
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
550
- return {
551
- defaultVisibility: true,
552
- supportedQueryFormats: "PBF, JSON",
553
- minScale: 600000,
554
- maxScale: 5000,
555
- };
556
- });
557
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
558
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
559
- });
560
- sandbox.stub(ArcGisFeatureResponse.prototype, "getResponseData").callsFake(async function _() {
561
- return { data: {
562
- toObject: () => undefined,
563
- } };
564
- });
565
- const provider = new ArcGisFeatureProvider(settings);
566
- await provider.initialize();
567
- provider._debugFeatureGeom = true;
568
- const featureInfos = [];
569
- const logInfoSpy = sandbox.spy(Logger, "logInfo");
570
- await provider.getFeatureInfo(featureInfos, new QuadId(0, 0, 0), Cartographic.fromDegrees({ latitude: 46, longitude: -71 }), undefined);
571
- expect(featureInfos.length).to.equals(0);
572
- expect(logInfoSpy.callCount).to.equals(2);
573
- });
574
- it("should compute computeTileWorld2CanvasTransform", async () => {
575
- const settings = ImageMapLayerSettings.fromJSON({
576
- ...esriFeatureSampleSource,
577
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
578
- });
579
- const worldSize = 100;
580
- const canvasSize = 10;
581
- const provider = new ArcGisFeatureProvider(settings);
582
- const getEPSG3857ExtentStub = sandbox.stub(ArcGisFeatureProvider.prototype, "getEPSG3857Extent").callsFake(function (_row, _column, _zoomLevel) {
583
- return { left: 0, right: worldSize, bottom: 0, top: worldSize };
584
- });
585
- sandbox.stub(provider, "tileSize").get(function () {
586
- return canvasSize; // return a size of 10 to simplicity
587
- });
588
- let transform = provider.computeTileWorld2CanvasTransform(0, 0, 0);
589
- let worldPoint = Point3d.createFrom({ x: worldSize * 0.5, y: worldSize * 0.5, z: 0 });
590
- let transformedPoint = transform?.multiplyPoint3d(worldPoint);
591
- // Make sure center point remains in the center
592
- expect(transformedPoint).to.not.undefined;
593
- expect(transformedPoint.x).to.equals(canvasSize * 0.5);
594
- expect(transformedPoint.y).to.equals(canvasSize * 0.5);
595
- expect(transformedPoint.z).to.equals(0);
596
- // Check that y-axis get flipped
597
- worldPoint = Point3d.createFrom({ x: 0, y: 10, z: 0 });
598
- transformedPoint = transform?.multiplyPoint3d(worldPoint);
599
- expect(transformedPoint.x).to.equals(0);
600
- expect(transformedPoint.y).to.equals(9);
601
- expect(transformedPoint.z).to.equals(0);
602
- // Now check translation has been applied (origin shift)
603
- getEPSG3857ExtentStub.restore();
604
- sandbox.stub(ArcGisFeatureProvider.prototype, "getEPSG3857Extent").callsFake(function (_row, _column, _zoomLevel) {
605
- return { left: worldSize, right: worldSize * 2, bottom: worldSize, top: worldSize * 2 };
606
- });
607
- worldPoint = Point3d.createFrom({ x: worldSize, y: worldSize, z: 0 });
608
- transform = provider.computeTileWorld2CanvasTransform(0, 0, 0);
609
- transformedPoint = transform?.multiplyPoint3d(worldPoint);
610
- expect(transformedPoint).to.not.undefined;
611
- expect(transformedPoint.x).to.equals(0);
612
- expect(transformedPoint.y).to.equals(10);
613
- expect(transformedPoint.z).to.equals(0);
614
- });
615
- it("should loadTile from PBF request", async () => {
616
- const settings = ImageMapLayerSettings.fromJSON({
617
- ...esriFeatureSampleSource,
618
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
619
- });
620
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
621
- return {
622
- defaultVisibility: true,
623
- supportedQueryFormats: "PBF",
624
- supportsCoordinatesQuantization: true,
625
- };
626
- });
627
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
628
- return { accessTokenRequired: false, content: { currentVersion: 11, capabilities: "Query" } };
629
- });
630
- sandbox.stub(HTMLCanvasElement.prototype, "getContext").callsFake(function _(_contextId, _options) {
631
- return {};
632
- });
633
- sandbox.stub(HTMLCanvasElement.prototype, "toDataURL").callsFake(function _(_type, _quality) {
634
- return `data:image/png;base64,${pngTransparent1x1}`;
635
- });
636
- const providerStub = sandbox.stub(ArcGisFeatureProvider.prototype, "fetchTile").callsFake(async function _() {
637
- return new ArcGisFeatureResponse("PBF", Promise.resolve({}));
638
- });
639
- sandbox.stub(ArcGisFeatureResponse.prototype, "getResponseData").callsFake(async function _() {
640
- return {
641
- exceedTransferLimit: false,
642
- data: { toObject: () => undefined },
643
- };
644
- });
645
- // toDataURL string;
646
- const readAndRenderSpy = sandbox.spy(ArcGisFeaturePBF.prototype, "readAndRender");
647
- const computeTransfoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "computeTileWorld2CanvasTransform");
648
- const provider = new ArcGisFeatureProvider(settings);
649
- await provider.initialize();
650
- const tileData = await provider.loadTile(0, 0, 0);
651
- expect(tileData).to.not.undefined;
652
- expect(tileData?.data instanceof Uint8Array).to.be.true;
653
- expect(tileData?.data).to.eqls(base64StringToUint8Array(pngTransparent1x1));
654
- expect(tileData?.format).to.equals(ImageSourceFormat.Png);
655
- expect(providerStub.calledOnce).to.be.true;
656
- expect(readAndRenderSpy.calledOnce).to.be.true;
657
- expect(computeTransfoSpy.calledOnce).to.be.false; // Should not be called since we have supportsCoordinatesQuantization in layer metadata
658
- });
659
- it("should loadTile from JSON request", async () => {
660
- const settings = ImageMapLayerSettings.fromJSON({
661
- ...esriFeatureSampleSource,
662
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
663
- });
664
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
665
- return {
666
- defaultVisibility: true,
667
- supportedQueryFormats: "JSON",
668
- };
669
- });
670
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
671
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
672
- });
673
- sandbox.stub(HTMLCanvasElement.prototype, "getContext").callsFake(function _(_contextId, _options) {
674
- return {};
675
- });
676
- sandbox.stub(HTMLCanvasElement.prototype, "toDataURL").callsFake(function _(_type, _quality) {
677
- return `data:image/png;base64,${pngTransparent1x1}`;
678
- });
679
- const providerStub = sandbox.stub(ArcGisFeatureProvider.prototype, "fetchTile").callsFake(async function _() {
680
- return new ArcGisFeatureResponse("JSON", Promise.resolve({}));
681
- });
682
- sandbox.stub(ArcGisFeatureResponse.prototype, "getResponseData").callsFake(async function _() {
683
- return {
684
- exceedTransferLimit: false,
685
- data: { toObject: () => undefined },
686
- };
687
- });
688
- const readAndRenderSpy = sandbox.spy(ArcGisFeatureJSON.prototype, "readAndRender");
689
- const computeTransfoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "computeTileWorld2CanvasTransform");
690
- const provider = new ArcGisFeatureProvider(settings);
691
- await provider.initialize();
692
- const tileData = await provider.loadTile(0, 0, 0);
693
- expect(tileData).to.not.undefined;
694
- expect(tileData?.data instanceof Uint8Array).to.be.true;
695
- expect(tileData?.data).to.eqls(base64StringToUint8Array(pngTransparent1x1));
696
- expect(tileData?.format).to.equals(ImageSourceFormat.Png);
697
- expect(providerStub.calledOnce).to.be.true;
698
- expect(readAndRenderSpy.calledOnce).to.be.true;
699
- expect(computeTransfoSpy.calledOnce).to.be.true; // Should be called since we dont have _supportsCoordinatesQuantization in layer metadata
700
- });
701
- it("should make sub request if loadtile request return 'exceedTransferLimit'", async () => {
702
- const settings = ImageMapLayerSettings.fromJSON({
703
- ...esriFeatureSampleSource,
704
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
705
- });
706
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
707
- return {
708
- defaultVisibility: true,
709
- supportedQueryFormats: "JSON",
710
- };
711
- });
712
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
713
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
714
- });
715
- sandbox.stub(HTMLCanvasElement.prototype, "getContext").callsFake(function _(_contextId, _options) {
716
- return {};
717
- });
718
- sandbox.stub(HTMLCanvasElement.prototype, "toDataURL").callsFake(function _(_type, _quality) {
719
- return `data:image/png;base64,${pngTransparent1x1}`;
720
- });
721
- const extentSize = 100;
722
- const fetchTileStub = sandbox.stub(ArcGisFeatureProvider.prototype, "fetchTile").callsFake(async function _() {
723
- const envelope = {
724
- xmin: 0,
725
- ymin: 0,
726
- xmax: extentSize,
727
- ymax: extentSize,
728
- spatialReference: {
729
- wkid: 102100,
730
- latestWkid: 3857,
731
- }
732
- };
733
- return new ArcGisFeatureResponse("JSON", Promise.resolve({}), envelope);
734
- });
735
- let firstCall = true;
736
- sandbox.stub(ArcGisFeatureResponse.prototype, "getResponseData").callsFake(async function _() {
737
- const exceed = firstCall === true;
738
- firstCall = false;
739
- return {
740
- exceedTransferLimit: exceed,
741
- data: { toObject: () => undefined },
742
- };
743
- });
744
- const readAndRenderSpy = sandbox.spy(ArcGisFeatureJSON.prototype, "readAndRender");
745
- const provider = new ArcGisFeatureProvider(settings);
746
- await provider.initialize();
747
- await provider.loadTile(0, 0, 0);
748
- // We should have 5 calls:
749
- // Call #1 : initial call for 0,0,0 and it returns 'exceedTransferLimit'
750
- // Calls #2-5: Four calls which represent a call for each sub-envelope (initial extent divided by 4)
751
- expect(fetchTileStub.getCalls().length).to.equals(5);
752
- expect(fetchTileStub.getCalls()[1].args[3]).to.eqls({
753
- xmin: 0, ymin: 0, xmax: extentSize * 0.5, ymax: extentSize * 0.5,
754
- spatialReference: { wkid: 102100, latestWkid: 3857,
755
- }
756
- });
757
- expect(fetchTileStub.getCalls()[2].args[3]).to.eqls({
758
- xmin: 0, ymin: extentSize * 0.5, xmax: extentSize * 0.5, ymax: extentSize,
759
- spatialReference: { wkid: 102100, latestWkid: 3857,
760
- }
761
- });
762
- expect(fetchTileStub.getCalls()[3].args[3]).to.eqls({
763
- xmin: extentSize * 0.5, ymin: 0, xmax: extentSize, ymax: extentSize * 0.5,
764
- spatialReference: { wkid: 102100, latestWkid: 3857,
765
- }
766
- });
767
- expect(fetchTileStub.getCalls()[4].args[3]).to.eqls({
768
- xmin: extentSize * 0.5, ymin: extentSize * 0.5, xmax: extentSize, ymax: extentSize,
769
- spatialReference: { wkid: 102100, latestWkid: 3857,
770
- }
771
- });
772
- expect(readAndRenderSpy.getCalls().length).to.equals(4);
773
- });
774
- it("fetchTile should return undefined when to format defined", async () => {
775
- const settings = ImageMapLayerSettings.fromJSON({
776
- ...esriFeatureSampleSource,
777
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
778
- });
779
- const provider = new ArcGisFeatureProvider(settings);
780
- // make a first request with init, should return undefined because of missing format
781
- const tileData = await provider.fetchTile(0, 0, 0);
782
- expect(tileData).to.be.undefined;
783
- });
784
- it("fetchTile should call fetch with the proper URL", async () => {
785
- const settings = ImageMapLayerSettings.fromJSON({
786
- ...esriFeatureSampleSource,
787
- subLayers: [{ id: 0, name: "layer1", visible: true }, { id: 2, name: "layer2", visible: true }]
788
- });
789
- sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata").callsFake(async function (_id) {
790
- return {
791
- defaultVisibility: true,
792
- supportedQueryFormats: "JSON",
793
- };
794
- });
795
- sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url, _formatId, _userName, _password, _ignoreCache, _requireToken) {
796
- return { accessTokenRequired: false, content: { capabilities: "Query" } };
797
- });
798
- sandbox.stub(ArcGisFeatureProvider.prototype, "constructFeatureUrl").callsFake(function _(_row, _column, _zoomLevel, _format, _geomOverride, _outFields, _tolerance, _returnGeometry) {
799
- return { url: settings.url };
800
- });
801
- const provider = new ArcGisFeatureProvider(settings);
802
- await provider.initialize();
803
- const response = await provider.fetchTile(0, 0, 0);
804
- expect(response).to.not.undefined;
805
- expect(fetchStub.calledOnce).to.be.true;
806
- const test1 = fetchStub.getCall(0).firstArg;
807
- expect(test1.toString()).to.equals(new URL(settings.url).toString());
808
- });
809
- });
810
- //# sourceMappingURL=ArcGisFeatureProvider.test.js.map