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