@geoscene/core 4.23.9 → 4.23.10

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 (221) hide show
  1. package/assets/geoscene/core/workers/chunks/6f827a32646bab0a8777.js +1 -1
  2. package/assets/geoscene/core/workers/chunks/9f458f10dc65b185f66e.js +1 -1
  3. package/assets/geoscene/themes/base/_Overlay.scss +2 -2
  4. package/assets/geoscene/themes/base/_OverlayItem.scss +12 -12
  5. package/assets/geoscene/themes/base/_Ui.scss +32 -32
  6. package/assets/geoscene/themes/base/_View.scss +31 -31
  7. package/assets/geoscene/themes/base/_animation.scss +6 -6
  8. package/assets/geoscene/themes/base/_core.scss +2 -2
  9. package/assets/geoscene/themes/base/_mixins.scss +43 -43
  10. package/assets/geoscene/themes/base/icons/style.css +190 -190
  11. package/assets/geoscene/themes/base/icons/style.scss +376 -376
  12. package/assets/geoscene/themes/base/icons/variables.scss +187 -187
  13. package/assets/geoscene/themes/base/widgets/_AreaMeasurement2D.scss +4 -4
  14. package/assets/geoscene/themes/base/widgets/_AreaMeasurement3D.scss +4 -4
  15. package/assets/geoscene/themes/base/widgets/_Attachments.scss +48 -48
  16. package/assets/geoscene/themes/base/widgets/_Attribution.scss +9 -9
  17. package/assets/geoscene/themes/base/widgets/_BasemapGallery.scss +39 -39
  18. package/assets/geoscene/themes/base/widgets/_BasemapLayerList.scss +100 -100
  19. package/assets/geoscene/themes/base/widgets/_BasemapToggle.scss +22 -22
  20. package/assets/geoscene/themes/base/widgets/_BinaryColorSizeSlider.scss +2 -2
  21. package/assets/geoscene/themes/base/widgets/_Bookmarks.scss +48 -48
  22. package/assets/geoscene/themes/base/widgets/_BuildingDisciplinesTree.scss +3 -3
  23. package/assets/geoscene/themes/base/widgets/_BuildingExplorer.scss +4 -4
  24. package/assets/geoscene/themes/base/widgets/_BuildingLevelPicker.scss +4 -4
  25. package/assets/geoscene/themes/base/widgets/_BuildingPhasePicker.scss +4 -4
  26. package/assets/geoscene/themes/base/widgets/_ButtonMenu.scss +21 -21
  27. package/assets/geoscene/themes/base/widgets/_ClassedColorSlider.scss +2 -2
  28. package/assets/geoscene/themes/base/widgets/_ClassedSizeSlider.scss +2 -2
  29. package/assets/geoscene/themes/base/widgets/_ColorPicker.scss +3 -3
  30. package/assets/geoscene/themes/base/widgets/_ColorSizeSlider.scss +2 -2
  31. package/assets/geoscene/themes/base/widgets/_ColorSlider.scss +2 -2
  32. package/assets/geoscene/themes/base/widgets/_Compass.scss +3 -3
  33. package/assets/geoscene/themes/base/widgets/_CoordinateConversion.scss +51 -51
  34. package/assets/geoscene/themes/base/widgets/_DatePicker.scss +34 -34
  35. package/assets/geoscene/themes/base/widgets/_Daylight.scss +63 -63
  36. package/assets/geoscene/themes/base/widgets/_DirectLineMeasurement3D.scss +2 -2
  37. package/assets/geoscene/themes/base/widgets/_Directions.scss +98 -98
  38. package/assets/geoscene/themes/base/widgets/_DistanceMeasurement2D.scss +2 -2
  39. package/assets/geoscene/themes/base/widgets/_Editor.scss +56 -56
  40. package/assets/geoscene/themes/base/widgets/_ElevationProfile.scss +19 -19
  41. package/assets/geoscene/themes/base/widgets/_Expand.scss +58 -58
  42. package/assets/geoscene/themes/base/widgets/_Feature.scss +13 -13
  43. package/assets/geoscene/themes/base/widgets/_FeatureContent.scss +24 -24
  44. package/assets/geoscene/themes/base/widgets/_FeatureForm.scss +36 -36
  45. package/assets/geoscene/themes/base/widgets/_FeatureMedia.scss +17 -17
  46. package/assets/geoscene/themes/base/widgets/_FeatureTable.scss +26 -26
  47. package/assets/geoscene/themes/base/widgets/_FeatureTemplates.scss +9 -9
  48. package/assets/geoscene/themes/base/widgets/_FloorFilter.scss +93 -93
  49. package/assets/geoscene/themes/base/widgets/_Grid.scss +6 -6
  50. package/assets/geoscene/themes/base/widgets/_HeatmapSlider.scss +2 -2
  51. package/assets/geoscene/themes/base/widgets/_Histogram.scss +10 -10
  52. package/assets/geoscene/themes/base/widgets/_HistogramRangeSlider.scss +27 -27
  53. package/assets/geoscene/themes/base/widgets/_IdentityForm.scss +5 -5
  54. package/assets/geoscene/themes/base/widgets/_IdentityModal.scss +13 -13
  55. package/assets/geoscene/themes/base/widgets/_ItemList.scss +18 -18
  56. package/assets/geoscene/themes/base/widgets/_LayerList.scss +89 -89
  57. package/assets/geoscene/themes/base/widgets/_Legend.scss +95 -95
  58. package/assets/geoscene/themes/base/widgets/_LineOfSight.scss +9 -9
  59. package/assets/geoscene/themes/base/widgets/_NavigationToggle.scss +14 -14
  60. package/assets/geoscene/themes/base/widgets/_OpacitySlider.scss +2 -2
  61. package/assets/geoscene/themes/base/widgets/_Popup.scss +167 -167
  62. package/assets/geoscene/themes/base/widgets/_Print.scss +52 -52
  63. package/assets/geoscene/themes/base/widgets/_ScaleBar.scss +28 -28
  64. package/assets/geoscene/themes/base/widgets/_ScaleRangeSlider.scss +29 -29
  65. package/assets/geoscene/themes/base/widgets/_Search.scss +50 -50
  66. package/assets/geoscene/themes/base/widgets/_SearchResultRenderer.scss +7 -7
  67. package/assets/geoscene/themes/base/widgets/_SelectionToolbar.scss +3 -3
  68. package/assets/geoscene/themes/base/widgets/_ShadowCast.scss +17 -17
  69. package/assets/geoscene/themes/base/widgets/_SizeSlider.scss +2 -2
  70. package/assets/geoscene/themes/base/widgets/_Sketch.scss +24 -24
  71. package/assets/geoscene/themes/base/widgets/_Slice.scss +5 -5
  72. package/assets/geoscene/themes/base/widgets/_Slider.scss +70 -70
  73. package/assets/geoscene/themes/base/widgets/_SnappingControls.scss +16 -16
  74. package/assets/geoscene/themes/base/widgets/_Spinner.scss +12 -12
  75. package/assets/geoscene/themes/base/widgets/_Swipe.scss +15 -15
  76. package/assets/geoscene/themes/base/widgets/_TableList.scss +57 -57
  77. package/assets/geoscene/themes/base/widgets/_TimePicker.scss +3 -3
  78. package/assets/geoscene/themes/base/widgets/_TimeSlider.scss +28 -28
  79. package/assets/geoscene/themes/base/widgets/_UtilityNetworkTrace.scss +8 -8
  80. package/assets/geoscene/themes/base/widgets/_Weather.scss +2 -2
  81. package/assets/geoscene/themes/base/widgets/_Widget.scss +95 -95
  82. package/assets/geoscene/themes/base/widgets/_Zoom.scss +8 -8
  83. package/assets/geoscene/themes/dark/main.css +1 -1
  84. package/assets/geoscene/themes/dark/main.scss +3 -3
  85. package/assets/geoscene/themes/dark-blue/main.css +1 -1
  86. package/assets/geoscene/themes/dark-blue/main.scss +3 -3
  87. package/assets/geoscene/themes/dark-green/main.css +1 -1
  88. package/assets/geoscene/themes/dark-green/main.scss +3 -3
  89. package/assets/geoscene/themes/dark-purple/main.css +1 -1
  90. package/assets/geoscene/themes/dark-purple/main.scss +3 -3
  91. package/assets/geoscene/themes/dark-red/main.css +1 -1
  92. package/assets/geoscene/themes/dark-red/main.scss +3 -3
  93. package/assets/geoscene/themes/light/main.css +1 -1
  94. package/assets/geoscene/themes/light/main.scss +2 -2
  95. package/assets/geoscene/themes/light/view.css +1 -1
  96. package/assets/geoscene/themes/light-blue/main.css +1 -1
  97. package/assets/geoscene/themes/light-blue/main.scss +3 -3
  98. package/assets/geoscene/themes/light-green/main.css +1 -1
  99. package/assets/geoscene/themes/light-green/main.scss +3 -3
  100. package/assets/geoscene/themes/light-purple/main.css +1 -1
  101. package/assets/geoscene/themes/light-purple/main.scss +3 -3
  102. package/assets/geoscene/themes/light-red/main.css +1 -1
  103. package/assets/geoscene/themes/light-red/main.scss +3 -3
  104. package/identity/IdentityForm.js +1 -1
  105. package/identity/IdentityModal.js +1 -1
  106. package/package.json +1 -1
  107. package/portal/schemas/definitions.js +1 -1
  108. package/portal/schemas/sceneLayerItem.js +1 -1
  109. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  110. package/views/2d/layers/support/clusterUtils.js +1 -1
  111. package/views/2d/navigation/ZoomBox.js +1 -1
  112. package/views/3d/externalRenderers.js +1 -1
  113. package/views/3d/layers/I3SMeshView3D.js +1 -1
  114. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  115. package/views/BreakpointsOwner.js +1 -1
  116. package/views/DOMContainer.js +1 -1
  117. package/views/input/BrowserEventSource.js +1 -1
  118. package/views/overlay/LineOverlayItem.js +1 -1
  119. package/views/overlay/TextOverlayItem.js +1 -1
  120. package/views/overlay/ViewOverlay.js +1 -1
  121. package/views/ui/Component.js +1 -1
  122. package/views/ui/UI.js +1 -1
  123. package/views/webgl/context-util.js +1 -1
  124. package/widgets/AreaMeasurement2D.js +1 -1
  125. package/widgets/AreaMeasurement3D.js +1 -1
  126. package/widgets/Attachments.js +1 -1
  127. package/widgets/Attribution.js +1 -1
  128. package/widgets/BasemapGallery.js +1 -1
  129. package/widgets/BasemapLayerList.js +1 -1
  130. package/widgets/BasemapToggle.js +1 -1
  131. package/widgets/Bookmarks.js +1 -1
  132. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  133. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  134. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  135. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  136. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  137. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  138. package/widgets/BuildingExplorer.js +1 -1
  139. package/widgets/Compass.js +1 -1
  140. package/widgets/CoordinateConversion.js +1 -1
  141. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  142. package/widgets/Daylight.js +1 -1
  143. package/widgets/DirectLineMeasurement3D.js +1 -1
  144. package/widgets/Directions/support/resources.js +1 -1
  145. package/widgets/Directions.js +1 -1
  146. package/widgets/DistanceMeasurement2D.js +1 -1
  147. package/widgets/Editor/deprecationUtils.js +1 -1
  148. package/widgets/Editor.js +1 -1
  149. package/widgets/ElevationProfile/css.js +1 -1
  150. package/widgets/Expand.js +1 -1
  151. package/widgets/Feature/FeatureAttachments.js +1 -1
  152. package/widgets/Feature/FeatureContent.js +1 -1
  153. package/widgets/Feature/FeatureExpression.js +1 -1
  154. package/widgets/Feature/FeatureFields.js +1 -1
  155. package/widgets/Feature/FeatureMedia.js +1 -1
  156. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  157. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  158. package/widgets/Feature/support/featureUtils.js +1 -1
  159. package/widgets/Feature.js +1 -1
  160. package/widgets/FeatureForm.js +1 -1
  161. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  162. package/widgets/FeatureTable/FieldColumn.js +1 -1
  163. package/widgets/FeatureTable/Grid/Column.js +1 -1
  164. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  165. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  166. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  167. package/widgets/FeatureTable.js +1 -1
  168. package/widgets/FeatureTemplates/ItemList.js +1 -1
  169. package/widgets/FeatureTemplates.js +1 -1
  170. package/widgets/FloorFilter.js +1 -1
  171. package/widgets/Fullscreen.js +1 -1
  172. package/widgets/Histogram.js +1 -1
  173. package/widgets/HistogramRangeSlider.js +1 -1
  174. package/widgets/Home.js +1 -1
  175. package/widgets/LayerList/ListItemPanel.js +1 -1
  176. package/widgets/LayerList.js +1 -1
  177. package/widgets/Legend/styles/Card.js +1 -1
  178. package/widgets/Legend/styles/Classic.js +1 -1
  179. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  180. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  181. package/widgets/Legend.js +1 -1
  182. package/widgets/LineOfSight.js +1 -1
  183. package/widgets/Locate.js +1 -1
  184. package/widgets/Measurement.js +1 -1
  185. package/widgets/NavigationToggle.js +1 -1
  186. package/widgets/Popup.js +1 -1
  187. package/widgets/Print.js +1 -1
  188. package/widgets/ScaleBar.js +1 -1
  189. package/widgets/ScaleRangeSlider.js +1 -1
  190. package/widgets/Search/SearchResultRenderer.js +1 -1
  191. package/widgets/Search.js +1 -1
  192. package/widgets/ShadowCast/css.js +1 -1
  193. package/widgets/Sketch.js +1 -1
  194. package/widgets/Slice.js +1 -1
  195. package/widgets/Slider.js +1 -1
  196. package/widgets/Spinner.js +1 -1
  197. package/widgets/Swipe.js +1 -1
  198. package/widgets/TableList.js +1 -1
  199. package/widgets/TimeSlider.js +1 -1
  200. package/widgets/Track.js +1 -1
  201. package/widgets/UtilityNetworkTrace.js +1 -1
  202. package/widgets/Weather/css.js +1 -1
  203. package/widgets/Widget.js +1 -1
  204. package/widgets/Zoom/IconButton.js +1 -1
  205. package/widgets/Zoom.js +1 -1
  206. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  207. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  208. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  209. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  210. package/widgets/smartMapping/ColorSlider.js +1 -1
  211. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  212. package/widgets/smartMapping/OpacitySlider.js +1 -1
  213. package/widgets/smartMapping/SizeSlider.js +1 -1
  214. package/widgets/support/ColorPicker.js +1 -1
  215. package/widgets/support/DatePicker.js +1 -1
  216. package/widgets/support/Heading.js +1 -1
  217. package/widgets/support/Popover.js +1 -1
  218. package/widgets/support/SelectionToolbar.js +1 -1
  219. package/widgets/support/SnappingControls.js +1 -1
  220. package/widgets/support/TimePicker.js +1 -1
  221. package/widgets/support/widgetThemeUtils.js +1 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{schema_definitions as e}from"./definitions.js";const i={title:"Scene Layer config on layer item",type:"object",properties:{layers:{type:"array",items:{properties:{disablePopup:{type:"boolean",description:"disablePopups allows a client to ignore popups defined by the service item."},id:{type:"integer",description:"ID of the service layer."},layerDefinition:{type:"object",description:"A layerDefinition object defining the attribute schema and drawing information for the layer.",allOf:[{$ref:"#/definitions/layerDefinition_schema.json"},{properties:{definitionExpression:{},drawingInfo:{allOf:[{$ref:"#/definitions/drawingInfo_schema.json"},{properties:{labelingInfo:{},renderer:{},transparency:{}},additionalProperties:!1}]},elevationInfo:{},excludeObjectIds:{},featureReduction:{},floorInfo:{},maxScale:{},minScale:{},rangeInfos:{}},additionalProperties:!1}]},listMode:{type:"string",description:"To show or hide layers in the layer list",enum:["hide","show"],default:"show"},opacity:{type:"number",description:"The degree of transparency applied to the layer on the client side, where 0 is full transparency and 1 is no transparency.",minimum:0,maximum:1,default:1},popupInfo:{description:"A popupInfo object defining the content of pop-up windows when you click or query a feature.",$ref:"#/definitions/popupInfo_schema.json"},screenSizePerspective:{type:"boolean",description:"Apply [perspective scaling](https://developers.geoscene.cn/javascript/latest/api-reference/esri-layers-FeatureLayer.html#screenSizePerspectiveEnabled) to screen-size symbols.",default:!0},showLabels:{type:"boolean",description:"If the layer has a labelingInfo property then labels show on the scene only if the showLabels property it true.",default:!1},showLegend:{type:"boolean",description:"Boolean value indicating whether to display the layer in the legend. Default value is `true`.",default:!0},visibility:{type:"boolean",description:"Boolean property determining whether the layer is initially visible in the web scene",default:!0}},additionalProperties:!1}}},additionalProperties:!1,$schema:"http://json-schema.org/draft-07/schema",definitions:e};export{i as json};
