@arcgis/core 4.34.0-next.13 → 4.34.0-next.15
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0512ee54f2259a437fdb.js +1 -0
- package/assets/esri/core/workers/chunks/{3145218abe59b5e99ff8.js → 05f2133f05f86266d8c7.js} +1 -1
- package/assets/esri/core/workers/chunks/0f81a2deb656e8b28eae.js +1 -0
- package/assets/esri/core/workers/chunks/{ad4f65d764654c70a117.js → 0f8f217aaf42eb1b9699.js} +1 -1
- package/assets/esri/core/workers/chunks/{74276044cb75b51967f2.js → 10eb89a93c8e31f03c95.js} +1 -1
- package/assets/esri/core/workers/chunks/15d3193576f93586674c.js +1 -0
- package/assets/esri/core/workers/chunks/{369978472cc9ee6a00b5.js → 1f559f1e7f0bc0f4bf20.js} +5 -5
- package/assets/esri/core/workers/chunks/243eb8a317333ec2715b.js +1 -0
- package/assets/esri/core/workers/chunks/273beed633cc37416ad7.js +1 -0
- package/assets/esri/core/workers/chunks/{63852887b3f07d50f7c9.js → 2ad538440cfb3ab94787.js} +1 -1
- package/assets/esri/core/workers/chunks/{aaa564c84ee8ea36fbb4.js → 49a57dc1e6d1048fa949.js} +1 -1
- package/assets/esri/core/workers/chunks/{e7589c39b13295af8f1d.js → 604f8094992bb642378b.js} +1 -1
- package/assets/esri/core/workers/chunks/6975929fa91c81c8afc0.js +1 -0
- package/assets/esri/core/workers/chunks/{0eeb0dce918e4827309a.js → 70e5848aa372475fc8fa.js} +1 -1
- package/assets/esri/core/workers/chunks/7716a9fb380d66ba7292.js +1 -0
- package/assets/esri/core/workers/chunks/77ad62ed93f713a909f0.js +1 -0
- package/assets/esri/core/workers/chunks/7b9eec0090f48e9cdaf1.js +1 -0
- package/assets/esri/core/workers/chunks/{3b63edcd34f832ac7bd8.js → 7c6b9e2c1dada4668c01.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b21651eb93efe9ce089.js → 7f14d6cb754c7e94748c.js} +83 -83
- package/assets/esri/core/workers/chunks/{af0d7a7cbbaad47a49c6.js → 802c6b1a6cb9264b8e4f.js} +1 -1
- package/assets/esri/core/workers/chunks/8865bd8f196556441ce3.js +1 -0
- package/assets/esri/core/workers/chunks/8b1842f0f94c18652d4e.js +1 -0
- package/assets/esri/core/workers/chunks/932808e485f305b6a26a.js +1 -0
- package/assets/esri/core/workers/chunks/93c145a738b3f6cf4ee4.js +1 -0
- package/assets/esri/core/workers/chunks/9d779891d51d196aa8c8.js +1 -0
- package/assets/esri/core/workers/chunks/{6cbe8205a4e0f62da519.js → a5a27e2e9b91fbe12da9.js} +1 -1
- package/assets/esri/core/workers/chunks/aeac889d95f34b6d3b72.js +1 -0
- package/assets/esri/core/workers/chunks/d0876a713079c669995a.js +1 -0
- package/assets/esri/core/workers/chunks/{d5f770302dc686e55ba7.js → daffceecdc71e74d2629.js} +1 -1
- package/assets/esri/core/workers/chunks/e980a81c4d1e05f07141.js +1 -0
- package/assets/esri/core/workers/chunks/{998819aade3898f52414.js → ec49e2849766402ad5c7.js} +1 -1
- package/assets/esri/core/workers/chunks/fa3edfbdaa3b716a3a10.js +1 -0
- package/assets/esri/core/workers/chunks/fa5715ca3ce95d005b0a.js +1 -0
- package/assets/esri/themes/base/widgets/_SelectionList.scss +31 -28
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/utils.js +1 -1
- package/core/object.js +1 -1
- package/editing/sharedTemplates/executor/builders/bufferPolygonToPolygon.js +1 -1
- package/interfaces.d.ts +28 -10
- package/intl/date.js +1 -1
- package/intl/duration.js +1 -1
- package/intl/locale.js +1 -1
- package/intl/messages.js +1 -1
- package/intl/number.js +1 -1
- package/intl.d.ts +1 -0
- package/intl.js +1 -1
- package/kernel.js +1 -1
- package/layers/CatalogLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/WFSLayer.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/queryValidationUtils.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/rasterDatasets/covJSONParser.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/package.json +1 -1
- package/renderers/support/DictionaryScriptEvaluator.js +1 -1
- package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
- package/rest/support/DateBinTimeInterval.js +1 -1
- package/rest/support/DateBinUtils.js +5 -0
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/ArcadeExpression.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleProperty.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +2 -2
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/layers/BuildingSceneLayerView.js +1 -1
- package/views/layers/PointCloudLayerView.js +1 -1
- package/views/layers/SceneLayerView.js +1 -1
- package/views/ui/UI.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/Directions/DirectionsVisibleElements.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflowData.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationNode.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationSettings.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI360.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider/scalePreviewUtils.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/support/timeWidgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/18011c691e0aca4144dd.js +0 -1
- package/assets/esri/core/workers/chunks/183a7dec68c8ba6eb3d6.js +0 -1
- package/assets/esri/core/workers/chunks/2ddb776434a93b8d9e63.js +0 -1
- package/assets/esri/core/workers/chunks/3916879b9ca8c6979011.js +0 -1
- package/assets/esri/core/workers/chunks/3cbc498388fb1931a9f8.js +0 -1
- package/assets/esri/core/workers/chunks/4079e307a0fce4516aa4.js +0 -1
- package/assets/esri/core/workers/chunks/4088f4c25a09932a3eb1.js +0 -1
- package/assets/esri/core/workers/chunks/467cacb501b0417bb4df.js +0 -1
- package/assets/esri/core/workers/chunks/49089731ecfe7e8bb2f6.js +0 -1
- package/assets/esri/core/workers/chunks/4e0bae3671fe1c7efa76.js +0 -1
- package/assets/esri/core/workers/chunks/5df4f2315fae82030e87.js +0 -1
- package/assets/esri/core/workers/chunks/72ea996b03932c0f004f.js +0 -1
- package/assets/esri/core/workers/chunks/a1a42b0d7cd47b647f8a.js +0 -1
- package/assets/esri/core/workers/chunks/a622ed3f182648ab3ff6.js +0 -1
- package/assets/esri/core/workers/chunks/a693cd3af2e995972252.js +0 -1
- package/assets/esri/core/workers/chunks/c8856370bae65d9eeb2b.js +0 -1
- package/assets/esri/core/workers/chunks/cd4fb107489594c57438.js +0 -1
- package/assets/esri/core/workers/chunks/d28d874c1337b69fedc0.js +0 -1
- package/assets/esri/core/workers/chunks/ec922f876e1465d36045.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{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import i from"../../../core/Accessor.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{mapCollection as o}from"../../../core/mapCollectionUtils.js";import{abortMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{watch as d,initial as l,when as h,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{getFeatureId as t,updatePointsFromFeatureReference as s}from"../../../analysis/featureReferenceUtils.js";import i from"../../../core/Accessor.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{mapCollection as o}from"../../../core/mapCollectionUtils.js";import{abortMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{watch as d,initial as l,when as h,syncAndInitial as c}from"../../../core/reactiveUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{c as u,q as w}from"../../../chunks/vec32.js";import{create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as f,isLoaded as V,projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{projectBoundingRect as _}from"../../../geometry/projection/projectBoundingRect.js";import{containsPoint as g,empty as j}from"../../../geometry/support/aaBoundingRect.js";import{AnalysisView3D as R}from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as b}from"./support/projectionUtils.js";import{ViewshedAnalysisVisualization as D}from"./Viewshed/ViewshedAnalysisVisualization.js";import{ViewshedComputedData as C}from"./Viewshed/ViewshedComputedData.js";import F from"./Viewshed/ViewshedTool.js";import{Intersector as H}from"../webgl-engine/lib/Intersector.js";import{StoreResults as O}from"../webgl-engine/lib/IntersectorInterfaces.js";import{Viewshed as U}from"../webgl-engine/lib/Viewshed.js";import{connectAnalysisViewToTool as A,removeAnalysisViewTool as S,startPlaceOperation as z}from"../../analysis/analysisViewUtils.js";let I=class extends(R(i)){constructor(e){super(e),this.type="viewshed-view-3d",this.analysis=null,this.tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderer=null,this._intersector=null}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){this._unselectOtherViewsheds(e),this._selectedViewshed=e}get selectedViewshedComputedData(){return this.tool?.selectedViewshedComputedData}get _isDecoration(){return!this.parent}initialize(){const e=this.view;this._viewshedRenderer=new U({view:e,selectedViewshed:()=>this.selectedViewshed??this.tool?.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new H(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=O.MIN,this.viewshedComputedDataHandles=o((()=>this.analysis.viewsheds),(t=>{const s=new C({renderCoordsHelper:e.renderCoordsHelper,viewshed:t}),i=Symbol();return this.addHandles([d((()=>({valid:s.valid,canProject:f(s.observer?.spatialReference,this.view.spatialReference)||V()})),(({valid:e,canProject:t},i)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(s):i?.valid&&i?.canProject&&this._removeViewshedsFromRenderer(s),t||b(this.analysis,s.observer.spatialReference,r.getLogger(this)))}),l),...this._createFeatureReferenceHandles(s)],i),{viewshedComputedData:s,remove:()=>{this.removeHandles(i),this._removeViewshedsFromRenderer(s),s.destroy()}}})),this._analysisVisualization=new D({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this.addHandles([d((()=>this.visible),(e=>{const t=this.viewshedComputedDataHandles;if(null==t)return;e||(this.selectedViewshed=null);const s=t.map((e=>e.viewshedComputedData)).filter((e=>e.valid)).toArray();e?this._addViewshedsToRenderer(s):this._removeViewshedsFromRenderer(s)})),d((()=>e.renderCoordsHelper),(e=>{this.viewshedComputedDataHandles?.forEach((({viewshedComputedData:t})=>t.renderCoordsHelper=e))})),A(this,F),h((()=>this.interactive),(()=>{this._unselectOtherViewsheds(this.selectedViewshed)}),c)])}destroy(){this.userOperation=a(this.userOperation),S(this),this._analysisVisualization=n(this._analysisVisualization);const e=this.viewshedComputedDataHandles;null!=e&&this._removeViewshedsFromRenderer(e.map((e=>e.viewshedComputedData)).toArray())}_createFeatureReferenceHandles(e){const{view:t}=this;return[d((()=>[t.state.camera,t.slice.plane,e.viewshed.observer,e.targetRenderSpace,e.verticalFieldOfView,e.horizontalFieldOfView,e.feature]),(()=>{this._updateObserverFromFeature(t,e)}),l),this._createElevationUpdateHandle(e),h((()=>e.needUpdateByFeature),(()=>{this._updateObserverFromFeature(t,e),e.needUpdateByFeature=!1}))]}_createElevationUpdateHandle(e){const t=(s,i)=>{const{view:r}=this,{observer:o}=e;if(null==o)return;const a=y(o,r.spatialReference);if(null!=a.pending)return void a.pending.finally((()=>t(s,i)));const n=a.geometry;null!=n&&(_(s,i,x,r.spatialReference),g(x,[n.x,n.y])&&(e.needUpdateByFeature=!0))};return this.view.elevationProvider.on("elevation-change",(({extent:e,spatialReference:s})=>t(e,s)))}async createViewsheds(e){return z(this,{placementOptions:e,onToolActivated:e=>e.place("multiple")})}async place(e){return z(this,{placementOptions:e,onToolActivated:e=>e.place("single")})}_addViewshedsToRenderer(e){this._viewshedRenderer.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderer.updateViewsheds({removes:e})}_updateObserverFromFeature(e,i){const r=i.observerRenderSpace,o=i.targetRenderSpace,a=u(v(),r),n={observer:r,observerSurfaceNormal:null,observerAdjusted:a,observerFeatureId:t(i.feature),target:o,targetSurfaceNormal:null,targetAdjusted:u(v(),o),targetFeatureId:null};s(e,this._intersector,n,(e=>Math.min(e,.05*i.farDistanceRenderSpace))),i.observerRenderSpaceOverride=w(a,r)?null:a}_unselectOtherViewsheds(e){if(null!=e)for(const t of this.view.tools.items)t!==this.tool&&t instanceof F&&(t.analysisViewData.selectedViewshed=null)}get test(){}};e([p({readOnly:!0})],I.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],I.prototype,"analysis",void 0),e([p()],I.prototype,"tool",void 0),e([p()],I.prototype,"_selectedViewshed",void 0),e([p()],I.prototype,"selectedViewshed",null),e([p()],I.prototype,"selectedViewshedComputedData",null),e([p()],I.prototype,"viewshedComputedDataHandles",void 0),e([p()],I.prototype,"userOperation",void 0),e([p()],I.prototype,"_analysisVisualization",void 0),e([p()],I.prototype,"_viewshedRenderer",void 0),I=e([m("esri.views.3d.analysis.ViewshedAnalysisView3D")],I);const T=I,x=j();export{T as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as e,s as r,g as
|
|
5
|
+
import{c as e,s as r,g as t,d as n,f as i,e as o,l as s}from"../../../chunks/vec32.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{containsPoint as l}from"../../../geometry/support/aaBoundingRect.js";import d from"../webgl/RenderCamera.js";import{DepthRange as g}from"../webgl-engine/lib/DepthRange.js";import{Intersector as f}from"../webgl-engine/lib/Intersector.js";function u(e,r,t,n){return null!=e.renderCoordsHelper.fromRenderCoords(r.eye,M,n)&&l(t,M)}function m(e,r){return e.elevationProvider?e.elevationProvider.getElevation(r[0],r[1],r[2],e.renderCoordsHelper.spatialReference,"ground")??0:0}function p(o,s,a,c){const l=o.state.camera.clone();s&&a&&c&&(l.eye=s,l.center=a,l.up=c),v(o,l.ray,j)||e(j,l.center);const d=o.state.constraints,g=d.minimumPoiDistance;if(r(l.eye,j)<g){const r=d.collision.enabled;e(R,l.viewForward),t(R,R,g),r?l.eye=n(M,j,R):i(j,l.eye,R);const s=o.renderCoordsHelper,a=s.getAltitude(l.eye),c=d.collision.elevationMargin;r&&a<c&&(n(R,j,l.eye),l.eye=s.setAltitude(M,c,l.eye),i(j,l.eye,R))}return l.center=j,l}function y(e,t,n){if(!e.state.isGlobal||!e.stateManager.constraintsManager)return!1;const i=m(e,t),o=e.stateManager.constraintsManager.nearFarHeuristic;let s=C.get(e);void 0===s&&(s=new d,C.set(e,s)),s.eye=t,s.center=n;const{far:a}=o.compute(s,e.renderDataExtent,g.infinite,i),c=a*a;return r(t,n)>c}function v(e,r,t){let n=w[e.viewingMode];n||(n=new f(e.state.viewingMode),n.options.backfacesTerrain=!e.state.isGlobal,n.options.invisibleTerrain=!0,w[e.viewingMode]=n);const{isGlobal:i}=e.state;return!(!e.sceneIntersectionHelper.intersectRay(r,n,t)||y(e,r.origin,t))||(!(!e.renderCoordsHelper.intersectManifold(r,0,t)||y(e,r.origin,t))||!!i&&b(r,t,c(e.spatialReference).radius))}function b(e,r,n){const a=o(e.origin,e.origin)-n*n,c=a>0?Math.sqrt(a)/3:1;return t(r,e.direction,c/s(e.direction)),i(r,r,e.origin),!0}const w={},M=a(),j=a(),R=a(),C=new WeakMap;export{p as cameraOnContentAlongViewDirection,u as eyeWithinExtent,m as surfaceElevationBelowRenderLocation};
|
|
@@ -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"../../../../Color.js";import{result as t,createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import has from"../../../../core/has.js";import{clone as s}from"../../../../core/lang.js";import{abortMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as n,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{pt2px as c,px2pt as h}from"../../../../core/screenUtils.js";import{numericHash as u}from"../../../../core/string.js";import{dataComponents as m}from"../../../../core/urlUtils.js";import{fromValues as d,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as _,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y,ZEROS as g,fromValues as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as b}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as v}from"../../../../geometry/support/aaBoundingBox.js";import S from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as P}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as w}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as R}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as z}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as C}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as O}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as j}from"../../../../symbols/support/utils.js";import{transparentUnit as I}from"./constants.js";import{perObjectElevationAligner as M}from"./ElevationAligners.js";import{SymbolUpdateType as E,elevationModeChangeUpdateType as T,needsElevationUpdates2D as F}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as U}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as D}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as A}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as L}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as G}from"./graphicUtils.js";import{ApplyRendererDiffResult as V}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as H}from"./placementUtils.js";import{placePointOnGeometry as k,updateStageObjectGeometry as B,getLocalOriginForPoint as N,extendPointGraphicElevationContext as $,createStageObject as W}from"./pointUtils.js";import{initFastSymbolUpdatesState as q,updateFastSymbolUpdatesState as J,evaluateModelTransformScale as Z,ConvertOptions as K}from"../support/FastSymbolUpdates.js";import{createTexture as Q,requiresHalfTexelOffset as X,defaultBoundingBox as Y,defaultSymbolSizeRatio as ee,defaultTexSize as te}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as re}from"../../terrain/OverlayRenderer.js";import{createPointGeometry as ie}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as se}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as oe}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as ae}from"../../webgl-engine/materials/HUDMaterial.js";const ne=_(0,0,1),le=16,ce=1.5,he=[te*ee,te*ee];class ue extends L{static{this.PRIMITIVE_SIZE=he}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:E.UPDATE,staysOnTheGround:E.NONE,onTheGroundChanged:E.RECREATE}}constructor(e,t,r,i){super(e,t,r,i,ge(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=j(this.symbolLayer),i=pe(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=G(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?c(e.size):le);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let i=this._cimData;if(r&&i&&i.symbol||this.logger.error("Can't create texture, CIM data is undefined"),i.primitiveOverrides){i=s(i);const o=i.primitiveOverrides;r.evaluateOverrides(o,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(i.symbol,o)}const o=u(JSON.stringify(i));let a=this._cimSymbolTextures.get(o);if(a)return a;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(i.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?R(this._cimScaleFactorOrFunction,e):1;1!==c&&i.symbol&&z(i.symbol,c,!0);const h=w.getEnvelope(i,null,n.resourceManager);if(h?.width&&h.height){const e=h.x+h.width/2,t=h.y+h.height/2,r=n.rasterize({type:"cim",data:i},h.width,h.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),s=new O({x:-h.x/h.width-.5,y:(h.height+h.y)/h.height-.5});this._cimMaterialParametersInfo.anchorPosition=_e("relative",s),a=new oe(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new oe(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(o,a),this._context.stage.addTexture(a),a}_prepareMaterialParameters(){const e={anchorPosition:_e(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;if(me(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:c(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=!has("disable-feature:non-occluded-hud");return e.occlusionTest=!r,e.occludedFragmentFade=r,e.horizonCullingEnabled=r&&this._context.spherical,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(de(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>Q(t)));this._textureHandle=r,e.textureId=r.texture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=X(t),e.distanceFieldBoundingBox=Y;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/ee,this._createMaterial(e)}async _prepareResourcesHref(e,r,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),a=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(r,a,{signal:s}));if(!1===l.ok){n(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${r})`)}this._textureHandle=l.value;const c=l.value.texture;this._size=fe(c,o),e.textureId=c.id}this._createMaterial(e)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;l(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference))}const s=this._context.sharedResources.cimSymbolRasterizer,o=[],a=t,n=a?.symbol;w.fetchResources(n,s.resourceManager,o,r),w.fetchFonts(n,s.resourceManager,o);const c=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},a?.primitiveOverrides&&o.push(i.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),o.length>0&&(await Promise.all(o),l(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await P(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new S(c);this._cimScaleFactorOrFunction=(e,t,o)=>{const a=i(r,e,{$view:o},"esriGeometryPoint",s,t);return null!==a?a:1}}}l(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return ye(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(c(t.outline.size),0);return e=de(this._getPrimitive())?ce:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(de(this._getPrimitive()))return I;const e=null==this._getPrimitive(),t=this.symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;if(null==t){return null==this._getPrimitive()?y:g}return e.toUnitRGBA(t)}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(c(t)):le)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new ae(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new ae(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=U(e.color,r),e.outlineColor=U(e.outlineColor,r),this._materials[1]=new ae(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=o(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.removeTexture(e))),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?c(r)/t:"number"==typeof s&&isFinite(s)?c(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=k(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const o=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),a={textureId:r.id,isFocused:o,...this._cimMaterialParametersInfo};i=this._createMaterial(a);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=o?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getVertexOpacityAndColor(a,this._getFallbackOpacityAndColor()),l=this._getDrivenRotation(a);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=d(s[0]*c,s[1]*c),u=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})}))}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:r,stageObject:i}=e;if(r.mode!==this.getGeometryElevationMode(t))return!1;const s=k(t);if(!s)return!1;const o=B(i,this._context,s,r);if(null==o)return!1;const a=N(this._context,s);return i.geometries[0].localOrigin===a&&(e.alignedSampledElevation=o,$(e,s,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(ue.elevationModeChangeTypes,r,i);if(s!==E.UPDATE)return s;const o=F(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return V.RecreateSymbol;if(!J(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return V.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return V.FastUpdate}updateFocus(e,t){t.forEach((t=>{const r=k(t.graphic.geometry);if(null==r)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const i=this.view.focusAreasView?.containsGeometry(r)??!0;t.layers.forEach((r=>{if(r?.graphics3DSymbolLayer===this&&r.stageObject){r.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i))&&e(t)}}))}))}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(e,s){if(!s.resource||"partial"!==s.resource.type)return;const c=s.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=pe(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;e.symbolLayerStatePatches.push((()=>{this._patchTask=o(this._patchTask),this._patchTask=r((e=>this._context.schedule((async(e,r)=>{const s=await t(u.fromUrl(h,d,{signal:r}));l(r);const o=!s.ok;if(o&&n(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,o){this._forEachMaterial((e=>{e.visible=!1,e.setParameters({textureId:null})}));const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new i("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.texture;this._size=fe(c,m),this._forEachMaterial((e=>{e.setParameters({textureId:c.id}),e.visible=!0}))}),e)))})),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push((()=>{this._forEachMaterial((e=>e.setParameters({rotation:r,hasRotation:i})))})),delete t.angle}_defaultElevationInfoNoZ(){return xe}_createAs3DShape(e,t,r,i,s,o,a,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=ie(r,{normal:ne,color:i,rotation:s,size:o,centerOffsetAndDistance:be,featureAttribute:l,objectAndLayerIdColor:h}),m=W(this._context,t,u,a,n);if(null==m)return null;const d=new A(this,m.object,null,M,a);return d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=F(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),$(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=f();b(t,a,this._context.overlaySR),a[2]=re;const n=this._context.clippingExtent;if(null!=n&&!v(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=ie(r,{normal:ne,position:a,color:i,rotation:s,size:o,featureAttribute:l,objectAndLayerIdColor:u}),d=new se(m,{layerViewUid:h,graphicUid:c}),p=new D(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=p())=>{const[o,a]=Z(ve,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=_(e,e,e),r=h(1),i=e*r,s=_(i,i,i),o=this._getFallbackSize();return new K({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:_(o,o,o)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function me(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function de(e){return null!=e&&("cross"===e||"x"===e)}function pe(e){const t=m(e);return"application/json"===t?.mediaType?t.data:void 0}function _e(e,t){return"relative"===e?d((t.x||0)+.5,.5-(t.y||0)):e in H?H[e]:H.center}function fe({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function ye(e){return e.resource?.href?null:e.resource?.primitive??C}function ge(e){return 1===(e.material?.color?.a??1)&&null!=ye(e)}const xe={mode:"relative-to-ground",offset:0},be=x(0,0,0,1),ve=f();export{ue as Graphics3DIconSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import{result as t,createTask as r}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import has from"../../../../core/has.js";import{clone as s}from"../../../../core/lang.js";import{abortMaybe as o,releaseMaybe as a}from"../../../../core/maybe.js";import{throwIfAbortError as n,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{pt2px as c,px2pt as h}from"../../../../core/screenUtils.js";import{numericHash as u}from"../../../../core/string.js";import{dataComponents as m}from"../../../../core/urlUtils.js";import{fromValues as d,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as _,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as y,ZEROS as g,fromValues as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPointToVector as b}from"../../../../geometry/projection/projectPointToVector.js";import{containsPoint as v}from"../../../../geometry/support/aaBoundingBox.js";import S from"../../../../layers/support/FieldsIndex.js";import{createRendererExpression as P}from"../../../../support/ArcadeExpression.js";import{CIMSymbolHelper as w}from"../../../../symbols/cim/CIMSymbolHelper.js";import{evaluateValueOrFunction as R}from"../../../../symbols/cim/utils.js";import{scaleCIMSymbol as z}from"../../../../symbols/support/cimSymbolUtils.js";import{defaultPrimitive as C}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{Symbol3DAnchorPosition2D as O}from"../../../../symbols/support/Symbol3DAnchorPosition2D.js";import{getIconHref as j}from"../../../../symbols/support/utils.js";import{transparentUnit as I}from"./constants.js";import{perObjectElevationAligner as M}from"./ElevationAligners.js";import{SymbolUpdateType as E,elevationModeChangeUpdateType as T,needsElevationUpdates2D as F}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as U}from"./focusAreaStyle.js";import{Graphics3DDrapedGraphicLayer as D}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as A}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as G}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as L}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as H}from"./placementUtils.js";import{placePointOnGeometry as k,updateStageObjectGeometry as B,getLocalOriginForPoint as N,extendPointGraphicElevationContext as $,createStageObject as q}from"./pointUtils.js";import{initFastSymbolUpdatesState as J,updateFastSymbolUpdatesState as Z,evaluateModelTransformScale as W,ConvertOptions as K}from"../support/FastSymbolUpdates.js";import{createTexture as Q,requiresHalfTexelOffset as X,defaultBoundingBox as Y,defaultSymbolSizeRatio as ee,defaultTexSize as te}from"../../support/engineContent/sdfPrimitives.js";import{drapedZ as re}from"../../terrain/OverlayRenderer.js";import{VerticalOffsetParameters as ie}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{createPointGeometry as se}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as oe}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as ae}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as ne}from"../../webgl-engine/materials/HUDMaterial.js";const le=_(0,0,1),ce=16,he=1.5,ue=[te*ee,te*ee];class me extends G{static{this.PRIMITIVE_SIZE=ue}getCachedSize(){return{size:this._getIconSize()}}static{this.elevationModeChangeTypes={definedChanged:E.UPDATE,staysOnTheGround:E.NONE,onTheGroundChanged:E.RECREATE}}constructor(e,t,r,i){super(e,t,r,i,xe(t)),this._cimData=null,this._overrideHelperClass=null,this._arcadeInfo=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._textureHandle=null,this._patchTask=null,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=j(this.symbolLayer),i=_e(r);null!=i?await this._prepareResourcesCIM(t,JSON.parse(i),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=V(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?c(e.size):ce);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e,t){const r=this._overrideHelperClass;let i=this._cimData;if(r&&i&&i.symbol||this.logger.error("Can't create texture, CIM data is undefined"),i.primitiveOverrides){i=s(i);const o=i.primitiveOverrides;r.evaluateOverrides(o,e,this._arcadeInfo.geometryType,null,null,t.layer.fieldsIndex),r.applyOverrides(i.symbol,o)}const o=u(JSON.stringify(i));let a=this._cimSymbolTextures.get(o);if(a)return a;const n=this._context.sharedResources.cimSymbolRasterizer,l=this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null;l&&r.applyDictionaryTextOverrides(i.symbol,e,l,null);const c=null!=this._cimScaleFactorOrFunction?R(this._cimScaleFactorOrFunction,e):1;1!==c&&i.symbol&&z(i.symbol,c,!0);const h=w.getEnvelope(i,null,n.resourceManager);if(h?.width&&h.height){const e=h.x+h.width/2,t=h.y+h.height/2,r=n.rasterize({type:"cim",data:i},h.width,h.height,e,t,1,"esriGeometryPoint",0,null,this._context.graphicsCoreOwner.view.state.rasterPixelRatio),s=new O({x:-h.x/h.width-.5,y:(h.height+h.y)/h.height-.5});this._cimMaterialParametersInfo.anchorPosition=fe("relative",s),a=new ae(r,{width:r?.width??1,height:r?.height??1,reloadable:!0})}else a=new ae(new ImageData(1,1),{width:1,height:1,reloadable:!0});return this._cimSymbolTextures.set(o,a),this._context.stage.addTexture(a),a}_prepareMaterialParameters(){const e={anchorPosition:fe(this.symbolLayer.anchor,this.symbolLayer.anchorPosition),rotation:this.symbolLayer.angle},t=this.symbol;de(t)&&(e.verticalOffset=new ie(t.verticalOffset)),this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),(0!==e.rotation||this._drivenProperties.rotation)&&(e.hasRotation=!0);const r=!has("disable-feature:non-occluded-hud");return e.occlusionTest=!r,e.occludedFragmentFade=r,e.horizonCullingEnabled=r&&this._context.spherical,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(pe(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>Q(t)));this._textureHandle=r,e.textureId=r.texture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=X(t),e.distanceFieldBoundingBox=Y;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/ee,this._createMaterial(e)}async _prepareResourcesHref(e,r,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),a=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(r,a,{signal:s}));if(!1===l.ok){n(l.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${r})`)}this._textureHandle=l.value;const c=l.value.texture;this._size=ye(c,o),e.textureId=c.id}this._createMaterial(e)}async _prepareResourcesCIM(e,t,r){const{OverrideHelper:i}=await import("../../../../symbols/cim/OverrideHelper.js");if(this._overrideHelperClass=i,this._cimData=t,!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;l(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference))}const s=this._context.sharedResources.cimSymbolRasterizer,o=[],a=t,n=a?.symbol;w.fetchResources(n,s.resourceManager,o,r),w.fetchFonts(n,s.resourceManager,o);const c=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):[],h=this._context.renderCoordsHelper.spatialReference;if(this._arcadeInfo={spatialReference:h,fields:c,geometryType:"esriGeometryPoint"},a?.primitiveOverrides&&o.push(i.createRenderExpressions(a.primitiveOverrides,this._arcadeInfo)),o.length>0&&(await Promise.all(o),l(r)),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(e.scaleExpression){const t=e.scaleExpression,r=await P(t,this._context.layer.spatialReference),{default:i}=await import("../../../2d/arcade/callExpressionWithFeature.js"),s=new S(c);this._cimScaleFactorOrFunction=(e,t,o)=>{const a=i(r,e,{$view:o},"esriGeometryPoint",s,t);return null!==a?a:1}}}l(r),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return ge(this.symbolLayer)}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline?.size)return Math.max(c(t.outline.size),0);return e=pe(this._getPrimitive())?he:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),s=i.a*t;return[r[0],r[1],r[2],s]}return[0,0,0,0]}_getFillColor(){if(pe(this._getPrimitive()))return I;const e=null==this._getPrimitive(),t=this.symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;if(null==t){return null==this._getPrimitive()?y:g}return e.toUnitRGBA(t)}_getFallbackSize(){const e=this._getIconSize(),{symbolLayer:{size:t}}=this;return(null!=t?Math.round(c(t)):ce)/e}_createMaterial(e){const t=this._context.spherical;if(this._cimData){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new ne(e,t),this._cimSymbolMaterials.set(e.textureId??0,r)),r}this._fastUpdates=J(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new ne(e,t),e.isFocused=!1;const r=this.view.map?.focusAreas.style;return e.color=U(e.color,r),e.outlineColor=U(e.outlineColor,r),this._materials[1]=new ne(e,t),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,draped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._patchTask=o(this._patchTask),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.removeTexture(e))),this._cimSymbolTextures.clear(),this._textureHandle=a(this._textureHandle)}_getScaleFactor({size:e},t){if(!this._drivenProperties.size)return 1;if(null==e)return this._getFallbackSize();const[r,i,s]=e;return"symbol-value"===r?1:"number"==typeof r&&isFinite(r)?c(r)/t:"number"==typeof s&&isFinite(s)?c(s)/t:1}_getDrivenRotation(e){return this._drivenProperties.rotation?e.heading??0:0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const r=k(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;let i,s=[0,0];const o=this.view.focusAreasView?.containsGeometry(r)??!0;if(this._cimData){if(!this._cimData.symbol)return null;const r=this._generateTextureCIM(t,e),a={textureId:r.id,isFocused:o,...this._cimMaterialParametersInfo};i=this._createMaterial(a);const n=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;s=[r.parameters.width/n,r.parameters.height/n]}else s=this._size,i=o?this._materials[0]:this._materials[1];if(null==r)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,n=this._getVertexOpacityAndColor(a,this._getFallbackOpacityAndColor()),l=this._getDrivenRotation(a);let c=1;if(!this._fastUpdates?.visualVariables.size){const e=s[0]>s[1]?s[0]:s[1];c=this._getScaleFactor(a,e)}c*=this._symbolTextureRatio;const h=d(s[0]*c,s[1]*c),u=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===u.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,r,i,n,l,h):this._createAs3DShape(t,r,i,n,l,h,u,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})}))}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:r,stageObject:i}=e;if(r.mode!==this.getGeometryElevationMode(t))return!1;const s=k(t);if(!s)return!1;const o=B(i,this._context,s,r);if(null==o)return!1;const a=N(this._context,s);return i.geometries[0].localOrigin===a&&(e.alignedSampledElevation=o,$(e,s,this._context.elevationProvider),!0)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(me.elevationModeChangeTypes,r,i);if(s!==E.UPDATE)return s;const o=F(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>o))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return L.RecreateSymbol;if(!Z(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return L.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return L.FastUpdate}updateFocus(e,t){t.forEach((t=>{const r=k(t.graphic.geometry);if(null==r)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const i=this.view.focusAreasView?.containsGeometry(r)??!0;t.layers.forEach((r=>{if(r?.graphics3DSymbolLayer===this&&r.stageObject){r.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i))&&e(t)}}))}))}prepareSymbolLayerPatch(e){if(this._patchTask?.abort(),"partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchResource(e,t),this._preparePatchRotation(e,t)}_preparePatchResource(e,s){if(!s.resource||"partial"!==s.resource.type)return;const c=s.resource.diff;if("complete"!==c?.href?.type)return;const h=c.href.newValue,{textures:u}=this._context.sharedResources;if(null==h||null==u||null!=_e(h))return;const m=this._getIconSize(),d=m*this._context.graphicsCoreOwner.view.state.pixelRatio;e.symbolLayerStatePatches.push((()=>{this._patchTask=o(this._patchTask),this._patchTask=r((e=>this._context.schedule((async(e,r)=>{const s=await t(u.fromUrl(h,d,{signal:r}));l(r);const o=!s.ok;if(o&&n(s.error),this._textureHandle=a(this._textureHandle),this._patchTask=null,o){this._forEachMaterial((e=>{e.visible=!1,e.setParameters({textureId:null})}));const e=`Failed to load (Request for icon resource failed: ${h})`;return void this.logger.error(new i("graphics3diconsymbollayer:request-failed",e))}this._textureHandle=s.value;const c=s.value.texture;this._size=ye(c,m),this._forEachMaterial((e=>{e.setParameters({textureId:c.id}),e.visible=!0}))}),e)))})),delete c.href}_preparePatchRotation(e,t){if(!t.angle||"complete"!==t.angle.type)return;const r=t.angle.newValue??0,i=0!==r||this._drivenProperties.rotation;e.symbolLayerStatePatches.push((()=>{this._forEachMaterial((e=>e.setParameters({rotation:r,hasRotation:i})))})),delete t.angle}_defaultElevationInfoNoZ(){return be}_createAs3DShape(e,t,r,i,s,o,a,n){const l=this.getFastUpdateAttrValues(e),c=this._context.layerViewUid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:c}),u=se(r,{normal:le,color:i,rotation:s,size:o,centerOffsetAndDistance:ve,featureAttribute:l,objectAndLayerIdColor:h}),m=q(this._context,t,u,a,n);if(null==m)return null;const d=new A(this,m.object,null,M,a);return d.alignedSampledElevation=m.sampledElevation,d.needsElevationUpdates=F(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(o,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),$(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,o){r.renderPriority=this._renderPriority;const a=f();b(t,a,this._context.overlaySR),a[2]=re;const n=this._context.clippingExtent;if(null!=n&&!v(n,a))return null;const l=this.getFastUpdateAttrValues(e),c=e.uid,h=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:h}),m=se(r,{normal:le,position:a,color:i,rotation:s,size:o,featureAttribute:l,objectAndLayerIdColor:u}),d=new oe(m,{layerViewUid:h,graphicUid:c}),p=new D(this,[d],null,this._context.drapeSourceRenderer);return p.getScreenSize=this._createScreenSizeGetter(o,l),p.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(p.getScreenSize(),1,e),p}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=p())=>{const[o,a]=W(Se,this._fastUpdates.materialParameters,t);return e[0]=o*i+r,e[1]=a*s+r,e}}const i=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(e=p())=>(e[0]=i,e[1]=s,e)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=_(e,e,e),r=h(1),i=e*r,s=_(i,i,i),o=this._getFallbackSize();return new K({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:t,symbolSize:s,unitInMeters:r,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:_(o,o,o)})}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}}function de(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function pe(e){return null!=e&&("cross"===e||"x"===e)}function _e(e){const t=m(e);return"application/json"===t?.mediaType?t.data:void 0}function fe(e,t){return"relative"===e?d((t.x||0)+.5,.5-(t.y||0)):e in H?H[e]:H.center}function ye({parameters:e},t){const r=(e.width??1)/(e.height??1);return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}function ge(e){return e.resource?.href?null:e.resource?.primitive??C}function xe(e){return 1===(e.material?.color?.a??1)&&null!=ge(e)}const be={mode:"relative-to-ground",offset:0},ve=x(0,0,0,1),Se=f();export{me as Graphics3DIconSymbolLayer};
|
|
@@ -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"../../../../Color.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as r,scale as i,translate as o,copy as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l,u as c,c as h,C as d,f as m,i as p}from"../../../../chunks/vec32.js";import{fromArray as u,ONES as f,create as y,ZEROS as _,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as b,ONES as x,ZEROS as P,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as v}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as L}from"../../../../geometry/projection/projectPointToVector.js";import{create as S,size as C,containsPoint as w,center as U}from"../../../../geometry/support/aaBoundingBox.js";import{EmissiveSourceMode as j,getEmissiveMode as O}from"../../../../symbols/support/materialUtils.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as T,objectSymbolLayerSizeWithResourceSize as B}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as G,defaultSymbolLayerMemoryComplexity as I}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as A}from"./ElevationAligners.js";import{needsElevationUpdates3D as F,SampleElevationInfo as D,evaluateElevationInfoAtPoint as z}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as V}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as k}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as H,computeObjectScale as M,computeObjectRotation as W}from"./graphicUtils.js";import{ApplyRendererDiffResult as q}from"./interfaces.js";import{LoadStatus as N}from"./Loadable.js";import{makeLodResources as $}from"./lodResourceUtils.js";import{fetch as Z}from"./objectResourceUtils.js";import{placePointOnGeometry as J,extendPointGraphicElevationContext as K}from"./pointUtils.js";import{isValidPrimitive as Q,primitiveLodResources as X}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as Y}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as ee}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as te,updateFastSymbolUpdatesState as se,ConvertOptions as re,evaluateModelTransformScale as ie,evaluateModelTransform as oe}from"../support/FastSymbolUpdates.js";import{olidEnabled as ae}from"../../webgl-engine/effects/geometry/olidUtils.js";import{CullFaceOptions as ne}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as le}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ce}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as he}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as de}from"../../webgl-engine/materials/pbrUtils.js";class me{constructor(e,t,s,r,i,o,a,n,l,c,h=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=o,this.resourceBoundingBox=a,this.symbolSize=n,this.extentPadding=l,this.physicalBasedRenderingEnabled=c,this.pivotOffset=h}}class pe extends k{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r,ye(t)),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){const e=H(this.symbolLayer);if(e)throw new Error(e)}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&Q(t?.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await ee(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return null!=this._primitive}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(t,r){const i=this.symbolLayer,o=S(T(t)),a=u(C(o)),n=u(B(a,i)),c=l(n),h=!1,d=!1,m=i?.material,p={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:de,ambient:f,diffuse:f,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:i.castShadows,emissiveStrength:m?.emissive?.strength??0,emissiveSource:j.Color,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},y=!!p.usePBR,_=m?.color,g=this.symbol;if("point-3d"===g.type&&g.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=g.verticalOffset;p.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0},p.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(p.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)p.externalColor=x;else{const t=null!=_?this._drivenProperties.opacity?b([...e.toUnitRGB(_),1]):e.toUnitRGBA(_):this._drivenProperties.opacity?x:P;p.externalColor=t}this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(o,n,a,null)),p.isInstanced=!0,this._fastUpdates?(Object.assign(p,this._fastUpdates.materialParameters),this._optionalFields.push(le.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(p.hasInstancedColor=!0,this._optionalFields.push(le.COLOR)),ae()&&this._optionalFields.push(le.OLIDCOLOR);const R=new he(p,this._context);R.setParameters({cullFace:_e(R.transparent)});const v=X(t,R);if(!v)throw new Error(`Unknown object symbol primitive: ${t}`);const L=await this._createStageResources(v,y,r),w=await this._createLodRenderer(v,r);return new me(v,w,L,a,h,d,o,n,c,y)}async _createResourcesForUrl(e,t){const r={isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},i={spherical:this._context.spherical,materialParameters:r,streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParameters,this._fastUpdates.materialParameters),this._optionalFields.push(le.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(i.materialParameters.hasInstancedColor=!0,this._optionalFields.push(le.COLOR)),ae()&&this._optionalFields.push(le.OLIDCOLOR);const o=this.symbol;if("point-3d"===o.type&&o.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=o.verticalOffset;i.materialParameters.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0},i.materialParameters.castShadows=!1}const a=this._context.physicalBasedRenderingEnabled;i.signal=t,i.usePBR=a,i.skipHighLods=this._context.skipHighSymbolLods;const n=await Z(e,i),c=n.isEsriSymbolResource,h=n.isWosr,d=$(n.lods),m=this._context,p=this.symbolLayer.material,f=this._getExternalColorParameters(p),y=this.needsDrivenTransparentPass,_=d.getMaterials();_.forEach((e=>{e.setParameters({...f,drivenOpacity:y}),m.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:m.sharedResources.screenSizePerspectiveSettings})}));const g=n.referenceBoundingBox,b=u(C(g)),x=u(d.levels[0].pivotOffset),P=u(B(b,this.symbolLayer)),R=l(P),v=this._fastUpdates;se(v,this._context.renderer,this._fastVisualVariableConvertOptions(g,P,b,x))&&_.forEach((e=>e.setParameters(v.materialParameters)));const L=await this._createStageResources(d,a,t),S=await this._createLodRenderer(d,t);return new me(d,S,L,b,c,h,g,P,R,a,x)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,s,r){const i=this._context.stage,o=e.getMaterials();s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();const a=e.getTextures();i.addTextures(a),this._addDisposeResource((()=>{a.forEach((e=>e.unload())),i.removeTextures(a)})),await Promise.all(a.map((e=>this._context.stage.schedule((()=>e.load(i.renderView.renderingContext)),r)))),t(r);const n=e.getEngineGeometries();return{materials:o,textures:a,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,o=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,Pe),a(s,oe(i.materialParameters,Pe,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,Pe),ie(e,i.materialParameters,Pe)}}:null,n=new ce({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:o},this._context.scheduler);return n.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(n),n.destroy()})),await s.addRenderPlugin(n,t),n}_getExternalColorParameters(t){const s={};if(this._drivenProperties.color)s.externalColor=x;else if(null!=t?.color){const r=e.toUnitRGBA(t.color);this._drivenProperties.opacity&&(r[3]=1),s.externalColor=r}else s.externalColor=x,s.colorMixMode="ignore";return s.emissiveStrength=t?.emissive?.strength??1,s.emissiveSource=O(t?.emissive?.source??"emissive"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=J(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let s=0;s<t.length;s++){const r=t[s];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:_e(r.transparent)})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,F)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return q.RecreateSymbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:o,resourceSize:a,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return q.RecreateSymbol;if(!se(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,o,a,n)))return q.RecreateSymbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return q.FastUpdate}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=G(e.levels),s=e.computeUsedMemory(),r={...I(this.symbol,this.symbolLayer),resourceBytes:s};return new Y({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),a=this._context.clippingExtent;if(L(t,ge,this._context.elevationProvider.spatialReference),null!=a&&!w(a,ge))return null;const n=fe(r),l=this._computeGlobalTransform(t,r,xe,Re),c=this._computeLocalTransform(this._resources,this.symbolLayer,s,be),h=this._resources.lodRenderer.instanceData,d=h.addInstance();if(this._instanceIndexToGraphicUid.set(d,i),h.setLocalTransform(d,c,!1),h.setGlobalTransform(d,l),o&&h.setFeatureAttribute(d,o),null==this._fastUpdates&&this._hasPerInstanceColor()){const e=this._getVertexOpacityAndColor(s,this._getFallbackOpacityAndColor(),255);h.setColor(d,e)}const m=this._context.stage.renderView.olidRenderHelper;if(m){const e=m.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:this._context.layerViewUid});h.setObjectAndLayerIdColor(d,e)}const p=new V(this,d,A,r,this._context.stage.view.state.highlightOrderMap);return n&&(p.alignedSampledElevation=Re.sampledElevation),p.needsElevationUpdates=F(r.mode),K(p,t,this._context.elevationProvider),p}_computeGlobalTransform(e,t,s,r){return z(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),ge[0]=e.x,ge[1]=e.y,ge[2]=r.z,v(e.spatialReference,ge,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,i){return r(i),this._applyObjectRotation(s,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,s,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,o=M(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===o[0]&&1===o[1]&&1===o[2]||i(s,s,o)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&J(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,xe,Re),fe(e.elevationContext)&&(e.alignedSampledElevation=Re.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,xe,!0),K(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),o=s(t.roll,this.symbolLayer.roll,0),a=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:o,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===N.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=u(B(m.resourceSize,{width:a,height:n,depth:l,isPrimitive:this._isPrimitive}))})),e.graphics3DGraphicPatches.push((({instanceIndex:e},t)=>{const s=this._computeLocalTransform(m,d,t,be);m.lodRenderer.instanceData.setLocalTransform(e,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,o=null!=i?e.toUnitRGBA(i):x;delete r.color;const a=this._resources;if(null==a)return;const n=this._isPrimitive;t.graphics3DGraphicPatches.push((({instanceIndex:e})=>{if(this._hasPerInstanceColor())a.lodRenderer.instanceData.setColor(e,o);else{const e={externalColor:o};for(const t of a.stageResources.materials)t.setParameters(e),n&&t.setParameters({cullFace:_e(t.transparent)})}}))}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return W(e.heading,e.tilt,e.roll,s)}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=ue(e.resourceBoundingBox,e.pivotOffset,t);r&&o(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?u(C(e)):f,o=null!=e?ue(e,r,this.symbolLayer):_,a=this._context.renderCoordsHelper.unitInMeters,n=M(null!=t?t:void 0,t,s,a),l=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new re({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??f,unitInMeters:a,anchor:o,scale:n,rotation:l,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:n})}get _primitive(){const{resource:e}=this.symbolLayer;return null!=e?.href?null:e?.primitive??E}_getFallbackOpacityAndColor(){const t=this.symbolLayer.material?.color;if(null==t){return null==this._primitive?x:P}return e.toUnitRGBA(t)}}function ue(e,t,s){const r=y();switch(s.anchor){case"center":h(r,U(e)),c(r,r);break;case"top":{const t=U(e);p(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=U(e);p(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=U(e),i=C(e),o=s.anchorPosition,a=o?g(o.x,o.y,o.z):_;d(r,i,a),m(r,r,t),c(r,r);break}default:null!=t?c(r,t):h(r,_)}return r}function fe(e){return"absolute-height"!==e.mode}function ye(e){return 1===(e.material?.color?.a??1)&&null==e.resource?.href}function _e(e){return e?ne.None:ne.Back}const ge=y(),be=n(),xe=n(),Pe=R(),Re=new D;export{pe as Graphics3DObjectSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{identity as r,scale as i,translate as o,copy as a}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{l,u as c,c as h,C as d,f as m,i as p}from"../../../../chunks/vec32.js";import{fromArray as u,ONES as f,create as y,ZEROS as _,fromValues as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as b,ONES as P,ZEROS as x,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as v}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVector as S}from"../../../../geometry/projection/projectPointToVector.js";import{create as C,size as L,containsPoint as w,center as U}from"../../../../geometry/support/aaBoundingBox.js";import{EmissiveSourceMode as j,getEmissiveMode as O}from"../../../../symbols/support/materialUtils.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as T,objectSymbolLayerSizeWithResourceSize as B}from"../../../../symbols/support/symbolLayerUtils3D.js";import{estimateNumVerticesForLods as G,defaultSymbolLayerMemoryComplexity as I}from"./defaultSymbolComplexity.js";import{perLodInstanceElevationAligner as A}from"./ElevationAligners.js";import{needsElevationUpdates3D as F,SampleElevationInfo as D,evaluateElevationInfoAtPoint as V}from"./elevationAlignmentUtils.js";import{Graphics3DLodInstanceGraphicLayer as z}from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as k}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as H,computeObjectScale as M,computeObjectRotation as W}from"./graphicUtils.js";import{ApplyRendererDiffResult as q}from"./interfaces.js";import{LoadStatus as N}from"./Loadable.js";import{makeLodResources as $}from"./lodResourceUtils.js";import{fetch as Z}from"./objectResourceUtils.js";import{placePointOnGeometry as J,extendPointGraphicElevationContext as K}from"./pointUtils.js";import{isValidPrimitive as Q,primitiveLodResources as X}from"./primitiveObjectSymbolUtils.js";import{SymbolComplexity as Y}from"./SymbolComplexity.js";import{getResourceUrlFromSymbolStyle as ee}from"./webStyleUtils.js";import{initFastSymbolUpdatesState as te,updateFastSymbolUpdatesState as se,ConvertOptions as re,evaluateModelTransformScale as ie,evaluateModelTransform as oe}from"../support/FastSymbolUpdates.js";import{VerticalOffsetParameters as ae}from"../../webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js";import{olidEnabled as ne}from"../../webgl-engine/effects/geometry/olidUtils.js";import{CullFaceOptions as le}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ce}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as he}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{DefaultMaterial as de}from"../../webgl-engine/materials/DefaultMaterial.js";import{schematicMRRFactors as me}from"../../webgl-engine/materials/pbrUtils.js";class pe{constructor(e,t,s,r,i,o,a,n,l,c,h=null){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.resourceSize=r,this.isEsriSymbolResource=i,this.isWosr=o,this.resourceBoundingBox=a,this.symbolSize=n,this.extentPadding=l,this.physicalBasedRenderingEnabled=c,this.pivotOffset=h}}class ue extends k{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r,_e(t)),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){const e=H(this.symbolLayer);if(e)throw new Error(e)}if(this._isPrimitive){const t=this.symbolLayer.resource,s=t&&Q(t?.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else{const t=await ee(this.symbol.styleOrigin),s=t?.href??this.symbolLayer.resource?.href;this._resources=await this._createResourcesForUrl(s,e)}this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.updateComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return null!=this._primitive}get lodRenderer(){return this._resources?.lodRenderer}get materials(){return this._resources?.stageResources.materials??[]}async _createResourcesForPrimitive(t,s){const r=this.symbolLayer,i=C(T(t)),o=u(L(i)),a=u(B(o,r)),n=l(a),c=!1,h=!1,d=r?.material,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:me,ambient:f,diffuse:f,opacity:1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:r.castShadows,emissiveStrength:d?.emissive?.strength??0,emissiveSource:j.Color,offsetTransparentBackfaces:!1,drivenOpacity:this.needsDrivenTransparentPass},p=!!m.usePBR,y=d?.color,_=this.symbol;if("point-3d"===_.type&&_.verticalOffset&&(m.verticalOffset=new ae(_.verticalOffset),m.castShadows=!1),this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)m.externalColor=P;else{const t=null!=y?this._drivenProperties.opacity?b([...e.toUnitRGB(y),1]):e.toUnitRGBA(y):this._drivenProperties.opacity?P:x;m.externalColor=t}this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(i,a,o,null)),m.isInstanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),this._optionalFields.push(ce.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(m.hasInstancedColor=!0,this._optionalFields.push(ce.COLOR)),ne()&&this._optionalFields.push(ce.OLIDCOLOR);const g=new de(m,this._context);g.setParameters({cullFace:ge(g.transparent)});const R=X(t,g);if(!R)throw new Error(`Unknown object symbol primitive: ${t}`);const v=await this._createStageResources(R,p,s),S=await this._createLodRenderer(R,s);return new pe(R,S,v,o,c,h,i,a,n,p)}async _createResourcesForUrl(e,t){const r={isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},i={spherical:this._context.spherical,materialParameters:r,streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache,compressionOptions:{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}};this._fastUpdates=te(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParameters,this._fastUpdates.materialParameters),this._optionalFields.push(ce.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(i.materialParameters.hasInstancedColor=!0,this._optionalFields.push(ce.COLOR)),ne()&&this._optionalFields.push(ce.OLIDCOLOR);const o=this.symbol;if("point-3d"===o.type&&o.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=o.verticalOffset;i.materialParameters.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0},i.materialParameters.castShadows=!1}const a=this._context.physicalBasedRenderingEnabled;i.signal=t,i.usePBR=a,i.skipHighLods=this._context.skipHighSymbolLods;const n=await Z(e,i),c=n.isEsriSymbolResource,h=n.isWosr,d=$(n.lods),m=this._context,p=this.symbolLayer.material,f=this._getExternalColorParameters(p),y=this.needsDrivenTransparentPass,_=d.getMaterials();_.forEach((e=>{e.setParameters({...f,drivenOpacity:y}),m.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:m.sharedResources.screenSizePerspectiveSettings})}));const g=n.referenceBoundingBox,b=u(L(g)),P=u(d.levels[0].pivotOffset),x=u(B(b,this.symbolLayer)),R=l(x),v=this._fastUpdates;se(v,this._context.renderer,this._fastVisualVariableConvertOptions(g,x,b,P))&&_.forEach((e=>e.setParameters(v.materialParameters)));const S=await this._createStageResources(d,a,t),C=await this._createLodRenderer(d,t);return new pe(d,C,S,b,c,h,g,x,R,a,P)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,s,r){const i=this._context.stage,o=e.getMaterials();s!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged();const a=e.getTextures();i.addTextures(a),this._addDisposeResource((()=>{a.forEach((e=>e.unload())),i.removeTextures(a)})),await Promise.all(a.map((e=>this._context.stage.schedule((()=>e.load(i.renderView.renderingContext)),r)))),t(r);const n=e.getEngineGeometries();return{materials:o,textures:a,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerViewUid:this._context.layerViewUid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,o=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,Re),a(s,oe(i.materialParameters,Re,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,Re),ie(e,i.materialParameters,Re)}}:null,n=new he({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:o},this._context.scheduler);return n.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(n),n.destroy()})),await s.addRenderPlugin(n,t),n}_getExternalColorParameters(t){const s={};if(this._drivenProperties.color)s.externalColor=P;else if(null!=t?.color){const r=e.toUnitRGBA(t.color);this._drivenProperties.opacity&&(r[3]=1),s.externalColor=r}else s.externalColor=P,s.colorMixMode="ignore";return s.emissiveStrength=t?.emissive?.strength??1,s.emissiveSource=O(t?.emissive?.source??"emissive"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=J(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for object symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._getLayerOpacity(),t=this._resources.stageResources.materials;for(let s=0;s<t.length;s++){const r=t[s];r.setParameters({layerOpacity:e}),this._isPrimitive&&r.setParameters({cullFace:ge(r.transparent)})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,F)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return q.RecreateSymbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:o,resourceSize:a,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return q.RecreateSymbol;if(!se(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,o,a,n)))return q.RecreateSymbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return q.FastUpdate}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=G(e.levels),s=e.computeUsedMemory(),r={...I(this.symbol,this.symbolLayer),resourceBytes:s};return new Y({verticesPerFeature:t,memory:r})}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),a=this._context.clippingExtent;if(S(t,be,this._context.elevationProvider.spatialReference),null!=a&&!w(a,be))return null;const n=ye(r),l=this._computeGlobalTransform(t,r,xe,ve),c=this._computeLocalTransform(this._resources,this.symbolLayer,s,Pe),h=this._resources.lodRenderer.instanceData,d=h.addInstance();if(this._instanceIndexToGraphicUid.set(d,i),h.setLocalTransform(d,c,!1),h.setGlobalTransform(d,l),o&&h.setFeatureAttribute(d,o),null==this._fastUpdates&&this._hasPerInstanceColor()){const e=this._getVertexOpacityAndColor(s,this._getFallbackOpacityAndColor(),255);h.setColor(d,e)}const m=this._context.stage.renderView.olidRenderHelper;if(m){const e=m.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:this._context.layerViewUid});h.setObjectAndLayerIdColor(d,e)}const p=new z(this,d,A,r,this._context.stage.view.state.highlightOrderMap);return n&&(p.alignedSampledElevation=ve.sampledElevation),p.needsElevationUpdates=F(r.mode),K(p,t,this._context.elevationProvider),p}_computeGlobalTransform(e,t,s,r){return V(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),be[0]=e.x,be[1]=e.y,be[2]=r.z,v(e.spatialReference,be,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,i){return r(i),this._applyObjectRotation(s,!1,i),this._applyObjectRotation(t,!0,i),this._applyObjectScale(e,s,i),this._applyAnchor(e,t,i),i}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,o=M(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===o[0]&&1===o[1]&&1===o[2]||i(s,s,o)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&J(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,xe,ve),ye(e.elevationContext)&&(e.alignedSampledElevation=ve.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,xe,!0),K(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),o=s(t.roll,this.symbolLayer.roll,0),a=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:o,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===N.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=u(B(m.resourceSize,{width:a,height:n,depth:l,isPrimitive:this._isPrimitive}))})),e.graphics3DGraphicPatches.push((({instanceIndex:e},t)=>{const s=this._computeLocalTransform(m,d,t,Pe);m.lodRenderer.instanceData.setLocalTransform(e,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,o=null!=i?e.toUnitRGBA(i):P;delete r.color;const a=this._resources;if(null==a)return;const n=this._isPrimitive;t.graphics3DGraphicPatches.push((({instanceIndex:e})=>{if(this._hasPerInstanceColor())a.lodRenderer.instanceData.setColor(e,o);else{const e={externalColor:o};for(const t of a.stageResources.materials)t.setParameters(e),n&&t.setParameters({cullFace:ge(t.transparent)})}}))}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return W(e.heading,e.tilt,e.roll,s)}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=fe(e.resourceBoundingBox,e.pivotOffset,t);r&&o(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?u(L(e)):f,o=null!=e?fe(e,r,this.symbolLayer):_,a=this._context.renderCoordsHelper.unitInMeters,n=M(null!=t?t:void 0,t,s,a),l=g(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new re({supports:{size:!0,color:!0,rotation:!0,opacity:!1},modelSize:i,symbolSize:t??f,unitInMeters:a,anchor:o,scale:n,rotation:l,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:n})}get _primitive(){const{resource:e}=this.symbolLayer;return null!=e?.href?null:e?.primitive??E}_getFallbackOpacityAndColor(){const t=this.symbolLayer.material?.color;if(null==t){return null==this._primitive?P:x}return e.toUnitRGBA(t)}}function fe(e,t,s){const r=y();switch(s.anchor){case"center":h(r,U(e)),c(r,r);break;case"top":{const t=U(e);p(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=U(e);p(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=U(e),i=L(e),o=s.anchorPosition,a=o?g(o.x,o.y,o.z):_;d(r,i,a),m(r,r,t),c(r,r);break}default:null!=t?c(r,t):h(r,_)}return r}function ye(e){return"absolute-height"!==e.mode}function _e(e){return 1===(e.material?.color?.a??1)&&null==e.resource?.href}function ge(e){return e?le.None:le.Back}const be=y(),Pe=n(),xe=n(),Re=R(),ve=new D;export{ue as Graphics3DObjectSymbolLayer};
|
|
@@ -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 has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{SymbolUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{focusAreaHUDColor as d}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as y}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as v}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as x}from"./graphicUtils.js";import{LabelPlacement as b,LabelParameters as O}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as w,verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as j,horizontalPlacementToAnchorX as E,anchorFromPlacements as _,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as G,getLocalOriginForPoint as A,extendPointGraphicElevationContext as C,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as U}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as D}from"../../webgl-engine/lib/TextRenderParameters.js";import R from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as T}from"../../webgl-engine/materials/HUDMaterial.js";const V=a(0,0,1);class H extends v{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=x(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=L(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(s)??!0,o=this.symbolLayer.text;if(null==o||""===o)return null;const i=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=i&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:n}=this.symbolLayer,a=new b(i);w(n,a.screenOffset);const l=new O(a,this.symbolLayer.horizontalAlignment,P(n));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,o,l)}updateFocus(e,t){t.forEach((t=>{const s=L(t.graphic.geometry);if(null==s)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const r=this.view.focusAreasView?.containsGeometry(s)??!0;t.layers.forEach((s=>{if(s?.graphics3DSymbolLayer===this&&s.stageObject){s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==r))&&e(t)}}))}))}createLabel(e,t,s,r,o){const i=e.graphic,n=L(i.geometry);if(null==n)return this.logger.warn(`unsupported geometry type for label: ${i.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(n)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(i,n,l,t,s,r,o))}setGraphicElevationContext(e,t=new p,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return W(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),h.UPDATE}slicePlaneEnabledChanged(e,t){return W(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=u(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const o=L(t);if(!o)return!1;const i=G(r,this._context,o,s);if(null==i)return!1;const n=A(this._context,o);return r.geometries[0].localOrigin===n&&(e.alignedSampledElevation=i,C(e,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,h,v=null,x=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new p,m.placement.elevationOffset),O=
|
|
5
|
+
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{SymbolUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{focusAreaHUDColor as d}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as y}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as v}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as x}from"./graphicUtils.js";import{LabelPlacement as b,LabelParameters as O}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as w,verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as j,horizontalPlacementToAnchorX as E,anchorFromPlacements as _,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as G,getLocalOriginForPoint as A,extendPointGraphicElevationContext as C,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as U}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as D}from"../../webgl-engine/lib/TextRenderParameters.js";import R from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as T}from"../../webgl-engine/materials/HUDMaterial.js";const V=a(0,0,1);class H extends v{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=x(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=L(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(s)??!0,o=this.symbolLayer.text;if(null==o||""===o)return null;const i=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=i&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:n}=this.symbolLayer,a=new b(i);w(n,a.screenOffset);const l=new O(a,this.symbolLayer.horizontalAlignment,P(n));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,o,l)}updateFocus(e,t){t.forEach((t=>{const s=L(t.graphic.geometry);if(null==s)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const r=this.view.focusAreasView?.containsGeometry(s)??!0;t.layers.forEach((s=>{if(s?.graphics3DSymbolLayer===this&&s.stageObject){s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==r))&&e(t)}}))}))}createLabel(e,t,s,r,o){const i=e.graphic,n=L(i.geometry);if(null==n)return this.logger.warn(`unsupported geometry type for label: ${i.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(n)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(i,n,l,t,s,r,o))}setGraphicElevationContext(e,t=new p,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return W(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),h.UPDATE}slicePlaneEnabledChanged(e,t){return W(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=u(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const o=L(t);if(!o)return!1;const i=G(r,this._context,o,s);if(null==i)return!1;const n=A(this._context,o);return r.geometries[0].localOrigin===n&&(e.alignedSampledElevation=i,C(e,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,h,v=null,x=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new p,m.placement.elevationOffset),O=e.uid;let w=null,P=null;if(null==v){const e=j(m.horizontalPlacement);w=new R(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){P=this._context.sharedResources.textures.fromData(w.key,(()=>w.create())),P.texture.events.on("unloaded",(()=>r=t(r)));const e=this._context.stage.renderView.textures.acquire(P.texture.id);if(null==e||s(e))return P.release(),null;r=e}}const E=!has("disable-feature:non-occluded-hud"),_=$(w,m),S={occlusionTest:!E,occludedFragmentFade:E,horizonCullingEnabled:E&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:_,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(S.shaderPolygonOffset=1e-4),v?S.textureId=v.id:P&&(S.textureId=P.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;S.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const L=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,G={screenOffset:S.screenOffset,anchorPosition:_,centerOffsetUnits:S.centerOffsetUnits,verticalOffset:S.verticalOffset,shaderPolygonOffset:S.shaderPolygonOffset,occlusionTest:S.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=U(this._textRenderParameters);S.screenSizePerspective=t.overrideFontHeight(s.maxHeight),S.screenSizePerspectiveAlignment=e,G.fontHeight=s.maxHeight}S.hasSlicePlane=this._context.slicePlaneEnabled;const A=this._context.spherical,D=h?JSON.stringify(G):"";let H=h?.get(D);if(null==H){if(!m.isFocused&&L){const e=this.view.map?.focusAreas.style;S.color=d(S.color,e),S.outlineColor=d(S.outlineColor,e)}H=new T(S,A),h?.set(D,H)}const W=m.placement.translation,I=w?o(w.displayWidth,w.displayHeight):i,M=m.placement.centerOffset,k=V,N=v?l(0,0,0,0):null,q=F(H,{normal:k,position:W,size:I,centerOffsetAndDistance:M,uvi:N}),B=z(this._context,a,q,b,O);if(null==B)return null;const J=(t,s,r,o,i,n)=>{const a=x()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return f(t,l,r,o,i,n)},Y=new g(this,B.object,P,J,b);Y.alignedSampledElevation=B.sampledElevation,Y.needsElevationUpdates=u(b.mode)||"absolute-height"===b.mode,Y.getScreenSize=(e=n())=>(e[0]=w?w.displayWidth:m.displaySize[0],e[1]=w?w.displayHeight:m.displaySize[1],e);const Z=new y(m.placement.elevationOffset,c);return Y.metadata=Z,C(Y,a,this._context.elevationProvider),Y}}function W(e,t,s){e?.forEach((e=>{const r=t(e);null!=r&&s(r,e.graphic)}))}function $(e,t){if("baseline"===t.verticalPlacement){const s=E[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return o(s,r)}const s=_(t.horizontalPlacement,t.verticalPlacement);return S[s]}const I={mode:"relative-to-ground",offset:0};export{H as Graphics3DTextSymbolLayer};
|
|
@@ -2,7 +2,7 @@
|
|
|
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{
|
|
5
|
+
import{pt2px as e}from"../../../../../../core/screenUtils.js";import{s as r}from"../../../../../../chunks/vec42.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ScreenSizePerspective as l,addScreenSizePerspectiveAlignment as o}from"../util/ScreenSizePerspective.glsl.js";import{addCameraPosition as c}from"../util/View.glsl.js";import{Float4PassUniform as s}from"../../shaderModules/Float4PassUniform.js";import{glsl as i}from"../../shaderModules/glsl.js";class a{constructor(r){this.screenLength=e(r.screenLength),this.minWorldLength=r.minWorldLength??0,this.maxWorldLength=r.maxWorldLength??1/0}}function n(e,r){const t=e.vertex;r.hasVerticalOffset?(d(t),r.hasScreenSizePerspective&&(e.include(l),o(t),c(e.vertex,r)),t.code.add(i`
|
|
6
6
|
vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
|
|
7
7
|
float viewDistance = length((view * vec4(worldPos, 1.0)).xyz);
|
|
8
8
|
${r.spherical?i`vec3 worldNormal = normalize(worldPos + localOrigin);`:i`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`}
|
|
@@ -18,4 +18,4 @@ import{s as e}from"../../../../../../chunks/vec42.js";import{create as r}from"..
|
|
|
18
18
|
vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) {
|
|
19
19
|
return worldPos + calculateVerticalOffset(worldPos, localOrigin);
|
|
20
20
|
}
|
|
21
|
-
`)):
|
|
21
|
+
`)):t.code.add(i`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const f=t();function d(e){e.uniforms.add(new s("verticalOffset",((e,t)=>{const{minWorldLength:l,maxWorldLength:o,screenLength:c}=e.verticalOffset,s=Math.tan(.5*t.camera.fovY)/(.5*t.camera.fullViewport[3]),i=t.camera.pixelRatio||1;return r(f,c*i,s,l,o)})))}export{n as VerticalOffset,a as VerticalOffsetParameters,d as addVerticalOffset};
|
|
@@ -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{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmission as s}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as o,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as u,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class d extends o{constructor(e,t){super(e,T),this.intersectDraped=void 0,this.produces=new Map([[c.LINE_CALLOUTS,e=>s(e)],[c.LINE_CALLOUTS_HUD_DEPTH,e=>s(e)]]),this._configuration=new m(t),this._uniqueMaterialIdentifier=O(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=t.slot===c.LINE_CALLOUTS_HUD_DEPTH,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new S(e)}createBufferWriter(){return new D}validateParameters(e){this._uniqueMaterialIdentifier=O(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function O({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:o,shaderPolygonOffset:a,hudDepthAlignStart:c,centerOffsetUnits:l,hasSlicePlane:f,screenSizePerspective:u,verticalOffset:h,borderColor:p}){return e`${t}:${r}:${i}:[${s}]:${n}:${o}:${a}:${c}:${l}:${f}:${null!=u}:{${h
|
|
5
|
+
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmission as s}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as o,MaterialParameters as a}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as u,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class d extends o{constructor(e,t){super(e,T),this.intersectDraped=void 0,this.produces=new Map([[c.LINE_CALLOUTS,e=>s(e)],[c.LINE_CALLOUTS_HUD_DEPTH,e=>s(e)]]),this._configuration=new m(t),this._uniqueMaterialIdentifier=O(this.parameters)}passParameters(){return this.parameters}getConfiguration(e,t){return super.getConfiguration(e,t,this._configuration),this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=t.slot===c.LINE_CALLOUTS_HUD_DEPTH,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new S(e)}createBufferWriter(){return new D}validateParameters(e){this._uniqueMaterialIdentifier=O(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function O({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,occlusionTest:o,shaderPolygonOffset:a,hudDepthAlignStart:c,centerOffsetUnits:l,hasSlicePlane:f,screenSizePerspective:u,verticalOffset:h,borderColor:p}){return e`${t}:${r}:${i}:[${s}]:${n}:${o}:${a}:${c}:${l}:${f}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${p}]`}class S extends n{beginSlot(e){return this.getTechnique(p,e)}}class T extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=r(0,0,0,1),this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const L=i().vec3f(l.POSITION).vec3f(l.NORMAL).vec2f16(l.UV0).vec4f(l.CENTEROFFSETANDDISTANCE),_=[t(0,0),t(1,0),t(0,1),t(1,0),t(1,1),t(0,1)];class D{constructor(){this.vertexBufferLayout=L}elementCount(e){return 6*e.get(l.POSITION).indices.length}write(e,t,r,i,s,n){f(r.get(l.POSITION),e,s.position,n,6),u(r.get(l.NORMAL),t,s.normal,n,6),h(r.get(l.CENTEROFFSETANDDISTANCE),s.centerOffsetAndDistance,n,6);for(let o=0;o<_.length;++o)s.uv0.setVec(n+o,_[o]);return null}}export{d as LineCalloutMaterial,T as Parameters,O as uniqueMaterialIdentifier};
|
|
@@ -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{equals as r}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{scale as e}from"../../lib/screenSizePerspectiveUtils.js";function i(r,i,n,
|
|
5
|
+
import{equals as r}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{scale as e}from"../../lib/screenSizePerspectiveUtils.js";function i(r,i,o,n,l){let s=o.screenLength*r.pixelRatio;null!=l&&(s=e(s,n,i,l));const c=s*Math.tan(.5*r.fovY)/(.5*r.fullHeight);return t(c*i,o.minWorldLength,o.maxWorldLength)}function o(t,e){let i=!1;for(const o in e){const n=e[o];void 0!==n&&(Array.isArray(n)?Array.isArray(t[o])&&r(n,t[o])||(t[o]=n.slice(),i=!0):t[o]!==n&&(i=!0,t[o]=n))}return i}const n={multiply:1,ignore:2,replace:3,tint:4};export{n as colorMixModes,o as updateParameters,i as verticalOffsetAtDistance};
|
|
@@ -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{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{throwIfAborted as i,isAbortError as
|
|
5
|
+
import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{notDeepEqual as n}from"../../core/object.js";import{throwIfAborted as i,isAbortError as r,onAbort as a}from"../../core/promiseUtils.js";import{watch as s,syncAndInitial as l,on as c,whenOnce as u}from"../../core/reactiveUtils.js";function m(t,n){t.interactive=!0;const{tool:i,view:r}=t;r.activeTool=i;let s=a(n,(()=>{r.activeTool===i&&(r.activeTool=null)}));return o((async o=>{await u((()=>!t.tool?.active),o),s=e(s)}),n)}function p(o,t){return s((()=>o.interactive),(()=>v(o,t)),l)}function v(o,t){o.interactive?f(o,t):y(o)}function f(o,t){y(o);const{view:e,analysis:n}=o,i=new t({view:e,analysis:n,analysisViewData:o});return o.tool=i,e.tools.add(i),i}function y(o){const{view:t,tool:e}=o;null!=e&&(t.tools.remove(e),o.tool=null)}function d(e,n){const a=e.userOperation,s=o((async o=>{if(a){const t=a.promise.catch((()=>{}));a?.abort(),await t,i(o)}const s=m(e,{signal:o}),l=n?.shouldRejectOnCancel??(()=>!0),u=t([c((()=>e.tool),"cancel",(()=>{l()&&s.abort()}))]),{tool:p}=e;try{p&&(p.resetCreated(),n?.onToolActivated?.(p)),await s.promise,i(o)}catch(v){if(o.aborted||!r(v)||l())throw v}finally{u?.remove()}}),{signal:n?.abortOptions?.signal});return e.userOperation=s,s.promise.finally((()=>{e.userOperation===s&&(e.userOperation=null)}))}function O(o,t){const e=o.analysis.toJSON();return d(o,{abortOptions:t?.placementOptions,onToolActivated:t?.onToolActivated,shouldRejectOnCancel:()=>{const{analysis:t}=o;return!t.valid||!n(e,t.toJSON())}})}export{m as activateAnalysisViewTool,p as connectAnalysisViewToTool,y as removeAnalysisViewTool,d as startExclusiveInteractiveOperation,O as startPlaceOperation};
|
|
@@ -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 r}from"../../chunks/tslib.es6.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import"../../core/Warning.js";import"../../core/Error.js";import e from"./LayerView.js";class s extends e{constructor(r){super(r),this.layer=null,this.sublayerViews=null}highlight(r){throw new Error("Not implemented")}}r([o()],s.prototype,"layer",void 0),r([o()],s.prototype,"sublayerViews",void 0);export{s as default};
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import"../../core/Warning.js";import"../../core/Error.js";import e from"./LayerView.js";class s extends e{constructor(r){super(r),this.layer=null,this.sublayerViews=null}highlight(r,o){throw new Error("Not implemented")}}r([o()],s.prototype,"layer",void 0),r([o()],s.prototype,"sublayerViews",void 0);export{s as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";const t=t=>{let s=class extends t{constructor(...r){super(...r),this.layer=null}get availableFields(){return[]}highlight(){throw new Error("Not implemented")}queryFeatures(){throw new Error("Not implemented")}queryFeatureCount(){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(){throw new Error("Not implemented")}};return r([e()],s.prototype,"layer",void 0),r([e()],s.prototype,"availableFields",null),s=r([o("esri.views.layers.PointCloudLayerView")],s),s};export{t as default};
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";const t=t=>{let s=class extends t{constructor(...r){super(...r),this.layer=null}get availableFields(){return[]}highlight(r,e){throw new Error("Not implemented")}queryFeatures(){throw new Error("Not implemented")}queryFeatureCount(){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(){throw new Error("Not implemented")}};return r([e()],s.prototype,"layer",void 0),r([e()],s.prototype,"availableFields",null),s=r([o("esri.views.layers.PointCloudLayerView")],s),s};export{t as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{isSome as t}from"../../core/arrayUtils.js";import r from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{unwrapUpdating as i,updating as n,isUpdating as l}from"../../core/maybeUpdating.js";import{throwIfAbortError as s,throwIfNotAbortError as a}from"../../core/promiseUtils.js";import{whenOnce as m}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{project as u,canProjectWithoutEngine as g,isLoaded as y,load as h}from"../../geometry/projectionUtils.js";import d from"./LayerView.js";let f=class extends d{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1,this._abortController=new AbortController}get availableFields(){return[]}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){throw new Error("Not implemented")}get maximumNumberOfFeaturesExceeded(){return!1}get layerFilter(){return i(this._layerFilter)}get _layerFilter(){const e=this.layer?.filter;if(null==e||e.geometries.length<1)return null;const o=this._geometryEngine;if(null==o||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return n;const i=e.geometries.at(0).spatialReference,l=e.geometries.toArray().map((e=>{try{e=o.simplify(e)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to simplify scene filter mask polygon. Polygon will be ignored."),null}if(null==e)return null;if(e.spatialReference.equals(i))return e;try{return u(e,i)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}})).filter(t).sort(((e,t)=>e.extent.xmin-t.extent.xmin)),s=new Set,a=new Array,m=new Array;for(let t of l){const e=t.extent.xmin;if(a.length=0,s.forEach((r=>{if(e>=r.extent.xmax)return m.push(r),void s.delete(r);t.extent.ymin<=r.extent.ymax&&t.extent.ymax>=r.extent.ymin&&o.intersects(t,r)&&a.push(r)})),a.length>0){a.push(t);try{t=o.union(a)}catch(p){r.getLogger(this).warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}a.pop(),a.forEach((e=>s.delete(e)))}s.add(t)}return s.forEach((e=>m.push(e))),m.length>0?{spatialRelationship:e.spatialRelationship,geometries:m}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(null==e||e.geometries.length<=1)return!1;const t=e.geometries.at(0).spatialReference;return e.geometries.some((({spatialReference:e})=>!e.equals(t)&&!g(e,t)))}get layerFilterUpdating(){return l(this._layerFilter)}initialize(){const{signal:e}=this._abortController;m((()=>this.destroyed||!this._geometryEngine&&this.layer?.filter?.geometries?.length),e).then((async()=>{s(e),this._geometryEngine=await import("../../geometry/geometryEngine.js")})).catch(a),this._projectionEngineLoaded=y(),m((()=>this.destroyed||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine),e).then((async()=>{s(e),await h(),this._projectionEngineLoaded=!0})).catch(a)}destroy(){this._abortController=o(this._abortController)}highlight(e){throw new Error("Not implemented")}queryFeatures(e,t){throw new Error("Not implemented")}queryObjectIds(e,t){throw new Error("Not implemented")}queryFeatureCount(e,t){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(e,t){throw new Error("Not implemented")}};e([p()],f.prototype,"layer",void 0),e([p()],f.prototype,"availableFields",null),e([p()],f.prototype,"maximumNumberOfFeatures",null),e([p({readOnly:!0})],f.prototype,"maximumNumberOfFeaturesExceeded",null),e([p()],f.prototype,"filter",void 0),e([p({readOnly:!0})],f.prototype,"layerFilter",null),e([p({readOnly:!0})],f.prototype,"_layerFilter",null),e([p()],f.prototype,"_geometryEngine",void 0),e([p()],f.prototype,"_projectionEngineLoaded",void 0),e([p()],f.prototype,"_filterNeedsProjectionEngine",null),e([p()],f.prototype,"layerFilterUpdating",null),f=e([c("esri.views.layers.SceneLayerView")],f);export{f as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{isSome as t}from"../../core/arrayUtils.js";import r from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{unwrapUpdating as i,updating as n,isUpdating as l}from"../../core/maybeUpdating.js";import{throwIfAbortError as s,throwIfNotAbortError as a}from"../../core/promiseUtils.js";import{whenOnce as m}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{project as u,canProjectWithoutEngine as g,isLoaded as y,load as h}from"../../geometry/projectionUtils.js";import d from"./LayerView.js";let f=class extends d{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1,this._abortController=new AbortController}get availableFields(){return[]}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){throw new Error("Not implemented")}get maximumNumberOfFeaturesExceeded(){return!1}get layerFilter(){return i(this._layerFilter)}get _layerFilter(){const e=this.layer?.filter;if(null==e||e.geometries.length<1)return null;const o=this._geometryEngine;if(null==o||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return n;const i=e.geometries.at(0).spatialReference,l=e.geometries.toArray().map((e=>{try{e=o.simplify(e)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to simplify scene filter mask polygon. Polygon will be ignored."),null}if(null==e)return null;if(e.spatialReference.equals(i))return e;try{return u(e,i)}catch(t){return r.getLogger(this).warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}})).filter(t).sort(((e,t)=>e.extent.xmin-t.extent.xmin)),s=new Set,a=new Array,m=new Array;for(let t of l){const e=t.extent.xmin;if(a.length=0,s.forEach((r=>{if(e>=r.extent.xmax)return m.push(r),void s.delete(r);t.extent.ymin<=r.extent.ymax&&t.extent.ymax>=r.extent.ymin&&o.intersects(t,r)&&a.push(r)})),a.length>0){a.push(t);try{t=o.union(a)}catch(p){r.getLogger(this).warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}a.pop(),a.forEach((e=>s.delete(e)))}s.add(t)}return s.forEach((e=>m.push(e))),m.length>0?{spatialRelationship:e.spatialRelationship,geometries:m}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(null==e||e.geometries.length<=1)return!1;const t=e.geometries.at(0).spatialReference;return e.geometries.some((({spatialReference:e})=>!e.equals(t)&&!g(e,t)))}get layerFilterUpdating(){return l(this._layerFilter)}initialize(){const{signal:e}=this._abortController;m((()=>this.destroyed||!this._geometryEngine&&this.layer?.filter?.geometries?.length),e).then((async()=>{s(e),this._geometryEngine=await import("../../geometry/geometryEngine.js")})).catch(a),this._projectionEngineLoaded=y(),m((()=>this.destroyed||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine),e).then((async()=>{s(e),await h(),this._projectionEngineLoaded=!0})).catch(a)}destroy(){this._abortController=o(this._abortController)}highlight(e,t){throw new Error("Not implemented")}queryFeatures(e,t){throw new Error("Not implemented")}queryObjectIds(e,t){throw new Error("Not implemented")}queryFeatureCount(e,t){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(e,t){throw new Error("Not implemented")}};e([p()],f.prototype,"layer",void 0),e([p()],f.prototype,"availableFields",null),e([p()],f.prototype,"maximumNumberOfFeatures",null),e([p({readOnly:!0})],f.prototype,"maximumNumberOfFeaturesExceeded",null),e([p()],f.prototype,"filter",void 0),e([p({readOnly:!0})],f.prototype,"layerFilter",null),e([p({readOnly:!0})],f.prototype,"_layerFilter",null),e([p()],f.prototype,"_geometryEngine",void 0),e([p()],f.prototype,"_projectionEngineLoaded",void 0),e([p()],f.prototype,"_filterNeedsProjectionEngine",null),e([p()],f.prototype,"layerFilterUpdating",null),f=e([c("esri.views.layers.SceneLayerView")],f);export{f as default};
|
package/views/ui/UI.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import o from"../../core/Accessor.js";import{isSome as n}from"../../core/arrayUtils.js";import e from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteModeClass as c}from"../../support/modeUtils.js";import l from"./Component.js";import{isRTL as m}from"../../widgets/support/widgetUtils.js";import{getLocale as h,onLocaleChange as u}from"../../intl/locale.js";const f={left:0,top:0,bottom:0,right:0},_={bottom:30,top:15,right:15,left:15},g="esri-ui",y={ui:g,corner:`${g}-corner`,innerContainer:`${g}-inner-container`,manualContainer:`${g}-manual-container`,cornerContainer:`${g}-corner-container`,topLeft:`${g}-top-left`,topRight:`${g}-top-right`,bottomLeft:`${g}-bottom-left`,bottomRight:`${g}-bottom-right`};function C(t){return t&&!t._started&&"function"==typeof t.postMixInProperties&&"function"==typeof t.buildRendering&&"function"==typeof t.postCreate&&"function"==typeof t.startup}function v(t){return 0===t?"0":`${t}px`}function b(t){const o="object"==typeof t&&null!==t&&Object.getPrototypeOf(t);return(null===o||o===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function w(t,{top:o,bottom:n,left:e,right:i}){t.style.top=o,t.style.bottom=n,t.style.left=e,t.style.right=i}let P=class extends e.EventedAccessor{constructor(t){super(t),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentMap=new Map,this._removeWidgetHandleKey=Symbol("componentOnRemoveSymbol"),this._locale=h(),this.view=null,this._applyViewPadding=()=>{const t=this.container;t&&w(t,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const t=this._innerContainer;t&&w(t,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([r((()=>[this.view?.padding,this.container]),this._applyViewPadding,s),r((()=>this.padding),this._applyUIPadding,s),r((()=>[this.container,this._locale]),(([t,o])=>{t&&t.setAttribute("lang",o)}),s),u((t=>{this._locale=t}))])}destroy(){this.container=null;for(const t of this._components)t.destroy();this._components.length=0,this._componentMap.clear()}set container(t){const o=this._get("container");t!==o&&(t&&(t.classList.add(y.ui),c(t),this._attachContainers(t)),o&&(o.classList.remove(y.ui),w(o,{top:"",bottom:"",left:"",right:""}),o.textContent=""),this._set("container",t))}get height(){const t=this.view?.height??0;if(0===t)return t;const o=this._getViewPadding(),{top:n,bottom:e}=o;return Math.max(t-n-e,0)}get padding(){return this._get("padding")}set padding(t){this._overrideIfSome("padding",t)}castPadding(t){return"number"==typeof t?{bottom:t,top:t,right:t,left:t}:{..._,...t}}get width(){const t=this.view?.width??0;if(0===t)return t;const o=this._getViewPadding(),{left:n,right:e}=o;return Math.max(t-n-e,0)}add(t,o){let n,e,i;if(Array.isArray(t))return void t.forEach((t=>this.add(t,o)));const r=b(t);r&&({index:n,position:o,component:t,key:e}=r),o&&"object"==typeof o&&({index:n,key:e,position:o,internal:i}=o),!t||o&&!this._isValidPosition(o)||this._add(t,o,n??this._getNumComponentsAtPosition(o),e,i)}remove(t,o){if(!t)return;if(Array.isArray(t))return t.map((t=>this.remove(t,o)));const n=this._find(t);if(n){
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import o from"../../core/Accessor.js";import{isSome as n}from"../../core/arrayUtils.js";import e from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import{watch as r,initial as s}from"../../core/reactiveUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{setCalciteModeClass as c}from"../../support/modeUtils.js";import l from"./Component.js";import{isRTL as m}from"../../widgets/support/widgetUtils.js";import{getLocale as h,onLocaleChange as u}from"../../intl/locale.js";const f={left:0,top:0,bottom:0,right:0},_={bottom:30,top:15,right:15,left:15},g="esri-ui",y={ui:g,corner:`${g}-corner`,innerContainer:`${g}-inner-container`,manualContainer:`${g}-manual-container`,cornerContainer:`${g}-corner-container`,topLeft:`${g}-top-left`,topRight:`${g}-top-right`,bottomLeft:`${g}-bottom-left`,bottomRight:`${g}-bottom-right`};function C(t){return t&&!t._started&&"function"==typeof t.postMixInProperties&&"function"==typeof t.buildRendering&&"function"==typeof t.postCreate&&"function"==typeof t.startup}function v(t){return 0===t?"0":`${t}px`}function b(t){const o="object"==typeof t&&null!==t&&Object.getPrototypeOf(t);return(null===o||o===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function w(t,{top:o,bottom:n,left:e,right:i}){t.style.top=o,t.style.bottom=n,t.style.left=e,t.style.right=i}let P=class extends e.EventedAccessor{constructor(t){super(t),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentMap=new Map,this._removeWidgetHandleKey=Symbol("componentOnRemoveSymbol"),this._locale=h(),this.view=null,this._applyViewPadding=()=>{const t=this.container;t&&w(t,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const t=this._innerContainer;t&&w(t,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([r((()=>[this.view?.padding,this.container]),this._applyViewPadding,s),r((()=>this.padding),this._applyUIPadding,s),r((()=>[this.container,this._locale]),(([t,o])=>{t&&t.setAttribute("lang",o)}),s),u((t=>{this._locale=t}))])}destroy(){this.container=null;for(const t of this._components)t.destroy();this._components.length=0,this._componentMap.clear()}set container(t){const o=this._get("container");t!==o&&(t&&(t.classList.add(y.ui),c(t),this._attachContainers(t)),o&&(o.classList.remove(y.ui),w(o,{top:"",bottom:"",left:"",right:""}),o.textContent=""),this._set("container",t))}get height(){const t=this.view?.height??0;if(0===t)return t;const o=this._getViewPadding(),{top:n,bottom:e}=o;return Math.max(t-n-e,0)}get padding(){return this._get("padding")}set padding(t){this._overrideIfSome("padding",t)}castPadding(t){return"number"==typeof t?{bottom:t,top:t,right:t,left:t}:{..._,...t}}get width(){const t=this.view?.width??0;if(0===t)return t;const o=this._getViewPadding(),{left:n,right:e}=o;return Math.max(t-n-e,0)}add(t,o){let n,e,i;if(Array.isArray(t))return void t.forEach((t=>this.add(t,o)));const r=b(t);r&&({index:n,position:o,component:t,key:e}=r),o&&"object"==typeof o&&({index:n,key:e,position:o,internal:i}=o),!t||o&&!this._isValidPosition(o)||this._add(t,o,n??this._getNumComponentsAtPosition(o),e,i)}remove(t,o){if(!t)return;if(Array.isArray(t))return t.map((t=>this.remove(t,o)));const n=this._find(t);if(n){const t=this._componentMap.get(n);if(!t||t.key!==o)return;const e=this._components.indexOf(n),i=n.node.parentNode;return i?.removeChild(n.node),this._componentMap.delete(n),n.widget?.removeHandlesReference(this._removeWidgetHandleKey),this._components.forEach((o=>{const n=this._componentMap.get(o);n&&n.position===t.position&&n.index>t.index&&n.index--})),this._components.splice(e,1)[0]}}empty(t,o={removeInternal:!1}){if(Array.isArray(t)){for(const n of t)this.empty(n,o);return}const n=this._positionNameToContainerLookup[t??"manual"],e=Array.prototype.slice.call(n.children).map((t=>this._findByNode(t))).filter((t=>{if(null==t)return!1;return!(this._componentMap.get(t)?.internal??!1)||o.removeInternal}));for(const i of e)this.remove(i)}move(t,o){if(Array.isArray(t)&&t.forEach((t=>this.move(t,o))),!t)return;let n;const e=b(t)||b(o);if(e&&(n=e.index,o=e.position,t=e.component||t),o&&!this._isValidPosition(o))return;const i=this.remove(t);i&&this.add(i,{position:o,index:n})}find(t){if(!t)return null;const o=this._findById(t);return o&&(o.widget||o.node)}getComponents(t,o={includeInternal:!1}){return t?Array.isArray(t)?t.flatMap((t=>this._getComponentsAtPosition(t,o))):this._getComponentsAtPosition(t,o):this._components.filter((t=>o.includeInternal||!this._componentMap.get(t)?.internal)).map((({widget:t,node:o})=>t??o))}getPosition(t){for(const o in this._positionNameToContainerLookup){if(this._positionNameToContainerLookup[o].contains(t))return o}return null}_add(t,n,e,r,s){t instanceof l||(t=new l({node:t}));const{widget:a}=t;null!=a&&a instanceof o&&a.addHandles(i((()=>{queueMicrotask((()=>this.remove(t)))})),this._removeWidgetHandleKey);this._components.some((t=>this._componentMap.get(t)?.position===n&&this._componentMap.get(t)?.index===e))&&this._components.forEach((t=>{const o=this._componentMap.get(t);o&&o.position===n&&o.index>=e&&o.index++})),this._place({component:t,position:n,index:e}),this._components.push(t),this._componentMap.set(t,{key:r,position:n,internal:s,index:e})}_find(t){return t?t instanceof l?this._findByComponent(t):"string"==typeof t?this._findById(t):"domNode"in t?this._findByNode(t.domNode):this._findByNode(t):null}_getViewPadding(){return this.view?.padding??f}_attachContainers(t){t.appendChild(this._innerContainer),t.appendChild(this._manualContainer)}_initContainers(){const t=document.createElement("div");t.classList.add(y.innerContainer,y.cornerContainer);const o=document.createElement("div");o.classList.add(y.innerContainer,y.manualContainer);const n=document.createElement("div");n.classList.add(y.topLeft,y.corner),t.appendChild(n);const e=document.createElement("div");e.classList.add(y.topRight,y.corner),t.appendChild(e);const i=document.createElement("div");i.classList.add(y.bottomLeft,y.corner),t.appendChild(i);const r=document.createElement("div");r.classList.add(y.bottomRight,y.corner),t.appendChild(r),this._innerContainer=t,this._manualContainer=o;const s=m();this._cornerNameToContainerLookup={"top-left":n,"top-right":e,"bottom-left":i,"bottom-right":r,"top-leading":s?e:n,"top-trailing":s?n:e,"bottom-leading":s?r:i,"bottom-trailing":s?i:r},this._positionNameToContainerLookup={manual:o,...this._cornerNameToContainerLookup}}_isValidPosition(t){return!!this._positionNameToContainerLookup[t]}_place(t){const o=t.position??"manual",{component:n,index:e}=t,i=this._positionNameToContainerLookup[o],r=null!=e&&e>-1;if(C(n.widget)&&n.widget.startup(),!r)return void i.appendChild(n.node);const s=Array.from(i.children);if(0!==s.length){for(const t of s){const o=this._findByNode(t);if(o&&e<(this._componentMap.get(o)?.index??0))return void t.parentNode?.insertBefore(n.node,t)}i.appendChild(n.node)}else i.appendChild(n.node)}_toPixelPosition(t){return{top:v(t.top),left:v(t.left),right:v(t.right),bottom:v(t.bottom)}}_findByComponent(t){return this._components.find((o=>o===t))??null}_findById(t){return this._components.find((({id:o})=>o===t))??null}_findByNode(t){return t?this._components.find((({node:o})=>o===t)):null}_getComponentsAtPosition(t,o){const e=this._positionNameToContainerLookup[t];return Array.prototype.slice.call(e.children).map((t=>this._findByNode(t))).filter(n).filter((t=>o.includeInternal||!this._componentMap.get(t)?.internal)).map((({widget:t,node:o})=>t??o))}_getNumComponentsAtPosition(t){const o=this._positionNameToContainerLookup[t];return o?.children.length??0}};t([a()],P.prototype,"_locale",void 0),t([a()],P.prototype,"container",null),t([a()],P.prototype,"height",null),t([a({value:_})],P.prototype,"padding",null),t([p("padding")],P.prototype,"castPadding",null),t([a()],P.prototype,"view",void 0),t([a()],P.prototype,"width",null),P=t([d("esri.views.ui.UI")],P);const x=P;export{x as default};
|
package/webscene/Slide.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w}from"../core/accessorSupport/decorators/property.js";import{cast as f}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as j}from"../core/accessorSupport/ensureType.js";import{s as L}from"../chunks/vec32.js";import{create as C}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as A}from"../views/support/Scheduler.js";import{SlideThumbnail as k}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import x from"./VirtualLighting.js";import F from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import R from"./support/SlideGround.js";import{SlideVisibleLayer as M}from"./support/SlideVisibleLayer.js";import O from"./support/Title.js";let P=0;const q=s.ofType(M),B=["caption","cover","none"];let G=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+P++,this.title=new O,this.description=new F,this.hidden=!1,this.thumbnail=new k,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.environment=new D,this.timeExtent=null,this.elements=new I,this.visibleLayers=new q,this.enabledFocusAreas=new s}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas?.removeAll(),this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new O({text:e}):j(O,e)}castDescription(e){return"string"==typeof e?new F({text:e}):j(F,e)}castThumbnail(e){return"string"==typeof e?new k({url:e}):j(k,e)}castBasemap(e){return E(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),q))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=H(i);t.push(new M({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?x.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=e.focusAreasView?.enabledAreas?new s(e.focusAreasView?.enabledAreas.map((({id:e})=>e))):null,this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?R.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new k({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),s=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw s(),c}if(i.signal.aborted)throw s(),d();const o=e.resourceController.scheduler.registerTask(A.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([o.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),o.schedule((()=>this._applyBasemap(e,l)),l.signal),o.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([o.schedule((()=>this._applyLayerVisibility(e)),l.signal),o.schedule((()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas))),o.schedule((()=>this._applyGround(e)),l.signal),o.schedule((()=>this.elements.analyses.applyTo(e)),l.signal),o.schedule((()=>this._applyViewpoint(e,l)),l.signal),o.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),o.schedule((()=>e.environment.weather=this.environment.weather.clone()))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),o.remove(),s(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,s]=this._getTime(n),[o,a]=this._getTime(i.date),l=K(s,a),p=e.renderCoordsHelper,m=C();p.toRenderCoords(e.camera.position,m);const c=C(),h=C();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=L(m,h),n=L(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(o-r)*a,y=Q(s,v(l*a));t.date=this._setTime(d,u,y)}))}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],G.prototype,"id",void 0),e([w({type:O,json:{default:()=>new O({text:""}),write:{isRequired:!0}}})],G.prototype,"title",void 0),e([f("title")],G.prototype,"castTitle",null),e([w({type:F,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],G.prototype,"description",void 0),e([f("description")],G.prototype,"castDescription",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],G.prototype,"hidden",void 0),e([w({type:k,json:{default:()=>new k({url:""}),write:{isRequired:!0}}})],G.prototype,"thumbnail",void 0),e([f("thumbnail")],G.prototype,"castThumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],G.prototype,"viewpoint",void 0),e([w({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],G.prototype,"basemap",void 0),e([f("basemap")],G.prototype,"castBasemap",null),e([w({type:R,json:{write:!0}})],G.prototype,"ground",void 0),e([w({type:B,json:{write:!0,default:"caption"},nonNullable:!0})],G.prototype,"layout",void 0),e([w({type:q,json:{write:{isRequired:!0}}})],G.prototype,"visibleLayers",null),e([f("visibleLayers")],G.prototype,"castVisibleLayers",null),e([w({type:s.ofType(String),json:{write:!0},clonable:e=>e?new s(e.items):null})],G.prototype,"enabledFocusAreas",void 0),e([w({type:D,json:{write:!0}})],G.prototype,"environment",void 0),e([w(V)],G.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],G.prototype,"elements",void 0),G=e([T("esri.webscene.Slide")],G);const N=G;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{N as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import r from"../core/Clonable.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import a from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w}from"../core/accessorSupport/decorators/property.js";import{cast as f}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as j}from"../core/accessorSupport/ensureType.js";import{s as L}from"../chunks/vec32.js";import{create as C}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as A}from"../views/support/Scheduler.js";import{SlideThumbnail as k}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import x from"./VirtualLighting.js";import F from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import R from"./support/SlideGround.js";import{SlideVisibleLayer as M}from"./support/SlideVisibleLayer.js";import O from"./support/Title.js";let P=0;const q=s.ofType(M),B=["caption","cover","none"];let G=class extends(r.ClonableMixin(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+P++,this.title=new O,this.description=new F,this.hidden=!1,this.thumbnail=new k,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.enabledFocusAreas=new s,this.environment=new D,this.timeExtent=null,this.elements=new I,this.visibleLayers=new q}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas=null,this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new O({text:e}):j(O,e)}castDescription(e){return"string"==typeof e?new F({text:e}):j(F,e)}castThumbnail(e){return"string"==typeof e?new k({url:e}):j(k,e)}castBasemap(e){return E(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),q))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map((e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)})):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map((i=>e.whenLayerView(i).then((e=>{if(e.visible){const n=H(i);t.push(new M({id:e.layer.id,sublayerIds:n}))}})))).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?x.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=e.focusAreasView?.enabledAreas?new s(e.focusAreasView?.enabledAreas.map((({id:e})=>e))):null,this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?R.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new k({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,(()=>i?.abort())),s=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y((()=>e.ready),i.signal)}catch(c){throw s(),c}if(i.signal.aborted)throw s(),d();const o=e.resourceController.scheduler.registerTask(A.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([o.schedule((async()=>a=await this._setViewpointOfInterest(e,l))),o.schedule((()=>this._applyBasemap(e,l)),l.signal),o.schedule((()=>this._loadLayersWithSublayerVisibility(e)))]),await Promise.all([o.schedule((()=>this._applyLayerVisibility(e)),l.signal),o.schedule((()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas))),o.schedule((()=>this._applyGround(e)),l.signal),o.schedule((()=>this.elements.analyses.applyTo(e)),l.signal),o.schedule((()=>this._applyViewpoint(e,l)),l.signal),o.schedule((()=>e.timeExtent=this.timeExtent?.clone()??null),l.signal),o.schedule((()=>e.environment.weather=this.environment.weather.clone()))])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),o.remove(),s(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach((e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))}))}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map((e=>{const t=this.visibleLayers.find((t=>t.id===e.id))?.sublayerIds;return t?e.load():null})))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach((e=>{const t=this.visibleLayers.find((t=>t.id===e.id));e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach((e=>e.visible=i.includes(e.id)))}))}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then((()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())})).catch((t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t})).finally((()=>{c(i)}))}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,s]=this._getTime(n),[o,a]=this._getTime(i.date),l=K(s,a),p=e.renderCoordsHelper,m=C();p.toRenderCoords(e.camera.position,m);const c=C(),h=C();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g((()=>e.camera),(e=>{p.toRenderCoords(e.position,h);const i=L(m,h),n=L(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(o-r)*a,y=Q(s,v(l*a));t.date=this._setTime(d,u,y)}))}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],G.prototype,"id",void 0),e([w({type:O,json:{default:()=>new O({text:""}),write:{isRequired:!0}}})],G.prototype,"title",void 0),e([f("title")],G.prototype,"castTitle",null),e([w({type:F,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],G.prototype,"description",void 0),e([f("description")],G.prototype,"castDescription",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],G.prototype,"hidden",void 0),e([w({type:k,json:{default:()=>new k({url:""}),write:{isRequired:!0}}})],G.prototype,"thumbnail",void 0),e([f("thumbnail")],G.prototype,"castThumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],G.prototype,"viewpoint",void 0),e([w({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],G.prototype,"basemap",void 0),e([f("basemap")],G.prototype,"castBasemap",null),e([w({type:R,json:{write:!0}})],G.prototype,"ground",void 0),e([w({type:B,json:{write:!0,default:"caption"},nonNullable:!0})],G.prototype,"layout",void 0),e([w({type:q,json:{write:{isRequired:!0}}})],G.prototype,"visibleLayers",null),e([f("visibleLayers")],G.prototype,"castVisibleLayers",null),e([w({type:s.ofType(String),json:{write:!0},clonable:e=>e?new s(e.items):null})],G.prototype,"enabledFocusAreas",void 0),e([w({type:D,json:{write:!0}})],G.prototype,"environment",void 0),e([w(V)],G.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],G.prototype,"elements",void 0),G=e([T("esri.webscene.Slide")],G);const N=G;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter((e=>e.visible)).map((e=>e.id))}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{N as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as e}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";let r=class extends t{constructor(){super(...arguments),this.editRouteButton=!0,this.layerDetails=!0,this.saveAsButton=!0,this.saveButton=!0}};o([e({type:Boolean,nonNullable:!0})],r.prototype,"editRouteButton",void 0),o([e({type:Boolean,nonNullable:!0})],r.prototype,"layerDetails",void 0),o([e({type:Boolean,nonNullable:!0})],r.prototype,"saveAsButton",void 0),o([e({type:Boolean,nonNullable:!0})],r.prototype,"saveButton",void 0),r=o([s("esri.widgets.Directions.DirectionsVisibleElements")],r);const
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as e}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";let r=class extends t{constructor(){super(...arguments),this.editRouteButton=!0,this.layerDetails=!0,this.printButton=!0,this.saveAsButton=!0,this.saveButton=!0}};o([e({type:Boolean,nonNullable:!0})],r.prototype,"editRouteButton",void 0),o([e({type:Boolean,nonNullable:!0})],r.prototype,"layerDetails",void 0),o([e({type:Boolean,nonNullable:!0})],r.prototype,"printButton",void 0),o([e({type:Boolean,nonNullable:!0})],r.prototype,"saveAsButton",void 0),o([e({type:Boolean,nonNullable:!0})],r.prototype,"saveButton",void 0),r=o([s("esri.widgets.Directions.DirectionsVisibleElements")],r);const n=r;export{n as default};
|