@arcgis/core 5.1.0-next.135 → 5.1.0-next.136
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/{6ae12ad5afbe97f80854.js → 312676c9027684a08107.js} +1 -1
- package/assets/esri/core/workers/chunks/5468a65698931603656d.js +1 -0
- package/assets/esri/core/workers/chunks/{8159a305578b6c6a1787.js → 5b83893a58529ef5f08b.js} +1 -1
- package/assets/esri/core/workers/chunks/{db26cf2c2735183294b8.js → 6649acaceab00ad30e7f.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d857d2281342f73fd05.js → 7197972041f5700c235d.js} +1 -1
- package/assets/esri/core/workers/chunks/{72edd08a2ff08970ba38.js → 87011d2fe14c54e296af.js} +1 -1
- package/assets/esri/core/workers/chunks/8a88146de5b12fd4dcd8.js +1 -0
- package/assets/esri/core/workers/chunks/{8aeb2d287ce3b7ec7979.js → 934cd06318b69f37d72b.js} +1 -1
- package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +1 -0
- package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +1 -0
- package/assets/esri/core/workers/chunks/{35c4037b8eea067d9638.js → 98f64d9ca6f2a76cf916.js} +7 -7
- package/assets/esri/core/workers/chunks/9bcebaf0d0e43db0b07f.js +2 -0
- package/assets/esri/core/workers/chunks/{4104a0585969f8cd524c.js → a40ede4d3375184f21fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c5ccda8f955e50cd941.js → a533d066cac26124c5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/a536904fe6f3b16fdbdc.js +1 -0
- package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +1 -0
- package/assets/esri/core/workers/chunks/{9186c494835707842673.js → b3be96d5f3f6b4342907.js} +1 -1
- package/assets/esri/core/workers/chunks/c9b212fe844ab918127f.js +1 -0
- package/assets/esri/core/workers/chunks/e006d1c26ae234f5b086.js +1 -0
- package/assets/esri/core/workers/chunks/{ab77c71cb4947204c9f2.js → f170d80c5930db1d630e.js} +2 -2
- package/assets/esri/core/workers/chunks/{5f63077ec5ba3560491b.js → f1ff33584680d8718400.js} +1 -1
- package/assets/esri/core/workers/chunks/{ae1b6a7bf46bb09d8715.js → feacdcf0ba9ea58f1616.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/config.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +43 -0
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +39 -0
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/DimensionLayer.d.ts +1 -0
- package/layers/FeatureLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.d.ts +9 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/AnnotationFeatureSublayer.d.ts +5 -3
- package/layers/support/SymbolLayerDrawing.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/symbols/SimpleMarkerSymbol.d.ts +2 -2
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/View2D.d.ts +2 -2
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/support/panConstraint.js +2 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print/CustomTemplate.d.ts +7 -0
- package/widgets/Search/LayerSearchSource.d.ts +3 -0
- package/assets/esri/core/workers/chunks/0a259137932211b80f0e.js +0 -1
- package/assets/esri/core/workers/chunks/24dcf2da6ab5d1593daa.js +0 -2
- package/assets/esri/core/workers/chunks/35a508a9311689d8df52.js +0 -1
- package/assets/esri/core/workers/chunks/966cd2a6b9ec6665b256.js +0 -1
- package/assets/esri/core/workers/chunks/9def4619d102f1d41578.js +0 -1
- package/assets/esri/core/workers/chunks/9eb0bea728ba8ef8a359.js +0 -1
- package/assets/esri/core/workers/chunks/d5a0e3a73df827dc7b06.js +0 -1
- package/assets/esri/core/workers/chunks/e5471373f89fd7cb9844.js +0 -1
- package/assets/esri/core/workers/chunks/ee146d860447a99370a5.js +0 -1
- /package/assets/esri/core/workers/chunks/{24dcf2da6ab5d1593daa.js.LICENSE.txt → 9bcebaf0d0e43db0b07f.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ab77c71cb4947204c9f2.js.LICENSE.txt → f170d80c5930db1d630e.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import h from"../../../core/Error.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{watch as o,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isLinkChartView as p}from"../../../linkChart/utils.js";import{Container as c}from"../engine/Container.js";import{ClipMesh as g}from"../engine/webgl/ClipMesh.js";import{HighlightCounter as d}from"./support/HighlightCounter.js";import{createOrReuseHighlightGradient as u}from"./support/util.js";import f from"../../layers/support/ClipRect.js";import m from"../../layers/support/GeometryClipArea.js";import y from"../../layers/support/Path.js";import{defaultHighlightName as v}from"../../support/HighlightDefaults.js";import w from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";const _=e.ofType({key:"type",base:null,typeMap:{rect:f,path:y,geometry:m}}),H=new(e.ofType(w)),S=f=>{const m=f;let y=class extends m{constructor(){super(...arguments),this._highlightCounter=new d,this.attached=!1,this.clips=new _,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const t=this.view?.spatialReferenceLocked??!0,e=this.view?.spatialReference;e&&t&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new h("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new c),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,t=>{this.container&&(this.container.visible=!t)},a),o(()=>this.updateSuspended,t=>{this.view&&!t&&this.updateRequested&&this.view.requestUpdate()},a),o(()=>this.layer?.opacity??1,t=>{this.container&&(this.container.opacity=t)},a),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",t=>{this.container&&(this.container.blendMode=t)},a),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,t=>{this.container&&(this.container.effect=t)},a),o(()=>this._mergedHighlights.items.map(t=>({name:t.name,options:{fillColor:t.color,haloColor:t.haloColor,fillOpacity:t.fillOpacity,haloOpacity:t.haloOpacity,haloWidth:t.haloWidth,haloBlur:t.haloBlur}})),()=>{this.container.highlightGradient=u(this.container.highlightGradient,this._mergedHighlights.items)},a),o(()=>this._mergedHighlights.items.map(t=>t.name),()=>{this._processHighlight()}),o(()=>this.clips.map(t=>t.version),async()=>{if(this.container){const t=this.view.spatialReference,e=await this._updatingHandles.addPromise(Promise.all(this.clips.items.map(e=>g.create(e,t))));for(const i of this.container.clips)i.destroy();this.container.clips=e.filter(t=>!!t)}},a),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:t,scaleRange:e})=>{const i=R(e,t);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)},a)],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(t=>{t===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1;for(const t of this.container?.clips??[])t.destroy()}get highlightOptions(){return this._logHighlightOptionsDeprecation(),this.highlights?.find(({name:t})=>t===v)}set highlightOptions(t){if(this._logHighlightOptionsDeprecation(),!this.highlights){if(!t)return;this.highlights=new e([new w])}const i=this.highlights.find(({name:t})=>t===v);t?i?.assignFrom(t):(this.highlights.remove(i),0===this.highlights.length&&(this.highlights=null))}_logHighlightOptionsDeprecation(){s(r.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:"View.highlights",version:"4.34",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}get hasHighlight(){return this._highlightCounter.size>0}get _mergedHighlights(){if(!this.view)return H;if(!this.highlights)return this.view.highlights;const t=this.view.highlights.clone();for(const e of this.highlights){const i=t.find(t=>t.name===e.name);i&&i.assignFrom(e)}return t}get highlightIds(){return Array.from(this._highlightCounter.objectIds)}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const t=this.view?.spatialReference;return null==t||this.supportsSpatialReference(t)}get updating(){if(!this.spatialReferenceSupported)return!1;if(!this.attached)return!0;if(this.suspended)return!1;return this.updateRequested||this.isUpdating()||this._updatingHandles?.updating||this.container.transitioning}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(t){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",t),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(t))):this.updateRequested=!1}hitTest(t,e){return Promise.resolve(null)}supportsSpatialReference(t){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":case"graphics":break;default:if(p(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const t=super.getSuspendInfo(),e=!this.spatialReferenceSupported;return e&&(t.spatialReferenceNotSupported=e),t}addAttachHandles(t){this.addHandles(t,"attach")}_addHighlights(t,e){this._highlightCounter.add(t,e)&&this._processHighlight()}_removeHighlights(t,e){this._highlightCounter.delete(t,e)&&this._processHighlight()}_processHighlight(){}_getHighlights(){const t=[];for(const[e,i]of this._highlightCounter.highlightNamesByObjectId){const s=this._getHighlightBits(i);t.push({objectId:e,highlightFlags:s})}return t}_getHighlightBits(t){const e=new Set(t);let i=1,s=0;if(!this.view)return 0;const h=this._mergedHighlights;for(const{name:r}of h)e.delete(r)&&(s=i),i<<=1;return s}};return t([n()],y.prototype,"attached",void 0),t([n({type:_,set(t){const e=i(t,this._get("clips"),_);this._set("clips",e)}})],y.prototype,"clips",void 0),t([n()],y.prototype,"container",void 0),t([n({type:w})],y.prototype,"highlightOptions",null),t([n({type:e.ofType(w)})],y.prototype,"highlights",void 0),t([n()],y.prototype,"_mergedHighlights",null),t([n()],y.prototype,"moving",void 0),t([n({readOnly:!0})],y.prototype,"spatialReferenceSupported",null),t([n({readOnly:!0})],y.prototype,"updateParameters",void 0),t([n()],y.prototype,"updateRequested",void 0),t([n()],y.prototype,"updating",null),t([n()],y.prototype,"view",void 0),t([n()],y.prototype,"_visibleAtCurrentScale",void 0),t([n({readOnly:!0})],y.prototype,"visibleAtCurrentScale",null),y=t([l("esri.views.2d.layers.LayerView2D")],y),y};export{S as LayerView2D};
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import h from"../../../core/Error.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{watch as o,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isLinkChartView as p}from"../../../linkChart/utils.js";import{Container as c}from"../engine/Container.js";import{ClipMesh as g}from"../engine/webgl/ClipMesh.js";import{HighlightCounter as d}from"./support/HighlightCounter.js";import{createOrReuseHighlightGradient as u}from"./support/util.js";import f from"../../layers/support/ClipRect.js";import m from"../../layers/support/GeometryClipArea.js";import y from"../../layers/support/Path.js";import{defaultHighlightName as v}from"../../support/HighlightDefaults.js";import w from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as R}from"../../support/layerViewUtils.js";const _=e.ofType({key:"type",base:null,typeMap:{rect:f,path:y,geometry:m}}),H=new(e.ofType(w)),S=f=>{const m=f;let y=class extends m{constructor(){super(...arguments),this._highlightCounter=new d,this.attached=!1,this.clips=new _,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const t=this.view?.spatialReferenceLocked??!0,e=this.view?.spatialReference;e&&t&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new h("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new c),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,t=>{this.container&&(this.container.visible=!t)},a),o(()=>this.updateSuspended,t=>{this.view&&!t&&this.updateRequested&&this.view.requestUpdate()},a),o(()=>this.layer?.opacity??1,t=>{this.container&&(this.container.opacity=t)},a),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",t=>{this.container&&(this.container.blendMode=t)},a),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,t=>{this.container&&(this.container.effect=t)},a),o(()=>this._mergedHighlights.items.map(t=>({name:t.name,options:{fillColor:t.color,haloColor:t.haloColor,fillOpacity:t.fillOpacity,haloOpacity:t.haloOpacity,haloWidth:t.haloWidth,haloBlur:t.haloBlur}})),()=>{this.container.highlightGradient=u(this.container.highlightGradient,this._mergedHighlights.items)},a),o(()=>this._mergedHighlights.items.map(t=>t.name),()=>{this._processHighlight()}),o(()=>this.clips.map(t=>t.version),async()=>{if(this.container){const t=this.view.spatialReference,e=await this._updatingHandles.addPromise(Promise.all(this.clips.items.map(e=>g.create(e,t))));for(const i of this.container.clips)i.destroy();this.container.clips=e.filter(t=>!!t)}},a),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:t,scaleRange:e})=>{const i=R(e,t);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)},a),o(()=>this.layer?.effectiveVisible,async t=>{this.container.requestDeclutter()})],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(t=>{t===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1;for(const t of this.container?.clips??[])t.destroy()}get highlightOptions(){return this._logHighlightOptionsDeprecation(),this.highlights?.find(({name:t})=>t===v)}set highlightOptions(t){if(this._logHighlightOptionsDeprecation(),!this.highlights){if(!t)return;this.highlights=new e([new w])}const i=this.highlights.find(({name:t})=>t===v);t?i?.assignFrom(t):(this.highlights.remove(i),0===this.highlights.length&&(this.highlights=null))}_logHighlightOptionsDeprecation(){s(r.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:"View.highlights",version:"4.34",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}get hasHighlight(){return this._highlightCounter.size>0}get _mergedHighlights(){if(!this.view)return H;if(!this.highlights)return this.view.highlights;const t=this.view.highlights.clone();for(const e of this.highlights){const i=t.find(t=>t.name===e.name);i&&i.assignFrom(e)}return t}get highlightIds(){return Array.from(this._highlightCounter.objectIds)}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const t=this.view?.spatialReference;return null==t||this.supportsSpatialReference(t)}get updating(){if(!this.spatialReferenceSupported)return!1;if(!this.attached)return!0;if(this.suspended)return!1;return this.updateRequested||this.isUpdating()||this._updatingHandles?.updating||this.container.transitioning}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(t){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",t),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(t))):this.updateRequested=!1}hitTest(t,e){return Promise.resolve(null)}supportsSpatialReference(t){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":case"graphics":break;default:if(p(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const t=super.getSuspendInfo(),e=!this.spatialReferenceSupported;return e&&(t.spatialReferenceNotSupported=e),t}addAttachHandles(t){this.addHandles(t,"attach")}_addHighlights(t,e){this._highlightCounter.add(t,e)&&this._processHighlight()}_removeHighlights(t,e){this._highlightCounter.delete(t,e)&&this._processHighlight()}_processHighlight(){}_getHighlights(){const t=[];for(const[e,i]of this._highlightCounter.highlightNamesByObjectId){const s=this._getHighlightBits(i);t.push({objectId:e,highlightFlags:s})}return t}_getHighlightBits(t){const e=new Set(t);let i=1,s=0;if(!this.view)return 0;const h=this._mergedHighlights;for(const{name:r}of h)e.delete(r)&&(s=i),i<<=1;return s}};return t([n()],y.prototype,"attached",void 0),t([n({type:_,set(t){const e=i(t,this._get("clips"),_);this._set("clips",e)}})],y.prototype,"clips",void 0),t([n()],y.prototype,"container",void 0),t([n({type:w})],y.prototype,"highlightOptions",null),t([n({type:e.ofType(w)})],y.prototype,"highlights",void 0),t([n()],y.prototype,"_mergedHighlights",null),t([n()],y.prototype,"moving",void 0),t([n({readOnly:!0})],y.prototype,"spatialReferenceSupported",null),t([n({readOnly:!0})],y.prototype,"updateParameters",void 0),t([n()],y.prototype,"updateRequested",void 0),t([n()],y.prototype,"updating",null),t([n()],y.prototype,"view",void 0),t([n()],y.prototype,"_visibleAtCurrentScale",void 0),t([n({readOnly:!0})],y.prototype,"visibleAtCurrentScale",null),y=t([l("esri.views.2d.layers.LayerView2D")],y),y};export{S as LayerView2D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../Graphic.js";import t from"../../../core/Collection.js";import i from"../../../core/Error.js";import"../../../core/has.js";import{some as r}from"../../../core/iteratorUtils.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as n}from"../../../core/MapUtils.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import l from"../../../core/ReactiveMap.js";import{watch as a,syncAndInitial as m,on as c}from"../../../core/reactiveUtils.js";import{isScreenRect as h}from"../../../core/screenUtils.js";import{property as p,subclass as d}from"../../../core/accessorSupport/decorators.js";import u from"../../../geometry/Extent.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as f}from"../../../geometry/support/contains.js";import{extentIntersectsPolygon as y}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as j}from"../../../layers/support/MediaElementView.js";import"../../../renderers/SimpleRenderer.js";import"../../../symbols/SimpleFillSymbol.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/Accessor.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../core/RandomLCG.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/GpuMeshState.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import _ from"../tiling/TileQueue.js";import w from"../tiling/TileStrategy.js";import v from"../engine/webgl/Overlay.js";import b from"../engine/webgl/OverlayContainer.js";import{LayerView2D as E}from"./LayerView2D.js";import S from"../../layers/MediaLayerView.js";import{TaskPriority as R}from"../../support/Scheduler.js";let T=class extends(E(S)){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new l,this._debugGraphicsView=null,this._interaction=null,this.elements=new t}initialize(){this.addHandles([a(()=>[this.interactive,this.suspended],async()=>{if(this.interactive&&!this._interaction){const{MediaLayerInteraction:e}=await this._updatingHandles.addPromise(import("./support/MediaLayerInteraction.js"));if(this.destroyed)return;this._interaction=new e({view:this.view,layer:this.layer}),this.selectedElement!==this._interaction.selectedElement&&(this._interaction.selectedElement=this.selectedElement),this.interactionOptions!==this._interaction.options&&(this._interaction.options=this.interactionOptions)}this._interaction&&(this._interaction.enabled=!this.suspended&&this.interactive)},m),a(()=>this.interactionOptions,e=>{this._interaction&&(this._interaction.options=e)},m),a(()=>this.selectedElement,e=>{this._interaction&&(this._interaction.selectedElement=e)},m)])}isUpdating(){return!0===this._interaction?.updating||r(this._elementReferences.values(),({overlay:e})=>!e.isReady)}attach(){this.addAttachHandles([c(()=>this.layer.effectiveSource,"refresh",()=>{this._tileStrategy.refresh(e=>this._updateTile(e)),this.requestUpdate()}),c(()=>this.layer.effectiveSource,"change",({element:e})=>this._elementUpdateHandler(e))]),this._overlayContainer=new b,this.container.addChild(this._overlayContainer),this._fetchQueue=new _({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t),scheduler:this.scheduler,priority:R.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new w({cachePolicy:"purge",resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){const i=[],r=e.normalize(),s=[r.x,r.y];for(const{elementView:{normalizedCoords:n,element:o}}of this._elementReferences.values())null!=n&&f(n.rings,s)&&i.push({type:"media",element:o,layer:this.layer,mapPoint:h(t)?null:e,sourcePoint:o.toSource(e)});return i.reverse()}canResume(){return null!=this.layer.source&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updateTile(e))}_acquireTile(e){const t=new V(e.clone());return this._updateTile(t),t}_updateTile(e){this._updatingHandles.consumePromise(this._fetchQueue.push(e.key).then(t=>{const[i,r]=e.setElements(t);this._referenceElements(e,i),this._dereferenceElements(e,r),this.requestUpdate()},e=>{o(e)||s.getLogger(this).error(e)}))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){const i=this.layer.effectiveSource;if(null==i)return[];this.view.featuresTilingScheme.getTileBounds(G,e,!0);const r=new u({xmin:G[0],ymin:G[1],xmax:G[2],ymax:G[3],spatialReference:this.view.spatialReference});return i.queryElements(r,t)}_referenceElements(e,t){if(null!=this.layer.source)for(const i of t)this._referenceElement(e,i)}_referenceElement(e,t){n(this._elementReferences,t.uid,()=>{const e=new j({element:t,spatialReference:this.view.spatialReference}),r=new v(e);return this._overlayContainer.addChild(r),this.elements.add(t),this._updatingHandles.consumePromise(t.load().catch(e=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new i("element-load-error","Element cannot be displayed",{element:t,error:e}))})),{debugGraphic:null,elementView:e,overlay:r,tiles:new Set}}).tiles.add(e)}_dereferenceElements(e,t){for(const i of t)this._dereferenceElement(e,i)}_dereferenceElement(e,t){const i=this._elementReferences.get(t.uid);i.tiles.delete(e),i.tiles.size||(this._overlayContainer.removeChild(i.overlay),i.overlay.destroy(),i.elementView.destroy(),this._elementReferences.delete(t.uid),this.elements.remove(t),this._debugGraphicsView?.graphics.remove(i.debugGraphic))}_elementUpdateHandler(e){let t=this._elementReferences.get(e.uid);if(t){const i=t.elementView.normalizedCoords;if(null==i)return this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.elementView.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),void this._debugGraphicsView?.graphics.remove(t.debugGraphic);const r=[],s=[];for(const e of this._tileStrategy.tiles){const n=C(this.view.featuresTilingScheme,e,i);t.tiles.has(e)?n||s.push(e):n&&r.push(e)}for(const t of r)this._referenceElement(t,e);for(const t of s)this._dereferenceElement(t,e);return t=this._elementReferences.get(e.uid),void(t?.debugGraphic&&(t.debugGraphic.geometry=t.elementView.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:"geometry"})))}const i=new j({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(null!=i)for(const r of this._tileStrategy.tiles){C(this.view.featuresTilingScheme,r,i)&&this._referenceElement(r,e)}}};e([p({readOnly:!0})],T.prototype,"elements",void 0),T=e([d("esri.views.2d.layers.MediaLayerView2D")],T);const G=g(),U={xmin:0,ymin:0,xmax:0,ymax:0};function C(e,t,i){return e.getTileBounds(G,t.key,!0),U.xmin=G[0],U.ymin=G[1],U.xmax=G[2],U.ymax=G[3],y(U,i)}class V{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){const t=[],i=new Set(this.elements);this.elements=e;for(const r of e)i.has(r)?i.delete(r):t.push(r);return this.isReady=!0,[t,Array.from(i)]}destroy(){}}const q=T;export{q as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../Graphic.js";import t from"../../../core/Collection.js";import i from"../../../core/Error.js";import"../../../core/has.js";import{some as r}from"../../../core/iteratorUtils.js";import s from"../../../core/Logger.js";import{getOrCreateMapValue as o}from"../../../core/MapUtils.js";import{isAbortError as n}from"../../../core/promiseUtils.js";import l from"../../../core/ReactiveMap.js";import{watch as a,syncAndInitial as m,on as c}from"../../../core/reactiveUtils.js";import{isScreenRect as p}from"../../../core/screenUtils.js";import{property as h,subclass as d}from"../../../core/accessorSupport/decorators.js";import u from"../../../geometry/Extent.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{ringsContainsCoords as f}from"../../../geometry/support/contains.js";import{targetIntersectsPolygon as y,extentIntersectsPolygon as j}from"../../../geometry/support/intersectsBase.js";import{MediaElementView as _}from"../../../layers/support/MediaElementView.js";import"../../../renderers/SimpleRenderer.js";import"../../../symbols/SimpleFillSymbol.js";import"../engine/Stage.js";import"../../../Color.js";import"../../../core/Accessor.js";import"../../../core/mathUtils.js";import"../../../core/libs/gl-matrix-2/factories/vec4f32.js";import"../../../geometry/Point.js";import"../../../chunks/pe.js";import"../../../core/units.js";import"../../../geometry/ellipsoidUtils.js";import"../../../geometry/support/spatialReferenceUtils.js";import"../../../core/RandomLCG.js";import"../engine/transitions/FadeTransition.js";import"../../webgl/BufferObject.js";import"../../webgl/FramebufferObject.js";import"../../webgl/Program.js";import"../../webgl/Renderbuffer.js";import"../../webgl/Texture.js";import"../../webgl/enums.js";import"../../webgl/Util.js";import"../engine/webgl/meshing/definitions.js";import"../engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"../LabelManager.js";import"./graphics/GraphicsView2D.js";import"../../../layers/effects/EffectView.js";import"../engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"../engine/webgl/AFeatureTile.js";import"../engine/webgl/DisplayEntity.js";import"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import"../engine/webgl/number.js";import"../engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"../engine/webgl/cpuMapped/GpuMeshState.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"../engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"./support/util.js";import"../navigation/MapViewNavigation.js";import"../../../request.js";import"../../../core/asyncUtils.js";import"../../../core/support/UpdatingHandles.js";import"../../../core/urlUtils.js";import"../engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../../../geometry/Geometry.js";import"../../../geometry/Multipoint.js";import"../../../geometry/Polygon.js";import"../../../geometry/Polyline.js";import"../../../geometry/SpatialReference.js";import"../../../geometry/spatialReferenceEllipsoidUtils.js";import"../../../geometry/operators/support/GeographicTransformation.js";import"../../../geometry/projection/projectors.js";import"../engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../../../geometry/support/geodesicConstants.js";import"../../../geometry/support/Ellipsoid.js";import"../tiling/TileInfoView.js";import"../tiling/TileKey.js";import w from"../tiling/TileQueue.js";import v from"../tiling/TileStrategy.js";import b from"../engine/webgl/Overlay.js";import S from"../engine/webgl/OverlayContainer.js";import{LayerView2D as E}from"./LayerView2D.js";import{getMapPointsFromScreen as T}from"../support/hitTestUtils.js";import R from"../../layers/MediaLayerView.js";import{TaskPriority as U}from"../../support/Scheduler.js";let G=class extends(E(R)){constructor(){super(...arguments),this._overlayContainer=null,this._fetchQueue=null,this._tileStrategy=null,this._elementReferences=new l,this._debugGraphicsView=null,this._interaction=null,this.elements=new t}initialize(){this.addHandles([a(()=>[this.interactive,this.suspended],async()=>{if(this.interactive&&!this._interaction){const{MediaLayerInteraction:e}=await this._updatingHandles.addPromise(import("./support/MediaLayerInteraction.js"));if(this.destroyed)return;this._interaction=new e({view:this.view,layer:this.layer}),this.selectedElement!==this._interaction.selectedElement&&(this._interaction.selectedElement=this.selectedElement),this.interactionOptions!==this._interaction.options&&(this._interaction.options=this.interactionOptions)}this._interaction&&(this._interaction.enabled=!this.suspended&&this.interactive)},m),a(()=>this.interactionOptions,e=>{this._interaction&&(this._interaction.options=e)},m),a(()=>this.selectedElement,e=>{this._interaction&&(this._interaction.selectedElement=e)},m)])}isUpdating(){return!0===this._interaction?.updating||r(this._elementReferences.values(),({overlay:e})=>!e.isReady)}attach(){this.addAttachHandles([c(()=>this.layer.effectiveSource,"refresh",()=>{this._tileStrategy.refresh(e=>this._updateTile(e)),this.requestUpdate()}),c(()=>this.layer.effectiveSource,"change",({element:e})=>this._elementUpdateHandler(e))]),this._overlayContainer=new S,this.container.addChild(this._overlayContainer),this._fetchQueue=new w({tileInfoView:this.view.featuresTilingScheme,concurrency:10,process:(e,t)=>this._queryElements(e,t),scheduler:this.scheduler,priority:U.MAPVIEW_FETCH_QUEUE}),this._tileStrategy=new v({cachePolicy:"purge",resampling:!0,acquireTile:e=>this._acquireTile(e),releaseTile:e=>this._releaseTile(e),tileInfoView:this.view.featuresTilingScheme}),this.requestUpdate()}detach(){this.elements.removeAll(),this._tileStrategy.destroy(),this._fetchQueue.destroy(),this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this._elementReferences.clear(),this._debugGraphicsView?.destroy()}supportsSpatialReference(e){return!0}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}update(e){this._tileStrategy.update(e),this._debugGraphicsView?.update(e)}async hitTest(e,t){const i=[],r=e.normalize(),s=[r.x,r.y],o=p(t);for(const{elementView:{normalizedCoords:n,element:l}}of this._elementReferences.values())if(o){const r=T(this.view,t).map(e=>[e.x,e.y]);null!=n&&y(r,n.rings)&&i.push({type:"media",element:l,layer:this.layer,mapPoint:null,sourcePoint:l.toSource(e)})}else null!=n&&f(n.rings,s)&&i.push({type:"media",element:l,layer:this.layer,mapPoint:e,sourcePoint:l.toSource(e)});return i.reverse()}canResume(){return null!=this.layer.source&&super.canResume()}async doRefresh(){this._fetchQueue.reset(),this._tileStrategy.refresh(e=>this._updateTile(e))}_acquireTile(e){const t=new x(e.clone());return this._updateTile(t),t}_updateTile(e){this._updatingHandles.consumePromise(this._fetchQueue.push(e.key).then(t=>{const[i,r]=e.setElements(t);this._referenceElements(e,i),this._dereferenceElements(e,r),this.requestUpdate()},e=>{n(e)||s.getLogger(this).error(e)}))}_releaseTile(e){this._fetchQueue.abort(e.key.id),e.elements&&this._dereferenceElements(e,e.elements),this.requestUpdate()}async _queryElements(e,t){const i=this.layer.effectiveSource;if(null==i)return[];this.view.featuresTilingScheme.getTileBounds(C,e,!0);const r=new u({xmin:C[0],ymin:C[1],xmax:C[2],ymax:C[3],spatialReference:this.view.spatialReference});return i.queryElements(r,t)}_referenceElements(e,t){if(null!=this.layer.source)for(const i of t)this._referenceElement(e,i)}_referenceElement(e,t){o(this._elementReferences,t.uid,()=>{const e=new _({element:t,spatialReference:this.view.spatialReference}),r=new b(e);return this._overlayContainer.addChild(r),this.elements.add(t),this._updatingHandles.consumePromise(t.load().catch(e=>{s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new i("element-load-error","Element cannot be displayed",{element:t,error:e}))})),{debugGraphic:null,elementView:e,overlay:r,tiles:new Set}}).tiles.add(e)}_dereferenceElements(e,t){for(const i of t)this._dereferenceElement(e,i)}_dereferenceElement(e,t){const i=this._elementReferences.get(t.uid);i.tiles.delete(e),i.tiles.size||(this._overlayContainer.removeChild(i.overlay),i.overlay.destroy(),i.elementView.destroy(),this._elementReferences.delete(t.uid),this.elements.remove(t),this._debugGraphicsView?.graphics.remove(i.debugGraphic))}_elementUpdateHandler(e){let t=this._elementReferences.get(e.uid);if(t){const i=t.elementView.normalizedCoords;if(null==i)return this._overlayContainer.removeChild(t.overlay),t.overlay.destroy(),t.elementView.destroy(),this._elementReferences.delete(e.uid),this.elements.remove(e),void this._debugGraphicsView?.graphics.remove(t.debugGraphic);const r=[],s=[];for(const e of this._tileStrategy.tiles){const o=q(this.view.featuresTilingScheme,e,i);t.tiles.has(e)?o||s.push(e):o&&r.push(e)}for(const t of r)this._referenceElement(t,e);for(const t of s)this._dereferenceElement(t,e);return t=this._elementReferences.get(e.uid),void(t?.debugGraphic&&(t.debugGraphic.geometry=t.elementView.normalizedCoords,this._debugGraphicsView.graphicUpdateHandler({graphic:t.debugGraphic,property:"geometry"})))}const i=new _({element:e,spatialReference:this.view.spatialReference}).normalizedCoords;if(null!=i)for(const r of this._tileStrategy.tiles){q(this.view.featuresTilingScheme,r,i)&&this._referenceElement(r,e)}}};e([h({readOnly:!0})],G.prototype,"elements",void 0),G=e([d("esri.views.2d.layers.MediaLayerView2D")],G);const C=g(),V={xmin:0,ymin:0,xmax:0,ymax:0};function q(e,t,i){return e.getTileBounds(C,t.key,!0),V.xmin=C[0],V.ymin=C[1],V.xmax=C[2],V.ymax=C[3],j(V,i)}class x{constructor(e){this.key=e,this.elements=null,this.isReady=!1,this.visible=!0}setElements(e){const t=[],i=new Set(this.elements);this.elements=e;for(const r of e)i.has(r)?i.delete(r):t.push(r);return this.isReady=!0,[t,Array.from(i)]}destroy(){}}const M=G;export{M as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{GeohashCell as r}from"../../../../../geohash/GeohashCell.js";import{GeohashTree as t}from"../../../../../geohash/GeohashTree.js";import{getGeohash as o,getGeohashBounds as s}from"../../../../../geohash/geohashUtils.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{createArcadeEvaluationOptions as n}from"../support/arcadeUtils.js";class a extends i{constructor(e,r){super(e),this._reader=r,this._tree=new t,this.insert(this._reader)}get usedMemory(){return this._tree.usedMemory}forEachInCell(e,r){throw new Error("Not supported.")}insert(e){const r=e.getCursor(),{featureFilter:t,sqlOptions:s,geohashLevel:i,spatialReference:n}=this.options.inner;for(;r.next();){const e=r;if(null!==t&&!t.check(e,s))continue;let a=0,h=0;if("esriGeometryPoint"===e.geometryType)a=e.readXWorldSpace(),h=e.readYWorldSpace();else{const r=e.readCentroidWorldSpace();if(null==r)
|
|
2
|
+
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{GeohashCell as r}from"../../../../../geohash/GeohashCell.js";import{GeohashTree as t}from"../../../../../geohash/GeohashTree.js";import{getGeohash as o,getGeohashBounds as s}from"../../../../../geohash/geohashUtils.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{createArcadeEvaluationOptions as n}from"../support/arcadeUtils.js";class a extends i{constructor(e,r){super(e),this._reader=r,this._tree=new t,this.insert(this._reader)}get usedMemory(){return this._tree.usedMemory}forEachInCell(e,r){throw new Error("Not supported.")}insert(e){const r=e.getCursor(),{featureFilter:t,sqlOptions:s,geohashLevel:i,spatialReference:n}=this.options.inner;for(;r.next();){const e=r;if(null!==t&&!t.check(e,s))continue;let a=0,h=0;if("esriGeometryPoint"===e.geometryType)a=e.readXWorldSpace(),h=e.readYWorldSpace();else{const r=e.readCentroidWorldSpace();if(null==r)continue;[a,h]=r.coords}const d=o(a,h,i,n);d&&this._tree.insert(e,d[0],d[1],i)}}put(e,r){throw new Error("Not supported.")}putBounded(t,o,i,a){const{arcadeContextInfo:h,scale:d,geohashLevel:l,spatialReference:c,fields:p}=this.options.inner,u=n(d,h),f=s(i,a,l,c);null!=f&&this._tree.forEachInBounds(f,s=>{let i=null;for(const n of s.indices){this._reader.setIndex(n);const a=this._reader.getObjectId();o.has(a)||(i??=e(t,s.id,()=>r.create(p,s.xNode,s.yNode,s.depth)),i.insert(this._reader,l,c,u),o.add(a))}})}}export{a as GeohashSpatialIndex};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{getMetersPerUnitForSR as t,inchesPerMeter as r}from"../../../../../core/units.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{GridCell as s}from"./GridCell.js";import{GridIndexCell as n}from"./GridIndexCell.js";import{createArcadeEvaluationOptions as o}from"../support/arcadeUtils.js";const l=96;function a(e,i){return t(e)*r*l/i}class c extends i{constructor(e,t){super(e),this._reader=t,this._cells=new Map,this._pixelsPerMapUnit=a(e.inner.spatialReference,e.inner.scale),this.insert(this._reader)}get worldUnitsPerCell(){return 1*this.options.inner.cellSize/this._pixelsPerMapUnit}insert(e){const t=e.getCursor();for(;t.next();){const e=t,{featureFilter:r,sqlOptions:i,cellSize:s}=this.options.inner;if(null!==r&&!r.check(e,i))continue;let n=0,o=0;if("esriGeometryPoint"===e.geometryType)n=e.readXWorldSpace(),o=e.readYWorldSpace();else{const t=e.readCentroidWorldSpace();if(null==t)
|
|
2
|
+
import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import{getMetersPerUnitForSR as t,inchesPerMeter as r}from"../../../../../core/units.js";import{AAggregateSpatialIndex as i}from"./AAggregateSpatialIndex.js";import{GridCell as s}from"./GridCell.js";import{GridIndexCell as n}from"./GridIndexCell.js";import{createArcadeEvaluationOptions as o}from"../support/arcadeUtils.js";const l=96;function a(e,i){return t(e)*r*l/i}class c extends i{constructor(e,t){super(e),this._reader=t,this._cells=new Map,this._pixelsPerMapUnit=a(e.inner.spatialReference,e.inner.scale),this.insert(this._reader)}get worldUnitsPerCell(){return 1*this.options.inner.cellSize/this._pixelsPerMapUnit}insert(e){const t=e.getCursor();for(;t.next();){const e=t,{featureFilter:r,sqlOptions:i,cellSize:s}=this.options.inner;if(null!==r&&!r.check(e,i))continue;let n=0,o=0;if("esriGeometryPoint"===e.geometryType)n=e.readXWorldSpace(),o=e.readYWorldSpace();else{const t=e.readCentroidWorldSpace();if(null==t)continue;[n,o]=t.coords}const l=n*this._pixelsPerMapUnit,a=o*this._pixelsPerMapUnit,c=Math.floor(l/s),d=Math.floor(a/s);this._getCellOrCreate(c,d).push(t.getIndex())}}get usedMemory(){return 0}forEachInCell(e,t){const r=this._cells.get(e);if(r)for(const i of r._indices)this._reader.setIndex(i),t(this._reader)}put(t,r){const{arcadeContextInfo:i,scale:n,fields:l}=this.options.inner,a=o(n,i);this._cells.forEach(i=>{let n=null;for(const o of i._indices){this._reader.setIndex(o);const c=this._reader.getObjectId();r.has(c)||(n??=e(t,i.id,()=>s.create(i.gridX,i.gridY,l,this.worldUnitsPerCell)),n.insert(this._reader,a),r.add(c))}})}putBounded(t,r,i,n){const{arcadeContextInfo:l,scale:a,cellSize:c,fields:d}=this.options.inner,h=o(a,l),p=[i.xmin,i.ymin,i.xmax,i.ymax],[f,_,u,x]=p,m=Math.floor(f*this._pixelsPerMapUnit/c),g=Math.floor(_*this._pixelsPerMapUnit/c),M=Math.ceil(u*this._pixelsPerMapUnit/c),C=Math.ceil(x*this._pixelsPerMapUnit/c);for(let o=g;o<=C;o++)for(let i=m;i<=M;i++){const n=s.createId(i,o),l=this._cells.get(n);if(!l)continue;let a=null;for(const c of l._indices){this._reader.setIndex(c);const n=this._reader.getObjectId();r.has(n)||(a??=e(t,l.id,()=>s.create(i,o,d,this.worldUnitsPerCell)),a.insert(this._reader,h),r.add(n))}}}_getCellOrCreate(e,t){const r=n.createId(e,t);let i=this._cells.get(r);return i||(i=new n(e,t),this._cells.set(r,i)),i}}export{c as GridSpatialIndex,a as pixelsPerMapUnit};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{clone as e}from"../../../../../core/lang.js";import{sqlNotIn as t,sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import a from"../../../../../layers/support/FeatureFilter.js";import{createFeatureIdInfo as i}from"./featureServiceUtils.js";import{addFloorFilter as o,hasFloorFilter as n}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{ExceedsLimitCache as
|
|
2
|
+
import{clone as e}from"../../../../../core/lang.js";import{sqlNotIn as t,sqlAnd as r}from"../../../../../core/sql.js";import{isHostedAgolService as s}from"../../../../../layers/support/arcgisLayerUrl.js";import a from"../../../../../layers/support/FeatureFilter.js";import{createFeatureIdInfo as i}from"./featureServiceUtils.js";import{addFloorFilter as o,hasFloorFilter as n}from"./floorFilterUtils.js";import{getServiceGeometryType as l}from"./geometryUtils.js";import{ExceedsLimitCache as p}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as u,createFeatureSourceSchema as c}from"../schema/SourceSchema.js";import{getSortKey as m}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as y}from"../schema/processor/StorageSchema.js";import{getAnnotationMatcherSchema as d}from"../../support/annodime/annotationSchema.js";import{annotationRealFields as h,annotationVirtualFields as f}from"../../support/annodime/fields.js";import{getReferenceScale as g}from"../../support/annodime/utils.js";class S{constructor(e){this.layer=e,this._cache=new p}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,a=this.layer.refreshInterval>0,i=!s&&a,o=u("isSourceHosted"in r&&r.isSourceHosted,i,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);let n=[];return n=e.availableFields.concat(...h),c(r,o,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:[],displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:n,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:a}=await this._fetchAnnotationDataElementRequest(e,{type:"annotation-data-element-request"}),{objectIdField:i}=this.layer,o=m(null,null,i);return{storage:y(null,t.filters),mesh:{properties:{sortKey:o,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:a}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e,s){e=o(this.layer,e,s);const i=this.layer.sublayers.filter(e=>!e.visible).map(e=>e.subtypeCode);if(!i.length)return e;e??=new a;const n=t(this.layer.subtypeField,i.toArray());return e.where=r(e.where,n),e}getUpdateHashProperties(e){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>n(this.layer,e)?e.floors:null,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields,()=>this.layer.sublayers.map(({visible:e})=>({visible:e}))]}getRenderer(){return null}setGraphicOrigin(e){const t=this.layer.findSublayerForFeature(e);e.layer=e.sourceLayer=this.layer,e.origin=t?.graphicOrigin}_createServiceInfo(t){const r=this.layer,a=r.fieldsIndex.toJSON();a.fields.push(...f);const{capabilities:o,editingInfo:n,globalIdField:p,datesInUnknownTimezone:u,dateFieldsTimeZone:c,subtypeField:m}=r,y=l(r),d=r.timeInfo?.toJSON(),h=r.spatialReference.toJSON(),g=e(this.layer.parsedUrl),S=this.layer.objectIdField,b=s(g.path),F=t.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:b,orderByFields:S,outSpatialReference:F,metadata:{timeReferenceUnknownClient:u,dateFieldsTimeZone:c,subtypeField:m,globalIdField:p,fieldsIndex:a,geometryType:y,featureIdInfo:i(r),timeInfo:d,spatialReference:h,outSpatialReference:F,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),typeIdField:null,types:null,layerType:r.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:o.query.supportsFormatPBF,supportsQuantization:!1,maxRecordCount:o.query.maxRecordCount,tileMaxRecordCount:o.query.tileMaxRecordCount,supportsCompactGeometry:o.query.supportsCompactGeometry,supportsDefaultSpatialReference:o.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:o.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:o.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:o.query.supportsDegeneratedQuantizedGeometry,lastEditDate:n?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:o.query.supportsReturnExceededLimitGeometries}}}async _fetchAnnotationDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,a=await s.fetchDataElement(),i=g(a);return{type:"annotation-data-element-response",dataElement:a,meshes:await d(a,r),referenceScale:i}}}export{S as AnnotationLayerAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{createFeatureIdInfo as r}from"./featureServiceUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{ExceedsLimitCache as i}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as a,createFeatureSourceSchema as o}from"../schema/SourceSchema.js";import{getSortKey as n}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as l}from"../schema/processor/StorageSchema.js";import{getDimensionMatcherSchema as c}from"../../support/annodime/dimensionSchema.js";import{dimensionRealFields as p,dimensionVirtualFields as u}from"../../support/annodime/fields.js";import{getReferenceScale as m}from"../../support/annodime/utils.js";class d{constructor(e){this.layer=e,this._cache=new i}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,i=this.layer.refreshInterval>0,n=!s&&i,l=a("isSourceHosted"in r&&r.isSourceHosted,n,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);let c=[];return c=e.availableFields.concat(...p),o(r,l,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:[],displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:c,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:i}=await this._fetchDimensionDataElementRequest(e,{type:"dimension-data-element-request"}),{objectIdField:a}=this.layer,o=n(null,null,a);return{storage:l(null,t.filters),mesh:{properties:{sortKey:o,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:i}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e){return e}getUpdateHashProperties(){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields]}getRenderer(){return null}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}_createServiceInfo(i){const a=this.layer,o=a.fieldsIndex.toJSON();o.fields.push(...u);const{capabilities:n,editingInfo:l,globalIdField:c,datesInUnknownTimezone:p,dateFieldsTimeZone:m,subtypeField:d}=a,y=s(a),h=a.timeInfo?.toJSON(),f=a.spatialReference.toJSON(),g=e(this.layer.parsedUrl),S=this.layer.objectIdField,R=t(g.path),
|
|
2
|
+
import{clone as e}from"../../../../../core/lang.js";import{isHostedAgolService as t}from"../../../../../layers/support/arcgisLayerUrl.js";import{createFeatureIdInfo as r}from"./featureServiceUtils.js";import{getServiceGeometryType as s}from"./geometryUtils.js";import{ExceedsLimitCache as i}from"../schema/ExceedsLimitCache.js";import{createSnapshotInfo as a,createFeatureSourceSchema as o}from"../schema/SourceSchema.js";import{getSortKey as n}from"../schema/processor/SimpleProcessorSchema.js";import{createStorageSchema as l}from"../schema/processor/StorageSchema.js";import{getDimensionMatcherSchema as c}from"../../support/annodime/dimensionSchema.js";import{dimensionRealFields as p,dimensionVirtualFields as u}from"../../support/annodime/fields.js";import{getReferenceScale as m}from"../../support/annodime/utils.js";class d{constructor(e){this.layer=e,this._cache=new i}getLabelingDeconflictionInfo(){return[]}async createSourceSchema(e,t){const r=this._createServiceInfo(e),s=null!=this.layer.editingInfo?.lastEditDate,i=this.layer.refreshInterval>0,n=!s&&i,l=a("isSourceHosted"in r&&r.isSourceHosted,n,this.layer.capabilities,r.metadata.geometryType,e.extent,this.layer.fullExtent);let c=[];return c=e.availableFields.concat(...p),o(r,l,{definitionExpression:this.layer.definitionExpression,queryScaleRanges:[],displayFilterEnabled:!1,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:this.layer.gdbVersion,historicMoment:this.layer.historicMoment,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:t,availableFields:c,cache:this._cache,postQueryFilter:null,returnM:!1,returnZ:!1})}async createProcessorSchema(e,t,r){const{meshes:s,referenceScale:i}=await this._fetchDimensionDataElementRequest(e,{type:"dimension-data-element-request"}),{objectIdField:a}=this.layer,o=n(null,null,a);return{storage:l(null,t.filters),mesh:{properties:{sortKey:o,timeZone:t.timeZone,returnMeshObjectId:!1,displayRefreshVersion:r,currentUser:t.currentUser},strategy:{type:"feature"},factory:{symbology:s,labels:{type:"label",classes:[]},referenceScale:i}},expressionProperties:{timeExtent:null}}}get hasRequiredSupport(){return!0}get timeOptions(){return this.layer}addFilters(e){return e}getUpdateHashProperties(){return this.layer.destroyed?[]:[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>this.layer.definitionExpression,()=>this.layer.gdbVersion,()=>this.layer.historicMoment,()=>this.layer.outFields]}getRenderer(){return null}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}_createServiceInfo(i){const a=this.layer,o=a.fieldsIndex.toJSON();o.fields.push(...u);const{capabilities:n,editingInfo:l,globalIdField:c,datesInUnknownTimezone:p,dateFieldsTimeZone:m,subtypeField:d}=a,y=s(a),h=a.timeInfo?.toJSON(),f=a.spatialReference.toJSON(),g=e(this.layer.parsedUrl),S=this.layer.objectIdField,R=t(g.path),F=i.spatialReference.toJSON();return{type:"feature-service",source:g,isSourceHosted:R,orderByFields:S,outSpatialReference:F,metadata:{timeReferenceUnknownClient:p,dateFieldsTimeZone:m,subtypeField:d,globalIdField:c,fieldsIndex:o,geometryType:y,featureIdInfo:r(a),timeInfo:h,spatialReference:f,outSpatialReference:F,subtypes:this.layer.subtypes?.map(e=>e.toJSON()),typeIdField:null,types:null,layerType:a.type,hasM:!1,hasZ:!1},queryMetadata:{supportsFormatPBF:n.query.supportsFormatPBF,supportsQuantization:!1,maxRecordCount:n.query.maxRecordCount,tileMaxRecordCount:n.query.tileMaxRecordCount,supportsCompactGeometry:n.query.supportsCompactGeometry,supportsDefaultSpatialReference:n.query.supportsDefaultSpatialReference,supportsMaxRecordCountFactor:n.query.supportsMaxRecordCountFactor,supportsCentroidOnDegeneratedQuantizedGeometry:n.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:n.query.supportsDegeneratedQuantizedGeometry,lastEditDate:l?.lastEditDate?.getTime(),supportsReturnExceededLimitGeometries:n.query.supportsReturnExceededLimitGeometries}}}async _fetchDimensionDataElementRequest(e,t){const r={cimAnalyzer:e.cimAnalyzer,cimResourceManager:e.cimResourceManager,store:e.store,scaleExpression:null},s=this.layer,i=await s.fetchDataElement(),a=m(i);return{type:"dimension-data-element-response",dataElement:i,meshes:await c(i,r),referenceScale:a}}}export{d as DimensionLayerAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i,createTrackStorageSchema as n}from"./StorageSchema.js";import{createVisualVariableUniforms as a}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,n=a(i);return{symbology:await s(e,i),labels:await t(e,r,n)}}async function o(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return f(n,e,r,t,s);case"cluster":return b(n,e,r,t,s)}if(t.trackInfo?.enabled)return y(t.trackInfo,e,r,t,s);t.symbolLayerDrawing?.enabled
|
|
2
|
+
import{pt2px as e}from"../../../../../../core/screenUtils.js";import r from"../../../../../../layers/support/OrderByInfo.js";import{createLabelMatcherSchema as t}from"./LabelMatcherSchema.js";import{createMatcherSchema as s}from"./MatcherSchema.js";import{createStorageSchema as i,createTrackStorageSchema as n}from"./StorageSchema.js";import{createVisualVariableUniforms as a}from"./VisualVariablesSchema.js";async function l(e,r){const i=r.renderer,n=a(i);return{symbology:await s(e,i),labels:await t(e,r,n)}}async function o(e,r,t,s){const n=t.featureReduction;if(n)switch(n.type){case"binning":return f(n,e,r,t,s);case"cluster":return b(n,e,r,t,s)}if(t.trackInfo?.enabled)return y(t.trackInfo,e,r,t,s);e.symbolLayerDrawing=t.symbolLayerDrawing?.enabled?t.symbolLayerDrawing:null;const a=p(t.orderBy,t.renderer,t.objectIdField),o=i(t.renderer,r.filters),c=await l(e,t),u=d(c.symbology);return{storage:o,mesh:{properties:{sortKey:a,timeZone:r.timeZone,returnMeshObjectId:u,displayRefreshVersion:s,currentUser:r.currentUser},strategy:{type:"feature"},factory:c},expressionProperties:{timeExtent:r.timeExtent?.toJSON()}}}function c(e,r){return e.fields.map(e=>({...e.toJSON(),type:u(e,r)}))}function u(e,r){const{onStatisticExpression:t,onStatisticField:s,statisticType:i}=e;switch(i){case"min":case"max":case"avg":case"avg_angle":case"sum":case"count":return"esriFieldTypeDouble";case"mode":{if(t){const{returnType:e}=t;return e?"string"===e?"esriFieldTypeString":"esriFieldTypeDouble":"esriFieldTypeString"}const e=r.find(e=>e.name===s);return e?e.type:"esriFieldTypeString"}}}async function f(r,n,l,o,u){const f=c(r,o.fields),b=r.renderer,y=await s(n,b),p=i(b,[null,null]),m=a(b),g=await t(n,{geometryType:"polygon",labelingInfoSource:o.labelingInfoSource+"-binning",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},m),v=d(y),h="geohash"===r.binType?{type:"geohash",fixBinLevel:r.fixedBinLevel??3}:{type:"grid",size:e(r.size),fixedBinLevel:r.fixedBinLevel};return{storage:p,mesh:{properties:{sortKey:null,timeZone:l.timeZone,returnMeshObjectId:v,displayRefreshVersion:u,currentUser:l.currentUser},strategy:{type:"binning",fields:f,index:h,featureFilter:l.filters[0]},factory:{labels:g,symbology:y}},expressionProperties:{timeExtent:l.timeExtent?.toJSON()}}}async function b(r,n,l,o,u){const f=c(r,o.fields),b={type:"cluster",feature:await s(n,r.effectiveFeatureRenderer),cluster:await s(n,r.effectiveClusterRenderer)},y=a(r.effectiveFeatureRenderer),p={type:"cluster",feature:await t(n,o,y),cluster:await t(n,{geometryType:"point",labelingInfoSource:o.labelingInfoSource+"-clusters",labelingInfo:r.labelingInfo,labelsVisible:r.labelsVisible},y)},m=i(r.effectiveFeatureRenderer,[null,null]),g=d(b);return{storage:m,mesh:{properties:{sortKey:null,timeZone:l.timeZone,displayRefreshVersion:u,returnMeshObjectId:g,currentUser:l.currentUser},strategy:{type:"cluster",fields:f,featureFilter:l.filters[0],clusterRadius:e(r.clusterRadius/2)},factory:{labels:p,symbology:b}},expressionProperties:{timeExtent:l.timeExtent?.toJSON()}}}async function y(e,r,i,l,o){const u=c(e,l.fields),f={type:"track",previousObservation:await s(r,e.previousObservations.renderer),latestObservation:await s(r,e.latestObservations.renderer),trackLine:await s(r,e.trackLines.renderer)},b={type:"track",previousObservation:await t(r,{geometryType:l.geometryType,labelingInfoSource:l.labelingInfoSource+"-track-prev",labelingInfo:e.previousObservations.labelingInfo,labelsVisible:e.previousObservations.labelsVisible},a(e.previousObservations.renderer)),latestObservation:await t(r,{geometryType:l.geometryType,labelingInfoSource:l.labelingInfoSource+"-track-latest",labelingInfo:e.latestObservations.labelingInfo,labelsVisible:e.latestObservations.labelsVisible},a(e.latestObservations.renderer)),trackLine:await t(r,{geometryType:"polyline",labelingInfoSource:l.labelingInfoSource+"-track-line",labelingInfo:e.trackLines.labelingInfo,labelsVisible:e.trackLines.labelsVisible},a(e.trackLines.renderer))},y=n(e,[null,null]),p=d(f);return{storage:y,mesh:{properties:{sortKey:null,timeZone:i.timeZone,returnMeshObjectId:p,displayRefreshVersion:o,currentUser:i.currentUser},strategy:{type:"track",featureFilter:i.filters[0],fields:u,maxDisplayDuration:e.maxDisplayDuration?.toMilliseconds()??0,maxDisplayObservationsPerTrack:e.maxDisplayObservationsPerTrack,showLatestObservation:e.latestObservations.visible,showPreviousObservations:e.previousObservations.visible,showTrackLine:e.trackLines.visible,timeField:e.timeField},factory:{labels:b,symbology:f}},expressionProperties:{timeExtent:i.timeExtent?.toJSON()}}}function p(e,t,s){const i=null!=t&&"unique-value"===t.type&&t.orderByClassesEnabled;if("default"!==e||i||(e=[new r({field:s,order:"descending"})]),"default"!==e&&e?.length){e.length;const r=e[0],t="ascending"===r.order?"asc":"desc";return r.field?{field:r.field,order:t}:r.valueExpression?{expression:r.valueExpression,order:t}:null}if(i){return{byRenderer:!0,order:"asc"}}return null}function m(e){return 2===e.techniqueType}function d(e){if("simple"===e.type&&e.meshes.some(m))return!0;if("interval"===e.type){if(e.intervals.some(e=>e.meshes.some(m)||e.alternateMeshes.some(m)))return!0;if(e.backgroundFill.some(m))return!0}if("map"===e.type){if(e.map.some(e=>e.meshes.some(m)||e.alternateMeshes.some(m)))return!0;if(e.backgroundFill.some(m))return!0}return!1}export{o as createSimpleProcessorSchema,c as getAggregateFields,p as getSortKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../../../request.js";import t from"../../../../../../../core/Error.js";import has from"../../../../../../../core/has.js";import a from"../../../../../../../core/workers/Connection.js";import{toQuantizationTransform as r}from"../../../../../../../geometry/support/quantizationUtils.js";import{equals as s}from"../../../../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatureSet as i,quantizeOptimizedFeatureSet as o}from"../../../../../../../layers/graphics/featureConversionUtils.js";import{checkProjectionSupport as n}from"../../../../../../../layers/graphics/data/projectionSupport.js";import{queryOptimizedFeatureSet as u}from"../../../../../../../layers/ogc/ogcFeatureUtils.js";import{executeQueryPBFBuffer as c,getQueryParameters as m,executeQuery as l}from"../../../../../../../rest/query/operations/query.js";import{FeatureSetReaderAnnotationJSON as p}from"../../../support/FeatureSetReaderAnnotationJSON.js";import{FeatureSetReaderDimensionJSON as d}from"../../../support/FeatureSetReaderDimensionJSON.js";import{FeatureSetReaderJSON as f}from"../../../support/FeatureSetReaderJSON.js";import{FeatureSetReaderPBF as h}from"../../../support/FeatureSetReaderPBF.js";import{annotationVirtualFields as y,dimensionVirtualFields as _}from"../../../../support/annodime/fields.js";class w{constructor(e,t){this.service=e,this._metadata=t}destroy(){}}function q(e,t,a){switch(e.type){case"memory":return new z(e,t,a);case"ogc":return new
|
|
2
|
+
import e from"../../../../../../../request.js";import t from"../../../../../../../core/Error.js";import has from"../../../../../../../core/has.js";import a from"../../../../../../../core/workers/Connection.js";import{toQuantizationTransform as r}from"../../../../../../../geometry/support/quantizationUtils.js";import{equals as s}from"../../../../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatureSet as i,quantizeOptimizedFeatureSet as o}from"../../../../../../../layers/graphics/featureConversionUtils.js";import{checkProjectionSupport as n}from"../../../../../../../layers/graphics/data/projectionSupport.js";import{queryOptimizedFeatureSet as u}from"../../../../../../../layers/ogc/ogcFeatureUtils.js";import{executeQueryPBFBuffer as c,getQueryParameters as m,executeQuery as l}from"../../../../../../../rest/query/operations/query.js";import{FeatureSetReaderAnnotationJSON as p}from"../../../support/FeatureSetReaderAnnotationJSON.js";import{FeatureSetReaderDimensionJSON as d}from"../../../support/FeatureSetReaderDimensionJSON.js";import{FeatureSetReaderJSON as f}from"../../../support/FeatureSetReaderJSON.js";import{FeatureSetReaderPBF as h}from"../../../support/FeatureSetReaderPBF.js";import{annotationVirtualFields as y,dimensionVirtualFields as _}from"../../../../support/annodime/fields.js";class w{constructor(e,t){this.service=e,this._metadata=t}destroy(){}}function q(e,t,a){switch(e.type){case"memory":return new z(e,t,a);case"ogc":return new O(e,t);case"feature-service":return e.queryMetadata.supportsFormatPBF&&has("featurelayer-pbf")?"annotation-feature"===t.layerType?new P(e,t):"dimension-feature"===t.layerType?new j(e,t):new F(e,t):"annotation-feature"===t.layerType?new x(e,t):"dimension-feature"===t.layerType?new R(e,t):new v(e,t)}}async function S(e){const t=new a;return await t.open(e,{}),t}class z extends w{constructor(e,t,a){super(e,t),this._ports=[],this._loaded=this._load(a)}destroy(){this._loaded.finally(()=>{this._client.close(),this._client=null;for(const e of this._ports)e.close()}).catch(()=>{})}async _load(e){this._ports=await e.layerView.openMemoryPorts(),this._client=await S(this._ports)}async executeQuery(e,t){await this._loaded;const a=await this._client.invoke("queryFeatures",e.toJSON(),t);let r=this._metadata;return s(e.outSpatialReference,a.spatialReference)&&(r=r.weakCloneWithResolvedSpatialReference()),f.fromFeatureSet(a,r)}}class F extends w{async executeQuery(a,r){const s=await c(this.service.source,a,r),i=!a.quantizationParameters;try{return h.fromBuffer(s,this._metadata,i)}catch(o){const s=await m(this.service.source,a,"pbf",r??{}),{data:{url:i}}=await e(s.url,{responseType:"native-request-init",...s.options});throw new t("featurelayer:query","Failed to parse response",{url:i,error:o,query:a.toJSON()})}}}class v extends w{async executeQuery(e,t){const{source:a,queryMetadata:s}=this.service,n=null;if(null!=e.quantizationParameters&&!s.supportsQuantization){const s=e.clone(),u=r(s.quantizationParameters);s.quantizationParameters=null;const c=await l(a,s,n,t),m=i(c,this._metadata.featureIdInfo);return o(u,m),f.fromOptimizedFeatureSet(m,this._metadata)}const u=await l(a,e,n,t);return"esriGeometryPoint"===this._metadata.geometryType&&(u.features=u.features?.filter(e=>{if(null!=e.geometry){const t=e.geometry;return Number.isFinite(t.x)&&Number.isFinite(t.y)}return!0})),f.fromFeatureSet(u,this._metadata)}}class x extends w{constructor(e,t){super(e,t),this._loaded=this._load()}async _load(){await n(this._metadata.spatialReference,this._metadata.outSpatialReference)}async executeQuery(e,t){await this._loaded;const{source:a}=this.service,s=e.clone(),n=r(s.quantizationParameters);s.quantizationParameters=null;const u=await l(a,s,this._metadata.spatialReference,t),c=i(u,this._metadata.featureIdInfo);return c.fields.push(...y),o(n,c),p.fromOptimizedFeatureSet(c,this._metadata)}}class P extends w{async executeQuery(a,r){const[s]=await Promise.all([c(this.service.source,a,r),n(this._metadata.spatialReference,this._metadata.outSpatialReference)]),i=!a.quantizationParameters;try{const e=h.fromBuffer(s,this._metadata,i),t=[];for(;e.next();){const a=e.readOptimizedFeatureWorldSpace();a&&t.push(a)}const a=e.getInTransform();return p.fromOptimizedFeatures(t,this._metadata,a)}catch(o){const s=await m(this.service.source,a,"pbf",r??{}),{data:{url:i}}=await e(s.url,{responseType:"native-request-init",...s.options});throw new t("featurelayer:query","Failed to parse response",{url:i,error:o,query:a.toJSON()})}}}class R extends w{constructor(e,t){super(e,t),this._loaded=this._load()}async _load(){await n(this._metadata.spatialReference,this._metadata.outSpatialReference)}async executeQuery(e,t){await this._loaded;const{source:a}=this.service,s=e.clone(),n=r(s.quantizationParameters);s.quantizationParameters=null;const u=await l(a,s,this._metadata.spatialReference,t),c=i(u,this._metadata.featureIdInfo);return c.fields.push(..._),o(n,c),d.fromOptimizedFeatureSet(c,this._metadata)}}class j extends w{async executeQuery(a,r){const[s]=await Promise.all([c(this.service.source,a,r),n(this._metadata.spatialReference,this._metadata.outSpatialReference)]),i=!a.quantizationParameters;try{const e=h.fromBuffer(s,this._metadata,i),t=[];for(;e.next();){const a=e.readOptimizedFeatureWorldSpace();a&&t.push(a)}const a=e.getInTransform();return d.fromOptimizedFeatures(t,this._metadata,a)}catch(o){const s=await m(this.service.source,a,"pbf",r??{}),{data:{url:i}}=await e(s.url,{responseType:"native-request-init",...s.options});throw new t("featurelayer:query","Failed to parse response",{url:i,error:o,query:a.toJSON()})}}}class O extends w{async executeQuery(e,t){if(e.quantizationParameters&&!this.service.queryMetadata.supportsQuantization){const a=e.clone(),s=r(a.quantizationParameters);a.quantizationParameters=null;const i=await u(this.service.source,e,t);return o(s,i),f.fromOptimizedFeatureSet(i,this._metadata)}const a=await u(this.service.source,e,t);return f.fromOptimizedFeatureSet(a,this._metadata)}}export{w as SourceAdapter,q as createQueryAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{minInt16 as t}from"../../../../../core/typedArrayUtil.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as
|
|
2
|
+
import"../../../../../core/has.js";import{baseObjectMemory as e}from"../../../../../core/memoryEstimations.js";import{minInt16 as t}from"../../../../../core/typedArrayUtil.js";import{fromRectValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import s from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as r}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{FeatureSetReader as n}from"./FeatureSetReader.js";const o=new TextDecoder;class d extends n{constructor(i,s,r,n,o,d=new Uint32Array(r.size()),h,a){if(super(i),this._indexMap=s,this._inner=r,this._fileId=n,this._transform=o,this._displayIds=d,this._points=h,this._rowIds=a,this._index=-1,this._emptyNumberValue=0,this.usedMemory=e,this._size=this._inner.size(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const e=this._inner.readPointCoordsQuantizedUnsafe()?.slice();e?(this._emptyNumberValue=t,this._points=e):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}i.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return!1}get hasM(){return!1}async updateFields(e,t,i,s){const r=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await e.createPatch(t,r,n,i,s);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let e="";for(const t of this.fields.fields)e+=this._readAttribute(t.name,!1)+".";return e}getObjectId(){const e=this._rowIds[this._index];return r(this._fileId,e)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(e){this._displayIds[this._index]=e}setIndex(e){this._index=e}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}getBounds(e){const t=this._inner.boundsXMin(this._index);return!!Number.isFinite(t)&&(i(e,t,this._inner.boundsYMin(this._index),this._inner.boundsXMax(this._index),this._inner.boundsYMax(this._index)),!0)}setBoundsXMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(e){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(e){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const e=new d(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds);return this.copyInto(e),e}copyInto(e){super.copyInto(e),e._index=this._index}_readGeometry(e){const t=this._inner.readCoordsUnsafe(this._index),i=this._inner.readLengthsUnsafe(this._index);return t&&i?new s(i,t,this.hasZ,this.hasM):null}_readX(){if(this._points){const e=this._points[2*this._index];return e===this._emptyNumberValue?NaN:e}return this._inner.readX(this._index)}_readY(){if(this._points){const e=this._points[2*this._index+1];return e===this._emptyNumberValue?NaN:e}return this._inner.readY(this._index)}_readServerCentroid(){return null}_readAttribute(e,t){const i=this.fields.get(e);if(!i)return;const s=this._indexMap[i.name];if(null==s)return this.getObjectId();const r=this._inner.readAttribute(this._index,s);if(null==r)return r;if("esriFieldTypeString"===i.type||"esriFieldTypeDateOnly"===i.type||"esriFieldTypeTimeOnly"===i.type||"esriFieldTypeTimestampOffset"===i.type){const e=this._inner.readAttribute(this._index,s);return o.decode(e)}const n=this.fields.isDateField(i.name);return t?null==r?r:n?new Date(r):r:r}_readAttributes(){const e={};for(const t of this.metadata.fieldsIndex.fields){if(null==this._indexMap[t.name])continue;const i=this._readAttribute(t.name,!1);void 0!==i&&(e[t.name]=i)}return e.__OBJECTID=this.getObjectId(),e}}export{d as FeatureSetReaderParquet};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import i from"../../../../../core/Error.js";import{rad2deg as t}from"../../../../../core/mathUtils.js";import{dist as n,set as e,equals as s,subtract as o}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,create as h}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as l}from"../../../../../geometry/support/jsonTypeUtils.js";import m from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as _}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as a,fromCIMVerticalAlignment as d,fromCIMFontDecoration as u}from"../../../../../symbols/cim/utils.js";import g from"../../../arcade/callExpressionWithFeature.js";import{glyphSize as P,magicLabelLineHeight as c}from"../../../engine/webgl/definitions.js";import b from"../../../engine/webgl/Rect.js";import{shapeGlyphs as x}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{queryPointOnLine as p,angleFromXAxis as f,intersectRaysByPointsAndAngles as y}from"../../features/support/FeatureSetReaderDimensionJSON.js";import{roundPtToWholePixel as D,getLineWidth as M}from"../../graphics/graphicsUtils.js";import{DimensionRealFieldName as S}from"./dimensionUtils.js";import{getAttributeValue as k}from"./utils.js";class L{static async create(i,t,n,e){const s=e(i.textSymbol),o=new L(i,s);return await o.initialize(t,n),o}constructor(i,t){if(this._dimensionStyle=i,this._mosaicItems=t,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._extAngleRad=Math.PI/2,this._compiledExpression=null,this._fieldsIndex=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerPoint=null,this._endMarkerPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!")}async initialize(t,n){if(!this._dimensionStyle)return;const{attributes:e}=t;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:e,expressionParserName:s}=this._dimensionStyle;if(e&&s){if(s&&"arcade"!==s.toLocaleLowerCase())throw new i("dimension-layer",`Unsupported expression parser (${s}) for dimension text.`);this._compiledExpression=await _(e,n),this._fieldsIndex=w(t)}}const s=Number(k(S.extAngle,e));this._extAngleRad=isNaN(s)?Math.PI/2:s,this._systemLength=Number(k("__SYSTEM_LENGTH__",e));const{geometry:o}=t;if(o&&!l(o))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const r=o?.rings[0];if(!r||r.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=0!==r[3][0]&&0!==r[3][1]&&void 0!==r[3][0]&&void 0!==r[3][1],this._hasTextPoint&&(this._textPoint=r[3]);const h=this._dimensionStyle.textSymbol;e.__DIMENSION_ANGLE__+=h?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,t){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,t),this._evaluateDefaultPlacement(t),this._updateExtensionLines(t),this._updateTextPoint(i,t),this._dimensionIsEvaluated=!0)}_updateTextPoint(i,t){if(this._hasTextPoint)return;const{textFit:n}=this._dimensionStyle;let e=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===n||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(e=!0);if((T(this._beginMarkerRect,this._textRect)||T(this._endMarkerRect,this._textRect))&&(e=!1),!e){const i=t*(this._textRect.width/2);"MoveBegin"===n?this._textPoint=p(this._beginMarkerPoint,this._endMarkerPoint,-i):"MoveEnd"===n&&(this._textPoint=p(this._endMarkerPoint,this._beginMarkerPoint,-i))}}if(e){if(!this._dimensionStyle.textSymbol)return;const i=t*(this._textRect.width/2),n=this._dimensionPolyline[0],e=this._dimensionPolyline[1],s=p(n[0],n[1],i),o=p(e[0],e[1],i);this._dimensionPolyline=[[s,n[1]],[o,e[1]]]}}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:t,extensionLineOffset:e}=this._dimensionStyle;let s=this._dimensionLinePoint,o=this._endDimensionPoint;null==t||isNaN(t)||0===t||(s=p(this._dimensionLinePoint,this._beginBaselinePoint,-t*i),o=p(this._endDimensionPoint,this._endBaselinePoint,-t*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=e&&!isNaN(e)&&0!==e){const i=n(s,this._beginBaselinePoint),t=n(o,this._endBaselinePoint);r=p(s,this._beginBaselinePoint,i-e),h=p(o,this._endBaselinePoint,t-e)}this._dimensionExtensionLines=[[s,r],[o,h]]}_computeDimensionLineInfo(o,m){if(!o||!l(o)||o.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const _=o.rings[0],a=r(_[0][0],_[0][1]),d=r(_[1][0],_[1][1]),u=r(_[2][0],_[2][1]);this._beginBaselinePoint=e(h(),a[0],a[1]),this._endBaselinePoint=e(h(),d[0],d[1]),this._dimensionLinePoint=u;let g=this._extAngleRad;if(s(a,u))this._beginDimensionPoint=e(h(),a[0],a[1]),this._endDimensionPoint=e(h(),d[0],d[1]),this._displayExtLines=!1;else{const n=f([d[0]-a[0],d[1]-a[1]]),s=t(g);s>=-1&&s<=1?g+=t(1):s>=179&&s<=181&&(g-=t(1));const o=y(u,n,d,n+g);if(!o)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=e(h(),u[0],u[1]),this._endDimensionPoint=e(h(),o[0],o[1])}this._dimensionLength=n(this._beginDimensionPoint,this._endDimensionPoint),this._hasTextPoint||(this._textPoint=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:t,endMarkerSymbol:n}=this._dimensionStyle,e=this._measureMarkerSymbolSize(t,this._beginDimensionPoint,this._dimensionAngleRad,i),s=this._measureMarkerSymbolSize(n,this._endDimensionPoint,this._dimensionAngleRad+Math.PI,i),r=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=r;const h=i*((e?.width??0)/2),l=i*((s?.width??0)/2);this._beginMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,h),this._endMarkerPoint=p(this._endDimensionPoint,this._beginDimensionPoint,l);const m=[0,0];if(e&&this._beginMarkerPoint){const i=o(m,this._beginMarkerPoint,this._beginDimensionPoint);e.x+=i[0],e.y+=i[1]}if(s&&this._endMarkerPoint){const i=o(m,this._endMarkerPoint,this._endDimensionPoint);s.x+=i[0],s.y+=i[1]}if(this._beginMarkerRect=e,this._endMarkerRect=s,this._doMarkersFit=this._checkMarkerFit(e,s,r,i),this._doMarkersFit){const i=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else this._beginMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,-4*h),this._endMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*l),this._dimensionPolyline=[[this._beginMarkerPoint,this._beginDimensionPoint],[this._endMarkerPoint,this._endDimensionPoint]]}_checkMarkerFit(i,t,n,e){if(!i||!t)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;if("Tolerance"===s)r*e>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?T(i,t)&&(h=!1):(T(i,t)&&(h=!1),h&&n&&(T(n,i)||T(n,t))&&(h=!1))}return h||(this._beginMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,-i.width/2),this._endMarkerPoint=p(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+t.width/2)),h}_measureDimensionText(i,t,n){if(null==this._textString||null==t||null==this._mosaicItems)return null;const e=[];for(const a of i)a.codePointAt(0),e.push(this._mosaicItems.glyphs[a.codePointAt(0)]);const s=this._dimensionStyle.textSymbol;if(!s)return null;const o=a(s.horizontalAlignment),r=d(s.verticalAlignment),h=u(s),l=D(s.height||10),m=!0,_=s.angle||0,g=l/P,p=M(s.lineWidth),f=c*Math.max(.25,Math.min(l||1,4)),y={...this._mosaicItems,glyphs:e.filter(i=>null!=i)},S=x(y,{scale:g,angle:_,xOffset:0,yOffset:0,horizontalAlignment:o,verticalAlignment:r,decoration:h,lineHeight:f,useCIMAngleBehavior:m,maxLineWidth:p,hasBackground:!1}),k=t;if(!k)return null;const L=n,w=[S.bounds.blX,S.bounds.trY],E=[S.bounds.trX,S.bounds.trY],T=[S.bounds.blX,S.bounds.blY],N=[S.bounds.trX,S.bounds.blY];return w[0]-=S.bounds.x,w[1]-=S.bounds.y,E[0]-=S.bounds.x,E[1]-=S.bounds.y,T[0]-=S.bounds.x,T[1]-=S.bounds.y,N[0]-=S.bounds.x,N[1]-=S.bounds.y,w[0]*=L,w[1]*=L,E[0]*=L,E[1]*=L,T[0]*=L,T[1]*=L,N[0]*=L,N[1]*=L,w[0]+=k[0],w[1]+=k[1],E[0]+=k[0],E[1]+=k[1],T[0]+=k[0],T[1]+=k[1],N[0]+=k[0],N[1]+=k[1],new b(E[0],E[1],1.1*Math.abs(w[0]-E[0]),1.1*Math.abs(N[1]-E[1]))}_measureMarkerSymbolSize(i,t,n,e){return i?new b(-16,-16,32,32):null}_getDimensionText(i){const{attributes:t}=i;let n=null;const e=1===Number(k(S.useCustomLength,t));n=Number(k(e?S.customLength:S.dimLength,t)),(0===n||isNaN(n)||null==n)&&(n=this._systemLength);let s=this._getDimensionString(n,i);return"number"==typeof s&&(s=s.toString()),t.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,t){const{convertUnits:n,displayUnits:e,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&t)return g(this._compiledExpression,t,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function w(i){const{attributes:t}=i,n=Object.keys(S).map(i=>({name:i,alias:i,type:"string"==typeof t[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new m(n)}function E(i){return{left:i.x,right:i.x+i.width,top:i.y+i.height,bottom:i.y}}function T(i,t){const n=E(i),e=E(t),s=n.left<=e.right&&e.left<=n.right,o=n.bottom<=e.top&&e.bottom<=n.top;return s&&o}export{L as default};
|
|
2
|
+
import i from"../../../../../core/Error.js";import{deg2rad as t,rad2deg as n}from"../../../../../core/mathUtils.js";import{dist as e,set as s,equals as o,subtract as r}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as h,create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as m}from"../../../../../geometry/support/jsonTypeUtils.js";import _ from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as a}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as d,fromCIMVerticalAlignment as u,fromCIMFontDecoration as g}from"../../../../../symbols/cim/utils.js";import P from"../../../arcade/callExpressionWithFeature.js";import{glyphSize as c,magicLabelLineHeight as b}from"../../../engine/webgl/definitions.js";import x from"../../../engine/webgl/Rect.js";import{shapeGlyphs as p}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{queryPointOnLine as f,angleFromXAxis as y,intersectRaysByPointsAndAngles as D}from"../../features/support/FeatureSetReaderDimensionJSON.js";import{roundPtToWholePixel as M,getLineWidth as S}from"../../graphics/graphicsUtils.js";import{DimensionRealFieldName as k}from"./dimensionUtils.js";import{getAttributeValue as L}from"./utils.js";class w{static async create(i,t,n,e){const s=e(i.textSymbol),o=new w(i,s);return await o.initialize(t,n),o}constructor(i,t){if(this._dimensionStyle=i,this._mosaicItems=t,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._extAngleRad=Math.PI/2,this._compiledExpression=null,this._fieldsIndex=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerPoint=null,this._endMarkerPoint=null,this._beginMarkerRect=null,this._endMarkerRect=null,this._textRect=null,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!")}async initialize(t,n){if(!this._dimensionStyle)return;const{attributes:e}=t;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:e,expressionParserName:s}=this._dimensionStyle;if(e&&s){if(s&&"arcade"!==s.toLocaleLowerCase())throw new i("dimension-layer",`Unsupported expression parser (${s}) for dimension text.`);this._compiledExpression=await a(e,n),this._fieldsIndex=E(t)}}const s=Number(L(k.extAngle,e));this._extAngleRad=isNaN(s)?Math.PI/2:s,this._systemLength=Number(L("__SYSTEM_LENGTH__",e));const{geometry:o}=t;if(o&&!m(o))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const r=o?.rings[0];if(!r||r.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=0!==r[3][0]&&0!==r[3][1]&&void 0!==r[3][0]&&void 0!==r[3][1],this._hasTextPoint&&(this._textPoint=r[3]);const h=this._dimensionStyle.textSymbol;e.__DIMENSION_ANGLE__+=h?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,t){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,t),this._evaluateDefaultPlacement(t),this._updateExtensionLines(t),this._updateTextPoint(i,t),this._dimensionIsEvaluated=!0)}_updateTextPoint(i,t){if(this._hasTextPoint)return;const{textFit:n}=this._dimensionStyle;let e=!0;if(!this._doMarkersFit){if(this._hasTextPoint)return;if("None"===n||!this._beginMarkerRect||!this._endMarkerRect||!this._textRect)return void(e=!0);if((N(this._beginMarkerRect,this._textRect)||N(this._endMarkerRect,this._textRect))&&(e=!1),!e){const i=t*(this._textRect.width/2);"MoveBegin"===n?this._textPoint=f(this._beginMarkerPoint,this._endMarkerPoint,-i):"MoveEnd"===n&&(this._textPoint=f(this._endMarkerPoint,this._beginMarkerPoint,-i))}}if(e){if(!this._dimensionStyle.textSymbol)return;const i=t*(this._textRect.width/2),n=this._dimensionPolyline[0],e=this._dimensionPolyline[1],s=f(n[0],n[1],i),o=f(e[0],e[1],i);this._dimensionPolyline=[[s,n[1]],[o,e[1]]]}}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:t,extensionLineOffset:n}=this._dimensionStyle;let s=this._dimensionLinePoint,o=this._endDimensionPoint;null==t||isNaN(t)||0===t||(s=f(this._dimensionLinePoint,this._beginBaselinePoint,-t*i),o=f(this._endDimensionPoint,this._endBaselinePoint,-t*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=n&&!isNaN(n)&&0!==n){const i=e(s,this._beginBaselinePoint),t=e(o,this._endBaselinePoint);r=f(s,this._beginBaselinePoint,i-n),h=f(o,this._endBaselinePoint,t-n)}this._dimensionExtensionLines=[[s,r],[o,h]]}_computeDimensionLineInfo(r,_){if(!r||!m(r)||r.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const a=r.rings[0],d=h(a[0][0],a[0][1]),u=h(a[1][0],a[1][1]),g=h(a[2][0],a[2][1]);this._beginBaselinePoint=s(l(),d[0],d[1]),this._endBaselinePoint=s(l(),u[0],u[1]),this._dimensionLinePoint=g;let P=this._extAngleRad;if(o(d,g))this._beginDimensionPoint=s(l(),d[0],d[1]),this._endDimensionPoint=s(l(),u[0],u[1]),this._displayExtLines=!1;else{const e=y([u[0]-d[0],u[1]-d[1]]),o=n(P);o>=-1&&o<=1?P+=t(1):o>=179&&o<=181&&(P-=t(1));const r=D(g,e,u,e+P);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=s(l(),g[0],g[1]),this._endDimensionPoint=s(l(),r[0],r[1])}this._dimensionLength=e(this._beginDimensionPoint,this._endDimensionPoint),this._hasTextPoint||(this._textPoint=f(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2))}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:t,endMarkerSymbol:n}=this._dimensionStyle,e=this._measureMarkerSymbolSize(t,this._beginDimensionPoint,this._dimensionAngleRad,i),s=this._measureMarkerSymbolSize(n,this._endDimensionPoint,this._dimensionAngleRad+Math.PI,i),o=this._measureDimensionText(this._textString||"",this._textPoint,i);this._textRect=o;const h=i*((e?.width??0)/2),l=i*((s?.width??0)/2);this._beginMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,h),this._endMarkerPoint=f(this._endDimensionPoint,this._beginDimensionPoint,l);const m=[0,0];if(e&&this._beginMarkerPoint){const i=r(m,this._beginMarkerPoint,this._beginDimensionPoint);e.x+=i[0],e.y+=i[1]}if(s&&this._endMarkerPoint){const i=r(m,this._endMarkerPoint,this._endDimensionPoint);s.x+=i[0],s.y+=i[1]}if(this._beginMarkerRect=e,this._endMarkerRect=s,this._doMarkersFit=this._checkMarkerFit(e,s,o,i),this._doMarkersFit){const i=f(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else this._beginMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,-4*h),this._endMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+4*l),this._dimensionPolyline=[[this._beginMarkerPoint,this._beginDimensionPoint],[this._endMarkerPoint,this._endDimensionPoint]]}_checkMarkerFit(i,t,n,e){if(!i||!t)return!1;const{markerFit:s,markerOption:o,markerFitTolerance:r}=this._dimensionStyle;if("None"===s)return!0;let h=!0;if("Tolerance"===s)r*e>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==o)return!0;this._hasTextPoint&&"Both"===o?N(i,t)&&(h=!1):(N(i,t)&&(h=!1),h&&n&&(N(n,i)||N(n,t))&&(h=!1))}return h||(this._beginMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,-i.width/2),this._endMarkerPoint=f(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+t.width/2)),h}_measureDimensionText(i,t,n){if(null==this._textString||null==t||null==this._mosaicItems)return null;const e=[];for(const d of i)d.codePointAt(0),e.push(this._mosaicItems.glyphs[d.codePointAt(0)]);const s=this._dimensionStyle.textSymbol;if(!s)return null;const o=d(s.horizontalAlignment),r=u(s.verticalAlignment),h=g(s),l=M(s.height||10),m=!0,_=s.angle||0,a=l/c,P=S(s.lineWidth),f=b*Math.max(.25,Math.min(l||1,4)),y={...this._mosaicItems,glyphs:e.filter(i=>null!=i)},D=p(y,{scale:a,angle:_,xOffset:0,yOffset:0,horizontalAlignment:o,verticalAlignment:r,decoration:h,lineHeight:f,useCIMAngleBehavior:m,maxLineWidth:P,hasBackground:!1}),k=t;if(!k)return null;const L=n,w=[D.bounds.blX,D.bounds.trY],E=[D.bounds.trX,D.bounds.trY],T=[D.bounds.blX,D.bounds.blY],N=[D.bounds.trX,D.bounds.blY];return w[0]-=D.bounds.x,w[1]-=D.bounds.y,E[0]-=D.bounds.x,E[1]-=D.bounds.y,T[0]-=D.bounds.x,T[1]-=D.bounds.y,N[0]-=D.bounds.x,N[1]-=D.bounds.y,w[0]*=L,w[1]*=L,E[0]*=L,E[1]*=L,T[0]*=L,T[1]*=L,N[0]*=L,N[1]*=L,w[0]+=k[0],w[1]+=k[1],E[0]+=k[0],E[1]+=k[1],T[0]+=k[0],T[1]+=k[1],N[0]+=k[0],N[1]+=k[1],new x(E[0],E[1],1.1*Math.abs(w[0]-E[0]),1.1*Math.abs(N[1]-E[1]))}_measureMarkerSymbolSize(i,t,n,e){return i?new x(-16,-16,32,32):null}_getDimensionText(i){const{attributes:t}=i;let n=null;const e=1===Number(L(k.useCustomLength,t));n=Number(L(e?k.customLength:k.dimLength,t)),(0===n||isNaN(n)||null==n)&&(n=this._systemLength);let s=this._getDimensionString(n,i);return"number"==typeof s&&(s=s.toString()),t.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,t){const{convertUnits:n,displayUnits:e,displayPrecision:s,prefix:o,suffix:r,textOption:h}=this._dimensionStyle;if("None"===h)return null;if("Expression"===h&&this._compiledExpression&&t)return P(this._compiledExpression,t,{},"esriGeometryPolyline",this._fieldsIndex);let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===h&&(o&&(l=`${o} ${l}`),r&&(l=`${l} ${r}`)),l}}function E(i){const{attributes:t}=i,n=Object.keys(k).map(i=>({name:i,alias:i,type:"string"==typeof t[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new _(n)}function T(i){return{left:i.x,right:i.x+i.width,top:i.y+i.height,bottom:i.y}}function N(i,t){const n=T(i),e=T(t),s=n.left<=e.right&&e.left<=n.right,o=n.bottom<=e.top&&e.bottom<=n.top;return s&&o}export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import{translate as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as s,scale as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,fromArray as n,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as h,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as m}from"../../../../geometry/projection/projectBuffer.js";import{create as u,fromSubBuffer as d,intersectsClippingArea as f}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as g,doubleArrayFrom as _}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{needsElevationUpdates3D as y,evaluateElevationAlignmentAtPoint as v,SampleElevationInfo as x}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as w}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as S}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as P,nanFallbackColor as D}from"./Graphics3DSymbolLayer.js";import{isValidSize as j}from"./graphicUtils.js";import{ConvertOptions as C,initFastSymbolUpdatesState as V,updateFastSymbolUpdatesState as A,getSizeAttributeValue as U,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as E}from"../../support/ElevationProvider.js";import{Object3D as R}from"../../webgl-engine/lib/Object3D.js";import{Path as B}from"../../webgl-engine/lib/Path.js";import{PathBuilder as L}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as k,TriangulationCapBuilder as G,NoCapBuilder as O}from"../../webgl-engine/lib/PathCapBuilder.js";import{MiterExtruder as I}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as F,isPathGeometry as M}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as T,StaticPathGeometry as q}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as H}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as W,circleProfiles as N}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as J}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as Z}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as K}from"../../webgl-engine/materials/PathMaterial.js";const Q=["polyline"];class X extends P{constructor(e,t,r,i){super(e,t,r,i,re(t)),this._intrinsicSize=o(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,r=null!=t.width?t.width:t.height,i=null!=t.height?t.height:r;this._vvConvertOptions=new C({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[r,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(D),fallbackSize:[r,1,i]});const o=this._context.renderer?.visualVariables;this._fastUpdates=o?.length?V(this._context.renderer,this._vvConvertOptions):null;const l=t.anchor||"center";this._upVectorAlignment="heading"===t.profileRotation?0:1;const c=t.profile||"circle";switch(c){default:case"circle":this._profile=N[l];break;case"quad":this._profile=W[l]}switch(t.join){case"round":this._extruder=new I(0,S);break;default:case"bevel":this._extruder=new I(0,1);break;case"miter":this._extruder=new I(.8*Math.PI,1)}switch(this._cap){case"none":this._capBuilder=new O;break;case"butt":default:this._capBuilder=new G(this._profile,1);break;case"square":this._capBuilder=new G(this._profile,2);break;case"round":{const e="quad"===c;this._capBuilder=new k(this._profile,e);break}}const p=this._materialColor,m=this._getCombinedOpacityAndColor(p),u=h(m),d=m[3],f=this.needsDrivenTransparentPass,g=t.material?.emissive,_={diffuse:u,ambient:u,emissiveStrengthFromSymbol:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:d,drivenOpacity:f,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(s(this._intrinsicSize,r,i),!j(this._intrinsicSize[0])||!j(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let b;this._fastUpdates?.visualVariables.size||a(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?b=new K({..._,...this._fastUpdates.materialParameters,size:n(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,numJoinSubdivisions:this._extruder.numBendSubdivisions},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=1,b=new Z(_,this._context)),b.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=b,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Q,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,y)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!A(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of r)t+=h.length;const n=g(3*t);let l,c=0;for(const h of r){i.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||m(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=_(n):(l=g(3*t),m(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,s){const{graphic:a,renderingInfo:o}=e,n=a.geometry,h=this._getVertexData(n);if(null==h)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===h.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const p=new Array,m=n.spatialReference,g=u(),_=this._context.renderCoordsHelper,x=new E(h.vertexDataES),S=a.uid,P=b(h.vertexDataRS.length);for(const u of h.pathVertexDataInfos){const e=u.numVertices;if(e<2)continue;const a=u.offset;if(null!=this._context.clippingExtent&&(d(h.vertexDataES,a,e,g),!f(g,this._context.clippingExtent)))continue;const n=new Array,b=a+3*e;for(let t=a;t<b;t+=3){x.offset=t;const e=v(x,this._context.elevationProvider,s,_);c(ie,h.vertexDataRS[t],h.vertexDataRS[t+1],h.vertexDataRS[t+2]),_.setAltitude(ie,e),h.vertexDataRS[t]=ie[0],h.vertexDataRS[t+1]=ie[1],h.vertexDataRS[t+2]=ie[2],n.push(J(this._upVectorAlignment))}const y=new B(n,h.vertexDataES,h.vertexDataRS,a,P);Y(y,this._upVectorAlignment,this._context.renderCoordsHelper);const w=new L(y,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment);let D=null;if(this._fastUpdates){const{size:e,color:t,opacity:r}=this._fastUpdates.visualVariables,i=U(e,o.size),s=z(t,o.color),a=z(r,o.opacity);D=new T(w,i,s,a)}else{const e=l(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size?.output??["symbol-value","symbol-value","symbol-value"];e[0]*=$(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=$(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new q(w);t.bake(e);const r=this._getDrivenColor(o);r&&t.bakeVertexColors(r),D=t}const j=D.createGeometryData(),C=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:S,layerViewUid:this._context.layerViewUid}),V=new F(this._materials[0],j,D,m,this._stencilWidth,C);V.transformation=t(i(),r,w.path.origin),p.push(V)}if(0===p.length)return null;const D=new R({geometries:p,layerViewUid:this._context.layerViewUid,graphicUid:S}),j=new w(this,D,null,(e,t,r,i,s)=>te(e,t,i,s,this._upVectorAlignment),s,null);return j.alignedSampledElevation=0,j.needsElevationUpdates=y(s.mode),j}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function Y(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)ie[0]=s[a++]+i[0],ie[1]=s[a++]+i[1],ie[2]=s[a++]+i[2],r.worldUpAtPosition(ie,ie),t.setFrameFromUpVector(ie);break;case 1:ie[0]=s[a]+i[0],ie[1]=s[a+1]+i[1],ie[2]=s[a+2]+i[2],r.worldUpAtPosition(ie,ie),H(e,ie)}}function $(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function ee(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,h=e.offset+3*o.length;for(let p=e.offset;p<h;p+=3)c(ie,l[p],l[p+1],l[p+2]),r(ie,se),s+=se.sampledElevation,ie[0]=n[p]+a[0],ie[1]=n[p+1]+a[1],ie[2]=n[p+2]+a[2],i.setAltitude(ie,se.z),n[p]=ie[0]-a[0],n[p+1]=ie[1]-a[1],n[p+2]=ie[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function te(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!M(l))continue;const e=l.path,o=e.builder.path;n+=ee(o,t,r,i),0!==s&&Y(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}function re(e){return 1===(e.material?.color?.a??0)}const ie=p(),se=new x;export{X as Graphics3DPathSymbolLayer};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../../../core/Error.js";import{disposable as i}from"../../../../core/handleUtils.js";import{translate as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as a,create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,scale as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as c,fromArray as h,clone as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromArray as f,create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as u}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as y}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as b,doubleArrayFrom as v}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as x}from"../../../../geometry/support/FloatArray.js";import{getCoordinateEquals as w}from"../../../../geometry/support/geometryUtils.js";import{needsElevationUpdates3D as S,evaluateElevationAlignmentAtPoint as P,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as j}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as V,nanFallbackColor as A}from"./Graphics3DSymbolLayer.js";import{isValidSize as U}from"./graphicUtils.js";import{ConvertOptions as z,initFastSymbolUpdatesState as E,updateFastSymbolUpdatesState as R,getSizeAttributeValue as B,getAttributeValue as k}from"../support/FastSymbolUpdates.js";import{SamplePosition as L}from"../../support/ElevationProvider.js";import{Object3D as G}from"../../webgl-engine/lib/Object3D.js";import{Path as O}from"../../webgl-engine/lib/Path.js";import{PathBuilder as I}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as F,TriangulationCapBuilder as M,NoCapBuilder as T}from"../../webgl-engine/lib/PathCapBuilder.js";import{MiterExtruder as q}from"../../webgl-engine/lib/PathExtruder.js";import{PathGeometry as H,isPathGeometry as W}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as N,StaticPathGeometry as Z}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as J}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as K,circleProfiles as Q}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as X}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as $}from"../../webgl-engine/materials/PathMaterial.js";const ee=["polyline"];class te extends V{constructor(e,t,r,i){super(e,t,r,i,oe(t)),this._intrinsicSize=c(1,1),this._upVectorAlignment=1,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=null!=e.width?e.width:e.height,i=null!=e.height?e.height:t;this._vvConvertOptions=new z({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[t,1,i],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(A),fallbackSize:[t,1,i]});const s=this._context.renderer?.visualVariables;this._fastUpdates=s?.length?E(this._context.renderer,this._vvConvertOptions):null;const a=e.anchor||"center";this._upVectorAlignment="heading"===e.profileRotation?0:1;const o=e.profile||"circle";switch(o){default:case"circle":this._profile=Q[a];break;case"quad":this._profile=K[a]}switch(e.join){case"round":this._extruder=new q(0,C);break;default:case"bevel":this._extruder=new q(0,1);break;case"miter":this._extruder=new q(.8*Math.PI,1)}switch(this._cap){case"none":this._capBuilder=new T;break;case"butt":default:this._capBuilder=new M(this._profile,1);break;case"square":this._capBuilder=new M(this._profile,2);break;case"round":{const e="quad"===o;this._capBuilder=new F(this._profile,e);break}}const c=this._materialColor,p=this._getCombinedOpacityAndColor(c),m=f(p),d=p[3],u=this.needsDrivenTransparentPass,g=e.material?.emissive,_={diffuse:m,ambient:m,emissiveStrengthFromSymbol:("color"===g?.source?g?.strength:void 0)??0,emissiveSource:1,opacity:d,drivenOpacity:u,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(n(this._intrinsicSize,t,i),!U(this._intrinsicSize[0])||!U(this._intrinsicSize[1])))throw new r("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let y;this._fastUpdates?.visualVariables.size||l(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?y=new $({..._,...this._fastUpdates.materialParameters,size:h(this._intrinsicSize),upVectorAlignment:this._upVectorAlignment,profile:this._profile,pathCapType:this._capBuilder.type,cutoffAngle:this._extruder.cutoffAngle,numJoinSubdivisions:this._extruder.numBendSubdivisions},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=1,y=new Y(_,this._context)),y.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._materials[0]=y,this._updateTransparentDepedentMaterialParameters()}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ee,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this._materialColor,t=this._getCombinedOpacity(e),r=this._materials[0];r&&(r.setParameters({opacity:t}),this._updateTransparentDepedentMaterialParameters())}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,S)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!R(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}_getVertexData(r){let i=0;const s=r.paths,a=[],o=r.spatialReference,n=this._context.elevationProvider.spatialReference,l=this._context.renderCoordsHelper.spatialReference,c=w(r.hasZ),h=s.map(r=>{const i={stack:[],error:void 0,hasError:!1};try{const t=ce;e(i,he,!1);for(let e=1;e<r.length;++e)c(r[e],r[e-1])&&t.add(e);return 0===t.size?r:r.filter((e,r)=>!t.has(r))}catch(s){i.error=s,i.hasError=!0}finally{t(i)}});for(const e of h)i+=e.length;const p=b(3*i);let m,f=0;for(const e of h){a.push({offset:f,numVertices:e.length});for(const t of e)p[f++]=t[0],p[f++]=t[1],p[f++]=r.hasZ?t[2]:0}return null==n||o.equals(n)||u(p,o,0,p,n,0,i)?(null==n||n.equals(l)?m=v(p):(m=b(3*i),u(p,n,0,m,l,0,i)),{pathVertexDataInfos:a,vertexDataES:p,vertexDataRS:m}):null}_createAs3DShape(e,t){const{graphic:r,renderingInfo:i}=e,n=r.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some(e=>e.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,h=n.spatialReference,f=g(),d=this._context.renderCoordsHelper,u=new L(l.vertexDataES),b=r.uid,v=x(l.vertexDataRS.length);for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const r=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,r,e,f),!y(f,this._context.clippingExtent)))continue;const n=new Array,x=r+3*e;for(let i=r;i<x;i+=3){u.offset=i;const e=P(u,this._context.elevationProvider,t,d);m(ne,l.vertexDataRS[i],l.vertexDataRS[i+1],l.vertexDataRS[i+2]),d.setAltitude(ne,e),l.vertexDataRS[i]=ne[0],l.vertexDataRS[i+1]=ne[1],l.vertexDataRS[i+2]=ne[2],n.push(X(this._upVectorAlignment))}const w=new O(n,l.vertexDataES,l.vertexDataRS,r,v);re(w,this._upVectorAlignment,this._context.renderCoordsHelper);const S=new I(w,this._profile,this._extruder,this._capBuilder,this._upVectorAlignment);let D=null;if(this._fastUpdates){const{size:e,color:t,opacity:r}=this._fastUpdates.visualVariables,s=B(e,i.size),a=k(t,i.color),o=k(r,i.opacity);D=new N(S,s,a,o)}else{const e=p(this._intrinsicSize);if(this._drivenProperties.size){const t=i.size?.output??["symbol-value","symbol-value","symbol-value"];e[0]*=ie(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=ie(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}const t=new Z(S);t.bake(e);const r=this._getDrivenColor(i);r&&t.bakeVertexColors(r),D=t}const j=D.createGeometryData(),C=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerViewUid:this._context.layerViewUid}),V=new H(this._materials[0],j,D,h,this._stencilWidth,C);V.transformation=s(o(),a,S.path.origin),c.push(V)}if(0===c.length)return null;const w=new G({geometries:c,layerViewUid:this._context.layerViewUid,graphicUid:b}),D=new j(this,w,null,(e,t,r,i,s)=>ae(e,t,i,s,this._upVectorAlignment),t,null);return D.alignedSampledElevation=0,D.needsElevationUpdates=S(t.mode),D}_getDrivenColor(e){return this._hasDrivenColorOrOpacity?this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!1):null}get _materialColor(){return this.symbolLayer.material?.color}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}get _cap(){return this.symbolLayer.cap||"butt"}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent||"none"===this._cap?0:2})}}function re(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case 0:for(const t of e.vertices)ne[0]=s[a++]+i[0],ne[1]=s[a++]+i[1],ne[2]=s[a++]+i[2],r.worldUpAtPosition(ne,ne),t.setFrameFromUpVector(ne);break;case 1:ne[0]=s[a]+i[0],ne[1]=s[a+1]+i[1],ne[2]=s[a+2]+i[2],r.worldUpAtPosition(ne,ne),J(e,ne)}}function ie(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function se(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(ne,l[h],l[h+1],l[h+2]),r(ne,le),s+=le.sampledElevation,ne[0]=n[h]+a[0],ne[1]=n[h+1]+a[1],ne[2]=n[h+2]+a[2],i.setAltitude(ne,le.z),n[h]=ne[0]-a[0],n[h+1]=ne[1]-a[1],n[h+2]=ne[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ae(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!W(l))continue;const e=l.path,o=e.builder.path;n+=se(o,t,r,i),0!==s&&re(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,"position")}return n/o.length}function oe(e){return 1===(e.material?.color?.a??0)}const ne=d(),le=new D,ce=new Set,he=i({remove:()=>ce.clear()});export{te as Graphics3DPathSymbolLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as
|
|
2
|
+
import"../../../../core/has.js";import"../../../../core/Logger.js";import{trackAccess as e}from"../../../../core/accessorSupport/tracking.js";import{SimpleObservable as n}from"../../../../core/accessorSupport/tracking/SimpleObservable.js";import{e as t}from"../../../../chunks/earcut.js";import{loadLibtessF64 as o,isLibtessF64Loaded as i,triangulateIndexedF64 as s}from"../../../../geometry/libtess.js";import{isClockwise as u}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as r,doubleSubArray as l,concatDoubleArrays as c}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as d,newIndexArray as g,concatIndexArrays as h}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as f}from"../../../../geometry/support/polygonUtils.js";const p=1e-5,a={method:"auto",projectionAxis:void 0,outlines:void 0};function m(e,n){const{hasZ:t,ccwRingsAsHoles:o,spatialReference:i}=n,s=n.axis??x(e,t,i),u=e.length,c=[],d=[],g=[],h=[],f=e.reduce((e,n)=>e+n.length,0);let p=0;const a=r(3*f);let m=0;const L=o&&e[0]&&v(e[0],t,s);for(let r=u-1;r>=0;r--){const n=e[r],i=D(n,t);if(i<3){i>1&&h.push(n);continue}const u=!!o&&v(n,t,s);if(L?!u:u)c[p++]=n;else{let e=n.length;for(let n=0;n<p;++n)e+=c[n].length;const o={index:m,pathLengths:new Array(p+1),count:e,holeIndices:new Array(p)};o.pathLengths[0]=n.length,n.length>0&&g.push({index:m,count:n.length}),m=S(n,a,m,n.length,t,L);for(let n=0;n<p;++n){const e=c[n];o.holeIndices[n]=m,o.pathLengths[n+1]=e.length,e.length>0&&g.push({index:m,count:e.length}),m=S(e,a,m,e.length,t,L)}p=0,o.count>0&&d.push(o)}}const y=m;for(const r of h)g.push({index:m,count:r.length}),m=S(r,a,m,r.length,t,L);return{positions:3*m===a.length?a:l(a,0,3*m),polygonVertexCount:y,polygons:d,outlines:g}}function x(e,n,t){if(!n)return 2;const o=e.map(e=>{const o=D(e,n);return o<3?2:f(e,o,t)}),i=o[0];return o.every(e=>e===i)?i:2}function v(e,n,t){if(!n)return!u(e);if(e.length<3)return!1;switch(t){case 0:return!u(e,1,2);case 1:return!u(e,0,2);case 2:return!u(e,0,1)}}const L=new n;function y(n,t){const o=R(n,t);if(o.succeeded)return o;return"libtess-not-loaded"===o.message?(e(L),I()):o}async function I(){try{await o(),L.notify()}catch(e){throw e}}function R(e,n){const t={method:n?.method??a.method,projectionAxis:n?.projectionAxis??a.projectionAxis,outlines:n?.outlines??a.outlines},{projectionAxis:o}=t,i=null!=o&&2!==o;i&&O(e.positions,o,2);const s=B(e,t);if(i){const n=s.succeeded?s.positions:null;null!=n&&n!==e.positions&&O(n,2,o),O(e.positions,2,o)}return s}function B(e,n){const t=Array();let o=0;for(const i of e.polygons){if("libtess"===n.method){const o=b(e,i,null!=n.outlines);if(!o.succeeded)return o;t.push(o);continue}const s=j(e,i,null!=n.outlines);if(o=Math.max(o,s.deviation),"auto"===n.method&&s.deviation>p){const o=b(e,i,null!=n.outlines);if(!o.succeeded)return o;t.push(o)}else t.push(s)}return A(t,e,n.method,n.outlines,o)}function A(e,n,t,o,i){const s=null!=o;if(0===e.length){const e=r(0),i=g(0),s=C(n,o,e,i,i),u={succeeded:!0,positions:s.positions,indices:i,outlineIndexBuffer:s.outlineIndexBuffer,outlineRingLengths:s.mergedOutlineRingLengths,vertexCount:s.positions.length/3};return"libtess"===t?{...u,method:"libtess"}:{...u,method:"earcut",deviation:0}}if(e.every(e=>"earcut"===e.method)){const t=Array();for(const n of e)for(let e=0;e<n.indices.length;e++)t.push(n.indices[e]+n.polygon.index);const{outlineIndexBuffer:u,outlineRingLengths:r}=s?U(o,n.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:n.positions,indices:d(t),outlineIndexBuffer:u,outlineRingLengths:r,vertexCount:n.positions.length/3,method:"earcut",deviation:i}}if(1===e.length&&"libtess"===e[0].method){const t=e[0],i=C(n,o,t.positions,t.outlineIndexBuffer,t.outlineRingLengths);return{succeeded:!0,positions:i.positions,indices:t.indices,outlineIndexBuffer:i.outlineIndexBuffer,outlineRingLengths:i.mergedOutlineRingLengths,vertexCount:i.positions.length/3,method:"libtess"}}const u=e.reduce((e,n)=>e+n.vertexCount,0),l=e.reduce((e,n)=>e+n.indices.length,0),c=s?e.reduce((e,n)=>e+(n.outlineIndexBuffer?.length??0),0):0,h=s?e.reduce((e,n)=>e+(n.outlineRingLengths?.length??0),0):0,f=new Float64Array(3*u),p=new Uint32Array(l),a=s?new Uint32Array(c):void 0,m=s?new Uint32Array(h):void 0;let x=0,v=0,L=0,y=0;for(const r of e){f.set(r.positions,3*x);for(let e=0;e<r.indices.length;e++)p[v+e]=r.indices[e]+x;if(s&&null!=a&&null!=m){const e=r.outlineIndexBuffer,n=r.outlineRingLengths;if(null!=e&&null!=n){for(let n=0;n<e.length;n++)a[L+n]=e[n]+x;m.set(n,y),L+=e.length,y+=n.length}}x+=r.vertexCount,v+=r.indices.length}const I=C(n,o,f,a,m),R={succeeded:!0,positions:I.positions,indices:p,outlineIndexBuffer:I.outlineIndexBuffer,outlineRingLengths:I.mergedOutlineRingLengths,vertexCount:I.positions.length/3};return e.every(e=>"libtess"===e.method)?{...R,method:"libtess"}:{...R,method:"mixed",deviation:i}}function j(e,n,o){const i=k(e.positions,n),s=n.holeIndices.map(e=>e-n.index),u=s.length>0?s:null,r=d(t(i,u,3)),l=t.deviation(i,s,3,r),c=o?w(n):void 0,g=null!=c?U(c,i):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,method:"earcut",polygon:n,positions:i,indices:r,outlineIndexBuffer:g.outlineIndexBuffer,outlineRingLengths:g.outlineRingLengths,vertexCount:n.count,deviation:l}}function b(e,n,t){if(!i())return F("libtess-not-loaded");const o=k(e.positions,n),u=n.pathLengths,r=s(o,u,3,t);return r.vertices.length%3!=0?F("positions-not-multiple-of-3"):{succeeded:!0,method:"libtess",polygon:n,positions:r.vertices,indices:r.indices,outlineIndexBuffer:r.outlineIndices,outlineRingLengths:r.outlineRingLengths,vertexCount:r.vertices.length/3}}function w(e){const n=new Array(e.pathLengths.length);let t=0;for(let o=0;o<e.pathLengths.length;o++){const i=e.pathLengths[o];n[o]={index:t,count:i},t+=i}return n}function C(e,n,t,o,i){if(null==n)return{positions:t,outlineIndexBuffer:void 0,mergedOutlineRingLengths:void 0};const s=o??g(0),u=i??g(0),r=e.polygonVertexCount,d=n.filter(e=>e.index>=r);if(0===d.length)return{positions:t,outlineIndexBuffer:s,mergedOutlineRingLengths:u};const f=3*r,p=l(e.positions,f,e.positions.length-f),a=c(t,p),m=t.length/3,x=d.map(e=>({index:m+e.index-r,count:e.count})),{outlineIndexBuffer:v,outlineRingLengths:L}=U(x,a);return{positions:a,outlineIndexBuffer:h(s,v,a.length/3),mergedOutlineRingLengths:h(u,L,u.length+L.length)}}function O(e,n,t){for(let o=0;o<e.length;o+=3){const i=e[o+n];e[o+n]=e[o+t],e[o+t]=i}}function U(e,n){const t=g(e.length);let o=0;for(let u=0;u<e.length;u++){const i=e[u],s=i.count;if(s<=0){t[u]=0;continue}const r=3*i.index,l=3*(i.index+s-1),c=s>1&&n[r]===n[l]&&n[r+1]===n[l+1]&&n[r+2]===n[l+2]?s-1:s,d=c>0?c+1:0;t[u]=d,o+=d}const i=g(o,n.length/3);let s=0;for(let u=0;u<e.length;u++){const n=t[u];if(0===n)continue;const o=e[u].index,r=n-1;for(let e=0;e<r;e++)i[s++]=o+e;i[s++]=o}return{outlineIndexBuffer:i,outlineRingLengths:t}}function k(e,{index:n,count:t}){return l(e,3*n,3*t)}function S(e,n,t,o,i,s){let u=s?e.length-1:0;const r=s?-1:1;t*=3;for(let l=0;l<o;++l){const o=e[u];n[t++]=o[0],n[t++]=o[1],n[t++]=i&&null!=o[2]?o[2]:0,u+=r}return t/3}function V(e,n){const t=e.length;if(t<2)return!1;const o=e[0],i=e[t-1];return o[0]===i[0]&&o[1]===i[1]&&(!n||o[2]===i[2])}function D(e,n){return V(e,n)?e.length-1:e.length}function F(e){return{succeeded:!1,message:e}}export{x as axisFromRings,v as isCounterClockwise,I as load,m as ringsToOutlinedTessellationInfo,R as tessellate,y as tessellateOrLoad};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Logger.js";import{destroyMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,cast as l,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeVisualizerNode as h,getAttachmentName as a}from"./RenderNodeVisualizerNode.js";import c from"../../../../../widgets/Widget.js";import{tsx as p}from"../../../../../widgets/support/widget.js";let u=class extends c{constructor(){super(...arguments),this.clearColor=d,this.previewSize=
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Logger.js";import{destroyMaybe as i}from"../../../../../core/maybe.js";import{watch as r,initial as s}from"../../../../../core/reactiveUtils.js";import{property as o,cast as l,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as d}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeVisualizerNode as h,getAttachmentName as a}from"./RenderNodeVisualizerNode.js";import c from"../../../../../widgets/Widget.js";import{tsx as p}from"../../../../../widgets/support/widget.js";let u=class extends c{constructor(){super(...arguments),this.clearColor=d,this.previewSize=w,this.filter=["color"],this.node=null,this.active=!0,this._previews=new Map,this._allPreviews=new Set,this._dirty=!0}castPreviewSize(e){return Math.max(e,w)}get _namedFilters(){const e=this.filter?.filter(e=>"color"!==e&&"depth"!==e);return e&&e.length>0?e:null}initialize(){this.node||(this.node=new h({view:this.view,destroyedCB:()=>{this.node=null,this.destroy()},clearColor:this.clearColor}));const e=this.node;this._updateInterval=setInterval(()=>this._updatePreviews()),this.addHandles([r(()=>this.active,i=>{this.view.stage.renderer.fboCache.debugCallback=i?(i,r)=>{if(null==i||null==r||!this.view.stage.renderView.renderingContext)return this._previews.forEach(([e])=>e.release()),void this._previews.clear();if("fbo visualizer"===i||!this._matchesFilter(i)||r&&0===r.colorAttachments.length&&null==r.depthStencilTexture)return;const{width:s,height:o}=r,l=o>this.previewSize?Math.round(s*this.previewSize/o):s,n=o>this.previewSize?this.previewSize:o;if(l/n>4)return void t.getLogger(this).warnOnce(`Skipping preview of wide ${i} FBO (${l}x${n}px)`);r.level&&(i+=` ${r.level}`);const d=e.getDownscaledFBO(r,i,l,n,this._focusedAttachment,this._focusedAttachmentType),h=null!=r.depthStencilTexture,c=this.filter?.includes("color")||!this.filter?.includes("depth"),p=this.filter?.includes("depth")||!this.filter?.includes("color");d.fbo?.colorAttachments.forEach((e,t)=>{const l=d.getAttachment(e);if(l){const n=h&&t===r.colorAttachments.length;if(n&&!p||!n&&!c)return;l.retain();const d=a(i,r,e,n),u=this._previews.get(d);u?.[0]?.release(),this._previews.set(d,[l,s,o]),this._allPreviews.add(d)}}),d.detachAllColors(),d.release(),this._dirty=!0}:null},s)])}destroy(){this.removeHandles(),this.view.stage?.renderer&&(this.view.stage.renderer.fboCache.debugCallback=null),this._removeUpdate(),this.node&&(this.node.destroyedCB=()=>{},this.node=i(this.node)),this._previews.forEach(([e])=>e.release()),this._previews.clear()}_matchesFilter(e){return this._namedFilters?.some(t=>e.includes(t))??!0}_updatePreviews(){if(!this._dirty)return;this._dirty=!1,this.renderNow();const e=this._focusedAttachment&&Array.from(this._previews.keys()).includes(this._focusedAttachment);this._focusedAttachment&&!e&&this._deselectFocusFBO(),this._allPreviews.forEach((e,t)=>{const i=this._getElement(t);if(!i)return;i.getContext("2d").clearRect(0,0,i.width,i.height)}),this._previews.forEach(([e,t,i],r)=>{const s=this._getElement(r);if(!s)return;const o=i>this.previewSize?Math.round(t*this.previewSize/i):t,l=i>this.previewSize?this.previewSize:i;s.style.width=`${o}px`,s.style.height=`${l}px`;const n=s.width,d=s.height,h=this._getElement(`label-${r}`);h&&(h.innerText=`${r} (${t}x${i})`);const a=this.node?.getPreviewContent(n,d,e,r),c=s.getContext("2d");c.clearRect(0,0,n,d),a&&c.putImageData(a,0,0)})}_getElement(e){return document.querySelector("arcgis-scene")?.shadowRoot?.getElementById(e)??document.getElementById(e)}_fboPreviewStyle(e){return{width:"1px",height:"1px",background:e?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0)",transform:"rotateX(180deg)"}}_removeUpdate(){null!=this._updateInterval&&(clearInterval(this._updateInterval),this._updateInterval=null)}_selectFocusFBO(e,t){this._focusedAttachment=e,this._focusedAttachmentType=0===t?null:9,this.view.stage.renderView.requestRender()}_deselectFocusFBO(){this._focusedAttachment=null,this.node?.clearFocusedFBO(),this.view.stage.renderView.requestRender()}_renderFBOPreviews(){const e=this._allPreviews.size>0?Array.from(this._allPreviews.keys()).sort().map(e=>this._renderFBOPreview(e)):p("div",null);return p("div",{styles:{display:"flex",flexFlow:"row wrap",justifyContent:"flex-end",gap:"2px"}},e)}_renderFBOPreview(e){const t=this._previews.has(e);return p("div",{key:e,styles:{display:"flex",flexFlow:"column nowrap",alignItems:"center"},onmousedown:t=>this._selectFocusFBO(e,t.button)},p("canvas",{id:e,styles:this._fboPreviewStyle(t)}),p("div",{id:e,styles:{display:"flex",justifyContent:"center"}},p("p",{id:`label-${e}`,styles:{fontSize:"12px",color:"white",margin:"1px",textShadow:"-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000"}})))}render(){return p("div",{class:"esri-widget debug-widget",styles:{display:"flex",flexFlow:"column nowrap",alignItems:"flex-end",background:"rgba(255, 255, 255, 0)"}},this._renderFBOPreviews(),p("button",{type:"button",onclick:()=>this._deselectFocusFBO()},"Reset focus"))}};e([o({constructOnly:!0})],u.prototype,"view",void 0),e([o({constructOnly:!0})],u.prototype,"clearColor",void 0),e([o()],u.prototype,"previewSize",void 0),e([l("previewSize")],u.prototype,"castPreviewSize",null),e([o()],u.prototype,"filter",void 0),e([o()],u.prototype,"_namedFilters",null),e([o()],u.prototype,"node",void 0),e([o()],u.prototype,"active",void 0),u=e([n("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizer")],u);const w=140;export{u as RenderNodeVisualizer,w as minimumPreviewSize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/oitResolution.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as f,DataType as d}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext,o=t.boundFramebuffer;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const n=this._focusedTexture.attachment,s=[v(n)],a=this._ensureProgram(t,!1,s);return t.useProgram(a),t.bindTexture(n,0),a.setUniform1i("colorTex0",0),a.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&a.setUniform2fv("nearFar",this.camera.nearFar),t.setDrawBuffers([p]),t.screen.draw(),t.bindFramebuffer(o),r}getDownscaledFBO(e,r,t,o,n){if(
|
|
2
|
+
import{__decorate as e}from"tslib";import{releaseMaybe as r}from"../../../../../core/maybe.js";import{property as t,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{ZEROS as n}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderNodeOutput as i}from"../../../webgl.js";import s from"../../../webgl/RenderNode.js";import{If as a,glsl as c}from"../../core/shaderModules/glsl.js";import{Pos2Locations as u}from"../../lib/DefaultVertexBufferLayouts.js";import{floatBlendReductionFactor as l}from"../../shaders/oitResolution.glsl.js";import{checkWebGLError as h}from"../../../../webgl/checkWebGLError.js";import{ColorAttachment0 as p,SizedPixelFormat as f,DataType as d}from"../../../../webgl/enums.js";let m=class extends s{constructor(e){super(e),this.destroyedCB=null,this.produces=i.FINAL,this.consumes={required:[i.FINAL]},this.clearColor=n,this._focusedFBOType=7,this._programs=new Map}destroy(){this._programs.clear(),this.destroyedCB()}render(e){const r=e.find(({name:e})=>e===i.FINAL);if(!this._focusedTexture)return r;const t=this.renderingContext,o=t.boundFramebuffer;t.bindFramebuffer(r.fbo),t.setClearColor(0,0,0,0),t.clear(16384);const n=this._focusedTexture.attachment,s=[v(n)],a=this._ensureProgram(t,!1,s);return t.useProgram(a),t.bindTexture(n,0),a.setUniform1i("colorTex0",0),a.setUniform1i("inputType",this._focusedFBOType),3===this._focusedFBOType&&a.setUniform2fv("nearFar",this.camera.nearFar),t.setDrawBuffers([p]),t.screen.draw(),t.bindFramebuffer(o),r}getDownscaledFBO(e,r,t,o,n,i){if(n?.startsWith(`${r}\n`)??!1){const r=1/2**e.level;t=e.width*r,o=e.height*r}else i=null;const s="linear depth"===r||r.includes("shadow"),a="overlay highlight"===r||"highlights"===r||"highlight mix"===r,c="highlight coverage"===r,u=e.colorTexture?.descriptor,l=u?.internalFormat,d=[],m=new Array,g=new Array;e.colorAttachments.forEach((r,t)=>{const o=e.getColorTexture(r);if(o){const e=v(o);d.push(e);const{descriptor:r}=o;"float"!==e||r.hasMipmap||r.isImmutable||(o.generateMipmap(),m[t]=!0)}if(t>0){const e=o?.descriptor.internalFormat;return void(e===f.RGBA8&&(o?.debugName?.indexOf("emissive")??-1)>=0?g.push(8):g.push(F(e)))}g.push(s?0:a?1:c?2:i??F(l))});const x=this.renderingContext,{depthStencilTexture:$}=e,b=this._ensureProgram(x,null!=$,d,e.level),C=this.fboCache.acquire(t,o,"fbo visualizer");x.useProgram(b);const R=x.boundFramebuffer;x.bindFramebuffer(C.fbo);const y=new Array;e.colorAttachments.forEach((r,t)=>{const o=`colorTex${t.toFixed()}`;x.bindTexture(e.getColorTexture(r),t),b.setUniform1i(o,t),t>0&&C.acquireColor(p+t,5,"fbo visualizer"),y.push(r)});const w=$?.descriptor.linearFilterDepth??!1;if($){const r=e.colorAttachments.length;$.setShadowFiltering(!1),x.bindTexture($,r),b.setUniform1i("depthTex",r);const t=p+r;t>p&&C.acquireColor(t,5,"fbo visualizer"),y.push(t)}x.gl.drawBuffers(y),h(x.gl);const B=x.getViewport();return x.setViewport(0,0,t,o),x.setClearColor(0,0,0,0),x.clear(16384),x.setBlendingEnabled(!0),x.setBlendFunction(1,771),b.setUniform1iv("inputTypes",g.length>0?g:[7]),b.setUniform2fv("nearFar",this.camera.nearFar),x.screen.draw(),h(x.gl),x.bindFramebuffer(R),x.setViewport(B.x,B.y,B.width,B.height),e.colorAttachments.forEach((t,o)=>{const i=e.getColorTexture(t);m[o]&&i?.clearMipmap(),n===T(r,e,t,!1)&&(this._focusedTexture?.release(),this._focusedTexture=C.getAttachment(t),this._focusedTexture?.retain(),this._focusedFBOType=9===g[o]?F(i?.descriptor.internalFormat):g[o])}),$&&$.setShadowFiltering(w),C}clearFocusedFBO(){this._focusedTexture=r(this._focusedTexture)}getPreviewContent(e,r,t,o){const n=this.renderingContext,i=o.includes("\ndepth"),s=this.fboCache.acquire(e,r,"fbo visualizer"),a=n.boundFramebuffer;n.bindFramebuffer(s?.fbo);const c=n.getViewport();n.setViewport(0,0,e,r),n.setClearColor(this.clearColor[0],this.clearColor[1],this.clearColor[2],this.clearColor[3]),n.clear(16384),n.setBlendingEnabled(!0),n.setBlendFunction(1,771);const u=t.attachment,l=this._ensureProgram(n,!1,[v(u)]);n.useProgram(l),n.bindTexture(u,0),l.setUniform1i("colorTex0",0),l.setUniform1iv("inputTypes",[i||u.descriptor.internalFormat!==f.RGBA16F?7:5]),n.screen.draw();const p=new ImageData(new Uint8ClampedArray(e*r*4),e,r);return n.gl.readPixels(0,0,e,r,6408,d.UNSIGNED_BYTE,new Uint8Array(p.data.buffer)),h(n.gl),n.bindFramebuffer(a),n.setViewport(c.x,c.y,c.width,c.height),s?.release(),p}_ensureProgram(e,r,t,o=0){const n=x({hasDepthAttachment:r,colorSamplerTypes:t}),i=this._programs.get(n);if(i)return i;const s="#version 300 es\n in vec2 position;\n out vec2 uv;\n\n void main() {\n gl_Position = vec4(position, 0.0, 1.0);\n uv = position * 0.5 + vec2(0.5);\n }",h=e=>{let r="";for(let t=0;t<e.length;++t){const o=e[t];r+=`layout(location = ${c.int(t)}) out vec4 fragColor${c.int(t)};\n uniform ${g(o)} colorTex${c.int(t)};`}return r},p=e=>e.reduce((e,r,t)=>e+`{\n int inputType = inputTypes[${t}];\n if (inputType == ${3..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv, ${o}.0).r), 1.0);\n } else if (inputType == ${4..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0).rg, 0.0, 1.0);\n } else if (inputType == ${(0).toFixed()}) {\n float depth = 1.0 - ((-linearDepthFromTexture(colorTex${t}, uv) - nearFar[0]) / (nearFar[1] - nearFar[0]));\n fragColor${t} = vec4(vec3(depth), depth >= 0.999 ? 0.0 : 1.0);\n } else if (inputType == ${5..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0).rgb, 1.0);\n } else if (inputType == ${1..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0)) * 255.0;\n fragColor${t} = vec4(fragColor${t}.rgb / fragColor${t}.a, fragColor${t}.a);\n } else if(inputType == ${2..toFixed()}) {\n vec2 texDim = vec2(textureSize(colorTex${t}, 0));\n ivec2 iuv = ivec2(uv * texDim);\n uvec2 hh = uvec2(texelFetch(colorTex${t}, iuv, 0).rg);\n fragColor${t} = vec4(\n ((hh & uvec2(0x55u)) != uvec2(0u)) ? 1.0 : 0.0,\n ((hh & uvec2(0xaau)) != uvec2(0u)) ? 1.0 : 0.0,\n 0.0,\n 1.0);\n } else if(inputType == ${8..toFixed()}) {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0));\n fragColor${t}.rgb *= ${l.toFixed(1)};\n } else if (inputType == ${9..toFixed()}) {\n fragColor${t} = vec4(vec3(texture(colorTex${t}, uv, ${o}.0).a), 1.0);\n } else {\n fragColor${t} = vec4(texture(colorTex${t}, uv, ${o}.0));\n }\n }`,""),f=t.length,d=`#version 300 es\n precision highp float;\n precision highp usampler2D;\n\n in vec2 uv;\n ${h(t)}\n ${a(r,`layout(location = ${c.int(f)}) out vec4 fragDepth;\n uniform sampler2D depthTex;`)}\n\n uniform int inputTypes[${t.length||1}];\n uniform vec2 nearFar;\n\n // Factors to convert rgba back to float\n const vec4 RGBA_2_FLOAT_FACTORS = vec4(\n 255.0 / (256.0),\n 255.0 / (256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0),\n 255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n );\n\n\n float rgbaToFloat(vec4 rgba) {\n // Convert components from 0->1 back to 0->255 and then add the components together with their corresponding\n // fixed point factors, i.e. (256^1, 256^2, 256^3, 256^4)\n return dot(rgba, RGBA_2_FLOAT_FACTORS);\n }\n\n float linearDepthFromFloat(float depth) {\n depth = pow(depth, 0.2);\n return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);\n }\n\n float linearDepthFromRGBA(vec4 depth) {\n return linearDepthFromFloat(rgbaToFloat(depth));\n }\n\n ${"float"===t[0]?"float linearDepthFromTexture(sampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(texelFetch(depthTex, iuv, 0));\n }":"float linearDepthFromTexture(usampler2D depthTex, vec2 uv) {\n ivec2 iuv = ivec2(uv * vec2(textureSize(depthTex, 0)));\n return linearDepthFromRGBA(vec4(texelFetch(depthTex, iuv, 0)) * 255.0);\n }"}\n\n void main() {\n ${p(t)}\n ${a(r,"float depth = 1.0 - pow(texture(depthTex, uv).r, 10.0);\n fragDepth = vec4(vec3(depth), depth < 0.000001 ? 0.0 : 1.0);")}\n }`,m=e.programCache.get(s,d,u);return this._programs.set(n,m),m}};function g(e){switch(e){case"float":return"sampler2D";case"uint":return"usampler2D";case"int":return"isampler2D"}}function v(e){if(!e)return"float";const{internalFormat:r}=e.descriptor;switch(r){case f.R8I:case f.R16I:case f.R32I:case f.RG8I:case f.RG16I:case f.RG32I:case f.RGB8I:case f.RGB16I:case f.RGB32I:case f.RGBA8I:case f.RGBA16I:case f.RGBA32I:return"int";case f.R8UI:case f.R16UI:case f.R32UI:case f.RG8UI:case f.RG16UI:case f.RG32UI:case f.RGB8UI:case f.RGB16UI:case f.RGB32UI:case f.RGBA8UI:case f.RGBA16UI:case f.RGBA32UI:return"uint";default:return"float"}}function x(e){const{hasDepthAttachment:r,colorSamplerTypes:t}=e;return`${r?"Depth":""}${t.reduceRight((e,r)=>e+`|C${r}`,"")}`}function F(e){switch(e){case f.R16F:case f.R32F:case f.R8:return 3;case f.RG8:return 4;case f.RGBA16F:return 5;case f.RG8UI:return 6;default:return 7}}function T(e,r,t,o){return o?`${e}\ndepth`:`${e}\n${$(r,t)}`}function $(e,r){return`${e.getColorTexture(r)?.debugName??"color"+(r-p)}`}e([t()],m.prototype,"destroyedCB",void 0),e([t()],m.prototype,"produces",void 0),e([t()],m.prototype,"consumes",void 0),e([t()],m.prototype,"clearColor",void 0),m=e([o("esri.views.3d.webgl-engine.effects.debug.RenderNodeVisualizerNode")],m);export{m as RenderNodeVisualizerNode,T as getAttachmentName};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{O as e}from"../../../../../chunks/OITBlendEmission.glsl.js";import{OITBlendEmissionTechnique as i}from"./OITBlendEmissionTechnique.js";import{OITBlendFragmentTechniqueConfiguration as s}from"./OITBlendFragmentTechniqueConfiguration.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as n}from"./OITBlendTechniqueConfiguration.js";import{OITDimOpaqueTechnique as
|
|
2
|
+
import{O as e}from"../../../../../chunks/OITBlendEmission.glsl.js";import{OITBlendEmissionTechnique as i}from"./OITBlendEmissionTechnique.js";import{OITBlendFragmentTechniqueConfiguration as s}from"./OITBlendFragmentTechniqueConfiguration.js";import{OITBlendTechnique as t}from"./OITBlendTechnique.js";import{OITBlendTechniqueConfiguration as n}from"./OITBlendTechniqueConfiguration.js";import{OITDimOpaqueTechnique as o}from"./OITDimOpaqueTechnique.js";import{OITResolutionConfiguration as r}from"../../shaders/oitResolution.glsl.js";import{ColorAttachment1 as a,ColorAttachment2 as u,DrawBufferNone as h}from"../../../../webgl/enums.js";class m{constructor(i){this._techniques=i,this._parameters=new e,this._blendConfiguration=new n,this._dimOpaqueConfiguration=new s,this._blendEmissionConfiguration=new r}precompile(e,s,n){this._updateConfigurations(e,s,n);const{hasTransparentEmission:r,hasOpaqueEmission:a}=e;a&&1!==n&&this._techniques.precompile(o,this._dimOpaqueConfiguration),this._techniques.precompile(t,this._blendConfiguration),r&&0===n&&this._techniques.precompile(i,this._blendEmissionConfiguration)}blend(e,s,n,r,m,f,p){this._updateConfigurations(r,m,f),this._parameters.colorTexture=s.getTexture(),this._parameters.alphaTexture=s.getTexture(a),this._parameters.emissionTexture=s.getTexture(u),this._parameters.frontFaceTexture=n.getTexture(),this._parameters.frontFaceEmissionTexture=n.getTexture(a);const c=e.drawBuffers,{hasOpaqueEmission:l,hasTransparentEmission:d}=r;if(l&&1!==f){const i=this._techniques.get(o,this._dimOpaqueConfiguration);e.bindTechnique(i,r,this._parameters),e.setDrawBuffers([h,a]),e.screen.draw(),p?.("oit opaque emission color",e.boundFramebuffer)}const _=this._techniques.get(t,this._blendConfiguration);if(e.bindTechnique(_,r,this._parameters),!l&&d){const i=c.slice();i[1]=h,e.setDrawBuffers(i),e.screen.draw()}else e.setDrawBuffers(c),e.screen.draw();if(p?.("oit composited",e.boundFramebuffer),d&&0===f){const s=this._techniques.get(i,this._blendEmissionConfiguration);e.bindTechnique(s,r,this._parameters),e.setDrawBuffers([h,a]),e.screen.draw(),p?.("oit transparent emission",e.boundFramebuffer)}e.setDrawBuffers(c)}_updateConfigurations(e,i,s){this._blendConfiguration.useFloatBlend=this._dimOpaqueConfiguration.useFloatBlend=this._blendEmissionConfiguration.useFloatBlend=e.useFloatBlend.value,this._blendConfiguration.computeHudOcclusion=i,this._blendConfiguration.hasOpaqueEmission=0===s&&e.hasOpaqueEmission,this._blendConfiguration.frontFaceMask=1===s}}export{m as OITBlend};
|