5
+ import{schema_definitions as e}from"./definitions.js";const i={title:"Scene Layer config on layer item",type:"object",properties:{layers:{type:"array",items:{properties:{disablePopup:{type:"boolean",description:"disablePopups allows a client to ignore popups defined by the service item."},id:{type:"integer",description:"ID of the service layer."},layerDefinition:{type:"object",description:"A layerDefinition object defining the attribute schema and drawing information for the layer.",allOf:[{$ref:"#/definitions/layerDefinition_schema.json"},{properties:{definitionExpression:{},drawingInfo:{allOf:[{$ref:"#/definitions/drawingInfo_schema.json"},{properties:{labelingInfo:{},renderer:{},transparency:{}},additionalProperties:!1}]},elevationInfo:{},excludeObjectIds:{},featureReduction:{},floorInfo:{},maxScale:{},minScale:{},rangeInfos:{}},additionalProperties:!1}]},listMode:{type:"string",description:"To show or hide layers in the layer list",enum:["hide","show"],default:"show"},opacity:{type:"number",description:"The degree of transparency applied to the layer on the client side, where 0 is full transparency and 1 is no transparency.",minimum:0,maximum:1,default:1},popupInfo:{description:"A popupInfo object defining the content of pop-up windows when you click or query a feature.",$ref:"#/definitions/popupInfo_schema.json"},screenSizePerspective:{type:"boolean",description:"Apply [perspective scaling](https://developers.geoscene.cn/javascript/latest/api-reference/geoscene-layers-FeatureLayer.html#screenSizePerspectiveEnabled) to screen-size symbols.",default:!0},showLabels:{type:"boolean",description:"If the layer has a labelingInfo property then labels show on the scene only if the showLabels property it true.",default:!1},showLegend:{type:"boolean",description:"Boolean value indicating whether to display the layer in the legend. Default value is `true`.",default:!0},visibility:{type:"boolean",description:"Boolean property determining whether the layer is initially visible in the web scene",default:!0}},additionalProperties:!1}}},additionalProperties:!1,$schema:"http://json-schema.org/draft-07/schema",definitions:e};export{i as json};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import t from"../../../../core/has.js";import{throwIfNotAbortError as e}from"../../../../core/promiseUtils.js";import i from"./Rect.js";import h from"./RectangleBinPack.js";import{PixelFormat as s,PixelType as r}from"../../../webgl/enums.js";import{Texture as a}from"../../../webgl/Texture.js";const n=256,c=t=>Math.floor(t/256);function o(t){const e=new Set;for(const i of t)e.add(c(i));return e}function l(t,i,h){return t.has(i)||t.set(i,h().then((()=>{t.delete(i)})).catch((h=>{t.delete(i),e(h)}))),t.get(i)}const g=t=>({rect:new i(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class _{constructor(t,e,i){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphCache={},this._textures=[],this._rangePromises=new Map,this.width=t,this.height=e,this._glyphSource=i,this._binPack=new h(t-4,e-4),this._glyphData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyph()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._glyphData.length=0}_initDecorationGlyph(){const t=[117,149,181,207,207,181,149,117],e=[];for(let h=0;h<t.length;h++){const i=t[h];for(let t=0;t<11;t++)e.push(i)}const i={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)};this._recordGlyph(i)}async getGlyphItems(t,e,i){const h=this._getGlyphCache(t);return await this._fetchRanges(t,e,i),e.map((e=>this._getMosaicItem(h,t,e)))}bind(t,e,i,h){const s=this._getTexture(t,i);s.setSamplingMode(e),this._dirties[i]&&(s.setData(this._glyphData[i]),this._dirties[i]=!1),t.bindTexture(s,h)}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_getTexture(t,e){return this._textures[e]||(this._textures[e]=new a(t,{pixelFormat:s.ALPHA,dataType:r.UNSIGNED_BYTE,width:this.width,height:this.height},new Uint8Array(this.width*this.height))),this._textures[e]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,i){const h=o(e),s=[];h.forEach((e=>{s.push(this._fetchRange(t,e,i))})),await Promise.all(s)}async _fetchRange(t,e,i){if(e>n)return null;const h=t+e;return l(this._rangePromises,h,(()=>this._glyphSource.getRange(t,e,i)))}_getMosaicItem(t,e,i){if(!t[i]){const h=this._glyphSource.getGlyph(e,i);if(!h||!h.metrics)return g(i);const s=this._recordGlyph(h),r=this._currentPage,a=h.metrics;t[i]={rect:s,page:r,metrics:a,code:i,sdf:!0},this._invalidate()}return t[i]}_recordGlyph(e){const s=e.metrics;let r;if(0===s.width)r=new i(0,0,0,0);else{const i=3,a=s.width+2*i,n=s.height+2*i;r=this._binPack.allocate(a,n),r.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyph(),this._binPack=new h(this.width-4,this.height-4),r=this._binPack.allocate(a,n));const c=this._glyphData[this._currentPage],o=e.bitmap;let l,g;if(o)for(let t=0;t<n;t++){l=a*t,g=this.width*(r.y+t)+r.x;for(let t=0;t<a;t++)c[g+t]=o[l+t]}t("esri-glyph-debug")&&this._showDebugPage(c)}return r}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),h=new ImageData(this.width,this.height),s=h.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let r=0;r<t.length;++r)s[4*r+0]=t[r],s[4*r+1]=0,s[4*r+2]=0,s[4*r+3]=255;i.putImageData(h,0,0),document.body.appendChild(e)}}export{_ as default};
5
+ import t from"../../../../core/has.js";import{throwIfNotAbortError as e}from"../../../../core/promiseUtils.js";import i from"./Rect.js";import h from"./RectangleBinPack.js";import{PixelFormat as s,PixelType as r}from"../../../webgl/enums.js";import{Texture as a}from"../../../webgl/Texture.js";const n=256,c=t=>Math.floor(t/256);function o(t){const e=new Set;for(const i of t)e.add(c(i));return e}function l(t,i,h){return t.has(i)||t.set(i,h().then((()=>{t.delete(i)})).catch((h=>{t.delete(i),e(h)}))),t.get(i)}const g=t=>({rect:new i(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class _{constructor(t,e,i){this.width=0,this.height=0,this._dirties=[],this._glyphData=[],this._currentPage=0,this._glyphCache={},this._textures=[],this._rangePromises=new Map,this.width=t,this.height=e,this._glyphSource=i,this._binPack=new h(t-4,e-4),this._glyphData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyph()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._glyphData.length=0}_initDecorationGlyph(){const t=[117,149,181,207,207,181,149,117],e=[];for(let h=0;h<t.length;h++){const i=t[h];for(let t=0;t<11;t++)e.push(i)}const i={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)};this._recordGlyph(i)}async getGlyphItems(t,e,i){const h=this._getGlyphCache(t);return await this._fetchRanges(t,e,i),e.map((e=>this._getMosaicItem(h,t,e)))}bind(t,e,i,h){const s=this._getTexture(t,i);s.setSamplingMode(e),this._dirties[i]&&(s.setData(this._glyphData[i]),this._dirties[i]=!1),t.bindTexture(s,h)}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_getTexture(t,e){return this._textures[e]||(this._textures[e]=new a(t,{pixelFormat:s.ALPHA,dataType:r.UNSIGNED_BYTE,width:this.width,height:this.height},new Uint8Array(this.width*this.height))),this._textures[e]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,i){const h=o(e),s=[];h.forEach((e=>{s.push(this._fetchRange(t,e,i))})),await Promise.all(s)}async _fetchRange(t,e,i){if(e>n)return null;const h=t+e;return l(this._rangePromises,h,(()=>this._glyphSource.getRange(t,e,i)))}_getMosaicItem(t,e,i){if(!t[i]){const h=this._glyphSource.getGlyph(e,i);if(!h||!h.metrics)return g(i);const s=this._recordGlyph(h),r=this._currentPage,a=h.metrics;t[i]={rect:s,page:r,metrics:a,code:i,sdf:!0},this._invalidate()}return t[i]}_recordGlyph(e){const s=e.metrics;let r;if(0===s.width)r=new i(0,0,0,0);else{const i=3,a=s.width+2*i,n=s.height+2*i;r=this._binPack.allocate(a,n),r.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyph(),this._binPack=new h(this.width-4,this.height-4),r=this._binPack.allocate(a,n));const c=this._glyphData[this._currentPage],o=e.bitmap;let l,g;if(o)for(let t=0;t<n;t++){l=a*t,g=this.width*(r.y+t)+r.x;for(let t=0;t<a;t++)c[g+t]=o[l+t]}t("geoscene-glyph-debug")&&this._showDebugPage(c)}return r}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),h=new ImageData(this.width,this.height),s=h.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let r=0;r<t.length;++r)s[4*r+0]=t[r],s[4*r+1]=0,s[4*r+2]=0,s[4*r+3]=255;i.putImageData(h,0,0),document.body.appendChild(e)}}export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import i from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isNone as r}from"../../../../core/maybe.js";import{createMD5Hash as s}from"../../../../core/MD5.js";import a from"../../../../renderers/visualVariables/SizeVariable.js";import n from"../../../../renderers/visualVariables/support/SizeStop.js";import{LevelDependentSizeVariable as l}from"../../engine/LevelDependentSizeVariable.js";const o=t.getLogger("geoscene.views.2d.layers.support.clusterUtils");i.add("esri-cluster-arcade-enabled",!0);const u=i("esri-cluster-arcade-enabled"),c=(e,i,t,s)=>{const a=i.clone();if(!m(a))return a;if(t.fields)for(const r of t.fields)x(e,r);if("visualVariables"in a){const i=(a.visualVariables||[]).filter((e=>"$view.scale"!==e.valueExpression)),n=d(i);i.forEach((i=>{"rotation"===i.type?i.field?i.field=y(e,i.field,"avg_angle"):i.valueExpression&&(i.field=S(e,i.valueExpression,"avg_angle"),i.valueExpression=null):i.normalizationField?(i.field=y(e,i.field,"norm",i.normalizationField),i.normalizationField=null):i.field?i.field=y(e,i.field,"avg"):(i.field=S(e,i.valueExpression,"avg"),i.valueExpression=null)})),r(n)&&!p(i)&&(i.push(f(t,s)),a.dynamicClusterSize=!0),a.visualVariables=i}switch(a.type){case"simple":break;case"unique-value":a.field?a.field=y(e,a.field,"mode"):a.valueExpression&&(a.field=S(e,a.valueExpression,"mode"),a.valueExpression=null);break;case"class-breaks":a.normalizationField?(a.field=y(e,a.field,"norm",a.normalizationField),a.normalizationField=null):a.field?a.field=y(e,a.field,"avg"):(a.field=S(e,a.valueExpression,"avg"),a.valueExpression=null)}return a},d=e=>{for(const i of e)if("size"===i.type)return i;return null},p=e=>{for(const i of e)if("cluster_count"===i.field)return!0;return!1},f=(e,i)=>{const t=[new n({value:0,size:0}),new n({value:1})];if(r(i))return new a({field:"cluster_count",stops:[...t,new n({value:2,size:0})]});const s=Object.keys(i).reduce(((r,s)=>({...r,[s]:[...t,new n({value:Math.max(2,i[s].minValue),size:e.clusterMinSize}),new n({value:Math.max(3,i[s].maxValue),size:e.clusterMaxSize})]})),{});return new l({field:"cluster_count",levels:s})},m=i=>{const t=t=>o.error(new e("Unsupported-renderer",t,{renderer:i}));if("unique-value"===i.type){if(i.field2||i.field3)return t("FeatureReductionCluster does not support multi-field UniqueValueRenderers"),!1}else if("class-breaks"===i.type){if(i.normalizationField){const e=i.normalizationType;if("field"!==e)return t(`FeatureReductionCluster does not support a normalizationType of ${e}`),!1}}else if("simple"!==i.type)return t(`FeatureReductionCluster does not support renderers of type ${i.type}`),!1;if(!u){if("valueExpression"in i&&i.valueExpression)return t("FeatureReductionCluster does not currently support renderer.valueExpression. Support will be added in a future release"),!1;if(("visualVariables"in i&&i.visualVariables||[]).some((e=>!(!("valueExpression"in e)||!e.valueExpression))))return t("FeatureReductionCluster does not currently support visualVariables with a valueExpression. Support will be added in a future release"),!1}return!0};function v(e,i,t){switch(e){case"avg":case"avg_angle":return`cluster_avg_${i}`;case"mode":return`cluster_type_${i}`;case"norm":{const e=t,r="field",a=i.toLowerCase()+",norm:"+r+","+e.toLowerCase();return"cluster_avg_"+s(a)}}}function x(i,t){const{name:r,outStatistic:a}=t,{onStatisticField:n,onStatisticValueExpression:l,statisticType:u}=a;if(l){const e=s(l.toLowerCase());i.push({name:r,outStatistic:{onStatisticField:e,onStatisticValueExpression:l,statisticType:u}})}else n?i.push({name:r,outStatistic:{onStatisticField:n,statisticType:u}}):o.error(new e("mapview-unsupported-field","Unable to handle field",{field:t}))}function S(e,i,t){const r=s(i),a="mode"===t?`cluster_type_${r}`:`cluster_avg_${r}`;return e.some((e=>e.name===a))||e.push({name:a,outStatistic:{onStatisticField:r,onStatisticValueExpression:i,statisticType:t}}),a}function y(e,i,t,r){if("cluster_count"===i||e.some((e=>e.name===i)))return i;const s=v(t,i,r);return e.some((e=>e.name===s))||("norm"===t?e.push({name:s,outStatistic:{onStatisticField:i,onStatisticNormalizationField:r,statisticType:t}}):e.push({name:s,outStatistic:{onStatisticField:i,statisticType:t}})),s}export{f as createClusterCountSizeVariable,c as createClusterRenderer,d as findSizeVV,p as hasClusterCountVV,m as isClusterCompatibleRenderer};
5
+ import e from"../../../../core/Error.js";import i from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isNone as r}from"../../../../core/maybe.js";import{createMD5Hash as s}from"../../../../core/MD5.js";import a from"../../../../renderers/visualVariables/SizeVariable.js";import n from"../../../../renderers/visualVariables/support/SizeStop.js";import{LevelDependentSizeVariable as l}from"../../engine/LevelDependentSizeVariable.js";const o=t.getLogger("geoscene.views.2d.layers.support.clusterUtils");i.add("geoscene-cluster-arcade-enabled",!0);const u=i("geoscene-cluster-arcade-enabled"),c=(e,i,t,s)=>{const a=i.clone();if(!m(a))return a;if(t.fields)for(const r of t.fields)x(e,r);if("visualVariables"in a){const i=(a.visualVariables||[]).filter((e=>"$view.scale"!==e.valueExpression)),n=d(i);i.forEach((i=>{"rotation"===i.type?i.field?i.field=y(e,i.field,"avg_angle"):i.valueExpression&&(i.field=S(e,i.valueExpression,"avg_angle"),i.valueExpression=null):i.normalizationField?(i.field=y(e,i.field,"norm",i.normalizationField),i.normalizationField=null):i.field?i.field=y(e,i.field,"avg"):(i.field=S(e,i.valueExpression,"avg"),i.valueExpression=null)})),r(n)&&!p(i)&&(i.push(f(t,s)),a.dynamicClusterSize=!0),a.visualVariables=i}switch(a.type){case"simple":break;case"unique-value":a.field?a.field=y(e,a.field,"mode"):a.valueExpression&&(a.field=S(e,a.valueExpression,"mode"),a.valueExpression=null);break;case"class-breaks":a.normalizationField?(a.field=y(e,a.field,"norm",a.normalizationField),a.normalizationField=null):a.field?a.field=y(e,a.field,"avg"):(a.field=S(e,a.valueExpression,"avg"),a.valueExpression=null)}return a},d=e=>{for(const i of e)if("size"===i.type)return i;return null},p=e=>{for(const i of e)if("cluster_count"===i.field)return!0;return!1},f=(e,i)=>{const t=[new n({value:0,size:0}),new n({value:1})];if(r(i))return new a({field:"cluster_count",stops:[...t,new n({value:2,size:0})]});const s=Object.keys(i).reduce(((r,s)=>({...r,[s]:[...t,new n({value:Math.max(2,i[s].minValue),size:e.clusterMinSize}),new n({value:Math.max(3,i[s].maxValue),size:e.clusterMaxSize})]})),{});return new l({field:"cluster_count",levels:s})},m=i=>{const t=t=>o.error(new e("Unsupported-renderer",t,{renderer:i}));if("unique-value"===i.type){if(i.field2||i.field3)return t("FeatureReductionCluster does not support multi-field UniqueValueRenderers"),!1}else if("class-breaks"===i.type){if(i.normalizationField){const e=i.normalizationType;if("field"!==e)return t(`FeatureReductionCluster does not support a normalizationType of ${e}`),!1}}else if("simple"!==i.type)return t(`FeatureReductionCluster does not support renderers of type ${i.type}`),!1;if(!u){if("valueExpression"in i&&i.valueExpression)return t("FeatureReductionCluster does not currently support renderer.valueExpression. Support will be added in a future release"),!1;if(("visualVariables"in i&&i.visualVariables||[]).some((e=>!(!("valueExpression"in e)||!e.valueExpression))))return t("FeatureReductionCluster does not currently support visualVariables with a valueExpression. Support will be added in a future release"),!1}return!0};function v(e,i,t){switch(e){case"avg":case"avg_angle":return`cluster_avg_${i}`;case"mode":return`cluster_type_${i}`;case"norm":{const e=t,r="field",a=i.toLowerCase()+",norm:"+r+","+e.toLowerCase();return"cluster_avg_"+s(a)}}}function x(i,t){const{name:r,outStatistic:a}=t,{onStatisticField:n,onStatisticValueExpression:l,statisticType:u}=a;if(l){const e=s(l.toLowerCase());i.push({name:r,outStatistic:{onStatisticField:e,onStatisticValueExpression:l,statisticType:u}})}else n?i.push({name:r,outStatistic:{onStatisticField:n,statisticType:u}}):o.error(new e("mapview-unsupported-field","Unable to handle field",{field:t}))}function S(e,i,t){const r=s(i),a="mode"===t?`cluster_type_${r}`:`cluster_avg_${r}`;return e.some((e=>e.name===a))||e.push({name:a,outStatistic:{onStatisticField:r,onStatisticValueExpression:i,statisticType:t}}),a}function y(e,i,t,r){if("cluster_count"===i||e.some((e=>e.name===i)))return i;const s=v(t,i,r);return e.some((e=>e.name===s))||("norm"===t?e.push({name:s,outStatistic:{onStatisticField:i,onStatisticNormalizationField:r,statisticType:t}}):e.push({name:s,outStatistic:{onStatisticField:i,statisticType:t}})),s}export{f as createClusterCountSizeVariable,c as createClusterRenderer,d as findSizeVV,p as hasClusterCountVV,m as isClusterCompatibleRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as s}from"../../input/InputManager.js";const a={container:"esri-zoom-box__container",overlay:"esri-zoom-box__overlay",background:"esri-zoom-box__overlay-background",box:"esri-zoom-box__outline"},n={zoom:"Shift",counter:"Ctrl"};let h=class extends e{constructor(t){super(t),this._container=null,this._overlay=null,this._backgroundShape=null,this._boxShape=null,this._box={x:0,y:0,width:0,height:0},this._redraw=this._redraw.bind(this)}destroy(){this.view=null}set view(t){this._handles&&this._handles.forEach((t=>{t.remove()})),this._handles=null,this._destroyOverlay(),this._set("view",t),t&&(t.on("drag",[n.zoom],(t=>this._handleDrag(t,1)),s.INTERNAL),t.on("drag",[n.zoom,n.counter],(t=>this._handleDrag(t,-1)),s.INTERNAL))}_start(){this._createContainer(),this._createOverlay(),this.navigation.begin()}_update(t,e,r,i){this._box.x=t,this._box.y=e,this._box.width=r,this._box.height=i,this._rafId||(this._rafId=requestAnimationFrame(this._redraw))}_end(t,e,i,o,s){const a=this.view,n=a.toMap(r(t+.5*i,e+.5*o));let h=Math.max(i/a.width,o/a.height);-1===s&&(h=1/h),this._destroyOverlay(),this.navigation.end(),a.goTo({center:n,scale:a.scale*h})}_updateBox(t,e,r,i){const o=this._boxShape;o.setAttributeNS(null,"x",""+t),o.setAttributeNS(null,"y",""+e),o.setAttributeNS(null,"width",""+r),o.setAttributeNS(null,"height",""+i),o.setAttributeNS(null,"class",a.box)}_updateBackground(t,e,r,i){this._backgroundShape.setAttributeNS(null,"d",this._toSVGPath(t,e,r,i,this.view.width,this.view.height))}_createContainer(){const t=document.createElement("div");t.className=a.container,this.view.root.appendChild(t),this._container=t}_createOverlay(){const t=this.view.width,e=this.view.height,r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M 0 0 L "+t+" 0 L "+t+" "+e+" L 0 "+e+" Z"),r.setAttributeNS(null,"class",a.background);const i=document.createElementNS("http://www.w3.org/2000/svg","rect"),o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),o.setAttributeNS(null,"class",a.overlay),o.appendChild(r),o.appendChild(i),this._container.appendChild(o),this._backgroundShape=r,this._boxShape=i,this._overlay=o}_destroyOverlay(){this._container&&this._container.parentNode&&this._container.parentNode.removeChild(this._container),this._container=this._backgroundShape=this._boxShape=this._overlay=null}_toSVGPath(t,e,r,i,o,s){const a=t+r,n=e+i;return"M 0 0 L "+o+" 0 L "+o+" "+s+" L 0 "+s+" ZM "+t+" "+e+" L "+t+" "+n+" L "+a+" "+n+" L "+a+" "+e+" Z"}_handleDrag(t,e){const r=t.x,i=t.y,o=t.origin.x,s=t.origin.y;let a,n,h,l;switch(r>o?(a=o,h=r-o):(a=r,h=o-r),i>s?(n=s,l=i-s):(n=i,l=s-i),t.action){case"start":this._start();break;case"update":this._update(a,n,h,l);break;case"end":this._end(a,n,h,l,e)}t.stopPropagation()}_redraw(){if(!this._rafId)return;if(this._rafId=null,!this._overlay)return;const{x:t,y:e,width:r,height:i}=this._box;this._updateBox(t,e,r,i),this._updateBackground(t,e,r,i),this._rafId=requestAnimationFrame(this._redraw)}};t([i()],h.prototype,"navigation",void 0),t([i()],h.prototype,"view",null),h=t([o("geoscene.views.2d.navigation.ZoomBox")],h);const l=h;export{l as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{ViewEventPriorities as s}from"../../input/InputManager.js";const a={container:"geoscene-zoom-box__container",overlay:"geoscene-zoom-box__overlay",background:"geoscene-zoom-box__overlay-background",box:"geoscene-zoom-box__outline"},n={zoom:"Shift",counter:"Ctrl"};let h=class extends e{constructor(t){super(t),this._container=null,this._overlay=null,this._backgroundShape=null,this._boxShape=null,this._box={x:0,y:0,width:0,height:0},this._redraw=this._redraw.bind(this)}destroy(){this.view=null}set view(t){this._handles&&this._handles.forEach((t=>{t.remove()})),this._handles=null,this._destroyOverlay(),this._set("view",t),t&&(t.on("drag",[n.zoom],(t=>this._handleDrag(t,1)),s.INTERNAL),t.on("drag",[n.zoom,n.counter],(t=>this._handleDrag(t,-1)),s.INTERNAL))}_start(){this._createContainer(),this._createOverlay(),this.navigation.begin()}_update(t,e,r,i){this._box.x=t,this._box.y=e,this._box.width=r,this._box.height=i,this._rafId||(this._rafId=requestAnimationFrame(this._redraw))}_end(t,e,i,o,s){const a=this.view,n=a.toMap(r(t+.5*i,e+.5*o));let h=Math.max(i/a.width,o/a.height);-1===s&&(h=1/h),this._destroyOverlay(),this.navigation.end(),a.goTo({center:n,scale:a.scale*h})}_updateBox(t,e,r,i){const o=this._boxShape;o.setAttributeNS(null,"x",""+t),o.setAttributeNS(null,"y",""+e),o.setAttributeNS(null,"width",""+r),o.setAttributeNS(null,"height",""+i),o.setAttributeNS(null,"class",a.box)}_updateBackground(t,e,r,i){this._backgroundShape.setAttributeNS(null,"d",this._toSVGPath(t,e,r,i,this.view.width,this.view.height))}_createContainer(){const t=document.createElement("div");t.className=a.container,this.view.root.appendChild(t),this._container=t}_createOverlay(){const t=this.view.width,e=this.view.height,r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttributeNS(null,"d","M 0 0 L "+t+" 0 L "+t+" "+e+" L 0 "+e+" Z"),r.setAttributeNS(null,"class",a.background);const i=document.createElementNS("http://www.w3.org/2000/svg","rect"),o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),o.setAttributeNS(null,"class",a.overlay),o.appendChild(r),o.appendChild(i),this._container.appendChild(o),this._backgroundShape=r,this._boxShape=i,this._overlay=o}_destroyOverlay(){this._container&&this._container.parentNode&&this._container.parentNode.removeChild(this._container),this._container=this._backgroundShape=this._boxShape=this._overlay=null}_toSVGPath(t,e,r,i,o,s){const a=t+r,n=e+i;return"M 0 0 L "+o+" 0 L "+o+" "+s+" L 0 "+s+" ZM "+t+" "+e+" L "+t+" "+n+" L "+a+" "+n+" L "+a+" "+e+" Z"}_handleDrag(t,e){const r=t.x,i=t.y,o=t.origin.x,s=t.origin.y;let a,n,h,l;switch(r>o?(a=o,h=r-o):(a=r,h=o-r),i>s?(n=s,l=i-s):(n=i,l=s-i),t.action){case"start":this._start();break;case"update":this._update(a,n,h,l);break;case"end":this._end(a,n,h,l,e)}t.stopPropagation()}_redraw(){if(!this._rafId)return;if(this._rafId=null,!this._overlay)return;const{x:t,y:e,width:r,height:i}=this._box;this._updateBox(t,e,r,i),this._updateBackground(t,e,r,i),this._rafId=requestAnimationFrame(this._redraw)}};t([i()],h.prototype,"navigation",void 0),t([i()],h.prototype,"view",null),h=t([o("geoscene.views.2d.navigation.ZoomBox")],h);const l=h;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import e from"../../core/has.js";import{c as r}from"../../chunks/mat4f64.js";import{projectBuffer as n,computeTranslationToOriginAndRotation as t}from"../../geometry/projection.js";import o from"./externalRenderers/ExternalRendererStore.js";const i=new o;function s(e,r){i.add(e,r)}function d(e,r){i.remove(e,r)}function a(e){e._stage.renderView.requestRender()}function c(e,r,t,o,i,s,d){return o=o||e.spatialReference,n(r,o,t,i,e.renderCoordsHelper.spatialReference,s,d)?i:null}function f(e,r,t,o,i,s,d){return s=s||e.spatialReference,n(r,e.renderCoordsHelper.spatialReference,t,o,s,i,d)?o:null}function u(e,n,o,i){return i||(i=r()),o=o||e.spatialReference,t(o,n,i,e.renderCoordsHelper.spatialReference)?i:null}function l(e){return e.state.camera.clone()}function m(e){return{add:s.bind(this,e),remove:d.bind(this,e),requestRender:a.bind(this,e),toRenderCoordinates:c.bind(this,e),fromRenderCoordinates:f.bind(this,e),renderCoordinateTransformAt:u.bind(this,e)}}function p(r){e.add("esri-force-webgl",r)}export{s as add,m as bind,p as forceWebGLContext,f as fromRenderCoordinates,l as getRenderCamera,d as remove,u as renderCoordinateTransformAt,a as requestRender,c as toRenderCoordinates};
5
+ import e from"../../core/has.js";import{c as r}from"../../chunks/mat4f64.js";import{projectBuffer as n,computeTranslationToOriginAndRotation as t}from"../../geometry/projection.js";import o from"./externalRenderers/ExternalRendererStore.js";const i=new o;function s(e,r){i.add(e,r)}function d(e,r){i.remove(e,r)}function a(e){e._stage.renderView.requestRender()}function c(e,r,t,o,i,s,d){return o=o||e.spatialReference,n(r,o,t,i,e.renderCoordsHelper.spatialReference,s,d)?i:null}function f(e,r,t,o,i,s,d){return s=s||e.spatialReference,n(r,e.renderCoordsHelper.spatialReference,t,o,s,i,d)?o:null}function u(e,n,o,i){return i||(i=r()),o=o||e.spatialReference,t(o,n,i,e.renderCoordsHelper.spatialReference)?i:null}function l(e){return e.state.camera.clone()}function m(e){return{add:s.bind(this,e),remove:d.bind(this,e),requestRender:a.bind(this,e),toRenderCoordinates:c.bind(this,e),fromRenderCoordinates:f.bind(this,e),renderCoordinateTransformAt:u.bind(this,e)}}function p(r){e.add("geoscene-force-webgl",r)}export{s as add,m as bind,p as forceWebGLContext,f as fromRenderCoordinates,l as getRenderCamera,d as remove,u as renderCoordinateTransformAt,a as requestRender,c as toRenderCoordinates};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as m}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f}from"../../../core/reactiveUtils.js";import{schedule as b}from"../../../core/scheduling.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{init as v}from"../../../core/watchUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as E}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as N,g as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as P,localLinearScaleFactors as A,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as me}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as _e,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as be}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ye,selectEncoding as Ie,defaultMaterial as ve,createTexture as Me,configureMaterial as Ce}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as xe,NodeState as Oe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Se,getLocalOrigin as Ee}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as je,checkSceneLayerValid as we,checkSceneLayerCompatibleWithView as Ne,getCacheKeySuffix as De,whenGraphicAttributes as Re,computeVisibilityObb as Te,filterInPlace as Fe,getCachedAttributeValue as Pe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Ve,addWraparound as Ue,getSymbolInfo as He,transparentEdgeMaterial as Ge,getClipRect as Le}from"./i3s/I3SUtil.js";import{IDBCache as Be}from"./i3s/IDBCache.js";import{attributeLookup as ke}from"./support/attributeUtils.js";import{ColorMixModeEnum as qe}from"./support/symbolColorUtils.js";import ze from"../support/debugFlags.js";import{toBoundingRect as Ke}from"../support/extentUtils.js";import{create as We,clone as $e}from"../support/orientedBoundingBox.js";import{updatingProgress as Xe}from"../support/updatingProperties.js";import{glLayout as Ye}from"../support/buffer/glUtil.js";import{State as Qe}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as Ze}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as et}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as tt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const it=a.getLogger("geoscene.views.3d.layers.SceneLayerView3D"),st=[1,1,1,1];class rt extends ge{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ot;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ot||(ot={}));const at=19,nt=100*s.MEGABYTES,lt=t=>{let s=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new Be("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new _e(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return je(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ye(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new me(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),we(this.i3slayer),Ne(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new be({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),f),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([v(ze,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&ze.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||ze.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))})),v(ze,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=De(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>it.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=oe().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==xe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!ze.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&et()}_getVertexBufferLayout(e,t){const i={hasTexture:pt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ye(Je(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=ke(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=ke(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Re(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${at}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const o=null!=(r=null==e?void 0:e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)})))?r:[];return 0===o.length?Promise.resolve(!1):i(o,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=yt(s.transformedGeometry,s.textureData),s.textureData.every(bt)&&It(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>it.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return ft(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Se(e.mbs,this.elevationOffset,l,d);e.geometryObb=We([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),N(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:yt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&It(e,m)){const t=h(m.textureData)?m.textureData.map((e=>bt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>it.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Te(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ee(o,a,n),u=Se(o,a,n,d),m=P(n,l),_=P(l,d);if(c(m)||c(_))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:m,vertexToRenderProjector:_};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=$e(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Qe.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:n,globalTrafo:l}=t;await this.attributeOverrides.apply(a.featureIds,r.attributeInfo,i);const d=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&d.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await et(),e.memory=0;const{componentOffsets:u,geometries:_,featureIds:g}=a,p=this._collection,f=_[0],{layout:b,indices:y,interleavedVertexData:I,positionData:v,hasColors:M}=n,C=this._materialParameters(f,b),N=u||new Uint32Array([0,y?y.length:I.byteLength/b[0].stride]),D={vertices:{data:I,count:I.byteLength/b[0].stride,layoutParameters:C.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:y,componentOffsets:N},T=f.transformation?j(f.transformation):w();S(T,l,T);const F=E(R(),T),P=x(O(),T),U=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,G=R(),L=[1,1,1];A(F,U,L,H)||it.errorOnce("Unsupported coordinate system for IM overlay"),V(F,U,G,H);const B=p.createObject({toMapSpace:[G[0],G[1],L[0],L[1]],geometry:D,obb:m(e.geometryObb),transform:{position:F,rotationScale:P}}),k=C.geometryParams.textureCoordinates===Ze.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(B,C.material,d,k);e.memory+=this._memEstimateGeometryAdded(B),e.memory+=q.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!C.material.hasParametersFromSource,W="blend"!==C.material.alphaMode&&C.material.metallicRoughness.baseColorFactor[3]>=1,$=new rt(e,g,B,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);r.meta=$,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||M,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(h(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);p.setObjectVisibility(B,Qe.Visible),h(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){it.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ct(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:ve(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=pt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Me(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ce(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?Ze.Atlas:Ze.Default:Ze.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=Ke(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=Ke(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Fe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Pe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,gt,this.view.renderSpatialReference),Ae(t,gt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,dt),B(dt,ht),q(i,ht)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ve.INSIDE)return;if(r===Ve.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ct,i,t.objectHandle);Fe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={slicePlaneEnabled:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Ct(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Qe.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Oe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ue(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ue(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ue(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:it.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&it.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<ot.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<ot.CastShadows),i.pickable=0!=(t[s+4]&1<<ot.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=He(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:mt,castShadows:!0,pickable:!0,colorMixMode:qe.Multiply,edgeMaterial:null},u=this.fullOpacity,m=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let _=null,g=tt.OPAQUE,p=Ge,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Pe(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:_t,arcade:this._arcade});e&&(u=mt,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?de(u,y,e.color,e.alpha,st,mt):de(u,y,null,null,st,mt)}if(c(u)&&(u=mt,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:qe.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?tt.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===qe.Replace)?tt.OPAQUE:tt.TRANSPARENT;d.edgeMaterial===_&&t===g||(p={...d.edgeMaterial,opacity:m,objectTransparency:t},_=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Ge;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<ot.CastShadows|+d.pickable<<ot.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Ct(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ge)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ge:(s=s||t!==Ge,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Ct(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.slicePlaneEnabled=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ve.OUTSIDE)return re.CONTINUE;if(i===Ve.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Le(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Pe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof r&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>ke(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Mt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=b((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),re.CONTINUE)),null,se.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(!h(this._edgeView)||!e.cachedEdgeMaterials)return;Ct(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=vt(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==xe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M(Xe)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("geoscene.views.3d.layers.I3SMeshView3D")],s),s},dt=H(),ht=k(),ct=k(),ut=We(),mt=[0,0,0,0],_t=new t([0,0,0,0]),gt=[0,0,0,0];function pt(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function ft(e){return"geometryData"in e}function bt(e){return h(e)&&y(e.data)}function yt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&y(s.data)&&(i+=s.data.byteLength);return i}function It(e,t){return t.byteSize>nt?(it.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function vt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=ut,D(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Mt={remove(){},pause(){},resume(){}};function Ct(e,t){e.forEach((e=>e.opacity=t))}export{lt as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{ByteSizeUnit as s}from"../../../core/byteSizeEstimations.js";import r from"../../../core/Collection.js";import o from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u,unwrap as m}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f}from"../../../core/reactiveUtils.js";import{schedule as b}from"../../../core/scheduling.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{init as v}from"../../../core/watchUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as S,B as E}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{m as N,g as D}from"../../../chunks/vec3.js";import{c as R}from"../../../chunks/vec3f64.js";import{s as T}from"../../../chunks/vec4.js";import{projectBuffer as F,getProjectorName as P,localLinearScaleFactors as A,projectVectorToVector as V,projectBoundingSphere as U}from"../../../geometry/projection.js";import{create as H,empty as G,expandWithBuffer as L,toRect as B}from"../../../geometry/support/aaBoundingBox.js";import{create as k,intersects as q}from"../../../geometry/support/aaBoundingRect.js";import z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as K}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as W}from"../../../layers/support/layerUtils.js";import $ from"../../../layers/support/SceneModification.js";import{getColor as X,getOpacity as Y}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as Q}from"../../../support/arcadeOnDemand.js";import J from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as Z}from"../../../symbols/support/unitConversionUtils.js";import ee from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as te,toWasmModification as ie}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as se,ForAllFeaturesReturnType as re}from"./II3SMeshView3D.js";import{initialize as oe,setModificationsSync as ae,filterObbsForModificationsSync as ne,interpretObbModificationResults as le}from"./SceneLayerWorker.js";import{overrideColor as de}from"./graphics/graphicUtils.js";import{TextureUsage as he,TextureEncoding as ce}from"./i3s/enums.js";import ue from"./i3s/Highlights.js";import{I3SAttributeOverrides as me}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as _e,NodeCrossfadeMetaData as ge}from"./i3s/I3SCrossfadeHelper.js";import pe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as fe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as be}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as ye,selectEncoding as Ie,defaultMaterial as ve,createTexture as Me,configureMaterial as Ce}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as xe,NodeState as Oe}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Se,getLocalOrigin as Ee}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as je,checkSceneLayerValid as we,checkSceneLayerCompatibleWithView as Ne,getCacheKeySuffix as De,whenGraphicAttributes as Re,computeVisibilityObb as Te,filterInPlace as Fe,getCachedAttributeValue as Pe,intersectBoundingRectWithMbs as Ae,MbsIntersectResult as Ve,addWraparound as Ue,getSymbolInfo as He,transparentEdgeMaterial as Ge,getClipRect as Le}from"./i3s/I3SUtil.js";import{IDBCache as Be}from"./i3s/IDBCache.js";import{attributeLookup as ke}from"./support/attributeUtils.js";import{ColorMixModeEnum as qe}from"./support/symbolColorUtils.js";import ze from"../support/debugFlags.js";import{toBoundingRect as Ke}from"../support/extentUtils.js";import{create as We,clone as $e}from"../support/orientedBoundingBox.js";import{updatingProgress as Xe}from"../support/updatingProperties.js";import{glLayout as Ye}from"../support/buffer/glUtil.js";import{State as Qe}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as Je}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as Ze}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as et}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as tt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const it=a.getLogger("geoscene.views.3d.layers.SceneLayerView3D"),st=[1,1,1,1];class rt extends ge{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ot;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ot||(ot={}));const at=19,nt=100*s.MEGABYTES,lt=t=>{let s=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=new Be("geoscene-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new _e(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return je(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?he.AllTexturesPBR:he.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?he.GeometryTexturesPBR:he.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=Z(e.unit);return l(e.offset,0)*i/t}return 0}get supportedTextureEncodings(){return ye(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var e;const t=null==(e=this.view)?void 0:e.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,i=0==(this.supportedTextureEncodings&ce.DDS_S3TC);return t&&i}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new me(this.i3slayer,e.memoryController),this._worker=new te((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),we(this.i3slayer),Ne(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new z({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ue({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,se.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new be({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new pe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),f),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([v(ze,"I3S_TREE_SHOW_TILES",(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&ze.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||ze.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))})),v(ze,"I3S_SHOW_MODIFICATIONS",(()=>this._showModifications()))]),this._cacheKeySuffix=De(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>it.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=d(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(W(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ee({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=oe().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=ie(this._layerClippingArea,this._modifications,t);ae({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?this._nodeId2Meta.delete(t):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==xe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),this._nodeId2Meta.delete(e.index),h(t)&&this._nodeId2MetaReloading.set(e.index,t)}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!ze.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!o("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ce.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&et()}_getVertexBufferLayout(e,t){const i={hasTexture:pt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ye(Je(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=ke(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=ke(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(c(i))return Promise.reject();const s=i.objectHandle,r=fe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(F(r,o,0,r,a,0,8)){const e=G();return L(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Re(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${at}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){var r;const o=null!=(r=null==e?void 0:e.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=Ie(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)})))?r:[];return 0===o.length?Promise.resolve(!1):i(o,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=yt(s.transformedGeometry,s.textureData),s.textureData.every(bt)&&It(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>it.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return ft(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Se(e.mbs,this.elevationOffset,l,d);e.geometryObb=We([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),N(e.geometryObb.center,e.geometryObb.center,u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:e.geometryObb,byteSize:yt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&It(e,m)){const t=h(m.textureData)?m.textureData.map((e=>bt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>it.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Te(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ee(o,a,n),u=Se(o,a,n,d),m=P(n,l),_=P(l,d);if(c(m)||c(_))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:m,vertexToRenderProjector:_};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){var e,t;return!(null!=(e=this.view)&&null!=(t=e._stage)&&t.renderView.hasShadowsEnabled)}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=$e(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,Qe.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){var s;if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const r=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:n,globalTrafo:l}=t;await this.attributeOverrides.apply(a.featureIds,r.attributeInfo,i);const d=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!o("disable-feature:i3s-basis")&&d.some((e=>h(e)&&(e.encoding===ce.Basis||e.encoding===ce.KTX2)))&&await et(),e.memory=0;const{componentOffsets:u,geometries:_,featureIds:g}=a,p=this._collection,f=_[0],{layout:b,indices:y,interleavedVertexData:I,positionData:v,hasColors:M}=n,C=this._materialParameters(f,b),N=u||new Uint32Array([0,y?y.length:I.byteLength/b[0].stride]),D={vertices:{data:I,count:I.byteLength/b[0].stride,layoutParameters:C.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:y,componentOffsets:N},T=f.transformation?j(f.transformation):w();S(T,l,T);const F=E(R(),T),P=x(O(),T),U=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,G=R(),L=[1,1,1];A(F,U,L,H)||it.errorOnce("Unsupported coordinate system for IM overlay"),V(F,U,G,H);const B=p.createObject({toMapSpace:[G[0],G[1],L[0],L[1]],geometry:D,obb:m(e.geometryObb),transform:{position:F,rotationScale:P}}),k=C.geometryParams.textureCoordinates===Ze.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(B,C.material,d,k);e.memory+=this._memEstimateGeometryAdded(B),e.memory+=q.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!C.material.hasParametersFromSource,W="blend"!==C.material.alphaMode&&C.material.metallicRoughness.baseColorFactor[3]>=1,$=new rt(e,g,B,this._getInvalidRendererVersion(),r.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);r.meta=$,!this._hasTextures&&null!=(s=t.requiredTextures)&&s.some((({usage:e})=>0!=(e&he.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||M,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(h(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(h(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);p.setObjectVisibility(B,Qe.Visible),h(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||h(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(r.meta)&&(this._cacheGPUData(r.meta),r.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){it.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Ct(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:ve(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=pt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Me(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ce(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?Ze.Atlas:Ze.Default:Ze.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=k();this._renderClippingArea=Ke(this.view.clippingArea,i,e)?i:null;const s=k();this._layerClippingArea=Ke(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Fe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Pe(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return U(e.node.mbs,this._controller.crsIndex,gt,this.view.renderSpatialReference),Ae(t,gt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,dt),B(dt,ht),q(i,ht)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ve.INSIDE)return;if(r===Ve.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(ct,i,t.objectHandle);Fe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={slicePlaneEnabled:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Ct(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,Qe.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Oe.Hole))}_invalidateAllSymbols(){this._rendererVersion=Ue(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Ue(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Ue(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await Q()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:it.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&it.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(e,i)=>{const s=5*e;T(i.externalColor,t[s+0]/255,t[s+1]/255,t[s+2]/255,t[s+3]/255),i.externalColorMixMode=t[s+4]&(1<<ot.CastShadows)-1,i.castShadows=0!=(t[s+4]&1<<ot.CastShadows),i.pickable=0!=(t[s+4]&1<<ot.Pickable)}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof J))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=He(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?K(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&h(this._symbologyFields))for(const h of this._symbologyFields){const e=r[h];e&&(n.push(h),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:mt,castShadows:!0,pickable:!0,colorMixMode:qe.Multiply,edgeMaterial:null},u=this.fullOpacity,m=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let _=null,g=tt.OPAQUE,p=Ge,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Pe(l[e],b);const r=this._getSymbolInfo(s,t);let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=X(this._colorVariable,t,{color:_t,arcade:this._arcade});e&&(u=mt,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=Y(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?de(u,y,e.color,e.alpha,st,mt):de(u,y,null,null,st,mt)}if(c(u)&&(u=mt,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:qe.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?tt.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===qe.Replace)?tt.OPAQUE:tt.TRANSPARENT;d.edgeMaterial===_&&t===g||(p={...d.edgeMaterial,opacity:m,objectTransparency:t},_=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Ge;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<ot.CastShadows|+d.pickable<<ot.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Ct(t,this.fullOpacity),c(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ge)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ge:(s=s||t!==Ge,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Ct(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.slicePlaneEnabled=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.slicePlaneEnabled=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{c(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=se.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case re.EXIT:return!0;case re.SKIP:return!1}}let r=re.CONTINUE;switch(i){case se.ALL:r=this._forAllFeaturesOfNode(s,e);break;case se.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case se.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===re.EXIT}))}_forAllFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===re.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=re.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===re.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ve.OUTSIDE)return re.CONTINUE;if(i===Ve.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=re.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Le(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===re.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=Pe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof r&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>ke(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Mt}_visibleGeometryChanged(e){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=b((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),re.CONTINUE)),null,se.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(!h(this._edgeView)||!e.cachedEdgeMaterials)return;Ct(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=vt(e);if(h(s)){const t={context:i,buffer:s.buffer};ne(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=le(i);e.imModificationImpact=s,s!==xe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}};return e([M()],s.prototype,"_hasLoadedPBRTextures",void 0),e([M()],s.prototype,"_asyncModuleLoading",void 0),e([M()],s.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],s.prototype,"view",void 0),e([M()],s.prototype,"i3slayer",void 0),e([M()],s.prototype,"_controller",void 0),e([M()],s.prototype,"_labeler",void 0),e([M()],s.prototype,"updating",void 0),e([M()],s.prototype,"suspended",void 0),e([M()],s.prototype,"holeFilling",void 0),e([M(Xe)],s.prototype,"updatingProgress",void 0),e([M({readOnly:!0,aliasOf:"_controller.updatingProgress"})],s.prototype,"updatingProgressValue",void 0),e([M({readOnly:!0})],s.prototype,"hasTexturesOrVertexColors",null),e([M({readOnly:!0})],s.prototype,"rendererTextureUsage",null),e([M()],s.prototype,"filter",void 0),e([M({readOnly:!0})],s.prototype,"elevationOffset",null),e([M({type:Boolean})],s.prototype,"slicePlaneEnabled",void 0),e([M()],s.prototype,"supportedTextureEncodings",null),e([M()],s.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[$]})],s.prototype,"_modifications",void 0),s=e([C("geoscene.views.3d.layers.I3SMeshView3D")],s),s},dt=H(),ht=k(),ct=k(),ut=We(),mt=[0,0,0,0],_t=new t([0,0,0,0]),gt=[0,0,0,0];function pt(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function ft(e){return"geometryData"in e}function bt(e){return h(e)&&y(e.data)}function yt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&y(s.data)&&(i+=s.data.byteLength);return i}function It(e,t){return t.byteSize>nt?(it.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function vt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=ut,D(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Mt={remove(){},pause(){},resume(){}};function Ct(e,t){e.forEach((e=>e.opacity=t))}export{lt as I3SMeshView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import i from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as o,disposeMaybe as n,isSome as a,isNone as p}from"../../../../core/maybe.js";import{addFrameTask as h}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as c}from"../../../../core/watchUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{ComponentObjectCollection as u}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueRepository as _}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{autoDispose as f,AutoDisposableMixin as g}from"../lib/AutoDisposable.js";import{RenderRequestType as y,Decorations as R}from"../lib/basicInterfaces.js";import x from"../lib/CompositingHelper.js";import{textureToDepth as b}from"../lib/depthRangeUtils.js";import{GLMaterialRepository as v}from"../lib/GLMaterialRepository.js";import{MagnifierHelper as w}from"../lib/MagnifierHelper.js";import{Renderer as C}from"../lib/Renderer.js";import{RenderingContext as T}from"../lib/RenderingContext.js";import{TextureRepository as U}from"../lib/TextureRepository.js";import{StippleTextureRepository as j}from"../materials/StippleTextureRepository.js";import{WaterTextureRepository as A}from"../materials/internal/WaterTextureRepository.js";import{removeLoadedShaderModules as S}from"./requireUtils.js";import{ScreenshotManager as q}from"./ScreenshotManager.js";import{createContextOrErrorHTML as M}from"../../../webgl/context-util.js";const O=s.getLogger("geoscene.views.3d.webgl-engine.parts.View");let D=class extends(g(t)){constructor(e){super({}),this.events=new r,this.waterTextureRepository=new A,this._magnifierHelper=new w,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this._container=e.container,this._initializeContext(e),c(this.waterTextureRepository,"loadingState",(()=>this.requestRender())),this._magnifierHelper.events.on("request-render",(()=>this.requestRender())),this._stippleTextureRepository=new j(this._rctx),this._shaderTechniqueRepository=new _({rctx:this._rctx,viewingMode:e.viewingMode,stippleTextureRepository:this._stippleTextureRepository,waterTextureRepository:this.waterTextureRepository}),this._textureRepository=new U(e,this._shaderTechniqueRepository,this._rctx),this._textureRepository.events.on("changed",(e=>this.requestRender(e))),this._materialRepository=new v(this._textureRepository,this._shaderTechniqueRepository,(()=>this.requestRender()),(()=>this.requestRender())),this._compositingHelper=new x(this._rctx,this._shaderTechniqueRepository),this._renderer=new C(this._materialRepository,this._textureRepository,this._shaderTechniqueRepository,this._rctx,this._compositingHelper,this._magnifierHelper,(e=>this.requestRender(e)),((t,r)=>e.schedule(t,r)),e),this._screenshotManager=new q(this._rctx,((e,t,r)=>this._renderer.render(e,t,t,r)),(e=>this.requestRender(e)),e.options.screenshot.renderOverlay,(e=>this.events.emit("force-camera-for-screenshot",e)),(()=>this._renderer.disposeOffscreenBuffers())),this._registerFrameTask(e)}normalizeCtorArgs(){return{}}dispose(){this._container.contains(this._canvas)&&this._container.removeChild(this._canvas),this._frameTask=o(this._frameTask),this._shaderTechniqueRepository=n(this._shaderTechniqueRepository),super.dispose(),this._tmpDepthBuffer=null,this._rctx=null}get performanceInfo(){const e=this._rctx.gl;return{renderer:this._renderer.performanceInfo,textureMemory:void 0!==e.getUsedTextureMemory?e.getUsedTextureMemory():void 0,renderbufferMemory:void 0!==e.getUsedRenderbufferMemory?e.getUsedRenderbufferMemory():void 0,VBOMemory:void 0!==e.getUsedVBOMemory?e.getUsedVBOMemory():void 0}}requestRender(e=y.UPDATE){e===y.UPDATE?this._needsUpdate=!0:this._needsRender=!0}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this._renderer.updating||this._textureRepository.updating||this.waterTextureRepository.updating||this._magnifierHelper.updating}ensureEdgeView(){return this._renderer.ensureEdgeView()}get edgeView(){return this._renderer.edgeView}get textureRepository(){return this._textureRepository}get compositingHelper(){return this._compositingHelper}set magnifier(e){this._magnifierHelper.magnifier=e}updateLightSources(e,t,r){this._renderer.updateLightSources(e,t,r),this.requestRender()}setRenderParameters(e){void 0!==e.idleSuspend&&this._idleSuspend!==!!e.idleSuspend&&(this._idleSuspend=!!e.idleSuspend,this.requestRender()),this._renderer.setRenderParameters(e)}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}modify(e){this._renderer.modify(e),e.clear()}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e)}get hasShadowsEnabled(){return this._renderer.hasShadowsEnabled}readAccumulatedShadow(e){return this._renderer.readAccumulatedShadow(e[0],e[1])}getMinimalDepthForArea(e,t,r,i,s,o=s){const n=i.constrainWindowSize(t,r,s*i.pixelRatio,o*i.pixelRatio),p=this._ensureDepthBuffer(n);this._renderer.readDepthPixels(i,n[0],n[1],n[2],n[3],p);let h=Number.MAX_VALUE;for(let a=0;a<n[2]*n[3];a++){const e=b(4*a,p,i.nearFar);h>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(h=e)}if(a(e)){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);a(s)&&h>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(h=s)}return h===Number.MAX_VALUE?void 0:h}_ensureDepthBuffer(e){const t=4*e[2]*e[3];return(p(this._tmpDepthBuffer)||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}get renderPlugins(){return this._renderer.renderPlugins}get test(){return{renderer:this._renderer}}get gpuMemoryUsage(){return this._renderer.gpuMemoryUsage}async reloadShaders(){S(),await this._shaderTechniqueRepository.reloadAll(),this.requestRender()}get animationTimestep(){return this._renderer.animationTimestep}_registerFrameTask(e){const t=e.state,r={viewCamera:t.camera,frameHasDecorations:!1};let i=!1,s=y.BACKGROUND,o=!1;const n={preRender:r=>{i=this.updating,s=this._needsUpdate?y.UPDATE:y.BACKGROUND,e.processSyncLayers();const o=d(r.time-this._lastAnimationUpdate);(o>this.animationTimestep||a(this.forcedAnimationTime)||i||this._needsRender)&&(this._renderer.updateAnimation({camera:t.camera,dt:o,forcedTime:this.forcedAnimationTime})&&this.requestRender(y.BACKGROUND),this._lastAnimationUpdate=r.time)},render:()=>{if((this._needsUpdate||this._needsRender||!this._idleSuspend||!this._renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const e=this._needsUpdate&&this._idleSuspend&&this._renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this._renderer.render(null,t.camera,t.contentCamera,R.ON),o=!0,e&&this._renderer.hasWaterReflection&&(this.requestRender(y.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:()=>{r.viewCamera=t.camera,r.frameHasDecorations=this._renderer.hasSlicePlane||this._magnifierHelper.enabled,this._textureRepository.update(),this._screenshotManager.update(r)},finish:()=>{o&&(this._renderer.finish(s),o=!1)}};this._frameTask=h(n)}_initializeContext(e){const t=e.options;this._canvas=t.canvas,this._canvas||(this._canvas=document.createElement("canvas")),this._canvas.setAttribute("style","width: 100%; height:100%; display:block;");const r={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:null==t.stencil||t.stencil,powerPreference:"high-performance"},s=M("3d",this._canvas,r);if(p(s)){const e=i("esri-force-webgl");O.error(e)}else this._rctx=this._newRenderingContext(s,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&O.error("WebGL context has alpha channel even though no alpha channel was requested"),!this._rctx.contextAttributes.alpha&&i("safari")>=11&&(this._container.style.backgroundColor="black"),this._container.appendChild(this._canvas)}_newRenderingContext(e,t){const r={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8},i=(e,r)=>t.resourceController.memoryController.newCache(e,r);if(E.enableContextCache){let t=H.get(e);return t?(t.configure(r),t.newCache=i,t.ref(),t):(t=new T(e,r,i),H.set(e,t),t.ref(),t)}return new T(e,r,i)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("standardDerivatives"),this._rctx.capabilities.enable("shaderTextureLOD"),this._rctx.capabilities.enable("textureFloat")}get componentObjectCollection(){return p(this._componentObjectCollection)&&(this._componentObjectCollection=new u(this._renderer.renderPassManager)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}};e([l({type:Boolean,readOnly:!0})],D.prototype,"updating",null),e([f()],D.prototype,"_rctx",void 0),e([f()],D.prototype,"_container",void 0),e([f()],D.prototype,"_canvas",void 0),e([f()],D.prototype,"_stippleTextureRepository",void 0),e([f(),l()],D.prototype,"waterTextureRepository",void 0),e([f(),l()],D.prototype,"_magnifierHelper",void 0),e([f(),l()],D.prototype,"_textureRepository",void 0),e([f()],D.prototype,"_compositingHelper",void 0),e([f()],D.prototype,"_renderer",void 0),e([f()],D.prototype,"_screenshotManager",void 0),e([f()],D.prototype,"componentObjectCollection",null),e([f()],D.prototype,"_componentObjectCollection",void 0),e([l()],D.prototype,"_needsUpdate",void 0),e([l()],D.prototype,"_needsWaterReflectionUpdate",void 0),D=e([m("geoscene.views.3d.webgl-engine.parts.RenderView")],D);const E={enableContextCache:!1,disposeContextCache:()=>{H.forEach((e=>e.dispose())),H.clear()}},H=new Map;export{D as RenderView,E as test};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import i from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{removeMaybe as o,disposeMaybe as n,isSome as a,isNone as p}from"../../../../core/maybe.js";import{addFrameTask as h}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{init as c}from"../../../../core/watchUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{ComponentObjectCollection as u}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueRepository as _}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{autoDispose as f,AutoDisposableMixin as g}from"../lib/AutoDisposable.js";import{RenderRequestType as y,Decorations as R}from"../lib/basicInterfaces.js";import x from"../lib/CompositingHelper.js";import{textureToDepth as b}from"../lib/depthRangeUtils.js";import{GLMaterialRepository as v}from"../lib/GLMaterialRepository.js";import{MagnifierHelper as w}from"../lib/MagnifierHelper.js";import{Renderer as C}from"../lib/Renderer.js";import{RenderingContext as T}from"../lib/RenderingContext.js";import{TextureRepository as U}from"../lib/TextureRepository.js";import{StippleTextureRepository as j}from"../materials/StippleTextureRepository.js";import{WaterTextureRepository as A}from"../materials/internal/WaterTextureRepository.js";import{removeLoadedShaderModules as S}from"./requireUtils.js";import{ScreenshotManager as q}from"./ScreenshotManager.js";import{createContextOrErrorHTML as M}from"../../../webgl/context-util.js";const O=s.getLogger("geoscene.views.3d.webgl-engine.parts.View");let D=class extends(g(t)){constructor(e){super({}),this.events=new r,this.waterTextureRepository=new A,this._magnifierHelper=new w,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this._container=e.container,this._initializeContext(e),c(this.waterTextureRepository,"loadingState",(()=>this.requestRender())),this._magnifierHelper.events.on("request-render",(()=>this.requestRender())),this._stippleTextureRepository=new j(this._rctx),this._shaderTechniqueRepository=new _({rctx:this._rctx,viewingMode:e.viewingMode,stippleTextureRepository:this._stippleTextureRepository,waterTextureRepository:this.waterTextureRepository}),this._textureRepository=new U(e,this._shaderTechniqueRepository,this._rctx),this._textureRepository.events.on("changed",(e=>this.requestRender(e))),this._materialRepository=new v(this._textureRepository,this._shaderTechniqueRepository,(()=>this.requestRender()),(()=>this.requestRender())),this._compositingHelper=new x(this._rctx,this._shaderTechniqueRepository),this._renderer=new C(this._materialRepository,this._textureRepository,this._shaderTechniqueRepository,this._rctx,this._compositingHelper,this._magnifierHelper,(e=>this.requestRender(e)),((t,r)=>e.schedule(t,r)),e),this._screenshotManager=new q(this._rctx,((e,t,r)=>this._renderer.render(e,t,t,r)),(e=>this.requestRender(e)),e.options.screenshot.renderOverlay,(e=>this.events.emit("force-camera-for-screenshot",e)),(()=>this._renderer.disposeOffscreenBuffers())),this._registerFrameTask(e)}normalizeCtorArgs(){return{}}dispose(){this._container.contains(this._canvas)&&this._container.removeChild(this._canvas),this._frameTask=o(this._frameTask),this._shaderTechniqueRepository=n(this._shaderTechniqueRepository),super.dispose(),this._tmpDepthBuffer=null,this._rctx=null}get performanceInfo(){const e=this._rctx.gl;return{renderer:this._renderer.performanceInfo,textureMemory:void 0!==e.getUsedTextureMemory?e.getUsedTextureMemory():void 0,renderbufferMemory:void 0!==e.getUsedRenderbufferMemory?e.getUsedRenderbufferMemory():void 0,VBOMemory:void 0!==e.getUsedVBOMemory?e.getUsedVBOMemory():void 0}}requestRender(e=y.UPDATE){e===y.UPDATE?this._needsUpdate=!0:this._needsRender=!0}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this._renderer.updating||this._textureRepository.updating||this.waterTextureRepository.updating||this._magnifierHelper.updating}ensureEdgeView(){return this._renderer.ensureEdgeView()}get edgeView(){return this._renderer.edgeView}get textureRepository(){return this._textureRepository}get compositingHelper(){return this._compositingHelper}set magnifier(e){this._magnifierHelper.magnifier=e}updateLightSources(e,t,r){this._renderer.updateLightSources(e,t,r),this.requestRender()}setRenderParameters(e){void 0!==e.idleSuspend&&this._idleSuspend!==!!e.idleSuspend&&(this._idleSuspend=!!e.idleSuspend,this.requestRender()),this._renderer.setRenderParameters(e)}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}modify(e){this._renderer.modify(e),e.clear()}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e)}get hasShadowsEnabled(){return this._renderer.hasShadowsEnabled}readAccumulatedShadow(e){return this._renderer.readAccumulatedShadow(e[0],e[1])}getMinimalDepthForArea(e,t,r,i,s,o=s){const n=i.constrainWindowSize(t,r,s*i.pixelRatio,o*i.pixelRatio),p=this._ensureDepthBuffer(n);this._renderer.readDepthPixels(i,n[0],n[1],n[2],n[3],p);let h=Number.MAX_VALUE;for(let a=0;a<n[2]*n[3];a++){const e=b(4*a,p,i.nearFar);h>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(h=e)}if(a(e)){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);a(s)&&h>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(h=s)}return h===Number.MAX_VALUE?void 0:h}_ensureDepthBuffer(e){const t=4*e[2]*e[3];return(p(this._tmpDepthBuffer)||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}get renderPlugins(){return this._renderer.renderPlugins}get test(){return{renderer:this._renderer}}get gpuMemoryUsage(){return this._renderer.gpuMemoryUsage}async reloadShaders(){S(),await this._shaderTechniqueRepository.reloadAll(),this.requestRender()}get animationTimestep(){return this._renderer.animationTimestep}_registerFrameTask(e){const t=e.state,r={viewCamera:t.camera,frameHasDecorations:!1};let i=!1,s=y.BACKGROUND,o=!1;const n={preRender:r=>{i=this.updating,s=this._needsUpdate?y.UPDATE:y.BACKGROUND,e.processSyncLayers();const o=d(r.time-this._lastAnimationUpdate);(o>this.animationTimestep||a(this.forcedAnimationTime)||i||this._needsRender)&&(this._renderer.updateAnimation({camera:t.camera,dt:o,forcedTime:this.forcedAnimationTime})&&this.requestRender(y.BACKGROUND),this._lastAnimationUpdate=r.time)},render:()=>{if((this._needsUpdate||this._needsRender||!this._idleSuspend||!this._renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const e=this._needsUpdate&&this._idleSuspend&&this._renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this._renderer.render(null,t.camera,t.contentCamera,R.ON),o=!0,e&&this._renderer.hasWaterReflection&&(this.requestRender(y.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:()=>{r.viewCamera=t.camera,r.frameHasDecorations=this._renderer.hasSlicePlane||this._magnifierHelper.enabled,this._textureRepository.update(),this._screenshotManager.update(r)},finish:()=>{o&&(this._renderer.finish(s),o=!1)}};this._frameTask=h(n)}_initializeContext(e){const t=e.options;this._canvas=t.canvas,this._canvas||(this._canvas=document.createElement("canvas")),this._canvas.setAttribute("style","width: 100%; height:100%; display:block;");const r={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:null==t.stencil||t.stencil,powerPreference:"high-performance"},s=M("3d",this._canvas,r);if(p(s)){const e=i("geoscene-force-webgl");O.error(e)}else this._rctx=this._newRenderingContext(s,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&O.error("WebGL context has alpha channel even though no alpha channel was requested"),!this._rctx.contextAttributes.alpha&&i("safari")>=11&&(this._container.style.backgroundColor="black"),this._container.appendChild(this._canvas)}_newRenderingContext(e,t){const r={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8},i=(e,r)=>t.resourceController.memoryController.newCache(e,r);if(E.enableContextCache){let t=H.get(e);return t?(t.configure(r),t.newCache=i,t.ref(),t):(t=new T(e,r,i),H.set(e,t),t.ref(),t)}return new T(e,r,i)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("standardDerivatives"),this._rctx.capabilities.enable("shaderTextureLOD"),this._rctx.capabilities.enable("textureFloat")}get componentObjectCollection(){return p(this._componentObjectCollection)&&(this._componentObjectCollection=new u(this._renderer.renderPassManager)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}};e([l({type:Boolean,readOnly:!0})],D.prototype,"updating",null),e([f()],D.prototype,"_rctx",void 0),e([f()],D.prototype,"_container",void 0),e([f()],D.prototype,"_canvas",void 0),e([f()],D.prototype,"_stippleTextureRepository",void 0),e([f(),l()],D.prototype,"waterTextureRepository",void 0),e([f(),l()],D.prototype,"_magnifierHelper",void 0),e([f(),l()],D.prototype,"_textureRepository",void 0),e([f()],D.prototype,"_compositingHelper",void 0),e([f()],D.prototype,"_renderer",void 0),e([f()],D.prototype,"_screenshotManager",void 0),e([f()],D.prototype,"componentObjectCollection",null),e([f()],D.prototype,"_componentObjectCollection",void 0),e([l()],D.prototype,"_needsUpdate",void 0),e([l()],D.prototype,"_needsWaterReflectionUpdate",void 0),D=e([m("geoscene.views.3d.webgl-engine.parts.RenderView")],D);const E={enableContextCache:!1,disposeContextCache:()=>{H.forEach((e=>e.dispose())),H.clear()}},H=new Map;export{D as RenderView,E as test};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import i from"../core/ArrayPool.js";import s from"../core/Handles.js";import{destroyMaybe as a}from"../core/maybe.js";import{watch as t,initial as r}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";const n={widthBreakpoint:{getValue(e){const i=e.viewSize[0],s=e.breakpoints,a=this.values;return i<=s.xsmall?a.xsmall:i<=s.small?a.small:i<=s.medium?a.medium:i<=s.large?a.large:a.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"esri-view-width-xsmall esri-view-width-less-than-small esri-view-width-less-than-medium esri-view-width-less-than-large esri-view-width-less-than-xlarge",small:"esri-view-width-small esri-view-width-greater-than-xsmall esri-view-width-less-than-medium esri-view-width-less-than-large esri-view-width-less-than-xlarge",medium:"esri-view-width-medium esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-less-than-large esri-view-width-less-than-xlarge",large:"esri-view-width-large esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-greater-than-medium esri-view-width-less-than-xlarge",xlarge:"esri-view-width-xlarge esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-greater-than-medium esri-view-width-greater-than-large"}},heightBreakpoint:{getValue(e){const i=e.viewSize[1],s=e.breakpoints,a=this.values;return i<=s.xsmall?a.xsmall:i<=s.small?a.small:i<=s.medium?a.medium:i<=s.large?a.large:a.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"esri-view-height-xsmall esri-view-height-less-than-small esri-view-height-less-than-medium esri-view-height-less-than-large esri-view-height-less-than-xlarge",small:"esri-view-height-small esri-view-height-greater-than-xsmall esri-view-height-less-than-medium esri-view-height-less-than-large esri-view-height-less-than-xlarge",medium:"esri-view-height-medium esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-less-than-large esri-view-height-less-than-xlarge",large:"esri-view-height-large esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-greater-than-medium esri-view-height-less-than-xlarge",xlarge:"esri-view-height-xlarge esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-greater-than-medium esri-view-height-greater-than-large"}},orientation:{getValue(e){const i=e.viewSize,s=i[0],a=i[1],t=this.values;return a>=s?t.portrait:t.landscape},values:{portrait:"portrait",landscape:"landscape"},valueToClassName:{portrait:"esri-view-orientation-portrait",landscape:"esri-view-orientation-landscape"}}},o={xsmall:544,small:768,medium:992,large:1200};function m(e){const i=e;return i&&i.xsmall<i.small&&i.small<i.medium&&i.medium<i.large}function g(e,i){return i?n[e].valueToClassName[i].split(" "):[]}const w=w=>{let d=class extends w{constructor(...e){super(...e),this._breakpointsHandles=new s,this.orientation=null,this.widthBreakpoint=null,this.heightBreakpoint=null,this.breakpoints=o}initialize(){this._breakpointsHandles.add(t((()=>[this.breakpoints,this.size]),(()=>this._updateClassNames()),r))}destroy(){this.destroyed||(this._removeActiveClassNames(),this._breakpointsHandles=a(this._breakpointsHandles))}set breakpoints(e){if(e===this._get("breakpoints"))return;const i=m(e);if(!i){const e=JSON.stringify(o,null,2);console.warn("provided breakpoints are not valid, using defaults:"+e)}e=i?e:o,this._set("breakpoints",{...e})}_updateClassNames(){if(!this.container)return;const e=i.acquire(),s=i.acquire();let a,t=!1;for(a in n){const i=this[a],r=n[a].getValue({viewSize:this.size,breakpoints:this.breakpoints});i!==r&&(t=!0,this[a]=r,g(a,i).forEach((e=>s.push(e))),g(a,r).forEach((i=>e.push(i))))}t&&(this._applyClassNameChanges(e,s),i.release(e),i.release(s))}_applyClassNameChanges(e,i){const s=this.container;s&&(i.forEach((e=>s.classList.remove(e))),e.forEach((e=>s.classList.add(e))))}_removeActiveClassNames(){const e=this.container;if(!e)return;let i;for(i in n)g(i,this[i]).forEach((i=>e.classList.remove(i)))}};return e([l()],d.prototype,"breakpoints",null),e([l()],d.prototype,"orientation",void 0),e([l()],d.prototype,"widthBreakpoint",void 0),e([l()],d.prototype,"heightBreakpoint",void 0),d=e([h("geoscene.views.BreakpointsOwner")],d),d};export{w as BreakpointsOwner};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import i from"../core/ArrayPool.js";import s from"../core/Handles.js";import{destroyMaybe as a}from"../core/maybe.js";import{watch as t,initial as r}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";const n={widthBreakpoint:{getValue(e){const i=e.viewSize[0],s=e.breakpoints,a=this.values;return i<=s.xsmall?a.xsmall:i<=s.small?a.small:i<=s.medium?a.medium:i<=s.large?a.large:a.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"geoscene-view-width-xsmall geoscene-view-width-less-than-small geoscene-view-width-less-than-medium geoscene-view-width-less-than-large geoscene-view-width-less-than-xlarge",small:"geoscene-view-width-small geoscene-view-width-greater-than-xsmall geoscene-view-width-less-than-medium geoscene-view-width-less-than-large geoscene-view-width-less-than-xlarge",medium:"geoscene-view-width-medium geoscene-view-width-greater-than-xsmall geoscene-view-width-greater-than-small geoscene-view-width-less-than-large geoscene-view-width-less-than-xlarge",large:"geoscene-view-width-large geoscene-view-width-greater-than-xsmall geoscene-view-width-greater-than-small geoscene-view-width-greater-than-medium geoscene-view-width-less-than-xlarge",xlarge:"geoscene-view-width-xlarge geoscene-view-width-greater-than-xsmall geoscene-view-width-greater-than-small geoscene-view-width-greater-than-medium geoscene-view-width-greater-than-large"}},heightBreakpoint:{getValue(e){const i=e.viewSize[1],s=e.breakpoints,a=this.values;return i<=s.xsmall?a.xsmall:i<=s.small?a.small:i<=s.medium?a.medium:i<=s.large?a.large:a.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"geoscene-view-height-xsmall geoscene-view-height-less-than-small geoscene-view-height-less-than-medium geoscene-view-height-less-than-large geoscene-view-height-less-than-xlarge",small:"geoscene-view-height-small geoscene-view-height-greater-than-xsmall geoscene-view-height-less-than-medium geoscene-view-height-less-than-large geoscene-view-height-less-than-xlarge",medium:"geoscene-view-height-medium geoscene-view-height-greater-than-xsmall geoscene-view-height-greater-than-small geoscene-view-height-less-than-large geoscene-view-height-less-than-xlarge",large:"geoscene-view-height-large geoscene-view-height-greater-than-xsmall geoscene-view-height-greater-than-small geoscene-view-height-greater-than-medium geoscene-view-height-less-than-xlarge",xlarge:"geoscene-view-height-xlarge geoscene-view-height-greater-than-xsmall geoscene-view-height-greater-than-small geoscene-view-height-greater-than-medium geoscene-view-height-greater-than-large"}},orientation:{getValue(e){const i=e.viewSize,s=i[0],a=i[1],t=this.values;return a>=s?t.portrait:t.landscape},values:{portrait:"portrait",landscape:"landscape"},valueToClassName:{portrait:"geoscene-view-orientation-portrait",landscape:"geoscene-view-orientation-landscape"}}},o={xsmall:544,small:768,medium:992,large:1200};function m(e){const i=e;return i&&i.xsmall<i.small&&i.small<i.medium&&i.medium<i.large}function g(e,i){return i?n[e].valueToClassName[i].split(" "):[]}const w=w=>{let d=class extends w{constructor(...e){super(...e),this._breakpointsHandles=new s,this.orientation=null,this.widthBreakpoint=null,this.heightBreakpoint=null,this.breakpoints=o}initialize(){this._breakpointsHandles.add(t((()=>[this.breakpoints,this.size]),(()=>this._updateClassNames()),r))}destroy(){this.destroyed||(this._removeActiveClassNames(),this._breakpointsHandles=a(this._breakpointsHandles))}set breakpoints(e){if(e===this._get("breakpoints"))return;const i=m(e);if(!i){const e=JSON.stringify(o,null,2);console.warn("provided breakpoints are not valid, using defaults:"+e)}e=i?e:o,this._set("breakpoints",{...e})}_updateClassNames(){if(!this.container)return;const e=i.acquire(),s=i.acquire();let a,t=!1;for(a in n){const i=this[a],r=n[a].getValue({viewSize:this.size,breakpoints:this.breakpoints});i!==r&&(t=!0,this[a]=r,g(a,i).forEach((e=>s.push(e))),g(a,r).forEach((i=>e.push(i))))}t&&(this._applyClassNameChanges(e,s),i.release(e),i.release(s))}_applyClassNameChanges(e,i){const s=this.container;s&&(i.forEach((e=>s.classList.remove(e))),e.forEach((e=>s.classList.add(e))))}_removeActiveClassNames(){const e=this.container;if(!e)return;let i;for(i in n)g(i,this[i]).forEach((i=>e.classList.remove(i)))}};return e([l()],d.prototype,"breakpoints",null),e([l()],d.prototype,"orientation",void 0),e([l()],d.prototype,"widthBreakpoint",void 0),e([l()],d.prototype,"heightBreakpoint",void 0),d=e([h("geoscene.views.BreakpointsOwner")],d),d};export{w as BreakpointsOwner};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{reparent as t,byId as s,empty as i}from"../core/domUtils.js";import{watch as o,initial as r}from"../core/reactiveUtils.js";import{addFrameTask as n}from"../core/scheduling.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import d from"./overlay/ViewOverlay.js";import u from"../widgets/Popup.js";const l=[0,0];function p(e){const t=(e.ownerDocument||window.document).defaultView,s=e.getBoundingClientRect();return l[0]=s.left+t.pageXOffset,l[1]=s.top+t.pageYOffset,l}function c(e){e&&(i(e),e.parentNode&&e.parentNode.removeChild(e))}function m(e){const t=document.createElement("div");return e.appendChild(t),t}const f=16,y=750,v=512,_=2,g=i=>{let l=class extends i{constructor(...e){super(...e),this._freqInfo={freq:f,time:y},this._overlayRenderTaskHandle=null,this.height=0,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.ui=null,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.handles.add([this.watch("cursor",(e=>{const t=this.surface;t&&t.setAttribute("data-cursor",e)})),this.watch("interacting",(e=>{const t=this.surface;t&&t.setAttribute("data-interacting",e.toString())}))])}initialize(){this.handles.add(this.watch("ui",((e,t)=>this._handleUIChange(e,t)))),this._wireUI(this.ui),this.handles.add([this.on("focus",(()=>this.notifyChange("focused"))),this.on("blur",(()=>this.notifyChange("focused")))])}destroy(){this.destroyed||(this.ui&&(this.ui.destroy(),this.ui=null),this.popup&&!this.popup.destroyed&&this.popup.destroy(),this.container=null)}set container(e){const s=this._get("container");if(s===e)return;const i="dom-size";if(this.handles.remove(i),this._stopMeasuring(),s&&(s.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay.destroy(),this._set("overlay",null),c(this.root),this._set("root",null),t(this.userContent,s),c(this.userContent),this._set("userContent",null)),e){e.classList.add("esri-view");const s=document.createElement("div");s.className="esri-view-user-storage",t(e,s),e.appendChild(s),this._set("userContent",s);const h=document.createElement("div");h.className="esri-view-root",e.insertBefore(h,e.firstChild),this._set("root",h);const a=document.createElement("div");a.className="esri-view-surface",a.setAttribute("role","application"),a.tabIndex=0,h.appendChild(a),this._set("surface",a);const u=new d;h.appendChild(u.surface),this._set("overlay",u),u.watch("needsRender",(e=>{e&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=n({render:()=>{this.overlay.render()}}):this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null)})),this.forceDOMReadyCycle(),this.handles.add(o((()=>this.size),(e=>{const[t,s]=e,i="esri-view-surface--inset-outline";t>=document.body.clientWidth||s>=document.body.clientHeight?a.classList.add(i):a.classList.remove(i)}),r),i),this._set("container",e),this._startMeasuring()}else this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),this._set("container",null)}get focused(){const e=document.activeElement===this.surface;return document.hasFocus()&&e}get popup(){return this._get("popup")||new u({view:this})}set popup(e){const t=this._get("popup");t&&t!==e&&t.destroy(),this._set("popup",e)}get size(){return[this.width,this.height]}blur(){this.surface&&this.surface.blur()}focus(){this.surface&&this.surface.focus()}pageToContainer(e,t,s){const i=this.position;return e-=i[0],t-=i[1],s?(s[0]=e,s[1]=t):s=[e,t],s}containerToPage(e,t,s){const i=this.position;return e+=i[0],t+=i[1],s?(s[0]=e,s[1]=t):s=[e,t],s}_handleUIChange(e,t){t&&(this.handles.remove("ui"),t.destroy()),e&&this._wireUI(e),this._set("ui",e)}_wireUI(e){this.handles.remove("ui"),e&&(e.view=this,this.handles.add([o((()=>this.root),(t=>{e.container=t?m(t):null}),r),o((()=>this.popup),((t,s)=>{const i="popup",o="manual";s&&e.remove(s,i),t&&(t.view=e.view,e.add(t,{key:i,position:o}))}),r)],"ui"))}_stopMeasuring(){this.handles.remove("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const e=this._freqInfo;e.freq=f,e.time=y,this.handles.add([(()=>{const t=()=>{e.freq=f,e.time=y};return window.addEventListener("resize",t),{remove(){window.removeEventListener("resize",t)}}})(),n({prepare:e=>{const t=this._measure(),s=this._freqInfo;if(s.time+=e.deltaTime,t&&(s.freq=f,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const i=this._position();s.freq=i||t?f:Math.min(y,s.freq*_),!t&&s.freq>=v&&this._get("resizing")&&this._set("resizing",!1)}})],"measuring"),this._measure(),this._position()}_measure(){const e=this.container,t=e?e.clientWidth:0,s=e?e.clientHeight:0;if(0===t||0===s)return this.suspended||this._set("suspended",!0),!1;const i=this.width,o=this.height;return t===i&&s===o?(this.suspended&&this._set("suspended",!1),!1):(this._set("width",t),this._set("height",s),this.suspended&&this._set("suspended",!1),this.emit("resize",{oldWidth:i,oldHeight:o,width:t,height:s}),!0)}_position(){const e=this.container,t=this.position,s=p(e);return(!t||s[0]!==t[0]||s[1]!==t[1])&&(this._set("position",[s[0],s[1]]),!0)}forceDOMReadyCycle(){}};return e([h({value:null,cast:e=>s(e)})],l.prototype,"container",null),e([h({readOnly:!0})],l.prototype,"focused",null),e([h({readOnly:!0})],l.prototype,"height",void 0),e([h({type:u})],l.prototype,"popup",null),e([h({type:d})],l.prototype,"overlay",void 0),e([h({readOnly:!0})],l.prototype,"position",void 0),e([h({readOnly:!0})],l.prototype,"resizing",void 0),e([h({readOnly:!0})],l.prototype,"root",void 0),e([h({value:null,readOnly:!0})],l.prototype,"size",null),e([h({readOnly:!0})],l.prototype,"surface",void 0),e([h({readOnly:!0})],l.prototype,"suspended",void 0),e([h()],l.prototype,"ui",void 0),e([h({readOnly:!0})],l.prototype,"userContent",void 0),e([h({readOnly:!0})],l.prototype,"width",void 0),e([h()],l.prototype,"widthBreakpoint",void 0),l=e([a("geoscene.views.DOMContainer")],l),l};function w(e){return e&&"focus"in e}export{g as DOMContainer,w as isDOMContainer};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{reparent as t,byId as s,empty as i}from"../core/domUtils.js";import{watch as o,initial as r}from"../core/reactiveUtils.js";import{addFrameTask as n}from"../core/scheduling.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import d from"./overlay/ViewOverlay.js";import u from"../widgets/Popup.js";const l=[0,0];function p(e){const t=(e.ownerDocument||window.document).defaultView,s=e.getBoundingClientRect();return l[0]=s.left+t.pageXOffset,l[1]=s.top+t.pageYOffset,l}function c(e){e&&(i(e),e.parentNode&&e.parentNode.removeChild(e))}function m(e){const t=document.createElement("div");return e.appendChild(t),t}const f=16,y=750,v=512,_=2,g=i=>{let l=class extends i{constructor(...e){super(...e),this._freqInfo={freq:f,time:y},this._overlayRenderTaskHandle=null,this.height=0,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.ui=null,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.handles.add([this.watch("cursor",(e=>{const t=this.surface;t&&t.setAttribute("data-cursor",e)})),this.watch("interacting",(e=>{const t=this.surface;t&&t.setAttribute("data-interacting",e.toString())}))])}initialize(){this.handles.add(this.watch("ui",((e,t)=>this._handleUIChange(e,t)))),this._wireUI(this.ui),this.handles.add([this.on("focus",(()=>this.notifyChange("focused"))),this.on("blur",(()=>this.notifyChange("focused")))])}destroy(){this.destroyed||(this.ui&&(this.ui.destroy(),this.ui=null),this.popup&&!this.popup.destroyed&&this.popup.destroy(),this.container=null)}set container(e){const s=this._get("container");if(s===e)return;const i="dom-size";if(this.handles.remove(i),this._stopMeasuring(),s&&(s.classList.remove("geoscene-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay.destroy(),this._set("overlay",null),c(this.root),this._set("root",null),t(this.userContent,s),c(this.userContent),this._set("userContent",null)),e){e.classList.add("geoscene-view");const s=document.createElement("div");s.className="geoscene-view-user-storage",t(e,s),e.appendChild(s),this._set("userContent",s);const h=document.createElement("div");h.className="geoscene-view-root",e.insertBefore(h,e.firstChild),this._set("root",h);const a=document.createElement("div");a.className="geoscene-view-surface",a.setAttribute("role","application"),a.tabIndex=0,h.appendChild(a),this._set("surface",a);const u=new d;h.appendChild(u.surface),this._set("overlay",u),u.watch("needsRender",(e=>{e&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=n({render:()=>{this.overlay.render()}}):this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null)})),this.forceDOMReadyCycle(),this.handles.add(o((()=>this.size),(e=>{const[t,s]=e,i="geoscene-view-surface--inset-outline";t>=document.body.clientWidth||s>=document.body.clientHeight?a.classList.add(i):a.classList.remove(i)}),r),i),this._set("container",e),this._startMeasuring()}else this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),this._set("container",null)}get focused(){const e=document.activeElement===this.surface;return document.hasFocus()&&e}get popup(){return this._get("popup")||new u({view:this})}set popup(e){const t=this._get("popup");t&&t!==e&&t.destroy(),this._set("popup",e)}get size(){return[this.width,this.height]}blur(){this.surface&&this.surface.blur()}focus(){this.surface&&this.surface.focus()}pageToContainer(e,t,s){const i=this.position;return e-=i[0],t-=i[1],s?(s[0]=e,s[1]=t):s=[e,t],s}containerToPage(e,t,s){const i=this.position;return e+=i[0],t+=i[1],s?(s[0]=e,s[1]=t):s=[e,t],s}_handleUIChange(e,t){t&&(this.handles.remove("ui"),t.destroy()),e&&this._wireUI(e),this._set("ui",e)}_wireUI(e){this.handles.remove("ui"),e&&(e.view=this,this.handles.add([o((()=>this.root),(t=>{e.container=t?m(t):null}),r),o((()=>this.popup),((t,s)=>{const i="popup",o="manual";s&&e.remove(s,i),t&&(t.view=e.view,e.add(t,{key:i,position:o}))}),r)],"ui"))}_stopMeasuring(){this.handles.remove("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const e=this._freqInfo;e.freq=f,e.time=y,this.handles.add([(()=>{const t=()=>{e.freq=f,e.time=y};return window.addEventListener("resize",t),{remove(){window.removeEventListener("resize",t)}}})(),n({prepare:e=>{const t=this._measure(),s=this._freqInfo;if(s.time+=e.deltaTime,t&&(s.freq=f,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const i=this._position();s.freq=i||t?f:Math.min(y,s.freq*_),!t&&s.freq>=v&&this._get("resizing")&&this._set("resizing",!1)}})],"measuring"),this._measure(),this._position()}_measure(){const e=this.container,t=e?e.clientWidth:0,s=e?e.clientHeight:0;if(0===t||0===s)return this.suspended||this._set("suspended",!0),!1;const i=this.width,o=this.height;return t===i&&s===o?(this.suspended&&this._set("suspended",!1),!1):(this._set("width",t),this._set("height",s),this.suspended&&this._set("suspended",!1),this.emit("resize",{oldWidth:i,oldHeight:o,width:t,height:s}),!0)}_position(){const e=this.container,t=this.position,s=p(e);return(!t||s[0]!==t[0]||s[1]!==t[1])&&(this._set("position",[s[0],s[1]]),!0)}forceDOMReadyCycle(){}};return e([h({value:null,cast:e=>s(e)})],l.prototype,"container",null),e([h({readOnly:!0})],l.prototype,"focused",null),e([h({readOnly:!0})],l.prototype,"height",void 0),e([h({type:u})],l.prototype,"popup",null),e([h({type:d})],l.prototype,"overlay",void 0),e([h({readOnly:!0})],l.prototype,"position",void 0),e([h({readOnly:!0})],l.prototype,"resizing",void 0),e([h({readOnly:!0})],l.prototype,"root",void 0),e([h({value:null,readOnly:!0})],l.prototype,"size",null),e([h({readOnly:!0})],l.prototype,"surface",void 0),e([h({readOnly:!0})],l.prototype,"suspended",void 0),e([h()],l.prototype,"ui",void 0),e([h({readOnly:!0})],l.prototype,"userContent",void 0),e([h({readOnly:!0})],l.prototype,"width",void 0),e([h()],l.prototype,"widthBreakpoint",void 0),l=e([a("geoscene.views.DOMContainer")],l),l};function w(e){return e&&"focus"in e}export{g as DOMContainer,w as isDOMContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import e from"../../core/has.js";import{eventKey as t}from"./keys.js";import{GamepadSource as n}from"./gamepad/GamepadSource.js";import{createScreenPointFromNativeEvent as i}from"../support/screenUtils.js";const o=e("trident"),a=e("edge"),s=e("chrome"),r=e("ff"),h=e("safari"),l={touchNone:"esri-view-surface--touch-none",touchPan:"esri-view-surface--touch-pan"};class u{constructor(e,t){this.input=t,this._active={},this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),this._gamepadSource=new n(e,this.input),this._gamepadSource.onEvent=e=>this._callback("gamepad",e)}destroy(){this._callback=null,this.activeEvents=null,this._activePointerCaptures.forEach((e=>{this._releasePointerCaptureSafe(e)})),this._gamepadSource&&(this._gamepadSource.destroy(),this._gamepadSource=null),this._activePointerCaptures=null,this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set activeEvents(e){for(const t in this._active)if(!e||!e.has(t)){const e=this._active[t];this._element.removeEventListener(c[t],e),delete this._active[t]}e&&e.forEach((e=>{if(!this._active[e]&&c[e]){const t=(this._eventHandlers[e]||this._handleDefault).bind(this,e);this._element.addEventListener(c[e],t),this._active[e]=t}})),this._gamepadSource.hasEventListeners=e&&e.has("gamepad")}setPointerCapture(e,t){t?(this._element.setPointerCapture(e.pointerId),this._activePointerCaptures.add(e.pointerId)):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?l.touchNone:l.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?l.touchPan:l.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(l.touchNone),this._element.classList.remove(l.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch(t){}}_updateNormalizedPointerLikeEvent(e,t){const n=i(this._element,e);return u.test.disableSubpixelCoordinates&&(n.x=Math.round(n.x),n.y=Math.round(n.y)),t.x=n.x,t.y=n.y,t}_handleKey(e,n){const i=t(n);i&&"key-up"===e&&this._keyDownState.delete(i);const o={native:n,key:i,repeat:i&&this._keyDownState.has(i)};i&&"key-down"===e&&this._keyDownState.add(o.key),this._callback(e,o)}_handlePointer(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});this._callback(e,n)}_handlePointerPreventDefault(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});t.preventDefault(),this._callback(e,n)}_handleMouseWheel(e,t){let n=t.deltaY;switch(t.deltaMode){case 0:(o||a)&&(n=n/document.documentElement.clientHeight*600);break;case 1:n*=30;break;case 2:n*=900}o||a?n*=.7:s||h?n*=.6:r&&(n*=1.375);const i=100,l=Math.abs(n);if(l>i){const e=.02;n=n/l*200/(1+Math.exp(-e*(l-i)))}const u=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,deltaY:n});this._callback(e,u)}_handlePointerCaptureLost(e,t){this._activePointerCaptures.delete(t.pointerId),this._handleDefault(e,t)}_handleDefault(e,t){const n={native:t};t.preventDefault(),this._callback(e,n)}_preventAltKeyDefault(e){"Alt"===e.key&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}}u.test={disableSubpixelCoordinates:!1};const c={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};export{u as BrowserEventSource};
5
+ import e from"../../core/has.js";import{eventKey as t}from"./keys.js";import{GamepadSource as n}from"./gamepad/GamepadSource.js";import{createScreenPointFromNativeEvent as i}from"../support/screenUtils.js";const o=e("trident"),a=e("edge"),s=e("chrome"),r=e("ff"),h=e("safari"),l={touchNone:"geoscene-view-surface--touch-none",touchPan:"geoscene-view-surface--touch-pan"};class u{constructor(e,t){this.input=t,this._active={},this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),this._gamepadSource=new n(e,this.input),this._gamepadSource.onEvent=e=>this._callback("gamepad",e)}destroy(){this._callback=null,this.activeEvents=null,this._activePointerCaptures.forEach((e=>{this._releasePointerCaptureSafe(e)})),this._gamepadSource&&(this._gamepadSource.destroy(),this._gamepadSource=null),this._activePointerCaptures=null,this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set activeEvents(e){for(const t in this._active)if(!e||!e.has(t)){const e=this._active[t];this._element.removeEventListener(c[t],e),delete this._active[t]}e&&e.forEach((e=>{if(!this._active[e]&&c[e]){const t=(this._eventHandlers[e]||this._handleDefault).bind(this,e);this._element.addEventListener(c[e],t),this._active[e]=t}})),this._gamepadSource.hasEventListeners=e&&e.has("gamepad")}setPointerCapture(e,t){t?(this._element.setPointerCapture(e.pointerId),this._activePointerCaptures.add(e.pointerId)):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?l.touchNone:l.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?l.touchPan:l.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(l.touchNone),this._element.classList.remove(l.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch(t){}}_updateNormalizedPointerLikeEvent(e,t){const n=i(this._element,e);return u.test.disableSubpixelCoordinates&&(n.x=Math.round(n.x),n.y=Math.round(n.y)),t.x=n.x,t.y=n.y,t}_handleKey(e,n){const i=t(n);i&&"key-up"===e&&this._keyDownState.delete(i);const o={native:n,key:i,repeat:i&&this._keyDownState.has(i)};i&&"key-down"===e&&this._keyDownState.add(o.key),this._callback(e,o)}_handlePointer(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});this._callback(e,n)}_handlePointerPreventDefault(e,t){const n=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,pointerType:t.pointerType,button:t.button,buttons:t.buttons,eventId:this._eventId++});t.preventDefault(),this._callback(e,n)}_handleMouseWheel(e,t){let n=t.deltaY;switch(t.deltaMode){case 0:(o||a)&&(n=n/document.documentElement.clientHeight*600);break;case 1:n*=30;break;case 2:n*=900}o||a?n*=.7:s||h?n*=.6:r&&(n*=1.375);const i=100,l=Math.abs(n);if(l>i){const e=.02;n=n/l*200/(1+Math.exp(-e*(l-i)))}const u=this._updateNormalizedPointerLikeEvent(t,{native:t,x:0,y:0,deltaY:n});this._callback(e,u)}_handlePointerCaptureLost(e,t){this._activePointerCaptures.delete(t.pointerId),this._handleDefault(e,t)}_handleDefault(e,t){const n={native:t};t.preventDefault(),this._callback(e,n)}_preventAltKeyDefault(e){"Alt"===e.key&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}}u.test={disableSubpixelCoordinates:!1};const c={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};export{u as BrowserEventSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../../libs/maquette/projection.js";import{h as o}from"../../libs/maquette/h.js";import"../../libs/maquette/projector.js";let r=class extends s{constructor(t){super(t),this.startX=0,this.startY=0,this.endX=0,this.endY=0,this.width=1,this.color=[0,0,0,.5],this.visible=!0}get startPosition(){return[this.startX,this.startY]}set startPosition(t){this._set("startX",t[0]),this._set("startY",t[1])}get endPosition(){return[this.endX,this.endY]}set endPosition(t){this._set("endX",t[0]),this._set("endY",t[1])}get strokeStyle(){const t=this.color;return`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]})`}get lineCap(){return"round"}render(){const{height:t,left:s,top:e,width:i,x1:r,x2:n,y1:a,y2:p}=this._calculateCoordinates(h),l=`stroke: ${this.strokeStyle}; stroke-width: ${this.width}; stroke-linecap: ${this.lineCap};`;return o("div",{classes:{"esri-line-overlay-item":!0},styles:{left:s+"px",top:e+"px",width:i+"px",height:t+"px",visibility:this.visible?"visible":"hidden"}},[o("svg",{width:i,height:t},[o("line",{x1:r,y1:a,x2:n,y2:p,style:l})])])}renderCanvas(t){if(!this.visible)return;t.strokeStyle=this.strokeStyle,t.lineWidth=this.width,t.lineCap=this.lineCap;const s=this._calculateCoordinates(h);t.beginPath(),t.moveTo(s.left+s.x1,s.top+s.y1),t.lineTo(s.left+s.x2,s.top+s.y2),t.stroke()}_calculateCoordinates(t){const s=Math.min(this.startX,this.endX),e=Math.max(this.startX,this.endX),i=Math.min(this.startY,this.endY),o=Math.max(this.startY,this.endY),r=this.width;return t.left=s-r,t.top=i-r,t.width=e-s+2*r,t.height=Math.max(20,o-i+2*r),t.x1=this.startX-s+r,t.y1=this.startY-i+r,t.x2=this.endX-s+r,t.y2=this.endY-i+r,t}};t([e()],r.prototype,"startX",void 0),t([e()],r.prototype,"startY",void 0),t([e()],r.prototype,"endX",void 0),t([e()],r.prototype,"endY",void 0),t([e()],r.prototype,"startPosition",null),t([e()],r.prototype,"endPosition",null),t([e()],r.prototype,"width",void 0),t([e()],r.prototype,"color",void 0),t([e()],r.prototype,"visible",void 0),t([e({readOnly:!0})],r.prototype,"strokeStyle",null),r=t([i("geoscene.views.overlay.LineOverlayItem")],r);const h={left:0,top:0,width:0,height:0,x1:0,y1:0,x2:0,y2:0},n=r;export{n as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../../libs/maquette/projection.js";import{h as o}from"../../libs/maquette/h.js";import"../../libs/maquette/projector.js";let r=class extends s{constructor(t){super(t),this.startX=0,this.startY=0,this.endX=0,this.endY=0,this.width=1,this.color=[0,0,0,.5],this.visible=!0}get startPosition(){return[this.startX,this.startY]}set startPosition(t){this._set("startX",t[0]),this._set("startY",t[1])}get endPosition(){return[this.endX,this.endY]}set endPosition(t){this._set("endX",t[0]),this._set("endY",t[1])}get strokeStyle(){const t=this.color;return`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${t[3]})`}get lineCap(){return"round"}render(){const{height:t,left:s,top:e,width:i,x1:r,x2:n,y1:a,y2:p}=this._calculateCoordinates(h),l=`stroke: ${this.strokeStyle}; stroke-width: ${this.width}; stroke-linecap: ${this.lineCap};`;return o("div",{classes:{"geoscene-line-overlay-item":!0},styles:{left:s+"px",top:e+"px",width:i+"px",height:t+"px",visibility:this.visible?"visible":"hidden"}},[o("svg",{width:i,height:t},[o("line",{x1:r,y1:a,x2:n,y2:p,style:l})])])}renderCanvas(t){if(!this.visible)return;t.strokeStyle=this.strokeStyle,t.lineWidth=this.width,t.lineCap=this.lineCap;const s=this._calculateCoordinates(h);t.beginPath(),t.moveTo(s.left+s.x1,s.top+s.y1),t.lineTo(s.left+s.x2,s.top+s.y2),t.stroke()}_calculateCoordinates(t){const s=Math.min(this.startX,this.endX),e=Math.max(this.startX,this.endX),i=Math.min(this.startY,this.endY),o=Math.max(this.startY,this.endY),r=this.width;return t.left=s-r,t.top=i-r,t.width=e-s+2*r,t.height=Math.max(20,o-i+2*r),t.x1=this.startX-s+r,t.y1=this.startY-i+r,t.x2=this.endX-s+r,t.y2=this.endY-i+r,t}};t([e()],r.prototype,"startX",void 0),t([e()],r.prototype,"startY",void 0),t([e()],r.prototype,"endX",void 0),t([e()],r.prototype,"endY",void 0),t([e()],r.prototype,"startPosition",null),t([e()],r.prototype,"endPosition",null),t([e()],r.prototype,"width",void 0),t([e()],r.prototype,"color",void 0),t([e()],r.prototype,"visible",void 0),t([e({readOnly:!0})],r.prototype,"strokeStyle",null),r=t([i("geoscene.views.overlay.LineOverlayItem")],r);const h={left:0,top:0,width:0,height:0,x1:0,y1:0,x2:0,y2:0},n=r;export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../../libs/maquette/projection.js";import{h as r}from"../../libs/maquette/h.js";import"../../libs/maquette/projector.js";const s={bottom:"esri-text-overlay-item-anchor-bottom","bottom-right":"esri-text-overlay-item-anchor-bottom-right","bottom-left":"esri-text-overlay-item-anchor-bottom-left",top:"esri-text-overlay-item-anchor-top","top-right":"esri-text-overlay-item-anchor-top-right","top-left":"esri-text-overlay-item-anchor-top-left",center:"esri-text-overlay-item-anchor-center",right:"esri-text-overlay-item-anchor-right",left:"esri-text-overlay-item-anchor-left"};let l=class extends e{constructor(t){super(t),this.x=0,this.y=0,this.text="-",this.fontSize=14,this.anchor="center",this.visible=!0,this.backgroundColor="rgba(0, 0, 0, 0.6)",this.textColor="white",this.textShadowColor=[0,0,0],this.textShadowSize=1}get position(){return[this.x,this.y]}set position(t){this._set("x",t[0]),this._set("y",t[1])}get padding(){return.5*this.fontSize}render(){return r("div",{classes:this._cssClasses(),styles:{left:Math.floor(this.x)+"px",top:Math.floor(this.y)+"px",visibility:this.visible?"visible":"hidden",fontSize:this.fontSize+"px",backgroundColor:this.backgroundColor,color:this.textColor,padding:this.padding+"px",borderRadius:this.padding+"px",textShadow:`0 0 ${this.textShadowSize}px rgb(${this.textShadowColor[0]}, ${this.textShadowColor[1]}, ${this.textShadowColor[2]})`}},[this.text])}renderCanvas(t){if(!this.visible)return;const e=t.font.replace(/^(.*?)px/,"");t.font=`${this.fontSize}px ${e}`;const o=this.padding,i=this.padding,r=t.measureText(this.text).width,s=this.fontSize,l=h[this.anchor];t.textAlign="center",t.textBaseline="middle";const n=r+2*o,a=s+2*o,x=this.x+l.x*n,c=this.y+l.y*a;this._roundedRect(t,x,c,n,a,i),t.fillStyle=this.backgroundColor,t.fill();const p=this.x+(l.x+.5)*n,d=this.y+(l.y+.5)*a;this._renderTextShadow(t,this.text,p,d),t.fillStyle=this.textColor,t.fillText(this.text,p,d)}_renderTextShadow(t,e,o,i){t.lineJoin="miter",t.fillStyle=`rgba(${this.textShadowColor[0]}, ${this.textShadowColor[1]}, ${this.textShadowColor[2]}, ${1/n.length})`;const r=this.textShadowSize;for(const[s,l]of n)t.fillText(e,o+r*s,i+r*l)}_roundedRect(t,e,o,i,r,s){t.beginPath(),t.moveTo(e,o+s),t.arcTo(e,o,e+s,o,s),t.lineTo(e+i-s,o),t.arcTo(e+i,o,e+i,o+s,s),t.lineTo(e+i,o+r-s),t.arcTo(e+i,o+r,e+i-s,o+r,s),t.lineTo(e+s,o+r),t.arcTo(e,o+r,e,o+r-s,s),t.closePath()}_cssClasses(){const t={"esri-text-overlay-item":!0};for(const e in s)t[s[e]]=this.anchor===e;return t}};t([o()],l.prototype,"x",void 0),t([o()],l.prototype,"y",void 0),t([o()],l.prototype,"position",null),t([o()],l.prototype,"text",void 0),t([o()],l.prototype,"fontSize",void 0),t([o()],l.prototype,"anchor",void 0),t([o()],l.prototype,"visible",void 0),t([o()],l.prototype,"padding",null),l=t([i("geoscene.views.overlay.TextOverlayItem")],l);const h={bottom:{x:-.5,y:-1,textAlign:"center",textBaseline:"bottom"},"bottom-left":{x:0,y:-1,textAlign:"left",textBaseline:"bottom"},"bottom-right":{x:-1,y:-1,textAlign:"right",textBaseline:"bottom"},center:{x:-.5,y:-.5,textAlign:"center",textBaseline:"middle"},left:{x:0,y:-.5,textAlign:"left",textBaseline:"middle"},right:{x:-1,y:-.5,textAlign:"right",textBaseline:"middle"},top:{x:-.5,y:0,textAlign:"center",textBaseline:"top"},"top-left":{x:0,y:0,textAlign:"left",textBaseline:"top"},"top-right":{x:-1,y:0,textAlign:"right",textBaseline:"top"}},n=[];{const t=16;for(let e=0;e<360;e+=360/t)n.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)])}const a=l;export{a as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import"../../libs/maquette/projection.js";import{h as r}from"../../libs/maquette/h.js";import"../../libs/maquette/projector.js";const s={bottom:"geoscene-text-overlay-item-anchor-bottom","bottom-right":"geoscene-text-overlay-item-anchor-bottom-right","bottom-left":"geoscene-text-overlay-item-anchor-bottom-left",top:"geoscene-text-overlay-item-anchor-top","top-right":"geoscene-text-overlay-item-anchor-top-right","top-left":"geoscene-text-overlay-item-anchor-top-left",center:"geoscene-text-overlay-item-anchor-center",right:"geoscene-text-overlay-item-anchor-right",left:"geoscene-text-overlay-item-anchor-left"};let l=class extends e{constructor(t){super(t),this.x=0,this.y=0,this.text="-",this.fontSize=14,this.anchor="center",this.visible=!0,this.backgroundColor="rgba(0, 0, 0, 0.6)",this.textColor="white",this.textShadowColor=[0,0,0],this.textShadowSize=1}get position(){return[this.x,this.y]}set position(t){this._set("x",t[0]),this._set("y",t[1])}get padding(){return.5*this.fontSize}render(){return r("div",{classes:this._cssClasses(),styles:{left:Math.floor(this.x)+"px",top:Math.floor(this.y)+"px",visibility:this.visible?"visible":"hidden",fontSize:this.fontSize+"px",backgroundColor:this.backgroundColor,color:this.textColor,padding:this.padding+"px",borderRadius:this.padding+"px",textShadow:`0 0 ${this.textShadowSize}px rgb(${this.textShadowColor[0]}, ${this.textShadowColor[1]}, ${this.textShadowColor[2]})`}},[this.text])}renderCanvas(t){if(!this.visible)return;const e=t.font.replace(/^(.*?)px/,"");t.font=`${this.fontSize}px ${e}`;const o=this.padding,i=this.padding,r=t.measureText(this.text).width,s=this.fontSize,l=h[this.anchor];t.textAlign="center",t.textBaseline="middle";const n=r+2*o,a=s+2*o,x=this.x+l.x*n,c=this.y+l.y*a;this._roundedRect(t,x,c,n,a,i),t.fillStyle=this.backgroundColor,t.fill();const p=this.x+(l.x+.5)*n,d=this.y+(l.y+.5)*a;this._renderTextShadow(t,this.text,p,d),t.fillStyle=this.textColor,t.fillText(this.text,p,d)}_renderTextShadow(t,e,o,i){t.lineJoin="miter",t.fillStyle=`rgba(${this.textShadowColor[0]}, ${this.textShadowColor[1]}, ${this.textShadowColor[2]}, ${1/n.length})`;const r=this.textShadowSize;for(const[s,l]of n)t.fillText(e,o+r*s,i+r*l)}_roundedRect(t,e,o,i,r,s){t.beginPath(),t.moveTo(e,o+s),t.arcTo(e,o,e+s,o,s),t.lineTo(e+i-s,o),t.arcTo(e+i,o,e+i,o+s,s),t.lineTo(e+i,o+r-s),t.arcTo(e+i,o+r,e+i-s,o+r,s),t.lineTo(e+s,o+r),t.arcTo(e,o+r,e,o+r-s,s),t.closePath()}_cssClasses(){const t={"geoscene-text-overlay-item":!0};for(const e in s)t[s[e]]=this.anchor===e;return t}};t([o()],l.prototype,"x",void 0),t([o()],l.prototype,"y",void 0),t([o()],l.prototype,"position",null),t([o()],l.prototype,"text",void 0),t([o()],l.prototype,"fontSize",void 0),t([o()],l.prototype,"anchor",void 0),t([o()],l.prototype,"visible",void 0),t([o()],l.prototype,"padding",null),l=t([i("geoscene.views.overlay.TextOverlayItem")],l);const h={bottom:{x:-.5,y:-1,textAlign:"center",textBaseline:"bottom"},"bottom-left":{x:0,y:-1,textAlign:"left",textBaseline:"bottom"},"bottom-right":{x:-1,y:-1,textAlign:"right",textBaseline:"bottom"},center:{x:-.5,y:-.5,textAlign:"center",textBaseline:"middle"},left:{x:0,y:-.5,textAlign:"left",textBaseline:"middle"},right:{x:-1,y:-.5,textAlign:"right",textBaseline:"middle"},top:{x:-.5,y:0,textAlign:"center",textBaseline:"top"},"top-left":{x:0,y:0,textAlign:"left",textBaseline:"top"},"top-right":{x:-1,y:0,textAlign:"right",textBaseline:"top"}},n=[];{const t=16;for(let e=0;e<360;e+=360/t)n.push([Math.cos(Math.PI*e/180),Math.sin(Math.PI*e/180)])}const a=l;export{a as default};