@arcgis/core 4.24.0-next.20220607 → 4.24.0-next.20220608
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.
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{2e2d7f5952934af43fd7.js → 04034dabc8e0a489b0f8.js} +1 -1
- package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +1 -0
- package/assets/esri/core/workers/chunks/34ad71bd3a4684583f83.js +1 -0
- package/assets/esri/core/workers/chunks/{c165845a117c21246b1e.js → 42aa8ce4eb7bd851475e.js} +1 -1
- package/assets/esri/core/workers/chunks/{e51420d231c286b9c062.js → 540f1ed1ea9cddc739af.js} +1 -1
- package/assets/esri/core/workers/chunks/{71d445d1e6812e03a1d7.js → 5574c1e7f35bc36a1375.js} +1 -1
- package/assets/esri/core/workers/chunks/6196cfdeb91ceba52af3.js +1 -0
- package/assets/esri/core/workers/chunks/71a4618d959a09302c51.js +1 -0
- package/assets/esri/core/workers/chunks/{13e9e6f0b4942d79b0eb.js → 88942e9f60687ac006dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{cbe98327181d8d7ad9e5.js → 9a8ebd98ad130abef76b.js} +1 -1
- package/assets/esri/core/workers/chunks/9d3954fb9513d7317ee2.js +1 -0
- package/assets/esri/core/workers/chunks/{4d2181bde97983ecac8b.js → a88cbb78f37c750fa461.js} +1 -1
- package/assets/esri/core/workers/chunks/{1d893ebc6f203ff1fc3d.js → ae8bb7a8cc714c942c74.js} +1 -1
- package/assets/esri/core/workers/chunks/b71a0a8a2f446c671161.js +1 -0
- package/assets/esri/core/workers/chunks/{185da42e7cc8e440c0f0.js → c157b46b0724f3f0947e.js} +1 -1
- package/assets/esri/core/workers/chunks/c8402e32307a7b7eaaeb.js +1 -0
- package/assets/esri/core/workers/chunks/{a9a4bb1d781b1a995fb3.js → cf6fce37217451e678ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{8152cd26ebeae910b753.js → d3c73da9c2abb59e762a.js} +1 -1
- package/assets/esri/core/workers/chunks/d828a0656e7351a74fc4.js +1 -0
- package/assets/esri/core/workers/chunks/{172368d4eb6e6f8d2bdb.js → d8b9551df1bd196d0126.js} +1 -1
- package/assets/esri/core/workers/chunks/f54d5abbb9668c45bd19.js +1 -0
- package/assets/esri/core/workers/chunks/{1ebed6d6f561f926bd36.js → faf6e48f9f1205fb2e43.js} +1 -1
- package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BasemapToggle.scss +6 -23
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +10 -2
- package/assets/esri/themes/base/widgets/_Tooltip.scss +7 -7
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ar.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bg.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bs.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ca.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_cs.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_da.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_de.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_el.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_en.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_es.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_et.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fi.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_he.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hu.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_id.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_it.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ja.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ko.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lt.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lv.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nb.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-BR.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-PT.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ro.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ru.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sk.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sl.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sv.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_th.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_tr.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_uk.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_vi.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-CN.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-HK.json +1 -1
- package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-TW.json +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/i3s.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/libtess-asm.js +1 -1
- package/chunks/libtess.js +1 -1
- package/chunks/pe-wasm.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/interfaces.d.ts +32 -20
- package/layers/LineOfSightLayer.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/package.json +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/MapView.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/Widget.js +1 -1
- package/assets/esri/core/workers/chunks/2ac6c99aacb873134f7c.js +0 -1
- package/assets/esri/core/workers/chunks/471beeb6924599209567.js +0 -1
- package/assets/esri/core/workers/chunks/770cf0a66102100abe74.js +0 -1
- package/assets/esri/core/workers/chunks/96ff15d6c2bfca0c6061.js +0 -1
- package/assets/esri/core/workers/chunks/9c4c721d890b49697132.js +0 -1
- package/assets/esri/core/workers/chunks/af3766a2d27419c7766c.js +0 -1
- package/assets/esri/core/workers/chunks/b50bbfd75768d9a8de88.js +0 -1
- package/assets/esri/core/workers/chunks/b577ec80647cf2ece397.js +0 -1
- package/assets/esri/core/workers/chunks/e99b58d07475bffce7ea.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isNone as r,isSome as s}from"../../../../core/maybe.js";import{screenPointObjectToArray as o}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 n}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{isNone as r,isSome as s}from"../../../../core/maybe.js";import{screenPointObjectToArray as o}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 n}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as a,g as c,n as p,a as l,c as m}from"../../../../chunks/vec3.js";import{d,a as u,c as h}from"../../../../chunks/vec3f64.js";import{create as y,copy as f,fromPoints as g}from"../../../../geometry/support/ray.js";import{sv2d as I}from"../../../../geometry/support/vectorStacks.js";import{getObjectId as w}from"../../../../layers/graphics/dehydratedFeatures.js";import{LineOfSightIntersectionResult as v}from"./LineOfSightIntersectionResult.js";import{isI3sIntersectorResult as j}from"../../layers/i3s/Intersector.js";import{fromScreen as R}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as b}from"../../terrain/Intersector.js";import{tilesAreRelated as C}from"../../terrain/tileUtils.js";import{newIntersector as U}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as S,IntersectorType as T}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as _}from"../../webgl-engine/lib/intersectorUtilsConversions.js";let H=class extends t{constructor(e){super(e),this._terrainIntersectionOptionsLayerUids=new Set(["terrain"])}initialize(){this.intersector=U(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=S.MIN}getScreenPointIntersection(e){const t=o(e,I.get()),r=R(this.view.state.camera,t,E);return this._getRayIntersection(r)}_getRayIntersection(e,t){if(r(e)||r(this.view.sceneIntersectionHelper))return null;this.intersector.options.store=S.MIN,this.view.sceneIntersectionHelper.intersectToolIntersectorRay(e,this.intersector,t);const o=this.intersector.results.min;if(!o.getIntersectionPoint(A))return null;const i=this.view.renderCoordsHelper.fromRenderCoords(A,this.view.spatialReference),n=d(o.normal),p=a(n,e.direction)>0?-1:1;if(c(n,n,p),j(o))return new v({type:T.OBJECT,id:`${o.target.layerUid}/${o.target.nodeIndex}/${o.target.componentIndex}`,point:i,normal:n,ray:f(e),graphic:null});if(b(o))return new v({type:T.TERRAIN,id:o.target.lij.slice(),point:i,normal:n,ray:f(e),graphic:null});const l=_(o,this.view);if(s(l)){const t=l.layer,r=l.sourceLayer;let s;if(r)if("scene"===r.type)s=w(l,r.objectIdField);else s=l.uid;else s=l.uid;return new v({type:T.OBJECT,id:`${t.uid}/${s}`,point:i,normal:n,ray:f(e),graphic:l})}return null}_canUpdateFromIntersectionResult(e,t){if(r(e)||!t||e.type!==t.type)return!1;switch(e.type){case T.TERRAIN:{const r=e.id,s=t.id;return r[0]===s[0]&&r[1]===s[1]&&r[2]===s[2]||C(r,s)}case T.OBJECT:case T.I3S:return e.id===t.id}}updateFromIntersectionResult(e){let t;if(e.type===T.TERRAIN&&s(e.point)){const r=A,s=O,o=x;this.view.renderCoordsHelper.toRenderCoords(e.point,s),this.view.renderCoordsHelper.worldUpAtPosition(s,o);const i=this.view.basemapTerrain.elevationBounds,n=this.view.renderCoordsHelper.getAltitude(s),a=i?Math.abs(i.max-i.min)/Math.abs(n):100,m=n>0?1:-1;p(o,o),c(o,o,m*a),l(r,s,o),g(r,s,E),t=this._getRayIntersection(E)}else t=this._getRayIntersection(e.ray);return this._canUpdateFromIntersectionResult(t,e)?t.point:null}adjustFromGroundIntersection(e,t){const r=A,o=O,i=x;m(o,e),this.view.renderCoordsHelper.worldUpAtPosition(o,i);const n=this.view.basemapTerrain.elevationBounds,a=this.view.renderCoordsHelper.getAltitude(o),d=n?Math.abs(n.max-n.min):100,h=a>0?1:-1;p(i,i),c(i,i,h*d),l(r,o,i),g(r,o,E);const y=this._getRayIntersection(E,{include:this._terrainIntersectionOptionsLayerUids});return s(y)&&s(y.point)?(this.view.renderCoordsHelper.toRenderCoords(y.point,t),u(y.normal)):(m(t,e),null)}};e([i()],H.prototype,"view",void 0),e([i()],H.prototype,"intersector",void 0),H=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],H);const A=h(),O=h(),x=h(),E=y();export{H as LineOfSightRayIntersector};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{isSome as s,destroyMaybe as r,applySome as a}from"../../../../../core/maybe.js";import{watch as n,initial as o}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 p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{getEffectiveElevationMode as c}from"../../../../../support/elevationInfoUtils.js";import h from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as u}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as m}from"../../SnappingVisualizer3D.js";import{settings as v}from"../settings.js";import{OutlineVisualElement as d}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as f}from"../../visualElements/VerticesVisualElement.js";import{GraphicState as w}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as V,geometryTypeToDrawOperationGeometryType as y}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as E}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as _,ElevationDrawSurface as g}from"../../../../draw/drawSurfaces.js";import O from"../../../../interactive/sketch/SketchLabelOptions.js";import j from"../../../../interactive/sketch/SketchTooltipOptions.js";let S=class extends V{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this.geometryType=null,this.labelOptions=new O,this.tooltipOptions=new j,this.type="draw-3d"}initialize(){const{mode:e,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new h({mode:e,offset:t})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:{mode:t?"absolute-height":"on-the-ground",offset:0}}}return e}initializeGraphic(e){const i=this._createGraphicState=new w({graphic:e});return t([this.view.maskOccludee(e),this.view.trackGraphicState(i),n((()=>({element:this._outlineVisualElement,isDraped:i.isDraped})),(({element:e,isDraped:t})=>{a(e,(e=>e.isDraped=t))}),o)])}makeDrawOperation(){return new E({view:this.view,manipulators:this.manipulators,geometryType:y(
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{isSome as s,destroyMaybe as r,applySome as a}from"../../../../../core/maybe.js";import{watch as n,initial as o}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 p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{getEffectiveElevationMode as c}from"../../../../../support/elevationInfoUtils.js";import h from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as u}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as m}from"../../SnappingVisualizer3D.js";import{settings as v}from"../settings.js";import{OutlineVisualElement as d}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as f}from"../../visualElements/VerticesVisualElement.js";import{GraphicState as w}from"../../../layers/graphics/GraphicState.js";import{DrawGraphicTool as V,geometryTypeToDrawOperationGeometryType as y}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as E}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as _,ElevationDrawSurface as g}from"../../../../draw/drawSurfaces.js";import O from"../../../../interactive/sketch/SketchLabelOptions.js";import j from"../../../../interactive/sketch/SketchTooltipOptions.js";let S=class extends V{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this.geometryType=null,this.labelOptions=new O,this.tooltipOptions=new j,this.type="draw-3d"}initialize(){const{mode:e,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new h({mode:e,offset:t})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:{mode:t?"absolute-height":"on-the-ground",offset:0}}}return e}initializeGraphic(e){const i=this._createGraphicState=new w({graphic:e});return t([this.view.maskOccludee(e),this.view.trackGraphicState(i),n((()=>({element:this._outlineVisualElement,isDraped:i.isDraped})),(({element:e,isDraped:t})=>{a(e,(e=>e.isDraped=t))}),o)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new E({view:this.view,manipulators:this.manipulators,geometryType:y(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new _(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new g(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new m,segmentLabels:t?new u:null,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions})}onActiveVertexChanged(e){return s(this._activeVertexVisualElement)?(this._activeVertexVisualElement.vertices=[e],null):(this._activeVertexVisualElement=new f({view:this.view,spatialReference:this.view.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,renderOccluded:v.reshapeManipulators.vertex.renderOccluded,attached:!1}),this._activeVertexVisualElement.color=v.colorToVec4(v.reshapeManipulators.selected.color),this._activeVertexVisualElement.attached=!0,i((()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement)})))}onOutlineChanged(e){if(s(this._outlineVisualElement))return this._outlineVisualElement.geometry=e,null;const t=this.internalGraphicsLayer.elevationInfo;return this._outlineVisualElement=new d({view:this.view,geometry:e,elevationInfo:t,isDraped:s(this._createGraphicState)?this._createGraphicState.isDraped:"on-the-ground"===c(this.hasZ,t),attached:!1}),v.visualElements.lineGraphics.outline.apply(this._outlineVisualElement),v.visualElements.lineGraphics.shadowStyle.apply(this._outlineVisualElement),this._outlineVisualElement.attached=!0,this._outlineVisualElement.laserlineEnabled=!0,i((()=>{this._outlineVisualElement=r(this._outlineVisualElement)}))}onRegularVerticesChanged(e){return s(this._verticesVisualElement)?(this._verticesVisualElement.vertices=e,null):(this._verticesVisualElement=new f({view:this.view,spatialReference:this.view.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,renderOccluded:v.reshapeManipulators.vertex.renderOccluded,attached:!1}),this._verticesVisualElement.attached=!0,i((()=>{this._verticesVisualElement=r(this._verticesVisualElement)})))}};e([l({constructOnly:!0})],S.prototype,"elevationInfo",void 0),e([l({constructOnly:!0})],S.prototype,"geometryType",void 0),e([l({constructOnly:!0,type:O})],S.prototype,"labelOptions",void 0),e([l({constructOnly:!0,type:j})],S.prototype,"tooltipOptions",void 0),e([l()],S.prototype,"type",void 0),e([l({constructOnly:!0})],S.prototype,"view",void 0),S=e([p("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],S);export{S as DrawGraphicTool3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../request.js";import{
|
|
5
|
+
import e from"../../../../request.js";import{remove as t,splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{resultOrAbort as i,result as r}from"../../../../core/asyncUtils.js";import{estimateStringByteSize as a,estimateNumberByteSize as n}from"../../../../core/byteSizeEstimations.js";import o from"../../../../core/Logger.js";import{isNone as c,unwrap as d,get as h,isSome as l}from"../../../../core/maybe.js";import{whenOrAbort as m}from"../../../../core/promiseUtils.js";import{formatNumber as u}from"../../../../intl/number.js";import{getMaximumQuerySize as g,queryAllJSON as b}from"../../../../layers/support/featureQueryAll.js";const p=o.getLogger("esri.views.3d.layers.i3s.I3SAttributeOverrides");class f{constructor(e,t){this.layer=e,this.warnMaximumChangedObjectsExceeded=!1,this.changedObjectIds=new Set,this.pendingFetchAbortController=new AbortController,this.interactiveEditingSessions=null,this._maximumNumberOfEditOVerrides=j,this.memCache=t.newCache(`${e.uid}-attribute-overrides`),this.pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this.pendingFetchAbortController.signal),this.pendingFetchChangedObjectIds.then((()=>this.pendingFetchAbortController=null))}destroy(){this.layer=null,this.memCache.destroy(),this.memCache=null,this.pendingFetchAbortController&&(this.pendingFetchAbortController.abort(),this.pendingFetchAbortController=null),this.pendingFetchChangedObjectIds=null}createInteractiveEditSession(e){this.changedObjectIds.add(e),c(this.interactiveEditingSessions)&&(this.interactiveEditingSessions=[]);const s=this.interactiveEditingSessions,i=new y(e,{rollback:()=>{t(s,i),0===s.length&&(this.interactiveEditingSessions=null)},commit:t=>{for(const[s,i]of t)this.updateValue(e,s,i)}});return s.unshift(i),i}async apply(e,t,s){if(c(t))return;const{loadedAttributes:i,attributeData:r}=t;if(c(i)||0===i.length||c(r))return;if(await m(this.pendingFetchChangedObjectIds,s),0===this.changedObjectIds.size)return;const a={loadedAttributes:i,attributeData:r},n=this._getOverridesFromCache(e,a,this.changedObjectIds),{objectIds:o,fieldNames:d}=n,h=await this._queryOverridesFromAssociatedLayer(o,d,s);c(h)||this._processOverridesFromAssociatedLayer(e,h,d,a)}updateValue(e,t,s){this.changedObjectIds.add(e),this._cacheValue(e,t,s)}_cacheValue(e,t,s){this.memCache.put(this._getCacheKey(e,t),s,this._memCacheValueSize(s))}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:s},i){const r=new Set,a=new Array;for(const o of t)a[o.index]=s[o.name];const n=new Set;for(let o=0;o<e.length;o++){const s=e[o];if(i.has(s))for(const e of t){const t=this._fromCache(s,e.index);void 0===t?(r.add(s),n.add(e.name)):a[e.index][o]=t}}return{objectIds:Array.from(r),fieldNames:Array.from(n)}}_fromCache(e,t){const s=this._fromInteractiveEditingSession(e,t);if(void 0!==s)return s;const i=this._getCacheKey(e,t);return this.memCache.get(i)}_fromInteractiveEditingSession(e,t){if(!c(this.interactiveEditingSessions))for(const s of this.interactiveEditingSessions){if(s.objectId!==e)continue;const i=s.get(t);if(void 0!==i)return i}}_getCacheKey(e,t){return`${e}-${t}`}async _queryOverridesFromAssociatedLayer(e,t,r){if(0===e.length||0===t.length)return null;e=e.sort(((e,t)=>e-t)),this.warnMaximumChangedObjectsExceeded&&(this.warnMaximumChangedObjectsExceeded=!1,this._logMaximumObjectsExceededWarning());const a=d(this.layer.associatedLayer),n=a.createQuery();n.where="1=1",n.returnGeometry=!1,n.outFields=[a.objectIdField,...t],n.cacheHint=!0,n.objectIds=e;const o=g(a),c=e.length>o?s(e,o).map((e=>{const t=n.clone();return t.objectIds=e,i(b(a,t,{signal:r}))})):[i(b(a,n,{signal:r}))];return(await Promise.all(c)).reduce(((e,t)=>e.concat(t.ok?t.value.features:[])),[])}_logMaximumObjectsExceededWarning(){let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${u(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;t&&t.loaded?e+=` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:e+=` (${this.layer.parsedUrl.path})`,p.warn("#queryOverrides()",this.layer.title,`${e}.`)}_processOverridesFromAssociatedLayer(e,t,s,{loadedAttributes:i,attributeData:r}){const a=d(this.layer.associatedLayer).objectIdField,n=s.map((e=>r[e])),o=new Map(i.map((e=>[e.name,e.index]))),c=s.map((e=>o.get(e))),h=new Map(Array.from(e,((e,t)=>[e,t])));for(const d of t){const e=d.attributes[a];for(let t=0;t<s.length;t++){const i=c[t],r=h.get(e),a=d.attributes[s[t]];n[t][r]=a,this._cacheValue(e,i,a)}}}_memCacheValueSize(e){return"string"==typeof e?a(e):n()}async _fetchChangedObjectIds(t){const s=this.layer;if(await s.load({signal:t}),this.changedObjectIds.clear(),c(s.associatedLayer)||!s.associatedLayer.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(c(i))return null;const a=s.associatedLayer.layerId,n=await r(e(`${s.associatedLayer.url}/extractChanges`,{method:"post",query:{f:"json",returnIdsOnly:!0,layers:`${a}`,returnUpdates:!0,returnDeletes:!1,returnInserts:!1,layerServerGens:JSON.stringify([{id:a,serverGen:i}])},timeout:C,signal:t})),o=n.ok&&n.value.data?.edits?h(n.value.data.edits[0],"objectIds","updates"):null;if(l(o)){const e=Math.min(this._maximumNumberOfEditOVerrides,o.length);e<o.length&&(this.warnMaximumChangedObjectsExceeded=!0);const t=o.sort(((e,t)=>e-t));for(let s=0;s<e;s++)this.changedObjectIds.add(t[s])}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(l(e.serviceUpdateTimeStamp)&&l(e.serviceUpdateTimeStamp.lastUpdate))return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return l(t)&&l(t.serverGens)&&l(t.serverGens.minServerGen)?t.serverGens.minServerGen:null}get test(){const e=Array.from(this.changedObjectIds),t=this.pendingFetchChangedObjectIds,s=this;return{changedObjectIds:e,pendingFetchChangedObjectIds:t,get maximumNumberOfEditOVerrides(){return s._maximumNumberOfEditOVerrides},set maximumNumberOfEditOVerrides(e){s._maximumNumberOfEditOVerrides=e}}}}class y{constructor(e,t){this.objectId=e,this.options=t,this.updates=new Map,this.state=O.ACTIVE}get(e){return this.updates.get(e)}set(e,t){this.isActive&&this.updates.set(e,t)}rollback(){this.isActive&&(this.state=O.ROLLED_BACK,this.options.rollback())}commit(){this.isActive&&(this.state=O.COMMITTED,this.options.commit(this.updates),this.updates.clear())}get isActive(){return this.state===O.ACTIVE}}var O;!function(e){e[e.ACTIVE=0]="ACTIVE",e[e.COMMITTED=1]="COMMITTED",e[e.ROLLED_BACK=2]="ROLLED_BACK"}(O||(O={}));const C=1e4,j=5e4;export{f as I3SAttributeOverrides};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import i from"../../../core/Logger.js";import{isSome as s}from"../../../core/maybe.js";import{MemCacheStorage as r,MemCache as a}from"../../../core/MemCache.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 h}from"../../../core/accessorSupport/decorators/subclass.js";import{isMemoryManagedLayerView as m}from"../layers/support/MemoryManagedLayerView.js";const y=i.getLogger("esri.views.3d.support.MemoryController");function l(t){return new p({view:t})}const n=1,d=1,u=.75,c=.6,_=1.3;let p=class extends e{constructor(t){super(t),this._quality=1,this._memoryUsed=0,this._updating=!1,this.minQuality=.1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._memoryPredicted=0,this._cacheStorage=new r,this._numQualityChanges=0,this._maxMemory=500,this._additionalCacheMemory=100}destroy(){this._cacheStorage.destroy()}set maxMemory(t){null==t||t<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<t&&this._updateQuality(n),this._maxMemory=t)}get maxMemory(){return this._maxMemory}set additionalCacheMemory(t){null!=t&&t>=0&&(this._additionalCacheMemory=t)}get additionalCacheMemory(){return this._additionalCacheMemory}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._memoryUsed}newCache(t,e){return new a(t,this._cacheStorage,e)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._updateMemory(),this._memoryPredicted<=0&&!this._updating)return;let t=this._layersUpdating();if(this._memoryPredicted<c&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(n);else if(t)(this._memoryPredicted>1.1*d||this._memoryUsed>d)&&(this._stableQuality>0?(this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality)):this._quality>this.minQuality&&this._downscaleMemoryUsed<this._memoryUsed&&(this._updateQuality(this._quality/_),this._downscaleMemoryUsed=this._memoryUsed,this._canFastRecover=!1));else if(this._downscaleMemoryUsed=0,this._memoryUsed>d)this._stableQuality=0,this._canFastRecover=!1,t=this._updateQuality(this._quality/_),this._downscaleMemoryUsed=this._memoryPredicted;else if(this._stableQuality!==this._quality)if(this._memoryUsed<u&&this._quality<n){this._stableQuality=this._quality;const e=.05;t=this._updateQuality(this._quality+e)}else this._quality<1&&(this._canFastRecover=!0);this._updating=t}_updateQuality(t){return(t=Math.min(Math.max(t,this.minQuality),n))!==this._quality&&(this._quality=t,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some((t=>!!t.updating))}_updateMemory(){let t=0,e=0;this.view.basemapTerrain&&this.view.basemapTerrain.getUsedMemory&&(t+=this.view.basemapTerrain.getUsedMemory());const i=this.view._stage&&this.view._stage.renderView&&this.view._stage.renderView.edgeView;s(i)&&(t+=i.usedMemory),this.view.allLayerViews&&this.view.allLayerViews.forEach((i=>{if(m(i)){const s=i.ignoresMemoryFactor()?this._quality:1;t+=i.getUsedMemory()*s,e+=i.getUnloadedMemory()*s}}));const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const i=t=>(t/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",s=Math.round(100*this._quality);y.warn(`Memory Limit exceeded! Limit: ${i(a)} Current: ${i(t)} Projected: ${i(t+e)} Quality: ${s}%`)}this._memoryUsed=t/a,this._memoryPredicted=(t+e)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){const t=this;return{cacheStorage:this._cacheStorage,resetQualityChanges:()=>{const e=t._numQualityChanges;return t._numQualityChanges=0,e}}}};t([o({constructOnly:!0})],p.prototype,"view",void 0),t([o()],p.prototype,"maxMemory",null),t([o()],p.prototype,"additionalCacheMemory",null),t([o()],p.prototype,"memoryFactor",null),t([o()],p.prototype,"updating",null),t([o()],p.prototype,"usedMemory",null),t([o()],p.prototype,"_quality",void 0),t([o()],p.prototype,"_memoryUsed",void 0),t([o()],p.prototype,"_updating",void 0),t([o()],p.prototype,"_stableQuality",void 0),t([o()],p.prototype,"_maxMemory",void 0),t([o()],p.prototype,"_additionalCacheMemory",void 0),p=t([h("esri.views.3d.support.MemoryController")],p);export{l as newMemoryController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e,releaseMaybe as r,isNone as t,isSome as i}from"../../../core/maybe.js";import{Z as o}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as l}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as n,BlendLayersTechnique as a}from"./BlendLayersTechnique.js";import{LayerClass as h}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as c,RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{FBOPool as _}from"./support/FBOPool.js";import{LayerBlendMode as d}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{TileBlendInput as f}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{B as b,b as p}from"../../../chunks/BlendLayers.glsl.js";import{BindParameters as T}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as m}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as y}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as g,ClearBufferBit as x,TextureType as B}from"../../webgl/enums.js";import{Texture as C}from"../../webgl/Texture.js";import{vertexCount as q}from"../../webgl/Util.js";class P{constructor(e,r){this._rctx=e,this._techniqueRepository=r,this._fboPools=[],this._doubleBufferFbo=[],this._vectorTileHelper=new l,this._bindParameters=new T(null,null,null),this._blendLayersTechniqueConfig=new n,this._poolToWrite=0,this._vaoQuad=y(this._rctx,m),this._fboPools.push(new _(this._rctx)),this._fboPools.push(new _(this._rctx))}dispose(){this._fboPools.forEach((e=>{e.clear(),e=null})),this._fboPools=null,this._doubleBufferFbo.forEach((r=>e(r))),this._vaoQuad=e(this._vaoQuad),this._vectorTileHelper=e(this._vectorTileHelper),this._backgroundTechnique=r(this._backgroundTechnique),this._applyOpacityTechnique=r(this._applyOpacityTechnique),this._blendLayersTechnique=r(this._blendLayersTechnique)}_getBlendLayersTechnique(e,r,t){return this._blendLayersTechniqueConfig.output=r,this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechniqueConfig.baseOpacityMode=t?r===b.Composite?p.OnBaseLayer:p.OnBackground:p.One,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(a,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}drawBackground(e,r){const t=this._getBlendLayersTechnique(d.Normal,r,!1),i=this._rctx.bindTechnique(t,e,this._bindParameters);this._render(i)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(g.TRIANGLE_STRIP,0,q(this._vaoQuad,"geometry"))}drawRasterData(e,r){if(t(r.texture))return;const i=r.baseOpacity<1;r.blendMode!==d.Normal||i?(r.fboTexture=this.currentFBO.colorTexture,this.switchPool(this.currentFBO.width)):r.fboTexture=null;const o=this._getBlendLayersTechnique(r.blendMode,e,i),s=this._rctx.bindTechnique(o,r,this._bindParameters);this._render(s)}drawImageryTileData(e,r,t){const i=e.sourceLayerInfo.data;if(!i.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,h.MAP).ensureSymbolizerParameters(i),t.blendMode===d.Normal?t.fboTexture=null:(t.fboTexture=this.currentFBO.colorTexture,this.switchPool(this.currentFBO.width));const o=this._getRasterColorizerTechnique(i,r,t.blendMode),s=this._rctx.bindTechnique(o);if(!i.bind(this._rctx))return;i.opacity=t.opacity;const l=i.getUniforms();l.scale=e.scale,l.offset=e.offset,l.backgroundColor=t.backgroundColor,l.fboTexture=t.fboTexture,o.bindPass(l,null),this._render(s)}_getRasterColorizerTechnique(e,r,i){const o=e.symbolizerParameters,l=["stretch","lut","hillshade"].indexOf(o.type);return t(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new c,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.tileBlendInput=r===b.ColorComposite?f.ColorComposite:r===b.GridComposite?f.GridComposite:f.LayerOnly,this._rasterColorizerConfig.blendMode=i,this._rasterColorizerConfig.colorizerType=l,this._rasterColorizerConfig.applyColormap=!!o.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(u,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,r,t,s,l,n,a){const c=this._rctx,u=r.sourceLayerInfo.data,_=r.tile.surface.layerViewByIndex(r.layerIndex,h.MAP);let f;return this._getBlendLayersTechnique(e.blendMode,a,e.baseOpacity<1).bindPipelineState(c),e.opacity<1||e.blendMode!==d.Normal?(f=this._acquire(l),c.bindFramebuffer(f),c.setClearColor(1,1,1,0),c.clearSafe(x.COLOR_BUFFER_BIT|x.DEPTH_BUFFER_BIT)):n&&c.clearSafe(x.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(c,r.sourceLod,u,_.painter,_.layer.styleRepository,_.schemaHelper,Math.round(1/r.scale),r.offset,s,t),!i(f)||(c.bindFramebuffer(this.currentFBO),e.texture=f.colorTexture,e.offset=o,e.scale=1,this.drawRasterData(a,e),this._release(f),n)}copyFBOToTexture(e){const r=this._rctx,t=r.bindTexture(e.texture,C.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;r.gl.copyTexImage2D(B.TEXTURE_2D,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),r.bindTexture(t,C.TEXTURE_UNIT_FOR_UPDATES)}_initFBO(e,r){this._rctx.bindFramebuffer(e),this._rctx.setViewport(0,0,r,r),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(x.COLOR_BUFFER_BIT|x.DEPTH_BUFFER_BIT)}_acquire(e){return this._fboPools[this._poolToWrite].acquire(e)}bindPool(e,r){this._poolToWrite=e,this._doubleBufferFbo[this._poolToWrite]=this._acquire(r),this._initFBO(this._doubleBufferFbo[this._poolToWrite],r)}switchPool(e){this._fboPools[this._poolToWrite].release(this.currentFBO),this._poolToWrite=0===this._poolToWrite?1:0,this.bindPool(this._poolToWrite,e)}get currentFBO(){return this._doubleBufferFbo[this._poolToWrite]}_release(e){this._fboPools[this._poolToWrite].release(e)}releasePool(){this._rctx.bindFramebuffer(null),this._release(this.currentFBO)}cleanupFBOPool(e,r){e===this._lastPixelRatio&&r===this._lastNumLayers||(this._fboPools.forEach((e=>e.clear())),this._lastPixelRatio=e,this._lastNumLayers=r)}}export{P as TileCompositor};
|
|
5
|
+
import{disposeMaybe as e,releaseMaybe as r,isNone as t,isSome as i}from"../../../core/maybe.js";import{Z as o}from"../../../chunks/vec2f64.js";import{RasterColorizerStretchType as s}from"../../2d/engine/imagery/enums.js";import{VectorTileRendererHelper3D as l}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{BlendLayersTechniqueConfiguration as n,BlendLayersTechnique as a}from"./BlendLayersTechnique.js";import{LayerClass as h}from"./LayerClass.js";import{RasterColorizerTechniqueConfiguration as c,RasterColorizerTechnique as u}from"./RasterColorizerTechnique.js";import{FBOPool as _}from"./support/FBOPool.js";import{LayerBlendMode as d}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{TileBlendInput as f}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{B as b,b as p}from"../../../chunks/BlendLayers.glsl.js";import{BindParameters as T}from"../webgl-engine/lib/BindParameters.js";import{Pos2Tex as m}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as y}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as g,ClearBufferBit as x,TextureType as B}from"../../webgl/enums.js";import{Texture as C}from"../../webgl/Texture.js";import{vertexCount as q}from"../../webgl/Util.js";class P{constructor(e,r){this._rctx=e,this._techniqueRepository=r,this._fboPools=[],this._doubleBufferFbo=[],this._vectorTileHelper=new l,this._bindParameters=new T(null,null,null),this._blendLayersTechniqueConfig=new n,this._poolToWrite=0,this._vaoQuad=y(this._rctx,m),this._fboPools.push(new _(this._rctx)),this._fboPools.push(new _(this._rctx))}dispose(){this._fboPools.forEach((e=>{e.clear(),e=null})),this._fboPools=null,this._doubleBufferFbo.forEach((r=>e(r))),this._vaoQuad=e(this._vaoQuad),this._vectorTileHelper=e(this._vectorTileHelper),this._backgroundTechnique=r(this._backgroundTechnique),this._applyOpacityTechnique=r(this._applyOpacityTechnique),this._blendLayersTechnique=r(this._blendLayersTechnique)}_getBlendLayersTechnique(e,r,t){return this._blendLayersTechniqueConfig.output=r,this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechniqueConfig.baseOpacityMode=t?r===b.Composite?p.OnBaseLayer:p.OnBackground:p.One,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(a,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}drawBackground(e,r){const t=this._getBlendLayersTechnique(d.Normal,r,!1),i=this._rctx.bindTechnique(t,e,this._bindParameters);this._render(i)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(g.TRIANGLE_STRIP,0,q(this._vaoQuad,"geometry"))}drawRasterData(e,r){if(t(r.texture))return;const i=r.baseOpacity<1;r.blendMode!==d.Normal||i?(r.fboTexture=this.currentFBO.colorTexture,this.switchPool(this.currentFBO.width)):r.fboTexture=null;const o=this._getBlendLayersTechnique(r.blendMode,e,i),s=this._rctx.bindTechnique(o,r,this._bindParameters);this._render(s)}drawImageryTileData(e,r,t){const i=e.sourceLayerInfo.data;if(!i.source)return;e.tile.surface.layerViewByIndex(e.layerIndex,h.MAP).ensureSymbolizerParameters(i),t.blendMode===d.Normal?t.fboTexture=null:(t.fboTexture=this.currentFBO.colorTexture,this.switchPool(this.currentFBO.width));const o=this._getRasterColorizerTechnique(i,r,t.blendMode),s=this._rctx.bindTechnique(o);if(!i.bind(this._rctx))return;i.opacity=t.opacity;const l=i.getUniforms();l.scale=e.scale,l.offset=e.offset,l.backgroundColor=t.backgroundColor,l.fboTexture=t.fboTexture,o.bindPass(l,null),this._render(s)}_getRasterColorizerTechnique(e,r,i){const o=e.symbolizerParameters,l=["stretch","lut","hillshade"].indexOf(o.type);return t(this._rasterColorizerConfig)&&(this._rasterColorizerConfig=new c,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.tileBlendInput=r===b.ColorComposite?f.ColorComposite:r===b.GridComposite?f.GridComposite:f.LayerOnly,this._rasterColorizerConfig.blendMode=i,this._rasterColorizerConfig.colorizerType=l,this._rasterColorizerConfig.applyColormap=!!o.colormap,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?s.Noop:s.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(u,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,r,t,s,l,n,a){const c=this._rctx,u=r.sourceLayerInfo.data,_=r.tile.surface.layerViewByIndex(r.layerIndex,h.MAP);let f;return this._getBlendLayersTechnique(e.blendMode,a,e.baseOpacity<1).bindPipelineState(c),e.opacity<1||e.blendMode!==d.Normal||a!==b.Composite?(f=this._acquire(l),c.bindFramebuffer(f),c.setClearColor(1,1,1,0),c.clearSafe(x.COLOR_BUFFER_BIT|x.DEPTH_BUFFER_BIT)):n&&c.clearSafe(x.DEPTH_BUFFER_BIT),this._vectorTileHelper.render(c,r.sourceLod,u,_.painter,_.layer.styleRepository,_.schemaHelper,Math.round(1/r.scale),r.offset,s,t),!i(f)||(c.bindFramebuffer(this.currentFBO),e.texture=f.colorTexture,e.offset=o,e.scale=1,this.drawRasterData(a,e),this._release(f),n)}copyFBOToTexture(e){const r=this._rctx,t=r.bindTexture(e.texture,C.TEXTURE_UNIT_FOR_UPDATES),i=e.descriptor;r.gl.copyTexImage2D(B.TEXTURE_2D,0,i.pixelFormat,0,0,i.width,i.height,0),e.generateMipmap(),r.bindTexture(t,C.TEXTURE_UNIT_FOR_UPDATES)}_initFBO(e,r){this._rctx.bindFramebuffer(e),this._rctx.setViewport(0,0,r,r),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.clearSafe(x.COLOR_BUFFER_BIT|x.DEPTH_BUFFER_BIT)}_acquire(e){return this._fboPools[this._poolToWrite].acquire(e)}bindPool(e,r){this._poolToWrite=e,this._doubleBufferFbo[this._poolToWrite]=this._acquire(r),this._initFBO(this._doubleBufferFbo[this._poolToWrite],r)}switchPool(e){this._fboPools[this._poolToWrite].release(this.currentFBO),this._poolToWrite=0===this._poolToWrite?1:0,this.bindPool(this._poolToWrite,e)}get currentFBO(){return this._doubleBufferFbo[this._poolToWrite]}_release(e){this._fboPools[this._poolToWrite].release(e)}releasePool(){this._rctx.bindFramebuffer(null),this._release(this.currentFBO)}cleanupFBOPool(e,r){e===this._lastPixelRatio&&r===this._lastNumLayers||(this._fboPools.forEach((e=>e.clear())),this._lastPixelRatio=e,this._lastNumLayers=r)}}export{P as TileCompositor};
|
package/views/MapView.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import n from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as p,unwrap as h,isNone as c}from"../core/maybe.js";import{throwIfAborted as d}from"../core/promiseUtils.js";import{watch as u,whenOnce as m,sync as g,syncAndInitial as f}from"../core/reactiveUtils.js";import{createScreenPoint as y}from"../core/screenUtils.js";import w from"../core/Warning.js";import{initialize as _}from"../core/workers/workers.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as V}from"../core/accessorSupport/decorators/subclass.js";import S from"../geometry/Extent.js";import j from"../geometry/Point.js";import{load as T,canProjectWithoutEngine as R,project as b,isLoaded as x}from"../geometry/projection.js";import{equals as M}from"../geometry/support/spatialReferenceUtils.js";import O from"../layers/support/TileInfo.js";import{BreakpointsOwner as k}from"./BreakpointsOwner.js";import{DOMContainer as z}from"./DOMContainer.js";import{PopupView as L}from"./PopupView.js";import P from"./View.js";import C from"./ViewAnimation.js";import E from"./2d/AnimationManager.js";import G from"./2d/FrameTask.js";import{layerView2DImporter as N}from"./2d/layerViewModuleImportUtils.js";import q from"./2d/MapViewConstraints.js";import D from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import A from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as F,setExtent as U,rotateTo as I,scaleTo as W,copy as B,create as H,extentToScale as $,resize as J,angleBetween as Q}from"./2d/viewpointUtils.js";import Z from"./2d/input/MapViewInputManager.js";import K from"./2d/layers/features/support/TileStore.js";import Y from"./2d/support/HighlightOptions.js";import{Timeline as X}from"./2d/support/Timeline.js";import ee from"./support/createScreenshotPlan.js";import{encode as te,encodeData as ie,getMaximumResolutionScale as se,getFormatAndQuality as re}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as ne,createScreenPointFromSupportedEvent as ae}from"./support/screenUtils.js";import{check as oe}from"./support/WebGLRequirements.js";import le from"./ui/2d/DefaultUI2D.js";import pe from"../webmap/background/ColorBackground.js";const he=l.getLogger("esri.views.MapView");let ce,de,ue,me,ge,fe;async function ye(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s,MagnifierView2D:r,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);de=e,ue=t,me=i,ge=s,fe=r,ce=n}const we=160;function _e(e){return e&&"esri.Viewpoint"===e.declaredClass}let ve=class extends(k(z(L(P)))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new G(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new Y,this.inputManager=new Z({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!1,this.timeline=new X,this.type="2d",this.ui=new le,this._pixelFormat={flipY:!0,premultipliedAlpha:!0},this.constraints=new q,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([u((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(we)}),g),this.on("resize",(e=>this._resizeHandler(e))),u((()=>this.animationManager?.animation),(e=>{this.animation=e}))]),_()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new K(this.featuresTilingScheme)}get initialExtentRequired(){const{scale:e,constraints:t,center:i,viewpoint:s,extent:r}=this;let n=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!r&&(t?.effectiveLODs||(n=-1),(!i||0===e&&-1===n)&&(!s||!p(s.targetGeometry)||"extent"!==s.targetGeometry.type&&!s.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!x()||(this._pePromise||(this._pePromise=T().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=this.spatialReference,i=h(e.targetGeometry);return!!R(i.spatialReference,t)||this._projectionEngineLoaded}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{e===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};e.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(e){void 0===e?this._clearOverride("background"):this._override("background",e)}get center(){if(!this.ready)return this._get("center");const{center:e,spatialReference:t}=this.state.paddedViewState;return new j({x:e[0],y:e[1],spatialReference:t})}set center(e){if(null==e)return;if(!this.ready)return this._set("center",e),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void he.error(new n("mapview:invalid-center","could not project the value in the view's spatial reference",{input:e,error:s}))}const i=this.viewpoint;F(i,i,t),this.viewpoint=i}set constraints(e){const t=this._get("constraints");t&&(this.handles.remove("map-view-constraints"),t.destroy()),this._set("constraints",e),e&&(e.view=this,this.ready&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint)),this.handles.add(u((()=>e.version),(()=>{this.ready&&this.state&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint))}),g),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(e){if(null==e)return;if(!e.width||!e.height)return void he.error(new n("mapview:invalid-extent","invalid extent size"));if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void he.error(new n("mapview:invalid-extent","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;U(i,i,t,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(e){this.ready?(this.state.padding=e,this._set("padding",this.state.padding)):this._set("padding",e)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(e){if(isNaN(e))return;if(!this.ready)return void this._set("rotation",e);const t=this.viewpoint;I(t,t,e),this.viewpoint=t}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(e){if(!e||isNaN(e))return;if(!this.ready){this._set("scale",e),this._set("zoom",-1);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}const t=this.viewpoint;W(t,t,e),this.viewpoint=t}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const e=this.state.paddedViewState;return e&&e.viewpoint.clone()}set viewpoint(e){if(null==e)return;if(!this.ready)return this._set("viewpoint",e),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");let t,s;try{t=this._project(e,this.spatialReference),!e.scale||isNaN(e.scale)?s=new n("mapview:invalid-viewpoint",`invalid scale value of ${e.scale}`):c(e.targetGeometry)&&(s=new n("mapview:invalid-viewpoint","geometry not defined"))}catch(a){s=new n("mapview:invalid-viewpoint","could not project the value in the view's spatial reference",{error:a})}if(s)return void he.error(s);this._scaleBeforeChangingSpatialReference=null;const r=new i({targetGeometry:new j,scale:0,rotation:0});B(r,t),this.constraints.constrain(r,this.state.paddedViewState.viewpoint),this.state.viewpoint=r,this.frameTask.requestFrame(),this._set("viewpoint",r)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(e){if(null==e)return;if(!this.ready){this._set("zoom",e),this._set("scale",0);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}if(!this.constraints.effectiveLODs)return void this._set("zoom",-1);const t=this.viewpoint;W(t,t,this.constraints.zoomToScale(e)),this.viewpoint=t,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(e,t){if(e)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),t).then((()=>{const i={animate:!0,...t},s=H(e,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));he.error("#goTo()","target cannot be null or undefined")}async hitTest(e,t){const i=ne(e)?ae(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,r=!1,n=null,a=null;t?.include?Te(t.include,je(this,(e=>s.add(e)),(e=>{n||(n=new Set),n.add(e)}),(e=>s.add(e)),(()=>r=!0))):(r=!0,s=new Set(this.allLayerViews)),t?.exclude&&Te(t.exclude,je(this,(e=>s.delete(e)),(e=>{a||(a=new Set),a.add(e)})));const o=this.allLayerViews.filter((e=>!e.suspended&&s.has(e))).reverse(),l=this.toMap(i);let h=[...r?this.graphicsView.hitTest(l).map((e=>({type:"graphic",graphic:e,layer:null,mapPoint:l}))):[],...await Promise.all(o.map((e=>e.hitTest(l,i))).toArray())].filter(p).flat().filter(p);return n&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||n.has(Se(e.graphic))))),a&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||a.has(Se(e.graphic))))),{screenPoint:i,results:h}}async takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return te(i,{format:t.format,quality:t.quality,rotation:0,disableDecorations:!1},this._pixelFormat)}async _takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return ie(i,this._pixelFormat)}_createScreenshotPlan(e){e=e||{};const t=this.supersampleScreenshotsEnabled?Math.min(4,se(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:s,quality:r}=re(e.format,e.quality);return ee(e,t,this.size,this.padding,s,r,i,e.rotation)}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}toMap(e){if(!this.ready)return null;const t=ne(e)?ae(this,e):e,i=[0,0],[s,r]=this.state.toMap(i,[t.x,t.y]),n=this.spatialReference;return new j({x:s,y:r,spatialReference:n})}toScreen(e){if(!this.ready)return null;const t=this._project(e,this.spatialReference),i=[t.x,t.y];return this.state.toScreen(i,i),y(i[0],i[1])}on(e,t,i,s){const r=this.inputManager&&this.viewEvents.on(e,t,i,s);return r||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||null}hasLayerViewModule(e){return N.hasLayerViewModule(e)}importLayerView(e){return N.importLayerView(e)}pixelSizeAt(){return this.ready?this.state.resolution:(he.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(e){return this.hitTest(e).then((t=>({...t,mapPoint:this.toMap(e)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let e=oe(this.type);return a("safari")&&a("safari")<9&&(e=new n("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),p(e)?(he.warn("#validate()",e.message),Promise.reject(e)):ye()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new C),this.animation}_cancellableGoTo(e,t,i){const s=()=>e===this._gotoTask,r=i.then((()=>{s()&&(this.animation=null)})).catch((e=>{throw s()&&(this.animation=null,t.done||(t.stop(),this.frameTask.animationInProgress=!1)),e})),n=new Promise((e=>e(r)));return t.when().catch((()=>{s()&&n.cancel&&n.cancel()})),n}_gotoImmediate(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(d(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=e,s.finish()}));return this._cancellableGoTo(i,s,r)}_flipStationary(e){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const e=performance.now()-this._lastStationaryEventTimestamp;e<we&&(this._stationaryTimer=this._flipStationary(e))}),e)),this._stationaryTimer}_getDefaultViewpoint(){const{constraints:e,initialExtent:t,map:s}=this;if(!e)return null;const r=s&&"initialViewProperties"in s&&s.initialViewProperties,n={zoom:this._get("zoom"),scale:this._get("scale"),center:this._get("center"),extent:this._get("extent"),rotation:this._get("rotation"),viewpoint:this._get("viewpoint"),spatialReference:this._userSpatialReference};e.effectiveLODs?-1!==n.zoom&&(n.scale=e.zoomToScale(n.zoom)):n.zoom=-1;let a=null,o=null,l=0;const c=n.viewpoint&&n.viewpoint.rotation,d=n.viewpoint&&n.viewpoint.targetGeometry;p(d)&&("extent"===d.type?a=d:"point"===d.type&&(o=d,l=n.viewpoint.scale));const u=n.extent||a||h(r?.viewpoint?.targetGeometry)?.extent||t,m=n.center||o||u?.center,g=n.scale||l||r?.viewpoint?.scale||u&&$(u,this.size),f=n.rotation||c||r?.viewpoint?.rotation||0;return m&&g?new i({targetGeometry:m,scale:g,rotation:f}):null}_gotoAnimated(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(d(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");return s.update(e),this.animationManager.animate(s,this.viewpoint,t),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,r)}_project(e,t){const i=e&&e.targetGeometry||e;if(!t)return e;if(!i)return null;if(t.imageCoordinateSystem||i.spatialReference?.imageCoordinateSystem)return e;if(M(t,i.spatialReference))return e;const s=b(i,t);if(!s)throw new n("mapview:projection-not-possible","projecting input geometry to target spatial reference returned a null value",{geometry:i,spatialReference:t});return _e(e)?(e.targetGeometry=s,e):s}_resizeHandler(e){if(!this.ready)return;const t=this.state;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();t.size=[e.width,e.height],J(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint(),t=e.targetGeometry;try{this._project(e,this.spatialReference)}catch(o){he.warn(new w("mapview:startup-projection-error","projection of initial viewpoint to the view's spatial reference, defaulting to the initial viewpoint.",{center:t.toJSON(),spatialReference:this.spatialReference,error:o})),e.targetGeometry=this.defaultsFromMap.extent?.center||new j({x:0,y:0,spatialReference:this.spatialReference})}this.constraints?.fit(e),this._set("state",new D({padding:this._get("padding"),size:this.size,viewpoint:e})),this.graphics.owner=this;const i=new ce(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this._stage=i,this._magnifierView=new fe,this._magnifierView.magnifier=this.magnifier;const s=new me({view:this});this._set("labelManager",s);const r=new E({view:this});this._set("animationManager",r);const n=new ge({view:this,animationManager:r});this._set("mapViewNavigation",n),this._setupSpatialReferenceDependentProperties(),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("post-render",(()=>this._set("rendering",i.renderRequested))),i.on("will-render",(()=>this._set("rendering",i.renderRequested))),i.on("webgl-error",(e=>this.fatalError=e.error)),u((()=>this.stationary),(e=>i.stationary=e),f),u((()=>this.background),(e=>{i.background=e,this._magnifierView.background=e}),f),u((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),f),u((()=>this.renderingOptions),(e=>i.renderingOptions=e),f),u((()=>this.highlightOptions),(e=>i.highlightOptions=e),f),u((()=>this.state.id),(()=>i.state=this.state),f)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask&&this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.handles.remove("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null),this._set("ready",!1);const{center:[e,t],spatialReference:i,rotation:s,scale:r}=this.state.paddedViewState,n=new j({x:e,y:t,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",n),this._set("zoom",-1),this._set("rotation",s),this._set("scale",r),this._set("spatialReference",i),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new A(O.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new de({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new ue(e)});this.frameTask.graphicsView=t,this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),this.frameTask.graphicsView=null,e.destroy(),this._set("featuresTilingScheme",null)}_spatialReferenceChanged(e){if(!this.ready)return;this.frameTask.stop();for(const i of this.allLayerViews)i.processDetach();this._destroySpatialReferenceDependentProperties();const t=this.state.paddedViewState.clone();if(c(this._scaleBeforeChangingSpatialReference))this._scaleBeforeChangingSpatialReference=t.scale;else{const e=t.viewpoint.clone();e.scale=this._scaleBeforeChangingSpatialReference,t.viewpoint=e}const s=t.clone(),[r,n]=t.center;let o=null;try{o=this._project(new j({x:r,y:n,spatialReference:t.spatialReference}),e)}catch(p){x()||he.warn(new w("mapview:spatial-reference-change","could not project the view's center to the new spatial reference",{center:o.toJSON(),spatialReference:e,error:p}))}o||(o=new j({x:0,y:0,spatialReference:e}));const l=F(new i({targetGeometry:new j,scale:0,rotation:0}),t.viewpoint,o);s.viewpoint=l;try{const i=20,r=[t.size[0]/2,t.size[1]/2],n=[r[0]+i,r[1]],o=t.toMap([0,0],n),{x:p,y:h}=this._project(new j({x:o[0],y:o[1],spatialReference:t.spatialReference}),e);o[0]=p,o[1]=h,s.toScreen(o,o);const c=Q(r,o,n),d=Math.hypot(o[0]-r[0],o[1]-r[1])/i;!Number.isFinite(d)||Math.abs(d)>4?(l.rotation=0,l.targetGeometry=new j({x:0,y:0,spatialReference:e})):(l.scale*=d,l.scale>a("mapview-srswitch-adjust-rotation-scale-threshold")?l.rotation=0:l.rotation+=Number.isFinite(c)?c:0)}catch{}this._get("constraints").constrain(l,null),this._get("state").viewpoint=l,this._stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const i of this.allLayerViews)i.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}};ve.type="2d",e([v({readOnly:!0})],ve.prototype,"animationManager",void 0),e([v({constructOnly:!0})],ve.prototype,"deactivatedWebGLExtensions",void 0),e([v({constructOnly:!0})],ve.prototype,"debugWebGLExtensions",void 0),e([v({readOnly:!0})],ve.prototype,"featuresTilingScheme",void 0),e([v({readOnly:!0})],ve.prototype,"fullOpacity",void 0),e([v({readOnly:!0})],ve.prototype,"graphicsTileStore",null),e([v()],ve.prototype,"graphicsView",void 0),e([v({readOnly:!0})],ve.prototype,"state",void 0),e([v()],ve.prototype,"initialExtentRequired",null),e([v()],ve.prototype,"labelManager",void 0),e([v({readOnly:!0})],ve.prototype,"resourceManager",null),e([v({readOnly:!0})],ve.prototype,"textureManager",null),e([v({readOnly:!0})],ve.prototype,"mapViewNavigation",void 0),e([v({constructOnly:!0})],ve.prototype,"renderCanvas",void 0),e([v()],ve.prototype,"renderingOptions",void 0),e([v({readOnly:!0})],ve.prototype,"rendering",void 0),e([v({constructOnly:!0})],ve.prototype,"supersampleScreenshotsEnabled",void 0),e([v({readOnly:!0})],ve.prototype,"supportsGround",void 0),e([v()],ve.prototype,"_stationaryTimer",void 0),e([v()],ve.prototype,"_defaultsFromMapSettings",null),e([v()],ve.prototype,"_pePromise",void 0),e([v({readOnly:!0})],ve.prototype,"typeSpecificPreconditionsReady",null),e([v()],ve.prototype,"animation",null),e([v({type:pe})],ve.prototype,"background",null),e([v({value:null,type:j,dependsOn:["state.id","ready"]})],ve.prototype,"center",null),e([v({type:q})],ve.prototype,"constraints",null),e([v({value:null,type:S,dependsOn:["state.id","ready"]})],ve.prototype,"extent",null),e([v()],ve.prototype,"floors",void 0),e([v({type:Y})],ve.prototype,"highlightOptions",void 0),e([v({readOnly:!0})],ve.prototype,"inputManager",void 0),e([v()],ve.prototype,"map",void 0),e([v({value:{top:0,right:0,bottom:0,left:0},cast:e=>({top:0,right:0,bottom:0,left:0,...e})})],ve.prototype,"padding",null),e([v()],ve.prototype,"resizeAlign",void 0),e([v({readOnly:!0,dependsOn:["state.id"]})],ve.prototype,"resolution",null),e([v({value:0,type:Number,dependsOn:["state.id","ready"]})],ve.prototype,"rotation",null),e([v({value:0,type:Number,dependsOn:["state.id","ready"]})],ve.prototype,"scale",null),e([v({constructOnly:!0})],ve.prototype,"spatialReferenceLocked",void 0),e([v()],ve.prototype,"stationary",null),e([v({type:X,readOnly:!0})],ve.prototype,"timeline",void 0),e([v({readOnly:!0})],ve.prototype,"type",void 0),e([v({readOnly:!0})],ve.prototype,"updating",null),e([v({value:null,type:i,dependsOn:["state.id","ready"]})],ve.prototype,"viewpoint",null),e([v({value:-1,dependsOn:["state.id","ready"]})],ve.prototype,"zoom",null),e([v({type:Boolean})],ve.prototype,"navigating",null),e([v({type:le})],ve.prototype,"ui",void 0),ve=e([V("esri.views.MapView")],ve);const Ve=ve;function Se(e){const t=e.getObjectId();return t?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${t}`:`"MapView/${e.uid}`}function je(e,i,s,r,n){return a=>{if(a instanceof t){if(a.layer===e)n?.();else{const t=e.allLayerViews.find((e=>e.layer===a.layer));t&&r?.(t)}s(Se(a))}else{const t=e.allLayerViews.find((e=>e.layer===a));t&&i(t)}}}function Te(e,t){if(e)if(o(e))for(const i of e)if(o(i))for(const e of i)t(e);else t(i);else t(e)}export{Ve as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import i from"../Viewpoint.js";import s from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import n from"../core/Error.js";import a from"../core/has.js";import{isIterable as o}from"../core/iteratorUtils.js";import l from"../core/Logger.js";import{isSome as p,unwrap as h,isNone as c}from"../core/maybe.js";import{throwIfAborted as d}from"../core/promiseUtils.js";import{watch as u,whenOnce as m,sync as g,syncAndInitial as f}from"../core/reactiveUtils.js";import{createScreenPoint as y}from"../core/screenUtils.js";import w from"../core/Warning.js";import{initialize as _}from"../core/workers/workers.js";import{property as v}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as V}from"../core/accessorSupport/decorators/subclass.js";import S from"../geometry/Extent.js";import j from"../geometry/Point.js";import{isLoaded as T,load as R,canProjectWithoutEngine as b,project as x}from"../geometry/projection.js";import{equals as M}from"../geometry/support/spatialReferenceUtils.js";import O from"../layers/support/TileInfo.js";import{BreakpointsOwner as k}from"./BreakpointsOwner.js";import{DOMContainer as z}from"./DOMContainer.js";import{PopupView as L}from"./PopupView.js";import P from"./View.js";import C from"./ViewAnimation.js";import E from"./2d/AnimationManager.js";import G from"./2d/FrameTask.js";import{layerView2DImporter as N}from"./2d/layerViewModuleImportUtils.js";import q from"./2d/MapViewConstraints.js";import D from"./2d/PaddedViewState.js";import"./2d/tiling/PagedTileQueue.js";import A from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{centerAt as F,setExtent as U,rotateTo as I,scaleTo as W,copy as B,create as H,extentToScale as $,resize as J,angleBetween as Q}from"./2d/viewpointUtils.js";import Z from"./2d/input/MapViewInputManager.js";import K from"./2d/layers/features/support/TileStore.js";import Y from"./2d/support/HighlightOptions.js";import{Timeline as X}from"./2d/support/Timeline.js";import ee from"./support/createScreenshotPlan.js";import{encode as te,encodeData as ie,getMaximumResolutionScale as se,getFormatAndQuality as re}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as ne,createScreenPointFromSupportedEvent as ae}from"./support/screenUtils.js";import{check as oe}from"./support/WebGLRequirements.js";import le from"./ui/2d/DefaultUI2D.js";import pe from"../webmap/background/ColorBackground.js";const he=l.getLogger("esri.views.MapView");let ce,de,ue,me,ge,fe;async function ye(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s,MagnifierView2D:r,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);de=e,ue=t,me=i,ge=s,fe=r,ce=n}const we=160;function _e(e){return e&&"esri.Viewpoint"===e.declaredClass}let ve=class extends(k(z(L(P)))){constructor(e){super(e),this._magnifierView=null,this._stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.graphicsView=null,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.rendering=!1,this.supersampleScreenshotsEnabled=!1,this.supportsGround=!1,this._stationaryTimer=null,this.frameTask=new G(this),this._pePromise=null,this.floors=new s,this.highlightOptions=new Y,this.inputManager=new Z({view:this}),this.map=null,this.resizeAlign="center",this.spatialReferenceLocked=!1,this.timeline=new X,this.type="2d",this.ui=new le,this._pixelFormat={flipY:!0,premultipliedAlpha:!0},this.constraints=new q,this.padding={top:0,right:0,bottom:0,left:0},this.handles.add([u((()=>this.viewpoint),(()=>{this._lastStationaryEventTimestamp=performance.now(),this._flipStationary(we)}),g),this.on("resize",(e=>this._resizeHandler(e))),u((()=>this.animationManager?.animation),(e=>{this.animation=e}))]),_()}destroy(){this._set("preconditionsReady",!1),this._gotoTask=this.frameTask=null,this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new K(this.featuresTilingScheme)}get initialExtentRequired(){const{scale:e,constraints:t,center:i,viewpoint:s,extent:r}=this;let n=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!r&&(t?.effectiveLODs||(n=-1),(!i||0===e&&-1===n)&&(!s||!p(s.targetGeometry)||"extent"!==s.targetGeometry.type&&!s.scale)))}get resourceManager(){return this._stage.resourceManager}get textureManager(){return this._stage.painter.textureManager}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get _projectionEngineLoaded(){return!!T()||(this._pePromise||(this._pePromise=R().finally((()=>{this._pePromise=null}))),!1)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=this.spatialReference,i=h(e.targetGeometry);return!!b(i.spatialReference,t)||this._projectionEngineLoaded}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),!e||e.isFulfilled())return void this._set("animation",null);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{e===this._get("animation")&&(this._set("animation",null),this.frameTask.requestFrame()),this.frameTask.animationInProgress=!1};e.when(i,i)}get background(){return this.get("map.initialViewProperties.background")||null}set background(e){void 0===e?this._clearOverride("background"):this._override("background",e)}get center(){if(!this.ready)return this._get("center");const{center:e,spatialReference:t}=this.state.paddedViewState;return new j({x:e[0],y:e[1],spatialReference:t})}set center(e){if(null==e)return;if(!this.ready)return this._set("center",e),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void he.error(new n("mapview:invalid-center","could not project the value in the view's spatial reference",{input:e,error:s}))}const i=this.viewpoint;F(i,i,t),this.viewpoint=i}set constraints(e){const t=this._get("constraints");t&&(this.handles.remove("map-view-constraints"),t.destroy()),this._set("constraints",e),e&&(e.view=this,this.ready&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint)),this.handles.add(u((()=>e.version),(()=>{this.ready&&this.state&&(this.state.viewpoint=e.fit(this.state.paddedViewState.viewpoint))}),g),"map-view-constraints"))}get extent(){return this.ready?this.state.paddedViewState.extent.clone():this._get("extent")}set extent(e){if(null==e)return;if(!e.width||!e.height)return void he.error(new n("mapview:invalid-extent","invalid extent size"));if(!this.ready)return this._set("extent",e),this._set("center",null),this._set("viewpoint",null),this._set("scale",0),this._set("zoom",-1),void this.notifyChange("initialExtentRequired");let t;try{t=this._project(e,this.spatialReference)}catch(s){return void he.error(new n("mapview:invalid-extent","could not project the value in the view's spatial reference",{error:s}))}const i=this.viewpoint;U(i,i,t,this.size,{constraints:this.constraints}),this.viewpoint=i}get padding(){return this.ready?this.state.padding:this._get("padding")}set padding(e){this.ready?(this.state.padding=e,this._set("padding",this.state.padding)):this._set("padding",e)}get resolution(){return this.state?this.state.resolution:0}get rotation(){return this.ready?this.state.rotation:this._get("rotation")}set rotation(e){if(isNaN(e))return;if(!this.ready)return void this._set("rotation",e);const t=this.viewpoint;I(t,t,e),this.viewpoint=t}get scale(){return this.ready?this.state.scale:this._get("scale")}set scale(e){if(!e||isNaN(e))return;if(!this.ready){this._set("scale",e),this._set("zoom",-1);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}const t=this.viewpoint;W(t,t,e),this.viewpoint=t}get stationary(){return!(this.animation||this.navigating||this.resizing||this._stationaryTimer)}get updating(){return!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)))}get viewpoint(){if(!this.ready)return this._get("viewpoint");const e=this.state.paddedViewState;return e&&e.viewpoint.clone()}set viewpoint(e){if(null==e)return;if(!this.ready)return this._set("viewpoint",e),this._set("extent",null),this._set("center",null),this._set("zoom",-1),this._set("scale",0),void this.notifyChange("initialExtentRequired");let t,s;try{t=this._project(e,this.spatialReference),!e.scale||isNaN(e.scale)?s=new n("mapview:invalid-viewpoint",`invalid scale value of ${e.scale}`):c(e.targetGeometry)&&(s=new n("mapview:invalid-viewpoint","geometry not defined"))}catch(a){s=new n("mapview:invalid-viewpoint","could not project the value in the view's spatial reference",{error:a})}if(s)return void he.error(s);this._scaleBeforeChangingSpatialReference=null;const r=new i({targetGeometry:new j,scale:0,rotation:0});B(r,t),this.constraints.constrain(r,this.state.paddedViewState.viewpoint),this.state.viewpoint=r,this.frameTask.requestFrame(),this._set("viewpoint",r)}get zoom(){return this.ready?this.constraints.scaleToZoom(this.scale):this._get("zoom")}set zoom(e){if(null==e)return;if(!this.ready){this._set("zoom",e),this._set("scale",0);const t=this._get("extent");return t&&(this._set("extent",null),this._set("center",t.center)),void this.notifyChange("initialExtentRequired")}if(!this.constraints.effectiveLODs)return void this._set("zoom",-1);const t=this.viewpoint;W(t,t,this.constraints.zoomToScale(e)),this.viewpoint=t,this._set("zoom",this.constraints.scaleToZoom(this.scale))}get navigating(){return!(!this.mapViewNavigation||!this.mapViewNavigation.interacting)}goTo(e,t){if(e)return this.animation&&(this.animation=null),this._createAnimation(),m((()=>this.ready),t).then((()=>{const i={animate:!0,...t},s=H(e,this);return this.animation.update(s),this._gotoTask={},i.animate?this._gotoAnimated(s,i):this._gotoImmediate(s,i)}));he.error("#goTo()","target cannot be null or undefined")}async hitTest(e,t){const i=ne(e)?ae(this,e):e;if(!this.ready||isNaN(i.x)||isNaN(i.y))return{screenPoint:i,results:[]};let s=new Set,r=!1,n=null,a=null;t?.include?Te(t.include,je(this,(e=>s.add(e)),(e=>{n||(n=new Set),n.add(e)}),(e=>s.add(e)),(()=>r=!0))):(r=!0,s=new Set(this.allLayerViews)),t?.exclude&&Te(t.exclude,je(this,(e=>s.delete(e)),(e=>{a||(a=new Set),a.add(e)})));const o=this.allLayerViews.filter((e=>!e.suspended&&s.has(e))).reverse(),l=this.toMap(i);let h=[...r?this.graphicsView.hitTest(l).map((e=>({type:"graphic",graphic:e,layer:null,mapPoint:l}))):[],...await Promise.all(o.map((e=>e.hitTest(l,i))).toArray())].filter(p).flat().filter(p);return n&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||n.has(Se(e.graphic))))),a&&(h=h.filter((e=>!("graphic"in e)||!e.graphic||a.has(Se(e.graphic))))),{screenPoint:i,results:h}}async takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return te(i,{format:t.format,quality:t.quality,rotation:0,disableDecorations:!1},this._pixelFormat)}async _takeScreenshot(e){const t=this._createScreenshotPlan(e),i=await this._stage.takeScreenshot(t);return ie(i,this._pixelFormat)}_createScreenshotPlan(e){e=e||{};const t=this.supersampleScreenshotsEnabled?Math.min(4,se(this.size,Math.min(4096,this._stage.context.parameters.maxTextureSize))):1;let i;e.layers?(i=[],e.layers.forEach((e=>{const t=this.allLayerViews.find((t=>t.layer.id===e.id));t&&"container"in t&&t.container&&i.push(t.container)}))):i=this._stage.children;const{format:s,quality:r}=re(e.format,e.quality);return ee(e,t,this.size,this.padding,s,r,i,e.rotation)}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}toMap(e){if(!this.ready)return null;const t=ne(e)?ae(this,e):e,i=[0,0],[s,r]=this.state.toMap(i,[t.x,t.y]),n=this.spatialReference;return new j({x:s,y:r,spatialReference:n})}toScreen(e){if(!this.ready)return null;const t=this._project(e,this.spatialReference),i=[t.x,t.y];return this.state.toScreen(i,i),y(i[0],i[1])}on(e,t,i,s){const r=this.inputManager&&this.viewEvents.on(e,t,i,s);return r||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||null}hasLayerViewModule(e){return N.hasLayerViewModule(e)}importLayerView(e){return N.importLayerView(e)}pixelSizeAt(){return this.ready?this.state.resolution:(he.error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}popupHitTest(e){return this.hitTest(e).then((t=>({...t,mapPoint:this.toMap(e)})))}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}validate(){let e=oe(this.type);return a("safari")&&a("safari")<9&&(e=new n("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:a("safari")})),p(e)?(he.warn("#validate()",e.message),Promise.reject(e)):ye()}_createAnimation(){return this.animation&&!this.animation.done||(this.animation=new C),this.animation}_cancellableGoTo(e,t,i){const s=()=>e===this._gotoTask,r=i.then((()=>{s()&&(this.animation=null)})).catch((e=>{throw s()&&(this.animation=null,t.done||(t.stop(),this.frameTask.animationInProgress=!1)),e})),n=new Promise((e=>e(r)));return t.when().catch((()=>{s()&&n.cancel&&n.cancel()})),n}_gotoImmediate(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(d(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");this.viewpoint=s.target=e,s.finish()}));return this._cancellableGoTo(i,s,r)}_flipStationary(e){return null!==this._stationaryTimer||(this._stationaryTimer=setTimeout((()=>{this._stationaryTimer=null;const e=performance.now()-this._lastStationaryEventTimestamp;e<we&&(this._stationaryTimer=this._flipStationary(e))}),e)),this._stationaryTimer}_getDefaultViewpoint(){const{constraints:e,initialExtent:t,map:s}=this;if(!e)return null;const r=s&&"initialViewProperties"in s&&s.initialViewProperties,n={zoom:this._get("zoom"),scale:this._get("scale"),center:this._get("center"),extent:this._get("extent"),rotation:this._get("rotation"),viewpoint:this._get("viewpoint"),spatialReference:this._userSpatialReference};e.effectiveLODs?-1!==n.zoom&&(n.scale=e.zoomToScale(n.zoom)):n.zoom=-1;let a=null,o=null,l=0;const c=n.viewpoint&&n.viewpoint.rotation,d=n.viewpoint&&n.viewpoint.targetGeometry;p(d)&&("extent"===d.type?a=d:"point"===d.type&&(o=d,l=n.viewpoint.scale));const u=n.extent||a||h(r?.viewpoint?.targetGeometry)?.extent||t,m=n.center||o||u?.center,g=n.scale||l||r?.viewpoint?.scale||u&&$(u,this.size),f=n.rotation||c||r?.viewpoint?.rotation||0;return m&&g?new i({targetGeometry:m,scale:g,rotation:f}):null}_gotoAnimated(e,t){const i=this._gotoTask,s=this.animation,r=e.then((e=>{if(d(t),i!==this._gotoTask)throw new n("view:goto-interrupted","Goto was interrupted");return s.update(e),this.animationManager.animate(s,this.viewpoint,t),s.when().then((()=>{}),(()=>{}))}));return this._cancellableGoTo(i,s,r)}_project(e,t){const i=e&&e.targetGeometry||e;if(!t)return e;if(!i)return null;if(t.imageCoordinateSystem||i.spatialReference?.imageCoordinateSystem)return e;if(M(t,i.spatialReference))return e;const s=x(i,t);if(!s)throw new n("mapview:projection-not-possible","projecting input geometry to target spatial reference returned a null value",{geometry:i,spatialReference:t});return _e(e)?(e.targetGeometry=s,e):s}_resizeHandler(e){if(!this.ready)return;const t=this.state;let i=this.state.paddedViewState.viewpoint;const s=this.state.paddedViewState.size.concat();t.size=[e.width,e.height],J(i,i,s,this.state.paddedViewState.size,this.resizeAlign),i=this.constraints.constrain(i,null),this.state.viewpoint=i}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint(),t=e.targetGeometry;try{this._project(e,this.spatialReference)}catch(o){he.warn(new w("mapview:startup-projection-error","projection of initial viewpoint to the view's spatial reference, defaulting to the initial viewpoint.",{center:t.toJSON(),spatialReference:this.spatialReference,error:o})),e.targetGeometry=this.defaultsFromMap.extent?.center||new j({x:0,y:0,spatialReference:this.spatialReference})}this.constraints?.fit(e),this._set("state",new D({padding:this._get("padding"),size:this.size,viewpoint:e})),this.graphics.owner=this;const i=new ce(this.surface,{canvas:this.renderCanvas,supersampleScreenshots:this.supersampleScreenshotsEnabled,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this._stage=i,this._magnifierView=new fe,this._magnifierView.magnifier=this.magnifier;const s=new me({view:this});this._set("labelManager",s);const r=new E({view:this});this._set("animationManager",r);const n=new ge({view:this,animationManager:r});this._set("mapViewNavigation",n),this._setupSpatialReferenceDependentProperties(),this.handles.add([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),i.on("post-render",(()=>this._set("rendering",i.renderRequested))),i.on("will-render",(()=>this._set("rendering",i.renderRequested))),i.on("webgl-error",(e=>this.fatalError=e.error)),u((()=>this.stationary),(e=>i.stationary=e),f),u((()=>this.background),(e=>{i.background=e,this._magnifierView.background=e}),f),u((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),f),u((()=>this.renderingOptions),(e=>i.renderingOptions=e),f),u((()=>this.highlightOptions),(e=>i.highlightOptions=e),f),u((()=>this.state.id),(()=>i.state=this.state),f)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask&&this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.handles.remove("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._stage.destroy(),this._stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask&&this.frameTask.stop(),this._stationaryTimer&&(clearTimeout(this._stationaryTimer),this._stationaryTimer=null),this._set("ready",!1);const{center:[e,t],spatialReference:i,rotation:s,scale:r}=this.state.paddedViewState,n=new j({x:e,y:t,spatialReference:i});this._set("viewpoint",null),this._set("extent",null),this._set("center",n),this._set("zoom",-1),this._set("rotation",s),this._set("scale",r),this._set("spatialReference",i),this._set("state",null),this.animation=null}_updateStageChildren(){this._stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this._stage.addChild(e.container)}));const e=this.graphicsView;this._stage.addChild(e.container),this._stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new A(O.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new de({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new ue(e)});this.frameTask.graphicsView=t,this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),this.frameTask.graphicsView=null,e.destroy(),this._set("featuresTilingScheme",null)}_spatialReferenceChanged(e){if(!this.ready)return;this.frameTask.stop();for(const i of this.allLayerViews)i.processDetach();this._destroySpatialReferenceDependentProperties();const t=this.state.paddedViewState.clone();if(c(this._scaleBeforeChangingSpatialReference))this._scaleBeforeChangingSpatialReference=t.scale;else{const e=t.viewpoint.clone();e.scale=this._scaleBeforeChangingSpatialReference,t.viewpoint=e}const s=t.clone(),[r,n]=t.center;let o=null;try{o=this._project(new j({x:r,y:n,spatialReference:t.spatialReference}),e)}catch(p){T()||he.warn(new w("mapview:spatial-reference-change","could not project the view's center to the new spatial reference",{center:o.toJSON(),spatialReference:e,error:p}))}o||(o=new j({x:0,y:0,spatialReference:e}));const l=F(new i({targetGeometry:new j,scale:0,rotation:0}),t.viewpoint,o);s.viewpoint=l;try{const i=20,r=[t.size[0]/2,t.size[1]/2],n=[r[0]+i,r[1]],o=t.toMap([0,0],n),{x:p,y:h}=this._project(new j({x:o[0],y:o[1],spatialReference:t.spatialReference}),e);o[0]=p,o[1]=h,s.toScreen(o,o);const c=Q(r,o,n),d=Math.hypot(o[0]-r[0],o[1]-r[1])/i;!Number.isFinite(d)||Math.abs(d)>4?(l.rotation=0,l.targetGeometry=new j({x:0,y:0,spatialReference:e})):(l.scale*=d,l.scale>a("mapview-srswitch-adjust-rotation-scale-threshold")?l.rotation=0:l.rotation+=Number.isFinite(c)?c:0)}catch{}this._get("constraints").constrain(l,null),this._get("state").viewpoint=l,this._stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const i of this.allLayerViews)i.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}};ve.type="2d",e([v({readOnly:!0})],ve.prototype,"animationManager",void 0),e([v({constructOnly:!0})],ve.prototype,"deactivatedWebGLExtensions",void 0),e([v({constructOnly:!0})],ve.prototype,"debugWebGLExtensions",void 0),e([v({readOnly:!0})],ve.prototype,"featuresTilingScheme",void 0),e([v({readOnly:!0})],ve.prototype,"fullOpacity",void 0),e([v({readOnly:!0})],ve.prototype,"graphicsTileStore",null),e([v()],ve.prototype,"graphicsView",void 0),e([v({readOnly:!0})],ve.prototype,"state",void 0),e([v()],ve.prototype,"initialExtentRequired",null),e([v()],ve.prototype,"labelManager",void 0),e([v({readOnly:!0})],ve.prototype,"resourceManager",null),e([v({readOnly:!0})],ve.prototype,"textureManager",null),e([v({readOnly:!0})],ve.prototype,"mapViewNavigation",void 0),e([v({constructOnly:!0})],ve.prototype,"renderCanvas",void 0),e([v()],ve.prototype,"renderingOptions",void 0),e([v({readOnly:!0})],ve.prototype,"rendering",void 0),e([v({constructOnly:!0})],ve.prototype,"supersampleScreenshotsEnabled",void 0),e([v({readOnly:!0})],ve.prototype,"supportsGround",void 0),e([v()],ve.prototype,"_stationaryTimer",void 0),e([v()],ve.prototype,"_defaultsFromMapSettings",null),e([v()],ve.prototype,"_pePromise",void 0),e([v({readOnly:!0})],ve.prototype,"typeSpecificPreconditionsReady",null),e([v()],ve.prototype,"animation",null),e([v({type:pe})],ve.prototype,"background",null),e([v({value:null,type:j,dependsOn:["state.id","ready"]})],ve.prototype,"center",null),e([v({type:q})],ve.prototype,"constraints",null),e([v({value:null,type:S,dependsOn:["state.id","ready"]})],ve.prototype,"extent",null),e([v()],ve.prototype,"floors",void 0),e([v({type:Y})],ve.prototype,"highlightOptions",void 0),e([v({readOnly:!0})],ve.prototype,"inputManager",void 0),e([v()],ve.prototype,"map",void 0),e([v({value:{top:0,right:0,bottom:0,left:0},cast:e=>({top:0,right:0,bottom:0,left:0,...e})})],ve.prototype,"padding",null),e([v()],ve.prototype,"resizeAlign",void 0),e([v({readOnly:!0,dependsOn:["state.id"]})],ve.prototype,"resolution",null),e([v({value:0,type:Number,dependsOn:["state.id","ready"]})],ve.prototype,"rotation",null),e([v({value:0,type:Number,dependsOn:["state.id","ready"]})],ve.prototype,"scale",null),e([v({constructOnly:!0})],ve.prototype,"spatialReferenceLocked",void 0),e([v()],ve.prototype,"stationary",null),e([v({type:X,readOnly:!0})],ve.prototype,"timeline",void 0),e([v({readOnly:!0})],ve.prototype,"type",void 0),e([v({readOnly:!0})],ve.prototype,"updating",null),e([v({value:null,type:i,dependsOn:["state.id","ready"]})],ve.prototype,"viewpoint",null),e([v({value:-1,dependsOn:["state.id","ready"]})],ve.prototype,"zoom",null),e([v({type:Boolean})],ve.prototype,"navigating",null),e([v({type:le})],ve.prototype,"ui",void 0),ve=e([V("esri.views.MapView")],ve);const Ve=ve;function Se(e){const t=e.getObjectId();return t?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${t}`:`"MapView/${e.uid}`}function je(e,i,s,r,n){return a=>{if(a instanceof t){if(a.layer===e)n?.();else{const t=e.allLayerViews.find((e=>e.layer===a.layer));t&&r?.(t)}s(Se(a))}else{const t=e.allLayerViews.find((e=>e.layer===a));t&&i(t)}}}function Te(e,t){if(e)if(o(e))for(const i of e)if(o(i))for(const e of i)t(e);else t(i);else t(e)}export{Ve as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import e from"../../../core/Handles.js";import{clone as s}from"../../../core/lang.js";import{destroyMaybe as r,
|
|
5
|
+
import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import e from"../../../core/Handles.js";import{clone as s}from"../../../core/lang.js";import{destroyMaybe as r,isSome as h,isNone as a}from"../../../core/maybe.js";import{watch as o,when as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../layers/GraphicsLayer.js";import{cloneMove as d}from"./drawUtils.js";import v from"./HighlightHelper.js";import{addUniqueLayer as g,findLayerView as _}from"./layerUtils.js";import{GraphicClickEvent as m,GraphicDoubleClickEvent as y,GraphicPointerDownEvent as u,GraphicPointerUpEvent as f,GraphicPointerOutEvent as w,GraphicMoveStartEvent as G,GraphicMoveEvent as b,GraphicMoveStopEvent as k,GraphicPointerOverEvent as O}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as H}from"../../input/InputManager.js";import{GraphicManipulator as M}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as x}from"../../support/screenUtils.js";import E from"../../../symbols/SimpleMarkerSymbol.js";import j from"../../../symbols/SimpleLineSymbol.js";import U from"../../../symbols/SimpleFillSymbol.js";const P="indicator-symbols";let S=class extends t.EventedAccessor{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._handles=new e,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._viewHandles=new e,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!1,this.layer=new p({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){g(this.view,this.layer),this._highlightHelper=new v({view:this.view}),this.refresh(),this._handles.add([o((()=>[this.graphics,this.graphics?.length]),(()=>this.refresh())),c((()=>this.view?.ready),(()=>{this._viewHandles.add([this.view.on("immediate-click",(i=>this._clickHandler(i)),H.TOOL),this.view.on("double-click",(i=>this._doubleClickHandler(i)),H.TOOL),this.view.on("pointer-down",(i=>this._pointerDownHandler(i)),H.TOOL),this.view.on("pointer-move",(i=>this._pointerMoveHandler(i)),H.TOOL),this.view.on("pointer-up",(i=>this._pointerUpHandler(i)),H.TOOL),this.view.on("drag",(i=>this._dragHandler(i)),H.TOOL),this.view.on("key-down",(i=>this._keyDownHandler(i)),H.TOOL)])}),{once:!0,initial:!0}),o((()=>this.view),(i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}))])}destroy(){this._removeIndicators(),this.view.map?.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach((i=>i.destroy())),this._manipulators=null,this._handles=r(this._handles),this._viewHandles=r(this._viewHandles)}set highlightsEnabled(i){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",i),i&&this._highlightHelper?.add(this.graphics)}get state(){const i=!!this.get("view.ready"),t=!!this.get("graphics.length"),e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new m(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(x(i));if(t){const e=new y(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(x(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new u(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new f(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(x(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new w(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(h)}const r=this.graphics.indexOf(t),h=new O(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(h))}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new w(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic||!this._activeGraphic.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:e,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),a=this._dragEvent?e-this._dragEvent.x:0,o=this._dragEvent?r-this._dragEvent.y:0,c=e-i.origin.x,n=r-i.origin.y,l="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,p=d(l,c,n,this.view);if(this._activeGraphic.geometry=p,this.enableMoveAllGraphics&&this.graphics.forEach((i=>{i!==this._activeGraphic&&(i.geometry=d(i.geometry,a,o,this.view))})),this._dragEvent=i,"start"===t){this._initialDragGeometry=s(l);const t=new G(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(t),t.defaultPrevented&&this._activeGraphic.set("geometry",l)}else if("update"===t){const t=new b(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(t),t.defaultPrevented&&(this._activeGraphic.geometry=l)}else{const t=new k(this._activeGraphic,this.graphics,h,e,r,a,o,c,n,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i);let e=null,s=Number.MAX_VALUE;this._syncLayerViews();const r=this._layerViews.flatMap((i=>"graphicsViews"in i?Array.from(i.graphicsViews(),(i=>i.hitTest(t))).flat():i.graphicsView.hitTest(t))).filter((i=>this.graphics.includes(i)));return r.length?r[0]:(this._manipulators.forEach((t=>{const r=t.intersectionDistance(i);h(r)&&r<s&&(s=r,e=t.graphic)})),e)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=_(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach((i=>i.destroy())),this._manipulators=i?.length?i.map((i=>new M({graphic:i,view:t}))):[]}_setUpHighlights(){this.highlightsEnabled&&this._highlightHelper.add(this.graphics)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=this._getSymbolForIndicator(i),this._indicators.push(t),this._handles.add(o((()=>i.symbol),(()=>this._setUpIndicators())),P)}this.layer.addMany(this._indicators)}}_removeIndicators(){this._handles.remove(P),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach((i=>i.destroy())),this._indicators=[])}_getSymbolForIndicator(i){const t=12;if(a(i.symbol))return null;switch(i.symbol.type){case"cim":return new E({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new E({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new E({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new U({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new j({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new E({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}};i([n()],S.prototype,"_activeGraphic",void 0),i([n({readOnly:!0})],S.prototype,"type",void 0),i([n()],S.prototype,"callbacks",void 0),i([n()],S.prototype,"enableMoveAllGraphics",void 0),i([n()],S.prototype,"graphics",void 0),i([n({value:!1})],S.prototype,"highlightsEnabled",null),i([n()],S.prototype,"indicatorsEnabled",void 0),i([n()],S.prototype,"layer",void 0),i([n({readOnly:!0})],S.prototype,"state",null),i([n()],S.prototype,"view",void 0),S=i([l("esri.views.draw.support.GraphicMover")],S);const D=S;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{typeCast as t}from"../../core/compilerUtils.js";import a from"../../core/Evented.js";import{isSome as s}from"../../core/maybe.js";import{watch as i,whenOnce as r,initial as o}from"../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{typeCast as t}from"../../core/compilerUtils.js";import a from"../../core/Evented.js";import{isSome as s}from"../../core/maybe.js";import{watch as i,whenOnce as r,initial as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{isLoaded as c,canProjectWithoutEngine as m,load as h}from"../../geometry/projection.js";import{equals as f}from"../../geometry/support/spatialReferenceUtils.js";import{esriBasemapDefinitions as u}from"../../support/basemapDefinitions.js";import{ensureType as d,destroyCache as g,findSpatialReference as v,getWellKnownBasemapId as b}from"../../support/basemapUtils.js";let B=class extends a.EventedAccessor{constructor(e){super(e),this._basemapCache={},this._loadingProjectionEngine=!1,this.nextBasemap=d("hybrid",this._basemapCache),this.view=null,this.toggle=this.toggle.bind(this)}initialize(){i((()=>this.nextBasemap),(e=>{e&&!e.loaded&&e.load().catch((()=>{}))}),o)}destroy(){this.view=null,g(this._basemapCache),this._basemapCache=null}get _nextBasemapSpatialReferenceTask(){return v(this.view,this.nextBasemap)}get _viewSpatialReferenceLocked(){return!("spatialReferenceLocked"in this.view)||this.view.spatialReferenceLocked}get activeBasemap(){return d(this.view?.map?.basemap??"topo",this._basemapCache)}castNextBasemap(e){return d(e,this._basemapCache)}get state(){const{view:e}=this;if(!e?.ready)return"disabled";if(this._nextBasemapSpatialReferenceTask.updating)return"disabled";const{spatialReference:t}=this._nextBasemapSpatialReferenceTask;return this._viewSpatialReferenceLocked&&s(t)&&!e.spatialReference.equals(t)?"incompatible-next-basemap":this._loadingProjectionEngine?"loading":"ready"}async toggle(){if("disabled"===this.state||"incompatible-next-basemap"===this.state)return;const{activeBasemap:e,nextBasemap:t}=this,a=this._viewSpatialReferenceLocked;if(!a){if(await r((()=>!this._nextBasemapSpatialReferenceTask.updating)),t!==this.nextBasemap||e!==this.activeBasemap)return;const{spatialReference:a}=this._nextBasemapSpatialReferenceTask;if(!s(a)||f(this.view.spatialReference,a)||c()||m(this.view.spatialReference,a)||(this._loadingProjectionEngine=!0,await h(),this._loadingProjectionEngine=!1),t!==this.nextBasemap||e!==this.activeBasemap)return}this.view.map.basemap=t,a||!s(this._nextBasemapSpatialReferenceTask.spatialReference)||f(this.view.spatialReference,this._nextBasemapSpatialReferenceTask.spatialReference)||(this.view.spatialReference=this._nextBasemapSpatialReferenceTask.spatialReference),this.nextBasemap=e,this.emit("toggle",{previous:e,current:t})}static getThumbnailUrl(e){if(!e)return null;const{thumbnailUrl:a}=e;if(a)return a;const s=b(e);if(s)return u[s].thumbnailUrl;const i=e.baseLayers.find((e=>!!t(e)().get("portalItem.thumbnailUrl")));return i?t(i)().get("portalItem.thumbnailUrl"):null}};e([n()],B.prototype,"_loadingProjectionEngine",void 0),e([n({readOnly:!0})],B.prototype,"_nextBasemapSpatialReferenceTask",null),e([n({readOnly:!0})],B.prototype,"_viewSpatialReferenceLocked",null),e([n({readOnly:!0})],B.prototype,"activeBasemap",null),e([n()],B.prototype,"nextBasemap",void 0),e([p("nextBasemap")],B.prototype,"castNextBasemap",null),e([n({readOnly:!0})],B.prototype,"state",null),e([n()],B.prototype,"view",void 0),e([n()],B.prototype,"toggle",null),B=e([l("esri.widgets.BasemapToggle.BasemapToggleViewModel")],B);const R=B;export{R as default};
|
package/widgets/BasemapToggle.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as t}from"../core/accessorSupport/decorators/cast.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as t}from"../core/accessorSupport/decorators/cast.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import l from"./BasemapToggle/BasemapToggleViewModel.js";import{accessibleHandler as r}from"./support/decorators/accessibleHandler.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as m}from"./support/decorators/vmEvent.js";import{tsx as c}from"./support/jsxFactory.js";import"./support/widgetUtils.js";const p={base:"esri-basemap-toggle esri-widget",secondaryBasemapImage:"esri-basemap-toggle__image--secondary",container:"esri-basemap-thumbnail esri-basemap-toggle__container",image:"esri-basemap-thumbnail__image esri-basemap-toggle__image",imageLoading:"esri-basemap-toggle__image--loading",overlay:"esri-basemap-thumbnail__overlay esri-basemap-toggle__image-overlay",title:"esri-basemap-thumbnail__title esri-basemap-toggle__title",overlayScrim:"esri-basemap-thumbnail__overlay-scrim",disabled:"esri-disabled",loaderAnimation:"esri-widget__loader-animation"};function d(e){const s=l.getThumbnailUrl(e);return s?{backgroundImage:"url("+s+")"}:{backgroundImage:""}}const g={title:!1};let u=class extends o{constructor(e,s){super(e,s),this.activeBasemap=null,this.label=void 0,this.messages=null,this.nextBasemap=null,this.view=null,this.viewModel=new l,this.visibleElements={...g}}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js")])}castVisibleElements(e){return{...g,...e}}toggle(){return null}render(){const e=this.viewModel,s="disabled"===e.state?null:e.activeBasemap,t="disabled"===e.state?null:e.nextBasemap,a="loading"===e.state,i="incompatible-next-basemap"===e.state,o=t?t.title:"",l=t&&"loaded"!==t.loadStatus;let r;const n=this.visibleElements.title&&o,m=i;return(n||m)&&(r=c("div",{class:p.overlay,key:"overlay"},n?c("span",{class:p.title,title:o},o):null,m?c("calcite-scrim",{class:p.overlayScrim,title:this.messages.incompatibleSpatialReference},c("calcite-icon",{icon:"exclamation-mark-triangle"})):null)),c("div",{class:this.classes(p.base,i?p.disabled:null),role:"button","data-basemap-id":t?t.id:"",bind:this,onclick:this._toggle,onkeydown:this._toggle,tabIndex:i?-1:0,title:this.label},c("div",{class:this.classes(p.container,p.secondaryBasemapImage)},c("div",{class:p.image,styles:d(s)})),c("div",{class:p.container},c("div",{class:this.classes(p.image,l?p.imageLoading:null),styles:d(t)},l||a?c("calcite-scrim",null,c("span",{"aria-hidden":"true",role:"presentation",class:p.loaderAnimation})):null),r))}_toggle(){this.toggle()}};e([s("viewModel.activeBasemap")],u.prototype,"activeBasemap",void 0),e([a({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],u.prototype,"label",void 0),e([a(),n("esri/widgets/BasemapToggle/t9n/BasemapToggle")],u.prototype,"messages",void 0),e([s("viewModel.nextBasemap")],u.prototype,"nextBasemap",void 0),e([s("viewModel.view")],u.prototype,"view",void 0),e([m("toggle"),a({type:l})],u.prototype,"viewModel",void 0),e([a()],u.prototype,"visibleElements",void 0),e([t("visibleElements")],u.prototype,"castVisibleElements",null),e([s("viewModel.toggle")],u.prototype,"toggle",null),e([r()],u.prototype,"_toggle",null),u=e([i("esri.widgets.BasemapToggle")],u);const b=u;export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as s}from"../../../chunks/tslib.es6.js";import{unwrapOr as e}from"../../../core/maybe.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 r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../Widget.js";import t from"./BuildingDisciplinesNode.js";import"../../support/widgetUtils.js";import{tsx as
|
|
5
|
+
import{_ as s}from"../../../chunks/tslib.es6.js";import{unwrapOr as e}from"../../../core/maybe.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 r}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../Widget.js";import t from"./BuildingDisciplinesNode.js";import"../../support/widgetUtils.js";import{tsx as p}from"../../support/jsxFactory.js";const l={expand:"expand",collapse:"collapse",hideSublayer:"hideSublayer",showSublayer:"showSublayer"},a={base:`${"esri-building-disciplines-tree"}`};let c=class extends o{constructor(s){super(s),this.toggleSiblingsVisibility=!1}render(){const{vm:s}=this,i=this.toggleSiblingsVisibility,r=e(this.messages,l);return p("div",{role:"tree",class:a.base},s.root.children.toArray().reverse().map((s=>p(t,{node:s,messages:r,toggleSiblingsVisibility:i}))))}};s([i()],c.prototype,"vm",void 0),s([i()],c.prototype,"messages",void 0),s([i()],c.prototype,"toggleSiblingsVisibility",void 0),c=s([r("esri.widgets.BuildingExplorer.BuildingDisciplinesTree.BuildingDisciplinesTree")],c);const n=c;export{n as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{on as t}from"../../../core/events.js";import i from"../../../core/Handles.js";import{clamp as s}from"../../../core/mathUtils.js";import{isNone as o,isSome as l,unwrapOr as n}from"../../../core/maybe.js";import{watch as r,initial as a}from"../../../core/reactiveUtils.js";import{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{on as t}from"../../../core/events.js";import i from"../../../core/Handles.js";import{clamp as s}from"../../../core/mathUtils.js";import{isNone as o,isSome as l,unwrapOr as n}from"../../../core/maybe.js";import{watch as r,initial as a}from"../../../core/reactiveUtils.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 v}from"../../../core/accessorSupport/decorators/subclass.js";import _ from"../../Widget.js";import{L as d,a as p,A as c,b as g,c as u,d as m,e as L,f as y,g as w,h as b,i as P}from"../../../chunks/constants.js";import{Label as f}from"./Label.js";import{LevelItem as C}from"./LevelItem.js";import{storeNode as W}from"../../support/widgetUtils.js";import{tsx as x}from"../../support/jsxFactory.js";const H={selectLevel:"selectLevel",clearLevel:"clearLevel",nextLevel:"nextLevel",previousLevel:"previousLevel",currentLevel:"{{value}}"},j="esri-building-level-picker",E={container:j,noLevel:`${j}--no-level`,animateLevel:`${j}--animate-level`,levelsContainer:`${j}__levels-container`,innerLevelsContainer:`${j}__inner-levels-container`,labelContainer:`${j}__label-container`,arrowUp:`${j}__arrow-up`,arrowDown:`${j}__arrow-down`};let M=class extends _{constructor(e,t){super(e,t),this._levelHandles=new i,this._levelEventHandles=new i,this._levelWidgets=[],this._labelWidget=new f({onClear:()=>this.vm.clear()}),this._hoveredLevel=null,this._expandedLevelsHeight=void 0,this._normalizedPointerPosition=0,this._hovering=!1,this._containerPosTop=null,this._levelsContainer=null,this._onPointerUp=()=>{if(window.getSelection().removeAllRanges(),o(this._hoveredLevel))return;const{vm:e}=this;e.enabled&&this._hoveredLevel===e.value?e.clear():e.select(this._hoveredLevel)},this._onPointerEnter=()=>{this._hovering||o(this._levelsContainer)||(this._hovering=!0,this._containerPosTop=this._levelsContainer.getBoundingClientRect().top??0)},this._onPointerLeave=()=>{this._hovering&&(this._normalizedPointerPosition=0,this._hoveredLevel=null,this._hovering=!1)},this._onPointerMove=e=>{if(!this._hovering)return!1;if(window.getSelection().removeAllRanges(),l(this._containerPosTop)){const t=this._containerPosTop,i=u*P,s=this._expandedLevelsMargin;let o=this._levelsHeight,l=t+i+s;const n=this._levelHeight/2;l+=n,o-=n;let r=(e.clientY-l)/o;r+=y,this._normalizedPointerPosition=r}return!1}}postInitialize(){this.own([r((()=>this._levelsContainer),(()=>this._onContainerChange()),a),r((()=>this._levels),(()=>this._createLevelWidgets()),a),r((()=>this.messages),(()=>{this._labelWidget.messages=n(this.messages,H)}),a)])}destroy(){this._levelHandles.destroy(),this._levelEventHandles.destroy(),this._levelWidgets.forEach((e=>e.destroy())),this._labelWidget.destroy()}get _levels(){return this.vm.allowedValues}get _numLevels(){return this._levels.length}get _levelsHeight(){return Math.round(this._levelHeight*this._numLevels)}get _expandedLevelsMargin(){return Math.round((this._expandedLevelsHeight-this._levelsHeight)/2)}get _levelWidth(){const{LEVEL_WIDTH_NOMINATOR:e,LEVEL_WIDTH_CONSTANT:t}=w,i=e/Math.sqrt(this._numLevels)+t;return Math.round(s(i,p,d))}get _levelHeight(){const e=b,t=2*e/Math.sqrt(this._numLevels);return Math.round(s(t,2,e))}get _gaussianFactor(){const e=this._numLevels;return e/Math.log(c*e)*g}get _levelClosestToPointer(){if(!this._hovering)return null;const e=this._numLevels-1,t=this._normalizedPointerPosition;return e>=0&&l(t)?this._levels[Math.round((1-t)*e)]:null}render(){const e=this._levelWidgets.length,t=e>1?this._levelWidgets.map((e=>e.render())):null,i=u*P,s=-i/P,o=this._levelsHeight,l=o+2*i;return x("div",{bind:this,key:this,class:this.classes("esri-widget",E.container,{[E.animateLevel]:!this._hovering,[E.noLevel]:e<2}),onkeydown:this._onKeyDown},this._renderLabelContainer(),x("div",{bind:this,class:E.levelsContainer,styles:{height:`${l}px`,marginTop:`${s}px`,marginBottom:`${s}px`},onfocus:this._onFocus,afterCreate:W,"data-node-ref":"_levelsContainer"},x("div",{styles:{height:`${o}px`,margin:u-this._expandedLevelsMargin+"px 0 0 0"},class:E.innerLevelsContainer},t)))}_renderLabelContainer(){const e=n(this.messages,H),t=e.previousLevel,i=e.nextLevel;return x("div",{class:E.labelContainer,tabIndex:0},x("button",{bind:this,class:E.arrowUp,disabled:!this.vm.hasNext,onclick:this._onArrowUpClick,"aria-label":i,title:i,type:"button"}),this._labelWidget.render(),x("button",{bind:this,class:E.arrowDown,disabled:!this.vm.hasPrevious,onclick:this._onArrowDownClick,"aria-label":t,title:t,type:"button"}))}_updateComponents(){const e=n(this.messages,H),t=this.vm.enabled?this.vm.value:null,i=l(this._hoveredLevel)?this._hoveredLevel:t;this._levelWidgets.forEach((i=>{const s=this.vm.getValueLabel(i.level);i.label=l(s)?s:e.currentLevel?.replace("{{level}}",String(i.level)),i.active=i.level===t,i.hovering=i.level===this._hoveredLevel})),this._labelWidget.level=i,this._labelWidget.active=i===t,this._labelWidget.hovering=l(this._hoveredLevel)}_createLevelWidgets(){this._levelWidgets.forEach((e=>e.destroy())),this._levelWidgets=this._levels.map((e=>new C({level:e,onSelect:()=>this._onLevelToggle(e)}))),this._levelHandles.removeAll(),this._levelHandles.add([r((()=>{const{vm:e}=this;return[this.messages,e?.value,e?.enabled,this._hoveredLevel,this._hovering]}),(()=>this._updateComponents()),a),r((()=>[this._normalizedPointerPosition,this._hovering]),(()=>this._onPointerPositionChange()),a),r((()=>this._levelWidth),(e=>this._levelWidgets.forEach((t=>t.width=e))),a)])}_onContainerChange(){const e=this._levelsContainer;o(e)||(this._levelEventHandles.removeAll(),this._levelEventHandles.add([t(e,"pointerenter",this._onPointerEnter),t(e,"pointerover",this._onPointerEnter),t(e,"pointerleave",this._onPointerLeave),t(e,"pointerup",this._onPointerUp),t(e,"pointermove",this._onPointerMove)]))}_onKeyDown(e){switch(e.key){case"ArrowDown":case"ArrowLeft":e.preventDefault(),e.stopPropagation(),this.vm.previous(),this._focusCurrentLevel();break;case"ArrowUp":case"ArrowRight":e.preventDefault(),e.stopPropagation(),this.vm.next(),this._focusCurrentLevel()}}_focusCurrentLevel(){const e=this._levelWidgets.find((e=>e.level===this.vm.value));e&&e.focus()}_onFocus(){this._hoveredLevel=this._levels.length>0?this._levels[0]:null}_onLevelToggle(e){const{vm:t}=this;t.enabled&&t.value===e?t.clear():t.select(e)}_onArrowUpClick(){this.vm.next()}_onArrowDownClick(){this.vm.previous()}_onPointerPositionChange(){let e=0;this._levelWidgets.forEach(((t,i)=>{const{width:s,height:o}=this._getLevelWidgetSize(i);t.height=o,t.width=s,e+=o})),this._hoveredLevel=this._levelClosestToPointer;const t=this._expandedLevelsHeight;(null==t||Math.abs(t-e)>30)&&(this._expandedLevelsHeight=e)}_getLevelWidgetSize(e){const t={width:this._levelWidth,height:this._levelHeight};if(this._hovering){const i=this._getGaussianFactor(e,this._normalizedPointerPosition);t.width+=m*i,t.height+=L*i}return t}_getGaussianFactor(e,t){const i=this._numLevels-1,s=(i-e)/i,o=this._gaussianFactor*(s-t);return Math.exp(-(o**2))}};e([h()],M.prototype,"vm",void 0),e([h()],M.prototype,"messages",void 0),e([h()],M.prototype,"_levelWidgets",void 0),e([h()],M.prototype,"_labelWidget",void 0),e([h()],M.prototype,"_hoveredLevel",void 0),e([h()],M.prototype,"_levels",null),e([h()],M.prototype,"_numLevels",null),e([h({readOnly:!0})],M.prototype,"_levelsHeight",null),e([h()],M.prototype,"_expandedLevelsHeight",void 0),e([h({readOnly:!0})],M.prototype,"_expandedLevelsMargin",null),e([h({readOnly:!0})],M.prototype,"_levelWidth",null),e([h({readOnly:!0})],M.prototype,"_levelHeight",null),e([h({readOnly:!0})],M.prototype,"_gaussianFactor",null),e([h({readOnly:!0})],M.prototype,"_levelClosestToPointer",null),e([h({type:Number,range:{min:0,max:1}})],M.prototype,"_normalizedPointerPosition",void 0),e([h()],M.prototype,"_hovering",void 0),e([h()],M.prototype,"_containerPosTop",void 0),e([h()],M.prototype,"_levelsContainer",void 0),M=e([v("esri.widgets.BuildingExplorer.BuildingLevelPicker.BuildingLevelPicker")],M);const T=M;export{T as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as s,unwrapOr as t,unwrap as r,isSome as o}from"../../../core/maybe.js";import{watch as i,initial as a}from"../../../core/reactiveUtils.js";import{property as n}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";import c from"../../Widget.js";import{isRTL as l}from"../../support/widgetUtils.js";import{tsx as u}from"../../support/jsxFactory.js";const p={nextPhase:"nextPhase",previousPhase:"previousPhase",currentPhase:"{{value}}"},d="esri-building-phase-picker",_={container:`${d}`,phasesContainer:`${d}__phases-container`,phase:`${d}__phase`,phaseActive:`${d}__phase--active`,phaseCurrent:`${d}__phase--current`,divider:`${d}__divider`,dividerActive:`${d}__divider--active`,arrowLeft:`${d}__arrow-left`,arrowRight:`${d}__arrow-right`};let v=class extends c{constructor(e,t){super(e,t),this._phasesContainer=null,this._shouldScrollCurrentPhaseIntoView=!0,this._shouldFocusCurrentPhase=!1,this._onKeyDown=e=>{const{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as s,unwrapOr as t,unwrap as r,isSome as o}from"../../../core/maybe.js";import{watch as i,initial as a}from"../../../core/reactiveUtils.js";import{property as n}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";import c from"../../Widget.js";import{isRTL as l}from"../../support/widgetUtils.js";import{tsx as u}from"../../support/jsxFactory.js";const p={nextPhase:"nextPhase",previousPhase:"previousPhase",currentPhase:"{{value}}"},d="esri-building-phase-picker",_={container:`${d}`,phasesContainer:`${d}__phases-container`,phase:`${d}__phase`,phaseActive:`${d}__phase--active`,phaseCurrent:`${d}__phase--current`,divider:`${d}__divider`,dividerActive:`${d}__divider--active`,arrowLeft:`${d}__arrow-left`,arrowRight:`${d}__arrow-right`};let v=class extends c{constructor(e,t){super(e,t),this._phasesContainer=null,this._shouldScrollCurrentPhaseIntoView=!0,this._shouldFocusCurrentPhase=!1,this._onKeyDown=e=>{const{vm:s}=this;switch(e.key){case"ArrowDown":case"ArrowLeft":e.stopPropagation(),e.preventDefault(),s.previous(),this._shouldFocusCurrentPhase=!0;break;case"ArrowUp":case"ArrowRight":e.stopPropagation(),e.preventDefault(),s.next(),this._shouldFocusCurrentPhase=!0}},this._onArrowLeftClick=()=>{this.vm.previous()},this._onArrowRightClick=()=>{this.vm.next()},this._onPhasesContainerAfterCreate=e=>{this._phasesContainer=e,requestAnimationFrame(this._scrollOrFocusPhase)},this._scrollOrFocusPhase=()=>{const e=this._phasesContainer;if(this.destroyed||s(e))return;const t=e.querySelector(`.${_.phaseCurrent}`);if(t){if(this._shouldScrollCurrentPhaseIntoView){const s=e.offsetWidth,r=t.offsetLeft,o=t.offsetWidth;e.scrollLeft=-s/2+r-o/2,this._shouldScrollCurrentPhaseIntoView=!1}this._shouldFocusCurrentPhase&&(t.focus(),this._shouldFocusCurrentPhase=!1)}}}initialize(){this.own([i((()=>[this._currentPhase,this._phasesContainer,this.container]),(()=>{this._shouldScrollCurrentPhaseIntoView=!0,requestAnimationFrame(this._scrollOrFocusPhase)}),a)])}get _phases(){return this.vm.allowedValues}get _currentPhase(){const{vm:e}=this;return e.enabled?e.value:null}render(){if(this._phases.length<2)return u("div",{key:"no-phases"});const{vm:e,container:s,messages:r}=this,{previousPhase:o,nextPhase:i}=t(r,p),a=l(s);return u("div",{class:this.classes("esri-widget",_.container),key:this,onkeydown:this._onKeyDown},u("button",{type:"button",class:a?_.arrowRight:_.arrowLeft,disabled:!e.hasPrevious,"aria-label":o,title:o,onclick:this._onArrowLeftClick}),u("div",{class:_.phasesContainer,afterCreate:this._onPhasesContainerAfterCreate},this._renderPhaseButtons()),u("button",{type:"button",class:a?_.arrowLeft:_.arrowRight,disabled:!e.hasNext,"aria-label":i,title:i,onclick:this._onArrowRightClick}))}_renderPhaseButtons(){const e=this._phases,s=this._currentPhase,t=[];for(let r=0;r<e.length;++r){const i=e[r],a={phase:i,active:!!o(s)&&i<=s,current:!!o(s)&&i===s};r>0&&t.push(this._renderDivider(a)),t.push(this._renderPhaseButton(a))}return t}_renderPhaseButton({phase:e,active:s,current:t}){const{vm:o}=this,i=r(o.getValueLabel(e));return u("button",{key:`phase-${e}`,class:this.classes(_.phase,{[_.phaseActive]:s,[_.phaseCurrent]:t}),"aria-label":i,title:i,onclick:()=>o.select(e),type:"button"},e)}_renderDivider({phase:e,active:s}){return u("div",{key:`phase-divider-${e}`,class:this.classes(_.divider,{[_.dividerActive]:s})})}};e([n({nonNullable:!0})],v.prototype,"vm",void 0),e([n()],v.prototype,"messages",void 0),e([n()],v.prototype,"_phases",null),e([n()],v.prototype,"_currentPhase",null),e([n()],v.prototype,"_phasesContainer",void 0),v=e([h("esri.widgets.BuildingExplorer.BuildingPhasePicker.BuildingPhasePicker")],v);const P=v;export{P as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import l from"./BuildingExplorer/BuildingExplorerViewModel.js";import n from"./BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js";import a from"./BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js";import d from"./BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js";import{Heading as p}from"./support/Heading.js";import{classes as c}from"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as u}from"./support/jsxFactory.js";const h={levels:!0,phases:!0,disciplines:!0},m="esri-building-explorer",v={esriWidget:"esri-widget",esriWidgetDisabled:"esri-widget--disabled",esriIconLoadingIndicator:"esri-icon-loading-indicator",esriRotating:"esri-rotating",widgetIcon:"esri-icon-organization",base:`${m} esri-widget--panel`,panelError:`${m}__panel--error`,loadingContainer:`${m}__loading-container`,content:`${m}__content`,section:`${m}__section`,levels:`${m}__levels`,phases:`${m}__phases`,disciplines:`${m}__disciplines`};let y=class extends o{constructor(e,i){super(e,i),this._defaultViewModel=new l,this.viewModel=this._defaultViewModel,this.view=null,this.layers=null,this.visibleElements={...h},this.headingLevel=3,this.iconClass=v.widgetIcon,this.label=void 0,this.messages=null,this.messagesCommon=null,this.toggleSiblingsVisibility=!1}destroy(){this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}_castVisibleElements(e){return{...h,...e}}render(){const e=this.viewModel,i="disabled"===e.state||!e.isSupported;return u("div",{key:this,class:c(v.esriWidget,v.base,{[v.esriWidgetDisabled]:i}),"aria-label":this.messages.widgetLabel},this._renderContent())}_renderContent(){const e=this.viewModel,i=this.messages;if(!e.isSupported)return u("p",{class:v.panelError},i.unsupported);if(!e.layers.length)return u("p",{class:v.panelError},i.noData);switch(e.state){case"loading":return this._renderLoadingIndicator();case"ready":return u("div",{key:"content",class:v.content},this._renderLevelPickerSection(),this._renderPhasePickerSection(),this._renderDisciplinesSection());case"failed":return u("p",{class:v.panelError},i.failed);default:return null}}_renderLoadingIndicator(){const e=this.messagesCommon.loading;return u("div",{key:"loading-container",role:"presentation",class:v.loadingContainer,"aria-label":e,title:e},u("span",{"aria-hidden":"true",class:c(v.esriIconLoadingIndicator,v.esriRotating)}))}_renderLevelPickerSection(){const e=this.viewModel.level,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.levels||!i||!s)return null;const t=this.messages?.level;return u("div",{key:"levels",class:c(v.section,v.levels)},u(p,{level:this.headingLevel},t?.title),u(a,{
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import{property as t}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import l from"./BuildingExplorer/BuildingExplorerViewModel.js";import n from"./BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js";import a from"./BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js";import d from"./BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js";import{Heading as p}from"./support/Heading.js";import{classes as c}from"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as u}from"./support/jsxFactory.js";const h={levels:!0,phases:!0,disciplines:!0},m="esri-building-explorer",v={esriWidget:"esri-widget",esriWidgetDisabled:"esri-widget--disabled",esriIconLoadingIndicator:"esri-icon-loading-indicator",esriRotating:"esri-rotating",widgetIcon:"esri-icon-organization",base:`${m} esri-widget--panel`,panelError:`${m}__panel--error`,loadingContainer:`${m}__loading-container`,content:`${m}__content`,section:`${m}__section`,levels:`${m}__levels`,phases:`${m}__phases`,disciplines:`${m}__disciplines`};let y=class extends o{constructor(e,i){super(e,i),this._defaultViewModel=new l,this.viewModel=this._defaultViewModel,this.view=null,this.layers=null,this.visibleElements={...h},this.headingLevel=3,this.iconClass=v.widgetIcon,this.label=void 0,this.messages=null,this.messagesCommon=null,this.toggleSiblingsVisibility=!1}destroy(){this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}_castVisibleElements(e){return{...h,...e}}render(){const e=this.viewModel,i="disabled"===e.state||!e.isSupported;return u("div",{key:this,class:c(v.esriWidget,v.base,{[v.esriWidgetDisabled]:i}),"aria-label":this.messages.widgetLabel},this._renderContent())}_renderContent(){const e=this.viewModel,i=this.messages;if(!e.isSupported)return u("p",{class:v.panelError},i.unsupported);if(!e.layers.length)return u("p",{class:v.panelError},i.noData);switch(e.state){case"loading":return this._renderLoadingIndicator();case"ready":return u("div",{key:"content",class:v.content},this._renderLevelPickerSection(),this._renderPhasePickerSection(),this._renderDisciplinesSection());case"failed":return u("p",{class:v.panelError},i.failed);default:return null}}_renderLoadingIndicator(){const e=this.messagesCommon.loading;return u("div",{key:"loading-container",role:"presentation",class:v.loadingContainer,"aria-label":e,title:e},u("span",{"aria-hidden":"true",class:c(v.esriIconLoadingIndicator,v.esriRotating)}))}_renderLevelPickerSection(){const e=this.viewModel.level,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.levels||!i||!s)return null;const t=this.messages?.level;return u("div",{key:"levels",class:c(v.section,v.levels)},u(p,{level:this.headingLevel},t?.title),u(a,{vm:e,messages:t}))}_renderPhasePickerSection(){const e=this.viewModel.phase,i="ready"===e.state,s=e.allowedValues.length>1;if(!this.visibleElements.phases||!i||!s)return null;const t=this.messages.phase;return u("div",{key:"phases",class:c(v.section,v.phases)},u(p,{level:this.headingLevel},t.title),u(d,{vm:e,messages:t}))}_renderDisciplinesSection(){const e=this.viewModel.disciplines,i="ready"===e.state,s=e.root.hasChildren;if(!this.visibleElements.disciplines||!i||!s)return null;const t=this.messages?.disciplines;return u("div",{key:"disciplines",class:c(v.section,v.disciplines)},u(p,{level:this.headingLevel},t.title),u(n,{vm:e,messages:t,toggleSiblingsVisibility:this.toggleSiblingsVisibility}))}};e([t({type:l})],y.prototype,"viewModel",void 0),e([i("viewModel.view")],y.prototype,"view",void 0),e([i("viewModel.layers")],y.prototype,"layers",void 0),e([t()],y.prototype,"visibleElements",void 0),e([s("visibleElements")],y.prototype,"_castVisibleElements",null),e([t()],y.prototype,"headingLevel",void 0),e([t()],y.prototype,"iconClass",void 0),e([i("messages.widgetLabel",{overridable:!0})],y.prototype,"label",void 0),e([t(),g("esri/widgets/BuildingExplorer/t9n/BuildingExplorer")],y.prototype,"messages",void 0),e([t(),g("esri/t9n/common")],y.prototype,"messagesCommon",void 0),e([t({nonNullable:!0})],y.prototype,"toggleSiblingsVisibility",void 0),e([t()],y.prototype,"uiStrings",void 0),y=e([r("esri.widgets.BuildingExplorer")],y);const b=y;export{b as default};
|