@vcmap/ui 5.0.0-rc.18 → 5.0.0-rc.21

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 (376) hide show
  1. package/README.md +6 -6
  2. package/build/build.js +2 -2
  3. package/build/buildCesium.js +3 -3
  4. package/build/buildHelpers.js +2 -1
  5. package/config/base.config.json +0 -4
  6. package/config/dev.config.json +35 -14
  7. package/config/www.config.json +4 -0
  8. package/dist/assets/cesium/Workers/ArcType-ce2e50ab.js +37 -0
  9. package/dist/assets/cesium/Workers/AttributeCompression-b646d393.js +716 -0
  10. package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-ff186ccc.js +258 -0
  11. package/dist/assets/cesium/Workers/BoundingRectangle-be5924f4.js +369 -0
  12. package/dist/assets/cesium/Workers/BoxGeometry-12eeccaf.js +884 -0
  13. package/dist/assets/cesium/Workers/Check-666ab1a0.js +290 -0
  14. package/dist/assets/cesium/Workers/Color-a84038cb.js +2262 -0
  15. package/dist/assets/cesium/Workers/ComponentDatatype-f7b11d02.js +341 -0
  16. package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-3272c1b3.js +132 -0
  17. package/dist/assets/cesium/Workers/CorridorGeometryLibrary-0170e093.js +498 -0
  18. package/dist/assets/cesium/Workers/CylinderGeometry-7c5da648.js +467 -0
  19. package/dist/assets/cesium/Workers/CylinderGeometryLibrary-372c07d8.js +63 -0
  20. package/dist/assets/cesium/Workers/EllipseGeometry-797d580e.js +1304 -0
  21. package/dist/assets/cesium/Workers/EllipseGeometryLibrary-2939e1dc.js +366 -0
  22. package/dist/assets/cesium/Workers/EllipseOutlineGeometry-8b50870f.js +443 -0
  23. package/dist/assets/cesium/Workers/EllipsoidGeodesic-98c62a56.js +520 -0
  24. package/dist/assets/cesium/Workers/EllipsoidGeometry-21c0e3a5.js +637 -0
  25. package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-eff247c8.js +454 -0
  26. package/dist/assets/cesium/Workers/EllipsoidRhumbLine-19756602.js +741 -0
  27. package/dist/assets/cesium/Workers/EllipsoidTangentPlane-214683dc.js +373 -0
  28. package/dist/assets/cesium/Workers/EncodedCartesian3-81f70735.js +171 -0
  29. package/dist/assets/cesium/Workers/FrustumGeometry-ac42a6d9.js +2512 -0
  30. package/dist/assets/cesium/Workers/GeometryAttribute-7d6f1732.js +619 -0
  31. package/dist/assets/cesium/Workers/GeometryAttributes-f06a2792.js +91 -0
  32. package/dist/assets/cesium/Workers/GeometryInstance-451dc1cd.js +121 -0
  33. package/dist/assets/cesium/Workers/GeometryOffsetAttribute-04332ce7.js +16 -0
  34. package/dist/assets/cesium/Workers/GeometryPipeline-ce4339ed.js +3690 -0
  35. package/dist/assets/cesium/Workers/IndexDatatype-a55ceaa1.js +200 -0
  36. package/dist/assets/cesium/Workers/IntersectionTests-f6e6bd8a.js +1836 -0
  37. package/dist/assets/cesium/Workers/Math-2dbd6b93.js +1330 -0
  38. package/dist/assets/cesium/Workers/Matrix2-13178034.js +7086 -0
  39. package/dist/assets/cesium/Workers/Matrix3-315394f6.js +4283 -0
  40. package/dist/assets/cesium/Workers/OrientedBoundingBox-04920dc7.js +1257 -0
  41. package/dist/assets/cesium/Workers/Plane-900aa728.js +309 -0
  42. package/dist/assets/cesium/Workers/PolygonGeometryLibrary-a8680d96.js +1074 -0
  43. package/dist/assets/cesium/Workers/PolygonPipeline-844aab0a.js +1345 -0
  44. package/dist/assets/cesium/Workers/PolylinePipeline-32f36d2a.js +573 -0
  45. package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-a510d657.js +781 -0
  46. package/dist/assets/cesium/Workers/PrimitivePipeline-ba38434a.js +966 -0
  47. package/dist/assets/cesium/Workers/RectangleGeometryLibrary-bdba697e.js +280 -0
  48. package/dist/assets/cesium/Workers/RuntimeError-06c93819.js +68 -0
  49. package/dist/assets/cesium/Workers/TerrainEncoding-833187da.js +1227 -0
  50. package/dist/assets/cesium/Workers/Transforms-40229881.js +14696 -0
  51. package/dist/assets/cesium/Workers/VertexFormat-6b480673.js +312 -0
  52. package/dist/assets/cesium/Workers/WallGeometryLibrary-919eed92.js +211 -0
  53. package/dist/assets/cesium/Workers/WebGLConstants-a8cc3e8c.js +620 -0
  54. package/dist/assets/cesium/Workers/WebMercatorProjection-13a90d41.js +151 -0
  55. package/dist/assets/cesium/Workers/arrayRemoveDuplicates-c2038105.js +129 -0
  56. package/dist/assets/cesium/Workers/cesiumWorkerBootstrapper.js +1336 -4
  57. package/dist/assets/cesium/Workers/combine-ca22a614.js +82 -0
  58. package/dist/assets/cesium/Workers/combineGeometry.js +17 -25
  59. package/dist/assets/cesium/Workers/createBoxGeometry.js +12 -25
  60. package/dist/assets/cesium/Workers/createBoxOutlineGeometry.js +313 -25
  61. package/dist/assets/cesium/Workers/createCircleGeometry.js +213 -25
  62. package/dist/assets/cesium/Workers/createCircleOutlineGeometry.js +160 -25
  63. package/dist/assets/cesium/Workers/createCoplanarPolygonGeometry.js +586 -25
  64. package/dist/assets/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +236 -25
  65. package/dist/assets/cesium/Workers/createCorridorGeometry.js +1407 -25
  66. package/dist/assets/cesium/Workers/createCorridorOutlineGeometry.js +603 -25
  67. package/dist/assets/cesium/Workers/createCylinderGeometry.js +12 -25
  68. package/dist/assets/cesium/Workers/createCylinderOutlineGeometry.js +265 -25
  69. package/dist/assets/cesium/Workers/createEllipseGeometry.js +14 -25
  70. package/dist/assets/cesium/Workers/createEllipseOutlineGeometry.js +14 -25
  71. package/dist/assets/cesium/Workers/createEllipsoidGeometry.js +12 -25
  72. package/dist/assets/cesium/Workers/createEllipsoidOutlineGeometry.js +15 -25
  73. package/dist/assets/cesium/Workers/createFrustumGeometry.js +12 -25
  74. package/dist/assets/cesium/Workers/createFrustumOutlineGeometry.js +251 -25
  75. package/dist/assets/cesium/Workers/createGeometry.js +55 -25
  76. package/dist/assets/cesium/Workers/createGroundPolylineGeometry.js +2134 -25
  77. package/dist/assets/cesium/Workers/createPlaneGeometry.js +250 -25
  78. package/dist/assets/cesium/Workers/createPlaneOutlineGeometry.js +115 -25
  79. package/dist/assets/cesium/Workers/createPolygonGeometry.js +1420 -25
  80. package/dist/assets/cesium/Workers/createPolygonOutlineGeometry.js +683 -25
  81. package/dist/assets/cesium/Workers/createPolylineGeometry.js +571 -25
  82. package/dist/assets/cesium/Workers/createPolylineVolumeGeometry.js +411 -25
  83. package/dist/assets/cesium/Workers/createPolylineVolumeOutlineGeometry.js +301 -25
  84. package/dist/assets/cesium/Workers/createRectangleGeometry.js +1476 -25
  85. package/dist/assets/cesium/Workers/createRectangleOutlineGeometry.js +535 -25
  86. package/dist/assets/cesium/Workers/createSimplePolylineGeometry.js +458 -25
  87. package/dist/assets/cesium/Workers/createSphereGeometry.js +123 -25
  88. package/dist/assets/cesium/Workers/createSphereOutlineGeometry.js +126 -25
  89. package/dist/assets/cesium/Workers/createTaskProcessorWorker.js +127 -25
  90. package/dist/assets/cesium/Workers/createVectorTileClampedPolylines.js +535 -25
  91. package/dist/assets/cesium/Workers/createVectorTileGeometries.js +445 -25
  92. package/dist/assets/cesium/Workers/createVectorTilePoints.js +79 -25
  93. package/dist/assets/cesium/Workers/createVectorTilePolygons.js +406 -25
  94. package/dist/assets/cesium/Workers/createVectorTilePolylines.js +254 -25
  95. package/dist/assets/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +640 -25
  96. package/dist/assets/cesium/Workers/createVerticesFromHeightmap.js +2711 -27
  97. package/dist/assets/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +994 -25
  98. package/dist/assets/cesium/Workers/createWallGeometry.js +623 -25
  99. package/dist/assets/cesium/Workers/createWallOutlineGeometry.js +432 -25
  100. package/dist/assets/cesium/Workers/decodeDraco.js +381 -25
  101. package/dist/assets/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +3687 -25
  102. package/dist/assets/cesium/Workers/decodeI3S.js +1040 -0
  103. package/dist/assets/cesium/Workers/defaultValue-0a909f67.js +51 -0
  104. package/dist/assets/cesium/Workers/package.js +2 -2
  105. package/dist/assets/cesium/Workers/transcodeKTX2.js +1516 -25
  106. package/dist/assets/cesium/Workers/transferTypedArrayTest.js +18 -2
  107. package/dist/assets/cesium/Workers/upsampleQuantizedTerrainMesh.js +1023 -25
  108. package/dist/assets/{cesium.2f992f.js → cesium.49585c.js} +112161 -108735
  109. package/dist/assets/cesium.js +1 -1
  110. package/dist/assets/{core.cb0408.js → core.59d4d1.js} +1616 -1629
  111. package/dist/assets/core.js +1 -1
  112. package/dist/assets/{index.bccdf969.js → index.a3861d4e.js} +1 -1
  113. package/dist/assets/{ol.5e3fd0.js → ol.c1c512.js} +6992 -6972
  114. package/dist/assets/ol.js +1 -1
  115. package/dist/assets/ui.80175f.css +1 -0
  116. package/dist/assets/{ui.08c48f.js → ui.80175f.js} +6121 -6785
  117. package/dist/assets/ui.js +1 -1
  118. package/dist/assets/{vue.228ead.js → vue.a08ab1.js} +0 -0
  119. package/dist/assets/vue.js +2 -2
  120. package/dist/assets/{vuetify.0b5039.css → vuetify.efc158.css} +0 -0
  121. package/dist/assets/{vuetify.0b5039.js → vuetify.efc158.js} +1 -1
  122. package/dist/assets/vuetify.js +2 -2
  123. package/dist/index.html +1 -1
  124. package/index.js +2 -1
  125. package/lib/cesium.js +1 -1
  126. package/package.json +3 -4
  127. package/plugins/{simple-graph → @vcmap/simple-graph}/README.md +1 -1
  128. package/plugins/{simple-graph → @vcmap/simple-graph}/SimpleGraphComponent.vue +0 -0
  129. package/plugins/{simple-graph → @vcmap/simple-graph}/index.js +0 -0
  130. package/plugins/{simple-graph → @vcmap/simple-graph}/package.json +0 -0
  131. package/plugins/{simple-graph → @vcmap/simple-graph}/simpleGraphView.js +0 -0
  132. package/plugins/@vcmap-show-case/README.md +20 -0
  133. package/plugins/{buttonExamples/ButtonExamples.vue → @vcmap-show-case/buttons-example/ButtonsExample.vue} +1 -1
  134. package/plugins/@vcmap-show-case/buttons-example/README.md +4 -0
  135. package/plugins/{buttonExamples → @vcmap-show-case/buttons-example}/index.js +16 -8
  136. package/plugins/@vcmap-show-case/buttons-example/package.json +5 -0
  137. package/plugins/{categoryTest → @vcmap-show-case/category-tester}/Categories.vue +7 -6
  138. package/plugins/{categoryTest → @vcmap-show-case/category-tester}/Category.vue +4 -3
  139. package/plugins/@vcmap-show-case/category-tester/README.md +3 -0
  140. package/plugins/{categoryTest → @vcmap-show-case/category-tester}/index.js +12 -4
  141. package/plugins/@vcmap-show-case/category-tester/package.json +5 -0
  142. package/plugins/@vcmap-show-case/config-editor/README.md +3 -0
  143. package/plugins/{test → @vcmap-show-case/config-editor}/editor.vue +0 -0
  144. package/plugins/@vcmap-show-case/config-editor/index.js +47 -0
  145. package/plugins/@vcmap-show-case/config-editor/package.json +5 -0
  146. package/plugins/@vcmap-show-case/context-menu-tester/README.md +3 -0
  147. package/plugins/@vcmap-show-case/context-menu-tester/index.js +33 -0
  148. package/plugins/@vcmap-show-case/context-menu-tester/package.json +5 -0
  149. package/plugins/{@vcmap/pluginExample/pluginExampleComponent.vue → @vcmap-show-case/form-inputs-example/FormInputsExample.vue} +14 -13
  150. package/plugins/@vcmap-show-case/form-inputs-example/README.md +4 -0
  151. package/plugins/@vcmap-show-case/form-inputs-example/config.json +5 -0
  152. package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/exampleActions.js +1 -1
  153. package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/index.js +23 -22
  154. package/plugins/@vcmap-show-case/form-inputs-example/package.json +5 -0
  155. package/plugins/{@vcmap/pluginExample → @vcmap-show-case/form-inputs-example}/validation.js +0 -0
  156. package/plugins/@vcmap-show-case/icons-example/README.md +5 -0
  157. package/plugins/@vcmap-show-case/icons-example/allIconsComponent.vue +51 -0
  158. package/plugins/@vcmap-show-case/icons-example/index.js +44 -0
  159. package/plugins/@vcmap-show-case/icons-example/package.json +5 -0
  160. package/plugins/{test/testList.vue → @vcmap-show-case/list-example/ListExample.vue} +1 -1
  161. package/plugins/@vcmap-show-case/list-example/README.md +3 -0
  162. package/plugins/@vcmap-show-case/list-example/index.js +44 -0
  163. package/plugins/@vcmap-show-case/list-example/package.json +5 -0
  164. package/plugins/@vcmap-show-case/notifier-tester/README.md +3 -0
  165. package/plugins/{notifier → @vcmap-show-case/notifier-tester}/index.js +11 -6
  166. package/plugins/{notifier → @vcmap-show-case/notifier-tester}/notifierTester.vue +0 -0
  167. package/plugins/@vcmap-show-case/notifier-tester/package.json +5 -0
  168. package/plugins/@vcmap-show-case/textfields-example/README.md +3 -0
  169. package/plugins/{example/mySuperComponent.vue → @vcmap-show-case/textfields-example/TextfieldsExample.vue} +1 -7
  170. package/plugins/{example → @vcmap-show-case/textfields-example}/index.js +58 -62
  171. package/plugins/@vcmap-show-case/textfields-example/package.json +5 -0
  172. package/plugins/@vcmap-show-case/window-tester/README.md +3 -0
  173. package/plugins/{test/windowManagerExample.vue → @vcmap-show-case/window-tester/WindowExample.vue} +36 -20
  174. package/plugins/{test → @vcmap-show-case/window-tester}/emptyComponent.vue +8 -3
  175. package/plugins/@vcmap-show-case/window-tester/index.js +62 -0
  176. package/plugins/{test → @vcmap-show-case/window-tester}/myCustomHeader.vue +0 -0
  177. package/plugins/@vcmap-show-case/window-tester/package.json +5 -0
  178. package/plugins/{test → @vcmap-show-case/window-tester}/toolbox-data.js +9 -9
  179. package/plugins/{test/vcsContent.vue → @vcmap-show-case/window-tester/windowExampleContent.vue} +1 -5
  180. package/plugins/@vcmap-show-case/wizard-example/README.md +3 -0
  181. package/plugins/{wizardExample → @vcmap-show-case/wizard-example}/index.js +12 -6
  182. package/plugins/@vcmap-show-case/wizard-example/package.json +5 -0
  183. package/plugins/@vcmap-show-case/wizard-example/wizardExample.vue +95 -0
  184. package/plugins/package.json +2 -1
  185. package/src/actions/actionHelper.js +1 -3
  186. package/src/actions/stateRefAction.js +0 -10
  187. package/src/application/VcsApp.vue +42 -23
  188. package/src/application/VcsMap.vue +9 -0
  189. package/src/components/buttons/VcsActionButtonList.vue +1 -0
  190. package/src/components/form-inputs-controls/VcsCheckbox.vue +3 -1
  191. package/src/components/form-inputs-controls/VcsWizard.vue +17 -20
  192. package/src/components/form-inputs-controls/VcsWizardStep.vue +160 -0
  193. package/src/{icons → components/icons}/+all.js +0 -0
  194. package/src/{icons → components/icons}/2DAreaIcon.vue +0 -0
  195. package/src/{icons → components/icons}/2DDistanceIcon.vue +0 -0
  196. package/src/{icons → components/icons}/3DAreaIcon.vue +0 -0
  197. package/src/{icons → components/icons}/3DDistanceIcon.vue +0 -0
  198. package/src/{icons → components/icons}/3DHeightIcon.vue +0 -0
  199. package/src/{icons → components/icons}/AngleIcon.vue +0 -0
  200. package/src/{icons → components/icons}/AssociationsIcon.vue +0 -0
  201. package/src/{icons → components/icons}/AxisIcon.vue +0 -0
  202. package/src/{icons → components/icons}/BoundingBoxIcon.vue +0 -0
  203. package/src/{icons → components/icons}/CheckboxCheckedIcon.vue +0 -0
  204. package/src/{icons → components/icons}/CheckboxIcon.vue +0 -0
  205. package/src/{icons → components/icons}/CheckboxIndeterminateIcon.vue +0 -0
  206. package/src/{icons → components/icons}/CircleIcon.vue +0 -0
  207. package/src/{icons → components/icons}/ClippingHorizontalIcon.vue +0 -0
  208. package/src/{icons → components/icons}/ClippingIcon.vue +0 -0
  209. package/src/{icons → components/icons}/ClippingVerticalIcon.vue +0 -0
  210. package/src/{icons → components/icons}/ColorPickerIcon.vue +0 -0
  211. package/src/{icons → components/icons}/ColorSwatchIcon.vue +0 -0
  212. package/src/{icons → components/icons}/CommentIcon.vue +0 -0
  213. package/src/{icons → components/icons}/CompassIcon.vue +0 -0
  214. package/src/{icons → components/icons}/ComponentsIcon.vue +0 -0
  215. package/src/{icons → components/icons}/ConeIcon.vue +0 -0
  216. package/src/{icons → components/icons}/DimensionsHouseIcon.vue +0 -0
  217. package/src/{icons → components/icons}/EditIcon.vue +0 -0
  218. package/src/{icons → components/icons}/ElevationProfileIcon.vue +0 -0
  219. package/src/{icons → components/icons}/ExportAreaIcon.vue +0 -0
  220. package/src/{icons → components/icons}/ExportFlightIcon.vue +0 -0
  221. package/src/{icons → components/icons}/ExportIcon.vue +0 -0
  222. package/src/{icons → components/icons}/ExternalLinkIcon.vue +0 -0
  223. package/src/{icons → components/icons}/EyeIcon.vue +0 -0
  224. package/src/{icons → components/icons}/FastForwardIcon.vue +0 -0
  225. package/src/{icons → components/icons}/FilterIcon.vue +0 -0
  226. package/src/{icons → components/icons}/GlobalTerrainIcon.vue +0 -0
  227. package/src/{icons → components/icons}/GlobeNatureIcon.vue +0 -0
  228. package/src/{icons → components/icons}/GroundIcon.vue +0 -0
  229. package/src/{icons → components/icons}/HealthCareIndustriesIcon.vue +0 -0
  230. package/src/{icons → components/icons}/HelpIcon.vue +0 -0
  231. package/src/{icons → components/icons}/HideIcon.vue +0 -0
  232. package/src/{icons → components/icons}/HomePointIcon.vue +0 -0
  233. package/src/{icons → components/icons}/HospitalsIcon.vue +0 -0
  234. package/src/{icons → components/icons}/HouseIcon.vue +0 -0
  235. package/src/{icons → components/icons}/ImportIcon.vue +0 -0
  236. package/src/{icons → components/icons}/InfoIcon.vue +0 -0
  237. package/src/{icons → components/icons}/KebabIcon.vue +0 -0
  238. package/src/{icons → components/icons}/LabelIcon.vue +0 -0
  239. package/src/{icons → components/icons}/LayersIcon.vue +0 -0
  240. package/src/{icons → components/icons}/LegendIcon.vue +0 -0
  241. package/src/{icons → components/icons}/LineIcon.vue +0 -0
  242. package/src/{icons → components/icons}/LinkIcon.vue +0 -0
  243. package/src/{icons → components/icons}/LogoutIcon.vue +0 -0
  244. package/src/{icons → components/icons}/MapIcon.vue +0 -0
  245. package/src/{icons → components/icons}/MenuIcon.vue +0 -0
  246. package/src/{icons → components/icons}/MinusIcon.vue +0 -0
  247. package/src/{icons → components/icons}/ObjectAttributeIcon.vue +0 -0
  248. package/src/{icons → components/icons}/ObjectSelectIcon.vue +0 -0
  249. package/src/{icons → components/icons}/ObliqueViewIcon.vue +0 -0
  250. package/src/{icons → components/icons}/PdfIcon.vue +0 -0
  251. package/src/{icons → components/icons}/PedestrianIcon.vue +0 -0
  252. package/src/{icons → components/icons}/PenIcon.vue +0 -0
  253. package/src/{icons → components/icons}/PlayCircleIcon.vue +0 -0
  254. package/src/{icons → components/icons}/PlusIcon.vue +0 -0
  255. package/src/{icons → components/icons}/PoiIcon.vue +0 -0
  256. package/src/{icons → components/icons}/PointSelectIcon.vue +0 -0
  257. package/src/{icons → components/icons}/PolygonIcon.vue +0 -0
  258. package/src/{icons → components/icons}/PresentationModeIcon.vue +0 -0
  259. package/src/{icons → components/icons}/ProgressIcon.vue +0 -0
  260. package/src/{icons → components/icons}/QueryIcon.vue +0 -0
  261. package/src/{icons → components/icons}/RectangleIcon.vue +0 -0
  262. package/src/{icons → components/icons}/ReturnIcon.vue +0 -0
  263. package/src/{icons → components/icons}/RewindIcon.vue +0 -0
  264. package/src/{icons → components/icons}/RotateLeftIcon.vue +0 -0
  265. package/src/{icons → components/icons}/RotateRightIcon.vue +0 -0
  266. package/src/{icons → components/icons}/ScreenshotIcon.vue +0 -0
  267. package/src/{icons → components/icons}/SearchIcon.vue +0 -0
  268. package/src/{icons → components/icons}/ShadowIcon.vue +0 -0
  269. package/src/{icons → components/icons}/ShapesIcon.vue +0 -0
  270. package/src/{icons → components/icons}/ShareIcon.vue +0 -0
  271. package/src/{icons → components/icons}/SimpleCircleFilledIcon.vue +0 -0
  272. package/src/{icons → components/icons}/SimpleCircleHalfFilledIcon.vue +0 -0
  273. package/src/{icons → components/icons}/SimpleCircleOutlinedIcon.vue +0 -0
  274. package/src/{icons → components/icons}/SkipNextIcon.vue +0 -0
  275. package/src/{icons → components/icons}/SkipPreviousIcon.vue +0 -0
  276. package/src/{icons → components/icons}/SplitViewIcon.vue +0 -0
  277. package/src/{icons → components/icons}/TerrainBoxIcon.vue +0 -0
  278. package/src/{icons → components/icons}/TextStyleIcon.vue +0 -0
  279. package/src/{icons → components/icons}/ThreeDimensionsIcon.vue +0 -0
  280. package/src/{icons → components/icons}/ToolsIcon.vue +0 -0
  281. package/src/{icons → components/icons}/TouchIcon.vue +0 -0
  282. package/src/{icons → components/icons}/TrashCanIcon.vue +0 -0
  283. package/src/{icons → components/icons}/TriangleIcon.vue +0 -0
  284. package/src/{icons → components/icons}/TwoDimensionsIcon.vue +0 -0
  285. package/src/{icons → components/icons}/UploadIcon.vue +0 -0
  286. package/src/{icons → components/icons}/UserProfileIcon.vue +0 -0
  287. package/src/{icons → components/icons}/UserShareIcon.vue +0 -0
  288. package/src/{icons → components/icons}/VideoRecorderIcon.vue +0 -0
  289. package/src/{icons → components/icons}/ViewpointFlightIcon.vue +0 -0
  290. package/src/{icons → components/icons}/ViewpointIcon.vue +0 -0
  291. package/src/{icons → components/icons}/Viewshed360Icon.vue +0 -0
  292. package/src/{icons → components/icons}/ViewshedConeIcon.vue +0 -0
  293. package/src/{icons → components/icons}/ViewshedIcon.vue +0 -0
  294. package/src/{icons → components/icons}/WalkingIcon.vue +0 -0
  295. package/src/{icons → components/icons}/WallIcon.vue +0 -0
  296. package/src/{icons → components/icons}/WandIcon.vue +0 -0
  297. package/src/components/lists/VcsList.vue +21 -12
  298. package/src/components/lists/VcsTreeviewLeaf.vue +14 -2
  299. package/src/components/notification/VcsTooltip.vue +1 -1
  300. package/src/featureInfo/abstractFeatureInfoView.js +1 -1
  301. package/src/featureInfo/addressBalloonFeatureInfoView.js +1 -1
  302. package/src/featureInfo/balloonFeatureInfoView.js +1 -1
  303. package/src/featureInfo/balloonHelper.js +6 -6
  304. package/src/featureInfo/featureInfo.js +2 -2
  305. package/src/i18n/de.js +2 -6
  306. package/src/i18n/en.js +2 -6
  307. package/src/legend/legendHelper.js +4 -3
  308. package/src/legend/vcsLegend.vue +21 -2
  309. package/src/manager/window/WindowComponent.vue +42 -4
  310. package/src/manager/window/WindowComponentHeader.vue +1 -1
  311. package/src/manager/window/windowHelper.js +7 -11
  312. package/src/manager/window/windowManager.js +15 -11
  313. package/src/navigation/mapNavCompass.vue +13 -7
  314. package/src/navigation/mapNavigation.vue +66 -4
  315. package/src/navigation/orientationToolsButton.vue +1 -1
  316. package/src/navigation/overviewMap.js +26 -10
  317. package/src/navigation/vcsCompass.vue +4 -73
  318. package/src/setup.js +1 -1
  319. package/src/vuePlugins/vuetify.js +1 -1
  320. package/dist/assets/cesium/Workers/ArcType-c9b2b290.js +0 -25
  321. package/dist/assets/cesium/Workers/AttributeCompression-7b0f288d.js +0 -25
  322. package/dist/assets/cesium/Workers/AxisAlignedBoundingBox-d0c22774.js +0 -25
  323. package/dist/assets/cesium/Workers/BoundingRectangle-201b1a81.js +0 -25
  324. package/dist/assets/cesium/Workers/BoxGeometry-4985457c.js +0 -25
  325. package/dist/assets/cesium/Workers/Color-cc8c18b3.js +0 -25
  326. package/dist/assets/cesium/Workers/ComponentDatatype-0200bf8c.js +0 -25
  327. package/dist/assets/cesium/Workers/CoplanarPolygonGeometryLibrary-4345acdf.js +0 -25
  328. package/dist/assets/cesium/Workers/CorridorGeometryLibrary-850a6c35.js +0 -25
  329. package/dist/assets/cesium/Workers/CylinderGeometry-57a1051a.js +0 -25
  330. package/dist/assets/cesium/Workers/CylinderGeometryLibrary-62ce5a1f.js +0 -25
  331. package/dist/assets/cesium/Workers/EllipseGeometry-8627398f.js +0 -25
  332. package/dist/assets/cesium/Workers/EllipseGeometryLibrary-e5919563.js +0 -25
  333. package/dist/assets/cesium/Workers/EllipseOutlineGeometry-96fd4ae1.js +0 -25
  334. package/dist/assets/cesium/Workers/EllipsoidGeodesic-8bfefbff.js +0 -25
  335. package/dist/assets/cesium/Workers/EllipsoidGeometry-377329b9.js +0 -25
  336. package/dist/assets/cesium/Workers/EllipsoidOutlineGeometry-e6e16e49.js +0 -25
  337. package/dist/assets/cesium/Workers/EllipsoidRhumbLine-03528f73.js +0 -25
  338. package/dist/assets/cesium/Workers/EllipsoidTangentPlane-c080fd1b.js +0 -25
  339. package/dist/assets/cesium/Workers/EncodedCartesian3-ea0e408f.js +0 -25
  340. package/dist/assets/cesium/Workers/FrustumGeometry-a8b5d817.js +0 -25
  341. package/dist/assets/cesium/Workers/GeometryAttribute-8458a8fd.js +0 -25
  342. package/dist/assets/cesium/Workers/GeometryAttributes-ac0f8485.js +0 -25
  343. package/dist/assets/cesium/Workers/GeometryInstance-ee3aa3ba.js +0 -25
  344. package/dist/assets/cesium/Workers/GeometryOffsetAttribute-08ae0c50.js +0 -25
  345. package/dist/assets/cesium/Workers/GeometryPipeline-33ca229c.js +0 -25
  346. package/dist/assets/cesium/Workers/IndexDatatype-e713bfd2.js +0 -25
  347. package/dist/assets/cesium/Workers/IntersectionTests-eb4db8e0.js +0 -25
  348. package/dist/assets/cesium/Workers/Matrix2-eefef8eb.js +0 -25
  349. package/dist/assets/cesium/Workers/OrientedBoundingBox-5193f9a2.js +0 -25
  350. package/dist/assets/cesium/Workers/Plane-b0299683.js +0 -25
  351. package/dist/assets/cesium/Workers/PolygonGeometryLibrary-b61295f3.js +0 -25
  352. package/dist/assets/cesium/Workers/PolygonPipeline-eb527514.js +0 -25
  353. package/dist/assets/cesium/Workers/PolylinePipeline-0f23dd84.js +0 -25
  354. package/dist/assets/cesium/Workers/PolylineVolumeGeometryLibrary-2d903430.js +0 -25
  355. package/dist/assets/cesium/Workers/PrimitivePipeline-e2640413.js +0 -25
  356. package/dist/assets/cesium/Workers/RectangleGeometryLibrary-ae8bf8a5.js +0 -25
  357. package/dist/assets/cesium/Workers/RuntimeError-5baf5c66.js +0 -25
  358. package/dist/assets/cesium/Workers/TerrainEncoding-bc10ab54.js +0 -25
  359. package/dist/assets/cesium/Workers/Transforms-d2e5867e.js +0 -63
  360. package/dist/assets/cesium/Workers/VertexFormat-5ec0d9ff.js +0 -25
  361. package/dist/assets/cesium/Workers/WallGeometryLibrary-1a33e416.js +0 -25
  362. package/dist/assets/cesium/Workers/WebGLConstants-5b50ced1.js +0 -25
  363. package/dist/assets/cesium/Workers/WebMercatorProjection-cd2f30c2.js +0 -25
  364. package/dist/assets/cesium/Workers/_commonjsHelpers-bc29abbc.js +0 -25
  365. package/dist/assets/cesium/Workers/arrayRemoveDuplicates-f13aceb1.js +0 -25
  366. package/dist/assets/cesium/Workers/combine-7533016d.js +0 -25
  367. package/dist/assets/cesium/Workers/defaultValue-0c475b81.js +0 -25
  368. package/dist/assets/cesium/Workers/package.json +0 -1
  369. package/dist/assets/ui.08c48f.css +0 -1
  370. package/plugins/@vcmap/pluginExample/config.json +0 -6
  371. package/plugins/@vcmap/pluginExample/package.json +0 -7
  372. package/plugins/categoryTest/ItemEditor.vue +0 -13
  373. package/plugins/test/allIconsComponent.vue +0 -50
  374. package/plugins/test/index.js +0 -209
  375. package/plugins/wizardExample/wizardExample.vue +0 -77
  376. package/src/components/form-inputs-controls/VcsColorPicker.vue +0 -85
