@arcgis/core 4.34.0-next.1 → 4.34.0-next.2
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/Map.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/DimensionAnalysis.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/arcade/Voxel.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{253bcc3cc7bc4c2dc6ea.js → 03db109e9b695528c35d.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa63b0f7fa799cb2f81d.js → 07e58dff44fcbb3b3539.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc61d02286b6ff5447cc.js → 09da6b3085fc84cd69d5.js} +1 -1
- package/assets/esri/core/workers/chunks/0fd826e7f64a37aaaa1e.js +1 -0
- package/assets/esri/core/workers/chunks/{1c86aa3802d9ae0230ae.js → 28e31ac00dc95a1318e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d23610475c85385fbff.js → 355e6bcdb401ada71f39.js} +1 -1
- package/assets/esri/core/workers/chunks/{bba6d7615d8f3862fe70.js → 36f0046ff6b46adce7b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{42d9989b2aad3ac28d4d.js → 397b15d46f22718c9f38.js} +1 -1
- package/assets/esri/core/workers/chunks/{b0522dffa5600345c07e.js → 3e85e63148b5e93d3074.js} +1 -1
- package/assets/esri/core/workers/chunks/{d2ebb72a43d995ed368a.js → 42bb9bb6fe44a47d9b81.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ee41e9c92ed8ba4c763.js → 4dd0a5f327fa5fc7249d.js} +1 -1
- package/assets/esri/core/workers/chunks/{36b0d6b4089a96475201.js → 51ba7345c31e6eb79060.js} +1 -1
- package/assets/esri/core/workers/chunks/{66e79aa02b3aa12b3778.js → 5200be8bce60fa831026.js} +1 -1
- package/assets/esri/core/workers/chunks/{6b23ca6570357f9fb724.js → 52a57106a41b8c9483d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{585c7b485c42555ec554.js → 61f9747c960d959b571b.js} +2 -2
- package/assets/esri/core/workers/chunks/{9fc35ec8185beba96715.js → 632d1a1287dde980479e.js} +1 -1
- package/assets/esri/core/workers/chunks/{1d043965dcdc11b3aeaa.js → 63852887b3f07d50f7c9.js} +1 -1
- package/assets/esri/core/workers/chunks/{c16e0da7a19310c71e8b.js → 677af0281e4fc9f3bd98.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ecc3a3737ae8622dfa4.js → 7b12607633bbdc318936.js} +1 -1
- package/assets/esri/core/workers/chunks/{d839a237d5edc243d645.js → 8aa8f9986b966ccb64e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{67338948e470c1251d8a.js → 8d14e957219364a81d5f.js} +3 -3
- package/assets/esri/core/workers/chunks/92a5dccb328229a9336b.js +1 -0
- package/assets/esri/core/workers/chunks/{631205dc4d73d49ec9ed.js → 95507ff0a243e451b99e.js} +1 -1
- package/assets/esri/core/workers/chunks/{1051a5a57b2fb843a555.js → 9cd55043f3d789f41815.js} +1 -1
- package/assets/esri/core/workers/chunks/{2b1486a466760d2152f5.js → a0f2df8ca7cd14bfa013.js} +1 -1
- package/assets/esri/core/workers/chunks/{06eb4832b6c86744e52e.js → aba19485b6cdcb70dac6.js} +1 -1
- package/assets/esri/core/workers/chunks/{9a06476b834584d00d5c.js → b160dcbea6256e0cf689.js} +1 -1
- package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +1 -0
- package/assets/esri/core/workers/chunks/{571252c9822d73cf7b01.js → b845586219f284a215b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{97c148adf0347c69a79c.js → c9604f8df909ec4fad46.js} +1 -1
- package/assets/esri/core/workers/chunks/{b87fec1753f164c845c5.js → ca76950d81ab4ebb65e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{faa40ef04604c7cce706.js → cb63ea6a53d3c2fc3179.js} +1 -1
- package/assets/esri/core/workers/chunks/{55f087bca75c3f2a4515.js → d3c0d7799c92c6f0e7d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{ca60b34c3e1ed2ff5934.js → dd2b316baae02bbdddac.js} +1 -1
- package/assets/esri/core/workers/chunks/{80b596496800e8d60eb8.js → ed75e0962358523f4439.js} +1 -1
- package/assets/esri/core/workers/chunks/{0cf979a093e9744d1e80.js → ef7955a2509be0f03ca2.js} +1 -1
- package/assets/esri/core/workers/chunks/{b5d68d8460b7c15001dd.js → f1c6df5cf2ccb6ac47a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{523046e04679e301797d.js → f3d97a4c4f433adbdab5.js} +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/chunks/FocusAreaColor.glsl.js +10 -8
- package/chunks/persistableUrlUtils.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/decorators/persistable.js +1 -1
- package/geometry/projection/projectPointToVector.js +1 -1
- package/geometry/projection/projectVectorToPoint.js +1 -1
- package/geometry/projection/projectVectorToVector.js +1 -1
- package/geometry/projection.js +1 -1
- package/geometry/projectionUtils.js +5 -0
- package/geometry/support/meshUtils/elevation.js +1 -1
- package/geometry/support/meshUtils/extent.js +1 -1
- package/interfaces.d.ts +34 -2
- package/kernel.js +1 -1
- package/layers/MapNotesLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/graphics/applyEditsUtils.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/graphics/data/queryUtils.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/CornersGeoreference.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/ExtentAndRotationGeoreference.js +1 -1
- package/layers/support/GeoreferenceBase.js +1 -1
- package/layers/support/LocalMediaElementSource.js +1 -1
- package/layers/support/MediaElementView.js +1 -1
- package/layers/support/PolygonCollection.js +1 -1
- package/layers/support/SceneModification.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/webScene.js +1 -1
- package/portal/support/portalItemUtils.js +1 -1
- package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/smartMapping/statistics/histogram.js +1 -1
- package/smartMapping/statistics/summaryStatistics.js +1 -1
- package/support/persistableUrlUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/ViewStateManager.js +1 -1
- package/views/2d/constraints/GeometryConstraint.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/support/projectionUtils.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/visualElements/support/Segment.js +1 -1
- package/views/3d/layers/FeatureLayerView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/TileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/focusAreaStyle.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaEffect.js +5 -0
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +1 -1
- package/views/FocusArea.js +1 -1
- package/views/FocusAreaOutline.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View2D.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/snapping/GridSnappingEngine.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/layers/SceneLayerView.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
- package/widgets/support/AnchorElementViewModel.js +1 -1
- package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
- package/widgets/support/tests.js +1 -1
- package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +0 -1
- package/assets/esri/core/workers/chunks/6d1e1a4fcb90ea8b6848.js +0 -1
- package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{indexOf as r,PositionHint as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Logger.js";import{clamp as o}from"../../../../core/mathUtils.js";import{unwrapUpdating as n,updating as a,isUpdating as l}from"../../../../core/maybeUpdating.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as p}from"../../../../core/unitUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{o as m,f as d,i as f}from"../../../../chunks/vec32.js";import{fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../../core/sql/WhereClause.js";import{getReferenceEllipsoid as j}from"../../../../geometry/ellipsoidUtils.js";import{load as R,project as S}from"../../../../geometry/projection.js";import w from"../../../../geometry/SpatialReference.js";import{projectBoundingSphere as E}from"../../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as v}from"../../../../geometry/projection/projectVectorToVector.js";import{create as b}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as F,expandWithNestedArray as I,expand as _}from"../../../../geometry/support/aaBoundingRect.js";import{doubleArrayFrom as k}from"../../../../geometry/support/DoubleArray.js";import{earth as M}from"../../../../geometry/support/Ellipsoid.js";import{isWGS84 as T,isWebMercator as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{f as G}from"../../../../chunks/sphere.js";import{project as C}from"../../../../geometry/support/webMercatorUtils.js";import A from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as x,filterInPlace as L}from"./I3SUtil.js";let O=class extends t{constructor(e){super(e),this._projectionEngineLoaded=!1}initialize(){c((()=>this.viewFilter?.geometry||null!=this.layerFilter)).then((()=>this.loadAsyncModule(import("../../../../geometry/geometryEngine.js").then((e=>{this.destroyed||(this._geometryEngine=e)})))))}get sortedObjectIds(){if(null==this.viewFilter?.objectIds)return null;const e=k(this.viewFilter.objectIds);return e.sort(),e}get parsedWhereClause(){const e=this.viewFilter?.where;if(null==e||!e)return null;try{return h.create(e,{fieldsIndex:this.layerFieldsIndex})}catch(t){s.getLogger(this).error(`Failed to parse filter where clause: ${t}`)}return null}addFilters(e,t,r,i){const o=this.sortedObjectIds;null!=o&&e.push((e=>x(o,!0,e))),this.addSqlFilter(e,this.parsedWhereClause),this.addTimeFilter(e,this.viewFilter?.timeExtent);const a=n(this._layerMaskGeometries),l=this._geometryEngine,c=()=>s.getLogger(this);if(null!=a&&null!=this.layerFilter&&null!=l){const s=this.layerFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,a,s)))}const p=n(this._viewMaskGeometries);if(null!=p&&null!=this.viewFilter&&null!=l){const s=this.viewFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,p,s)))}}isMBSGeometryVisible(e,t,r){const i=n(this._layerMaskGeometries),o=this._geometryEngine;if(null!=i&&null!=this.layerFilter&&null!=o){const n=this.layerFilter.spatialRelationship,a=i[0].spatialReference||t;if(!E(e,r,q,a))return s.getLogger(this).warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,i,a,n)}const a=n(this._viewMaskGeometries);if(null!=a&&null!=this.viewFilter&&null!=o){const i=this.viewFilter.spatialRelationship,n=a[0].spatialReference||t;if(!E(e,r,q,n))return s.getLogger(this).warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,a,n,i)}return!0}get parsedGeometry(){const e=n(this._viewMaskGeometries),t=n(this._layerMaskGeometries);return null==e||null==t?e||t:t.concat(e)}get _layerMaskGeometries(){const e=this.layerFilter;return null==e?null:null==this._geometryEngine?a:"disjoint"===e.spatialRelationship?e.geometries.map((e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}}))):[e.geometries.reduce(((e,t)=>(e.rings=[...e.rings,...t.rings],e)),{type:"polygon",rings:[],spatialReference:e.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){if(null==this.viewFilter)return null;const{geometry:e}=this.viewFilter;if(null==e)return null;if(null==this.viewFilter||null==this._geometryEngine)return a;const{distance:t,units:r}=this.viewFilter,i=this.viewFilter.spatialRelationship,o="mesh"===e.type?e.extent:e;if(null==t||0===t)return K(this._geometryEngine,o,i);const n=r||p(o.spatialReference);if(o.spatialReference.isWGS84){const e=this._geometryEngine.geodesicBuffer(o,t,n);return K(this._geometryEngine,e,i)}const l=C(o,w.WGS84);if(null!=l){const e=C(this._geometryEngine.geodesicBuffer(l,t,n),o.spatialReference);return K(this._geometryEngine,e,i)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(R().then((()=>this._projectionEngineLoaded=!0))),!this._projectionEngineLoaded))return null;let c=null;try{c=S(o,w.WGS84)}catch(u){}if(c)try{c=S(this._geometryEngine.geodesicBuffer(c,t,n),o.spatialReference)}catch(u){c=null}return c||s.getLogger(this).error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${o.spatialReference.wkid}) to WGS84.`),K(this._geometryEngine,c,i)}get updating(){return l(this._layerMaskGeometries)||l(this._viewMaskGeometries)}static checkSupport(e){return null!=e&&(!!P(e.spatialRelationship)||(s.getLogger(this.prototype).warn(`Filters with spatialRelationship other than ${B.join(", ")} are not supported for mesh scene layers`),!1))}};e([u()],O.prototype,"layerFilter",void 0),e([u({type:A})],O.prototype,"viewFilter",void 0),e([u()],O.prototype,"layerFieldsIndex",void 0),e([u()],O.prototype,"loadAsyncModule",void 0),e([u()],O.prototype,"addSqlFilter",void 0),e([u()],O.prototype,"addTimeFilter",void 0),e([u({readOnly:!0})],O.prototype,"sortedObjectIds",null),e([u({readOnly:!0})],O.prototype,"parsedWhereClause",null),e([u({readOnly:!0})],O.prototype,"parsedGeometry",null),e([u({readOnly:!0})],O.prototype,"_layerMaskGeometries",null),e([u({readOnly:!0})],O.prototype,"_viewMaskGeometries",null),e([u()],O.prototype,"updating",null),e([u()],O.prototype,"_projectionEngineLoaded",void 0),e([u()],O.prototype,"_geometryEngine",void 0),O=e([g("esri.views.3d.layers.i3s.I3SMeshViewFilter")],O);const B=(e=>e)(["contains","intersects","disjoint"]);function P(e){return null!=e&&B.includes(e)}var U;function K(e,t,s){if(null==t)return null;if("disjoint"===s&&"polygon"===t.type){const s=t.rings.length,o=t.spatialReference,n=new Array(s);for(let e=0;e<s;++e){const r=F(1/0,1/0,-1/0,-1/0);I(r,t.rings[e]),n[e]={type:"polygon",rings:[t.rings[e]],spatialReference:o,cache:{},aabr:r}}n.sort(((e,t)=>e.aabr[0]-t.aabr[0]));const a=new Set,l=new i;for(let t=0;t<n.length;++t){const i=n[t],s=i.aabr[0];a.forEach((t=>{if(s>=t.aabr[2])return void a.delete(t);if(i.aabr[1]>t.aabr[3]||i.aabr[3]<t.aabr[1]||!e.intersects(i,t))return;i.rings=i.rings.concat(t.rings),_(i.aabr,t.aabr,i.aabr),i.cache={},a.delete(t);const o=r(n,t,n.length,l);n.splice(o,1)})),a.add(i)}for(const e of n)e.aabr=void 0;return n}return[t]}function V(e,t,r,i,s){if(t[3]>=.5*(t[2]+j(i).radius))return!0;const o=$(e,t,i);return r.every((t=>z(e,t,o,s)!==U.DISCARD))}function W(e,t,r,i,s,o,n,a,l){const c=a[0].spatialReference||o.spatialReference;if(!E(i.node.serviceMbsInIndexSR,n,q,c))return void e().warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const p=$(t,q,c),u=N(l,o,c,s,i.objectHandle),g="intersects"===l;let m=null;for(const d of a){if(0===r.length)return;switch(z(t,d,p,l)){case U.DISCARD:return g&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(r)??r.slice()),void(r.length=0);case U.KEEP:continue}L(r,i.featureIds,(e=>!!J(t,d,e,u)||(g&&(m||=[],m.push(i.featureIds[e])),!1)))}m&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(m)??m)}!function(e){e[e.KEEP=0]="KEEP",e[e.DISCARD=1]="DISCARD",e[e.TEST=2]="TEST"}(U||(U={}));const q=G(0,0,0,0);function N(e,t,r,i,s){const o=t.renderSpatialReference,n=new Map,a={type:"polygon",rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};a.rings[0][3]=a.rings[0][0];const l={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let c,p;switch(e){case"intersects":c=(e,t,r)=>e.intersects(t,r)?U.KEEP:U.TEST,p=H;break;case"contains":c=(e,t,r)=>e.contains(t,r)?U.TEST:U.DISCARD,p=H;break;default:c=(e,t,r)=>e.disjoint(t,r)?U.TEST:U.DISCARD,p=Z}return{collection:i,object:s,type:e,maskSR:r,renderSR:o,aabbCache:n,triangle:a,positions:l,triangleTest:c,geometryTest:p}}function $(e,t,r){const i={type:"point",x:t[0],y:t[1],hasZ:!1,hasM:!1,spatialReference:r},s=!T(r)&&!D(r),n=Number.isNaN(t[3])?0:o(t[3],0,2*M.radius),a=s?e.buffer(i,n,1):e.geodesicBuffer(i,n,1);return a.type="polygon",a}function z(e,t,r,i){switch(i){case"intersects":case"contains":return H(e,t,r);case"disjoint":return Z(e,t,r)}}function H(e,t,r){return e.intersects(t,r)?e.contains(t,r)?U.KEEP:U.TEST:U.DISCARD}function Z(e,t,r){return e.intersects(t,r)?e.contains(t,r)?U.DISCARD:U.TEST:U.KEEP}function J(e,t,r,i){const{collection:s,object:o,renderSR:n,maskSR:a,geometryTest:l,aabbCache:c}=i;let p=c.get(r);if(!p){const e=s.getObjectTransform(o);s.getComponentAabb(o,r,Q);const t=[y(Q[0],Q[1],0),y(Q[0],Q[4],0),y(Q[3],Q[4],0),y(Q[3],Q[1],0)];for(let r=0;r<4;++r)m(t[r],t[r],e.rotationScale),d(t[r],t[r],e.position),v(t[r],n,t[r],a);p={type:"polygon",rings:[t],spatialReference:a,cache:{}},p.rings[0][4]=p.rings[0][0],c.set(r,p)}switch(l(e,t,p)){case U.DISCARD:return!1;case U.KEEP:return!0}const{triangle:u,triangleTest:g,positions:h}=i,j=u.rings[0][0],R=u.rings[0][1],S=u.rings[0][2],w=s.getObjectTransform(o);s.getComponentPositions(o,r,h);const{indices:E,data:b,stride:F,startIndex:I,endIndex:_}=h;for(let y=I;y<_;y+=3){const r=F*E[y],i=F*E[y+1],s=F*E[y+2];switch(f(j,b[r],b[r+1],b[r+2]),f(R,b[i],b[i+1],b[i+2]),f(S,b[s],b[s+1],b[s+2]),m(j,j,w.rotationScale),m(R,R,w.rotationScale),m(S,S,w.rotationScale),d(j,j,w.position),d(R,R,w.position),d(S,S,w.position),v(j,n,j,a),v(R,n,R,a),v(S,n,S,a),g(e,t,u)){case U.DISCARD:return!1;case U.KEEP:return!0}}return"intersects"!==i.type}const Q=b();export{O as I3SMeshViewFilter};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{indexOf as r,PositionHint as i}from"../../../../core/arrayUtils.js";import s from"../../../../core/Logger.js";import{clamp as o}from"../../../../core/mathUtils.js";import{unwrapUpdating as n,updating as a,isUpdating as l}from"../../../../core/maybeUpdating.js";import{whenOnce as c}from"../../../../core/reactiveUtils.js";import{getUnitString as p}from"../../../../core/unitUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{o as m,f as d,i as f}from"../../../../chunks/vec32.js";import{fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import h from"../../../../core/sql/WhereClause.js";import{getReferenceEllipsoid as j}from"../../../../geometry/ellipsoidUtils.js";import{load as R,project as S}from"../../../../geometry/projectionUtils.js";import w from"../../../../geometry/SpatialReference.js";import{projectBoundingSphere as E}from"../../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as v}from"../../../../geometry/projection/projectVectorToVector.js";import{create as b}from"../../../../geometry/support/aaBoundingBox.js";import{fromValues as F,expandWithNestedArray as I,expand as _}from"../../../../geometry/support/aaBoundingRect.js";import{doubleArrayFrom as k}from"../../../../geometry/support/DoubleArray.js";import{earth as M}from"../../../../geometry/support/Ellipsoid.js";import{isWGS84 as T,isWebMercator as D}from"../../../../geometry/support/spatialReferenceUtils.js";import{f as G}from"../../../../chunks/sphere.js";import{project as C}from"../../../../geometry/support/webMercatorUtils.js";import A from"../../../../layers/support/FeatureFilter.js";import{objectIdFilter as x,filterInPlace as L}from"./I3SUtil.js";let O=class extends t{constructor(e){super(e),this._projectionEngineLoaded=!1}initialize(){c((()=>this.viewFilter?.geometry||null!=this.layerFilter)).then((()=>this.loadAsyncModule(import("../../../../geometry/geometryEngine.js").then((e=>{this.destroyed||(this._geometryEngine=e)})))))}get sortedObjectIds(){if(null==this.viewFilter?.objectIds)return null;const e=k(this.viewFilter.objectIds);return e.sort(),e}get parsedWhereClause(){const e=this.viewFilter?.where;if(null==e||!e)return null;try{return h.create(e,{fieldsIndex:this.layerFieldsIndex})}catch(t){s.getLogger(this).error(`Failed to parse filter where clause: ${t}`)}return null}addFilters(e,t,r,i){const o=this.sortedObjectIds;null!=o&&e.push((e=>x(o,!0,e))),this.addSqlFilter(e,this.parsedWhereClause),this.addTimeFilter(e,this.viewFilter?.timeExtent);const a=n(this._layerMaskGeometries),l=this._geometryEngine,c=()=>s.getLogger(this);if(null!=a&&null!=this.layerFilter&&null!=l){const s=this.layerFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,a,s)))}const p=n(this._viewMaskGeometries);if(null!=p&&null!=this.viewFilter&&null!=l){const s=this.viewFilter.spatialRelationship;e.push(((e,o)=>W(c,l,e,o,i,t,r,p,s)))}}isMBSGeometryVisible(e,t,r){const i=n(this._layerMaskGeometries),o=this._geometryEngine;if(null!=i&&null!=this.layerFilter&&null!=o){const n=this.layerFilter.spatialRelationship,a=i[0].spatialReference||t;if(!E(e,r,q,a))return s.getLogger(this).warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,i,a,n)}const a=n(this._viewMaskGeometries);if(null!=a&&null!=this.viewFilter&&null!=o){const i=this.viewFilter.spatialRelationship,n=a[0].spatialReference||t;if(!E(e,r,q,n))return s.getLogger(this).warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0;return V(o,q,a,n,i)}return!0}get parsedGeometry(){const e=n(this._viewMaskGeometries),t=n(this._layerMaskGeometries);return null==e||null==t?e||t:t.concat(e)}get _layerMaskGeometries(){const e=this.layerFilter;return null==e?null:null==this._geometryEngine?a:"disjoint"===e.spatialRelationship?e.geometries.map((e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}}))):[e.geometries.reduce(((e,t)=>(e.rings=[...e.rings,...t.rings],e)),{type:"polygon",rings:[],spatialReference:e.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){if(null==this.viewFilter)return null;const{geometry:e}=this.viewFilter;if(null==e)return null;if(null==this.viewFilter||null==this._geometryEngine)return a;const{distance:t,units:r}=this.viewFilter,i=this.viewFilter.spatialRelationship,o="mesh"===e.type?e.extent:e;if(null==t||0===t)return K(this._geometryEngine,o,i);const n=r||p(o.spatialReference);if(o.spatialReference.isWGS84){const e=this._geometryEngine.geodesicBuffer(o,t,n);return K(this._geometryEngine,e,i)}const l=C(o,w.WGS84);if(null!=l){const e=C(this._geometryEngine.geodesicBuffer(l,t,n),o.spatialReference);return K(this._geometryEngine,e,i)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(R().then((()=>this._projectionEngineLoaded=!0))),!this._projectionEngineLoaded))return null;let c=null;try{c=S(o,w.WGS84)}catch(u){}if(c)try{c=S(this._geometryEngine.geodesicBuffer(c,t,n),o.spatialReference)}catch(u){c=null}return c||s.getLogger(this).error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${o.spatialReference.wkid}) to WGS84.`),K(this._geometryEngine,c,i)}get updating(){return l(this._layerMaskGeometries)||l(this._viewMaskGeometries)}static checkSupport(e){return null!=e&&(!!U(e.spatialRelationship)||(s.getLogger(this.prototype).warn(`Filters with spatialRelationship other than ${B.join(", ")} are not supported for mesh scene layers`),!1))}};e([u()],O.prototype,"layerFilter",void 0),e([u({type:A})],O.prototype,"viewFilter",void 0),e([u()],O.prototype,"layerFieldsIndex",void 0),e([u()],O.prototype,"loadAsyncModule",void 0),e([u()],O.prototype,"addSqlFilter",void 0),e([u()],O.prototype,"addTimeFilter",void 0),e([u({readOnly:!0})],O.prototype,"sortedObjectIds",null),e([u({readOnly:!0})],O.prototype,"parsedWhereClause",null),e([u({readOnly:!0})],O.prototype,"parsedGeometry",null),e([u({readOnly:!0})],O.prototype,"_layerMaskGeometries",null),e([u({readOnly:!0})],O.prototype,"_viewMaskGeometries",null),e([u()],O.prototype,"updating",null),e([u()],O.prototype,"_projectionEngineLoaded",void 0),e([u()],O.prototype,"_geometryEngine",void 0),O=e([g("esri.views.3d.layers.i3s.I3SMeshViewFilter")],O);const B=(e=>e)(["contains","intersects","disjoint"]);function U(e){return null!=e&&B.includes(e)}var P;function K(e,t,s){if(null==t)return null;if("disjoint"===s&&"polygon"===t.type){const s=t.rings.length,o=t.spatialReference,n=new Array(s);for(let e=0;e<s;++e){const r=F(1/0,1/0,-1/0,-1/0);I(r,t.rings[e]),n[e]={type:"polygon",rings:[t.rings[e]],spatialReference:o,cache:{},aabr:r}}n.sort(((e,t)=>e.aabr[0]-t.aabr[0]));const a=new Set,l=new i;for(let t=0;t<n.length;++t){const i=n[t],s=i.aabr[0];a.forEach((t=>{if(s>=t.aabr[2])return void a.delete(t);if(i.aabr[1]>t.aabr[3]||i.aabr[3]<t.aabr[1]||!e.intersects(i,t))return;i.rings=i.rings.concat(t.rings),_(i.aabr,t.aabr,i.aabr),i.cache={},a.delete(t);const o=r(n,t,n.length,l);n.splice(o,1)})),a.add(i)}for(const e of n)e.aabr=void 0;return n}return[t]}function V(e,t,r,i,s){if(t[3]>=.5*(t[2]+j(i).radius))return!0;const o=$(e,t,i);return r.every((t=>z(e,t,o,s)!==P.DISCARD))}function W(e,t,r,i,s,o,n,a,l){const c=a[0].spatialReference||o.spatialReference;if(!E(i.node.serviceMbsInIndexSR,n,q,c))return void e().warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const p=$(t,q,c),u=N(l,o,c,s,i.objectHandle),g="intersects"===l;let m=null;for(const d of a){if(0===r.length)return;switch(z(t,d,p,l)){case P.DISCARD:return g&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(r)??r.slice()),void(r.length=0);case P.KEEP:continue}L(r,i.featureIds,(e=>!!J(t,d,e,u)||(g&&(m||=[],m.push(i.featureIds[e])),!1)))}m&&(i.weaklyRemovedIds=i.weaklyRemovedIds?.concat(m)??m)}!function(e){e[e.KEEP=0]="KEEP",e[e.DISCARD=1]="DISCARD",e[e.TEST=2]="TEST"}(P||(P={}));const q=G(0,0,0,0);function N(e,t,r,i,s){const o=t.renderSpatialReference,n=new Map,a={type:"polygon",rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};a.rings[0][3]=a.rings[0][0];const l={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let c,p;switch(e){case"intersects":c=(e,t,r)=>e.intersects(t,r)?P.KEEP:P.TEST,p=H;break;case"contains":c=(e,t,r)=>e.contains(t,r)?P.TEST:P.DISCARD,p=H;break;default:c=(e,t,r)=>e.disjoint(t,r)?P.TEST:P.DISCARD,p=Z}return{collection:i,object:s,type:e,maskSR:r,renderSR:o,aabbCache:n,triangle:a,positions:l,triangleTest:c,geometryTest:p}}function $(e,t,r){const i={type:"point",x:t[0],y:t[1],hasZ:!1,hasM:!1,spatialReference:r},s=!T(r)&&!D(r),n=Number.isNaN(t[3])?0:o(t[3],0,2*M.radius),a=s?e.buffer(i,n,1):e.geodesicBuffer(i,n,1);return a.type="polygon",a}function z(e,t,r,i){switch(i){case"intersects":case"contains":return H(e,t,r);case"disjoint":return Z(e,t,r)}}function H(e,t,r){return e.intersects(t,r)?e.contains(t,r)?P.KEEP:P.TEST:P.DISCARD}function Z(e,t,r){return e.intersects(t,r)?e.contains(t,r)?P.DISCARD:P.TEST:P.KEEP}function J(e,t,r,i){const{collection:s,object:o,renderSR:n,maskSR:a,geometryTest:l,aabbCache:c}=i;let p=c.get(r);if(!p){const e=s.getObjectTransform(o);s.getComponentAabb(o,r,Q);const t=[y(Q[0],Q[1],0),y(Q[0],Q[4],0),y(Q[3],Q[4],0),y(Q[3],Q[1],0)];for(let r=0;r<4;++r)m(t[r],t[r],e.rotationScale),d(t[r],t[r],e.position),v(t[r],n,t[r],a);p={type:"polygon",rings:[t],spatialReference:a,cache:{}},p.rings[0][4]=p.rings[0][0],c.set(r,p)}switch(l(e,t,p)){case P.DISCARD:return!1;case P.KEEP:return!0}const{triangle:u,triangleTest:g,positions:h}=i,j=u.rings[0][0],R=u.rings[0][1],S=u.rings[0][2],w=s.getObjectTransform(o);s.getComponentPositions(o,r,h);const{indices:E,data:b,stride:F,startIndex:I,endIndex:_}=h;for(let y=I;y<_;y+=3){const r=F*E[y],i=F*E[y+1],s=F*E[y+2];switch(f(j,b[r],b[r+1],b[r+2]),f(R,b[i],b[i+1],b[i+2]),f(S,b[s],b[s+1],b[s+2]),m(j,j,w.rotationScale),m(R,R,w.rotationScale),m(S,S,w.rotationScale),d(j,j,w.position),d(R,R,w.position),d(S,S,w.position),v(j,n,j,a),v(R,n,R,a),v(S,n,S,a),g(e,t,u)){case P.DISCARD:return!1;case P.KEEP:return!0}}return"intersects"!==i.type}const Q=b();export{O as I3SMeshViewFilter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as s,t as i,c as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projection.js";import f from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as m,expandPointInPlace as y,intersects as h}from"../../../../geometry/support/aaBoundingRect.js";import{a as g}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as b,getCachedAttributeValue as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as v}from"../support/symbolColorUtils.js";import{Obb as x,compute as M}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as j}from"../../../support/layerViewUtils.js";function C(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function k(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function N(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&q(e,r))!==O.OUTSIDE&&(o(t),!0)}))}function U(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function D(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}function W(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return _[0]=(e[0]-t.position[0])/t.rotationScale[0],_[1]=(e[1]-t.position[1])/t.rotationScale[4],_[2]=(e[2]-t.position[0])/t.rotationScale[0],_[3]=(e[3]-t.position[1])/t.rotationScale[4],_}const _=d();var O;function q(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,s=r-e[2],i=e[1]-o,l=o-e[3],c=Math.max(a,s,0),u=Math.max(i,l,0),f=c*c+u*u;if(f>n*n)return O.OUTSIDE;if(f>0)return O.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,s,i,l)>n?O.INSIDE:O.INTERSECTS_CENTER_INSIDE}function F(e,t,r){const o=[],n=r?.missingFields,a=r?.originalFields;for(const s of e){const e=s.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(s);break}!r&&n&&n.push(s)}return o}async function L(e,t,r,n,a,s){if(0===t.length)return[];const i=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await A(e.associatedLayer,t,r,n,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(i){const l=K(t,r,a);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>B(c,i,t.node,t.indices,n,e.apiKey,e.customParameters,s).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],a=r();for(const s of e){const e=s.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(s);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function A(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const a=t.map((e=>e.attributes[r])),s=[],i=F(o,e.fields,{originalFields:s}),l=await P(e,a,i,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<s.length;t++)o[s[t]]=r[i[t]];e.attributes=o}return t}function P(e,t,n,a){const s=e.capabilities.query.maxRecordCount;if(null!=s&&t.length>s){const o=r(t,s);return Promise.all(o.map((t=>P(e,t,n,a)))).then((e=>e.flat()))}const i=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(i,a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function B(e,t,r,o,n,a,s,i){return G(e,t,r.resources.attributes,o,n,a,s,i)}async function G(t,r,o,n,a,s,i,l){const c=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...i,token:s},signal:l?.signal}).then((e=>b(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=w(n,e)}}f.push(t)}return f}function V(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function $(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function z(e,t,r){if(!u(e,t))throw j("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Z(e,t))throw j("scene layer",e?.wkid,t?.wkid)}function Q(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed","Could not recycle layerview")}function Z(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function H(e,t,r){const o=V(e),n=$(e);z(o,t,r),z(n,t,r)}function J(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function X(e){if(null==e.store?.defaultGeometrySchema||!J(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function Y(e,t){H(e,t.spatialReference,t.viewingMode)}function ee(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function te(e){if(null==e.store?.defaultGeometrySchema||!ee(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function re(e,t){z(e.spatialReference,t.spatialReference,t.viewingMode)}function oe(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ne(e){return"mesh-3d"===e.type}function ae(e){if(null==e||!oe(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!ne(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(O||(O={}));const se=T({color:[0,0,0,0],opacity:0});class ie{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function le(e){const t=new ie;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(null!=e&&!r){const o=e.color,a=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:{color:[1,1,1],alpha:1,colorMixMode:v.Multiply},t.castShadows=n.castShadows,r=!0}null==a||o||(t.edgeMaterial=E(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:v.Multiply}),t}function ce(e,t){return(0|e)+(0|t)|0}function ue(e,t,r,o,a,c,u){if(!c||0===c.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,a,"none",r,t);n(be,f);let d=null;const S=()=>{if(!d)if(d=de,m(ye),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(he,r,t,a,u),he.getCorners(d);for(const e of d)i(e,e,be),y(ye,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const n=o[3];p(g(o),r,ge,t),i(ge,ge,be),ge[2]+=a;for(let e=0;e<8;++e){const t=1&e?n:-n,r=2&e?n:-n,o=4&e?n:-n,a=d[e];l(a,[ge[0]+t,ge[1]+r,ge[2]+o]),y(ye,a)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;m(me);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(s(ge,r[0],r[1],r[2]),p(ge,n,ge,t),i(ge,ge,be),y(me,ge),Math.min(ge[2],e))),e)),1/0);S(),h(ye,me)&&(b=Math.min(b,a),w=Math.max(w,a))};if(c.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=b,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=w,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2]};for(let n=0;n<8;++n)E(Se.data,3*n,d[n]);return M(Se)}function fe(e){return e[3]>=0}function pe(e){null!=e&&(e[3]=-1)}const de=[c(),c(),c(),c(),c(),c(),c(),c()],me=d(),ye=d(),he=new x,ge=c(),Se={data:new Array(72),size:3,exclusive:!0,stride:3},be=a();export{O as MbsIntersectResult,ie as SymbolInfo,ce as addWraparound,re as checkPointCloudLayerCompatibleWithView,te as checkPointCloudLayerValid,Q as checkRecyclable,Y as checkSceneLayerCompatibleWithView,X as checkSceneLayerValid,z as checkSpatialReference,H as checkSpatialReferences,ue as computeVisibilityObb,k as containsDraco,C as extractWkid,U as filterInPlace,F as findFieldsCaseInsensitive,N as findIntersectingNodes,W as getClipRect,V as getIndexCrs,le as getSymbolInfo,$ as getVertexCrs,q as intersectBoundingRectWithMbs,pe as invalidateMbs,Z as isSupportedLocalModeProjection,fe as isValidMbs,D as objectIdFilter,G as queryAttributesFromCachedAttributesId,ae as rendererNeedsTextures,se as transparentEdgeMaterial,L as whenGraphicAttributes};
|
|
5
|
+
import e from"../../../../request.js";import{binaryIndexOf as t,splitIntoChunks as r}from"../../../../core/arrayUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as s,t as i,c as l}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as u}from"../../../../geometry/projectionUtils.js";import f from"../../../../geometry/SpatialReference.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as d,empty as m,expandPointInPlace as y,intersects as h}from"../../../../geometry/support/aaBoundingRect.js";import{a as g}from"../../../../chunks/sphere.js";import S from"../../../../rest/support/Query.js";import{readBinaryAttribute as b,getCachedAttributeValue as w}from"./I3SBinaryReader.js";import{computeGlobalTransformation as I}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as T,createMaterialFromEdges as E}from"../support/edgeUtils.js";import{parseColorMixMode as R,ColorMixModeEnum as v}from"../support/symbolColorUtils.js";import{Obb as x,compute as M}from"../../support/orientedBoundingBox.js";import{spatialReferenceIncompatibleError as j}from"../../../support/layerViewUtils.js";function C(e){return e?parseInt(e.slice(e.lastIndexOf("/")+1),10):void 0}function U(e){if(has("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes?.encoding)return!0;return!1}function k(e,t,r,o){r.traverse(t,(t=>{const r=t.serviceMbsInIndexSR;return(null!=r&&q(e,r))!==O.OUTSIDE&&(o(t),!0)}))}function N(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function D(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}function W(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return _[0]=(e[0]-t.position[0])/t.rotationScale[0],_[1]=(e[1]-t.position[1])/t.rotationScale[4],_[2]=(e[2]-t.position[0])/t.rotationScale[0],_[3]=(e[3]-t.position[1])/t.rotationScale[4],_}const _=d();var O;function q(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,s=r-e[2],i=e[1]-o,l=o-e[3],c=Math.max(a,s,0),u=Math.max(i,l,0),f=c*c+u*u;if(f>n*n)return O.OUTSIDE;if(f>0)return O.INTERSECTS_CENTER_OUTSIDE;return-Math.max(a,s,i,l)>n?O.INSIDE:O.INTERSECTS_CENTER_INSIDE}function F(e,t,r){const o=[],n=r?.missingFields,a=r?.originalFields;for(const s of e){const e=s.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(s);break}!r&&n&&n.push(s)}return o}async function L(e,t,r,n,a,s){if(0===t.length)return[];const i=e.attributeStorageInfo;if(null!=e.associatedLayer)try{return await A(e.associatedLayer,t,r,n,s)}catch(l){if(e.associatedLayer.loaded)throw l}if(i){const l=K(t,r,a);if(null==l)throw new o("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const c=e.parsedUrl.path;return(await Promise.all(l.map((t=>B(c,i,t.node,t.indices,n,e.apiKey,e.customParameters,s).then((e=>{for(let r=0;r<t.graphics.length;r++){const o=t.graphics[r],n=e[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return t.graphics})))))).flat()}throw new o("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function K(e,t,r){const o=new Map,n=[],a=r();for(const s of e){const e=s.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(s);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function A(e,t,r,o,n){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const a=t.map((e=>e.attributes[r])),s=[],i=F(o,e.fields,{originalFields:s}),l=await P(e,a,i,n);for(let c=0;c<t.length;c++){const e=t[c],r=l[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<s.length;t++)o[s[t]]=r[i[t]];e.attributes=o}return t}function P(e,t,n,a){const s=e.capabilities.query.maxRecordCount;if(null!=s&&t.length>s){const o=r(t,s);return Promise.all(o.map((t=>P(e,t,n,a)))).then((e=>e.flat()))}const i=new S({objectIds:t,outFields:n,orderByFields:[e.objectIdField]});return e.queryFeatures(i,a).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new o("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function B(e,t,r,o,n,a,s,i){return G(e,t,r.resources.attributes,o,n,a,s,i)}async function G(t,r,o,n,a,s,i,l){const c=[];for(const e of r)if(e&&a.includes(e.name)){const r=`${t}/nodes/${o}/attributes/${e.key}/0`;c.push({url:r,storageInfo:e})}const u=await Promise.allSettled(c.map((t=>e(t.url,{responseType:"array-buffer",query:{...i,token:s},signal:l?.signal}).then((e=>b(t.storageInfo,e.data)))))),f=[];for(const e of n){const t={};for(let r=0;r<u.length;r++){const o=u[r];if("fulfilled"===o.status){const n=o.value;t[c[r].storageInfo.name]=w(n,e)}}f.push(t)}return f}function V(e){const t=e.store,r=t.indexCRS||t.geographicCRS,n=void 0===r?t.indexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-index-incompatible","The indexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function $(e){const t=e.store,r=t.vertexCRS||t.projectedCRS,n=void 0===r?t.vertexWKT:void 0;if(n){if(!e.spatialReference)throw new o("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(n!==e.spatialReference.wkt)throw new o("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const a=r?new f(C(r)):e.spatialReference;return a.equals(e.spatialReference)?e.spatialReference:a}function z(e,t,r){if(!u(e,t))throw j("scene layer",e?.wkid,t?.wkid);if("local"===r&&!Z(e,t))throw j("scene layer",e?.wkid,t?.wkid)}function Q(e,t,r){if(e.serviceUpdateTimeStamp?.lastUpdate!==t.serviceUpdateTimeStamp?.lastUpdate||!r.isEmpty||e.associatedLayer?.url!==t.associatedLayer?.url)throw new o("layerview:recycle-failed","Could not recycle layerview")}function Z(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator||e.isWebMercator&&t.isWGS84}function H(e,t,r){const o=V(e),n=$(e);z(o,t,r),z(n,t,r)}function J(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&null!=e.vertexAttributes?.position)}function X(e){if(null==e.store?.defaultGeometrySchema||!J(e.store.defaultGeometrySchema))throw new o("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function Y(e,t){H(e,t.spatialReference,t.viewingMode)}function ee(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&null!=e.vertexAttributes?.position))}function te(e){if(null==e.store?.defaultGeometrySchema||!ee(e.store.defaultGeometrySchema))throw new o("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function re(e,t){z(e.spatialReference,t.spatialReference,t.viewingMode)}function oe(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ne(e){return"mesh-3d"===e.type}function ae(e){if(null==e||!oe(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.symbols;if(0===t.length)return!0;for(const r of t){if(!ne(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||null==e.material?.color||"replace"!==e.material.colorMixMode)return!0}return!1}!function(e){e[e.OUTSIDE=0]="OUTSIDE",e[e.INTERSECTS_CENTER_OUTSIDE=1]="INTERSECTS_CENTER_OUTSIDE",e[e.INTERSECTS_CENTER_INSIDE=2]="INTERSECTS_CENTER_INSIDE",e[e.INSIDE=3]="INSIDE"}(O||(O={}));const se=T({color:[0,0,0,0],opacity:0});class ie{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function le(e){const t=new ie;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(null!=e&&!r){const o=e.color,a=R(e.colorMixMode);t.material=null!=o?{color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:{color:[1,1,1],alpha:1,colorMixMode:v.Multiply},t.castShadows=n.castShadows,r=!0}null==a||o||(t.edgeMaterial=E(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:v.Multiply}),t}function ce(e,t){return(0|e)+(0|t)|0}function ue(e,t,r,o,a,c,u){if(!c||0===c.length||null==t||!e.serviceMbsInIndexSR)return null;const f=I(e.serviceMbsInIndexSR,a,"none",r,t);n(be,f);let d=null;const S=()=>{if(!d)if(d=de,m(ye),null!=e.serviceObbInIndexSR){e.serviceObbInIndexSR.transform(he,r,t,a,u),he.getCorners(d);for(const e of d)i(e,e,be),y(ye,e)}else{const o=e.serviceMbsInIndexSR;if(!o)return;const n=o[3];p(g(o),r,ge,t),i(ge,ge,be),ge[2]+=a;for(let e=0;e<8;++e){const t=1&e?n:-n,r=2&e?n:-n,o=4&e?n:-n,a=d[e];l(a,[ge[0]+t,ge[1]+r,ge[2]+o]),y(ye,a)}}};let b=1/0,w=-1/0;const T=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r?.hasZ)return;m(me);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(s(ge,r[0],r[1],r[2]),p(ge,n,ge,t),i(ge,ge,be),y(me,ge),Math.min(ge[2],e))),e)),1/0);S(),h(ye,me)&&(b=Math.min(b,a),w=Math.max(w,a))};if(c.forEach((e=>T(e))),b===1/0)return null;const E=(e,t,r)=>{i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=b,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2],t+=24,r[2]=w,i(ge,r,f),e[t]=ge[0],e[t+1]=ge[1],e[t+2]=ge[2]};for(let n=0;n<8;++n)E(Se.data,3*n,d[n]);return M(Se)}function fe(e){return e[3]>=0}function pe(e){null!=e&&(e[3]=-1)}const de=[c(),c(),c(),c(),c(),c(),c(),c()],me=d(),ye=d(),he=new x,ge=c(),Se={data:new Array(72),size:3,exclusive:!0,stride:3},be=a();export{O as MbsIntersectResult,ie as SymbolInfo,ce as addWraparound,re as checkPointCloudLayerCompatibleWithView,te as checkPointCloudLayerValid,Q as checkRecyclable,Y as checkSceneLayerCompatibleWithView,X as checkSceneLayerValid,z as checkSpatialReference,H as checkSpatialReferences,ue as computeVisibilityObb,U as containsDraco,C as extractWkid,N as filterInPlace,F as findFieldsCaseInsensitive,k as findIntersectingNodes,W as getClipRect,V as getIndexCrs,le as getSymbolInfo,$ as getVertexCrs,q as intersectBoundingRectWithMbs,pe as invalidateMbs,Z as isSupportedLocalModeProjection,fe as isValidMbs,D as objectIdFilter,G as queryAttributesFromCachedAttributesId,ae as rendererNeedsTextures,se as transparentEdgeMaterial,L as whenGraphicAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import{makeHandle as r,destroyHandle as o}from"../../../../core/handleUtils.js";import{watch as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as c,project as n}from"../../../../geometry/
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import{makeHandle as r,destroyHandle as o}from"../../../../core/handleUtils.js";import{watch as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as c,project as n}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as g}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import u from"../../../../symbols/SimpleLineSymbol.js";import d from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as y}from"../../../layers/support/highlightUtils.js";let w=class extends i{get updating(){return this.graphicsView?.updating??!1}constructor(t){super(t),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new g,this.graphicsView=null,this.suspended=!1;const i=new e([255,255,255,1/255]);this._symbols=new Map([["point",new d({size:"2px",style:"square",color:i})],["polyline",new u({width:"2px",color:i})],["polygon",new m({outline:null,color:i})]])}highlight(t,e){const i=y(t);if(0===i.length)return r();let s,o=!1;return this.updatingHandles.addPromise(Promise.all([this._createHighlightGraphics(i),this._ensureGraphicsView3D()]).then((([t,i])=>{!o&&i&&(s=this._addHighlightGraphics(i,t,e))}))),r((()=>{o=!0,s?.remove()}))}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(t,e,i){for(const r of e)this._highlightCounts.set(r,(this._highlightCounts.get(r)??0)+1);this.graphics.addMany(e);const s=t.highlight(e,i);return r((()=>{this._removeHighlightGraphics(e),s.remove()}))}_removeHighlightGraphics(t){this.graphics.removeMany(t.filter((t=>{const e=Math.max(0,(this._highlightCounts.get(t)??0)-1);return 0===e?(this._highlightCounts.delete(t),!0):(this._highlightCounts.set(t,e),!1)})))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||(this._graphicsViewLoader=import("../GraphicsView3D.js"));const{default:t}=await this._graphicsViewLoader;if(this.destroyed)return null;const e=new t({view:this.view,layer:this.layer,getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set("graphicsView",e),this.addHandles([o(this.graphicsView),h((()=>this.suspended),(t=>{e.suspended=t}),p)]),e}async _createHighlightGraphics(t){const e=t.map((({geometry:t})=>t?.spatialReference)).filter(s).reduce(((t,e)=>(0!==t.length&&t.at(-1)?.equals(e)||t.push(e),t)),[]),i=this.view.spatialReference,r=e.map((t=>({source:t,dest:i})));try{await c(r)}catch{return[]}return t.map((t=>{const{geometry:e}=t;try{const s=e?n(e,i):null,r=t.cloneShallow();return r.geometry=s,r.symbol=this._symbols.get(s?.type),r}catch{return t}}))}};t([a()],w.prototype,"graphics",void 0),t([a()],w.prototype,"graphicsView",void 0),t([a()],w.prototype,"view",void 0),t([a()],w.prototype,"layer",void 0),t([a()],w.prototype,"updatingHandles",void 0),t([a()],w.prototype,"suspended",void 0),t([a()],w.prototype,"updating",null),w=t([l("esri.views.3d.layers.support.ImageHighlightHelper3D")],w);export{w as ImageHighlightHelper3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projection.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as A,toExtent as E,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(({camera:e})=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return A(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=E(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?.stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?.stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:_})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:y})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Camera.js";import i from"../../../Viewpoint.js";import r from"../../../core/Accessor.js";import a from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{on as n,watch as o,sync as h,when as l}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{createScreenPoint as c}from"../../../core/screenUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../../chunks/vec32.js";import{fromArray as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as w}from"../../../chunks/vec42.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../geometry/Extent.js";import _ from"../../../geometry/Point.js";import f from"../../../geometry/Polygon.js";import{isLoadedOrLoadFor as C,requiresLoad as x}from"../../../geometry/projectionUtils.js";import{ViewingMode as R}from"../../ViewingMode.js";import{applyAll as P}from"../camera/constraintUtils.js";import{cameraOnContentAlongViewDirection as S,surfaceElevationBelowRenderLocation as O}from"../camera/intersectionUtils.js";import{ConstraintsManager as T}from"./ConstraintsManager.js";import{Frustum as b}from"./Frustum.js";import{GoToOperation as j}from"./GoToOperation.js";import{SurfaceCollisionCorrectionController as I}from"./controllers/SurfaceCollisionCorrectionController.js";import{internalToExternal as M,externalToInternal as z,toArea as A,toExtent as E,applyTiltAdjustToScale as L,scaleToZoom as H,fromExtentSync as N,OrientationMode as V,getObserverForPointAtDistanceSync as B,viewScaleToCameraDistance as D,zoomToScale as G}from"../support/cameraUtils.js";import{fromCamera as U,toCameraSync as F}from"../support/viewpointUtils.js";import k from"../webgl/RenderCamera.js";import{PaddingSide as q}from"../webgl-engine/lib/rendererUtils.js";import{RenderFeature as W}from"../webgl-engine/lib/RenderFeature.js";import{PropertiesPool as J}from"../../support/PropertiesPool.js";import{RenderState as K}from"../../support/RenderState.js";import{ensureAttachmentMaxSize as Z}from"../../webgl/FramebufferObject.js";let Q=class extends r{constructor(e){super(e),this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=ne,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:e=>this._devicePixelRatioOverride=e,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return null!=this.renderState},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(e){this.viewStateManager._idleTimeout=e?ne:0}},this._propertiesPool=new J({frustum:b},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new X}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([n((()=>this.view.state.events),"before-camera-change",(({camera:e})=>e&&this._updateElevation(e))),o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),h)]),l((()=>this.view.state?.camera),(e=>this._updateElevation(e)),{once:!0,sync:!0}),this.addHandles([p({prepare:()=>this._prepareFrame()}),o((()=>this.view.state.cameraController),(()=>{this._cameraSetByUser=!0,this.removeHandles(ae)})),n((()=>this.view.state.events),"camera-projection-changed",(()=>this.notifyChange("scale")))])}destroy(){this.exit(),this._propertiesPool=s(this._propertiesPool)}get camera(){const e=this._get("camera");if(!this.ready)return e;const t=M(this.view,this.view.state.camera,te);return t&&e&&t.equals(e)?e:t.clone()}set camera(e){this._updatePropertyBeforeReady("camera",e)||(this.view.elevationProvider?.enableCache(!0),this.setStateCamera(z(this.view,e),{applyConstraints:!1})||a.getLogger(this).error("#camera=","Invalid camera",e),this.view.elevationProvider?.enableCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const t=M(this.view,this.view.state.contentCamera,te);return t&&e&&t.equals(e)?e:t.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const t=z(this.view,e);this.view.state.contentCamera=null!=t?t:null}installContentCameraReset(e){if(this.removeHandles(se),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const t=this.zoom,i=this.view.state.camera.distance**2,r=u(this.view.state.camera.center),a=e.sticky?this.contentCamera.clone():null;return this.addHandles([o((()=>this.contentCamera),(()=>{e.sticky||(this.removeHandles(se),this.test.contentCameraResetState.clear())})),o((()=>this.zoom),(e=>{void 0!==e&&void 0!==t&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(e-t)/2),Math.abs(e-t)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a))})),o((()=>this.view.state.camera),(e=>{const t=v(r,e.center);this.test.contentCameraResetState.set("camera.center",t/i),t>i?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=a)}))],se),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():a.getLogger(this).error("#center=","Invalid center",e):a.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#center=","Center may not be null or undefined"))}get visibleArea(){if(!this.ready){const e=this._get("extent");return e?f.fromExtent(e):null}return A(this.view,this.view.pointsOfInterest.focus.renderLocation)}get extent(){if(!this.ready)return this._get("extent");const e=this.view,t=E(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return null!=t?t:this._get("extent")}set extent(e){this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#extent=","Invalid extent",e):a.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e):a.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get constraintsManager(){return this._constraintsManager}get _initialViewpoint(){const e=this.view.map;return e&&"initialViewProperties"in e?e.initialViewProperties?.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(!this.ready)return this._get("scale");const e=this.view.basemapTerrain.tilingScheme,t=this.view.pointsOfInterest.cameraOnSurface.scale;return e&&t?L(this.view,t,this.view.state.contentCamera,e):this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,t=e.padding,i=e.pixelRatio,r=this._get("padding"),a=Math.round(t[q.TOP]/i),s=Math.round(t[q.RIGHT]/i),n=Math.round(t[q.BOTTOM]/i),o=Math.round(t[q.LEFT]/i);return null!=r&&r.top===a&&r.right===s&&r.bottom===n&&r.left===o?r:{top:a,right:s,bottom:n,left:o}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,re),this.view.state.updateCamera((e=>e.padding=re)))}_paddingToArray(e,t,i){e?w(i,e.top||0,e.right||0,e.bottom||0,e.left||0):w(i,0,0,0,0);for(let r=0;r<4;r++)i[r]=Math.round(i[r]*t)}get screenCenter(){const e=this.padding;return c((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?U(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||a.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const t=null!=e.camera?e.camera.position:e.targetGeometry,i=null!=t&&t.spatialReference;a.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(i?i.wkid:"none")+", view: "+this.view.spatialReference?.wkid+")",e)}else a.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?H(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||void 0===e||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||a.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),t=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*t),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*t);const i=this.view.stage.renderView.renderingContext?.parameters.maxTextureSize;return i&&Z(this._tmpCanvasSize,i),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:t,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return null!=this._devicePixelRatioOverride?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){return this.view?.stage?.renderer.isFeatureEnabled(W.PhysicalPixelRendering)??!1}get _usePhysicalPixelRenderingAny(){const e=this.view?.stage?.renderer;return e&&(e.isFeatureEnabled(W.PhysicalPixelRendering,K.IDLE)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.INTERACTING)||e.isFeatureEnabled(W.PhysicalPixelRendering,K.ANIMATING))}preinit(e){return!(this._isOverridden("center")&&!C(this.center.spatialReference,e))&&(!(this._isOverridden("camera")&&!C(this.camera.position.spatialReference,e))&&(!(this._isOverridden("extent")&&!C(this.extent.spatialReference,e))&&!!(!this._isOverridden("viewpoint")||C(this.viewpoint.targetGeometry?.spatialReference,e)&&C(this.viewpoint.camera?.position?.spatialReference,e))))}init(){this._constraintsManager=new T({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const t of e)this.set(t.name,t.value);if(!this._cameraSetByUser){const e=this._initialViewpoint||this.view.initialExtent;e&&this.isCompatible(e)?this._setInitialView(e):this.view.state.viewingMode===R.Local&&this.addHandles(l((()=>this.view.basemapTerrain.ready),(()=>{this.removeHandles(ae),this._setInitialView(this.view.dataExtent)}),{once:!0,initial:!0}),ae)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(ae),this._constraintsManager=s(this._constraintsManager))}async goTo(e,t){return t={animate:!0,...t},null!=this._gotoOperation&&this._gotoOperation.abort(t.animate),this._gotoOperation=new j(e,t,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(S(this.view),{applyConstraints:!1})}step(e){const t=this.view.state,i=t?.cameraController;i&&(t.updateCamera((t=>i.stepController(e,t))),i.steppingFinished&&i.finishController())}_cancelGoToOperation(){null!=this._gotoOperation&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,t=[];for(const{propertyName:i,overrides:r}of $){const a=e.has(i),s=this._isOverridden(i);!a&&s&&t.push({name:i,value:this._get(i)}),this._clearOverride(i),(a||s)&&r.forEach((t=>e.add(t)))}return t}_setInitialView(e){if(null==e||this._cameraSetByUser)return;if(e instanceof t)return void this.setStateCamera(z(this.view,e),{applyConstraints:!1});if(e instanceof i){if(e.targetGeometry instanceof y){const t=N(this.view,e.targetGeometry,0,.5,V.LOCKED);return void(null!=t&&this.setStateCamera(z(this.view,t),{applyConstraints:!0}))}const t={applyConstraints:!e.camera},i=this._viewpointToCamera(e);return void this.setStateCamera(i,t)}const r=N(this.view,e,0,.5,V.LOCKED);null!=r&&this.setStateCamera(z(this.view,r),{applyConstraints:!0})}_updatePropertyBeforeReady(e,t){return!this.ready&&(this._override(e,t),t&&Y.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return null!=e&&(e instanceof i?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof t?this.isCompatible(e.position):e.spatialReference&&!x(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=ee){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,t,i=ie){const{heading:r,tilt:a}=this._getPreservingHeadingTilt(),s=B(this.view,r,a,e,t,V.ADJUST);return null==s?null:(i.copyFrom(this.view.state.camera),i.eye=s.eye,i.center=s.center,i.up=s.up,i)}_centerToCamera(e){let t;if(e.hasZ)t=this.view.state.camera.distance;else{const{centerOnContent:e}=this.view.pointsOfInterest;e.runTask(),t=e.distance}return this._centerPointAtDistanceToCamera(e,t)}_extentToCamera(e){const{heading:t,tilt:i}=this._getPreservingHeadingTilt(),r=N(this.view,e,t,i,V.ADJUST,te);return r?z(this.view,r):null}_scaleToCamera(e){if(null==e)return null;const t=this.view,i=t.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,a=t.pointsOfInterest.cameraOnSurface.renderLocation,s=D(t,e,t.state.contentCamera,r,a);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(G(this.view,e))}_viewpointToCamera(e){return z(this.view,F(this.view,e))}setStateCamera(e,t){return!(null==e||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,t.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera((i=>{t.positionAndOrientationOnly?(i.eye=e.eye,i.center=e.center,i.up=e.up,i.fov=e.fov):i.copyFrom(e),t.applyConstraints&&P(this.view,i)})),t.applyConstraints||(this.view.state.cameraController=new I({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:t}=this.view;if(!e||!t)return;this._windowDevicePixelRatio=window.devicePixelRatio;const i=this._computeCanvasSize();if(0!==i.width&&0!==i.height&&(t.width===i.width&&t.height===i.height||(t.width=i.width,t.height=i.height),this.view.state)){const e=this.view.state.camera;e.fullWidth===i.width&&e.fullHeight===i.height&&e.pixelRatio===i.pixelRatio||(ie.copyFrom(e),ie.pixelRatio!==i.pixelRatio&&(this._paddingToArray(this.padding,i.pixelRatio,re),ie.padding=re),ie.fullWidth=i.width,ie.fullHeight=i.height,ie.pixelRatio=i.pixelRatio,this.view.state.camera=ie),this._updateViewState()}}_updateElevation(e){const t=this.view.basemapTerrain?.spatialReference,i=this.view.renderCoordsHelper?.getAltitude(e.eye)??0,r=t?O(this.view,e.eye):0;e.relativeElevation=i-r}_updateViewState(){null!=this.test.renderState?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=K.ANIMATING:this.view.interacting?this.view.state.mode=K.INTERACTING:(this.view.state.mode===K.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<this._idleTimeout?this.view.state.mode=K.INTERACTING:this.view.state.mode=K.IDLE),this.view.state.rasterPixelRatio=this._rasterPixelRatio}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateViewState())}};e([m({type:t,dependsOn:["view.state.camera","ready"]})],Q.prototype,"camera",null),e([m({type:t,dependsOn:["view.state.contentCamera","ready"]})],Q.prototype,"contentCamera",null),e([m({type:_})],Q.prototype,"center",null),e([m()],Q.prototype,"visibleArea",null),e([m({type:y})],Q.prototype,"extent",null),e([m({readOnly:!0})],Q.prototype,"frustum",null),e([m()],Q.prototype,"_constraintsManager",void 0),e([m({readOnly:!0})],Q.prototype,"constraintsManager",null),e([m()],Q.prototype,"_initialViewpoint",null),e([m({readOnly:!0})],Q.prototype,"hasInitialView",null),e([m({readOnly:!0,type:Boolean})],Q.prototype,"ready",void 0),e([m({type:Number})],Q.prototype,"scale",null),e([m()],Q.prototype,"padding",null),e([m({readOnly:!0})],Q.prototype,"screenCenter",null),e([m({constructOnly:!0})],Q.prototype,"view",void 0),e([m({type:i})],Q.prototype,"viewpoint",null),e([m({type:Number})],Q.prototype,"zoom",null),e([m({readOnly:!0})],Q.prototype,"_rasterPixelRatio",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRendering",null),e([m({readOnly:!0})],Q.prototype,"_usePhysicalPixelRenderingAny",null),e([m()],Q.prototype,"_windowDevicePixelRatio",void 0),e([m()],Q.prototype,"_devicePixelRatioOverride",void 0),Q=e([d("esri.views.3d.state.ViewStateManager")],Q);class X{constructor(){this.width=0,this.height=0,this.pixelRatio=1}}const Y=new Set(["camera","viewpoint","extent","scale","center","zoom"]),$=[{propertyName:"camera",overrides:["viewpoint"]},{propertyName:"viewpoint",overrides:["extent"]},{propertyName:"extent",overrides:["center","scale"]},{propertyName:"center",overrides:[]},{propertyName:"scale",overrides:["zoom"]},{propertyName:"zoom",overrides:[]},{propertyName:"padding",overrides:[]}],ee={heading:0,tilt:0},te=new t,ie=new k,re=g(),ae="pending-initial-view",se="content-camera-reset",ne=300,oe=100;export{Q as ViewStateManager,oe as interactingTimeout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Camera.js";import{Cyclical as t}from"../../../core/Cyclical.js";import n from"../../../core/Logger.js";import{rad2deg as r,deg2rad as i,asinClamped as o}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{c,j as l,F as s,g as u,f,l as m}from"../../../chunks/vec32.js";import{create as p,clone as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import y from"../../../geometry/Point.js";import{projectWithZConversion as g,project as v}from"../../../geometry/projection.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as R,projectPointToVector as T}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as x,projectVectorToPoint as S}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{ViewingMode as j}from"../../ViewingMode.js";import{cameraOnContentAlongViewDirection as z}from"../camera/intersectionUtils.js";import{c as C}from"../../../chunks/cameraUtilsPlanar.js";import{c as A}from"../../../chunks/cameraUtilsSpherical.js";import{getGreatCircleSpanAt as b}from"./earthUtils.js";import{getElevationAtPoint as U}from"./ElevationProvider.js";import{isSpatialReferenceSupported as D}from"../../support/spatialReferenceSupport.js";const L=()=>n.getLogger("esri.views.3d.support.cameraUtils"),P=96*39.37,E=1,G=8,H=5,F=1,J={heading:0,tilt:0},O=p(),q=new t(-20037508.342788905,20037508.342788905),I=new t(-180,180);var k;function V(e){return e.spatialReference??w.WGS84}function X({state:e}){return e.isGlobal?A:C}function K(e,t,n,r,i){return X(e).headingTiltToDirectionUp(t,n,r,i)}function W(e,t){if(null==t)return null;const n=e.renderSpatialReference,r=X(e).headingTiltToDirectionUp,o=p();if(!T(t.position,o,n))return null;const a=r(o,t.heading,t.tilt);u(a.direction,a.direction,e.state.camera.distance),f(a.direction,a.direction,o);const c=z(e,o,a.direction,a.up);return c.fov=i(t.fov),c.row=t.layout.row,c.rows=t.layout.rows,c.column=t.layout.column,c.columns=t.layout.columns,c}!function(e){e[e.LOCKED=0]="LOCKED",e[e.ADJUST=1]="ADJUST"}(k||(k={}));const Y=p();function N(t,n,i){const o=t.renderSpatialReference,a=le(t,n.eye,n.viewForward,n.up,J);let c=V(t);return M(n.eye,o,Y,c)||(c=w.WGS84,M(n.eye,o,Y,c)),null==i?i=new e(new y(Y,c),a.heading,a.tilt,r(n.fov)):(i.position.x=Y[0],i.position.y=Y[1],i.position.z=Y[2],i.position.spatialReference=c,i.heading=a.heading,i.tilt=a.tilt,i.fov=r(n.fov)),i.layout.row=n.row,i.layout.rows=n.rows,i.layout.column=n.column,i.layout.columns=n.columns,i}function Z(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper;t/=r;return n.width/2/n.pixelRatio/(P/t)/Math.tan(n.fovX/2)}function B(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper,i=t*Math.tan(n.fovX/2),o=n.width/2/n.pixelRatio;return P/(o/i)*r}function Q(e,t,n,r){const i=r.levelAtScale(t),o=_(le(e,n.eye,n.viewForward,n.up).tilt),a=Math.max(i-o,0);return r.scaleAtLevel(a)}function $(e,t,n){const r=n.levelAtScale(e),i=_(t);return n.scaleAtLevel(r+i)}function _(e){return 2*((e>90?180-e:e)/90)**2}function ee(e,t,n=0){const r=e.basemapTerrain?.tilingScheme;if(!r)return 0;const i=h(e.spatialReference).radius,o=e.state.viewingMode===j.Local?t.eye[2]:m(t.eye)-i;return Q(e,B(e,Math.abs(o-n)),t,r)}function te(e,t,n=0){const r=W(e,t);return r?ee(e,r,n):0}const ne=1,re=100;function ie(e,t,n,a,c){if(0===t)return 0;const s=l(n.eye,a),u=e.basemapTerrain?.tilingScheme;if(!u)return L().error("#scaleToTargetDistance()","Cannot compute distance from scale without a tiling scheme"),s;let f=s;const p=le(e,n.eye,n.viewForward,n.up),d=p.tilt>90;if(e.state.isLocal){const r=(Z(e,$(t,p.tilt,u))-Math.abs(n.eye[2]-c[2]))/Math.cos(i(p.tilt));return f=d?f-r:f+r,f}let y=1/0,g=0,v=pe(e,p.heading,p.tilt,a,s,k.ADJUST);if(!v)return f;const w=m(c);for(;y>ne&&g<re;){const c=m(v.eye),s=d?180-v.tilt:v.tilt,R=i(s),T=Math.sin(R)*c,x=Math.cos(R)*c,S=Z(e,$(t,v.tilt,u)),M=d?w-S:w+S,j=o(T/M),z=Math.cos(j)*M-x,C=l(v.eye,a);f=d?C-z:C+z,v=pe(e,p.heading,p.tilt,a,f,k.ADJUST);const A=Ee(e,v,r(n.fov));if(!v||!A)return f;const b=te(e,A,w-h(e.spatialReference).radius);y=Math.abs(t-b),++g}return f}async function oe(e,t,n,r,i,o){return ce(e,t,Z(e,n),r,i,o)}function ae(e,t,n,r,i,o){return Ee(e,pe(e,r.heading,r.tilt,t,n,i),r.fov,o)}async function ce(e,t,n,r,i,o){const c=await de(e,r.heading,r.tilt,t,n,i,o);return a(o),Ge(e,c,r.fov,o)}function le(e,t,n,r,i){return X(e).directionToHeadingTilt(t,n,r,i)}function se(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,O,e.spatialReference)&&e.elevationProvider&&(U(e.elevationProvider,O)??0)>O[2]-F)}async function ue(e,t,n){if(se(e,t))return!0;const{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(null==r||!o.fromRenderCoords(t,O,i))return!1;const[c,l,s]=O,u=await r.queryElevation(c,l,s,i,"ground",n)??0;return a(n),u>s-F}async function fe(e,t,n){const r=p();if(null==t)return c(r,e.state.camera.center);if(t instanceof y){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:c}=e,l=t.spatialReference;if(await R(t,r,i,0,{signal:n}),a(n),null==t.z&&null!=o&&null!=c){const i=await c.queryElevation(t.x,t.y,t.z??0,l,"ground",n);a(n),null!=i&&e.renderCoordsHelper.setAltitude(r,i)}return r}return c(r,t)}function me(e,t){const n=p();if(null==t)return c(n,e.state.camera.center);if(t instanceof y){if(!T(t,n,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:i}=e;if(null==t.z&&null!=r&&null!=i){const r=U(i,t);null!=r&&e.renderCoordsHelper.setAltitude(n,r)}return n}return c(n,t)}function pe(e,t,n,r,i,o){return he(e,t,n,r instanceof y?r:null,me(e,r),i,o)}async function de(e,t,n,r,i,o,c){const l=r instanceof y?r:null,s=await fe(e,r,c);return a(c),ye(e,t,n,l,s,i,o,c)}function he(e,t,n,r,i,o,a){if(null==i)return null;if(!r&&(r=new y({spatialReference:V(e)}),!S(i,e.renderSpatialReference,r)))return null;const c=ge(e,t,n,i,o,a);if(ve(e,n,a)&&se(e,c.eye)){const{tilt:a,mode:c}=we(e,n,i,o);return he(e,t,a,r,i,o,c)}return Re(c,i)}async function ye(e,t,n,r,i,o,c,l){r||(r=new y({spatialReference:V(e)}),await x(i,e.renderSpatialReference,r,{signal:l})||(r=null)),a(l);const s=ge(e,t,n,i,o,c);if(ve(e,n,c)&&await ue(e,s.eye,l)){a(l);const{tilt:c,mode:s}=we(e,n,i,o);return ye(e,t,c,r,i,o,s,l)}return Re(s,i)}function ge(e,t,n,r,i,o){const a=Ae(e,t,n,r,i=Math.max(i,e.state.constraints.minimumPoiDistance),o);return(0,X(e).eyeForCenterWithHeadingTilt)(r,i,a.heading,a.tilt)}function ve(e,t,n){const r=e.map.ground.navigationConstraint;return n===k.ADJUST&&e.state.isGlobal&&t>0&&(null==r||"stay-above"===r.type)}function we(e,t,n,r){const i=Le(e,n,r,De(e,r,t,n));return{tilt:i,mode:t-i<1?k.LOCKED:k.ADJUST}}function Re(e,t){return{...e,center:d(t)}}function Te(e,t){const{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&D(i,j.Global)||n.isLocal&&r.equals(i)}function xe(e,t){let n,r,i;if(e.state.isGlobal){const e=new y(t.xmin,t.ymin,t.spatialReference),o=new y(t.xmax,t.ymax,t.spatialReference),a=t.spatialReference.isGeographic?I:q;n=new y({x:a.center(e.x,o.x),y:(o.y+e.y)/2,z:null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});const c=h(t.spatialReference),l=b(n,e,o);r=l.lon,i=l.lat,a.diff(e.x,o.x)>a.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),i=Math.min(i,c.halfCircumference)}else{const o=e.renderSpatialReference??t.spatialReference;o.equals(t.spatialReference)||(t=v(t,o)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;const a=null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0;n=new y({x:t.xmin+.5*r,y:t.ymin+.5*i,z:a,spatialReference:o})}const o=null!=t.zmax&&null!=t.zmin?t.zmax-t.zmin:0,a=e.state.camera,c=1/Math.tan(a.fovX/2),l=1/Math.tan(a.fovY/2),s=1/Math.tan(a.fov/2);return{center:n,distance:Math.max(.5*r*c,.5*i*l,.5*o*s)/E}}async function Se(e,t,n,r,i,o){const c=Te(e,t)?t:await g(t,e.spatialReference,{signal:o});a(o);const{center:l,distance:s}=xe(e,c),u=await de(e,n,r,l,s,i,o);return a(o),Ge(e,u,e.camera.fov,o)}function Me(e,t,n,r,i,o){let a;try{a=Te(e,t)?t:v(t,e.spatialReference)}catch(u){return null}const{center:c,distance:l}=xe(e,a),s=pe(e,n,r,c,l,i);return null==s?null:Ee(e,s,e.camera.fov,o)}function je(e,t,n){const r=e.renderSpatialReference,i=new y({spatialReference:V(e)});if(!S(n,r,i))return null;const o=Math.tan(t.fovX/2),a=Math.tan(t.fovY/2),c=s(t.eye,n),l=2*c*o*E,u=2*c*a*E;return X(e).toExtent(e,i,l,u)}function ze(e,t){return X(e).toArea(e,t)}function Ce(e,t,n){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>G)return!0;const i=t,o=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return l(i,o)/(Math.tan(.5*e.state.camera.fov)*r)>H}function Ae(e,t,n,r,i,o){let a=0;return o===k.ADJUST&&Ce(e,r,i)?(t=0,a=Ue(e,i,n,r)):a=Pe(e,r,i,n),a=e.state.constraints.clampTilt(i,a),{heading:t,tilt:n=Le(e,r,i,a)}}const be=.7;function Ue(e,t,n,r){const i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);o.max=Math.min(o.max,.5*Math.PI);const a=o.min*(1-be)+o.max*be;return Math.min(i,a)}function De(e,t,n,r){let i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);return i=Math.min(i,.5*Math.PI),o.min*(1-be)+i*be}function Le(e,t,n,r){return X(e).lookAtTiltToEyeTilt(r,t,n)}function Pe(e,t,n,r){return X(e).eyeTiltToLookAtTilt(r,t,n)}function Ee(t,n,r,i){if(null==n)return null;const o=t.renderSpatialReference,a=new y({spatialReference:V(t)});return S(n.eye,o,a)?(i??=new e,i.position=a,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function Ge(t,n,r,i){const o=t.renderSpatialReference,c=new y({spatialReference:V(t)});return await x(n.eye,o,c,{signal:i}),a(i),new e(c,n.heading,n.tilt,r)}function He(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.levelAtScale(t);L().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function Fe(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.scaleAtLevel(t);L().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}export{k as OrientationMode,Q as applyTiltAdjustToScale,le as directionToHeadingTilt,B as distanceToScale,W as externalToInternal,ce as fromCenterDistanceAsync,ae as fromCenterDistanceSync,oe as fromCenterScale,Se as fromExtentAsync,Me as fromExtentSync,de as getObserverForPointAtDistanceAsync,pe as getObserverForPointAtDistanceSync,V as getViewSR,K as headingTiltToDirectionUp,N as internalToExternal,$ as removeTiltAdjustFromScale,ne as scaleErrorThreshold,Z as scaleToDistance,He as scaleToZoom,ze as toArea,je as toExtent,ie as viewScaleToCameraDistance,Fe as zoomToScale};
|
|
5
|
+
import e from"../../../Camera.js";import{Cyclical as t}from"../../../core/Cyclical.js";import n from"../../../core/Logger.js";import{rad2deg as r,deg2rad as i,asinClamped as o}from"../../../core/mathUtils.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{c,j as l,F as s,g as u,f,l as m}from"../../../chunks/vec32.js";import{create as p,clone as d}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import y from"../../../geometry/Point.js";import{projectWithZConversion as g,project as v}from"../../../geometry/projectionUtils.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVectorAsync as R,projectPointToVector as T}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPointAsync as x,projectVectorToPoint as S}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{ViewingMode as j}from"../../ViewingMode.js";import{cameraOnContentAlongViewDirection as z}from"../camera/intersectionUtils.js";import{c as C}from"../../../chunks/cameraUtilsPlanar.js";import{c as A}from"../../../chunks/cameraUtilsSpherical.js";import{getGreatCircleSpanAt as U}from"./earthUtils.js";import{getElevationAtPoint as b}from"./ElevationProvider.js";import{isSpatialReferenceSupported as D}from"../../support/spatialReferenceSupport.js";const L=()=>n.getLogger("esri.views.3d.support.cameraUtils"),P=96*39.37,E=1,G=8,H=5,F=1,J={heading:0,tilt:0},O=p(),q=new t(-20037508.342788905,20037508.342788905),I=new t(-180,180);var k;function V(e){return e.spatialReference??w.WGS84}function X({state:e}){return e.isGlobal?A:C}function K(e,t,n,r,i){return X(e).headingTiltToDirectionUp(t,n,r,i)}function W(e,t){if(null==t)return null;const n=e.renderSpatialReference,r=X(e).headingTiltToDirectionUp,o=p();if(!T(t.position,o,n))return null;const a=r(o,t.heading,t.tilt);u(a.direction,a.direction,e.state.camera.distance),f(a.direction,a.direction,o);const c=z(e,o,a.direction,a.up);return c.fov=i(t.fov),c.row=t.layout.row,c.rows=t.layout.rows,c.column=t.layout.column,c.columns=t.layout.columns,c}!function(e){e[e.LOCKED=0]="LOCKED",e[e.ADJUST=1]="ADJUST"}(k||(k={}));const Y=p();function N(t,n,i){const o=t.renderSpatialReference,a=le(t,n.eye,n.viewForward,n.up,J);let c=V(t);return M(n.eye,o,Y,c)||(c=w.WGS84,M(n.eye,o,Y,c)),null==i?i=new e(new y(Y,c),a.heading,a.tilt,r(n.fov)):(i.position.x=Y[0],i.position.y=Y[1],i.position.z=Y[2],i.position.spatialReference=c,i.heading=a.heading,i.tilt=a.tilt,i.fov=r(n.fov)),i.layout.row=n.row,i.layout.rows=n.rows,i.layout.column=n.column,i.layout.columns=n.columns,i}function Z(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper;t/=r;return n.width/2/n.pixelRatio/(P/t)/Math.tan(n.fovX/2)}function B(e,t){const{camera:n}=e.state,{unitInMeters:r}=e.renderCoordsHelper,i=t*Math.tan(n.fovX/2),o=n.width/2/n.pixelRatio;return P/(o/i)*r}function Q(e,t,n,r){const i=r.levelAtScale(t),o=_(le(e,n.eye,n.viewForward,n.up).tilt),a=Math.max(i-o,0);return r.scaleAtLevel(a)}function $(e,t,n){const r=n.levelAtScale(e),i=_(t);return n.scaleAtLevel(r+i)}function _(e){return 2*((e>90?180-e:e)/90)**2}function ee(e,t,n=0){const r=e.basemapTerrain?.tilingScheme;if(!r)return 0;const i=h(e.spatialReference).radius,o=e.state.viewingMode===j.Local?t.eye[2]:m(t.eye)-i;return Q(e,B(e,Math.abs(o-n)),t,r)}function te(e,t,n=0){const r=W(e,t);return r?ee(e,r,n):0}const ne=1,re=100;function ie(e,t,n,a,c){if(0===t)return 0;const s=l(n.eye,a),u=e.basemapTerrain?.tilingScheme;if(!u)return L().error("#scaleToTargetDistance()","Cannot compute distance from scale without a tiling scheme"),s;let f=s;const p=le(e,n.eye,n.viewForward,n.up),d=p.tilt>90;if(e.state.isLocal){const r=(Z(e,$(t,p.tilt,u))-Math.abs(n.eye[2]-c[2]))/Math.cos(i(p.tilt));return f=d?f-r:f+r,f}let y=1/0,g=0,v=pe(e,p.heading,p.tilt,a,s,k.ADJUST);if(!v)return f;const w=m(c);for(;y>ne&&g<re;){const c=m(v.eye),s=d?180-v.tilt:v.tilt,R=i(s),T=Math.sin(R)*c,x=Math.cos(R)*c,S=Z(e,$(t,v.tilt,u)),M=d?w-S:w+S,j=o(T/M),z=Math.cos(j)*M-x,C=l(v.eye,a);f=d?C-z:C+z,v=pe(e,p.heading,p.tilt,a,f,k.ADJUST);const A=Ee(e,v,r(n.fov));if(!v||!A)return f;const U=te(e,A,w-h(e.spatialReference).radius);y=Math.abs(t-U),++g}return f}async function oe(e,t,n,r,i,o){return ce(e,t,Z(e,n),r,i,o)}function ae(e,t,n,r,i,o){return Ee(e,pe(e,r.heading,r.tilt,t,n,i),r.fov,o)}async function ce(e,t,n,r,i,o){const c=await de(e,r.heading,r.tilt,t,n,i,o);return a(o),Ge(e,c,r.fov,o)}function le(e,t,n,r,i){return X(e).directionToHeadingTilt(t,n,r,i)}function se(e,t){return!!(e.basemapTerrain&&e.renderCoordsHelper.fromRenderCoords(t,O,e.spatialReference)&&e.elevationProvider&&(b(e.elevationProvider,O)??0)>O[2]-F)}async function ue(e,t,n){if(se(e,t))return!0;const{elevationProvider:r,spatialReference:i,renderCoordsHelper:o}=e;if(null==r||!o.fromRenderCoords(t,O,i))return!1;const[c,l,s]=O,u=await r.queryElevation(c,l,s,i,"ground",n)??0;return a(n),u>s-F}async function fe(e,t,n){const r=p();if(null==t)return c(r,e.state.camera.center);if(t instanceof y){const{renderSpatialReference:i,basemapTerrain:o,elevationProvider:c}=e,l=t.spatialReference;if(await R(t,r,i,0,{signal:n}),a(n),null==t.z&&null!=o&&null!=c){const i=await c.queryElevation(t.x,t.y,t.z??0,l,"ground",n);a(n),null!=i&&e.renderCoordsHelper.setAltitude(r,i)}return r}return c(r,t)}function me(e,t){const n=p();if(null==t)return c(n,e.state.camera.center);if(t instanceof y){if(!T(t,n,e.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:i}=e;if(null==t.z&&null!=r&&null!=i){const r=b(i,t);null!=r&&e.renderCoordsHelper.setAltitude(n,r)}return n}return c(n,t)}function pe(e,t,n,r,i,o){return he(e,t,n,r instanceof y?r:null,me(e,r),i,o)}async function de(e,t,n,r,i,o,c){const l=r instanceof y?r:null,s=await fe(e,r,c);return a(c),ye(e,t,n,l,s,i,o,c)}function he(e,t,n,r,i,o,a){if(null==i)return null;if(!r&&(r=new y({spatialReference:V(e)}),!S(i,e.renderSpatialReference,r)))return null;const c=ge(e,t,n,i,o,a);if(ve(e,n,a)&&se(e,c.eye)){const{tilt:a,mode:c}=we(e,n,i,o);return he(e,t,a,r,i,o,c)}return Re(c,i)}async function ye(e,t,n,r,i,o,c,l){r||(r=new y({spatialReference:V(e)}),await x(i,e.renderSpatialReference,r,{signal:l})||(r=null)),a(l);const s=ge(e,t,n,i,o,c);if(ve(e,n,c)&&await ue(e,s.eye,l)){a(l);const{tilt:c,mode:s}=we(e,n,i,o);return ye(e,t,c,r,i,o,s,l)}return Re(s,i)}function ge(e,t,n,r,i,o){const a=Ae(e,t,n,r,i=Math.max(i,e.state.constraints.minimumPoiDistance),o);return(0,X(e).eyeForCenterWithHeadingTilt)(r,i,a.heading,a.tilt)}function ve(e,t,n){const r=e.map.ground.navigationConstraint;return n===k.ADJUST&&e.state.isGlobal&&t>0&&(null==r||"stay-above"===r.type)}function we(e,t,n,r){const i=Le(e,n,r,De(e,r,t,n));return{tilt:i,mode:t-i<1?k.LOCKED:k.ADJUST}}function Re(e,t){return{...e,center:d(t)}}function Te(e,t){const{state:n,spatialReference:r}=e,i=t.spatialReference;return n.isGlobal&&D(i,j.Global)||n.isLocal&&r.equals(i)}function xe(e,t){let n,r,i;if(e.state.isGlobal){const e=new y(t.xmin,t.ymin,t.spatialReference),o=new y(t.xmax,t.ymax,t.spatialReference),a=t.spatialReference.isGeographic?I:q;n=new y({x:a.center(e.x,o.x),y:(o.y+e.y)/2,z:null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0,spatialReference:t.spatialReference});const c=h(t.spatialReference),l=U(n,e,o);r=l.lon,i=l.lat,a.diff(e.x,o.x)>a.range/2&&(r+=c.halfCircumference),r=Math.min(r,c.halfCircumference),i=Math.min(i,c.halfCircumference)}else{const o=e.renderSpatialReference??t.spatialReference;o.equals(t.spatialReference)||(t=v(t,o)),r=t.xmax-t.xmin,i=t.ymax-t.ymin;const a=null!=t.zmax&&null!=t.zmin?(t.zmax+t.zmin)/2:void 0;n=new y({x:t.xmin+.5*r,y:t.ymin+.5*i,z:a,spatialReference:o})}const o=null!=t.zmax&&null!=t.zmin?t.zmax-t.zmin:0,a=e.state.camera,c=1/Math.tan(a.fovX/2),l=1/Math.tan(a.fovY/2),s=1/Math.tan(a.fov/2);return{center:n,distance:Math.max(.5*r*c,.5*i*l,.5*o*s)/E}}async function Se(e,t,n,r,i,o){const c=Te(e,t)?t:await g(t,e.spatialReference,{signal:o});a(o);const{center:l,distance:s}=xe(e,c),u=await de(e,n,r,l,s,i,o);return a(o),Ge(e,u,e.camera.fov,o)}function Me(e,t,n,r,i,o){let a;try{a=Te(e,t)?t:v(t,e.spatialReference)}catch(u){return null}const{center:c,distance:l}=xe(e,a),s=pe(e,n,r,c,l,i);return null==s?null:Ee(e,s,e.camera.fov,o)}function je(e,t,n){const r=e.renderSpatialReference,i=new y({spatialReference:V(e)});if(!S(n,r,i))return null;const o=Math.tan(t.fovX/2),a=Math.tan(t.fovY/2),c=s(t.eye,n),l=2*c*o*E,u=2*c*a*E;return X(e).toExtent(e,i,l,u)}function ze(e,t){return X(e).toArea(e,t)}function Ce(e,t,n){const r=e.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(n/r)/Math.LN2>G)return!0;const i=t,o=e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation;return l(i,o)/(Math.tan(.5*e.state.camera.fov)*r)>H}function Ae(e,t,n,r,i,o){let a=0;return o===k.ADJUST&&Ce(e,r,i)?(t=0,a=be(e,i,n,r)):a=Pe(e,r,i,n),a=e.state.constraints.clampTilt(i,a),{heading:t,tilt:n=Le(e,r,i,a)}}const Ue=.7;function be(e,t,n,r){const i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);o.max=Math.min(o.max,.5*Math.PI);const a=o.min*(1-Ue)+o.max*Ue;return Math.min(i,a)}function De(e,t,n,r){let i=Pe(e,r,t,n);if(!e.state.constraints.tilt)return i;const o=e.state.constraints.tilt(t);return i=Math.min(i,.5*Math.PI),o.min*(1-Ue)+i*Ue}function Le(e,t,n,r){return X(e).lookAtTiltToEyeTilt(r,t,n)}function Pe(e,t,n,r){return X(e).eyeTiltToLookAtTilt(r,t,n)}function Ee(t,n,r,i){if(null==n)return null;const o=t.renderSpatialReference,a=new y({spatialReference:V(t)});return S(n.eye,o,a)?(i??=new e,i.position=a,i.heading=n.heading,i.tilt=n.tilt,i.fov=r,i):null}async function Ge(t,n,r,i){const o=t.renderSpatialReference,c=new y({spatialReference:V(t)});return await x(n.eye,o,c,{signal:i}),a(i),new e(c,n.heading,n.tilt,r)}function He(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.levelAtScale(t);L().error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function Fe(e,t){const n=e.basemapTerrain?.tilingScheme;if(n)return n.scaleAtLevel(t);L().error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}export{k as OrientationMode,Q as applyTiltAdjustToScale,le as directionToHeadingTilt,B as distanceToScale,W as externalToInternal,ce as fromCenterDistanceAsync,ae as fromCenterDistanceSync,oe as fromCenterScale,Se as fromExtentAsync,Me as fromExtentSync,de as getObserverForPointAtDistanceAsync,pe as getObserverForPointAtDistanceSync,V as getViewSR,K as headingTiltToDirectionUp,N as internalToExternal,$ as removeTiltAdjustFromScale,ne as scaleErrorThreshold,Z as scaleToDistance,He as scaleToZoom,ze as toArea,je as toExtent,ie as viewScaleToCameraDistance,Fe as zoomToScale};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../Camera.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as r}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as u,f,j as p,c as g,d as y,i as h,o as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import x from"../../../geometry/Extent.js";import j from"../../../geometry/Geometry.js";import v from"../../../geometry/Multipoint.js";import b from"../../../geometry/Point.js";import{projectWithZConversion as R,tryProjectWithZConversion as z}from"../../../geometry/projection.js";import G from"../../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as S}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as B}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as T}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{create as Z,center as A,toRect as E,isPoint as F,empty as O,expandWithVec3 as P,expandWithAABB as D,width as U,height as V,depth as C}from"../../../geometry/support/aaBoundingBox.js";import{create as k,isPoint as I}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as J}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as K}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as L}from"../camera/intersectionUtils.js";import{getViewSR as N,fromExtentAsync as W,internalToExternal as Y,OrientationMode as q,scaleToDistance as X,fromCenterDistanceAsync as _,fromExtentSync as H,externalToInternal as Q,distanceToScale as $,fromCenterDistanceSync as tt,fromCenterScale as et,directionToHeadingTilt as nt,zoomToScale as at}from"./cameraUtils.js";import{getElevationAtPoint as rt}from"./ElevationProvider.js";const ot=.66;function it(t){return 360-r.normalize(t)}function st(t){return r.normalize(360-t)}function ct(t,e,n){const a=e.camera;if(null!=a)return mt(a,N(t));const{targetGeometry:r}=e;if(null==r)return null;const{camera:o,mode:i}=ft(t,e.rotation,n);if("point"===r.type)return pt(t,e,r,o,i);const s=r.extent;return null==s?null:H(t,s,o.heading,o.tilt,i)}async function lt(t,e,n,a){const r=e.camera;if(null!=r)return ut(r,N(t),a);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=ft(t,e.rotation,n);if("point"===o.type)return gt(t,e,o,i,s,a);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return W(t,c,i.heading,i.tilt,s,a)}function mt(t,e){const n=t.position;let a;try{a=z(n,e)}catch(o){return null}if(!a)return null;const r=t.clone();return r.position=a.clone(),r}async function ut(t,e,n){const a=t.position,r=await R(a,e,{signal:n});i(n);const o=t.clone();return o.position=r.clone(),o}function ft(t,e,n){const a=Y(t,t.state.camera);let r=q.ADJUST;return null!=e&&(a.heading=it(e),r=q.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:r}}function pt(t,e,n,a,r){const o=t.spatialReference;let i;try{i=z(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?X(t,e.scale):t.state.camera.distance;return tt(t,i,s,a,r)}async function gt(t,e,n,a,r,o){const s=t.spatialReference,c=await R(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?X(t,e.scale):t.state.camera.distance;return _(t,c,l,a,r,o)}function yt(t,e,a=null){return null==a&&(a=new n),jt(t,null,e.clone(),a)}async function ht(e,a,r){const i=Ft(e,a);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Ot(await zt(e,i.target,i,r,c))}if(i.target instanceof t)return Ot(await Gt(e,i.target,r,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof x){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Ot(l||t?await Bt(e,i,i.target.center,s,r,c):await Zt(e,i,i.target,s,r,c))}const m=new Dt,u=l?wt(e,i):void 0;if(await Rt(e,i.target,u,m,r),isFinite(m.boundingBox[0])){let t;if(A(m.boundingBox,Ut),Wt.x=Ut[0],Wt.y=Ut[1],Wt.z=Ut[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=F(m.boundingBox):(Wt.z=void 0,t=I(E(m.boundingBox,It))),l||t)return Ot(await Bt(e,i,Wt,s,r,c));const n=Pt(e,m.screenSpaceObjects);return Ot(await Et(e,i,Wt,m.boundingBox,n,s,r,c))}return i.position?Ot(await Tt(e,i,s,c,r)):Ot(await Mt(e,i,s,r,c))}function dt(t,e){return null==e.scale&&null!=e.zoom?at(t,e.zoom):e.scale}function wt(t,e){const n=dt(t,e);return n?K(n):void 0}function xt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=it(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function jt(t,e,n,a){const r=t.spatialReference||G.WGS84;if(e??=Q(t,n),null==e)return a;const o=new b({spatialReference:r});return T(e.center,t.renderSpatialReference,o)?(a.targetGeometry=o,a.scale=$(t,e.distance),a.rotation=st(n.heading),a.camera=n,a):a}async function vt(t,e,n,a){const r=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw r();"mesh"===e.type&&(e=e.extent);const i=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&i&&t.elevationProvider?(n=await R(n,i,{signal:a}),Ut[2]=rt(t.elevationProvider,n)??0):Ut[2]=0}const s=Yt[e.type],c=new Array;if(s(e,e.hasZ?t=>{c.push([t[0],t[1],t[2]])}:t=>{c.push([t[0],t[1]])},Ut),0===c.length)throw r();const l=e.spatialReference,m=t.spatialReference,u=await R(new v({spatialReference:l,hasZ:e.hasZ,hasM:!1,points:c}),m,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Ut[0]=o,Ut[1]=f,Ut[2]=p,P(n.boundingBox,Ut);else for(const[o,f]of u.points)Ut[0]=o,Ut[1]=f,P(n.boundingBox,Ut)}async function bt(t,e,n,r,o){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await vt(t,e.geometry,r,o);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await vt(t,e.geometry,r,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;D(r.boundingBox,m),l&&l.forEach((t=>{r.screenSpaceObjects.push(t)})),isFinite(m[2])&&(r.hasZ=!0)}async function Rt(t,n,a,r,o){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:G.WGS84,void await vt(t,Wt,r,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>Rt(t,e,a,r,o)))):n instanceof j?await vt(t,n,r,o):n instanceof e&&await bt(t,n,a,r,o)}async function zt(t,e,n,a,r){if(e.camera)return Gt(t,e.camera,a,r);r.scale=e.scale,r.rotation=e.rotation,r.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,r.camera=null,null!=n.heading?r.rotation=st(n.heading):null!=n.rotation&&(r.rotation=n.rotation);const o=dt(t,n);return null!=o&&(r.scale=o),r.camera=await lt(t,r,n.tilt,a),r}async function Gt(t,e,n,a){const r=t.spatialReference,o=await R(e.position,r,{signal:n}),i=e.clone();return i.position=o,jt(t,null,i,a)}async function St(t,e,n,a,r,o,i){const s=t.renderSpatialReference;return await B(e,Lt,s,0,{signal:i}),await B(n,Kt,s,0,{signal:i}),o.targetGeometry=new b(e),r.position=new b(n),y(Jt,Lt,Kt),nt(t,Kt,Jt,a.up,r),o.scale=$(t,p(Kt,Lt)),o.rotation=st(r.heading),o.camera=r,o}async function Bt(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=L(t);if(e.position)return St(t,o.targetGeometry,e.position,i,a,o,r);if(e.zoomFactor){const n=i.distance/e.zoomFactor,a=u(Ut,i.viewForward,-n);i.eye=f(Ut,i.center,a),o.scale=$(t,n)}Y(t,i,a);const s=xt(a,e)?q.LOCKED:q.ADJUST;if(!e.zoomFactor){const n=dt(t,e);if(null==n){await B(o.targetGeometry,Ut,t.renderSpatialReference,0,{signal:r});const e=J(i.frustum,Ut)?p(i.eye,Ut):i.distance;o.camera=await _(t,o.targetGeometry,e,a,s),o.scale=$(t,e)}else o.scale=n,o.camera=await et(t,o.targetGeometry,o.scale,a,s,r)}return o}async function Tt(t,e,n,a,r){const o=L(t);g(Jt,o.viewForward),nt(t,o.eye,Jt,o.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await R(s,i,{signal:r});n.position=t}else n.position=new b;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,jt(t,null,n,a)}async function Mt(t,e,n,a,r){if(null!=e.heading||null!=e.rotation||null!=e.scale||null!=e.tilt||null!=e.zoom||null!=e.zoomFactor){const o=L(t),{spatialReference:i,renderSpatialReference:s}=t,c=new b({spatialReference:i});return T(o.center,s,c)?Bt(t,e,c,n,a,r):r}return r.scale=t.scale,r.camera=t.camera.clone(),xt(r.camera,e),r}async function Zt(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=L(t);Y(t,i,a);const s=xt(a,e)?q.LOCKED:q.ADJUST;return o.camera=await W(t,n,a.heading,a.tilt,s,r),o}function At(t,e,n,a,r){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=rt(t.elevationProvider,n)),h(Ut,n.x,n.y,o),S(t.spatialReference,Ut,Vt,t.renderSpatialReference),s(Ct,Vt),c(Ct,Ct),O(kt);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=o),h(Ut,a[e[0]],a[e[1]],n),M(Ut,t.spatialReference,Ut,t.renderSpatialReference),P(kt,d(Ut,Ut,Ct))}const l=U(kt),m=V(kt),u=C(kt),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/r}async function Et(t,e,n,a,r,o,i,s){s.targetGeometry=n.clone();const c=L(t),l=At(t,c,n,a,r);Y(t,c,o);const m=xt(o,e)?q.LOCKED:q.ADJUST;return s.camera=await _(t,s.targetGeometry,l,o,m,i),s.scale=$(t,l),s}function Ft(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),!n.target&&"center"in e&&e.center&&(n.target=e.center)),n}function Ot(t){return null!=t?.camera&&(t.rotation=st(t.camera.heading)),t}function Pt(t,e){const n=ot;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let r=0;r<e.length;r++){const t=e[r].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}class Dt{constructor(){this.hasZ=!1,this.boundingBox=O(),this.screenSpaceObjects=new Array}}const Ut=w(),Vt=m(),Ct=l(),kt=Z(),It=k(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new b,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let r=0;r<t.rings.length;r++){const o=t.rings[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let r=0;r<t.paths.length;r++){const o=t.paths[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,r=t.hasZ;for(let o=0;o<a.length;o++)n[0]=a[o][0],n[1]=a[o][1],r&&(n[2]=a[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{ht as create,yt as fromCamera,lt as toCameraAsync,ct as toCameraSync};
|
|
5
|
+
import t from"../../../Camera.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as r}from"../../../core/Cyclical.js";import o from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{fromMat4 as s,transpose as c}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{g as u,f,j as p,c as g,d as y,i as h,o as d}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import x from"../../../geometry/Extent.js";import j from"../../../geometry/Geometry.js";import v from"../../../geometry/Multipoint.js";import b from"../../../geometry/Point.js";import{projectWithZConversion as R,tryProjectWithZConversion as z}from"../../../geometry/projectionUtils.js";import G from"../../../geometry/SpatialReference.js";import{computeTranslationToOriginAndRotation as S}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorAsync as B}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToPoint as T}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{create as Z,center as A,toRect as E,isPoint as F,empty as O,expandWithVec3 as P,expandWithAABB as U,width as D,height as V,depth as C}from"../../../geometry/support/aaBoundingBox.js";import{create as k,isPoint as I}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as J}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as K}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as L}from"../camera/intersectionUtils.js";import{getViewSR as N,fromExtentAsync as W,internalToExternal as Y,OrientationMode as q,scaleToDistance as X,fromCenterDistanceAsync as _,fromExtentSync as H,externalToInternal as Q,distanceToScale as $,fromCenterDistanceSync as tt,fromCenterScale as et,directionToHeadingTilt as nt,zoomToScale as at}from"./cameraUtils.js";import{getElevationAtPoint as rt}from"./ElevationProvider.js";const ot=.66;function it(t){return 360-r.normalize(t)}function st(t){return r.normalize(360-t)}function ct(t,e,n){const a=e.camera;if(null!=a)return mt(a,N(t));const{targetGeometry:r}=e;if(null==r)return null;const{camera:o,mode:i}=ft(t,e.rotation,n);if("point"===r.type)return pt(t,e,r,o,i);const s=r.extent;return null==s?null:H(t,s,o.heading,o.tilt,i)}async function lt(t,e,n,a){const r=e.camera;if(null!=r)return ut(r,N(t),a);const{targetGeometry:o}=e;if(null==o)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=ft(t,e.rotation,n);if("point"===o.type)return gt(t,e,o,i,s,a);const c=o.extent;if(null==c)throw new Error("Target geometry has no extent!");return W(t,c,i.heading,i.tilt,s,a)}function mt(t,e){const n=t.position;let a;try{a=z(n,e)}catch(o){return null}if(!a)return null;const r=t.clone();return r.position=a.clone(),r}async function ut(t,e,n){const a=t.position,r=await R(a,e,{signal:n});i(n);const o=t.clone();return o.position=r.clone(),o}function ft(t,e,n){const a=Y(t,t.state.camera);let r=q.ADJUST;return null!=e&&(a.heading=it(e),r=q.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:r}}function pt(t,e,n,a,r){const o=t.spatialReference;let i;try{i=z(n.clone(),o)}catch(c){return null}if(!i)return null;const s=null!=e.scale?X(t,e.scale):t.state.camera.distance;return tt(t,i,s,a,r)}async function gt(t,e,n,a,r,o){const s=t.spatialReference,c=await R(n.clone(),s,{signal:o});i(o);const l=null!=e.scale?X(t,e.scale):t.state.camera.distance;return _(t,c,l,a,r,o)}function yt(t,e,a=null){return null==a&&(a=new n),jt(t,null,e.clone(),a)}async function ht(e,a,r){const i=Ft(e,a);if(!i)throw new o("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Ot(await zt(e,i.target,i,r,c))}if(i.target instanceof t)return Ot(await Gt(e,i.target,r,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof x){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Ot(l||t?await Bt(e,i,i.target.center,s,r,c):await Zt(e,i,i.target,s,r,c))}const m=new Ut,u=l?wt(e,i):void 0;if(await Rt(e,i.target,u,m,r),isFinite(m.boundingBox[0])){let t;if(A(m.boundingBox,Dt),Wt.x=Dt[0],Wt.y=Dt[1],Wt.z=Dt[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=F(m.boundingBox):(Wt.z=void 0,t=I(E(m.boundingBox,It))),l||t)return Ot(await Bt(e,i,Wt,s,r,c));const n=Pt(e,m.screenSpaceObjects);return Ot(await Et(e,i,Wt,m.boundingBox,n,s,r,c))}return i.position?Ot(await Tt(e,i,s,c,r)):Ot(await Mt(e,i,s,r,c))}function dt(t,e){return null==e.scale&&null!=e.zoom?at(t,e.zoom):e.scale}function wt(t,e){const n=dt(t,e);return n?K(n):void 0}function xt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=it(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function jt(t,e,n,a){const r=t.spatialReference||G.WGS84;if(e??=Q(t,n),null==e)return a;const o=new b({spatialReference:r});return T(e.center,t.renderSpatialReference,o)?(a.targetGeometry=o,a.scale=$(t,e.distance),a.rotation=st(n.heading),a.camera=n,a):a}async function vt(t,e,n,a){const r=()=>new o("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw r();"mesh"===e.type&&(e=e.extent);const i=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&i&&t.elevationProvider?(n=await R(n,i,{signal:a}),Dt[2]=rt(t.elevationProvider,n)??0):Dt[2]=0}const s=Yt[e.type],c=new Array;if(s(e,e.hasZ?t=>{c.push([t[0],t[1],t[2]])}:t=>{c.push([t[0],t[1]])},Dt),0===c.length)throw r();const l=e.spatialReference,m=t.spatialReference,u=await R(new v({spatialReference:l,hasZ:e.hasZ,hasM:!1,points:c}),m,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[o,f,p]of u.points)Dt[0]=o,Dt[1]=f,Dt[2]=p,P(n.boundingBox,Dt);else for(const[o,f]of u.points)Dt[0]=o,Dt[1]=f,P(n.boundingBox,Dt)}async function bt(t,e,n,r,o){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await vt(t,e.geometry,r,o);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await vt(t,e.geometry,r,o);const{screenSpaceObjects:l,boundingBox:m}=c.value;U(r.boundingBox,m),l&&l.forEach((t=>{r.screenSpaceObjects.push(t)})),isFinite(m[2])&&(r.hasZ=!0)}async function Rt(t,n,a,r,o){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:G.WGS84,void await vt(t,Wt,r,o)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>Rt(t,e,a,r,o)))):n instanceof j?await vt(t,n,r,o):n instanceof e&&await bt(t,n,a,r,o)}async function zt(t,e,n,a,r){if(e.camera)return Gt(t,e.camera,a,r);r.scale=e.scale,r.rotation=e.rotation,r.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,r.camera=null,null!=n.heading?r.rotation=st(n.heading):null!=n.rotation&&(r.rotation=n.rotation);const o=dt(t,n);return null!=o&&(r.scale=o),r.camera=await lt(t,r,n.tilt,a),r}async function Gt(t,e,n,a){const r=t.spatialReference,o=await R(e.position,r,{signal:n}),i=e.clone();return i.position=o,jt(t,null,i,a)}async function St(t,e,n,a,r,o,i){const s=t.renderSpatialReference;return await B(e,Lt,s,0,{signal:i}),await B(n,Kt,s,0,{signal:i}),o.targetGeometry=new b(e),r.position=new b(n),y(Jt,Lt,Kt),nt(t,Kt,Jt,a.up,r),o.scale=$(t,p(Kt,Lt)),o.rotation=st(r.heading),o.camera=r,o}async function Bt(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=L(t);if(e.position)return St(t,o.targetGeometry,e.position,i,a,o,r);if(e.zoomFactor){const n=i.distance/e.zoomFactor,a=u(Dt,i.viewForward,-n);i.eye=f(Dt,i.center,a),o.scale=$(t,n)}Y(t,i,a);const s=xt(a,e)?q.LOCKED:q.ADJUST;if(!e.zoomFactor){const n=dt(t,e);if(null==n){await B(o.targetGeometry,Dt,t.renderSpatialReference,0,{signal:r});const e=J(i.frustum,Dt)?p(i.eye,Dt):i.distance;o.camera=await _(t,o.targetGeometry,e,a,s),o.scale=$(t,e)}else o.scale=n,o.camera=await et(t,o.targetGeometry,o.scale,a,s,r)}return o}async function Tt(t,e,n,a,r){const o=L(t);g(Jt,o.viewForward),nt(t,o.eye,Jt,o.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await R(s,i,{signal:r});n.position=t}else n.position=new b;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,jt(t,null,n,a)}async function Mt(t,e,n,a,r){if(null!=e.heading||null!=e.rotation||null!=e.scale||null!=e.tilt||null!=e.zoom||null!=e.zoomFactor){const o=L(t),{spatialReference:i,renderSpatialReference:s}=t,c=new b({spatialReference:i});return T(o.center,s,c)?Bt(t,e,c,n,a,r):r}return r.scale=t.scale,r.camera=t.camera.clone(),xt(r.camera,e),r}async function Zt(t,e,n,a,r,o){o.targetGeometry=n.clone();const i=L(t);Y(t,i,a);const s=xt(a,e)?q.LOCKED:q.ADJUST;return o.camera=await W(t,n,a.heading,a.tilt,s,r),o}function At(t,e,n,a,r){let o=0;null!=n.z?o=n.z:t.basemapTerrain&&t.elevationProvider&&(o=rt(t.elevationProvider,n)),h(Dt,n.x,n.y,o),S(t.spatialReference,Dt,Vt,t.renderSpatialReference),s(Ct,Vt),c(Ct,Ct),O(kt);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=o),h(Dt,a[e[0]],a[e[1]],n),M(Dt,t.spatialReference,Dt,t.renderSpatialReference),P(kt,d(Dt,Dt,Ct))}const l=D(kt),m=V(kt),u=C(kt),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/r}async function Et(t,e,n,a,r,o,i,s){s.targetGeometry=n.clone();const c=L(t),l=At(t,c,n,a,r);Y(t,c,o);const m=xt(o,e)?q.LOCKED:q.ADJUST;return s.camera=await _(t,s.targetGeometry,l,o,m,i),s.scale=$(t,l),s}function Ft(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),!n.target&&"center"in e&&e.center&&(n.target=e.center)),n}function Ot(t){return null!=t?.camera&&(t.rotation=st(t.camera.heading)),t}function Pt(t,e){const n=ot;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let r=0;r<e.length;r++){const t=e[r].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}class Ut{constructor(){this.hasZ=!1,this.boundingBox=O(),this.screenSpaceObjects=new Array}}const Dt=w(),Vt=m(),Ct=l(),kt=Z(),It=k(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new b,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let r=0;r<t.rings.length;r++){const o=t.rings[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let r=0;r<t.paths.length;r++){const o=t.paths[r];for(let t=0;t<o.length;t++)n[0]=o[t][0],n[1]=o[t][1],a&&(n[2]=o[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,r=t.hasZ;for(let o=0;o<a.length;o++)n[0]=a[o][0],n[1]=a[o][1],r&&(n[2]=a[o][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{ht as create,yt as fromCamera,lt as toCameraAsync,ct as toCameraSync};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{projectWithoutEngine as i}from"../../../geometry/
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{projectWithoutEngine as i}from"../../../geometry/projectionUtils.js";import{fromExtent as l,empty as s,expand as o,allFinite as a,equals as c}from"../../../geometry/support/aaBoundingRect.js";import{isIntegratedMeshOperationalLayer as p,isTiledLayer as u}from"../../../layers/support/layerUtils.js";import{ViewingMode as y}from"../../ViewingMode.js";import{webMercatorWorldExtent as f,geographicWorldExtent as d}from"./TerrainConst.js";import{getTiledLayerInfo as E,isProjectableRasterLayer as m}from"./terrainUtils.js";let x=class extends t{constructor(e){super(e)}initialize(){this.addHandles([this.layerViews.on("change",(()=>this.notifyChange("stencilEnabledExtents")))])}destroy(){}get layerViewsExtent(){return this._computeLayerViewsExtent()}get tiledLayersExtent(){return this._computeTiledLayersExtent()}get stencilEnabledExtents(){return this._computeStencilEnabledExtents()}_computeStencilEnabledExtents(){const e=[];return this.layerViews.forEach((t=>{const r=t.layer;if("operationalLayerType"in r&&p(r.operationalLayerType)&&null!=this.viewSpatialReference){const t=L(r.fullExtent,this.viewSpatialReference);null!=t&&e.push(l(t))}})),e}};function h(e,t){return e===y.Global?new w(t):new g(t)}e([r({readOnly:!0})],x.prototype,"layerViewsExtent",null),e([r({readOnly:!0})],x.prototype,"tiledLayersExtent",null),e([r({readOnly:!0})],x.prototype,"stencilEnabledExtents",null),e([r()],x.prototype,"viewSpatialReference",void 0),e([r()],x.prototype,"tilingScheme",void 0),e([r()],x.prototype,"defaultTiledLayersExtent",void 0),e([r({constructOnly:!0})],x.prototype,"layers",void 0),e([r({constructOnly:!0})],x.prototype,"layerViews",void 0),x=e([n("esri.views.3d.terrain.ExtentHelper")],x);let w=class extends x{_computeLayerViewsExtent(){return this._globalExtent}_computeTiledLayersExtent(){return this._globalExtent}get _globalExtent(){return this.viewSpatialReference.isWebMercator?f:d}};w=e([n("esri.views.3d.terrain.ExtentHelper.ExtentHelperGlobal")],w);let g=class extends x{_computeLayerViewsExtent(){const e=s(),t=this.viewSpatialReference;this.layerViews.forEach((r=>{const n=r.layer;if(r.isResolved()&&("graphics"!==n.type||!n.internal)){const n=L("fullExtentInLocalViewSpatialReference"in r&&r.fullExtentInLocalViewSpatialReference||r.layer.fullExtent,t);o(e,n,e)}}));const r=a(e)?e:null,n=this._get("layerViewsExtent");return c(r,n)?n:r}_computeTiledLayersExtent(){const e=this.tilingScheme;if(!e)return null;const t=this.viewSpatialReference,r=s();this.layers.forEach((n=>{if(n.loaded&&u(n)){const i=E(n,t,y.Local);if(null==i)return;const{tileInfo:l,fullExtent:s}=i,a="tilemapCache"in n?n.tilemapCache?.effectiveMaxLOD:void 0;null!=l&&null!=s&&(m(n)||e.compatibleWith(l,a)&&s.spatialReference.equals(e.spatialReference))&&o(r,s,r)}})),o(r,this.defaultTiledLayersExtent,r);const n=a(r)?r:null,i=this._get("tiledLayersExtent");return c(n,i)?i:n}};function L(e,t){return null==e||e.spatialReference.equals(t)?e:i(e,e.spatialReference,t)}g=e([n("esri.views.3d.terrain.ExtentHelper.ExtentHelperLocal")],g);export{x as ExtentHelper,h as create};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as r}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{ColorFormat as c,isDepthFormat as h,DepthTextureFormats as i,ColorFormats as n,DepthFormat as o}from"./FBOCacheFormats.js";import{FBOPool as s}from"./FBOPool.js";import{DepthStencilAttachment as l,ColorAttachment0 as u}from"../../../webgl/enums.js";import{FramebufferObject as m}from"../../../webgl/FramebufferObject.js";import{Texture as d}from"../../../webgl/Texture.js";class f{constructor(e){this.rctx=e,this._interactive=!1,this._acquired=new Set,this._cache=new s(e.newCache,"FBOCache"),this._depthCache=new s(e.newCache,"DepthAttachmentCache"),this._colorCache=new s(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const{debugCallback:e}=this;e&&this._acquired.forEach((t=>e(t.name,t.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+t.cachedMemory),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(t,r,i,n=c.RGBA8UNORM){const s=w(n,t,r);let d=this._cache.pop(s);const{rctx:f}=this;if(d){d.retain(),d.setName(i);const t=d.getAttachment(l);t&&(t.name=_(i));const r=d.getAttachment(u);r&&(r.name=p(i,0));const{fbo:a}=d;if(!a)throw new e("renderer","attempt to use a none existing framebuffer");f.temporaryBindFramebufferObject(a,(()=>{f.setDrawBuffers([u]),f.unbindTexture(a.colorTexture)}))}else{const e=new m(f),C=(e,a,h)=>{a??=c.RGBA8UNORM;const i=this._acquireColor(a,t,r,h??p(d.name,e-u));return this.rctx.unbindTexture(i.attachment),d.attachColor(i,e),i.release(),d},w=e=>{e??=o.DEPTH24_STENCIL8;const a=this.acquireDepth(e,t,r,_(d.name));return d.attachDepth(a),a.release(),d},b=()=>{this.debugCallback?.(d.name,d.fbo),this._acquired.delete(d);const e=h(n)
|
|
5
|
+
import e from"../../../../core/Error.js";import{ManagedColorAttachment as t}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as r}from"../../webgl/ManagedDepthTexture.js";import a from"../../webgl/ManagedFBO.js";import{ColorFormat as c,isDepthFormat as h,DepthTextureFormats as i,ColorFormats as n,DepthFormat as o}from"./FBOCacheFormats.js";import{FBOPool as s}from"./FBOPool.js";import{DepthStencilAttachment as l,ColorAttachment0 as u}from"../../../webgl/enums.js";import{FramebufferObject as m}from"../../../webgl/FramebufferObject.js";import{Texture as d}from"../../../webgl/Texture.js";class f{constructor(e){this.rctx=e,this._interactive=!1,this._acquired=new Set,this._cache=new s(e.newCache,"FBOCache"),this._depthCache=new s(e.newCache,"DepthAttachmentCache"),this._colorCache=new s(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const{debugCallback:e}=this;e&&this._acquired.forEach((t=>e(t.name,t.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+t.cachedMemory),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(t,r,i,n=c.RGBA8UNORM){const s=w(n,t,r);let d=this._cache.pop(s);const{rctx:f}=this;if(d){d.retain(),d.setName(i);const t=d.getAttachment(l);t&&(t.name=_(i));const r=d.getAttachment(u);r&&(r.name=p(i,0));const{fbo:a}=d;if(!a)throw new e("renderer","attempt to use a none existing framebuffer");f.temporaryBindFramebufferObject(a,(()=>{f.setDrawBuffers([u]),f.unbindTexture(a.colorTexture)}))}else{const e=new m(f),C=(e,a,h)=>{a??=c.RGBA8UNORM;const i=this._acquireColor(a,t,r,h??p(d.name,e-u));return this.rctx.unbindTexture(i.attachment),d.attachColor(i,e),i.release(),d},w=e=>{e??=o.DEPTH24_STENCIL8;const a=this.acquireDepth(e,t,r,_(d.name));return d.attachDepth(a),a.release(),d},b=()=>{this.debugCallback?.(d.name,d.fbo),this._acquired.delete(d);const e=h(n);e&&null!=d?.getAttachment(l)||!e&&null!=d?.getAttachment(u)?(e?(d.fbo?.invalidateAttachments([l]),d.detachAllColors()):(d.fbo?.invalidateAttachments([u]),d.detachAllButColor0()),this._cache.put(d)):d?.dispose()};d=new a(s,i,e,C,w,b),h(n)?d.acquireDepth(n):d.acquireColor(u,n,i)}return this._trackHandle(d)}acquireDepth(e,t,a,c){const h=w(e,t,a);let n=this._depthCache.pop(h);if(n)n.retain(),n.attachment.setShadowFiltering(!1);else{const c=new d(this.rctx,{...i[e],width:t,height:a});n=new r(h,c,(()=>this._depthCache.put(n)))}return n.name=c,n}_acquireColor(e,r,a,c){const h=w(e,r,a),i=this._colorCache.pop(h);if(i)return i.retain(),i.name=c,i;const o=new t(h,new d(this.rctx,{...n[e],width:r,height:a}),(()=>{this._colorCache.put(o)}));return o.name=c,o}_trackHandle(e){return this._acquired.add(e),e}}function p(e,t=0){return`${e}.color${t}`}function _(e){return`${e}.depth`}const C=new a("default","default",null,(()=>C),(()=>C),(()=>{}));function w(e,t,r){return`${t}x${r}:${e}`}C.release=()=>!1;export{f as FBOCache,C as defaultWebGLFBO};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as o}from"../../../webgl.js";import t from"../../../webgl/RenderNode.js";import{FocusAreaColorTechnique as i}from"./FocusAreaColorTechnique.js";import{
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as o}from"../../../webgl.js";import t from"../../../webgl/RenderNode.js";import{FocusAreaColorTechnique as i}from"./FocusAreaColorTechnique.js";import{FocusAreaEffect as c}from"./FocusAreaEffect.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";import{DepthStencilAttachment as p}from"../../../../webgl/enums.js";let m=class extends t{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._passParameters=new a}precompile(){this.techniques.precompile(i)}render(e){const r=this.techniques.get(i),s=e.find((({name:e})=>e===this.produces));if(!r.compiled)return this.requestRender(),s;const t=this.focusAreasView.style,c=this.bindParameters,a=c.camera,m=a.fullViewport[2],n=a.fullViewport[3],f=e.find((({name:e})=>e===o.FOCUSAREA)),h=this.fboCache.acquire(m,n,this.produces),d=this.renderingContext;return d.bindFramebuffer(h.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=f.getTexture(),this._passParameters.effect=u[t],d.bindTechnique(r,c,this._passParameters),d.screen.draw(),h.attachDepth(s.getAttachment(p)),h}};e([r()],m.prototype,"consumes",void 0),e([r()],m.prototype,"produces",void 0),e([r({constructOnly:!0})],m.prototype,"focusAreasView",void 0),m=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],m);const u={bright:c.BRIGHT,dark:c.DARK};export{m as FocusAreaColorNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r,InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{ColorFormat as n,DepthFormat as a}from"../../core/FBOCacheFormats.js";import{FocusAreaMaskTechnique as c}from"./FocusAreaMaskTechnique.js";import{Default3D as h}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as p}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as u}from"../../lib/VertexArrayObject.js";import{F as l}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as m}from"../../../../webgl/BufferObject.js";import{FramebufferBit as d,DepthStencilAttachment as f,Face as g,StencilOperation as A,CompareFunction as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r,InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{ColorFormat as n,DepthFormat as a}from"../../core/FBOCacheFormats.js";import{FocusAreaMaskTechnique as c}from"./FocusAreaMaskTechnique.js";import{Default3D as h}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as p}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as u}from"../../lib/VertexArrayObject.js";import{F as l}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as m}from"../../../../webgl/BufferObject.js";import{FramebufferBit as d,DepthStencilAttachment as f,Face as g,StencilOperation as A,CompareFunction as b,PrimitiveType as E,Usage as w}from"../../../../webgl/enums.js";import{noParameters as _}from"../../../../webgl/NoParameters.js";let R=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=i.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new l}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(c)}render(e){const t=this.techniques.get(c),s=this.bindParameters,o=s.camera,h=o.fullViewport[2],p=o.fullViewport[3];if(!t.compiled||!this._vaos)return void this.requestRender();const u=e.find((({name:e})=>e===r.TRANSPARENT)),l=this.renderingContext,m=this.fboCache.acquire(h,p,i.FOCUSAREA,n.RGBA8UNORM);this.view.stage.renderer.occludedRequiresStencil?(m.acquireDepth(a.DEPTH24_STENCIL8),l.blitFramebuffer(u.fbo,m.fbo,d.DEPTH)):m.attachDepth(u.getAttachment(f)),l.bindFramebuffer(m.fbo),l.clear(d.COLOR|d.STENCIL),l.setViewport(0,0,h,p);const w=l.bindTechnique(t,s);l.setFaceCullingEnabled(!1),l.setStencilTestEnabled(!0),l.setStencilOpSeparate(g.FRONT,A.KEEP,A.INCR_WRAP,A.KEEP),l.setStencilOpSeparate(g.BACK,A.KEEP,A.DECR_WRAP,A.KEEP),l.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],w.bindDraw(s,_,this._maskParameters),l.bindVAO(e),l.setDepthTestEnabled(!0),l.setStencilWriteMask(255),l.setStencilFunction(b.ALWAYS,0,255),l.setColorMask(!1,!1,!1,!1),l.drawArrays(E.TRIANGLES,0,t),l.setDepthTestEnabled(!1),l.setStencilWriteMask(0),l.setStencilFunction(b.NOTEQUAL,0,255),l.setColorMask(!0,!0,!0,!0),l.drawArrays(E.TRIANGLES,0,t)}return m}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach((e=>e.forEach((e=>{const t=new Array,s=e.indicesBottom;for(let o=0;o<s.length;o++)t.push(e.positions[3*(s[o]-1)]),t.push(e.positions[3*(s[o]-1)+1]),t.push(e.positions[3*(s[o]-1)+2]);const r=e.indicesExtruded;for(let o=0;o<r.length;o++)t.push(e.positions[3*r[o]]),t.push(e.positions[3*r[o]+1]),t.push(e.positions[3*r[o]+2]);const i=new u(this.renderingContext,h,new Map([["geometry",p]]),new Map([["geometry",m.createVertex(this.renderingContext,w.STATIC_DRAW,new Float32Array(t))]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(e.origin)})))),this.requestRender()}};e([t()],R.prototype,"consumes",void 0),e([t()],R.prototype,"produces",void 0),e([t({constructOnly:!0})],R.prototype,"focusAreasView",void 0),R=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],R);class S{constructor(e,t,s,r,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=i}}export{S as FocusAreaGeometry,R as FocusAreaMaskNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,g as m,c as d,l as g,j as O,f as S,a as T,o as b,e as v}from"../../../../chunks/vec32.js";import{create as A,fromValues as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as R,create as I,freeze as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as F}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as P}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as _,BufferViewVec3f as C,BufferViewFloat as y,BufferViewVec2f as D,BufferViewVec4f as L}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as N}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{newLayout as U}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as z,isColorOrColorEmission as M}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as w}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as B}from"../effects/geometry/olidUtils.js";import{GLTextureMaterialBindParameters as V,GLTextureMaterial as X}from"../lib/GLTextureMaterial.js";import{Material as q,RenderOccludedFlag as G}from"../lib/Material.js";import{RenderSlot as H}from"../lib/RenderSlot.js";import{applyScaleFactor as W,applyPrecomputedScaleFactor as Y,precomputeScaleFactor as Z}from"../lib/screenSizePerspectiveUtils.js";import{assert as k}from"../lib/Util.js";import{VertexAttribute as J}from"../lib/VertexAttribute.js";import{ScaleInfo as K}from"./ScaleInfo.js";import{writePosition as Q,writeNormal as $,writeColor as ee,writeBufferFloat as te,writeBufferVec4 as ie,writeBufferVec4Zeros as se,writeOlidColor as re}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ae}from"./internal/MaterialUtil.js";import{c as ne,f as oe}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as le}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ce}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as fe}from"../../../../webscene/support/AlphaCutoff.js";class ue extends q{constructor(e,t){super(e,Me),this.produces=new Map([[H.HUD_MATERIAL,e=>z(e)&&!this.parameters.drawAsLabel],[H.LABEL_MATERIAL,e=>z(e)&&this.parameters.drawAsLabel],[H.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[H.DRAPED_MATERIAL,e=>this.parameters.draped&&z(e)]]),this._visible=!0,this._configuration=new ce(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===H.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===H.OCCLUSION_PIXELS,M(e)&&(this._configuration.debugDrawLabelBorder=!!j.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:T,camera:b}=s,{parameters:v}=this;if(!l||!c||S&&v.isLabel||!e.visible||!T||!b)return;const E=e.attributes.get(J.FEATUREATTRIBUTE),I=null==E?null:R(E.data,ye),{scaleX:x,scaleY:F}=Xe(I,v,b.pixelRatio);i(Ie,t),e.attributes.has(J.FEATUREATTRIBUTE)&&de(Ie);const P=e.attributes.get(J.POSITION),_=e.attributes.get(J.SIZE),C=e.attributes.get(J.NORMAL),y=e.attributes.get(J.ROTATION),D=e.attributes.get(J.CENTEROFFSETANDDISTANCE);k(P.size>=3);const L=ne(v),N="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<P.data.length/P.size;i++){const e=i*P.size;f(Se,P.data[e],P.data[e+1],P.data[e+2]),u(Se,Se,t),u(Se,Se,b.viewMatrix);const a=i*D.size;if(f(_e,D.data[a],D.data[a+1],D.data[a+2]),!N&&(Se[0]+=_e[0],Se[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,Se),h(Se,Se,m(_e,_e,e))}const n=i*C.size;if(f(Te,C.data[n],C.data[n+1],C.data[n+2]),me(Te,Ie,b,De),qe(this.parameters,Se,De,b,Oe),b.applyProjection(Se,be),be[0]>-1){N&&(_e[0]||_e[1])&&(be[0]+=_e[0]*b.pixelRatio,0!==_e[1]&&(be[1]+=W(_e[1],Oe.factorAlignment)*b.pixelRatio),b.unapplyProjection(be,Se)),be[0]+=this.parameters.screenOffset[0]*b.pixelRatio,be[1]+=this.parameters.screenOffset[1]*b.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]);const e=i*_.size;je[0]=_.data[e],je[1]=_.data[e+1],Y(je,Oe.factor,je);const t=Le*b.pixelRatio;let a=0;if(v.textureIsSignedDistanceField){a=Math.min(v.outlineSize,.5*je[0])*b.pixelRatio/2}je[0]*=x,je[1]*=F;const n=i*y.size,l=v.rotation+y.data[n];if(ge(T,be[0],be[1],je,t,a,l,v,L)){const e=s.ray;if(u(Ae,Se,r(Fe,b.viewMatrix)),be[0]=T[0],be[1]=T[1],b.unprojectFromRenderScreen(be,Se)){const t=A();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Se)*i,t,-1,Ae)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get(J.POSITION),n=e.attributes.get(J.SIZE),o=e.attributes.get(J.ROTATION),l=this.parameters,c=ne(l),f=e.attributes.get(J.FEATUREATTRIBUTE),u=null==f?null:R(f.data,ye),{scaleX:p,scaleY:h}=Xe(u,l,e.screenToWorldRatio),m=Ne*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,f=a.data[t],u=a.data[t+1],g=d*n.size;je[0]=n.data[g],je[1]=n.data[g+1];let O=0;if(l.textureIsSignedDistanceField){O=Math.min(l.outlineSize,.5*je[0])*e.screenToWorldRatio/2}je[0]*=p,je[1]*=h;const S=d*o.size,T=l.rotation+o.data[S];ge(i,f,u,je,m,O,T,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Ve}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=me(t,i,r,De);return this._applyVerticalGroundOffsetView(e,o,r,n),qe(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*w,o=m(Se,t.normal,a*n);return S(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Te,i),T(i,i,m(Te,Te,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=fe||t>=fe&&i[3]>=fe;return this._visible&&s}createGLMaterial(e){return new pe(e)}calculateRelativeScreenBounds(e,t,i=P()){return he(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class pe extends X{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(le,e)}}function he(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function me(e,t,s,r){return F(t)&&(t=i(xe,t)),b(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=v(ve,ze),r}function de(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function ge(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(Re,i,s),o(Ee,e,Re,t(c)),Ee[0]>p&&Ee[0]<h&&Ee[1]>m&&Ee[1]<d}const Oe=new K,Se=A(),Te=A(),be=I(),ve=A(),Ae=A(),Ee=c(),Re=c(),Ie=s(),xe=s(),Fe=a(),Pe=I(),_e=A(),Ce=A(),ye=I(),De={normal:ve,cosAngle:0},Le=1,Ne=2,je=l(0,0),Ue=6,ze=E(0,0,1);class Me extends V{constructor(){super(...arguments),this.renderOccluded=G.Occlude,this.isDecoration=!1,this.color=x(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=x(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=I(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="none",this.draped=!1,this.isLabel=!1}}const we=U().vec3f(J.POSITION).vec3f(J.NORMAL).vec2i16(J.UVI).vec4u8(J.COLOR).vec2f(J.SIZE).f32(J.ROTATION).vec4f(J.CENTEROFFSETANDDISTANCE).vec4f(J.FEATUREATTRIBUTE),Be=we.clone().vec4u8(J.OLIDCOLOR);class Ve{constructor(){this.vertexBufferLayout=B()?Be:we}elementCount(e){return e.get(J.POSITION).indices.length*Ue}write(e,t,i,s,r,a){const{position:n,normal:o,uvi:l,color:c,size:f,rotation:u,centerOffsetAndDistance:p,featureAttribute:h}=r;Q(i.get(J.POSITION),e,n,a,Ue),$(i.get(J.NORMAL),t,o,a,Ue);const m=i.get(J.UVI)?.data;let d=0,g=0,O=-1-oe,S=-1-oe;m&&m.length>=4&&(d=m[0],g=m[1],O=-1-m[2],S=-1-m[3]);let T=i.get(J.POSITION).indices.length,b=a;for(let E=0;E<T;++E)l.set(b,0,d),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,S),b++,l.set(b,0,O),l.set(b,1,S),b++,l.set(b,0,d),l.set(b,1,S),b++,l.set(b,0,d),l.set(b,1,g),b++;ee(i.get(J.COLOR),4,c,a,Ue);const{data:v,indices:A}=i.get(J.SIZE);T=A.length,b=a;for(let E=0;E<T;++E){const e=v[2*A[E]],t=v[2*A[E]+1];for(let i=0;i<Ue;++i)f.set(b,0,e),f.set(b,1,t),b++}if(te(i.get(J.ROTATION),u,a,Ue),i.get(J.CENTEROFFSETANDDISTANCE)?ie(i.get(J.CENTEROFFSETANDDISTANCE),p,a,Ue):se(p,a,T*Ue),i.get(J.FEATUREATTRIBUTE)?ie(i.get(J.FEATUREATTRIBUTE),h,a,Ue):se(h,a,T*Ue),null!=s){const e=i.get(J.POSITION)?.indices;if(e){const t=e.length,i=r.getField(J.OLIDCOLOR,_);re(s,i,t,a,Ue)}}return{numVerticesPerItem:Ue,numItems:T}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:b,camera:v}=s;if(!l||!c||T&&t.isLabel||!b)return;const E=this.vertexBufferLayout.createView(e),R=E.getField(J.POSITION,C),I=E.getField(J.NORMAL,C),x=E.getField(J.ROTATION,y),F=E.getField(J.SIZE,D),P=E.getField(J.FEATUREATTRIBUTE,L),_=E.getField(J.CENTEROFFSETANDDISTANCE,L),N="screen"===t.centerOffsetUnits,j=ne(t);if(null==R||null==I||null==x||null==F||null==_||null==v)return;const U=null==P?null:P.getVec(0,ye),{scaleX:z,scaleY:M}=Xe(U,t,v.pixelRatio),w=R.count/Ue;for(let C=0;C<w;C++){const e=C*Ue;if(R.getVec(e,Se),null!=i&&S(Se,Se,i),u(Se,Se,v.viewMatrix),_.getVec(e,Pe),f(_e,Pe[0],Pe[1],Pe[2]),!N&&(Se[0]+=_e[0],Se[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,Se),h(Se,Se,m(_e,_e,e))}if(I.getVec(e,Te),me(Te,Ie,v,De),qe(t,Se,De,v,Oe),v.applyProjection(Se,be),be[0]>-1){N&&(_e[0]||_e[1])&&(be[0]+=_e[0]*v.pixelRatio,0!==_e[1]&&(be[1]+=W(_e[1],Oe.factorAlignment)*v.pixelRatio),v.unapplyProjection(be,Se)),be[0]+=t.screenOffset[0]*v.pixelRatio,be[1]+=t.screenOffset[1]*v.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]),F.getVec(e,je),Y(je,Oe.factor,je);const i=Le*v.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*je[0])*v.pixelRatio/2}je[0]*=z,je[1]*=M;const n=x.get(e),l=t.rotation+n;if(ge(b,be[0],be[1],je,i,a,l,t,j)){const e=s.ray;if(u(Ae,Se,r(Fe,v.viewMatrix)),be[0]=b[0],be[1]=b[1],v.unprojectFromRenderScreen(be,Se)){const t=A();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Se)*i,t,C,Ae)}}}}}}function Xe(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(N(Ce,t,e),{scaleX:Ce[0]*i,scaleY:Ce[1]*i})}function qe(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){Ge(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ae(s,a,e.verticalOffset,i.cosAngle,n);return Ge(e,r,a,i.cosAngle),m(i.normal,i.normal,o),S(t,t,i.normal)}function Ge(e,t,i,s){null!=e.screenSizePerspective?Z(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Z(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{ue as HUDMaterial,Me as Parameters};
|
|
5
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,g as m,c as d,l as g,j as O,f as S,a as T,o as b,e as v}from"../../../../chunks/vec32.js";import{create as A,fromValues as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as R,create as I,freeze as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as F}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as P}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as _,BufferViewVec3f as C,BufferViewFloat as y,BufferViewVec2f as D,BufferViewVec4f as L}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as N}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{newLayout as U}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as z,isColorOrColorEmission as M}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as w}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as B}from"../effects/geometry/olidUtils.js";import{GLTextureMaterialBindParameters as V,GLTextureMaterial as X}from"../lib/GLTextureMaterial.js";import{Material as q,RenderOccludedFlag as G}from"../lib/Material.js";import{RenderSlot as H}from"../lib/RenderSlot.js";import{applyScaleFactor as W,applyPrecomputedScaleFactor as Y,precomputeScaleFactor as Z}from"../lib/screenSizePerspectiveUtils.js";import{assert as k}from"../lib/Util.js";import{VertexAttribute as J}from"../lib/VertexAttribute.js";import{ScaleInfo as K}from"./ScaleInfo.js";import{writePosition as Q,writeNormal as $,writeColor as ee,writeBufferFloat as te,writeBufferVec4 as ie,writeBufferVec4Zeros as se,writeOlidColor as re}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ae}from"./internal/MaterialUtil.js";import{c as ne,f as oe}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as le}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ce}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as fe}from"../../../../webscene/support/AlphaCutoff.js";class ue extends q{constructor(e,t){super(e,Me),this.produces=new Map([[H.HUD_MATERIAL,e=>z(e)&&!this.parameters.drawAsLabel],[H.LABEL_MATERIAL,e=>z(e)&&this.parameters.drawAsLabel],[H.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[H.DRAPED_MATERIAL,e=>this.parameters.draped&&z(e)]]),this._visible=!0,this._configuration=new ce(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===H.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===H.OCCLUSION_PIXELS,M(e)&&(this._configuration.debugDrawLabelBorder=!!j.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:T,camera:b}=s,{parameters:v}=this;if(!l||!c||S&&v.isLabel||!e.visible||!T||!b)return;const E=e.attributes.get(J.FEATUREATTRIBUTE),I=null==E?null:R(E.data,ye),{scaleX:x,scaleY:F}=Xe(I,v,b.pixelRatio);i(Ie,t),e.attributes.has(J.FEATUREATTRIBUTE)&&de(Ie);const P=e.attributes.get(J.POSITION),_=e.attributes.get(J.SIZE),C=e.attributes.get(J.NORMAL),y=e.attributes.get(J.ROTATION),D=e.attributes.get(J.CENTEROFFSETANDDISTANCE);k(P.size>=3);const L=ne(v),N="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<P.data.length/P.size;i++){const e=i*P.size;f(Se,P.data[e],P.data[e+1],P.data[e+2]),u(Se,Se,t),u(Se,Se,b.viewMatrix);const a=i*D.size;if(f(_e,D.data[a],D.data[a+1],D.data[a+2]),!N&&(Se[0]+=_e[0],Se[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,Se),h(Se,Se,m(_e,_e,e))}const n=i*C.size;if(f(Te,C.data[n],C.data[n+1],C.data[n+2]),me(Te,Ie,b,De),qe(this.parameters,Se,De,b,Oe),b.applyProjection(Se,be),be[0]>-1){N&&(_e[0]||_e[1])&&(be[0]+=_e[0]*b.pixelRatio,0!==_e[1]&&(be[1]+=W(_e[1],Oe.factorAlignment)*b.pixelRatio),b.unapplyProjection(be,Se)),be[0]+=this.parameters.screenOffset[0]*b.pixelRatio,be[1]+=this.parameters.screenOffset[1]*b.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]);const e=i*_.size;je[0]=_.data[e],je[1]=_.data[e+1],Y(je,Oe.factor,je);const t=Le*b.pixelRatio;let a=0;if(v.textureIsSignedDistanceField){a=Math.min(v.outlineSize,.5*je[0])*b.pixelRatio/2}je[0]*=x,je[1]*=F;const n=i*y.size,l=v.rotation+y.data[n];if(ge(T,be[0],be[1],je,t,a,l,v,L)){const e=s.ray;if(u(Ae,Se,r(Fe,b.viewMatrix)),be[0]=T[0],be[1]=T[1],b.unprojectFromRenderScreen(be,Se)){const t=A();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Se)*i,t,-1,Ae)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get(J.POSITION),n=e.attributes.get(J.SIZE),o=e.attributes.get(J.ROTATION),l=this.parameters,c=ne(l),f=e.attributes.get(J.FEATUREATTRIBUTE),u=null==f?null:R(f.data,ye),{scaleX:p,scaleY:h}=Xe(u,l,e.screenToWorldRatio),m=Ne*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,f=a.data[t],u=a.data[t+1],g=d*n.size;je[0]=n.data[g],je[1]=n.data[g+1];let O=0;if(l.textureIsSignedDistanceField){O=Math.min(l.outlineSize,.5*je[0])*e.screenToWorldRatio/2}je[0]*=p,je[1]*=h;const S=d*o.size,T=l.rotation+o.data[S];ge(i,f,u,je,m,O,T,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Ve}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=me(t,i,r,De);return this._applyVerticalGroundOffsetView(e,o,r,n),qe(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*w,o=m(Se,t.normal,a*n);return S(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Te,i),T(i,i,m(Te,Te,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=fe||t>=fe&&i[3]>=fe;return this._visible&&s}createGLMaterial(e){return new pe(e)}calculateRelativeScreenBounds(e,t,i=P()){return he(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class pe extends X{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(le,e)}}function he(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function me(e,t,s,r){return F(t)&&(t=i(xe,t)),b(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=v(ve,ze),r}function de(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function ge(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(Re,i,s),o(Ee,e,Re,t(c)),Ee[0]>p&&Ee[0]<h&&Ee[1]>m&&Ee[1]<d}const Oe=new K,Se=A(),Te=A(),be=I(),ve=A(),Ae=A(),Ee=c(),Re=c(),Ie=s(),xe=s(),Fe=a(),Pe=I(),_e=A(),Ce=A(),ye=I(),De={normal:ve,cosAngle:0},Le=1,Ne=2,je=l(0,0),Ue=6,ze=E(0,0,1);class Me extends V{constructor(){super(...arguments),this.renderOccluded=G.Occlude,this.isDecoration=!1,this.color=x(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=x(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=I(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}}const we=U().vec3f(J.POSITION).vec3f(J.NORMAL).vec2i16(J.UVI).vec4u8(J.COLOR).vec2f(J.SIZE).f32(J.ROTATION).vec4f(J.CENTEROFFSETANDDISTANCE).vec4f(J.FEATUREATTRIBUTE),Be=we.clone().vec4u8(J.OLIDCOLOR);class Ve{constructor(){this.vertexBufferLayout=B()?Be:we}elementCount(e){return e.get(J.POSITION).indices.length*Ue}write(e,t,i,s,r,a){const{position:n,normal:o,uvi:l,color:c,size:f,rotation:u,centerOffsetAndDistance:p,featureAttribute:h}=r;Q(i.get(J.POSITION),e,n,a,Ue),$(i.get(J.NORMAL),t,o,a,Ue);const m=i.get(J.UVI)?.data;let d=0,g=0,O=-1-oe,S=-1-oe;m&&m.length>=4&&(d=m[0],g=m[1],O=-1-m[2],S=-1-m[3]);let T=i.get(J.POSITION).indices.length,b=a;for(let E=0;E<T;++E)l.set(b,0,d),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,S),b++,l.set(b,0,O),l.set(b,1,S),b++,l.set(b,0,d),l.set(b,1,S),b++,l.set(b,0,d),l.set(b,1,g),b++;ee(i.get(J.COLOR),4,c,a,Ue);const{data:v,indices:A}=i.get(J.SIZE);T=A.length,b=a;for(let E=0;E<T;++E){const e=v[2*A[E]],t=v[2*A[E]+1];for(let i=0;i<Ue;++i)f.set(b,0,e),f.set(b,1,t),b++}if(te(i.get(J.ROTATION),u,a,Ue),i.get(J.CENTEROFFSETANDDISTANCE)?ie(i.get(J.CENTEROFFSETANDDISTANCE),p,a,Ue):se(p,a,T*Ue),i.get(J.FEATUREATTRIBUTE)?ie(i.get(J.FEATUREATTRIBUTE),h,a,Ue):se(h,a,T*Ue),null!=s){const e=i.get(J.POSITION)?.indices;if(e){const t=e.length,i=r.getField(J.OLIDCOLOR,_);re(s,i,t,a,Ue)}}return{numVerticesPerItem:Ue,numItems:T}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:b,camera:v}=s;if(!l||!c||T&&t.isLabel||!b)return;const E=this.vertexBufferLayout.createView(e),R=E.getField(J.POSITION,C),I=E.getField(J.NORMAL,C),x=E.getField(J.ROTATION,y),F=E.getField(J.SIZE,D),P=E.getField(J.FEATUREATTRIBUTE,L),_=E.getField(J.CENTEROFFSETANDDISTANCE,L),N="screen"===t.centerOffsetUnits,j=ne(t);if(null==R||null==I||null==x||null==F||null==_||null==v)return;const U=null==P?null:P.getVec(0,ye),{scaleX:z,scaleY:M}=Xe(U,t,v.pixelRatio),w=R.count/Ue;for(let C=0;C<w;C++){const e=C*Ue;if(R.getVec(e,Se),null!=i&&S(Se,Se,i),u(Se,Se,v.viewMatrix),_.getVec(e,Pe),f(_e,Pe[0],Pe[1],Pe[2]),!N&&(Se[0]+=_e[0],Se[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,Se),h(Se,Se,m(_e,_e,e))}if(I.getVec(e,Te),me(Te,Ie,v,De),qe(t,Se,De,v,Oe),v.applyProjection(Se,be),be[0]>-1){N&&(_e[0]||_e[1])&&(be[0]+=_e[0]*v.pixelRatio,0!==_e[1]&&(be[1]+=W(_e[1],Oe.factorAlignment)*v.pixelRatio),v.unapplyProjection(be,Se)),be[0]+=t.screenOffset[0]*v.pixelRatio,be[1]+=t.screenOffset[1]*v.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]),F.getVec(e,je),Y(je,Oe.factor,je);const i=Le*v.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*je[0])*v.pixelRatio/2}je[0]*=z,je[1]*=M;const n=x.get(e),l=t.rotation+n;if(ge(b,be[0],be[1],je,i,a,l,t,j)){const e=s.ray;if(u(Ae,Se,r(Fe,v.viewMatrix)),be[0]=b[0],be[1]=b[1],v.unprojectFromRenderScreen(be,Se)){const t=A();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Se)*i,t,C,Ae)}}}}}}function Xe(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(N(Ce,t,e),{scaleX:Ce[0]*i,scaleY:Ce[1]*i})}function qe(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){Ge(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ae(s,a,e.verticalOffset,i.cosAngle,n);return Ge(e,r,a,i.cosAngle),m(i.normal,i.normal,o),S(t,t,i.normal)}function Ge(e,t,i,s){null!=e.screenSizePerspective?Z(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Z(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{ue as HUDMaterial,Me as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{F as FocusAreaColorPassParameters,b as build}from"../../../../chunks/FocusAreaColor.glsl.js";
|
|
5
|
+
import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/focusArea/FocusAreaEffect.js";import"../../../webgl/NoParameters.js";import"../../../webgl/ShaderBuilder.js";export{F as FocusAreaColorPassParameters,b as build}from"../../../../chunks/FocusAreaColor.glsl.js";
|