@@ -1,27 +1,2711 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.97.1
5
- *
6
- * Copyright 2011-2022 Cesium Contributors
7
- *
8
- * Licensed under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License.
10
- * You may obtain a copy of the License at
11
- *
12
- * http://www.apache.org/licenses/LICENSE-2.0
13
- *
14
- * Unless required by applicable law or agreed to in writing, software
15
- * distributed under the License is distributed on an "AS IS" BASIS,
16
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- * See the License for the specific language governing permissions and
18
- * limitations under the License.
19
- *
20
- * Columbus View (Pat. Pend.)
21
- *
22
- * Portions licensed separately.
23
- * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
- */
25
- define(["./Matrix2-eefef8eb","./AxisAlignedBoundingBox-d0c22774","./Transforms-d2e5867e","./defaultValue-0c475b81","./TerrainEncoding-bc10ab54","./ComponentDatatype-0200bf8c","./OrientedBoundingBox-5193f9a2","./WebMercatorProjection-cd2f30c2","./RuntimeError-5baf5c66","./_commonjsHelpers-bc29abbc","./createTaskProcessorWorker","./combine-7533016d","./AttributeCompression-7b0f288d","./WebGLConstants-5b50ced1","./EllipsoidTangentPlane-c080fd1b","./IntersectionTests-eb4db8e0","./Plane-b0299683"],(function(e,t,i,a,n,r,s,l,o,f,u,c,d,h,m,g,p){"use strict";var x=Object.freeze({NONE:0,LERC:1});const w={};w.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const k=new e.Cartesian3,y=new e.Matrix4,b=new e.Cartesian3,I=new e.Cartesian3;w.computeVertices=function(o){const f=Math.cos,u=Math.sin,c=Math.sqrt,d=Math.atan,h=Math.exp,m=r.CesiumMath.PI_OVER_TWO,g=r.CesiumMath.toRadians,p=o.heightmap,x=o.width,U=o.height,T=o.skirtHeight,M=T>0,V=a.defaultValue(o.isGeographic,!0),v=a.defaultValue(o.ellipsoid,e.Ellipsoid.WGS84),A=1/v.maximumRadius,B=e.Rectangle.clone(o.nativeRectangle),D=e.Rectangle.clone(o.rectangle);let S,P,E,C;a.defined(D)?(S=D.west,P=D.south,E=D.east,C=D.north):V?(S=g(B.west),P=g(B.south),E=g(B.east),C=g(B.north)):(S=B.west*A,P=m-2*d(h(-B.south*A)),E=B.east*A,C=m-2*d(h(-B.north*A)));let F=o.relativeToCenter;const N=a.defined(F);F=N?F:e.Cartesian3.ZERO;const O=a.defaultValue(o.includeWebMercatorT,!1),R=a.defaultValue(o.exaggeration,1),L=a.defaultValue(o.exaggerationRelativeHeight,0),z=1!==R,H=a.defaultValue(o.structure,w.DEFAULT_STRUCTURE),_=a.defaultValue(H.heightScale,w.DEFAULT_STRUCTURE.heightScale),Y=a.defaultValue(H.heightOffset,w.DEFAULT_STRUCTURE.heightOffset),W=a.defaultValue(H.elementsPerHeight,w.DEFAULT_STRUCTURE.elementsPerHeight),X=a.defaultValue(H.stride,w.DEFAULT_STRUCTURE.stride),Z=a.defaultValue(H.elementMultiplier,w.DEFAULT_STRUCTURE.elementMultiplier),j=a.defaultValue(H.isBigEndian,w.DEFAULT_STRUCTURE.isBigEndian);let G=e.Rectangle.computeWidth(B),q=e.Rectangle.computeHeight(B);const Q=G/(x-1),J=q/(U-1);V||(G*=A,q*=A);const K=v.radiiSquared,$=K.x,ee=K.y,te=K.z;let ie=65536,ae=-65536;const ne=i.Transforms.eastNorthUpToFixedFrame(F,v),re=e.Matrix4.inverseTransformation(ne,y);let se,le;O&&(se=l.WebMercatorProjection.geodeticLatitudeToMercatorAngle(P),le=1/(l.WebMercatorProjection.geodeticLatitudeToMercatorAngle(C)-se));const oe=b;oe.x=Number.POSITIVE_INFINITY,oe.y=Number.POSITIVE_INFINITY,oe.z=Number.POSITIVE_INFINITY;const fe=I;fe.x=Number.NEGATIVE_INFINITY,fe.y=Number.NEGATIVE_INFINITY,fe.z=Number.NEGATIVE_INFINITY;let ue=Number.POSITIVE_INFINITY;const ce=x*U,de=ce+(T>0?2*x+2*U:0),he=new Array(de),me=new Array(de),ge=new Array(de),pe=O?new Array(de):[],xe=z?new Array(de):[];let we=0,ke=U,ye=0,be=x;M&&(--we,++ke,--ye,++be);const Ie=1e-5;for(let t=we;t<ke;++t){let i=t;i<0&&(i=0),i>=U&&(i=U-1);let a=B.north-J*i;a=V?g(a):m-2*d(h(-a*A));let n=(a-P)/(C-P);n=r.CesiumMath.clamp(n,0,1);const s=t===we,o=t===ke-1;T>0&&(s?a+=Ie*q:o&&(a-=Ie*q));const w=f(a),y=u(a),b=te*y;let I;O&&(I=(l.WebMercatorProjection.geodeticLatitudeToMercatorAngle(a)-se)*le);for(let t=ye;t<be;++t){let a=t;a<0&&(a=0),a>=x&&(a=x-1);const l=i*(x*X)+a*X;let d;if(1===W)d=p[l];else{let e;if(d=0,j)for(e=0;e<W;++e)d=d*Z+p[l+e];else for(e=W-1;e>=0;--e)d=d*Z+p[l+e]}d=d*_+Y,ae=Math.max(ae,d),ie=Math.min(ie,d);let h=B.west+Q*a;V?h=g(h):h*=A;let m=(h-S)/(E-S);m=r.CesiumMath.clamp(m,0,1);let M=i*x+a;if(T>0){const e=t===ye,n=t===be-1,r=s||o||e||n;if((s||o)&&(e||n))continue;r&&(d-=T,e?(M=ce+(U-i-1),h-=Ie*G):o?M=ce+U+(x-a-1):n?(M=ce+U+x+i,h+=Ie*G):s&&(M=ce+U+x+U+a))}const D=w*f(h),P=w*u(h),C=$*D,F=ee*P,N=1/c(C*D+F*P+b*y),R=C*N,L=F*N,H=b*N,q=new e.Cartesian3;q.x=R+D*d,q.y=L+P*d,q.z=H+y*d,e.Matrix4.multiplyByPoint(re,q,k),e.Cartesian3.minimumByComponent(k,oe,oe),e.Cartesian3.maximumByComponent(k,fe,fe),ue=Math.min(ue,d),he[M]=q,ge[M]=new e.Cartesian2(m,n),me[M]=d,O&&(pe[M]=I),z&&(xe[M]=v.geodeticSurfaceNormal(q))}}const Ue=i.BoundingSphere.fromPoints(he);let Te,Me;if(a.defined(D)&&(Te=s.OrientedBoundingBox.fromRectangle(D,ie,ae,v)),N){Me=new n.EllipsoidalOccluder(v).computeHorizonCullingPointPossiblyUnderEllipsoid(F,he,ie)}const Ve=new t.AxisAlignedBoundingBox(oe,fe,F),ve=new n.TerrainEncoding(F,Ve,ue,ae,ne,!1,O,z,R,L),Ae=new Float32Array(de*ve.stride);let Be=0;for(let e=0;e<de;++e)Be=ve.encode(Ae,Be,he[e],ge[e],me[e],void 0,pe[e],xe[e]);return{vertices:Ae,maximumHeight:ae,minimumHeight:ie,encoding:ve,boundingSphere3D:Ue,orientedBoundingBox:Te,occludeePointInScaledSpace:Me}};var U=w,T=f.createCommonjsModule((function(e){
26
- /* Copyright 2015-2018 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
27
- !function(){var t,i,a,n,r,s,l,o,f,u,c,d,h,m,g,p,x=(t={defaultNoDataValue:-34027999387901484e22,decode:function(e,s){var l=(s=s||{}).encodedMaskData||null===s.encodedMaskData,o=r(e,s.inputOffset||0,l),f=null!==s.noDataValue?s.noDataValue:t.defaultNoDataValue,u=i(o,s.pixelType||Float32Array,s.encodedMaskData,f,s.returnMask),c={width:o.width,height:o.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:o.pixels.maxValue,noDataValue:f};return u.resultMask&&(c.maskData=u.resultMask),s.returnEncodedMask&&o.mask&&(c.encodedMaskData=o.mask.bitset?o.mask.bitset:null),s.returnFileInfo&&(c.fileInfo=a(o),s.computeUsedBitDepths&&(c.fileInfo.bitDepths=n(o))),c}},i=function(e,t,i,a,n){var r,l,o,f=0,u=e.pixels.numBlocksX,c=e.pixels.numBlocksY,d=Math.floor(e.width/u),h=Math.floor(e.height/c),m=2*e.maxZError,g=Number.MAX_VALUE;i=i||(e.mask?e.mask.bitset:null),l=new t(e.width*e.height),n&&i&&(o=new Uint8Array(e.width*e.height));for(var p,x,w=new Float32Array(d*h),k=0;k<=c;k++){var y=k!==c?h:e.height%c;if(0!==y)for(var b=0;b<=u;b++){var I=b!==u?d:e.width%u;if(0!==I){var U,T,M,V,v=k*e.width*h+b*d,A=e.width-I,B=e.pixels.blocks[f];if(B.encoding<2?(0===B.encoding?U=B.rawData:(s(B.stuffedData,B.bitsPerPixel,B.numValidPixels,B.offset,m,w,e.pixels.maxValue),U=w),T=0):M=2===B.encoding?0:B.offset,i)for(x=0;x<y;x++){for(7&v&&(V=i[v>>3],V<<=7&v),p=0;p<I;p++)7&v||(V=i[v>>3]),128&V?(o&&(o[v]=1),g=g>(r=B.encoding<2?U[T++]:M)?r:g,l[v++]=r):(o&&(o[v]=0),l[v++]=a),V<<=1;v+=A}else if(B.encoding<2)for(x=0;x<y;x++){for(p=0;p<I;p++)g=g>(r=U[T++])?r:g,l[v++]=r;v+=A}else for(g=g>M?M:g,x=0;x<y;x++){for(p=0;p<I;p++)l[v++]=M;v+=A}if(1===B.encoding&&T!==B.numValidPixels)throw"Block and Mask do not match";f++}}}return{resultPixels:l,resultMask:o,minValue:g}},a=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},n=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,i={},a=0;a<t;a++){var n=e.pixels.blocks[a];0===n.encoding?i.float32=!0:1===n.encoding?i[n.bitsPerPixel]=!0:i[0]=!0}return Object.keys(i)},r=function(e,t,i){var a={},n=new Uint8Array(e,t,10);if(a.fileIdentifierString=String.fromCharCode.apply(null,n),"CntZImage"!==a.fileIdentifierString.trim())throw"Unexpected file identifier string: "+a.fileIdentifierString;t+=10;var r=new DataView(e,t,24);if(a.fileVersion=r.getInt32(0,!0),a.imageType=r.getInt32(4,!0),a.height=r.getUint32(8,!0),a.width=r.getUint32(12,!0),a.maxZError=r.getFloat64(16,!0),t+=24,!i)if(r=new DataView(e,t,16),a.mask={},a.mask.numBlocksY=r.getUint32(0,!0),a.mask.numBlocksX=r.getUint32(4,!0),a.mask.numBytes=r.getUint32(8,!0),a.mask.maxValue=r.getFloat32(12,!0),t+=16,a.mask.numBytes>0){var s=new Uint8Array(Math.ceil(a.width*a.height/8)),l=(r=new DataView(e,t,a.mask.numBytes)).getInt16(0,!0),o=2,f=0;do{if(l>0)for(;l--;)s[f++]=r.getUint8(o++);else{var u=r.getUint8(o++);for(l=-l;l--;)s[f++]=u}l=r.getInt16(o,!0),o+=2}while(o<a.mask.numBytes);if(-32768!==l||f<s.length)throw"Unexpected end of mask RLE encoding";a.mask.bitset=s,t+=a.mask.numBytes}else 0==(a.mask.numBytes|a.mask.numBlocksY|a.mask.maxValue)&&(a.mask.bitset=new Uint8Array(Math.ceil(a.width*a.height/8)));r=new DataView(e,t,16),a.pixels={},a.pixels.numBlocksY=r.getUint32(0,!0),a.pixels.numBlocksX=r.getUint32(4,!0),a.pixels.numBytes=r.getUint32(8,!0),a.pixels.maxValue=r.getFloat32(12,!0),t+=16;var c=a.pixels.numBlocksX,d=a.pixels.numBlocksY,h=c+(a.width%c>0?1:0),m=d+(a.height%d>0?1:0);a.pixels.blocks=new Array(h*m);for(var g=0,p=0;p<m;p++)for(var x=0;x<h;x++){var w=0,k=e.byteLength-t;r=new DataView(e,t,Math.min(10,k));var y={};a.pixels.blocks[g++]=y;var b=r.getUint8(0);if(w++,y.encoding=63&b,y.encoding>3)throw"Invalid block encoding ("+y.encoding+")";if(2!==y.encoding){if(0!==b&&2!==b){if(b>>=6,y.offsetType=b,2===b)y.offset=r.getInt8(1),w++;else if(1===b)y.offset=r.getInt16(1,!0),w+=2;else{if(0!==b)throw"Invalid block offset type";y.offset=r.getFloat32(1,!0),w+=4}if(1===y.encoding)if(b=r.getUint8(w),w++,y.bitsPerPixel=63&b,b>>=6,y.numValidPixelsType=b,2===b)y.numValidPixels=r.getUint8(w),w++;else if(1===b)y.numValidPixels=r.getUint16(w,!0),w+=2;else{if(0!==b)throw"Invalid valid pixel count type";y.numValidPixels=r.getUint32(w,!0),w+=4}}var I;if(t+=w,3!==y.encoding)if(0===y.encoding){var U=(a.pixels.numBytes-1)/4;if(U!==Math.floor(U))throw"uncompressed block has invalid length";I=new ArrayBuffer(4*U),new Uint8Array(I).set(new Uint8Array(e,t,4*U));var T=new Float32Array(I);y.rawData=T,t+=4*U}else if(1===y.encoding){var M=Math.ceil(y.numValidPixels*y.bitsPerPixel/8),V=Math.ceil(M/4);I=new ArrayBuffer(4*V),new Uint8Array(I).set(new Uint8Array(e,t,M)),y.stuffedData=new Uint32Array(I),t+=M}}else t++}return a.eofOffset=t,a},s=function(e,t,i,a,n,r,s){var l,o,f,u=(1<<t)-1,c=0,d=0,h=Math.ceil((s-a)/n),m=4*e.length-Math.ceil(t*i/8);for(e[e.length-1]<<=8*m,l=0;l<i;l++){if(0===d&&(f=e[c++],d=32),d>=t)o=f>>>d-t&u,d-=t;else{var g=t-d;o=(f&u)<<g&u,o+=(f=e[c++])>>>(d=32-g)}r[l]=o<h?a+o*n:s}return r},t),w=(l=function(e,t,i,a,n,r,s,l){var o,f,u,c,d,h=(1<<i)-1,m=0,g=0,p=4*e.length-Math.ceil(i*a/8);if(e[e.length-1]<<=8*p,n)for(o=0;o<a;o++)0===g&&(u=e[m++],g=32),g>=i?(f=u>>>g-i&h,g-=i):(f=(u&h)<<(c=i-g)&h,f+=(u=e[m++])>>>(g=32-c)),t[o]=n[f];else for(d=Math.ceil((l-r)/s),o=0;o<a;o++)0===g&&(u=e[m++],g=32),g>=i?(f=u>>>g-i&h,g-=i):(f=(u&h)<<(c=i-g)&h,f+=(u=e[m++])>>>(g=32-c)),t[o]=f<d?r+f*s:l},o=function(e,t,i,a,n,r){var s,l=(1<<t)-1,o=0,f=0,u=0,c=0,d=0,h=[],m=4*e.length-Math.ceil(t*i/8);e[e.length-1]<<=8*m;var g=Math.ceil((r-a)/n);for(f=0;f<i;f++)0===c&&(s=e[o++],c=32),c>=t?(d=s>>>c-t&l,c-=t):(d=(s&l)<<(u=t-c)&l,d+=(s=e[o++])>>>(c=32-u)),h[f]=d<g?a+d*n:r;return h.unshift(a),h},f=function(e,t,i,a,n,r,s,l){var o,f,u,c,d=(1<<i)-1,h=0,m=0,g=0;if(n)for(o=0;o<a;o++)0===m&&(u=e[h++],m=32,g=0),m>=i?(f=u>>>g&d,m-=i,g+=i):(f=u>>>g&d,m=32-(c=i-m),f|=((u=e[h++])&(1<<c)-1)<<i-c,g=c),t[o]=n[f];else{var p=Math.ceil((l-r)/s);for(o=0;o<a;o++)0===m&&(u=e[h++],m=32,g=0),m>=i?(f=u>>>g&d,m-=i,g+=i):(f=u>>>g&d,m=32-(c=i-m),f|=((u=e[h++])&(1<<c)-1)<<i-c,g=c),t[o]=f<p?r+f*s:l}return t},u=function(e,t,i,a,n,r){var s,l=(1<<t)-1,o=0,f=0,u=0,c=0,d=0,h=0,m=[],g=Math.ceil((r-a)/n);for(f=0;f<i;f++)0===c&&(s=e[o++],c=32,h=0),c>=t?(d=s>>>h&l,c-=t,h+=t):(d=s>>>h&l,c=32-(u=t-c),d|=((s=e[o++])&(1<<u)-1)<<t-u,h=u),m[f]=d<g?a+d*n:r;return m.unshift(a),m},c=function(e,t,i,a){var n,r,s,l,o=(1<<i)-1,f=0,u=0,c=4*e.length-Math.ceil(i*a/8);for(e[e.length-1]<<=8*c,n=0;n<a;n++)0===u&&(s=e[f++],u=32),u>=i?(r=s>>>u-i&o,u-=i):(r=(s&o)<<(l=i-u)&o,r+=(s=e[f++])>>>(u=32-l)),t[n]=r;return t},d=function(e,t,i,a){var n,r,s,l,o=(1<<i)-1,f=0,u=0,c=0;for(n=0;n<a;n++)0===u&&(s=e[f++],u=32,c=0),u>=i?(r=s>>>c&o,u-=i,c+=i):(r=s>>>c&o,u=32-(l=i-u),r|=((s=e[f++])&(1<<l)-1)<<i-l,c=l),t[n]=r;return t},h={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,i=65535,a=e.length,n=Math.floor(a/2),r=0;n;){var s=n>=359?359:n;n-=s;do{t+=e[r++]<<8,i+=t+=e[r++]}while(--s);t=(65535&t)+(t>>>16),i=(65535&i)+(i>>>16)}return 1&a&&(i+=t+=e[r]<<8),((i=(65535&i)+(i>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var i=t.ptr,a=new Uint8Array(e,i,6),n={};if(n.fileIdentifierString=String.fromCharCode.apply(null,a),0!==n.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+n.fileIdentifierString;i+=6;var r,s=new DataView(e,i,8),l=s.getInt32(0,!0);if(n.fileVersion=l,i+=4,l>=3&&(n.checksum=s.getUint32(4,!0),i+=4),s=new DataView(e,i,12),n.height=s.getUint32(0,!0),n.width=s.getUint32(4,!0),i+=8,l>=4?(n.numDims=s.getUint32(8,!0),i+=4):n.numDims=1,s=new DataView(e,i,40),n.numValidPixel=s.getUint32(0,!0),n.microBlockSize=s.getInt32(4,!0),n.blobSize=s.getInt32(8,!0),n.imageType=s.getInt32(12,!0),n.maxZError=s.getFloat64(16,!0),n.zMin=s.getFloat64(24,!0),n.zMax=s.getFloat64(32,!0),i+=40,t.headerInfo=n,t.ptr=i,l>=3&&(r=l>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,i-r,n.blobSize-14))!==n.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var i=t.headerInfo,a=this.getDataTypeArray(i.imageType),n=i.numDims*this.getDataTypeSize(i.imageType),r=this.readSubArray(e,t.ptr,a,n),s=this.readSubArray(e,t.ptr+n,a,n);t.ptr+=2*n;var l,o=!0;for(l=0;l<i.numDims;l++)if(r[l]!==s[l]){o=!1;break}return i.minValues=r,i.maxValues=s,o},readSubArray:function(e,t,i,a){var n;if(i===Uint8Array)n=new Uint8Array(e,t,a);else{var r=new ArrayBuffer(a);new Uint8Array(r).set(new Uint8Array(e,t,a)),n=new i(r)}return n},readMask:function(e,t){var i,a,n=t.ptr,r=t.headerInfo,s=r.width*r.height,l=r.numValidPixel,o=new DataView(e,n,4),f={};if(f.numBytes=o.getUint32(0,!0),n+=4,(0===l||s===l)&&0!==f.numBytes)throw"invalid mask";if(0===l)i=new Uint8Array(Math.ceil(s/8)),f.bitset=i,a=new Uint8Array(s),t.pixels.resultMask=a,n+=f.numBytes;else if(f.numBytes>0){i=new Uint8Array(Math.ceil(s/8));var u=(o=new DataView(e,n,f.numBytes)).getInt16(0,!0),c=2,d=0,h=0;do{if(u>0)for(;u--;)i[d++]=o.getUint8(c++);else for(h=o.getUint8(c++),u=-u;u--;)i[d++]=h;u=o.getInt16(c,!0),c+=2}while(c<f.numBytes);if(-32768!==u||d<i.length)throw"Unexpected end of mask RLE encoding";a=new Uint8Array(s);var m=0,g=0;for(g=0;g<s;g++)7&g?(m=i[g>>3],m<<=7&g):m=i[g>>3],128&m&&(a[g]=1);t.pixels.resultMask=a,f.bitset=i,n+=f.numBytes}return t.ptr=n,t.mask=f,!0},readDataOneSweep:function(e,t,i){var a,n=t.ptr,r=t.headerInfo,s=r.numDims,l=r.width*r.height,o=r.imageType,f=r.numValidPixel*h.getDataTypeSize(o)*s,u=t.pixels.resultMask;if(i===Uint8Array)a=new Uint8Array(e,n,f);else{var c=new ArrayBuffer(f);new Uint8Array(c).set(new Uint8Array(e,n,f)),a=new i(c)}if(a.length===l*s)t.pixels.resultPixels=a;else{t.pixels.resultPixels=new i(l*s);var d=0,m=0,g=0,p=0;if(s>1)for(g=0;g<s;g++)for(p=g*l,m=0;m<l;m++)u[m]&&(t.pixels.resultPixels[p+m]=a[d++]);else for(m=0;m<l;m++)u[m]&&(t.pixels.resultPixels[m]=a[d++])}return n+=f,t.ptr=n,!0},readHuffmanTree:function(e,t){var i=this.HUFFMAN_LUT_BITS_MAX,a=new DataView(e,t.ptr,16);if(t.ptr+=16,a.getInt32(0,!0)<2)throw"unsupported Huffman version";var n=a.getInt32(4,!0),r=a.getInt32(8,!0),s=a.getInt32(12,!0);if(r>=s)return!1;var l=new Uint32Array(s-r);h.decodeBits(e,t,l);var o,f,u,c,d=[];for(o=r;o<s;o++)d[f=o-(o<n?0:n)]={first:l[o-r],second:null};var g=e.byteLength-t.ptr,p=Math.ceil(g/4),x=new ArrayBuffer(4*p);new Uint8Array(x).set(new Uint8Array(e,t.ptr,g));var w,k=new Uint32Array(x),y=0,b=0;for(w=k[0],o=r;o<s;o++)(c=d[f=o-(o<n?0:n)].first)>0&&(d[f].second=w<<y>>>32-c,32-y>=c?32===(y+=c)&&(y=0,w=k[++b]):(y+=c-32,w=k[++b],d[f].second|=w>>>32-y));var I=0,U=0,T=new m;for(o=0;o<d.length;o++)void 0!==d[o]&&(I=Math.max(I,d[o].first));U=I>=i?i:I,I>=30&&console.log("WARning, large NUM LUT BITS IS "+I);var M,V,v,A,B,D=[];for(o=r;o<s;o++)if((c=d[f=o-(o<n?0:n)].first)>0)if(M=[c,f],c<=U)for(V=d[f].second<<U-c,v=1<<U-c,u=0;u<v;u++)D[V|u]=M;else for(V=d[f].second,B=T,A=c-1;A>=0;A--)V>>>A&1?(B.right||(B.right=new m),B=B.right):(B.left||(B.left=new m),B=B.left),0!==A||B.val||(B.val=M[1]);return{decodeLut:D,numBitsLUTQick:U,numBitsLUT:I,tree:T,stuffedData:k,srcPtr:b,bitPos:y}},readHuffman:function(e,t,i){var a,n,r,s,l,o,f,u,c,d=t.headerInfo,h=d.numDims,m=t.headerInfo.height,g=t.headerInfo.width,p=g*m,x=this.readHuffmanTree(e,t),w=x.decodeLut,k=x.tree,y=x.stuffedData,b=x.srcPtr,I=x.bitPos,U=x.numBitsLUTQick,T=x.numBitsLUT,M=0===t.headerInfo.imageType?128:0,V=t.pixels.resultMask,v=0;I>0&&(b++,I=0);var A,B=y[b],D=1===t.encodeMode,S=new i(p*h),P=S;for(A=0;A<d.numDims;A++){if(h>1&&(P=new i(S.buffer,p*A,p),v=0),t.headerInfo.numValidPixel===g*m)for(u=0,o=0;o<m;o++)for(f=0;f<g;f++,u++){if(n=0,l=s=B<<I>>>32-U,32-I<U&&(l=s|=y[b+1]>>>64-I-U),w[l])n=w[l][1],I+=w[l][0];else for(l=s=B<<I>>>32-T,32-I<T&&(l=s|=y[b+1]>>>64-I-T),a=k,c=0;c<T;c++)if(!(a=s>>>T-c-1&1?a.right:a.left).left&&!a.right){n=a.val,I=I+c+1;break}I>=32&&(I-=32,B=y[++b]),r=n-M,D?(r+=f>0?v:o>0?P[u-g]:v,r&=255,P[u]=r,v=r):P[u]=r}else for(u=0,o=0;o<m;o++)for(f=0;f<g;f++,u++)if(V[u]){if(n=0,l=s=B<<I>>>32-U,32-I<U&&(l=s|=y[b+1]>>>64-I-U),w[l])n=w[l][1],I+=w[l][0];else for(l=s=B<<I>>>32-T,32-I<T&&(l=s|=y[b+1]>>>64-I-T),a=k,c=0;c<T;c++)if(!(a=s>>>T-c-1&1?a.right:a.left).left&&!a.right){n=a.val,I=I+c+1;break}I>=32&&(I-=32,B=y[++b]),r=n-M,D?(f>0&&V[u-1]?r+=v:o>0&&V[u-g]?r+=P[u-g]:r+=v,r&=255,P[u]=r,v=r):P[u]=r}t.ptr=t.ptr+4*(b+1)+(I>0?4:0)}t.pixels.resultPixels=S},decodeBits:function(e,t,i,a,n){var r=t.headerInfo,s=r.fileVersion,h=0,m=new DataView(e,t.ptr,5),g=m.getUint8(0);h++;var p=g>>6,x=0===p?4:3-p,w=(32&g)>0,k=31&g,y=0;if(1===x)y=m.getUint8(h),h++;else if(2===x)y=m.getUint16(h,!0),h+=2;else{if(4!==x)throw"Invalid valid pixel count type";y=m.getUint32(h,!0),h+=4}var b,I,U,T,M,V,v,A,B,D=2*r.maxZError,S=r.numDims>1?r.maxValues[n]:r.zMax;if(w){for(t.counter.lut++,A=m.getUint8(h),h++,T=Math.ceil((A-1)*k/8),M=Math.ceil(T/4),I=new ArrayBuffer(4*M),U=new Uint8Array(I),t.ptr+=h,U.set(new Uint8Array(e,t.ptr,T)),v=new Uint32Array(I),t.ptr+=T,B=0;A-1>>>B;)B++;T=Math.ceil(y*B/8),M=Math.ceil(T/4),I=new ArrayBuffer(4*M),(U=new Uint8Array(I)).set(new Uint8Array(e,t.ptr,T)),b=new Uint32Array(I),t.ptr+=T,V=s>=3?u(v,k,A-1,a,D,S):o(v,k,A-1,a,D,S),s>=3?f(b,i,B,y,V):l(b,i,B,y,V)}else t.counter.bitstuffer++,B=k,t.ptr+=h,B>0&&(T=Math.ceil(y*B/8),M=Math.ceil(T/4),I=new ArrayBuffer(4*M),(U=new Uint8Array(I)).set(new Uint8Array(e,t.ptr,T)),b=new Uint32Array(I),t.ptr+=T,s>=3?null==a?d(b,i,B,y):f(b,i,B,y,!1,a,D,S):null==a?c(b,i,B,y):l(b,i,B,y,!1,a,D,S))},readTiles:function(e,t,i){var a=t.headerInfo,n=a.width,r=a.height,s=a.microBlockSize,l=a.imageType,o=h.getDataTypeSize(l),f=Math.ceil(n/s),u=Math.ceil(r/s);t.pixels.numBlocksY=u,t.pixels.numBlocksX=f,t.pixels.ptr=0;var c,d,m,g,p,x,w,k,y=0,b=0,I=0,U=0,T=0,M=0,V=0,v=0,A=0,B=0,D=0,S=0,P=0,E=0,C=0,F=new i(s*s),N=r%s||s,O=n%s||s,R=a.numDims,L=t.pixels.resultMask,z=t.pixels.resultPixels;for(I=0;I<u;I++)for(T=I!==u-1?s:N,U=0;U<f;U++)for(B=I*n*s+U*s,D=n-(M=U!==f-1?s:O),k=0;k<R;k++){if(R>1&&(z=new i(t.pixels.resultPixels.buffer,n*r*k*o,n*r)),V=e.byteLength-t.ptr,d={},C=0,C++,A=(v=(c=new DataView(e,t.ptr,Math.min(10,V))).getUint8(0))>>6&255,(v>>2&15)!=(U*s>>3&15))throw"integrity issue";if((p=3&v)>3)throw t.ptr+=C,"Invalid block encoding ("+p+")";if(2!==p)if(0===p){if(t.counter.uncompressed++,t.ptr+=C,S=(S=T*M*o)<(P=e.byteLength-t.ptr)?S:P,m=new ArrayBuffer(S%o==0?S:S+o-S%o),new Uint8Array(m).set(new Uint8Array(e,t.ptr,S)),g=new i(m),E=0,L)for(y=0;y<T;y++){for(b=0;b<M;b++)L[B]&&(z[B]=g[E++]),B++;B+=D}else for(y=0;y<T;y++){for(b=0;b<M;b++)z[B++]=g[E++];B+=D}t.ptr+=E*o}else if(x=h.getDataTypeUsed(l,A),w=h.getOnePixel(d,C,x,c),C+=h.getDataTypeSize(x),3===p)if(t.ptr+=C,t.counter.constantoffset++,L)for(y=0;y<T;y++){for(b=0;b<M;b++)L[B]&&(z[B]=w),B++;B+=D}else for(y=0;y<T;y++){for(b=0;b<M;b++)z[B++]=w;B+=D}else if(t.ptr+=C,h.decodeBits(e,t,F,w,k),C=0,L)for(y=0;y<T;y++){for(b=0;b<M;b++)L[B]&&(z[B]=F[C++]),B++;B+=D}else for(y=0;y<T;y++){for(b=0;b<M;b++)z[B++]=F[C++];B+=D}else t.counter.constant++,t.ptr+=C}},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:h.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e){var t=e.headerInfo.zMax,i=e.headerInfo.numDims,a=e.headerInfo.height*e.headerInfo.width,n=a*i,r=0,s=0,l=0,o=e.pixels.resultMask;if(o)if(i>1)for(r=0;r<i;r++)for(l=r*a,s=0;s<a;s++)o[s]&&(e.pixels.resultPixels[l+s]=t);else for(s=0;s<a;s++)o[s]&&(e.pixels.resultPixels[s]=t);else if(e.pixels.resultPixels.fill)e.pixels.resultPixels.fill(t);else for(s=0;s<n;s++)e.pixels.resultPixels[s]=t},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var i;switch(e){case 0:i=t>=-128&&t<=127;break;case 1:i=t>=0&&t<=255;break;case 2:i=t>=-32768&&t<=32767;break;case 3:i=t>=0&&t<=65536;break;case 4:i=t>=-2147483648&&t<=2147483647;break;case 5:i=t>=0&&t<=4294967296;break;case 6:i=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:i=t>=5e-324&&t<=17976931348623157e292;break;default:i=!1}return i},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var i=e;switch(e){case 2:case 4:i=e-t;break;case 3:case 5:i=e-2*t;break;case 6:i=0===t?e:1===t?2:1;break;case 7:i=0===t?e:e-2*t+1;break;default:i=e}return i},getOnePixel:function(e,t,i,a){var n=0;switch(i){case 0:n=a.getInt8(t);break;case 1:n=a.getUint8(t);break;case 2:n=a.getInt16(t,!0);break;case 3:n=a.getUint16(t,!0);break;case 4:n=a.getInt32(t,!0);break;case 5:n=a.getUInt32(t,!0);break;case 6:n=a.getFloat32(t,!0);break;case 7:n=a.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return n}},m=function(e,t,i){this.val=e,this.left=t,this.right=i},{decode:function(e,t){var i=(t=t||{}).noDataValue,a=0,n={};n.ptr=t.inputOffset||0,n.pixels={},h.readHeaderInfo(e,n);var r=n.headerInfo,s=r.fileVersion,l=h.getDataTypeArray(r.imageType);h.readMask(e,n),r.numValidPixel===r.width*r.height||n.pixels.resultMask||(n.pixels.resultMask=t.maskData);var o,f=r.width*r.height;if(n.pixels.resultPixels=new l(f*r.numDims),n.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0},0!==r.numValidPixel)if(r.zMax===r.zMin)h.constructConstantSurface(n);else if(s>=4&&h.checkMinMaxRanges(e,n))h.constructConstantSurface(n);else{var u=new DataView(e,n.ptr,2),c=u.getUint8(0);if(n.ptr++,c)h.readDataOneSweep(e,n,l);else if(s>1&&r.imageType<=1&&Math.abs(r.maxZError-.5)<1e-5){var d=u.getUint8(1);if(n.ptr++,n.encodeMode=d,d>2||s<4&&d>1)throw"Invalid Huffman flag "+d;d?h.readHuffman(e,n,l):h.readTiles(e,n,l)}else h.readTiles(e,n,l)}n.eofOffset=n.ptr,t.inputOffset?(o=n.headerInfo.blobSize+t.inputOffset-n.ptr,Math.abs(o)>=1&&(n.eofOffset=t.inputOffset+n.headerInfo.blobSize)):(o=n.headerInfo.blobSize-n.ptr,Math.abs(o)>=1&&(n.eofOffset=n.headerInfo.blobSize));var m={width:r.width,height:r.height,pixelData:n.pixels.resultPixels,minValue:r.zMin,maxValue:r.zMax,validPixelCount:r.numValidPixel,dimCount:r.numDims,dimStats:{minValues:r.minValues,maxValues:r.maxValues},maskData:n.pixels.resultMask};if(n.pixels.resultMask&&h.isValidPixelValue(r.imageType,i)){var g=n.pixels.resultMask;for(a=0;a<f;a++)g[a]||(m.pixelData[a]=i);m.noDataValue=i}return n.noDataValue=i,t.returnFileInfo&&(m.fileInfo=h.formatFileInfo(n)),m},getBandCount:function(e){for(var t=0,i=0,a={ptr:0,pixels:{}};i<e.byteLength-58;)h.readHeaderInfo(e,a),i+=a.headerInfo.blobSize,t++,a.ptr=i;return t}}),k=(g=new ArrayBuffer(4),p=new Uint8Array(g),new Uint32Array(g)[0]=1,1===p[0]),y={decode:function(e,t){if(!k)throw"Big endian system is not supported.";var i,a,n=(t=t||{}).inputOffset||0,r=new Uint8Array(e,n,10),s=String.fromCharCode.apply(null,r);if("CntZImage"===s.trim())i=x,a=1;else{if("Lerc2"!==s.substring(0,5))throw"Unexpected file identifier string: "+s;i=w,a=2}for(var l,o,f,u,c,d,h=0,m=e.byteLength-10,g=[],p={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]};n<m;){var y=i.decode(e,{inputOffset:n,encodedMaskData:l,maskData:f,returnMask:0===h,returnEncodedMask:0===h,returnFileInfo:!0,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});n=y.fileInfo.eofOffset,0===h&&(l=y.encodedMaskData,f=y.maskData,p.width=y.width,p.height=y.height,p.dimCount=y.dimCount||1,p.pixelType=y.pixelType||y.fileInfo.pixelType,p.mask=y.maskData),a>1&&y.fileInfo.mask&&y.fileInfo.mask.numBytes>0&&g.push(y.maskData),h++,p.pixels.push(y.pixelData),p.statistics.push({minValue:y.minValue,maxValue:y.maxValue,noDataValue:y.noDataValue,dimStats:y.dimStats})}if(a>1&&g.length>1){for(d=p.width*p.height,p.bandMasks=g,(f=new Uint8Array(d)).set(g[0]),u=1;u<g.length;u++)for(o=g[u],c=0;c<d;c++)f[c]=f[c]&o[c];p.maskData=f}return p}};e.exports?e.exports=y:this.Lerc=y}()}));return u((function(t,i){if(t.encoding===x.LERC){let e;try{e=T.decode(t.heightmap)}catch(e){throw new o.RuntimeError(e)}if(e.statistics[0].minValue===Number.MAX_VALUE)throw new o.RuntimeError("Invalid tile data");t.heightmap=e.pixels[0],t.width=e.width,t.height=e.height}t.ellipsoid=e.Ellipsoid.clone(t.ellipsoid),t.rectangle=e.Rectangle.clone(t.rectangle);const a=U.computeVertices(t),n=a.vertices;return i.push(n.buffer),{vertices:n.buffer,numberOfAttributes:a.encoding.stride,minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight,gridWidth:t.width,gridHeight:t.height,boundingSphere3D:a.boundingSphere3D,orientedBoundingBox:a.orientedBoundingBox,occludeePointInScaledSpace:a.occludeePointInScaledSpace,encoding:a.encoding,westIndicesSouthToNorth:a.westIndicesSouthToNorth,southIndicesEastToWest:a.southIndicesEastToWest,eastIndicesNorthToSouth:a.eastIndicesNorthToSouth,northIndicesWestToEast:a.northIndicesWestToEast}}))}));
1
+ define(['./Matrix3-315394f6', './AxisAlignedBoundingBox-ff186ccc', './Transforms-40229881', './Matrix2-13178034', './defaultValue-0a909f67', './Check-666ab1a0', './TerrainEncoding-833187da', './Math-2dbd6b93', './OrientedBoundingBox-04920dc7', './WebMercatorProjection-13a90d41', './RuntimeError-06c93819', './createTaskProcessorWorker', './combine-ca22a614', './AttributeCompression-b646d393', './ComponentDatatype-f7b11d02', './WebGLConstants-a8cc3e8c', './EllipsoidTangentPlane-214683dc', './IntersectionTests-f6e6bd8a', './Plane-900aa728'], (function (Matrix3, AxisAlignedBoundingBox, Transforms, Matrix2, defaultValue, Check, TerrainEncoding, Math$1, OrientedBoundingBox, WebMercatorProjection, RuntimeError, createTaskProcessorWorker, combine, AttributeCompression, ComponentDatatype, WebGLConstants, EllipsoidTangentPlane, IntersectionTests, Plane) { 'use strict';
2
+
3
+ /**
4
+ * The encoding that is used for a heightmap
5
+ *
6
+ * @enum {Number}
7
+ */
8
+ const HeightmapEncoding = {
9
+ /**
10
+ * No encoding
11
+ *
12
+ * @type {Number}
13
+ * @constant
14
+ */
15
+ NONE: 0,
16
+
17
+ /**
18
+ * LERC encoding
19
+ *
20
+ * @type {Number}
21
+ * @constant
22
+ *
23
+ * @see {@link https://github.com/Esri/lerc|The LERC specification}
24
+ */
25
+ LERC: 1,
26
+ };
27
+ var HeightmapEncoding$1 = Object.freeze(HeightmapEncoding);
28
+
29
+ /**
30
+ * Contains functions to create a mesh from a heightmap image.
31
+ *
32
+ * @namespace HeightmapTessellator
33
+ *
34
+ * @private
35
+ */
36
+ const HeightmapTessellator = {};
37
+
38
+ /**
39
+ * The default structure of a heightmap, as given to {@link HeightmapTessellator.computeVertices}.
40
+ *
41
+ * @constant
42
+ */
43
+ HeightmapTessellator.DEFAULT_STRUCTURE = Object.freeze({
44
+ heightScale: 1.0,
45
+ heightOffset: 0.0,
46
+ elementsPerHeight: 1,
47
+ stride: 1,
48
+ elementMultiplier: 256.0,
49
+ isBigEndian: false,
50
+ });
51
+
52
+ const cartesian3Scratch = new Matrix3.Cartesian3();
53
+ const matrix4Scratch = new Matrix2.Matrix4();
54
+ const minimumScratch = new Matrix3.Cartesian3();
55
+ const maximumScratch = new Matrix3.Cartesian3();
56
+
57
+ /**
58
+ * Fills an array of vertices from a heightmap image.
59
+ *
60
+ * @param {Object} options Object with the following properties:
61
+ * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array|Float64Array} options.heightmap The heightmap to tessellate.
62
+ * @param {Number} options.width The width of the heightmap, in height samples.
63
+ * @param {Number} options.height The height of the heightmap, in height samples.
64
+ * @param {Number} options.skirtHeight The height of skirts to drape at the edges of the heightmap.
65
+ * @param {Rectangle} options.nativeRectangle A rectangle in the native coordinates of the heightmap's projection. For
66
+ * a heightmap with a geographic projection, this is degrees. For the web mercator
67
+ * projection, this is meters.
68
+ * @param {Number} [options.exaggeration=1.0] The scale used to exaggerate the terrain.
69
+ * @param {Number} [options.exaggerationRelativeHeight=0.0] The height from which terrain is exaggerated.
70
+ * @param {Rectangle} [options.rectangle] The rectangle covered by the heightmap, in geodetic coordinates with north, south, east and
71
+ * west properties in radians. Either rectangle or nativeRectangle must be provided. If both
72
+ * are provided, they're assumed to be consistent.
73
+ * @param {Boolean} [options.isGeographic=true] True if the heightmap uses a {@link GeographicProjection}, or false if it uses
74
+ * a {@link WebMercatorProjection}.
75
+ * @param {Cartesian3} [options.relativeToCenter=Cartesian3.ZERO] The positions will be computed as <code>Cartesian3.subtract(worldPosition, relativeToCenter)</code>.
76
+ * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to which the heightmap applies.
77
+ * @param {Object} [options.structure] An object describing the structure of the height data.
78
+ * @param {Number} [options.structure.heightScale=1.0] The factor by which to multiply height samples in order to obtain
79
+ * the height above the heightOffset, in meters. The heightOffset is added to the resulting
80
+ * height after multiplying by the scale.
81
+ * @param {Number} [options.structure.heightOffset=0.0] The offset to add to the scaled height to obtain the final
82
+ * height in meters. The offset is added after the height sample is multiplied by the
83
+ * heightScale.
84
+ * @param {Number} [options.structure.elementsPerHeight=1] The number of elements in the buffer that make up a single height
85
+ * sample. This is usually 1, indicating that each element is a separate height sample. If
86
+ * it is greater than 1, that number of elements together form the height sample, which is
87
+ * computed according to the structure.elementMultiplier and structure.isBigEndian properties.
88
+ * @param {Number} [options.structure.stride=1] The number of elements to skip to get from the first element of
89
+ * one height to the first element of the next height.
90
+ * @param {Number} [options.structure.elementMultiplier=256.0] The multiplier used to compute the height value when the
91
+ * stride property is greater than 1. For example, if the stride is 4 and the strideMultiplier
92
+ * is 256, the height is computed as follows:
93
+ * `height = buffer[index] + buffer[index + 1] * 256 + buffer[index + 2] * 256 * 256 + buffer[index + 3] * 256 * 256 * 256`
94
+ * This is assuming that the isBigEndian property is false. If it is true, the order of the
95
+ * elements is reversed.
96
+ * @param {Number} [options.structure.lowestEncodedHeight] The lowest value that can be stored in the height buffer. Any heights that are lower
97
+ * than this value after encoding with the `heightScale` and `heightOffset` are clamped to this value. For example, if the height
98
+ * buffer is a `Uint16Array`, this value should be 0 because a `Uint16Array` cannot store negative numbers. If this parameter is
99
+ * not specified, no minimum value is enforced.
100
+ * @param {Number} [options.structure.highestEncodedHeight] The highest value that can be stored in the height buffer. Any heights that are higher
101
+ * than this value after encoding with the `heightScale` and `heightOffset` are clamped to this value. For example, if the height
102
+ * buffer is a `Uint16Array`, this value should be `256 * 256 - 1` or 65535 because a `Uint16Array` cannot store numbers larger
103
+ * than 65535. If this parameter is not specified, no maximum value is enforced.
104
+ * @param {Boolean} [options.structure.isBigEndian=false] Indicates endianness of the elements in the buffer when the
105
+ * stride property is greater than 1. If this property is false, the first element is the
106
+ * low-order element. If it is true, the first element is the high-order element.
107
+ *
108
+ * @example
109
+ * const width = 5;
110
+ * const height = 5;
111
+ * const statistics = Cesium.HeightmapTessellator.computeVertices({
112
+ * heightmap : [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0],
113
+ * width : width,
114
+ * height : height,
115
+ * skirtHeight : 0.0,
116
+ * nativeRectangle : {
117
+ * west : 10.0,
118
+ * east : 20.0,
119
+ * south : 30.0,
120
+ * north : 40.0
121
+ * }
122
+ * });
123
+ *
124
+ * const encoding = statistics.encoding;
125
+ * const position = encoding.decodePosition(statistics.vertices, index);
126
+ */
127
+ HeightmapTessellator.computeVertices = function (options) {
128
+ //>>includeStart('debug', pragmas.debug);
129
+ if (!defaultValue.defined(options) || !defaultValue.defined(options.heightmap)) {
130
+ throw new Check.DeveloperError("options.heightmap is required.");
131
+ }
132
+ if (!defaultValue.defined(options.width) || !defaultValue.defined(options.height)) {
133
+ throw new Check.DeveloperError("options.width and options.height are required.");
134
+ }
135
+ if (!defaultValue.defined(options.nativeRectangle)) {
136
+ throw new Check.DeveloperError("options.nativeRectangle is required.");
137
+ }
138
+ if (!defaultValue.defined(options.skirtHeight)) {
139
+ throw new Check.DeveloperError("options.skirtHeight is required.");
140
+ }
141
+ //>>includeEnd('debug');
142
+
143
+ // This function tends to be a performance hotspot for terrain rendering,
144
+ // so it employs a lot of inlining and unrolling as an optimization.
145
+ // In particular, the functionality of Ellipsoid.cartographicToCartesian
146
+ // is inlined.
147
+
148
+ const cos = Math.cos;
149
+ const sin = Math.sin;
150
+ const sqrt = Math.sqrt;
151
+ const atan = Math.atan;
152
+ const exp = Math.exp;
153
+ const piOverTwo = Math$1.CesiumMath.PI_OVER_TWO;
154
+ const toRadians = Math$1.CesiumMath.toRadians;
155
+
156
+ const heightmap = options.heightmap;
157
+ const width = options.width;
158
+ const height = options.height;
159
+ const skirtHeight = options.skirtHeight;
160
+ const hasSkirts = skirtHeight > 0.0;
161
+
162
+ const isGeographic = defaultValue.defaultValue(options.isGeographic, true);
163
+ const ellipsoid = defaultValue.defaultValue(options.ellipsoid, Matrix3.Ellipsoid.WGS84);
164
+
165
+ const oneOverGlobeSemimajorAxis = 1.0 / ellipsoid.maximumRadius;
166
+
167
+ const nativeRectangle = Matrix2.Rectangle.clone(options.nativeRectangle);
168
+ const rectangle = Matrix2.Rectangle.clone(options.rectangle);
169
+
170
+ let geographicWest;
171
+ let geographicSouth;
172
+ let geographicEast;
173
+ let geographicNorth;
174
+
175
+ if (!defaultValue.defined(rectangle)) {
176
+ if (isGeographic) {
177
+ geographicWest = toRadians(nativeRectangle.west);
178
+ geographicSouth = toRadians(nativeRectangle.south);
179
+ geographicEast = toRadians(nativeRectangle.east);
180
+ geographicNorth = toRadians(nativeRectangle.north);
181
+ } else {
182
+ geographicWest = nativeRectangle.west * oneOverGlobeSemimajorAxis;
183
+ geographicSouth =
184
+ piOverTwo -
185
+ 2.0 * atan(exp(-nativeRectangle.south * oneOverGlobeSemimajorAxis));
186
+ geographicEast = nativeRectangle.east * oneOverGlobeSemimajorAxis;
187
+ geographicNorth =
188
+ piOverTwo -
189
+ 2.0 * atan(exp(-nativeRectangle.north * oneOverGlobeSemimajorAxis));
190
+ }
191
+ } else {
192
+ geographicWest = rectangle.west;
193
+ geographicSouth = rectangle.south;
194
+ geographicEast = rectangle.east;
195
+ geographicNorth = rectangle.north;
196
+ }
197
+
198
+ let relativeToCenter = options.relativeToCenter;
199
+ const hasRelativeToCenter = defaultValue.defined(relativeToCenter);
200
+ relativeToCenter = hasRelativeToCenter ? relativeToCenter : Matrix3.Cartesian3.ZERO;
201
+ const includeWebMercatorT = defaultValue.defaultValue(options.includeWebMercatorT, false);
202
+
203
+ const exaggeration = defaultValue.defaultValue(options.exaggeration, 1.0);
204
+ const exaggerationRelativeHeight = defaultValue.defaultValue(
205
+ options.exaggerationRelativeHeight,
206
+ 0.0
207
+ );
208
+ const hasExaggeration = exaggeration !== 1.0;
209
+ const includeGeodeticSurfaceNormals = hasExaggeration;
210
+
211
+ const structure = defaultValue.defaultValue(
212
+ options.structure,
213
+ HeightmapTessellator.DEFAULT_STRUCTURE
214
+ );
215
+ const heightScale = defaultValue.defaultValue(
216
+ structure.heightScale,
217
+ HeightmapTessellator.DEFAULT_STRUCTURE.heightScale
218
+ );
219
+ const heightOffset = defaultValue.defaultValue(
220
+ structure.heightOffset,
221
+ HeightmapTessellator.DEFAULT_STRUCTURE.heightOffset
222
+ );
223
+ const elementsPerHeight = defaultValue.defaultValue(
224
+ structure.elementsPerHeight,
225
+ HeightmapTessellator.DEFAULT_STRUCTURE.elementsPerHeight
226
+ );
227
+ const stride = defaultValue.defaultValue(
228
+ structure.stride,
229
+ HeightmapTessellator.DEFAULT_STRUCTURE.stride
230
+ );
231
+ const elementMultiplier = defaultValue.defaultValue(
232
+ structure.elementMultiplier,
233
+ HeightmapTessellator.DEFAULT_STRUCTURE.elementMultiplier
234
+ );
235
+ const isBigEndian = defaultValue.defaultValue(
236
+ structure.isBigEndian,
237
+ HeightmapTessellator.DEFAULT_STRUCTURE.isBigEndian
238
+ );
239
+
240
+ let rectangleWidth = Matrix2.Rectangle.computeWidth(nativeRectangle);
241
+ let rectangleHeight = Matrix2.Rectangle.computeHeight(nativeRectangle);
242
+
243
+ const granularityX = rectangleWidth / (width - 1);
244
+ const granularityY = rectangleHeight / (height - 1);
245
+
246
+ if (!isGeographic) {
247
+ rectangleWidth *= oneOverGlobeSemimajorAxis;
248
+ rectangleHeight *= oneOverGlobeSemimajorAxis;
249
+ }
250
+
251
+ const radiiSquared = ellipsoid.radiiSquared;
252
+ const radiiSquaredX = radiiSquared.x;
253
+ const radiiSquaredY = radiiSquared.y;
254
+ const radiiSquaredZ = radiiSquared.z;
255
+
256
+ let minimumHeight = 65536.0;
257
+ let maximumHeight = -65536.0;
258
+
259
+ const fromENU = Transforms.Transforms.eastNorthUpToFixedFrame(
260
+ relativeToCenter,
261
+ ellipsoid
262
+ );
263
+ const toENU = Matrix2.Matrix4.inverseTransformation(fromENU, matrix4Scratch);
264
+
265
+ let southMercatorY;
266
+ let oneOverMercatorHeight;
267
+ if (includeWebMercatorT) {
268
+ southMercatorY = WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(
269
+ geographicSouth
270
+ );
271
+ oneOverMercatorHeight =
272
+ 1.0 /
273
+ (WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(geographicNorth) -
274
+ southMercatorY);
275
+ }
276
+
277
+ const minimum = minimumScratch;
278
+ minimum.x = Number.POSITIVE_INFINITY;
279
+ minimum.y = Number.POSITIVE_INFINITY;
280
+ minimum.z = Number.POSITIVE_INFINITY;
281
+
282
+ const maximum = maximumScratch;
283
+ maximum.x = Number.NEGATIVE_INFINITY;
284
+ maximum.y = Number.NEGATIVE_INFINITY;
285
+ maximum.z = Number.NEGATIVE_INFINITY;
286
+
287
+ let hMin = Number.POSITIVE_INFINITY;
288
+
289
+ const gridVertexCount = width * height;
290
+ const edgeVertexCount = skirtHeight > 0.0 ? width * 2 + height * 2 : 0;
291
+ const vertexCount = gridVertexCount + edgeVertexCount;
292
+
293
+ const positions = new Array(vertexCount);
294
+ const heights = new Array(vertexCount);
295
+ const uvs = new Array(vertexCount);
296
+ const webMercatorTs = includeWebMercatorT ? new Array(vertexCount) : [];
297
+ const geodeticSurfaceNormals = includeGeodeticSurfaceNormals
298
+ ? new Array(vertexCount)
299
+ : [];
300
+
301
+ let startRow = 0;
302
+ let endRow = height;
303
+ let startCol = 0;
304
+ let endCol = width;
305
+
306
+ if (hasSkirts) {
307
+ --startRow;
308
+ ++endRow;
309
+ --startCol;
310
+ ++endCol;
311
+ }
312
+
313
+ const skirtOffsetPercentage = 0.00001;
314
+
315
+ for (let rowIndex = startRow; rowIndex < endRow; ++rowIndex) {
316
+ let row = rowIndex;
317
+ if (row < 0) {
318
+ row = 0;
319
+ }
320
+ if (row >= height) {
321
+ row = height - 1;
322
+ }
323
+
324
+ let latitude = nativeRectangle.north - granularityY * row;
325
+
326
+ if (!isGeographic) {
327
+ latitude =
328
+ piOverTwo - 2.0 * atan(exp(-latitude * oneOverGlobeSemimajorAxis));
329
+ } else {
330
+ latitude = toRadians(latitude);
331
+ }
332
+
333
+ let v = (latitude - geographicSouth) / (geographicNorth - geographicSouth);
334
+ v = Math$1.CesiumMath.clamp(v, 0.0, 1.0);
335
+
336
+ const isNorthEdge = rowIndex === startRow;
337
+ const isSouthEdge = rowIndex === endRow - 1;
338
+ if (skirtHeight > 0.0) {
339
+ if (isNorthEdge) {
340
+ latitude += skirtOffsetPercentage * rectangleHeight;
341
+ } else if (isSouthEdge) {
342
+ latitude -= skirtOffsetPercentage * rectangleHeight;
343
+ }
344
+ }
345
+
346
+ const cosLatitude = cos(latitude);
347
+ const nZ = sin(latitude);
348
+ const kZ = radiiSquaredZ * nZ;
349
+
350
+ let webMercatorT;
351
+ if (includeWebMercatorT) {
352
+ webMercatorT =
353
+ (WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(latitude) -
354
+ southMercatorY) *
355
+ oneOverMercatorHeight;
356
+ }
357
+
358
+ for (let colIndex = startCol; colIndex < endCol; ++colIndex) {
359
+ let col = colIndex;
360
+ if (col < 0) {
361
+ col = 0;
362
+ }
363
+ if (col >= width) {
364
+ col = width - 1;
365
+ }
366
+
367
+ const terrainOffset = row * (width * stride) + col * stride;
368
+
369
+ let heightSample;
370
+ if (elementsPerHeight === 1) {
371
+ heightSample = heightmap[terrainOffset];
372
+ } else {
373
+ heightSample = 0;
374
+
375
+ let elementOffset;
376
+ if (isBigEndian) {
377
+ for (
378
+ elementOffset = 0;
379
+ elementOffset < elementsPerHeight;
380
+ ++elementOffset
381
+ ) {
382
+ heightSample =
383
+ heightSample * elementMultiplier +
384
+ heightmap[terrainOffset + elementOffset];
385
+ }
386
+ } else {
387
+ for (
388
+ elementOffset = elementsPerHeight - 1;
389
+ elementOffset >= 0;
390
+ --elementOffset
391
+ ) {
392
+ heightSample =
393
+ heightSample * elementMultiplier +
394
+ heightmap[terrainOffset + elementOffset];
395
+ }
396
+ }
397
+ }
398
+
399
+ heightSample = heightSample * heightScale + heightOffset;
400
+
401
+ maximumHeight = Math.max(maximumHeight, heightSample);
402
+ minimumHeight = Math.min(minimumHeight, heightSample);
403
+
404
+ let longitude = nativeRectangle.west + granularityX * col;
405
+
406
+ if (!isGeographic) {
407
+ longitude = longitude * oneOverGlobeSemimajorAxis;
408
+ } else {
409
+ longitude = toRadians(longitude);
410
+ }
411
+
412
+ let u = (longitude - geographicWest) / (geographicEast - geographicWest);
413
+ u = Math$1.CesiumMath.clamp(u, 0.0, 1.0);
414
+
415
+ let index = row * width + col;
416
+
417
+ if (skirtHeight > 0.0) {
418
+ const isWestEdge = colIndex === startCol;
419
+ const isEastEdge = colIndex === endCol - 1;
420
+ const isEdge = isNorthEdge || isSouthEdge || isWestEdge || isEastEdge;
421
+ const isCorner =
422
+ (isNorthEdge || isSouthEdge) && (isWestEdge || isEastEdge);
423
+ if (isCorner) {
424
+ // Don't generate skirts on the corners.
425
+ continue;
426
+ } else if (isEdge) {
427
+ heightSample -= skirtHeight;
428
+
429
+ if (isWestEdge) {
430
+ // The outer loop iterates north to south but the indices are ordered south to north, hence the index flip below
431
+ index = gridVertexCount + (height - row - 1);
432
+ longitude -= skirtOffsetPercentage * rectangleWidth;
433
+ } else if (isSouthEdge) {
434
+ // Add after west indices. South indices are ordered east to west.
435
+ index = gridVertexCount + height + (width - col - 1);
436
+ } else if (isEastEdge) {
437
+ // Add after west and south indices. East indices are ordered north to south. The index is flipped like above.
438
+ index = gridVertexCount + height + width + row;
439
+ longitude += skirtOffsetPercentage * rectangleWidth;
440
+ } else if (isNorthEdge) {
441
+ // Add after west, south, and east indices. North indices are ordered west to east.
442
+ index = gridVertexCount + height + width + height + col;
443
+ }
444
+ }
445
+ }
446
+
447
+ const nX = cosLatitude * cos(longitude);
448
+ const nY = cosLatitude * sin(longitude);
449
+
450
+ const kX = radiiSquaredX * nX;
451
+ const kY = radiiSquaredY * nY;
452
+
453
+ const gamma = sqrt(kX * nX + kY * nY + kZ * nZ);
454
+ const oneOverGamma = 1.0 / gamma;
455
+
456
+ const rSurfaceX = kX * oneOverGamma;
457
+ const rSurfaceY = kY * oneOverGamma;
458
+ const rSurfaceZ = kZ * oneOverGamma;
459
+
460
+ const position = new Matrix3.Cartesian3();
461
+ position.x = rSurfaceX + nX * heightSample;
462
+ position.y = rSurfaceY + nY * heightSample;
463
+ position.z = rSurfaceZ + nZ * heightSample;
464
+
465
+ Matrix2.Matrix4.multiplyByPoint(toENU, position, cartesian3Scratch);
466
+ Matrix3.Cartesian3.minimumByComponent(cartesian3Scratch, minimum, minimum);
467
+ Matrix3.Cartesian3.maximumByComponent(cartesian3Scratch, maximum, maximum);
468
+ hMin = Math.min(hMin, heightSample);
469
+
470
+ positions[index] = position;
471
+ uvs[index] = new Matrix2.Cartesian2(u, v);
472
+ heights[index] = heightSample;
473
+
474
+ if (includeWebMercatorT) {
475
+ webMercatorTs[index] = webMercatorT;
476
+ }
477
+
478
+ if (includeGeodeticSurfaceNormals) {
479
+ geodeticSurfaceNormals[index] = ellipsoid.geodeticSurfaceNormal(
480
+ position
481
+ );
482
+ }
483
+ }
484
+ }
485
+
486
+ const boundingSphere3D = Transforms.BoundingSphere.fromPoints(positions);
487
+ let orientedBoundingBox;
488
+ if (defaultValue.defined(rectangle)) {
489
+ orientedBoundingBox = OrientedBoundingBox.OrientedBoundingBox.fromRectangle(
490
+ rectangle,
491
+ minimumHeight,
492
+ maximumHeight,
493
+ ellipsoid
494
+ );
495
+ }
496
+
497
+ let occludeePointInScaledSpace;
498
+ if (hasRelativeToCenter) {
499
+ const occluder = new TerrainEncoding.EllipsoidalOccluder(ellipsoid);
500
+ occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
501
+ relativeToCenter,
502
+ positions,
503
+ minimumHeight
504
+ );
505
+ }
506
+
507
+ const aaBox = new AxisAlignedBoundingBox.AxisAlignedBoundingBox(minimum, maximum, relativeToCenter);
508
+ const encoding = new TerrainEncoding.TerrainEncoding(
509
+ relativeToCenter,
510
+ aaBox,
511
+ hMin,
512
+ maximumHeight,
513
+ fromENU,
514
+ false,
515
+ includeWebMercatorT,
516
+ includeGeodeticSurfaceNormals,
517
+ exaggeration,
518
+ exaggerationRelativeHeight
519
+ );
520
+ const vertices = new Float32Array(vertexCount * encoding.stride);
521
+
522
+ let bufferIndex = 0;
523
+ for (let j = 0; j < vertexCount; ++j) {
524
+ bufferIndex = encoding.encode(
525
+ vertices,
526
+ bufferIndex,
527
+ positions[j],
528
+ uvs[j],
529
+ heights[j],
530
+ undefined,
531
+ webMercatorTs[j],
532
+ geodeticSurfaceNormals[j]
533
+ );
534
+ }
535
+
536
+ return {
537
+ vertices: vertices,
538
+ maximumHeight: maximumHeight,
539
+ minimumHeight: minimumHeight,
540
+ encoding: encoding,
541
+ boundingSphere3D: boundingSphere3D,
542
+ orientedBoundingBox: orientedBoundingBox,
543
+ occludeePointInScaledSpace: occludeePointInScaledSpace,
544
+ };
545
+ };
546
+ var HeightmapTessellator$1 = HeightmapTessellator;
547
+
548
+ var LercDecodeExports = {};
549
+ var LercDecode = {
550
+ get exports(){ return LercDecodeExports; },
551
+ set exports(v){ LercDecodeExports = v; },
552
+ };
553
+
554
+ /* jshint forin: false, bitwise: false */
555
+
556
+ (function (module) {
557
+ /*
558
+ Copyright 2015-2018 Esri
559
+
560
+ Licensed under the Apache License, Version 2.0 (the "License");
561
+ you may not use this file except in compliance with the License.
562
+ You may obtain a copy of the License at
563
+
564
+ http://www.apache.org/licenses/LICENSE-2.0
565
+
566
+ Unless required by applicable law or agreed to in writing, software
567
+ distributed under the License is distributed on an "AS IS" BASIS,
568
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
569
+ See the License for the specific language governing permissions and
570
+ limitations under the License.
571
+
572
+ A copy of the license and additional notices are located with the
573
+ source distribution at:
574
+
575
+ http://github.com/Esri/lerc/
576
+
577
+ Contributors: Johannes Schmid, (LERC v1)
578
+ Chayanika Khatua, (LERC v1)
579
+ Wenxue Ju (LERC v1, v2.x)
580
+ */
581
+
582
+ /* Copyright 2015-2018 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
583
+
584
+ /**
585
+ * a module for decoding LERC blobs
586
+ * @module Lerc
587
+ */
588
+ (function() {
589
+ //the original LercDecode for Version 1
590
+ var LercDecode = (function() {
591
+
592
+ // WARNING: This decoder version can only read old version 1 Lerc blobs. Use with caution.
593
+
594
+ // Note: currently, this module only has an implementation for decoding LERC data, not encoding. The name of
595
+ // the class was chosen to be future proof.
596
+
597
+ var CntZImage = {};
598
+
599
+ CntZImage.defaultNoDataValue = -3.4027999387901484e+38; // smallest Float32 value
600
+
601
+ /**
602
+ * Decode a LERC byte stream and return an object containing the pixel data and some required and optional
603
+ * information about it, such as the image's width and height.
604
+ *
605
+ * @param {ArrayBuffer} input The LERC input byte stream
606
+ * @param {object} [options] Decoding options, containing any of the following properties:
607
+ * @config {number} [inputOffset = 0]
608
+ * Skip the first inputOffset bytes of the input byte stream. A valid LERC file is expected at that position.
609
+ * @config {Uint8Array} [encodedMask = null]
610
+ * If specified, the decoder will not read mask information from the input and use the specified encoded
611
+ * mask data instead. Mask header/data must not be present in the LERC byte stream in this case.
612
+ * @config {number} [noDataValue = LercCode.defaultNoDataValue]
613
+ * Pixel value to use for masked pixels.
614
+ * @config {ArrayBufferView|Array} [pixelType = Float32Array]
615
+ * The desired type of the pixelData array in the return value. Note that it is the caller's responsibility to
616
+ * provide an appropriate noDataValue if the default pixelType is overridden.
617
+ * @config {boolean} [returnMask = false]
618
+ * If true, the return value will contain a maskData property of type Uint8Array which has one element per
619
+ * pixel, the value of which is 1 or 0 depending on whether that pixel's data is present or masked. If the
620
+ * input LERC data does not contain a mask, maskData will not be returned.
621
+ * @config {boolean} [returnEncodedMask = false]
622
+ * If true, the return value will contain a encodedMaskData property, which can be passed into encode() as
623
+ * encodedMask.
624
+ * @config {boolean} [returnFileInfo = false]
625
+ * If true, the return value will have a fileInfo property that contains metadata obtained from the
626
+ * LERC headers and the decoding process.
627
+ * @config {boolean} [computeUsedBitDepths = false]
628
+ * If true, the fileInfo property in the return value will contain the set of all block bit depths
629
+ * encountered during decoding. Will only have an effect if returnFileInfo option is true.
630
+ * @returns {{width, height, pixelData, minValue, maxValue, noDataValue, maskData, encodedMaskData, fileInfo}}
631
+ */
632
+ CntZImage.decode = function(input, options) {
633
+ options = options || {};
634
+
635
+ var skipMask = options.encodedMaskData || (options.encodedMaskData === null);
636
+ var parsedData = parse(input, options.inputOffset || 0, skipMask);
637
+
638
+ var noDataValue = (options.noDataValue !== null) ? options.noDataValue : CntZImage.defaultNoDataValue;
639
+
640
+ var uncompressedData = uncompressPixelValues(parsedData, options.pixelType || Float32Array,
641
+ options.encodedMaskData, noDataValue, options.returnMask);
642
+
643
+ var result = {
644
+ width: parsedData.width,
645
+ height: parsedData.height,
646
+ pixelData: uncompressedData.resultPixels,
647
+ minValue: uncompressedData.minValue,
648
+ maxValue: parsedData.pixels.maxValue,
649
+ noDataValue: noDataValue
650
+ };
651
+
652
+ if (uncompressedData.resultMask) {
653
+ result.maskData = uncompressedData.resultMask;
654
+ }
655
+
656
+ if (options.returnEncodedMask && parsedData.mask) {
657
+ result.encodedMaskData = parsedData.mask.bitset ? parsedData.mask.bitset : null;
658
+ }
659
+
660
+ if (options.returnFileInfo) {
661
+ result.fileInfo = formatFileInfo(parsedData);
662
+ if (options.computeUsedBitDepths) {
663
+ result.fileInfo.bitDepths = computeUsedBitDepths(parsedData);
664
+ }
665
+ }
666
+
667
+ return result;
668
+ };
669
+
670
+ var uncompressPixelValues = function(data, TypedArrayClass, maskBitset, noDataValue, storeDecodedMask) {
671
+ var blockIdx = 0;
672
+ var numX = data.pixels.numBlocksX;
673
+ var numY = data.pixels.numBlocksY;
674
+ var blockWidth = Math.floor(data.width / numX);
675
+ var blockHeight = Math.floor(data.height / numY);
676
+ var scale = 2 * data.maxZError;
677
+ var minValue = Number.MAX_VALUE, currentValue;
678
+ maskBitset = maskBitset || ((data.mask) ? data.mask.bitset : null);
679
+
680
+ var resultPixels, resultMask;
681
+ resultPixels = new TypedArrayClass(data.width * data.height);
682
+ if (storeDecodedMask && maskBitset) {
683
+ resultMask = new Uint8Array(data.width * data.height);
684
+ }
685
+ var blockDataBuffer = new Float32Array(blockWidth * blockHeight);
686
+
687
+ var xx, yy;
688
+ for (var y = 0; y <= numY; y++) {
689
+ var thisBlockHeight = (y !== numY) ? blockHeight : (data.height % numY);
690
+ if (thisBlockHeight === 0) {
691
+ continue;
692
+ }
693
+ for (var x = 0; x <= numX; x++) {
694
+ var thisBlockWidth = (x !== numX) ? blockWidth : (data.width % numX);
695
+ if (thisBlockWidth === 0) {
696
+ continue;
697
+ }
698
+
699
+ var outPtr = y * data.width * blockHeight + x * blockWidth;
700
+ var outStride = data.width - thisBlockWidth;
701
+
702
+ var block = data.pixels.blocks[blockIdx];
703
+
704
+ var blockData, blockPtr, constValue;
705
+ if (block.encoding < 2) {
706
+ // block is either uncompressed or bit-stuffed (encodings 0 and 1)
707
+ if (block.encoding === 0) {
708
+ // block is uncompressed
709
+ blockData = block.rawData;
710
+ } else {
711
+ // block is bit-stuffed
712
+ unstuff(block.stuffedData, block.bitsPerPixel, block.numValidPixels, block.offset, scale, blockDataBuffer, data.pixels.maxValue);
713
+ blockData = blockDataBuffer;
714
+ }
715
+ blockPtr = 0;
716
+ }
717
+ else if (block.encoding === 2) {
718
+ // block is all 0
719
+ constValue = 0;
720
+ }
721
+ else {
722
+ // block has constant value (encoding === 3)
723
+ constValue = block.offset;
724
+ }
725
+
726
+ var maskByte;
727
+ if (maskBitset) {
728
+ for (yy = 0; yy < thisBlockHeight; yy++) {
729
+ if (outPtr & 7) {
730
+ //
731
+ maskByte = maskBitset[outPtr >> 3];
732
+ maskByte <<= outPtr & 7;
733
+ }
734
+ for (xx = 0; xx < thisBlockWidth; xx++) {
735
+ if (!(outPtr & 7)) {
736
+ // read next byte from mask
737
+ maskByte = maskBitset[outPtr >> 3];
738
+ }
739
+ if (maskByte & 128) {
740
+ // pixel data present
741
+ if (resultMask) {
742
+ resultMask[outPtr] = 1;
743
+ }
744
+ currentValue = (block.encoding < 2) ? blockData[blockPtr++] : constValue;
745
+ minValue = minValue > currentValue ? currentValue : minValue;
746
+ resultPixels[outPtr++] = currentValue;
747
+ } else {
748
+ // pixel data not present
749
+ if (resultMask) {
750
+ resultMask[outPtr] = 0;
751
+ }
752
+ resultPixels[outPtr++] = noDataValue;
753
+ }
754
+ maskByte <<= 1;
755
+ }
756
+ outPtr += outStride;
757
+ }
758
+ } else {
759
+ // mask not present, simply copy block over
760
+ if (block.encoding < 2) {
761
+ // duplicating this code block for performance reasons
762
+ // blockData case:
763
+ for (yy = 0; yy < thisBlockHeight; yy++) {
764
+ for (xx = 0; xx < thisBlockWidth; xx++) {
765
+ currentValue = blockData[blockPtr++];
766
+ minValue = minValue > currentValue ? currentValue : minValue;
767
+ resultPixels[outPtr++] = currentValue;
768
+ }
769
+ outPtr += outStride;
770
+ }
771
+ }
772
+ else {
773
+ // constValue case:
774
+ minValue = minValue > constValue ? constValue : minValue;
775
+ for (yy = 0; yy < thisBlockHeight; yy++) {
776
+ for (xx = 0; xx < thisBlockWidth; xx++) {
777
+ resultPixels[outPtr++] = constValue;
778
+ }
779
+ outPtr += outStride;
780
+ }
781
+ }
782
+ }
783
+ if ((block.encoding === 1) && (blockPtr !== block.numValidPixels)) {
784
+ throw "Block and Mask do not match";
785
+ }
786
+ blockIdx++;
787
+ }
788
+ }
789
+
790
+ return {
791
+ resultPixels: resultPixels,
792
+ resultMask: resultMask,
793
+ minValue: minValue
794
+ };
795
+ };
796
+
797
+ var formatFileInfo = function(data) {
798
+ return {
799
+ "fileIdentifierString": data.fileIdentifierString,
800
+ "fileVersion": data.fileVersion,
801
+ "imageType": data.imageType,
802
+ "height": data.height,
803
+ "width": data.width,
804
+ "maxZError": data.maxZError,
805
+ "eofOffset": data.eofOffset,
806
+ "mask": data.mask ? {
807
+ "numBlocksX": data.mask.numBlocksX,
808
+ "numBlocksY": data.mask.numBlocksY,
809
+ "numBytes": data.mask.numBytes,
810
+ "maxValue": data.mask.maxValue
811
+ } : null,
812
+ "pixels": {
813
+ "numBlocksX": data.pixels.numBlocksX,
814
+ "numBlocksY": data.pixels.numBlocksY,
815
+ "numBytes": data.pixels.numBytes,
816
+ "maxValue": data.pixels.maxValue,
817
+ "noDataValue": data.noDataValue
818
+ }
819
+ };
820
+ };
821
+
822
+ var computeUsedBitDepths = function(data) {
823
+ var numBlocks = data.pixels.numBlocksX * data.pixels.numBlocksY;
824
+ var bitDepths = {};
825
+ for (var i = 0; i < numBlocks; i++) {
826
+ var block = data.pixels.blocks[i];
827
+ if (block.encoding === 0) {
828
+ bitDepths.float32 = true;
829
+ } else if (block.encoding === 1) {
830
+ bitDepths[block.bitsPerPixel] = true;
831
+ } else {
832
+ bitDepths[0] = true;
833
+ }
834
+ }
835
+
836
+ return Object.keys(bitDepths);
837
+ };
838
+
839
+ var parse = function(input, fp, skipMask) {
840
+ var data = {};
841
+
842
+ // File header
843
+ var fileIdView = new Uint8Array(input, fp, 10);
844
+ data.fileIdentifierString = String.fromCharCode.apply(null, fileIdView);
845
+ if (data.fileIdentifierString.trim() !== "CntZImage") {
846
+ throw "Unexpected file identifier string: " + data.fileIdentifierString;
847
+ }
848
+ fp += 10;
849
+ var view = new DataView(input, fp, 24);
850
+ data.fileVersion = view.getInt32(0, true);
851
+ data.imageType = view.getInt32(4, true);
852
+ data.height = view.getUint32(8, true);
853
+ data.width = view.getUint32(12, true);
854
+ data.maxZError = view.getFloat64(16, true);
855
+ fp += 24;
856
+
857
+ // Mask Header
858
+ if (!skipMask) {
859
+ view = new DataView(input, fp, 16);
860
+ data.mask = {};
861
+ data.mask.numBlocksY = view.getUint32(0, true);
862
+ data.mask.numBlocksX = view.getUint32(4, true);
863
+ data.mask.numBytes = view.getUint32(8, true);
864
+ data.mask.maxValue = view.getFloat32(12, true);
865
+ fp += 16;
866
+
867
+ // Mask Data
868
+ if (data.mask.numBytes > 0) {
869
+ var bitset = new Uint8Array(Math.ceil(data.width * data.height / 8));
870
+ view = new DataView(input, fp, data.mask.numBytes);
871
+ var cnt = view.getInt16(0, true);
872
+ var ip = 2, op = 0;
873
+ do {
874
+ if (cnt > 0) {
875
+ while (cnt--) { bitset[op++] = view.getUint8(ip++); }
876
+ } else {
877
+ var val = view.getUint8(ip++);
878
+ cnt = -cnt;
879
+ while (cnt--) { bitset[op++] = val; }
880
+ }
881
+ cnt = view.getInt16(ip, true);
882
+ ip += 2;
883
+ } while (ip < data.mask.numBytes);
884
+ if ((cnt !== -32768) || (op < bitset.length)) {
885
+ throw "Unexpected end of mask RLE encoding";
886
+ }
887
+ data.mask.bitset = bitset;
888
+ fp += data.mask.numBytes;
889
+ }
890
+ else if ((data.mask.numBytes | data.mask.numBlocksY | data.mask.maxValue) === 0) { // Special case, all nodata
891
+ data.mask.bitset = new Uint8Array(Math.ceil(data.width * data.height / 8));
892
+ }
893
+ }
894
+
895
+ // Pixel Header
896
+ view = new DataView(input, fp, 16);
897
+ data.pixels = {};
898
+ data.pixels.numBlocksY = view.getUint32(0, true);
899
+ data.pixels.numBlocksX = view.getUint32(4, true);
900
+ data.pixels.numBytes = view.getUint32(8, true);
901
+ data.pixels.maxValue = view.getFloat32(12, true);
902
+ fp += 16;
903
+
904
+ var numBlocksX = data.pixels.numBlocksX;
905
+ var numBlocksY = data.pixels.numBlocksY;
906
+ // the number of blocks specified in the header does not take into account the blocks at the end of
907
+ // each row/column with a special width/height that make the image complete in case the width is not
908
+ // evenly divisible by the number of blocks.
909
+ var actualNumBlocksX = numBlocksX + ((data.width % numBlocksX) > 0 ? 1 : 0);
910
+ var actualNumBlocksY = numBlocksY + ((data.height % numBlocksY) > 0 ? 1 : 0);
911
+ data.pixels.blocks = new Array(actualNumBlocksX * actualNumBlocksY);
912
+ var blockI = 0;
913
+ for (var blockY = 0; blockY < actualNumBlocksY; blockY++) {
914
+ for (var blockX = 0; blockX < actualNumBlocksX; blockX++) {
915
+
916
+ // Block
917
+ var size = 0;
918
+ var bytesLeft = input.byteLength - fp;
919
+ view = new DataView(input, fp, Math.min(10, bytesLeft));
920
+ var block = {};
921
+ data.pixels.blocks[blockI++] = block;
922
+ var headerByte = view.getUint8(0); size++;
923
+ block.encoding = headerByte & 63;
924
+ if (block.encoding > 3) {
925
+ throw "Invalid block encoding (" + block.encoding + ")";
926
+ }
927
+ if (block.encoding === 2) {
928
+ fp++;
929
+ continue;
930
+ }
931
+ if ((headerByte !== 0) && (headerByte !== 2)) {
932
+ headerByte >>= 6;
933
+ block.offsetType = headerByte;
934
+ if (headerByte === 2) {
935
+ block.offset = view.getInt8(1); size++;
936
+ } else if (headerByte === 1) {
937
+ block.offset = view.getInt16(1, true); size += 2;
938
+ } else if (headerByte === 0) {
939
+ block.offset = view.getFloat32(1, true); size += 4;
940
+ } else {
941
+ throw "Invalid block offset type";
942
+ }
943
+
944
+ if (block.encoding === 1) {
945
+ headerByte = view.getUint8(size); size++;
946
+ block.bitsPerPixel = headerByte & 63;
947
+ headerByte >>= 6;
948
+ block.numValidPixelsType = headerByte;
949
+ if (headerByte === 2) {
950
+ block.numValidPixels = view.getUint8(size); size++;
951
+ } else if (headerByte === 1) {
952
+ block.numValidPixels = view.getUint16(size, true); size += 2;
953
+ } else if (headerByte === 0) {
954
+ block.numValidPixels = view.getUint32(size, true); size += 4;
955
+ } else {
956
+ throw "Invalid valid pixel count type";
957
+ }
958
+ }
959
+ }
960
+ fp += size;
961
+
962
+ if (block.encoding === 3) {
963
+ continue;
964
+ }
965
+
966
+ var arrayBuf, store8;
967
+ if (block.encoding === 0) {
968
+ var numPixels = (data.pixels.numBytes - 1) / 4;
969
+ if (numPixels !== Math.floor(numPixels)) {
970
+ throw "uncompressed block has invalid length";
971
+ }
972
+ arrayBuf = new ArrayBuffer(numPixels * 4);
973
+ store8 = new Uint8Array(arrayBuf);
974
+ store8.set(new Uint8Array(input, fp, numPixels * 4));
975
+ var rawData = new Float32Array(arrayBuf);
976
+ block.rawData = rawData;
977
+ fp += numPixels * 4;
978
+ } else if (block.encoding === 1) {
979
+ var dataBytes = Math.ceil(block.numValidPixels * block.bitsPerPixel / 8);
980
+ var dataWords = Math.ceil(dataBytes / 4);
981
+ arrayBuf = new ArrayBuffer(dataWords * 4);
982
+ store8 = new Uint8Array(arrayBuf);
983
+ store8.set(new Uint8Array(input, fp, dataBytes));
984
+ block.stuffedData = new Uint32Array(arrayBuf);
985
+ fp += dataBytes;
986
+ }
987
+ }
988
+ }
989
+ data.eofOffset = fp;
990
+ return data;
991
+ };
992
+
993
+ var unstuff = function(src, bitsPerPixel, numPixels, offset, scale, dest, maxValue) {
994
+ var bitMask = (1 << bitsPerPixel) - 1;
995
+ var i = 0, o;
996
+ var bitsLeft = 0;
997
+ var n, buffer;
998
+ var nmax = Math.ceil((maxValue - offset) / scale);
999
+ // get rid of trailing bytes that are already part of next block
1000
+ var numInvalidTailBytes = src.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
1001
+ src[src.length - 1] <<= 8 * numInvalidTailBytes;
1002
+
1003
+ for (o = 0; o < numPixels; o++) {
1004
+ if (bitsLeft === 0) {
1005
+ buffer = src[i++];
1006
+ bitsLeft = 32;
1007
+ }
1008
+ if (bitsLeft >= bitsPerPixel) {
1009
+ n = (buffer >>> (bitsLeft - bitsPerPixel)) & bitMask;
1010
+ bitsLeft -= bitsPerPixel;
1011
+ } else {
1012
+ var missingBits = (bitsPerPixel - bitsLeft);
1013
+ n = ((buffer & bitMask) << missingBits) & bitMask;
1014
+ buffer = src[i++];
1015
+ bitsLeft = 32 - missingBits;
1016
+ n += (buffer >>> bitsLeft);
1017
+ }
1018
+ //pixel values may exceed max due to quantization
1019
+ dest[o] = n < nmax ? offset + n * scale : maxValue;
1020
+ }
1021
+ return dest;
1022
+ };
1023
+
1024
+ return CntZImage;
1025
+ })();
1026
+
1027
+ //version 2. Supports 2.1, 2.2, 2.3
1028
+ var Lerc2Decode = (function() {
1029
+ // Note: currently, this module only has an implementation for decoding LERC data, not encoding. The name of
1030
+ // the class was chosen to be future proof, following LercDecode.
1031
+
1032
+ /*****************************************
1033
+ * private static class bitsutffer used by Lerc2Decode
1034
+ *******************************************/
1035
+ var BitStuffer = {
1036
+ //methods ending with 2 are for the new byte order used by Lerc2.3 and above.
1037
+ //originalUnstuff is used to unpack Huffman code table. code is duplicated to unstuffx for performance reasons.
1038
+ unstuff: function(src, dest, bitsPerPixel, numPixels, lutArr, offset, scale, maxValue) {
1039
+ var bitMask = (1 << bitsPerPixel) - 1;
1040
+ var i = 0, o;
1041
+ var bitsLeft = 0;
1042
+ var n, buffer, missingBits, nmax;
1043
+
1044
+ // get rid of trailing bytes that are already part of next block
1045
+ var numInvalidTailBytes = src.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
1046
+ src[src.length - 1] <<= 8 * numInvalidTailBytes;
1047
+ if (lutArr) {
1048
+ for (o = 0; o < numPixels; o++) {
1049
+ if (bitsLeft === 0) {
1050
+ buffer = src[i++];
1051
+ bitsLeft = 32;
1052
+ }
1053
+ if (bitsLeft >= bitsPerPixel) {
1054
+ n = (buffer >>> (bitsLeft - bitsPerPixel)) & bitMask;
1055
+ bitsLeft -= bitsPerPixel;
1056
+ }
1057
+ else {
1058
+ missingBits = (bitsPerPixel - bitsLeft);
1059
+ n = ((buffer & bitMask) << missingBits) & bitMask;
1060
+ buffer = src[i++];
1061
+ bitsLeft = 32 - missingBits;
1062
+ n += (buffer >>> bitsLeft);
1063
+ }
1064
+ dest[o] = lutArr[n];//offset + lutArr[n] * scale;
1065
+ }
1066
+ }
1067
+ else {
1068
+ nmax = Math.ceil((maxValue - offset) / scale);
1069
+ for (o = 0; o < numPixels; o++) {
1070
+ if (bitsLeft === 0) {
1071
+ buffer = src[i++];
1072
+ bitsLeft = 32;
1073
+ }
1074
+ if (bitsLeft >= bitsPerPixel) {
1075
+ n = (buffer >>> (bitsLeft - bitsPerPixel)) & bitMask;
1076
+ bitsLeft -= bitsPerPixel;
1077
+ }
1078
+ else {
1079
+ missingBits = (bitsPerPixel - bitsLeft);
1080
+ n = ((buffer & bitMask) << missingBits) & bitMask;
1081
+ buffer = src[i++];
1082
+ bitsLeft = 32 - missingBits;
1083
+ n += (buffer >>> bitsLeft);
1084
+ }
1085
+ //pixel values may exceed max due to quantization
1086
+ dest[o] = n < nmax ? offset + n * scale : maxValue;
1087
+ }
1088
+ }
1089
+ },
1090
+
1091
+ unstuffLUT: function(src, bitsPerPixel, numPixels, offset, scale, maxValue) {
1092
+ var bitMask = (1 << bitsPerPixel) - 1;
1093
+ var i = 0, o = 0, missingBits = 0, bitsLeft = 0, n = 0;
1094
+ var buffer;
1095
+ var dest = [];
1096
+
1097
+ // get rid of trailing bytes that are already part of next block
1098
+ var numInvalidTailBytes = src.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
1099
+ src[src.length - 1] <<= 8 * numInvalidTailBytes;
1100
+
1101
+ var nmax = Math.ceil((maxValue - offset) / scale);
1102
+ for (o = 0; o < numPixels; o++) {
1103
+ if (bitsLeft === 0) {
1104
+ buffer = src[i++];
1105
+ bitsLeft = 32;
1106
+ }
1107
+ if (bitsLeft >= bitsPerPixel) {
1108
+ n = (buffer >>> (bitsLeft - bitsPerPixel)) & bitMask;
1109
+ bitsLeft -= bitsPerPixel;
1110
+ } else {
1111
+ missingBits = (bitsPerPixel - bitsLeft);
1112
+ n = ((buffer & bitMask) << missingBits) & bitMask;
1113
+ buffer = src[i++];
1114
+ bitsLeft = 32 - missingBits;
1115
+ n += (buffer >>> bitsLeft);
1116
+ }
1117
+ //dest.push(n);
1118
+ dest[o] = n < nmax ? offset + n * scale : maxValue;
1119
+ }
1120
+ dest.unshift(offset);//1st one
1121
+ return dest;
1122
+ },
1123
+
1124
+ unstuff2: function(src, dest, bitsPerPixel, numPixels, lutArr, offset, scale, maxValue) {
1125
+ var bitMask = (1 << bitsPerPixel) - 1;
1126
+ var i = 0, o;
1127
+ var bitsLeft = 0, bitPos = 0;
1128
+ var n, buffer, missingBits;
1129
+ if (lutArr) {
1130
+ for (o = 0; o < numPixels; o++) {
1131
+ if (bitsLeft === 0) {
1132
+ buffer = src[i++];
1133
+ bitsLeft = 32;
1134
+ bitPos = 0;
1135
+ }
1136
+ if (bitsLeft >= bitsPerPixel) {
1137
+ n = ((buffer >>> bitPos) & bitMask);
1138
+ bitsLeft -= bitsPerPixel;
1139
+ bitPos += bitsPerPixel;
1140
+ } else {
1141
+ missingBits = (bitsPerPixel - bitsLeft);
1142
+ n = (buffer >>> bitPos) & bitMask;
1143
+ buffer = src[i++];
1144
+ bitsLeft = 32 - missingBits;
1145
+ n |= (buffer & ((1 << missingBits) - 1)) << (bitsPerPixel - missingBits);
1146
+ bitPos = missingBits;
1147
+ }
1148
+ dest[o] = lutArr[n];
1149
+ }
1150
+ }
1151
+ else {
1152
+ var nmax = Math.ceil((maxValue - offset) / scale);
1153
+ for (o = 0; o < numPixels; o++) {
1154
+ if (bitsLeft === 0) {
1155
+ buffer = src[i++];
1156
+ bitsLeft = 32;
1157
+ bitPos = 0;
1158
+ }
1159
+ if (bitsLeft >= bitsPerPixel) {
1160
+ //no unsigned left shift
1161
+ n = ((buffer >>> bitPos) & bitMask);
1162
+ bitsLeft -= bitsPerPixel;
1163
+ bitPos += bitsPerPixel;
1164
+ } else {
1165
+ missingBits = (bitsPerPixel - bitsLeft);
1166
+ n = (buffer >>> bitPos) & bitMask;//((buffer & bitMask) << missingBits) & bitMask;
1167
+ buffer = src[i++];
1168
+ bitsLeft = 32 - missingBits;
1169
+ n |= (buffer & ((1 << missingBits) - 1)) << (bitsPerPixel - missingBits);
1170
+ bitPos = missingBits;
1171
+ }
1172
+ //pixel values may exceed max due to quantization
1173
+ dest[o] = n < nmax ? offset + n * scale : maxValue;
1174
+ }
1175
+ }
1176
+ return dest;
1177
+ },
1178
+
1179
+ unstuffLUT2: function(src, bitsPerPixel, numPixels, offset, scale, maxValue) {
1180
+ var bitMask = (1 << bitsPerPixel) - 1;
1181
+ var i = 0, o = 0, missingBits = 0, bitsLeft = 0, n = 0, bitPos = 0;
1182
+ var buffer;
1183
+ var dest = [];
1184
+ var nmax = Math.ceil((maxValue - offset) / scale);
1185
+ for (o = 0; o < numPixels; o++) {
1186
+ if (bitsLeft === 0) {
1187
+ buffer = src[i++];
1188
+ bitsLeft = 32;
1189
+ bitPos = 0;
1190
+ }
1191
+ if (bitsLeft >= bitsPerPixel) {
1192
+ //no unsigned left shift
1193
+ n = ((buffer >>> bitPos) & bitMask);
1194
+ bitsLeft -= bitsPerPixel;
1195
+ bitPos += bitsPerPixel;
1196
+ } else {
1197
+ missingBits = (bitsPerPixel - bitsLeft);
1198
+ n = (buffer >>> bitPos) & bitMask;//((buffer & bitMask) << missingBits) & bitMask;
1199
+ buffer = src[i++];
1200
+ bitsLeft = 32 - missingBits;
1201
+ n |= (buffer & ((1 << missingBits) - 1)) << (bitsPerPixel - missingBits);
1202
+ bitPos = missingBits;
1203
+ }
1204
+ //dest.push(n);
1205
+ dest[o] = n < nmax ? offset + n * scale : maxValue;
1206
+ }
1207
+ dest.unshift(offset);
1208
+ return dest;
1209
+ },
1210
+
1211
+ originalUnstuff: function(src, dest, bitsPerPixel, numPixels) {
1212
+ var bitMask = (1 << bitsPerPixel) - 1;
1213
+ var i = 0, o;
1214
+ var bitsLeft = 0;
1215
+ var n, buffer, missingBits;
1216
+
1217
+ // get rid of trailing bytes that are already part of next block
1218
+ var numInvalidTailBytes = src.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
1219
+ src[src.length - 1] <<= 8 * numInvalidTailBytes;
1220
+
1221
+ for (o = 0; o < numPixels; o++) {
1222
+ if (bitsLeft === 0) {
1223
+ buffer = src[i++];
1224
+ bitsLeft = 32;
1225
+ }
1226
+ if (bitsLeft >= bitsPerPixel) {
1227
+ n = (buffer >>> (bitsLeft - bitsPerPixel)) & bitMask;
1228
+ bitsLeft -= bitsPerPixel;
1229
+ }
1230
+ else {
1231
+ missingBits = (bitsPerPixel - bitsLeft);
1232
+ n = ((buffer & bitMask) << missingBits) & bitMask;
1233
+ buffer = src[i++];
1234
+ bitsLeft = 32 - missingBits;
1235
+ n += (buffer >>> bitsLeft);
1236
+ }
1237
+ dest[o] = n;
1238
+ }
1239
+ return dest;
1240
+ },
1241
+
1242
+ originalUnstuff2: function(src, dest, bitsPerPixel, numPixels) {
1243
+ var bitMask = (1 << bitsPerPixel) - 1;
1244
+ var i = 0, o;
1245
+ var bitsLeft = 0, bitPos = 0;
1246
+ var n, buffer, missingBits;
1247
+ //micro-optimizations
1248
+ for (o = 0; o < numPixels; o++) {
1249
+ if (bitsLeft === 0) {
1250
+ buffer = src[i++];
1251
+ bitsLeft = 32;
1252
+ bitPos = 0;
1253
+ }
1254
+ if (bitsLeft >= bitsPerPixel) {
1255
+ //no unsigned left shift
1256
+ n = ((buffer >>> bitPos) & bitMask);
1257
+ bitsLeft -= bitsPerPixel;
1258
+ bitPos += bitsPerPixel;
1259
+ } else {
1260
+ missingBits = (bitsPerPixel - bitsLeft);
1261
+ n = (buffer >>> bitPos) & bitMask;//((buffer & bitMask) << missingBits) & bitMask;
1262
+ buffer = src[i++];
1263
+ bitsLeft = 32 - missingBits;
1264
+ n |= (buffer & ((1 << missingBits) - 1)) << (bitsPerPixel - missingBits);
1265
+ bitPos = missingBits;
1266
+ }
1267
+ dest[o] = n;
1268
+ }
1269
+ return dest;
1270
+ }
1271
+ };
1272
+
1273
+ /*****************************************
1274
+ *private static class used by Lerc2Decode
1275
+ ******************************************/
1276
+ var Lerc2Helpers = {
1277
+ HUFFMAN_LUT_BITS_MAX: 12, //use 2^12 lut, treat it like constant
1278
+ computeChecksumFletcher32: function(input) {
1279
+
1280
+ var sum1 = 0xffff, sum2 = 0xffff;
1281
+ var len = input.length;
1282
+ var words = Math.floor(len / 2);
1283
+ var i = 0;
1284
+ while (words) {
1285
+ var tlen = (words >= 359) ? 359 : words;
1286
+ words -= tlen;
1287
+ do {
1288
+ sum1 += (input[i++] << 8);
1289
+ sum2 += sum1 += input[i++];
1290
+ } while (--tlen);
1291
+
1292
+ sum1 = (sum1 & 0xffff) + (sum1 >>> 16);
1293
+ sum2 = (sum2 & 0xffff) + (sum2 >>> 16);
1294
+ }
1295
+
1296
+ // add the straggler byte if it exists
1297
+ if (len & 1) {
1298
+ sum2 += sum1 += (input[i] << 8);
1299
+ }
1300
+ // second reduction step to reduce sums to 16 bits
1301
+ sum1 = (sum1 & 0xffff) + (sum1 >>> 16);
1302
+ sum2 = (sum2 & 0xffff) + (sum2 >>> 16);
1303
+
1304
+ return (sum2 << 16 | sum1) >>> 0;
1305
+ },
1306
+
1307
+ readHeaderInfo: function(input, data) {
1308
+ var ptr = data.ptr;
1309
+ var fileIdView = new Uint8Array(input, ptr, 6);
1310
+ var headerInfo = {};
1311
+ headerInfo.fileIdentifierString = String.fromCharCode.apply(null, fileIdView);
1312
+ if (headerInfo.fileIdentifierString.lastIndexOf("Lerc2", 0) !== 0) {
1313
+ throw "Unexpected file identifier string (expect Lerc2 ): " + headerInfo.fileIdentifierString;
1314
+ }
1315
+ ptr += 6;
1316
+ var view = new DataView(input, ptr, 8);
1317
+ var fileVersion = view.getInt32(0, true);
1318
+ headerInfo.fileVersion = fileVersion;
1319
+ ptr += 4;
1320
+ if (fileVersion >= 3) {
1321
+ headerInfo.checksum = view.getUint32(4, true); //nrows
1322
+ ptr += 4;
1323
+ }
1324
+
1325
+ //keys start from here
1326
+ view = new DataView(input, ptr, 12);
1327
+ headerInfo.height = view.getUint32(0, true); //nrows
1328
+ headerInfo.width = view.getUint32(4, true); //ncols
1329
+ ptr += 8;
1330
+ if (fileVersion >= 4) {
1331
+ headerInfo.numDims = view.getUint32(8, true);
1332
+ ptr += 4;
1333
+ }
1334
+ else {
1335
+ headerInfo.numDims = 1;
1336
+ }
1337
+
1338
+ view = new DataView(input, ptr, 40);
1339
+ headerInfo.numValidPixel = view.getUint32(0, true);
1340
+ headerInfo.microBlockSize = view.getInt32(4, true);
1341
+ headerInfo.blobSize = view.getInt32(8, true);
1342
+ headerInfo.imageType = view.getInt32(12, true);
1343
+
1344
+ headerInfo.maxZError = view.getFloat64(16, true);
1345
+ headerInfo.zMin = view.getFloat64(24, true);
1346
+ headerInfo.zMax = view.getFloat64(32, true);
1347
+ ptr += 40;
1348
+ data.headerInfo = headerInfo;
1349
+ data.ptr = ptr;
1350
+
1351
+ var checksum, keyLength;
1352
+ if (fileVersion >= 3) {
1353
+ keyLength = fileVersion >= 4 ? 52 : 48;
1354
+ checksum = this.computeChecksumFletcher32(new Uint8Array(input, ptr - keyLength, headerInfo.blobSize - 14));
1355
+ if (checksum !== headerInfo.checksum) {
1356
+ throw "Checksum failed.";
1357
+ }
1358
+ }
1359
+ return true;
1360
+ },
1361
+
1362
+ checkMinMaxRanges: function(input, data) {
1363
+ var headerInfo = data.headerInfo;
1364
+ var OutPixelTypeArray = this.getDataTypeArray(headerInfo.imageType);
1365
+ var rangeBytes = headerInfo.numDims * this.getDataTypeSize(headerInfo.imageType);
1366
+ var minValues = this.readSubArray(input, data.ptr, OutPixelTypeArray, rangeBytes);
1367
+ var maxValues = this.readSubArray(input, data.ptr + rangeBytes, OutPixelTypeArray, rangeBytes);
1368
+ data.ptr += (2 * rangeBytes);
1369
+ var i, equal = true;
1370
+ for (i = 0; i < headerInfo.numDims; i++) {
1371
+ if (minValues[i] !== maxValues[i]) {
1372
+ equal = false;
1373
+ break;
1374
+ }
1375
+ }
1376
+ headerInfo.minValues = minValues;
1377
+ headerInfo.maxValues = maxValues;
1378
+ return equal;
1379
+ },
1380
+
1381
+ readSubArray: function(input, ptr, OutPixelTypeArray, numBytes) {
1382
+ var rawData;
1383
+ if (OutPixelTypeArray === Uint8Array) {
1384
+ rawData = new Uint8Array(input, ptr, numBytes);
1385
+ }
1386
+ else {
1387
+ var arrayBuf = new ArrayBuffer(numBytes);
1388
+ var store8 = new Uint8Array(arrayBuf);
1389
+ store8.set(new Uint8Array(input, ptr, numBytes));
1390
+ rawData = new OutPixelTypeArray(arrayBuf);
1391
+ }
1392
+ return rawData;
1393
+ },
1394
+
1395
+ readMask: function(input, data) {
1396
+ var ptr = data.ptr;
1397
+ var headerInfo = data.headerInfo;
1398
+ var numPixels = headerInfo.width * headerInfo.height;
1399
+ var numValidPixel = headerInfo.numValidPixel;
1400
+
1401
+ var view = new DataView(input, ptr, 4);
1402
+ var mask = {};
1403
+ mask.numBytes = view.getUint32(0, true);
1404
+ ptr += 4;
1405
+
1406
+ // Mask Data
1407
+ if ((0 === numValidPixel || numPixels === numValidPixel) && 0 !== mask.numBytes) {
1408
+ throw ("invalid mask");
1409
+ }
1410
+ var bitset, resultMask;
1411
+ if (numValidPixel === 0) {
1412
+ bitset = new Uint8Array(Math.ceil(numPixels / 8));
1413
+ mask.bitset = bitset;
1414
+ resultMask = new Uint8Array(numPixels);
1415
+ data.pixels.resultMask = resultMask;
1416
+ ptr += mask.numBytes;
1417
+ }// ????? else if (data.mask.numBytes > 0 && data.mask.numBytes< data.numValidPixel) {
1418
+ else if (mask.numBytes > 0) {
1419
+ bitset = new Uint8Array(Math.ceil(numPixels / 8));
1420
+ view = new DataView(input, ptr, mask.numBytes);
1421
+ var cnt = view.getInt16(0, true);
1422
+ var ip = 2, op = 0, val = 0;
1423
+ do {
1424
+ if (cnt > 0) {
1425
+ while (cnt--) { bitset[op++] = view.getUint8(ip++); }
1426
+ } else {
1427
+ val = view.getUint8(ip++);
1428
+ cnt = -cnt;
1429
+ while (cnt--) { bitset[op++] = val; }
1430
+ }
1431
+ cnt = view.getInt16(ip, true);
1432
+ ip += 2;
1433
+ } while (ip < mask.numBytes);
1434
+ if ((cnt !== -32768) || (op < bitset.length)) {
1435
+ throw "Unexpected end of mask RLE encoding";
1436
+ }
1437
+
1438
+ resultMask = new Uint8Array(numPixels);
1439
+ var mb = 0, k = 0;
1440
+
1441
+ for (k = 0; k < numPixels; k++) {
1442
+ if (k & 7) {
1443
+ mb = bitset[k >> 3];
1444
+ mb <<= k & 7;
1445
+ }
1446
+ else {
1447
+ mb = bitset[k >> 3];
1448
+ }
1449
+ if (mb & 128) {
1450
+ resultMask[k] = 1;
1451
+ }
1452
+ }
1453
+ data.pixels.resultMask = resultMask;
1454
+
1455
+ mask.bitset = bitset;
1456
+ ptr += mask.numBytes;
1457
+ }
1458
+ data.ptr = ptr;
1459
+ data.mask = mask;
1460
+ return true;
1461
+ },
1462
+
1463
+ readDataOneSweep: function(input, data, OutPixelTypeArray) {
1464
+ var ptr = data.ptr;
1465
+ var headerInfo = data.headerInfo;
1466
+ var numDims = headerInfo.numDims;
1467
+ var numPixels = headerInfo.width * headerInfo.height;
1468
+ var imageType = headerInfo.imageType;
1469
+ var numBytes = headerInfo.numValidPixel * Lerc2Helpers.getDataTypeSize(imageType) * numDims;
1470
+ //data.pixels.numBytes = numBytes;
1471
+ var rawData;
1472
+ var mask = data.pixels.resultMask;
1473
+ if (OutPixelTypeArray === Uint8Array) {
1474
+ rawData = new Uint8Array(input, ptr, numBytes);
1475
+ }
1476
+ else {
1477
+ var arrayBuf = new ArrayBuffer(numBytes);
1478
+ var store8 = new Uint8Array(arrayBuf);
1479
+ store8.set(new Uint8Array(input, ptr, numBytes));
1480
+ rawData = new OutPixelTypeArray(arrayBuf);
1481
+ }
1482
+ if (rawData.length === numPixels * numDims) {
1483
+ data.pixels.resultPixels = rawData;
1484
+ }
1485
+ else //mask
1486
+ {
1487
+ data.pixels.resultPixels = new OutPixelTypeArray(numPixels * numDims);
1488
+ var z = 0, k = 0, i = 0, nStart = 0;
1489
+ if (numDims > 1) {
1490
+ for (i=0; i < numDims; i++) {
1491
+ nStart = i * numPixels;
1492
+ for (k = 0; k < numPixels; k++) {
1493
+ if (mask[k]) {
1494
+ data.pixels.resultPixels[nStart + k] = rawData[z++];
1495
+ }
1496
+ }
1497
+ }
1498
+ }
1499
+ else {
1500
+ for (k = 0; k < numPixels; k++) {
1501
+ if (mask[k]) {
1502
+ data.pixels.resultPixels[k] = rawData[z++];
1503
+ }
1504
+ }
1505
+ }
1506
+ }
1507
+ ptr += numBytes;
1508
+ data.ptr = ptr; //return data;
1509
+ return true;
1510
+ },
1511
+
1512
+ readHuffmanTree: function(input, data) {
1513
+ var BITS_MAX = this.HUFFMAN_LUT_BITS_MAX; //8 is slow for the large test image
1514
+ //var size_max = 1 << BITS_MAX;
1515
+ /* ************************
1516
+ * reading code table
1517
+ *************************/
1518
+ var view = new DataView(input, data.ptr, 16);
1519
+ data.ptr += 16;
1520
+ var version = view.getInt32(0, true);
1521
+ if (version < 2) {
1522
+ throw "unsupported Huffman version";
1523
+ }
1524
+ var size = view.getInt32(4, true);
1525
+ var i0 = view.getInt32(8, true);
1526
+ var i1 = view.getInt32(12, true);
1527
+ if (i0 >= i1) {
1528
+ return false;
1529
+ }
1530
+ var blockDataBuffer = new Uint32Array(i1 - i0);
1531
+ Lerc2Helpers.decodeBits(input, data, blockDataBuffer);
1532
+ var codeTable = []; //size
1533
+ var i, j, k, len;
1534
+
1535
+ for (i = i0; i < i1; i++) {
1536
+ j = i - (i < size ? 0 : size);//wrap around
1537
+ codeTable[j] = { first: blockDataBuffer[i - i0], second: null };
1538
+ }
1539
+
1540
+ var dataBytes = input.byteLength - data.ptr;
1541
+ var dataWords = Math.ceil(dataBytes / 4);
1542
+ var arrayBuf = new ArrayBuffer(dataWords * 4);
1543
+ var store8 = new Uint8Array(arrayBuf);
1544
+ store8.set(new Uint8Array(input, data.ptr, dataBytes));
1545
+ var stuffedData = new Uint32Array(arrayBuf); //must start from x*4
1546
+ var bitPos = 0, word, srcPtr = 0;
1547
+ word = stuffedData[0];
1548
+ for (i = i0; i < i1; i++) {
1549
+ j = i - (i < size ? 0 : size);//wrap around
1550
+ len = codeTable[j].first;
1551
+ if (len > 0) {
1552
+ codeTable[j].second = (word << bitPos) >>> (32 - len);
1553
+
1554
+ if (32 - bitPos >= len) {
1555
+ bitPos += len;
1556
+ if (bitPos === 32) {
1557
+ bitPos = 0;
1558
+ srcPtr++;
1559
+ word = stuffedData[srcPtr];
1560
+ }
1561
+ }
1562
+ else {
1563
+ bitPos += len - 32;
1564
+ srcPtr++;
1565
+ word = stuffedData[srcPtr];
1566
+ codeTable[j].second |= word >>> (32 - bitPos);
1567
+ }
1568
+ }
1569
+ }
1570
+
1571
+ //finished reading code table
1572
+
1573
+ /* ************************
1574
+ * building lut
1575
+ *************************/
1576
+ var numBitsLUT = 0, numBitsLUTQick = 0;
1577
+ var tree = new TreeNode();
1578
+ for (i = 0; i < codeTable.length; i++) {
1579
+ if (codeTable[i] !== undefined) {
1580
+ numBitsLUT = Math.max(numBitsLUT, codeTable[i].first);
1581
+ }
1582
+ }
1583
+ if (numBitsLUT >= BITS_MAX) {
1584
+ numBitsLUTQick = BITS_MAX;
1585
+ }
1586
+ else {
1587
+ numBitsLUTQick = numBitsLUT;
1588
+ }
1589
+ if (numBitsLUT >= 30) {
1590
+ console.log("WARning, large NUM LUT BITS IS " + numBitsLUT);
1591
+ }
1592
+ var decodeLut = [], entry, code, numEntries, jj, currentBit, node;
1593
+ for (i = i0; i < i1; i++) {
1594
+ j = i - (i < size ? 0 : size);//wrap around
1595
+ len = codeTable[j].first;
1596
+ if (len > 0) {
1597
+ entry = [len, j];
1598
+ if (len <= numBitsLUTQick) {
1599
+ code = codeTable[j].second << (numBitsLUTQick - len);
1600
+ numEntries = 1 << (numBitsLUTQick - len);
1601
+ for (k = 0; k < numEntries; k++) {
1602
+ decodeLut[code | k] = entry;
1603
+ }
1604
+ }
1605
+ else {
1606
+ //build tree
1607
+ code = codeTable[j].second;
1608
+ node = tree;
1609
+ for (jj = len - 1; jj >= 0; jj--) {
1610
+ currentBit = code >>> jj & 1; //no left shift as length could be 30,31
1611
+ if (currentBit) {
1612
+ if (!node.right) {
1613
+ node.right = new TreeNode();
1614
+ }
1615
+ node = node.right;
1616
+ }
1617
+ else {
1618
+ if (!node.left) {
1619
+ node.left = new TreeNode();
1620
+ }
1621
+ node = node.left;
1622
+ }
1623
+ if (jj === 0 && !node.val) {
1624
+ node.val = entry[1];
1625
+ }
1626
+ }
1627
+ }
1628
+ }
1629
+ }
1630
+ return {
1631
+ decodeLut: decodeLut,
1632
+ numBitsLUTQick: numBitsLUTQick,
1633
+ numBitsLUT: numBitsLUT,
1634
+ tree: tree,
1635
+ stuffedData: stuffedData,
1636
+ srcPtr: srcPtr,
1637
+ bitPos: bitPos
1638
+ };
1639
+ },
1640
+
1641
+ readHuffman: function(input, data, OutPixelTypeArray) {
1642
+ var headerInfo = data.headerInfo;
1643
+ var numDims = headerInfo.numDims;
1644
+ var height = data.headerInfo.height;
1645
+ var width = data.headerInfo.width;
1646
+ var numPixels = width * height;
1647
+ //var size_max = 1 << BITS_MAX;
1648
+ /* ************************
1649
+ * reading huffman structure info
1650
+ *************************/
1651
+ var huffmanInfo = this.readHuffmanTree(input, data);
1652
+ var decodeLut = huffmanInfo.decodeLut;
1653
+ var tree = huffmanInfo.tree;
1654
+ //stuffedData includes huffman headers
1655
+ var stuffedData = huffmanInfo.stuffedData;
1656
+ var srcPtr = huffmanInfo.srcPtr;
1657
+ var bitPos = huffmanInfo.bitPos;
1658
+ var numBitsLUTQick = huffmanInfo.numBitsLUTQick;
1659
+ var numBitsLUT = huffmanInfo.numBitsLUT;
1660
+ var offset = data.headerInfo.imageType === 0 ? 128 : 0;
1661
+ /*************************
1662
+ * decode
1663
+ ***************************/
1664
+ var node, val, delta, mask = data.pixels.resultMask, valTmp, valTmpQuick, currentBit;
1665
+ var i, j, k, ii;
1666
+ var prevVal = 0;
1667
+ if (bitPos > 0) {
1668
+ srcPtr++;
1669
+ bitPos = 0;
1670
+ }
1671
+ var word = stuffedData[srcPtr];
1672
+ var deltaEncode = data.encodeMode === 1;
1673
+ var resultPixelsAllDim = new OutPixelTypeArray(numPixels * numDims);
1674
+ var resultPixels = resultPixelsAllDim;
1675
+ var iDim;
1676
+ for (iDim = 0; iDim < headerInfo.numDims; iDim++) {
1677
+ if (numDims > 1) {
1678
+ //get the mem block of current dimension
1679
+ resultPixels = new OutPixelTypeArray(resultPixelsAllDim.buffer, numPixels * iDim, numPixels);
1680
+ prevVal = 0;
1681
+ }
1682
+ if (data.headerInfo.numValidPixel === width * height) { //all valid
1683
+ for (k = 0, i = 0; i < height; i++) {
1684
+ for (j = 0; j < width; j++, k++) {
1685
+ val = 0;
1686
+ valTmp = (word << bitPos) >>> (32 - numBitsLUTQick);
1687
+ valTmpQuick = valTmp;// >>> deltaBits;
1688
+ if (32 - bitPos < numBitsLUTQick) {
1689
+ valTmp |= ((stuffedData[srcPtr + 1]) >>> (64 - bitPos - numBitsLUTQick));
1690
+ valTmpQuick = valTmp;// >>> deltaBits;
1691
+ }
1692
+ if (decodeLut[valTmpQuick]) // if there, move the correct number of bits and done
1693
+ {
1694
+ val = decodeLut[valTmpQuick][1];
1695
+ bitPos += decodeLut[valTmpQuick][0];
1696
+ }
1697
+ else {
1698
+ valTmp = (word << bitPos) >>> (32 - numBitsLUT);
1699
+ valTmpQuick = valTmp;// >>> deltaBits;
1700
+ if (32 - bitPos < numBitsLUT) {
1701
+ valTmp |= ((stuffedData[srcPtr + 1]) >>> (64 - bitPos - numBitsLUT));
1702
+ valTmpQuick = valTmp;// >>> deltaBits;
1703
+ }
1704
+ node = tree;
1705
+ for (ii = 0; ii < numBitsLUT; ii++) {
1706
+ currentBit = valTmp >>> (numBitsLUT - ii - 1) & 1;
1707
+ node = currentBit ? node.right : node.left;
1708
+ if (!(node.left || node.right)) {
1709
+ val = node.val;
1710
+ bitPos = bitPos + ii + 1;
1711
+ break;
1712
+ }
1713
+ }
1714
+ }
1715
+
1716
+ if (bitPos >= 32) {
1717
+ bitPos -= 32;
1718
+ srcPtr++;
1719
+ word = stuffedData[srcPtr];
1720
+ }
1721
+
1722
+ delta = val - offset;
1723
+ if (deltaEncode) {
1724
+ if (j > 0) {
1725
+ delta += prevVal; // use overflow
1726
+ }
1727
+ else if (i > 0) {
1728
+ delta += resultPixels[k - width];
1729
+ }
1730
+ else {
1731
+ delta += prevVal;
1732
+ }
1733
+ delta &= 0xFF; //overflow
1734
+ resultPixels[k] = delta;//overflow
1735
+ prevVal = delta;
1736
+ }
1737
+ else {
1738
+ resultPixels[k] = delta;
1739
+ }
1740
+ }
1741
+ }
1742
+ }
1743
+ else { //not all valid, use mask
1744
+ for (k = 0, i = 0; i < height; i++) {
1745
+ for (j = 0; j < width; j++, k++) {
1746
+ if (mask[k]) {
1747
+ val = 0;
1748
+ valTmp = (word << bitPos) >>> (32 - numBitsLUTQick);
1749
+ valTmpQuick = valTmp;// >>> deltaBits;
1750
+ if (32 - bitPos < numBitsLUTQick) {
1751
+ valTmp |= ((stuffedData[srcPtr + 1]) >>> (64 - bitPos - numBitsLUTQick));
1752
+ valTmpQuick = valTmp;// >>> deltaBits;
1753
+ }
1754
+ if (decodeLut[valTmpQuick]) // if there, move the correct number of bits and done
1755
+ {
1756
+ val = decodeLut[valTmpQuick][1];
1757
+ bitPos += decodeLut[valTmpQuick][0];
1758
+ }
1759
+ else {
1760
+ valTmp = (word << bitPos) >>> (32 - numBitsLUT);
1761
+ valTmpQuick = valTmp;// >>> deltaBits;
1762
+ if (32 - bitPos < numBitsLUT) {
1763
+ valTmp |= ((stuffedData[srcPtr + 1]) >>> (64 - bitPos - numBitsLUT));
1764
+ valTmpQuick = valTmp;// >>> deltaBits;
1765
+ }
1766
+ node = tree;
1767
+ for (ii = 0; ii < numBitsLUT; ii++) {
1768
+ currentBit = valTmp >>> (numBitsLUT - ii - 1) & 1;
1769
+ node = currentBit ? node.right : node.left;
1770
+ if (!(node.left || node.right)) {
1771
+ val = node.val;
1772
+ bitPos = bitPos + ii + 1;
1773
+ break;
1774
+ }
1775
+ }
1776
+ }
1777
+
1778
+ if (bitPos >= 32) {
1779
+ bitPos -= 32;
1780
+ srcPtr++;
1781
+ word = stuffedData[srcPtr];
1782
+ }
1783
+
1784
+ delta = val - offset;
1785
+ if (deltaEncode) {
1786
+ if (j > 0 && mask[k - 1]) {
1787
+ delta += prevVal; // use overflow
1788
+ }
1789
+ else if (i > 0 && mask[k - width]) {
1790
+ delta += resultPixels[k - width];
1791
+ }
1792
+ else {
1793
+ delta += prevVal;
1794
+ }
1795
+
1796
+ delta &= 0xFF; //overflow
1797
+ resultPixels[k] = delta;//overflow
1798
+ prevVal = delta;
1799
+ }
1800
+ else {
1801
+ resultPixels[k] = delta;
1802
+ }
1803
+ }
1804
+ }
1805
+ }
1806
+ }
1807
+ data.ptr = data.ptr + (srcPtr + 1) * 4 + (bitPos > 0 ? 4 : 0);
1808
+ }
1809
+ data.pixels.resultPixels = resultPixelsAllDim;
1810
+ },
1811
+
1812
+ decodeBits: function(input, data, blockDataBuffer, offset, iDim) {
1813
+ {
1814
+ //bitstuff encoding is 3
1815
+ var headerInfo = data.headerInfo;
1816
+ var fileVersion = headerInfo.fileVersion;
1817
+ //var block = {};
1818
+ var blockPtr = 0;
1819
+ var view = new DataView(input, data.ptr, 5);//to do
1820
+ var headerByte = view.getUint8(0);
1821
+ blockPtr++;
1822
+ var bits67 = headerByte >> 6;
1823
+ var n = (bits67 === 0) ? 4 : 3 - bits67;
1824
+ var doLut = (headerByte & 32) > 0 ? true : false;//5th bit
1825
+ var numBits = headerByte & 31;
1826
+ var numElements = 0;
1827
+ if (n === 1) {
1828
+ numElements = view.getUint8(blockPtr); blockPtr++;
1829
+ } else if (n === 2) {
1830
+ numElements = view.getUint16(blockPtr, true); blockPtr += 2;
1831
+ } else if (n === 4) {
1832
+ numElements = view.getUint32(blockPtr, true); blockPtr += 4;
1833
+ } else {
1834
+ throw "Invalid valid pixel count type";
1835
+ }
1836
+ //fix: huffman codes are bit stuffed, but not bound by data's max value, so need to use originalUnstuff
1837
+ //offset = offset || 0;
1838
+ var scale = 2 * headerInfo.maxZError;
1839
+ var stuffedData, arrayBuf, store8, dataBytes, dataWords;
1840
+ var lutArr, lutData, lutBytes, bitsPerPixel;
1841
+ var zMax = headerInfo.numDims > 1 ? headerInfo.maxValues[iDim] : headerInfo.zMax;
1842
+ if (doLut) {
1843
+ data.counter.lut++;
1844
+ lutBytes = view.getUint8(blockPtr);
1845
+ blockPtr++;
1846
+ dataBytes = Math.ceil((lutBytes - 1) * numBits / 8);
1847
+ dataWords = Math.ceil(dataBytes / 4);
1848
+ arrayBuf = new ArrayBuffer(dataWords * 4);
1849
+ store8 = new Uint8Array(arrayBuf);
1850
+
1851
+ data.ptr += blockPtr;
1852
+ store8.set(new Uint8Array(input, data.ptr, dataBytes));
1853
+
1854
+ lutData = new Uint32Array(arrayBuf);
1855
+ data.ptr += dataBytes;
1856
+
1857
+ bitsPerPixel = 0;
1858
+ while ((lutBytes - 1) >>> bitsPerPixel) {
1859
+ bitsPerPixel++;
1860
+ }
1861
+ dataBytes = Math.ceil(numElements * bitsPerPixel / 8);
1862
+ dataWords = Math.ceil(dataBytes / 4);
1863
+ arrayBuf = new ArrayBuffer(dataWords * 4);
1864
+ store8 = new Uint8Array(arrayBuf);
1865
+ store8.set(new Uint8Array(input, data.ptr, dataBytes));
1866
+ stuffedData = new Uint32Array(arrayBuf);
1867
+ data.ptr += dataBytes;
1868
+ if (fileVersion >= 3) {
1869
+ lutArr = BitStuffer.unstuffLUT2(lutData, numBits, lutBytes - 1, offset, scale, zMax);
1870
+ }
1871
+ else {
1872
+ lutArr = BitStuffer.unstuffLUT(lutData, numBits, lutBytes - 1, offset, scale, zMax);
1873
+ }
1874
+ //lutArr.unshift(0);
1875
+ if (fileVersion >= 3) {
1876
+ //BitStuffer.unstuff2(block, blockDataBuffer, headerInfo.zMax);
1877
+ BitStuffer.unstuff2(stuffedData, blockDataBuffer, bitsPerPixel, numElements, lutArr);
1878
+ }
1879
+ else {
1880
+ BitStuffer.unstuff(stuffedData, blockDataBuffer, bitsPerPixel, numElements, lutArr);
1881
+ }
1882
+ }
1883
+ else {
1884
+ //console.debug("bitstuffer");
1885
+ data.counter.bitstuffer++;
1886
+ bitsPerPixel = numBits;
1887
+ data.ptr += blockPtr;
1888
+ if (bitsPerPixel > 0) {
1889
+ dataBytes = Math.ceil(numElements * bitsPerPixel / 8);
1890
+ dataWords = Math.ceil(dataBytes / 4);
1891
+ arrayBuf = new ArrayBuffer(dataWords * 4);
1892
+ store8 = new Uint8Array(arrayBuf);
1893
+ store8.set(new Uint8Array(input, data.ptr, dataBytes));
1894
+ stuffedData = new Uint32Array(arrayBuf);
1895
+ data.ptr += dataBytes;
1896
+ if (fileVersion >= 3) {
1897
+ if (offset == null) {
1898
+ BitStuffer.originalUnstuff2(stuffedData, blockDataBuffer, bitsPerPixel, numElements);
1899
+ }
1900
+ else {
1901
+ BitStuffer.unstuff2(stuffedData, blockDataBuffer, bitsPerPixel, numElements, false, offset, scale, zMax);
1902
+ }
1903
+ }
1904
+ else {
1905
+ if (offset == null) {
1906
+ BitStuffer.originalUnstuff(stuffedData, blockDataBuffer, bitsPerPixel, numElements);
1907
+ }
1908
+ else {
1909
+ BitStuffer.unstuff(stuffedData, blockDataBuffer, bitsPerPixel, numElements, false, offset, scale, zMax);
1910
+ }
1911
+ }
1912
+ }
1913
+ }
1914
+ }
1915
+
1916
+ },
1917
+
1918
+ readTiles: function(input, data, OutPixelTypeArray) {
1919
+ var headerInfo = data.headerInfo;
1920
+ var width = headerInfo.width;
1921
+ var height = headerInfo.height;
1922
+ var microBlockSize = headerInfo.microBlockSize;
1923
+ var imageType = headerInfo.imageType;
1924
+ var dataTypeSize = Lerc2Helpers.getDataTypeSize(imageType);
1925
+ var numBlocksX = Math.ceil(width / microBlockSize);
1926
+ var numBlocksY = Math.ceil(height / microBlockSize);
1927
+ data.pixels.numBlocksY = numBlocksY;
1928
+ data.pixels.numBlocksX = numBlocksX;
1929
+ data.pixels.ptr = 0;
1930
+ var row = 0, col = 0, blockY = 0, blockX = 0, thisBlockHeight = 0, thisBlockWidth = 0, bytesLeft = 0, headerByte = 0, bits67 = 0, testCode = 0, outPtr = 0, outStride = 0, numBytes = 0, bytesleft = 0, z = 0, blockPtr = 0;
1931
+ var view, block, arrayBuf, store8, rawData;
1932
+ var blockEncoding;
1933
+ var blockDataBuffer = new OutPixelTypeArray(microBlockSize * microBlockSize);
1934
+ var lastBlockHeight = (height % microBlockSize) || microBlockSize;
1935
+ var lastBlockWidth = (width % microBlockSize) || microBlockSize;
1936
+ var offsetType, offset;
1937
+ var numDims = headerInfo.numDims, iDim;
1938
+ var mask = data.pixels.resultMask;
1939
+ var resultPixels = data.pixels.resultPixels;
1940
+ for (blockY = 0; blockY < numBlocksY; blockY++) {
1941
+ thisBlockHeight = (blockY !== numBlocksY - 1) ? microBlockSize : lastBlockHeight;
1942
+ for (blockX = 0; blockX < numBlocksX; blockX++) {
1943
+ //console.debug("y" + blockY + " x" + blockX);
1944
+ thisBlockWidth = (blockX !== numBlocksX - 1) ? microBlockSize : lastBlockWidth;
1945
+
1946
+ outPtr = blockY * width * microBlockSize + blockX * microBlockSize;
1947
+ outStride = width - thisBlockWidth;
1948
+
1949
+
1950
+ for (iDim = 0; iDim < numDims; iDim++) {
1951
+ if (numDims > 1) {
1952
+ resultPixels = new OutPixelTypeArray(data.pixels.resultPixels.buffer, width * height * iDim * dataTypeSize, width * height);
1953
+ }
1954
+ bytesLeft = input.byteLength - data.ptr;
1955
+ view = new DataView(input, data.ptr, Math.min(10, bytesLeft));
1956
+ block = {};
1957
+ blockPtr = 0;
1958
+ headerByte = view.getUint8(0);
1959
+ blockPtr++;
1960
+ bits67 = (headerByte >> 6) & 0xFF;
1961
+ testCode = (headerByte >> 2) & 15; // use bits 2345 for integrity check
1962
+ if (testCode !== (((blockX * microBlockSize) >> 3) & 15)) {
1963
+ throw "integrity issue";
1964
+ //return false;
1965
+ }
1966
+
1967
+ blockEncoding = headerByte & 3;
1968
+ if (blockEncoding > 3) {
1969
+ data.ptr += blockPtr;
1970
+ throw "Invalid block encoding (" + blockEncoding + ")";
1971
+ }
1972
+ else if (blockEncoding === 2) { //constant 0
1973
+ data.counter.constant++;
1974
+ data.ptr += blockPtr;
1975
+ continue;
1976
+ }
1977
+ else if (blockEncoding === 0) { //uncompressed
1978
+ data.counter.uncompressed++;
1979
+ data.ptr += blockPtr;
1980
+ numBytes = thisBlockHeight * thisBlockWidth * dataTypeSize;
1981
+ bytesleft = input.byteLength - data.ptr;
1982
+ numBytes = numBytes < bytesleft ? numBytes : bytesleft;
1983
+ //bit alignment
1984
+ arrayBuf = new ArrayBuffer((numBytes % dataTypeSize) === 0 ? numBytes : (numBytes + dataTypeSize - numBytes % dataTypeSize));
1985
+ store8 = new Uint8Array(arrayBuf);
1986
+ store8.set(new Uint8Array(input, data.ptr, numBytes));
1987
+ rawData = new OutPixelTypeArray(arrayBuf);
1988
+ z = 0;
1989
+ if (mask) {
1990
+ for (row = 0; row < thisBlockHeight; row++) {
1991
+ for (col = 0; col < thisBlockWidth; col++) {
1992
+ if (mask[outPtr]) {
1993
+ resultPixels[outPtr] = rawData[z++];
1994
+ }
1995
+ outPtr++;
1996
+ }
1997
+ outPtr += outStride;
1998
+ }
1999
+ }
2000
+ else {//all valid
2001
+ for (row = 0; row < thisBlockHeight; row++) {
2002
+ for (col = 0; col < thisBlockWidth; col++) {
2003
+ resultPixels[outPtr++] = rawData[z++];
2004
+ }
2005
+ outPtr += outStride;
2006
+ }
2007
+ }
2008
+ data.ptr += z * dataTypeSize;
2009
+ }
2010
+ else { //1 or 3
2011
+ offsetType = Lerc2Helpers.getDataTypeUsed(imageType, bits67);
2012
+ offset = Lerc2Helpers.getOnePixel(block, blockPtr, offsetType, view);
2013
+ blockPtr += Lerc2Helpers.getDataTypeSize(offsetType);
2014
+ if (blockEncoding === 3) //constant offset value
2015
+ {
2016
+ data.ptr += blockPtr;
2017
+ data.counter.constantoffset++;
2018
+ //you can delete the following resultMask case in favor of performance because val is constant and users use nodata mask, otherwise nodatavalue post processing handles it too.
2019
+ //while the above statement is true, we're not doing it as we want to keep invalid pixel value at 0 rather than arbitrary values
2020
+ if (mask) {
2021
+ for (row = 0; row < thisBlockHeight; row++) {
2022
+ for (col = 0; col < thisBlockWidth; col++) {
2023
+ if (mask[outPtr]) {
2024
+ resultPixels[outPtr] = offset;
2025
+ }
2026
+ outPtr++;
2027
+ }
2028
+ outPtr += outStride;
2029
+ }
2030
+ }
2031
+ else {
2032
+ for (row = 0; row < thisBlockHeight; row++) {
2033
+ for (col = 0; col < thisBlockWidth; col++) {
2034
+ resultPixels[outPtr++] = offset;
2035
+ }
2036
+ outPtr += outStride;
2037
+ }
2038
+ }
2039
+ }
2040
+ else { //bitstuff encoding is 3
2041
+ data.ptr += blockPtr;
2042
+ //heavy lifting
2043
+ Lerc2Helpers.decodeBits(input, data, blockDataBuffer, offset, iDim);
2044
+ blockPtr = 0;
2045
+ if (mask) {
2046
+ for (row = 0; row < thisBlockHeight; row++) {
2047
+ for (col = 0; col < thisBlockWidth; col++) {
2048
+ if (mask[outPtr]) {
2049
+ resultPixels[outPtr] = blockDataBuffer[blockPtr++];
2050
+ }
2051
+ outPtr++;
2052
+ }
2053
+ outPtr += outStride;
2054
+ }
2055
+ }
2056
+ else {
2057
+ for (row = 0; row < thisBlockHeight; row++) {
2058
+ for (col = 0; col < thisBlockWidth; col++) {
2059
+ resultPixels[outPtr++] = blockDataBuffer[blockPtr++];
2060
+ }
2061
+ outPtr += outStride;
2062
+ }
2063
+ }
2064
+ }
2065
+ }
2066
+ }
2067
+ }
2068
+ }
2069
+ },
2070
+
2071
+ /*****************
2072
+ * private methods (helper methods)
2073
+ *****************/
2074
+
2075
+ formatFileInfo: function(data) {
2076
+ return {
2077
+ "fileIdentifierString": data.headerInfo.fileIdentifierString,
2078
+ "fileVersion": data.headerInfo.fileVersion,
2079
+ "imageType": data.headerInfo.imageType,
2080
+ "height": data.headerInfo.height,
2081
+ "width": data.headerInfo.width,
2082
+ "numValidPixel": data.headerInfo.numValidPixel,
2083
+ "microBlockSize": data.headerInfo.microBlockSize,
2084
+ "blobSize": data.headerInfo.blobSize,
2085
+ "maxZError": data.headerInfo.maxZError,
2086
+ "pixelType": Lerc2Helpers.getPixelType(data.headerInfo.imageType),
2087
+ "eofOffset": data.eofOffset,
2088
+ "mask": data.mask ? {
2089
+ "numBytes": data.mask.numBytes
2090
+ } : null,
2091
+ "pixels": {
2092
+ "numBlocksX": data.pixels.numBlocksX,
2093
+ "numBlocksY": data.pixels.numBlocksY,
2094
+ //"numBytes": data.pixels.numBytes,
2095
+ "maxValue": data.headerInfo.zMax,
2096
+ "minValue": data.headerInfo.zMin,
2097
+ "noDataValue": data.noDataValue
2098
+ }
2099
+ };
2100
+ },
2101
+
2102
+ constructConstantSurface: function(data) {
2103
+ var val = data.headerInfo.zMax;
2104
+ var numDims = data.headerInfo.numDims;
2105
+ var numPixels = data.headerInfo.height * data.headerInfo.width;
2106
+ var numPixelAllDims = numPixels * numDims;
2107
+ var i=0, k = 0, nStart=0;
2108
+ var mask = data.pixels.resultMask;
2109
+ if (mask) {
2110
+ if (numDims > 1) {
2111
+ for (i=0; i < numDims; i++) {
2112
+ nStart = i * numPixels;
2113
+ for (k = 0; k < numPixels; k++) {
2114
+ if (mask[k]) {
2115
+ data.pixels.resultPixels[nStart + k] = val;
2116
+ }
2117
+ }
2118
+ }
2119
+ }
2120
+ else {
2121
+ for (k = 0; k < numPixels; k++) {
2122
+ if (mask[k]) {
2123
+ data.pixels.resultPixels[k] = val;
2124
+ }
2125
+ }
2126
+ }
2127
+ }
2128
+ else {
2129
+ if (data.pixels.resultPixels.fill) {
2130
+ data.pixels.resultPixels.fill(val);
2131
+ }
2132
+ else {
2133
+ for (k = 0; k < numPixelAllDims; k++) {
2134
+ data.pixels.resultPixels[k] = val;
2135
+ }
2136
+ }
2137
+ }
2138
+ return;
2139
+ },
2140
+
2141
+ getDataTypeArray: function(t) {
2142
+ var tp;
2143
+ switch (t) {
2144
+ case 0: //char
2145
+ tp = Int8Array;
2146
+ break;
2147
+ case 1: //byte
2148
+ tp = Uint8Array;
2149
+ break;
2150
+ case 2: //short
2151
+ tp = Int16Array;
2152
+ break;
2153
+ case 3: //ushort
2154
+ tp = Uint16Array;
2155
+ break;
2156
+ case 4:
2157
+ tp = Int32Array;
2158
+ break;
2159
+ case 5:
2160
+ tp = Uint32Array;
2161
+ break;
2162
+ case 6:
2163
+ tp = Float32Array;
2164
+ break;
2165
+ case 7:
2166
+ tp = Float64Array;
2167
+ break;
2168
+ default:
2169
+ tp = Float32Array;
2170
+ }
2171
+ return tp;
2172
+ },
2173
+
2174
+ getPixelType: function(t) {
2175
+ var tp;
2176
+ switch (t) {
2177
+ case 0: //char
2178
+ tp = "S8";
2179
+ break;
2180
+ case 1: //byte
2181
+ tp = "U8";
2182
+ break;
2183
+ case 2: //short
2184
+ tp = "S16";
2185
+ break;
2186
+ case 3: //ushort
2187
+ tp = "U16";
2188
+ break;
2189
+ case 4:
2190
+ tp = "S32";
2191
+ break;
2192
+ case 5:
2193
+ tp = "U32";
2194
+ break;
2195
+ case 6:
2196
+ tp = "F32";
2197
+ break;
2198
+ case 7:
2199
+ tp = "F64"; //not supported
2200
+ break;
2201
+ default:
2202
+ tp = "F32";
2203
+ }
2204
+ return tp;
2205
+ },
2206
+
2207
+ isValidPixelValue: function(t, val) {
2208
+ if (val == null) {
2209
+ return false;
2210
+ }
2211
+ var isValid;
2212
+ switch (t) {
2213
+ case 0: //char
2214
+ isValid = val >= -128 && val <= 127;
2215
+ break;
2216
+ case 1: //byte (unsigned char)
2217
+ isValid = val >= 0 && val <= 255;
2218
+ break;
2219
+ case 2: //short
2220
+ isValid = val >= -32768 && val <= 32767;
2221
+ break;
2222
+ case 3: //ushort
2223
+ isValid = val >= 0 && val <= 65536;
2224
+ break;
2225
+ case 4: //int 32
2226
+ isValid = val >= -2147483648 && val <= 2147483647;
2227
+ break;
2228
+ case 5: //uinit 32
2229
+ isValid = val >= 0 && val <= 4294967296;
2230
+ break;
2231
+ case 6:
2232
+ isValid = val >= -3.4027999387901484e+38 && val <= 3.4027999387901484e+38;
2233
+ break;
2234
+ case 7:
2235
+ isValid = val >= 5e-324 && val <= 1.7976931348623157e+308;
2236
+ break;
2237
+ default:
2238
+ isValid = false;
2239
+ }
2240
+ return isValid;
2241
+ },
2242
+
2243
+ getDataTypeSize: function(t) {
2244
+ var s = 0;
2245
+ switch (t) {
2246
+ case 0: //ubyte
2247
+ case 1: //byte
2248
+ s = 1;
2249
+ break;
2250
+ case 2: //short
2251
+ case 3: //ushort
2252
+ s = 2;
2253
+ break;
2254
+ case 4:
2255
+ case 5:
2256
+ case 6:
2257
+ s = 4;
2258
+ break;
2259
+ case 7:
2260
+ s = 8;
2261
+ break;
2262
+ default:
2263
+ s = t;
2264
+ }
2265
+ return s;
2266
+ },
2267
+
2268
+ getDataTypeUsed: function(dt, tc) {
2269
+ var t = dt;
2270
+ switch (dt) {
2271
+ case 2: //short
2272
+ case 4: //long
2273
+ t = dt - tc;
2274
+ break;
2275
+ case 3: //ushort
2276
+ case 5: //ulong
2277
+ t = dt - 2 * tc;
2278
+ break;
2279
+ case 6: //float
2280
+ if (0 === tc) {
2281
+ t = dt;
2282
+ }
2283
+ else if (1 === tc) {
2284
+ t = 2;
2285
+ }
2286
+ else {
2287
+ t = 1;//byte
2288
+ }
2289
+ break;
2290
+ case 7: //double
2291
+ if (0 === tc) {
2292
+ t = dt;
2293
+ }
2294
+ else {
2295
+ t = dt - 2 * tc + 1;
2296
+ }
2297
+ break;
2298
+ default:
2299
+ t = dt;
2300
+ break;
2301
+ }
2302
+ return t;
2303
+ },
2304
+
2305
+ getOnePixel: function(block, blockPtr, offsetType, view) {
2306
+ var temp = 0;
2307
+ switch (offsetType) {
2308
+ case 0: //char
2309
+ temp = view.getInt8(blockPtr);
2310
+ break;
2311
+ case 1: //byte
2312
+ temp = view.getUint8(blockPtr);
2313
+ break;
2314
+ case 2:
2315
+ temp = view.getInt16(blockPtr, true);
2316
+ break;
2317
+ case 3:
2318
+ temp = view.getUint16(blockPtr, true);
2319
+ break;
2320
+ case 4:
2321
+ temp = view.getInt32(blockPtr, true);
2322
+ break;
2323
+ case 5:
2324
+ temp = view.getUInt32(blockPtr, true);
2325
+ break;
2326
+ case 6:
2327
+ temp = view.getFloat32(blockPtr, true);
2328
+ break;
2329
+ case 7:
2330
+ //temp = view.getFloat64(blockPtr, true);
2331
+ //blockPtr += 8;
2332
+ //lerc2 encoding doesnt handle float 64, force to float32???
2333
+ temp = view.getFloat64(blockPtr, true);
2334
+ break;
2335
+ default:
2336
+ throw ("the decoder does not understand this pixel type");
2337
+ }
2338
+ return temp;
2339
+ }
2340
+ };
2341
+
2342
+ /***************************************************
2343
+ *private class for a tree node. Huffman code is in Lerc2Helpers
2344
+ ****************************************************/
2345
+ var TreeNode = function(val, left, right) {
2346
+ this.val = val;
2347
+ this.left = left;
2348
+ this.right = right;
2349
+ };
2350
+
2351
+ var Lerc2Decode = {
2352
+ /*
2353
+ * ********removed options compared to LERC1. We can bring some of them back if needed.
2354
+ * removed pixel type. LERC2 is typed and doesn't require user to give pixel type
2355
+ * changed encodedMaskData to maskData. LERC2 's js version make it faster to use maskData directly.
2356
+ * removed returnMask. mask is used by LERC2 internally and is cost free. In case of user input mask, it's returned as well and has neglible cost.
2357
+ * removed nodatavalue. Because LERC2 pixels are typed, nodatavalue will sacrify a useful value for many types (8bit, 16bit) etc,
2358
+ * user has to be knowledgable enough about raster and their data to avoid usability issues. so nodata value is simply removed now.
2359
+ * We can add it back later if their's a clear requirement.
2360
+ * removed encodedMask. This option was not implemented in LercDecode. It can be done after decoding (less efficient)
2361
+ * removed computeUsedBitDepths.
2362
+ *
2363
+ *
2364
+ * response changes compared to LERC1
2365
+ * 1. encodedMaskData is not available
2366
+ * 2. noDataValue is optional (returns only if user's noDataValue is with in the valid data type range)
2367
+ * 3. maskData is always available
2368
+ */
2369
+ /*****************
2370
+ * public properties
2371
+ ******************/
2372
+ //HUFFMAN_LUT_BITS_MAX: 12, //use 2^12 lut, not configurable
2373
+
2374
+ /*****************
2375
+ * public methods
2376
+ *****************/
2377
+
2378
+ /**
2379
+ * Decode a LERC2 byte stream and return an object containing the pixel data and optional metadata.
2380
+ *
2381
+ * @param {ArrayBuffer} input The LERC input byte stream
2382
+ * @param {object} [options] options Decoding options
2383
+ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid LERC file is expected at that position
2384
+ * @param {boolean} [options.returnFileInfo] If true, the return value will have a fileInfo property that contains metadata obtained from the LERC headers and the decoding process
2385
+ */
2386
+ decode: function(/*byte array*/ input, /*object*/ options) {
2387
+ //currently there's a bug in the sparse array, so please do not set to false
2388
+ options = options || {};
2389
+ var noDataValue = options.noDataValue;
2390
+
2391
+ //initialize
2392
+ var i = 0, data = {};
2393
+ data.ptr = options.inputOffset || 0;
2394
+ data.pixels = {};
2395
+
2396
+ // File header
2397
+ if (!Lerc2Helpers.readHeaderInfo(input, data)) ;
2398
+ var headerInfo = data.headerInfo;
2399
+ var fileVersion = headerInfo.fileVersion;
2400
+ var OutPixelTypeArray = Lerc2Helpers.getDataTypeArray(headerInfo.imageType);
2401
+
2402
+ // Mask Header
2403
+ Lerc2Helpers.readMask(input, data);
2404
+ if (headerInfo.numValidPixel !== headerInfo.width * headerInfo.height && !data.pixels.resultMask) {
2405
+ data.pixels.resultMask = options.maskData;
2406
+ }
2407
+
2408
+ var numPixels = headerInfo.width * headerInfo.height;
2409
+ data.pixels.resultPixels = new OutPixelTypeArray(numPixels * headerInfo.numDims);
2410
+
2411
+ data.counter = {
2412
+ onesweep: 0,
2413
+ uncompressed: 0,
2414
+ lut: 0,
2415
+ bitstuffer: 0,
2416
+ constant: 0,
2417
+ constantoffset: 0
2418
+ };
2419
+ if (headerInfo.numValidPixel !== 0) {
2420
+ //not tested
2421
+ if (headerInfo.zMax === headerInfo.zMin) //constant surface
2422
+ {
2423
+ Lerc2Helpers.constructConstantSurface(data);
2424
+ }
2425
+ else if (fileVersion >= 4 && Lerc2Helpers.checkMinMaxRanges(input, data)) {
2426
+ Lerc2Helpers.constructConstantSurface(data);
2427
+ }
2428
+ else {
2429
+ var view = new DataView(input, data.ptr, 2);
2430
+ var bReadDataOneSweep = view.getUint8(0);
2431
+ data.ptr++;
2432
+ if (bReadDataOneSweep) {
2433
+ //console.debug("OneSweep");
2434
+ Lerc2Helpers.readDataOneSweep(input, data, OutPixelTypeArray);
2435
+ }
2436
+ else {
2437
+ //lerc2.1: //bitstuffing + lut
2438
+ //lerc2.2: //bitstuffing + lut + huffman
2439
+ //lerc2.3: new bitstuffer
2440
+ if (fileVersion > 1 && headerInfo.imageType <= 1 && Math.abs(headerInfo.maxZError - 0.5) < 0.00001) {
2441
+ //this is 2.x plus 8 bit (unsigned and signed) data, possiblity of Huffman
2442
+ var flagHuffman = view.getUint8(1);
2443
+ data.ptr++;
2444
+ data.encodeMode = flagHuffman;
2445
+ if (flagHuffman > 2 || (fileVersion < 4 && flagHuffman > 1)) {
2446
+ throw "Invalid Huffman flag " + flagHuffman;
2447
+ }
2448
+ if (flagHuffman) {//1 - delta Huffman, 2 - Huffman
2449
+ //console.log("Huffman");
2450
+ Lerc2Helpers.readHuffman(input, data, OutPixelTypeArray);
2451
+ }
2452
+ else {
2453
+ //console.log("Tiles");
2454
+ Lerc2Helpers.readTiles(input, data, OutPixelTypeArray);
2455
+ }
2456
+ }
2457
+ else { //lerc2.x non-8 bit data
2458
+ //console.log("Tiles");
2459
+ Lerc2Helpers.readTiles(input, data, OutPixelTypeArray);
2460
+ }
2461
+ }
2462
+ }
2463
+ }
2464
+
2465
+ data.eofOffset = data.ptr;
2466
+ var diff;
2467
+ if (options.inputOffset) {
2468
+ diff = data.headerInfo.blobSize + options.inputOffset - data.ptr;
2469
+ if (Math.abs(diff) >= 1) {
2470
+ //console.debug("incorrect eof: dataptr " + data.ptr + " offset " + options.inputOffset + " blobsize " + data.headerInfo.blobSize + " diff: " + diff);
2471
+ data.eofOffset = options.inputOffset + data.headerInfo.blobSize;
2472
+ }
2473
+ }
2474
+ else {
2475
+ diff = data.headerInfo.blobSize - data.ptr;
2476
+ if (Math.abs(diff) >= 1) {
2477
+ //console.debug("incorrect first band eof: dataptr " + data.ptr + " blobsize " + data.headerInfo.blobSize + " diff: " + diff);
2478
+ data.eofOffset = data.headerInfo.blobSize;
2479
+ }
2480
+ }
2481
+
2482
+ var result = {
2483
+ width: headerInfo.width,
2484
+ height: headerInfo.height,
2485
+ pixelData: data.pixels.resultPixels,
2486
+ minValue: headerInfo.zMin,
2487
+ maxValue: headerInfo.zMax,
2488
+ validPixelCount: headerInfo.numValidPixel,
2489
+ dimCount: headerInfo.numDims,
2490
+ dimStats: {
2491
+ minValues: headerInfo.minValues,
2492
+ maxValues: headerInfo.maxValues
2493
+ },
2494
+ maskData: data.pixels.resultMask
2495
+ //noDataValue: noDataValue
2496
+ };
2497
+
2498
+ //we should remove this if there's no existing client
2499
+ //optional noDataValue processing, it's user's responsiblity
2500
+ if (data.pixels.resultMask && Lerc2Helpers.isValidPixelValue(headerInfo.imageType, noDataValue)) {
2501
+ var mask = data.pixels.resultMask;
2502
+ for (i = 0; i < numPixels; i++) {
2503
+ if (!mask[i]) {
2504
+ result.pixelData[i] = noDataValue;
2505
+ }
2506
+ }
2507
+ result.noDataValue = noDataValue;
2508
+ }
2509
+ data.noDataValue = noDataValue;
2510
+ if (options.returnFileInfo) {
2511
+ result.fileInfo = Lerc2Helpers.formatFileInfo(data);
2512
+ }
2513
+ return result;
2514
+ },
2515
+
2516
+ getBandCount: function(/*byte array*/ input) {
2517
+ var count = 0;
2518
+ var i = 0;
2519
+ var temp = {};
2520
+ temp.ptr = 0;
2521
+ temp.pixels = {};
2522
+ while (i < input.byteLength - 58) {
2523
+ Lerc2Helpers.readHeaderInfo(input, temp);
2524
+ i += temp.headerInfo.blobSize;
2525
+ count++;
2526
+ temp.ptr = i;
2527
+ }
2528
+ return count;
2529
+ }
2530
+ };
2531
+
2532
+ return Lerc2Decode;
2533
+ })();
2534
+
2535
+ var isPlatformLittleEndian = (function() {
2536
+ var a = new ArrayBuffer(4);
2537
+ var b = new Uint8Array(a);
2538
+ var c = new Uint32Array(a);
2539
+ c[0] = 1;
2540
+ return b[0] === 1;
2541
+ })();
2542
+
2543
+ var Lerc = {
2544
+ /************wrapper**********************************************/
2545
+ /**
2546
+ * A wrapper for decoding both LERC1 and LERC2 byte streams capable of handling multiband pixel blocks for various pixel types.
2547
+ *
2548
+ * @alias module:Lerc
2549
+ * @param {ArrayBuffer} input The LERC input byte stream
2550
+ * @param {object} [options] The decoding options below are optional.
2551
+ * @param {number} [options.inputOffset] The number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position.
2552
+ * @param {string} [options.pixelType] (LERC1 only) Default value is F32. Valid pixel types for input are U8/S8/S16/U16/S32/U32/F32.
2553
+ * @param {number} [options.noDataValue] (LERC1 only). It is recommended to use the returned mask instead of setting this value.
2554
+ * @returns {{width, height, pixels, pixelType, mask, statistics}}
2555
+ * @property {number} width Width of decoded image.
2556
+ * @property {number} height Height of decoded image.
2557
+ * @property {array} pixels [band1, band2, …] Each band is a typed array of width*height.
2558
+ * @property {string} pixelType The type of pixels represented in the output.
2559
+ * @property {mask} mask Typed array with a size of width*height, or null if all pixels are valid.
2560
+ * @property {array} statistics [statistics_band1, statistics_band2, …] Each element is a statistics object representing min and max values
2561
+ **/
2562
+ decode: function(encodedData, options) {
2563
+ if (!isPlatformLittleEndian) {
2564
+ throw "Big endian system is not supported.";
2565
+ }
2566
+ options = options || {};
2567
+ var inputOffset = options.inputOffset || 0;
2568
+ var fileIdView = new Uint8Array(encodedData, inputOffset, 10);
2569
+ var fileIdentifierString = String.fromCharCode.apply(null, fileIdView);
2570
+ var lerc, majorVersion;
2571
+ if (fileIdentifierString.trim() === "CntZImage") {
2572
+ lerc = LercDecode;
2573
+ majorVersion = 1;
2574
+ }
2575
+ else if (fileIdentifierString.substring(0, 5) === "Lerc2") {
2576
+ lerc = Lerc2Decode;
2577
+ majorVersion = 2;
2578
+ }
2579
+ else {
2580
+ throw "Unexpected file identifier string: " + fileIdentifierString;
2581
+ }
2582
+
2583
+ var iPlane = 0, eof = encodedData.byteLength - 10, encodedMaskData, bandMasks = [], bandMask, maskData;
2584
+ var decodedPixelBlock = {
2585
+ width: 0,
2586
+ height: 0,
2587
+ pixels: [],
2588
+ pixelType: options.pixelType,
2589
+ mask: null,
2590
+ statistics: []
2591
+ };
2592
+
2593
+ while (inputOffset < eof) {
2594
+ var result = lerc.decode(encodedData, {
2595
+ inputOffset: inputOffset,//for both lerc1 and lerc2
2596
+ encodedMaskData: encodedMaskData,//lerc1 only
2597
+ maskData: maskData,//lerc2 only
2598
+ returnMask: iPlane === 0 ? true : false,//lerc1 only
2599
+ returnEncodedMask: iPlane === 0 ? true : false,//lerc1 only
2600
+ returnFileInfo: true,//for both lerc1 and lerc2
2601
+ pixelType: options.pixelType || null,//lerc1 only
2602
+ noDataValue: options.noDataValue || null//lerc1 only
2603
+ });
2604
+
2605
+ inputOffset = result.fileInfo.eofOffset;
2606
+ if (iPlane === 0) {
2607
+ encodedMaskData = result.encodedMaskData;//lerc1
2608
+ maskData = result.maskData;//lerc2
2609
+ decodedPixelBlock.width = result.width;
2610
+ decodedPixelBlock.height = result.height;
2611
+ decodedPixelBlock.dimCount = result.dimCount || 1;
2612
+ //decodedPixelBlock.dimStats = decodedPixelBlock.dimStats;
2613
+ decodedPixelBlock.pixelType = result.pixelType || result.fileInfo.pixelType;
2614
+ decodedPixelBlock.mask = result.maskData;
2615
+ }
2616
+ if (majorVersion >1 && result.fileInfo.mask && result.fileInfo.mask.numBytes > 0) {
2617
+ bandMasks.push(result.maskData);
2618
+ }
2619
+
2620
+ iPlane++;
2621
+ decodedPixelBlock.pixels.push(result.pixelData);
2622
+ decodedPixelBlock.statistics.push({
2623
+ minValue: result.minValue,
2624
+ maxValue: result.maxValue,
2625
+ noDataValue: result.noDataValue,
2626
+ dimStats: result.dimStats
2627
+ });
2628
+ }
2629
+ var i, j, numPixels;
2630
+ if (majorVersion > 1 && bandMasks.length > 1) {
2631
+ numPixels = decodedPixelBlock.width * decodedPixelBlock.height;
2632
+ decodedPixelBlock.bandMasks = bandMasks;
2633
+ maskData = new Uint8Array(numPixels);
2634
+ maskData.set(bandMasks[0]);
2635
+ for (i = 1; i < bandMasks.length; i++) {
2636
+ bandMask = bandMasks[i];
2637
+ for (j = 0; j < numPixels; j++) {
2638
+ maskData[j] = maskData[j] & bandMask[j];
2639
+ }
2640
+ }
2641
+ decodedPixelBlock.maskData = maskData;
2642
+ }
2643
+
2644
+ return decodedPixelBlock;
2645
+ }
2646
+ };
2647
+
2648
+ if (module.exports) {/* jshint ignore:line */
2649
+ //commonJS module 1.0/1.1/1.1.1 systems, such as nodeJS
2650
+ //http://wiki.commonjs.org/wiki/Modules
2651
+ module.exports = Lerc;/* jshint ignore:line */
2652
+ }
2653
+ else {
2654
+ //assign to this, most likely window
2655
+ this.Lerc = Lerc;
2656
+ }
2657
+
2658
+ })();
2659
+ } (LercDecode));
2660
+
2661
+ var Lerc = LercDecodeExports;
2662
+
2663
+ function createVerticesFromHeightmap(parameters, transferableObjects) {
2664
+ // LERC encoded buffers must be decoded, then we can process them like normal
2665
+ if (parameters.encoding === HeightmapEncoding$1.LERC) {
2666
+ let result;
2667
+ try {
2668
+ result = Lerc.decode(parameters.heightmap);
2669
+ } catch (error) {
2670
+ throw new RuntimeError.RuntimeError(error);
2671
+ }
2672
+
2673
+ const lercStatistics = result.statistics[0];
2674
+ if (lercStatistics.minValue === Number.MAX_VALUE) {
2675
+ throw new RuntimeError.RuntimeError("Invalid tile data");
2676
+ }
2677
+
2678
+ parameters.heightmap = result.pixels[0];
2679
+ parameters.width = result.width;
2680
+ parameters.height = result.height;
2681
+ }
2682
+
2683
+ parameters.ellipsoid = Matrix3.Ellipsoid.clone(parameters.ellipsoid);
2684
+ parameters.rectangle = Matrix2.Rectangle.clone(parameters.rectangle);
2685
+
2686
+ const statistics = HeightmapTessellator$1.computeVertices(parameters);
2687
+ const vertices = statistics.vertices;
2688
+ transferableObjects.push(vertices.buffer);
2689
+
2690
+ return {
2691
+ vertices: vertices.buffer,
2692
+ numberOfAttributes: statistics.encoding.stride,
2693
+ minimumHeight: statistics.minimumHeight,
2694
+ maximumHeight: statistics.maximumHeight,
2695
+ gridWidth: parameters.width,
2696
+ gridHeight: parameters.height,
2697
+ boundingSphere3D: statistics.boundingSphere3D,
2698
+ orientedBoundingBox: statistics.orientedBoundingBox,
2699
+ occludeePointInScaledSpace: statistics.occludeePointInScaledSpace,
2700
+ encoding: statistics.encoding,
2701
+ westIndicesSouthToNorth: statistics.westIndicesSouthToNorth,
2702
+ southIndicesEastToWest: statistics.southIndicesEastToWest,
2703
+ eastIndicesNorthToSouth: statistics.eastIndicesNorthToSouth,
2704
+ northIndicesWestToEast: statistics.northIndicesWestToEast,
2705
+ };
2706
+ }
2707
+ var createVerticesFromHeightmap$1 = createTaskProcessorWorker(createVerticesFromHeightmap);
2708
+
2709
+ return createVerticesFromHeightmap$1;
2710
+
2711
+ }));