@arcgis/core 5.2.0-next.34 → 5.2.0-next.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/Viewshed.d.ts +0 -5
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{4316b78fc36bfd893a90.js → 155940ef3d1888272d73.js} +1 -1
- package/assets/esri/core/workers/chunks/24aa98cb2021ddd789ce.js +1 -0
- package/assets/esri/core/workers/chunks/406c7723e8db470822bf.js +1 -0
- package/assets/esri/core/workers/chunks/{37dc6a8495f1f44e2d45.js → 6c746ac4bd2e57b8cb41.js} +1 -1
- package/assets/esri/core/workers/chunks/{3dd8145ef89f32920177.js → 7b5e628ea3d4a51f1c4e.js} +1 -1
- package/assets/esri/core/workers/chunks/8a9b2efa0603e9fa4e8b.js +1 -0
- package/assets/esri/core/workers/chunks/{fe8032905992e6574714.js → 9fb0431b0628dcb53004.js} +54 -54
- package/assets/esri/core/workers/chunks/bccc199af4e2e49f7acd.js +1 -0
- package/assets/esri/core/workers/chunks/{87c7092282214f5b78b8.js → c72121076e438ed28d60.js} +12 -12
- package/assets/esri/core/workers/chunks/{414691f7758c78e2a704.js → cfbbfa5edffa57bd3a8e.js} +1 -1
- package/assets/esri/core/workers/chunks/d0217187aed8bb7038f4.js +1 -0
- package/assets/esri/core/workers/chunks/{b7d7bfcb089a3f1a38b6.js → dd785e595cd08b2d6284.js} +1 -1
- package/assets/esri/core/workers/chunks/{0087ad36f7d38fc7fe11.js → ee446250a40e5d89bb5a.js} +44 -44
- package/assets/esri/core/workers/chunks/{42b1c526c4c9636a169d.js → f1f3fe9d2d96578f4f6b.js} +1 -1
- package/chunks/FocusAreaColor.glsl.js +1 -10
- package/chunks/RibbonLine.glsl.js +22 -22
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/kernel.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/raster/datasets/pixelReader.js +1 -1
- package/layers/raster/functions/pixelUtils.js +1 -1
- package/layers/types.d.ts +9 -2
- package/package.json +1 -1
- package/popup/Features.d.ts +2 -2
- package/popup/Features.js +1 -1
- package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +17 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -14
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
- package/views/View2D.js +1 -1
- package/views/interactive/tooltip/fields/fields.js +1 -1
- package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
- package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
- package/views/layers/ViewshedLayerView.d.ts +0 -10
- package/views/support/LayerViewManager.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/Editor.d.ts +6 -0
- package/assets/esri/core/workers/chunks/3d1021f7ea9617a76ccf.js +0 -1
- package/assets/esri/core/workers/chunks/7a59d39010ed33b8fabb.js +0 -1
- package/assets/esri/core/workers/chunks/a0f7e37d385fc68b138d.js +0 -1
- package/assets/esri/core/workers/chunks/dfae4440afe0ca7c5b25.js +0 -1
- package/assets/esri/core/workers/chunks/fec9ce6ad634c904ffdf.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
class
|
|
2
|
+
class t{constructor(t,e,r,s=0){this.layout=t,this.byteOffset=s,this._bufferViews=new Map,this.buffer="number"==typeof e?new ArrayBuffer(e*t.byteStride):e,this.texelElementBuffer=new r(this.buffer,s);const f=this._bufferViews;for(const[i,n]of this.layout.fields)f.set(i,new n.bufferViewConstructor(this.buffer,s+n.byteOffset,this.layout.byteStride))}get stride(){return this.layout.byteStride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(t,e){const r=this._bufferViews.get(t);return null!=r&&r.elementCount===e.ElementCount&&r.elementType===e.ElementType?r:null}copyItem(t,e){const{buffer:r,layout:s,byteOffset:f}=this,i=new Uint8Array(r),n=s.byteStride,u=f+t*n,y=f+e*n;i.copyWithin(y,u,u+n)}get usedMemory(){return this.byteLength}}export{t as TextureBufferView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{copy as
|
|
2
|
+
import{copy as i,lerp as s,squaredLength as t,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{h as o}from"../../../../chunks/boundedPlane.js";import{clipPolygon as l,clipLineSegment as r,create as c,fromValues as a}from"../../../../geometry/support/plane.js";function u(i){return(t,n,e)=>!o(i,s(b,t,n,e))}class h{constructor(i,s){this.list=i,this.count=s}}class m{constructor(i){this._remainingA=g(),this._remainingB=g(),this._visible=g(),this._lineRemainingA=p(),this._lineRemainingB=p(),this._lineVisible=p(),this._slicedAwayHalfspaces=f(i)}*processTriangle(s,t){let n=new h(this._remainingA,3),e=new h(this._remainingB,0);i(n.list[0],t[0]),i(n.list[1],t[1]),i(n.list[2],t[2]);const o=new h(this._visible,0);for(const i of this._slicedAwayHalfspaces){if(o.count=l(i,n.list,n.count,o.list,!1),o.count>=3&&(s.list=o.list,s.count=o.count,yield s),e.count=l(i,n.list,n.count,e.list,!0),e.count<3)return;[e,n]=[n,e]}}*processLineSegment(s,t,n){let e=this._lineRemainingA,o=this._lineRemainingB;i(e[0],t),i(e[1],n);for(const l of this._slicedAwayHalfspaces){if(r(l,e[0],e[1],this._lineVisible[0],this._lineVisible[1],!1)&&(i(s[0],this._lineVisible[0]),i(s[1],this._lineVisible[1]),yield s),!r(l,e[0],e[1],o[0],o[1],!0))return;[o,e]=[e,o]}}}function f(i){const s=[c(i.plane),c(),c(),c(),c()];return _(i.basis1,i.origin,s[1],s[2]),_(i.basis2,i.origin,s[3],s[4]),s}function _(i,s,e,o){const l=t(i),r=n(i,s);a(i[0],i[1],i[2],-r+l,e),a(-i[0],-i[1],-i[2],r+l,o)}function g(){return Array.from({length:12},()=>e())}function p(){return[e(),e()]}const b=e();export{m as SliceScreenPolygonPrimitiveProcessor,u as sliceFilterPredicate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterialLoader as t}from"../GLMaterialLoader.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{VertexBuffer as s}from"../../../../webgl/VertexBuffer.js";class
|
|
2
|
+
import{glLayout as e}from"../../../support/buffer/glUtil.js";import{GLMaterialLoader as t}from"../GLMaterialLoader.js";import{VertexArrayObject as r}from"../VertexArrayObject.js";import{VertexBuffer as s}from"../../../../webgl/VertexBuffer.js";class o{constructor(o,i){this.geometry=i;const n=o.renderContext.rctx,m=i.renderGeometry,{material:a,layout:u,buffer:g}=m;this._materials=o.materials,a.setParameters({instancedDoublePrecision:!0}),this.glMaterialLoader=new t(a,this._materials),this.vbo=new s(n,e(u),g),this.vao=new r(n,this.vbo)}destroy(){this.glMaterialLoader.dispose(),this.vbo.dispose(),this.vao.dispose()}get material(){return this.geometry.renderGeometry.material}get emissions(){return this.material.emissions}get layout(){return this.geometry.renderGeometry.layout}get boundingInfo(){return this.geometry.boundingInfo}get numTriangles(){return this.numVertices/3}get numVertices(){return this.geometry.renderGeometry.numVertices}get usedMemory(){return 128+this.vbo.usedMemory+this.vao.usedMemory}intersect(e,t,r,s,o,i,n,m){return this.geometry.intersect(e,t,r,s,o,i,n,m)}intersectScreenPolygon(e,t,r,s,o,i){return this.geometry.intersectScreenPolygon(e,t,r,s,o,i)}}export{o as LodComponentData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isSome as
|
|
2
|
+
import{isSome as e}from"../../../../../core/arrayUtils.js";import{isAborted as o,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{create as t}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as i,center as r,diameter as c}from"../../../../../geometry/support/aaBoundingBox.js";import{getEmissions as u}from"../../effects/emissive/emissions.js";import{LodComponentData as m}from"./LodComponentData.js";class a{static async create(t,s,i){const r=await Promise.allSettled(s.components.map(e=>t.controller.schedule(()=>new m(t,e.geometry),i))),c=r.map(e=>"fulfilled"===e.status?e.value:null).filter(e);if(o(i)||c.length!==r.length){c.forEach(e=>e.destroy()),n(i);for(const e of r)if("rejected"===e.status)throw e.reason}return new a(s.minScreenSpaceRadius,c)}constructor(e,o){this.minScreenSpaceRadius=e,this.components=o}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,o,n,t,s,i,r){this.components.forEach(c=>c.intersect(e,o,n,t,s,i,this.boundingSphere,r))}*intersectScreenPolygon(e,o,n,t,s){for(const i of this.components)i.intersectScreenPolygon(e,o,n,t,this.boundingSphere,s),yield}get boundingBox(){if(null==this._boundingBox){const e=s();this.components.forEach(o=>{null!=o.boundingInfo&&(i(e,o.boundingInfo.bbMin),i(e,o.boundingInfo.bbMax))}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(null==this._boundingSphere){const e=this.boundingBox,o=t();r(e,o),this._boundingSphere={center:o,radius:.5*c(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,o)=>e+o.numTriangles,0)}get emissions(){return u(this.components)}}export{a as LodLevel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{getEmissions as C}from"../../effects/emissive/emissions.js";import{DepthRange as D}from"../DepthRange.js";import{assert as R}from"../Util.js";import{InstanceData as E}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as w}from"./LodLevel.js";import{getRenderInstanceDataLayout as L,RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as U}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as O}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as T}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as A}from"../../../../support/HighlightDefaults.js";import{TaskPriority as M,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as B}from"../../../../webgl/Util.js";import{fromLayout as F}from"../../../../webgl/VertexAttributeLocations.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map(e=>e.minScreenSpaceRadius);return new S(t,r)};let H=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new E({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(M.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=L(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==A&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get emissions(){return C(this._levels)}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new j(e,this._instanceBufferLayout))}async initializeRenderContext(e,r){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const n=await Promise.allSettled(this.symbol.levels.map(t=>w.create(e,t,r))),s=n.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(r)||s.length!==n.length){s.forEach(e=>e.destroy()),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return n(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(A))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach(t=>n.forEach(({components:n},s)=>n.forEach(n=>r.push(this._beginComponent(e,t[s],n))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;const s=this.levels;r.forEach(r=>s.forEach(({components:s},a)=>s.forEach(s=>this._renderComponent(e,t[n++],r[a],s,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:r}=e,n=10===t,s=6===t,a=7!==t;if(!n&&!s)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(n){const e=r.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(A);return s?e?[e]:null:Array.from(i.values())}return null}intersectRay(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=f();d(s,n,r);const a=s=>{this._withIntersectableInstance(e,s,(a,i)=>{m(k,r,e.transform.inverse),m(Y,n,e.transform.inverse),a.intersect(e,t,k,Y,s,this.metadata,i)})};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}_withIntersectableInstance(e,t,r){const n=this._instanceData.getState(t);if(!(4&n))return;const s=this._instanceData.getLodLevel(t),a=this._levels.length;R(!!(18&n),"invalid instance state"),R(s>=0&&s<a,"invaid lod level");const i=this._levels[s];null!=i&&(this._instanceData.getCombinedModelTransform(t,W),e.transform.set(W),r(i,a))}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)18&t.get(r)&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,1,e.frustum),n=this._octree.findClosest(t,-1,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,G),d(G,G,s);const i=u(G,t)-G[3];a.boundingSphere.getVec(n,G),d(G,G,s);const o=u(G,t)+G[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,N),e=a.selectLevel(N,i.getCombinedMedianScaleFactor(h),n)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);P(a[e],o,h)}f|=16}else P(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,n.material.parameters,$),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(n.vao,F(l)),i.bindVAO(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Z[Math.min(s,Z.length-1)]),o.setUniform1i("symbolColorMixMode",U.replace));const c=r.capacity,h=r.headIndex,d=r.tailIndex,u=r.firstIndex,m=(e,s)=>{B(i,o.locations,r.buffer,e),i.drawArraysInstanced(t.primitiveType,0,n.numVertices,s-e)};n.material.transparent&&null!=u?h>d?(R(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(R(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(R(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function P(e,t,r){const n=e.allocateHead();z(t,r,e.view,n)}function z(e,t,r,n){O(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.olidColor&&r.olidColor&&r.olidColor.copyFrom(n,e.olidColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}e([l({constructOnly:!0})],H.prototype,"symbol",void 0),e([l({constructOnly:!0})],H.prototype,"metadata",void 0),e([l({constructOnly:!0})],H.prototype,"shaderTransformation",void 0),e([l()],H.prototype,"_instanceData",void 0),e([l()],H.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],H.prototype,"_enableLevelSelection",null),e([l()],H.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],H.prototype,"readyToRun",null),H=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],H);const N=f(),G=_(),W=h(),k=f(),Y=f(),Z=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],$=new T;export{H as LodRenderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import s from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as r}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{getEmissions as C}from"../../effects/emissive/emissions.js";import{DepthRange as D}from"../DepthRange.js";import{assert as R}from"../Util.js";import{InstanceData as E}from"./InstanceData.js";import{InstanceOctree as S}from"./InstanceOctree.js";import{LevelSelector as x}from"./LevelSelector.js";import{LodLevel as w}from"./LodLevel.js";import{getRenderInstanceDataLayout as L,RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as O}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as U}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as T}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as M}from"../../../../support/HighlightDefaults.js";import{TaskPriority as A,noBudget as P}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F}from"../../../../webgl/Util.js";import{fromLayout as q}from"../../../../webgl/VertexAttributeLocations.js";const V=e=>{const t=e.baseBoundingSphere.radius,s=e.levels.map(e=>e.minScreenSpaceRadius);return new x(t,s)};let B=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new E({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(A.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=L(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==M&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get emissions(){return C(this._levels)}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,s)=>{const n=this._allRenderInstanceData[0][s].size+this._allRenderInstanceData[1][s].size,r=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*r,trianglesPerInstance:r})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new j(e,this._instanceBufferLayout))}async initializeRenderContext(e,s){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const n=await Promise.allSettled(this.symbol.levels.map(t=>w.create(e,t,s))),r=n.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(s)||r.length!==n.length){r.forEach(e=>e.destroy()),o(s);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=r,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return n(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(M))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(P),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const s=new Array,n=this.levels;return t.forEach(t=>n.forEach(({components:n},r)=>n.forEach(n=>s.push(this._beginComponent(e,t[r],n))))),s}render(e,t){const s=this._getInstanceDatas(e);if(!s||null==t)return;let n=0;const r=this.levels;s.forEach(s=>r.forEach(({components:r},a)=>r.forEach(r=>this._renderComponent(e,t[n++],s[a],r,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:s}=e,n=10===t,r=6===t,a=7!==t;if(!n&&!r)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(n){const e=s.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(M);return r?e?[e]:null:Array.from(i.values())}return null}intersectRay(e,t,s,n){if(!this.baseMaterial.visible||null==this._octree)return;const r=f();d(r,n,s);const a=r=>{const a=this._setupIntersectableInstance(e,r);a&&(m(k,s,e.transform.inverse),m(Y,n,e.transform.inverse),a.intersect(e,t,k,Y,r,this.metadata,this._levels.length))};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(s,r,a)}*intersectScreenPolygon(e,t){if(!this.baseMaterial.visible||null==this._octree)return;const s=this.baseMaterial.parameters.verticalOffset?this._octree.values():this._octree.intersectingFrustumValues(t.broadPhaseFrustum,e=>!!(4&this._instanceData.getState(e)));for(const n of s)yield*this._intersectScreenPolygonInstance(e,t,n)}*_intersectScreenPolygonInstance(e,t,s){const n=this._setupIntersectableInstance(e,s);n&&(yield*n.intersectScreenPolygon(e,t,s,this.metadata,this._levels.length))}_setupIntersectableInstance(e,t){const s=this._instanceData.getState(t);if(!(4&s))return null;const n=this._instanceData.getLodLevel(t),r=this._levels.length;R(!!(18&s),"invalid instance state"),R(n>=0&&n<r,"invaid lod level");const a=this._levels[n];return null==a?null:(this._instanceData.getCombinedModelTransform(t,W),e.transform.set(W),a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new S(e,this.baseBoundingSphere);for(let s=0;s<e.capacity;++s)18&t.get(s)&&this._octreeCached.addInstance(s)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,s=this._octree.findClosest(t,1,e.frustum),n=this._octree.findClosest(t,-1,e.frustum);if(null==s||null==n)return new D;const r=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(s,G),d(G,G,r);const i=u(G,t)-G[3];a.boundingSphere.getVec(n,G),d(G,G,r);const o=u(G,t)+G[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new s("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,N),e=a.selectLevel(N,i.getCombinedMedianScaleFactor(h),n)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=r(u,t,n);if(e>=a.length)throw new s("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);H(a[e],o,h)}f|=16}else H(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,s){if(0===t.size)return null;const n=s.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,s,n,r){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,n.material.parameters,$),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(n.vao,q(l)),i.bindVAO(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Z[Math.min(r,Z.length-1)]),o.setUniform1i("symbolColorMixMode",O.replace));const c=s.capacity,h=s.headIndex,d=s.tailIndex,u=s.firstIndex,m=(e,r)=>{F(i,o.locations,s.buffer,e),i.drawArraysInstanced(t.primitiveType,0,n.numVertices,r-e)};n.material.transparent&&null!=u?h>d?(R(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(R(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(R(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function H(e,t,s){const n=e.allocateHead();z(t,s,e.view,n)}function z(e,t,s,n){U(e.modelOrigin,t,s.modelOriginHi,s.modelOriginLo,n),s.model.copyFrom(n,e.model,t),s.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&s.color&&s.color.copyFrom(n,e.color,t),e.olidColor&&s.olidColor&&s.olidColor.copyFrom(n,e.olidColor,t),e.featureAttribute&&s.featureAttribute&&s.featureAttribute.copyFrom(n,e.featureAttribute,t)}e([l({constructOnly:!0})],B.prototype,"symbol",void 0),e([l({constructOnly:!0})],B.prototype,"metadata",void 0),e([l({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([l()],B.prototype,"_instanceData",void 0),e([l()],B.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([l()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],B.prototype,"readyToRun",null),B=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const N=f(),G=_(),W=h(),k=f(),Y=f(),Z=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],$=new T;export{B as LodRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResult as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),
|
|
2
|
+
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResult as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),a=o.layout,m=o.elementCount(s),u=a.createBuffer(m);o.write(null,null,s,null,{buffer:u,offset:0}),this.renderGeometry=new i(t,u.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const u=this.engineGeometry;this.material.intersectRay(u,e.transform.transform,e,r,s,(r,s,u)=>a(r,s,u,e,t,i,o,n,m))}intersectScreenPolygon(e,t,r,s,i,o){const a=this.engineGeometry,m=this.material.intersectScreenPolygon?.(a,e.transform.transform,e,t);m?.valid&&e.polygonResults.add(3,new n(s.layerViewUid,s.graphicUid(r),m.primitiveIndex,i,o),m.distance)}}function a(e,t,r,i,o,a,m,u,c){if(e<0)return;if(o&&!o(i.rayBegin,i.rayEnd,e))return;const l=new n(a.layerViewUid,a.graphicUid(u),r,m,c);if((null==i.results.min.distance||e<i.results.min.distance)&&i.results.min.set(3,l,e,t,i.transform.transform),(null==i.results.max.distance||e>i.results.max.distance)&&i.results.max.set(3,l,e,t,i.transform.transform),2===i.options.store){const r=new s(i.results.min.ray);r.set(3,l,e,t,i.transform.transform),i.results.all.push(r)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class u{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,u as LodLevelResources,c as LodResources};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,set as n,transformMat4 as o,distance as r,squaredDistance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as a,getMax as u,getMin as c,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as
|
|
2
|
+
import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{copy as e,set as n,transformMat4 as o,distance as r,squaredDistance as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as l,setMax as a,getMax as u,getMin as c,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{clipPolygon as m}from"../../../../geometry/support/plane.js";import{normalFromValues as p,closestPointFromValues as d}from"../../../../geometry/support/triangle.js";import{boundingInfoSubdivisionThreshold as I}from"./intersectionConstants.js";import{projectAabbToScreenBounds as h,projectBoundingInfoToScreenBounds as g,screenPolygonIntersectsBounds as b,screenPolygonIntersectsTriangle as v}from"./screenPolygonOverlapUtils.js";class y{constructor(){this.distance=Number.POSITIVE_INFINITY,this.primitiveIndex=0,this.hasNormal=!1,this.point=s(),this.normal=s()}reset(){this.distance=Number.POSITIVE_INFINITY}update(t,n,o,r){this.distance=t,this.primitiveIndex=n,e(this.point,o),this.hasNormal=null!=r,null!=r&&e(this.normal,r)}updateIfCloserFromValues(t,e,n,o){t<this.distance&&this.update(t,e,n,o)}updateIfCloser(t){const{distance:e,primitiveIndex:n,point:o,normal:r}=t;this.updateIfCloserFromValues(e,n,o,t.hasNormal?r:null)}get valid(){return Number.isFinite(this.distance)}}function N(t,e,n,o,r){if(!t.visible||0!==t.type)return null;const i=new y;let s;if(t.boundingInfo)s=x(t.boundingInfo,e,n,o,r);else{const i=t.positionAttribute,l=t.primitivePositionIndices;s=j(e,n,o,0,l.length/3,l,i.data,i.stride,r,null,0)}for(const l of s)i.updateIfCloser(l);return i.valid?i:null}function T(t,e,n,o,r,i,s,l,a){const u=new y;for(const c of j(t,e,n,o,r,i,s,l,a,null,0))u.updateIfCloser(c);return u.valid?u:null}function*j(t,e,n,o,i,s,l,a,u,c=null,f=0){if(null==t.camera)return;const{camera:d,screenPolygonPrimitiveProcessor:I}=t;for(let h=o;h<i;++h){const t=(c?.[h]??h)+f,o=null==c?t:h,i=3*t;C(O[0],s,l,a,i+0,u,o,e),C(O[1],s,l,a,i+1,u,o,e),C(O[2],s,l,a,i+2,u,o,e);const g=Y;let b;B.reset();for(const{list:e,count:s}of I.processTriangle(M,O)){const o=m(d.frustum[4],e,s,S,!1);if(!(o<3)){for(let t=0;t<o;t++)d.projectToScreen(S[t],w[t]);P(n,w,o)&&(F(d.eye,S,o,E),null==b&&(b=p(Y,O[0],O[1],O[2])),B.updateIfCloserFromValues(r(d.eye,E),t,E,b?g:null))}}B.valid&&(yield B)}}function*x(t,e,n,o,r){const i=e.camera,s=null!=r?(l(V,t.bbMin),a(V,t.bbMax),r.applyToAabb(V),h(i,c(V,O[0]),u(V,O[1]),n)):g(i,t,n);if(null==s||!b(o,s.bounds))return;const{primitiveIndices:f,position:m}=t,p=f?f.length:m.indices.length/3;if(p>I){const i=t.getChildren();if(void 0!==i){for(const t of i)yield*x(t,e,n,o,r);return}}yield*j(e,n,o,0,p,m.indices,m.data,m.stride,r,f,0)}function C(t,e,r,i,s,l,a,u){const c=i*e[s],f=r[c+0],m=r[c+1],p=r[c+2];null!=l?l.applyToVertex(t,f,m,p,a):n(t,f,m,p),u&&o(t,t,u)}function P(t,e,n){for(let o=1;o<n-1;o++)if(v(t,e[0],e[o],e[o+1]))return!0;return!1}function F(t,n,o,r){let s=Number.POSITIVE_INFINITY;for(let l=1;l<o-1;l++){d(_,t,n[0],n[l],n[l+1]);const o=i(t,_);o<s&&(s=o,e(r,_))}}const V=f(),A=12,O=[s(),s(),s()],S=Array.from({length:A},()=>s()),w=Array.from({length:A},()=>t()),E=s(),Y=s(),_=s(),B=new y,M={list:[],count:0};export{y as Hit,j as forEachTriangleRangeScreenPolygonHit,N as intersectTriangleGeometryScreenPolygon,T as intersectTriangleRangeScreenPolygon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as t,createScreenPointArray as o}from"../../../../core/screenUtils.js";import{copy as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as s,subtract as n,dot as a,scale as c,add as l,copy as m,length as u,distance as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as g}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as d,closestLineSegmentPoint as j,projectPoint as b,create as y}from"../../../../geometry/support/lineSegment.js";import{fromPoints as v,signedDistance as x,getNormal as L,create as S}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as w}from"../core/shaderLibrary/ShaderOutput.js";import M from"../lib/GLMaterial.js";import{Material as T,MaterialParameters as P}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as C,screenPolygonIntersectsBufferedSegment as R}from"../lib/screenPolygonOverlapUtils.js";import{Hit as V}from"../lib/screenPolygonTriangleIntersections.js";import{isTranslationMatrix as _}from"../lib/Util.js";import{DefaultBufferWriter as A}from"./DefaultBufferWriter.js";import{PositionColorLayout as N,PositionLayout as U}from"./DefaultLayouts.js";import{NativeLineTechnique as E}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as O}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as q}from"../../../../webscene/support/AlphaCutoff.js";class B extends T{constructor(e){super(e,X),this._configuration=new O,this.produces=new Map([[2,e=>w(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=q}intersectRay(r,t,o,p,g,b){const{options:y,camera:S,rayBegin:w,rayEnd:M}=o;if(!y.selectionMode||!r.visible||!S)return;if(!_(t))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const T=r.attributes.get("position").data,P=Z;i(P,o.point);const C=ae*S.pixelRatio;s(re[0],P[0]-C,P[1]+C,0),s(re[1],P[0]+C,P[1]+C,0),s(re[2],P[0]+C,P[1]-C,0),s(re[3],P[0]-C,P[1]-C,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(re[e],te[e]))return;v(S.eye,te[0],te[1],oe),v(S.eye,te[1],te[2],ie),v(S.eye,te[2],te[3],se),v(S.eye,te[3],te[0],ne);let R=Number.MAX_VALUE,V=0;for(const e of W(F,G,T,t)){if(x(oe,F)<0&&x(oe,G)<0||x(ie,F)<0&&x(ie,G)<0||x(se,F)<0&&x(se,G)<0||x(ne,F)<0&&x(ne,G)<0)continue;const r=S.projectToRenderScreen(F,k),t=S.projectToRenderScreen(G,H);if(null==r||null==t)continue;if(r[2]<0&&t[2]>0){n(I,F,G);const e=S.frustum,t=-x(e[4],F)/a(I,L(e[4]));if(c(I,I,t),l(F,F,I),!S.projectToRenderScreen(F,r))continue}else if(r[2]>0&&t[2]<0){n(I,G,F);const e=S.frustum,r=-x(e[4],G)/a(I,L(e[4]));if(c(I,I,r),l(G,G,I),!S.projectToRenderScreen(G,t))continue}else if(r[2]<0&&t[2]<0)continue;r[2]=0,t[2]=0;const o=h(d(r,t,Q),P);o<R&&(R=o,m(J,F),m(K,G),V=e)}if(R<C*C){let e=Number.MAX_VALUE;if(j(d(J,K,Q),d(w,M,Y),z)){n(z,z,w);const r=u(z);c(z,z,1/r),e=r/f(w,M)}b(e,z,V)}}intersectScreenPolygon(r,t,o,i){const{options:s,camera:n,screenPolygonPrimitiveProcessor:a}=o;if(!s.selectionMode||!r.visible)return null;if(!_(t))return e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix"),null;const c=r.attributes.get("position").data,l=new V;for(const e of W(F,G,c,t))for(const[r,t]of a.processLineSegment(ce,F,G))C(n,r,t,k,H)&&(n.renderToScreen(k,$),n.renderToScreen(H,ee),R(i,$,ee,ae)&&(b(d(r,t,Y),n.eye,Z),l.updateIfCloserFromValues(f(n.eye,Z),e,Z,null)));return l}intersectRayDraped(e,t,o,i,s){if(!t.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let g=0;g<n.length-5;g+=3){const e=n[g],t=n[g+1],o=l-e,i=m-t,s=n[g+3]-e,a=n[g+4]-t,c=r((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,h=a*c-i,d=u*u+h*h;d<f&&(f=d,p=g/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new D(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?N:U;return new A(e)}}class D extends M{beginSlot(e){return this.getTechnique(E,e)}}function*W(e,r,t,o){for(let i=0;i<t.length-5;i+=3)e[0]=t[i]+o[12],e[1]=t[i+1]+o[13],e[2]=t[i+2]+o[14],r[0]=t[i+3]+o[12],r[1]=t[i+4]+o[13],r[2]=t[i+5]+o[14],yield i/3}class X extends P{constructor(){super(...arguments),this.color=g,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const F=p(),G=p(),I=p(),z=p(),k=t(),H=t(),J=p(),K=p(),Q=y(),Y=y(),Z=p(),$=o(),ee=o(),re=[t(),t(),t(),t()],te=[p(),p(),p(),p()],oe=S(),ie=S(),se=S(),ne=S(),ae=2,ce=[p(),p()];export{B as NativeLineMaterial,X as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as c,copy as h,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as y,distance2 as E,closestLineSegmentPoint as x,projectPointFraction as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as T,getNormal as A,create as L}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as M}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as R,isColor as O,isDepth as V,isColorHighlightOLIDOrDepth as F,is2DGeometryOutput as B}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as k}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as W}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as I,assert as D}from"../lib/Util.js";import{isImagePattern as Y}from"./lineStippleUtils.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as q}from"./internal/bufferWriterUtils.js";import{r as X}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as G,getTextureBufferLayout as H}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as K}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Q}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";class $ extends k{constructor(e,t){super(e,te),this.produces=new Map([[2,e=>R(e)||O(e)&&8===this.parameters.renderOccluded],[3,e=>V(e)],[10,e=>F(e)&&8===this.parameters.renderOccluded],[11,e=>F(e)&&8===this.parameters.renderOccluded],[4,e=>O(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>O(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>B(e)]]),this._configuration=new Q(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ne(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ae(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectScreenPolygon(){return null}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],h=(l/2+4)*r;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=se(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,d=o*l-a,b=h*h+d*d;b<m&&(m=b,u=g/3)}m<h*h&&a(n.distance,n.normal,u)}intersectRay(r,i,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!r.visible||!S)return;if(!I(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes,w=P.get("position").data;let j=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(j*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(j*=P.get("size").data[0]);const L=de;a(L,s.point);const C=j*S.pixelRatio,M=4*S.pixelRatio,R=C/2+M;n(je[0],L[0]-R,L[1]+R,0),n(je[1],L[0]+R,L[1]+R,0),n(je[2],L[0]+R,L[1]-R,0),n(je[3],L[0]-R,L[1]-R,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(je[e],ze[e]))return;z(S.eye,ze[0],ze[1],Te),z(S.eye,ze[1],ze[2],Ae),z(S.eye,ze[2],ze[3],Le),z(S.eye,ze[3],ze[0],Ce);let O=Number.MAX_VALUE,V=0;const F=se(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){le[0]=w[e]+i[12],le[1]=w[e+1]+i[13],le[2]=w[e+2]+i[14];const t=(e+3)%w.length;if(pe[0]=w[t]+i[12],pe[1]=w[t+1]+i[13],pe[2]=w[t+2]+i[14],T(Te,le)<0&&T(Te,pe)<0||T(Ae,le)<0&&T(Ae,pe)<0||T(Le,le)<0&&T(Le,pe)<0||T(Ce,le)<0&&T(Ce,pe)<0)continue;const r=S.projectToRenderScreen(le,ge),s=S.projectToRenderScreen(pe,be);if(null==r||null==s)continue;if(r[2]<0&&s[2]>0){o(ue,le,pe);const e=S.frustum,t=-T(e[4],le)/l(ue,A(e[4]));if(p(ue,ue,t),c(le,le,ue),!S.projectToRenderScreen(le,r))continue}else if(r[2]>0&&s[2]<0){o(ue,pe,le);const e=S.frustum,t=-T(e[4],pe)/l(ue,A(e[4]));if(p(ue,ue,t),c(pe,pe,ue),!S.projectToRenderScreen(pe,s))continue}else if(r[2]<0&&s[2]<0)continue;r[2]=0,s[2]=0;const a=y(r,s,ve),n=E(a,L);if(!(n>=O)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,le,pe,L,S,j,M);if(n>=e*e)continue}O=n,h(Se,le),h(_e,pe),V=e/3}}if(O<R*R){let e=Number.MAX_VALUE;if(x(y(Se,_e,ve),y(_,v,Pe),fe)){o(fe,fe,_);const t=m(fe);p(fe,fe,1/t),e=t/u(_,v)}g(e,fe,V)}}createBufferWriter(){return new re(G(this.parameters),H(this.parameters),this.parameters)}createGLMaterial(e){return new ee(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:i(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=w(e,i);f(ce,t,r,o),d(he,ce,s.viewMatrix);const l=m(he),p=this.computeCameraAbsCosAngle(ce,s,this._configuration.spherical);oe.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return oe.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?g(fe,e):n(fe,0,0,1),o(me,e,t.eye),g(me,me),Math.abs(l(fe,me))}}class ee extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(K,e)}}class te extends J{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Y(this.stipplePattern)&&null!=this.stippleTexture}}class re{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ne(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return se(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:o,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),f=m.indices,g=m.data.length/3,b=g,_=r.get("distanceToStart")?.data;f&&f.length!==2*(g-1)&&console.warn("RibbonLineMaterial does not support indices");const v=o.getField("textureElementIndex",C);D(null!=v,"Missing texture buffer index field"),D(null!==a,"Expected texture buffer target"),D(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;D(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;D(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,j=w.getField("position",M);D(null!==j,"Expected valid position field in texture buffer");const z=p.fields.has("sizeFeatureAttribute");let T=1,A=null;if(z){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:A=e.data}else T=r.get("size")?.data[0]??1;let L=[1,1,1,1],R=0,O=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?R=e.data[0]:O=e.data}else L=r.get("color")?.data??L;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),N=p.fields.has("opacityFeatureAttribute");let k=0,W=null;if(N){const e=r.get("opacityFeatureAttribute");1===e.data.length?k=e.data[0]:W=e.data}const I=new Float32Array(o.buffer),Y=P(o.buffer),J=new Uint8Array(o.buffer),X=new Uint32Array(o.buffer),G=p.stride/4;let H=l*G;const K=H;let Q=0;const Z=_?(e,t,r)=>Q=_[r]:(e,t,r)=>Q+=u(e,t),$=I.BYTES_PER_ELEMENT/Y.BYTES_PER_ELEMENT,ee=4/$,te=U(),re=(e,t,r,s,a,n,o,l)=>{const p=o;X[H]=x+p,H++,j.setVec(E+p,t),q(e,t,Y,H*$),H+=ee,q(r,t,Y,H*$),H+=ee,I[H++]=l;let c=H*$;if(Y[c++]=a,Y[c++]=n,H=Math.ceil(c/$),V)I[H]=O?.[o]??R;else{const e=Math.min(4*o,L.length-4),t=4*H;J[t]=255*L[e],J[t+1]=255*L[e+1],J[t+2]=255*L[e+2],J[t+3]=255*L[e+3]}if(H++,I[H++]=A?.[o]??T,N&&(I[H++]=W?.[o]??k),te){let e=4*H;i?(J[e++]=i[0],J[e++]=i[1],J[e++]=i[2],J[e++]=i[3]):(J[e++]=0,J[e++]=0,J[e++]=0,J[e++]=0),H=Math.ceil(.25*e)}B&&(c=H*$,Y[c++]=s[0],Y[c++]=s[1],Y[c++]=s[2],Y[c++]=s[3],H=Math.ceil(c/$))};H+=G,n(Ee,m.data[0],m.data[1],m.data[2]),B&&S(we,F[0],F[1],F[2],F[3]),e&&d(Ee,Ee,e);const se=this._isClosed(r);if(se){const t=m.data.length-3;n(ye,m.data[t],m.data[t+1],m.data[t+2]),e&&d(ye,ye,e)}else n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),re(Ee,Ee,xe,we,1,-4,0,0),re(Ee,Ee,xe,we,1,4,0,0),h(ye,Ee),h(Ee,xe),B&&S(we,F[4],F[5],F[6],F[7]);const ae=se?0:1,ne=se?g:g-1;for(let u=ae;u<ne;u++){const t=(u+1)%g*3;n(xe,m.data[t],m.data[t+1],m.data[t+2]),e&&d(xe,xe,e),Z(ye,Ee,u),re(ye,Ee,xe,we,0,-1,u,Q),re(ye,Ee,xe,we,0,1,u,Q);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);re(ye,Ee,xe,we,t,-1,u,Q),re(ye,Ee,xe,we,t,1,u,Q)}if(re(ye,Ee,xe,we,1,-2,u,Q),re(ye,Ee,xe,we,1,2,u,Q),h(ye,Ee),h(Ee,xe),B){const e=(u+1)%g*4;S(we,F[e],F[e+1],F[e+2],F[e+3])}}se?(n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),Q=Z(ye,Ee,ne),re(ye,Ee,xe,we,0,-1,ae,Q),re(ye,Ee,xe,we,0,1,ae,Q)):(Q=Z(ye,Ee,ne),re(ye,Ee,Ee,we,0,-5,ne,Q),re(ye,Ee,Ee,we,0,5,ne,Q)),ie(I,K+G,I,K,G);H=ie(I,H-G,I,H,G),this._parameters.wireframe&&this._addWireframeVertices(o,K,H,G)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ie(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function ie(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function se(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function ae(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ne(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return X+r}}const oe=new W,le=b(),pe=b(),ce=b(),he=b(),me=b(),ue=b(),fe=b(),de=b(),ge=r(),be=r(),Se=b(),_e=b(),ve=j(),Pe=j(),ye=b(),Ee=b(),xe=b(),we=v(),je=[r(),r(),r(),r()],ze=[b(),b(),b(),b()],Te=L(),Ae=L(),Le=L(),Ce=L();export{te as Parameters,$ as RibbonLineMaterial};
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as a}from"../../../../core/time.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as o,subtract as l,dot as p,scale as c,add as m,copy as h,length as u,distance as f,lerp as d,transformMat4 as g,normalize as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as v,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as E,distance2 as x,closestLineSegmentPoint as w,projectPoint as z,projectPointFraction as j,create as T}from"../../../../geometry/support/lineSegment.js";import{fromPoints as L,signedDistance as A,getNormal as M,create as R}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as O}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as V,isColor as F,isDepth as B,isColorHighlightOLIDOrDepth as U,is2DGeometryOutput as N}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as I}from"../effects/geometry/olidUtils.js";import k from"../lib/GLMaterial.js";import{Material as W}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as D,screenPolygonIntersectsBufferedSegment as Y}from"../lib/screenPolygonOverlapUtils.js";import{Hit as J}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as q}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as X,assert as G}from"../lib/Util.js";import{isImagePattern as H}from"./lineStippleUtils.js";import{VisualVariablePassParameters as K}from"./VisualVariablePassParameters.js";import{r as Q}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Z,getTextureBufferLayout as $}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ee}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as te}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as re}from"../../../../webscene/support/AlphaCutoff.js";class ie extends W{constructor(e,t){super(e,ae),this.produces=new Map([[2,e=>V(e)||F(e)&&8===this.parameters.renderOccluded],[3,e=>B(e)],[10,e=>U(e)&&8===this.parameters.renderOccluded],[11,e=>U(e)&&8===this.parameters.renderOccluded],[4,e=>F(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>F(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>N(e)]]),this._configuration=new te(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ce(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&pe(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=re||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>re}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],m=(l/2+Ue)*r;let h=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=le(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<h&&(h=b,u=g/3)}h<m*m&&a(n.distance,n.normal,u)}intersectRay(t,r,i,s,a,d){const{options:g,camera:b,rayBegin:S,rayEnd:_}=i;if(!g.selectionMode||!t.visible||!b)return;if(!X(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const v=t.attributes,y=v.get("position").data,P=this._getLineSize(v),z=_e;n(z,i.point);const j=P*b.pixelRatio,T=Ue*b.pixelRatio,R=j/2+T;o(Re[0],z[0]-R,z[1]+R,0),o(Re[1],z[0]+R,z[1]+R,0),o(Re[2],z[0]+R,z[1]-R,0),o(Re[3],z[0]-R,z[1]-R,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(Re[e],Ce[e]))return;L(b.eye,Ce[0],Ce[1],Oe),L(b.eye,Ce[1],Ce[2],Ve),L(b.eye,Ce[2],Ce[3],Fe),L(b.eye,Ce[3],Ce[0],Be);let C=Number.MAX_VALUE,O=0;for(const e of this._forEachTransformedLineSegment(he,ue,y,r,le(this.parameters,v))){if(A(Oe,he)<0&&A(Oe,ue)<0||A(Ve,he)<0&&A(Ve,ue)<0||A(Fe,he)<0&&A(Fe,ue)<0||A(Be,he)<0&&A(Be,ue)<0)continue;const t=b.projectToRenderScreen(he,ve),r=b.projectToRenderScreen(ue,ye);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){l(be,he,ue);const e=b.frustum,r=-A(e[4],he)/p(be,M(e[4]));if(c(be,be,r),m(he,he,be),!b.projectToRenderScreen(he,t))continue}else if(t[2]>0&&r[2]<0){l(be,ue,he);const e=b.frustum,t=-A(e[4],ue)/p(be,M(e[4]));if(c(be,be,t),m(ue,ue,be),!b.projectToRenderScreen(ue,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=E(t,r,ze),s=x(i,z);if(!(s>=C)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,he,ue,z,b,P,T);if(s>=e*e)continue}C=s,h(xe,he),h(we,ue),O=e}}if(C<R*R){let e=Number.MAX_VALUE;if(w(E(xe,we,ze),E(S,_,je),Se)){l(Se,Se,S);const t=u(Se);c(Se,Se,1/t),e=t/f(S,_)}d(e,Se,O)}}intersectScreenPolygon(t,r,i,s){const{options:a,camera:n,screenPolygonPrimitiveProcessor:o}=i;if(!a.selectionMode||!t.visible)return null;if(!X(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,p=l.get("position").data,c=this._getLineSize(l),m=Ue,h=m*n.pixelRatio,u=new J;for(const e of this._forEachTransformedLineSegment(he,ue,p,r,le(this.parameters,l)))for(const[t,r]of o.processLineSegment(Ne,he,ue)){if(!D(n,t,r,ve,ye))continue;const i=E(ve,ye,ze);let a=c/2+m;this.parameters.screenSizePerspective&&(d(_e,ve,ye,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(i,t,r,_e,n,c,h)/n.pixelRatio)),n.renderToScreen(ve,Pe),n.renderToScreen(ye,Ee),Y(s,Pe,Ee,a)&&(z(E(t,r,je),n.eye,fe),u.updateIfCloserFromValues(f(n.eye,fe),e,fe,null))}return u}createBufferWriter(){return new ne(Z(this.parameters),$(this.parameters),this.parameters)}createGLMaterial(e){return new se(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:s(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=j(e,i);d(fe,t,r,o),g(de,fe,s.viewMatrix);const l=u(de),p=this.computeCameraAbsCosAngle(fe,s,this._configuration.spherical);me.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return me.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?b(Se,e):o(Se,0,0,1),l(ge,e,t.eye),b(ge,ge),Math.abs(p(Se,ge))}_getLineSize(e,r=!1){let i=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?r&&(i*=this.parameters.vvSize.fallback[0]):i*=t(this.parameters.vvSize.offset[0]+s*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has("size")&&(i*=e.get("size").data[0]);return i}*_forEachTransformedLineSegment(e,t,r,i,s){const a=s?r.length-2:r.length-5;for(let n=0;n<a;n+=3){e[0]=r[n]+i[12],e[1]=r[n+1]+i[13],e[2]=r[n+2]+i[14];const s=(n+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield n/3}}}class se extends k{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(ee,e)}}class ae extends K{constructor(){super(...arguments),this._width=0,this.color=v,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return H(this.stipplePattern)&&null!=this.stippleTexture}}class ne{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ce(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return le(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+2}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:n,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),u=m.indices,d=m.data.length/3,b=d+2,S=r.get("distanceToStart")?.data;u&&u.length!==2*(d-1)&&console.warn("RibbonLineMaterial does not support indices");const v=n.getField("textureElementIndex",C);G(null!=v,"Missing texture buffer index field"),G(null!==a,"Expected texture buffer target"),G(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;G(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;G(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,z=w.getField("position",O);G(null!==z,"Expected valid position field in texture buffer");const j=p.fields.has("sizeFeatureAttribute");let T=1,L=null;if(j){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:L=e.data}else T=r.get("size")?.data[0]??1;let A=[1,1,1,1],M=0,R=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?M=e.data[0]:R=e.data}else A=r.get("color")?.data??A;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),U=p.fields.has("opacityFeatureAttribute");let N=0,k=null;if(U){const e=r.get("opacityFeatureAttribute");1===e.data.length?N=e.data[0]:k=e.data}const W=new Float32Array(n.buffer),D=P(n.buffer),Y=new Uint8Array(n.buffer),J=new Uint32Array(n.buffer),q=p.stride/4;let X=l*q;const H=X;let K=0;const Q=W.BYTES_PER_ELEMENT/D.BYTES_PER_ELEMENT,Z=I(),$=this._isClosed(r),ee=(t,r)=>{const i=3*r;o(t,m.data[i+0],m.data[i+1],m.data[i+2]),e&&g(t,t,e)};for(let o=0;o<d;++o)ee(Le,o),z.setVec(E+o+1,Le);$?(w.copyItem(E+b-2,E+0),w.copyItem(E+1,E+b-1)):(w.copyItem(E+1,E+0),w.copyItem(E+b-2,E+b-1));const te=(e,t,r,s,a,n,o,l)=>{const p=o+1;J[X]=x+p,X++,W[X++]=l;let c=X*Q;if(D[c++]=a,D[c++]=n,X=Math.ceil(c/Q),V)W[X]=R?.[o]??M;else{const e=Math.min(4*o,A.length-4),t=4*X;Y[t]=255*A[e],Y[t+1]=255*A[e+1],Y[t+2]=255*A[e+2],Y[t+3]=255*A[e+3]}if(X++,W[X++]=L?.[o]??T,U&&(W[X++]=k?.[o]??N),Z){let e=4*X;i?(Y[e++]=i[0],Y[e++]=i[1],Y[e++]=i[2],Y[e++]=i[3]):(Y[e++]=0,Y[e++]=0,Y[e++]=0,Y[e++]=0),X=Math.ceil(.25*e)}B&&(c=X*Q,D[c++]=s[0],D[c++]=s[1],D[c++]=s[2],D[c++]=s[3],X=Math.ceil(c/Q))},re=()=>{h(Te,Le),h(Le,Ae)},ie=e=>{if(B){const t=4*e;_(Me,F[t+0],F[t+1],F[t+2],F[t+3])}},se=(e,t,r)=>{null!=S?K=S[r]:K+=f(e,t)};X+=q,ee(Le,0),ie(0);let ae=0,ne=0;$?(ee(Te,d-1),ae=0,ne=d):(ee(Ae,1),te(Le,Le,Ae,Me,1,-4,0,0),te(Le,Le,Ae,Me,1,4,0,0),re(),ie(1),ae=1,ne=d-1);for(let o=ae;o<ne;o++){ee(Ae,(o+1)%d),se(Te,Le,o),te(Te,Le,Ae,Me,0,-1,o,K),te(Te,Le,Ae,Me,0,1,o,K);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);te(Te,Le,Ae,Me,r,-1,o,K),te(Te,Le,Ae,Me,r,1,o,K)}te(Te,Le,Ae,Me,1,-2,o,K),te(Te,Le,Ae,Me,1,2,o,K),re(),ie((o+1)%d)}se(Te,Le,ne),$?(ee(Ae,1),te(Te,Le,Ae,Me,0,-1,ae,K),te(Te,Le,Ae,Me,0,1,ae,K)):(te(Te,Le,Le,Me,0,-5,ne,K),te(Te,Le,Le,Me,0,5,ne,K)),oe(W,H+q,W,H,q);X=oe(W,X-q,W,X,q),this._parameters.wireframe&&this._addWireframeVertices(n,H,X,q)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=oe(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function oe(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function le(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function pe(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ce(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return Q+r}}const me=new q,he=S(),ue=S(),fe=S(),de=S(),ge=S(),be=S(),Se=S(),_e=S(),ve=r(),ye=r(),Pe=i(),Ee=i(),xe=S(),we=S(),ze=T(),je=T(),Te=S(),Le=S(),Ae=S(),Me=y(),Re=[r(),r(),r(),r()],Ce=[S(),S(),S(),S()],Oe=R(),Ve=R(),Fe=R(),Be=R(),Ue=4,Ne=[S(),S()];export{ae as Parameters,ie as RibbonLineMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as r}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function o(r){const o=e().u32("textureElementIndex",{integer:!0}).
|
|
2
|
+
import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as r}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function o(r){const o=e().u32("textureElementIndex",{integer:!0}).f32("u0").vec2f16("lineParameters");return r.hasVVColor?o.f32("colorFeatureAttribute"):o.vec4u8("color",{glNormalized:!0}),r.hasVVSize?o.f32("sizeFeatureAttribute"):o.f32("size"),r.hasVVOpacity&&o.f32("opacityFeatureAttribute"),t()&&o.vec4u8("olidColor"),r.hasAnimation&&o.vec4f16("timeStamps"),o}const i=new r([{type:"vec3f32",name:"position"}]);function u(e){return i}export{i as baseTextureBufferLayout,o as getLayout,u as getTextureBufferLayout};
|
package/views/View2D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{isScreenPoint as p,screenRectToPolygon as h,createScreenPoint as g}from"../core/screenUtils.js";import{property as d,cast as u,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import{initialize as y}from"../core/workers/workers.js";import f from"../geometry/Point.js";import w from"../geometry/Polygon.js";import{isLoadedOrLoadFor as V}from"../geometry/projectionUtils.js";import v from"../layers/support/TileInfo.js";import{BreakpointsOwner as M}from"./BreakpointsOwner.js";import{DOMContainer as _}from"./DOMContainer.js";import{PopupView as b}from"./PopupView.js";import S from"./View.js";import{Viewport2DBaseMixin as R}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import T from"./2d/AnimationManager.js";import{layerView2DImporter as O}from"./2d/layerViewModuleImportUtils.js";import k from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as C}from"./2d/analysis/analysisViewModuleImportUtils.js";import x from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{hitTest as P,getHitTestLayerViews as z}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as A,takeScreenshot as E}from"./2d/support/screenshotUtils.js";import{Timeline as I}from"./2d/support/Timeline.js";import U from"./navigation/Navigation.js";import G from"./navigation/NavigationActionMap.js";import F from"./support/AnalysisViewManager.js";import q from"./ui/DefaultUI.js";import W from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as N}from"./webgl/RenderingContextOptions.js";import{isWebMap as B}from"../webmap/utils.js";import H from"../webmap/background/ColorBackground.js";let Z,K,Q,J,X,Y;async function $(){const[,{GraphicsView2D:e,GraphicContainer:t,MapViewNavigation:i,MagnifierView2D:r,GridView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);K=e,Q=t,J=i,X=r,Y=s,Z=a}let ee=class extends(j(R(M(b(_(S)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.navigation=new U({actionMap:new G({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analysisViewManager=new F({importAnalysisViewModule:e=>C(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new I,this.type="2d",this.view2dType=null,this.ui=new W,this.test={takeScreenshot:async e=>A(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},y()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new x(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return V(t.spatialReference,i)}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get background(){return B(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get extent(){return super.extent}set extent(e){super.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){if(this.destroying||this.destroyed)return!1;const{analysisViewManager:e,allLayerViews:t,frameTask:i,graphicsView:r,inputManager:s,layerViewManager:a,magnifier:n,map:o,ready:l,rendering:p,selectionManager:h,stationary:g,toolViewManager:d,updatingHandles:u,stage:c}=this,m=o?.basemap,y=o?.ground,f="loading"===m?.loadStatus||"loading"===y?.loadStatus||!!o?.allLayers?.some(e=>e.parent!==y&&!e.isFulfilled()),w=!c||c.updating,V=!u||u.updating,v=!e||e.updating,M=!d||d.updating,_=!s||s.updating,b=!r||r.updating,S=!i||i.updating,R=!a||a.updating,j=!h||h.updating,T=!(!n.visible||null===n.position||!this._magnifierView?.updatingHandles.updating),O=t.some(e=>e.updating&&!e.destroyed&&!("layerViews"in e));return!l||!g||p||f||O||T||V||v||S||M||_||R||b||j||w}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new w({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return P(this,e,t)}async takeScreenshot(e){return E(this._getScreenshotView(e),e)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}zoomIn(){return super.zoomIn()}zoomOut(){return super.zoomOut()}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return B(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return B(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return O.hasLayerViewModule(e)}importLayerView(e){return O.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=p(e)?this.toMap(e):h(this,e),i=p(e)?e:g(e.x+e.width/2,e.y+e.height/2),r=this.toMap(i),s=await this.hitTest(e),a=z(this,e,r),n=new globalThis.Map(a.map(e=>[e.layer.uid,e])),o=[];let l=0,d=0;for(;l<s.results.length||d<a.length;){const e=s.results.at(l);if(e&&"graphic"!==e.type){++l;continue}const i=n.get((e?.layer??e?.graphic.layer)?.uid);if((!e||i)&&d<a.length&&a.at(d)!==i){const e=a.at(d);"fetchPopupFeaturesAtTarget"in e&&o.push({geometry:t,layerView:e}),++d}else e&&(o.push({graphic:e.graphic,layerView:i}),++l)}return{hits:o,location:r}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}loadAsyncDependencies(){return $()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&L(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=this._createFeaturesTilingScheme(),i=new Z(this._getOrCreateRenderCanvas(),{contextOptions:new N(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),featuresTilingScheme:t,renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=i,this._magnifierView=new X,this._magnifierView.magnifier=this.magnifier,this._gridView=new Y;const r=new T({view:this});this._set("animationManager",r);const s=new J({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(t),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>this.stage.animationsEnabled=e,l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(e=this._createFeaturesTilingScheme()){this._set("featuresTilingScheme",e),this.stage.labelManager.featuresTilingScheme=e;const t=new K({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new Q(e,!0)});this._set("graphicsView",t)}_createFeaturesTilingScheme(){return new k(v.create({spatialReference:this.spatialReference,size:512,numLODs:36}))}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([d()],ee.prototype,"_magnifierView",void 0),e([d()],ee.prototype,"_gridView",void 0),e([d({constructOnly:!0})],ee.prototype,"deactivatedWebGLExtensions",void 0),e([d({constructOnly:!0})],ee.prototype,"debugWebGLExtensions",void 0),e([d({readOnly:!0})],ee.prototype,"featuresTilingScheme",void 0),e([d({readOnly:!0})],ee.prototype,"graphicsTileStore",null),e([d()],ee.prototype,"graphicsView",void 0),e([d()],ee.prototype,"constraintsInfo",null),e([d()],ee.prototype,"initialExtentRequired",null),e([d({type:U,nonNullable:!0})],ee.prototype,"navigation",void 0),e([d()],ee.prototype,"renderingOptions",void 0),e([d({constructOnly:!0})],ee.prototype,"supersampleScreenshotsEnabled",void 0),e([d()],ee.prototype,"defaultsFromMapSettings",null),e([d({readOnly:!0})],ee.prototype,"typeSpecificPreconditionsReady",null),e([d()],ee.prototype,"analysisViewManager",void 0),e([d({type:H})],ee.prototype,"background",null),e([d({type:f})],ee.prototype,"center",null),e([d({type:i})],ee.prototype,"floors",void 0),e([d()],ee.prototype,"grid",void 0),e([d()],ee.prototype,"map",void 0),e([d()],ee.prototype,"padding",null),e([d({readOnly:!0})],ee.prototype,"rendering",null),e([d({readOnly:!0})],ee.prototype,"resolution",null),e([d()],ee.prototype,"scale",null),e([d({type:Boolean,value:!1})],ee.prototype,"spatialReferenceLocked",null),e([d({readOnly:!0})],ee.prototype,"tileInfo",null),e([d({type:I,readOnly:!0})],ee.prototype,"timeline",void 0),e([d({readOnly:!0})],ee.prototype,"type",void 0),e([d({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([d({readOnly:!0})],ee.prototype,"view2dType",void 0),e([d({readOnly:!0})],ee.prototype,"visibleArea",null),e([d()],ee.prototype,"zoom",null),e([d({readOnly:!0})],ee.prototype,"navigating",null),e([d(),u(e=>e instanceof q?e:m(W,e))],ee.prototype,"ui",void 0),ee=e([c("esri.views.View2D")],ee);const te=ee;export{te as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{isScreenPoint as p,screenRectToPolygon as h,createScreenPoint as g}from"../core/screenUtils.js";import{property as d,cast as u,subclass as c}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import{initialize as y}from"../core/workers/workers.js";import f from"../geometry/Point.js";import w from"../geometry/Polygon.js";import{isLoadedOrLoadFor as V}from"../geometry/projectionUtils.js";import v from"../layers/support/TileInfo.js";import{BreakpointsOwner as M}from"./BreakpointsOwner.js";import{DOMContainer as _}from"./DOMContainer.js";import{PopupView as b}from"./PopupView.js";import S from"./View.js";import{Viewport2DBaseMixin as R}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import T from"./2d/AnimationManager.js";import{layerView2DImporter as O}from"./2d/layerViewModuleImportUtils.js";import k from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as C}from"./2d/analysis/analysisViewModuleImportUtils.js";import x from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{hitTest as P,getHitTestLayerViews as z}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as A,takeScreenshot as E}from"./2d/support/screenshotUtils.js";import{Timeline as I}from"./2d/support/Timeline.js";import U from"./navigation/Navigation.js";import G from"./navigation/NavigationActionMap.js";import F from"./support/AnalysisViewManager.js";import q from"./ui/DefaultUI.js";import W from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as N}from"./webgl/RenderingContextOptions.js";import{isWebMap as B}from"../webmap/utils.js";import H from"../webmap/background/ColorBackground.js";let Z,K,Q,J,X,Y;async function $(){const[,{GraphicsView2D:e,GraphicContainer:t,MapViewNavigation:i,MagnifierView2D:r,GridView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);K=e,Q=t,J=i,X=r,Y=s,Z=a}let ee=class extends(j(R(M(b(_(S)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.navigation=new U({actionMap:new G({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analysisViewManager=new F({importAnalysisViewModule:e=>C(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new I,this.type="2d",this.view2dType=null,this.ui=new W,this.test={takeScreenshot:async e=>A(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},y()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new x(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return V(t.spatialReference,i)}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get background(){return B(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get extent(){return super.extent}set extent(e){super.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){if(this.destroying||this.destroyed)return!1;const{analysisViewManager:e,allLayerViews:t,frameTask:i,graphicsView:r,inputManager:s,layerViewManager:a,magnifier:n,map:o,ready:l,rendering:p,selectionManager:h,stationary:g,toolViewManager:d,updatingHandles:u,stage:c}=this,m=o?.basemap,y=o?.ground,f="loading"===m?.loadStatus||"loading"===y?.loadStatus||!!o?.allLayers?.some(e=>e.parent!==y&&!e.isFulfilled()),w=!c||c.updating,V=!u||u.updating,v=!e||e.updating,M=!d||d.updating,_=!s||s.updating,b=!r||r.updating,S=!i||i.updating,R=!a||a.updating,j=!h||h.updating,T=!(!n.visible||null===n.position||!this._magnifierView?.updatingHandles.updating),O=t.some(e=>e.updating&&!e.destroyed);return!l||!g||p||f||O||T||V||v||S||M||_||R||b||j||w}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new w({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return P(this,e,t)}async takeScreenshot(e){return E(this._getScreenshotView(e),e)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}zoomIn(){return super.zoomIn()}zoomOut(){return super.zoomOut()}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return B(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return B(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return O.hasLayerViewModule(e)}importLayerView(e){return O.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=p(e)?this.toMap(e):h(this,e),i=p(e)?e:g(e.x+e.width/2,e.y+e.height/2),r=this.toMap(i),s=await this.hitTest(e),a=z(this,e,r),n=new globalThis.Map(a.map(e=>[e.layer.uid,e])),o=[];let l=0,d=0;for(;l<s.results.length||d<a.length;){const e=s.results.at(l);if(e&&"graphic"!==e.type){++l;continue}const i=n.get((e?.layer??e?.graphic.layer)?.uid);if((!e||i)&&d<a.length&&a.at(d)!==i){const e=a.at(d);"fetchPopupFeaturesAtTarget"in e&&o.push({geometry:t,layerView:e}),++d}else e&&(o.push({graphic:e.graphic,layerView:i}),++l)}return{hits:o,location:r}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}loadAsyncDependencies(){return $()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&L(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=this._createFeaturesTilingScheme(),i=new Z(this._getOrCreateRenderCanvas(),{contextOptions:new N(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),featuresTilingScheme:t,renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=i,this._magnifierView=new X,this._magnifierView.magnifier=this.magnifier,this._gridView=new Y;const r=new T({view:this});this._set("animationManager",r);const s=new J({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(t),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>this.stage.animationsEnabled=e,l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(e=this._createFeaturesTilingScheme()){this._set("featuresTilingScheme",e),this.stage.labelManager.featuresTilingScheme=e;const t=new K({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new Q(e,!0)});this._set("graphicsView",t)}_createFeaturesTilingScheme(){return new k(v.create({spatialReference:this.spatialReference,size:512,numLODs:36}))}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([d()],ee.prototype,"_magnifierView",void 0),e([d()],ee.prototype,"_gridView",void 0),e([d({constructOnly:!0})],ee.prototype,"deactivatedWebGLExtensions",void 0),e([d({constructOnly:!0})],ee.prototype,"debugWebGLExtensions",void 0),e([d({readOnly:!0})],ee.prototype,"featuresTilingScheme",void 0),e([d({readOnly:!0})],ee.prototype,"graphicsTileStore",null),e([d()],ee.prototype,"graphicsView",void 0),e([d()],ee.prototype,"constraintsInfo",null),e([d()],ee.prototype,"initialExtentRequired",null),e([d({type:U,nonNullable:!0})],ee.prototype,"navigation",void 0),e([d()],ee.prototype,"renderingOptions",void 0),e([d({constructOnly:!0})],ee.prototype,"supersampleScreenshotsEnabled",void 0),e([d()],ee.prototype,"defaultsFromMapSettings",null),e([d({readOnly:!0})],ee.prototype,"typeSpecificPreconditionsReady",null),e([d()],ee.prototype,"analysisViewManager",void 0),e([d({type:H})],ee.prototype,"background",null),e([d({type:f})],ee.prototype,"center",null),e([d({type:i})],ee.prototype,"floors",void 0),e([d()],ee.prototype,"grid",void 0),e([d()],ee.prototype,"map",void 0),e([d()],ee.prototype,"padding",null),e([d({readOnly:!0})],ee.prototype,"rendering",null),e([d({readOnly:!0})],ee.prototype,"resolution",null),e([d()],ee.prototype,"scale",null),e([d({type:Boolean,value:!1})],ee.prototype,"spatialReferenceLocked",null),e([d({readOnly:!0})],ee.prototype,"tileInfo",null),e([d({type:I,readOnly:!0})],ee.prototype,"timeline",void 0),e([d({readOnly:!0})],ee.prototype,"type",void 0),e([d({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([d({readOnly:!0})],ee.prototype,"view2dType",void 0),e([d({readOnly:!0})],ee.prototype,"visibleArea",null),e([d()],ee.prototype,"zoom",null),e([d({readOnly:!0})],ee.prototype,"navigating",null),e([d(),u(e=>e instanceof q?e:m(W,e))],ee.prototype,"ui",void 0),ee=e([c("esri.views.View2D")],ee);const te=ee;export{te as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{zeroSquareMeters as t,toUnit as e,createScalar as a,zeroMeters as n,zeroDegrees as r,createAngle as i,createLength as o,createArea as s}from"../../../../core/quantity.js";import{makeQuantityParser as u,
|
|
2
|
+
import{zeroSquareMeters as t,toUnit as e,createScalar as a,zeroMeters as n,zeroDegrees as r,createAngle as i,createLength as o,createArea as s}from"../../../../core/quantity.js";import{makeQuantityParser as u,formatLongitudeDecimalDegreesForInputMode as f,makeCoordinateExpressionParser as c,formatLatitudeDecimalDegreesForInputMode as l,sanitizeAngle as m,parseLongitude as p,parseLatitude as g}from"./parsingAndFormattingUtils.js";import{TooltipField as d}from"./TooltipField.js";import{TooltipFieldElevation as h}from"./TooltipFieldElevation.js";import{TooltipFieldOrientation as b}from"./TooltipFieldOrientation.js";import{TooltipFieldSize as I}from"./TooltipFieldSize.js";import{getNormalizedDirection as v}from"../../../support/angularMeasurementUtils.js";function y(t){const a=t=>t.inputUnitInfos.angle.unit,n=t=>t.sketchOptions.values.effectiveDirectionMode;return new d({name:"direction",actual:r,parse:u({createQuantity:(t,e)=>i(t,a(e),"geographic"),sanitize:m}),format:(t,e)=>{const a=n(e),r=v(t,a);switch(a){case"absolute":return e.formatters.direction(r);case"relative":return e.formatters.directionRelative(r);case"relative-bilateral":return e.formatters.directionRelativeBilateral(r)}},formatForInputMode:(t,r)=>{const i=v(t,n(r));return r.formatters.scalar(e(i,a(r)))},suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>{const e=n(t),{absolute:a,relative:r}=t.messages.sketch.direction;switch(e){case"absolute":return a;case"relative":case"relative-bilateral":return r}},...t})}function U(t){const a=t=>t.inputUnitInfos.length.unit;return new d({name:t?.name??"distance",actual:n,parse:u({createQuantity:(t,e)=>o(Math.max(t,0),a(e))}),format:(t,e)=>e.formatters.length(t),formatForInputMode:(t,n)=>n.formatters.scalar(e(t,a(n))),suffix:t=>t.inputUnitInfos.length.abbreviation,title:t=>t.messages.sketch.distance,...t})}function w(t){const a=t=>t.inputUnitInfos.length.unit;return new d({name:t?.name??"radius",actual:n,parse:u({createQuantity:(t,e)=>o(Math.max(t,0),a(e))}),format:(t,e)=>e.formatters.length(t),formatForInputMode:(t,n)=>n.formatters.scalar(e(t,a(n))),suffix:t=>t.inputUnitInfos.length.abbreviation,title:t=>t.messages.sketch.radius,...t})}function x(t){return U({format:(t,e)=>e.formatters.totalLength(t),title:t=>t.messages.sketch.totalLength,readOnly:!0,...t})}function F(t){return U({...t})}function M(t){const e=t=>t.inputUnitInfos.length.unit;return U({...t,parse:u({createQuantity:(t,a)=>o(t,e(a))}),format:(t,e)=>e.formatters.lengthRelative(t)})}function k(t){return new h(t)}function j(t){return new b(t)}function Q(t){return new I(t)}function D(t){return A("scale",{name:"scale",actual:null,parse:u({createQuantity:t=>a(Math.abs(t))}),...t})}function O(a){const n=t=>t.inputUnitInfos.area.unit;return new d({name:"area",actual:t,parse:u({createQuantity:(t,e)=>s(t,n(e))}),format:(t,e)=>e.formatters.area(t),formatForInputMode:(t,a)=>a.formatters.scalar(e(t,n(a))),suffix:t=>t.inputUnitInfos.area.abbreviation,title:t=>t.messages.sketch.area,readOnly:!0,...a})}function T(t){return new d({name:"x",actual:r,parse:c(p),format:(t,e)=>e.formatters.longitudeDecimalDegrees(t),formatForInputMode:t=>f(t),suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>t.messages.sketch.longitude,...t})}function R(t){return new d({name:"y",actual:r,parse:c(g),format:(t,e)=>e.formatters.latitudeDecimalDegrees(t),formatForInputMode:t=>l(t),suffix:t=>t.inputUnitInfos.angle.abbreviation,title:t=>t.messages.sketch.latitude,...t})}function z(t){return A("x",{name:"x",...t})}function L(t){return A("y",{name:"y",...t})}function q(t){return new d({actual:a(0),parse:u({createQuantity:t=>a(t)}),format:(t,e)=>e.formatters.scalar(t),formatForInputMode:(t,e)=>e.formatters.scalar(t),title:t=>t.messages.sketch.scale,...t})}function A(t,e){return q({title:e=>e.messages.sketch[t],...e})}export{O as makeAreaField,y as makeDirectionField,F as makeDistanceField,k as makeElevationField,R as makeLatitudeField,U as makeLengthField,T as makeLongitudeField,j as makeOrientationField,w as makeRadiusField,M as makeRelativeDistanceField,q as makeScalarField,D as makeScaleField,Q as makeSizeField,x as makeTotalLengthField,z as makeXField,L as makeYField};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{Cyclical as
|
|
2
|
+
import{Cyclical as n}from"../../../../core/Cyclical.js";import{createAngle as e,createScalar as t,toUnit as r}from"../../../../core/quantity.js";import{formatRelativeVerticalLength as i,formatVerticalLength as u,formatLength as a,formatRelativeLength as l,formatArea as o,formatAngle as c}from"../../../../core/quantityFormatUtils.js";import{isLoaded as s,fromLatitudeLongitude as f,fromLongitude as p,fromLatitude as m}from"../../../../geometry/coordinateFormatter.js";import{parseNumber as g,formatNumber as d}from"../../../../intl/number.js";import{getDegreesGeographic as h}from"../../../support/angularMeasurementUtils.js";const y=1,v=6,D=/^\s*(.+?)\s*([+\-*/])\s*(.+)\s*$/;function x(n,e){return{angleRelative:z,direction:$,directionRelative:j,directionRelativeBilateral:F,latitudeDecimalDegrees:R,longitudeDecimalDegrees:O,area:(t,r)=>o(n,t,r??e.area),length:(t,r,i)=>a(n,t,r??e.length,i),lengthRelative:(t,r)=>l(n,t,r??e.length),totalLength:(t,r)=>a(n,t,r??e.length),verticalLength:(t,r)=>u(n,t,r??e.verticalLength),verticalLengthRelative:(t,r)=>i(n,t,r??e.verticalLength),percentage:Q,scalar:P,scale:k}}function z(n){return d(n,{signDisplay:"exceptZero",...V(y)})}function $(n){return c(n,n.rotationType,y)}function j(n){const e=h(n);return d(e,{style:"unit",unitDisplay:"narrow",unit:"degree",signDisplay:e>0?"never":"exceptZero",...V(y)})}function F(n){return c(n,n.rotationType,y)}function O(n){return L(n,S)}function R(n){return L(n,W)}function b(n){return A(n,S)}function w(n){return A(n,W)}function L(n,e){const t=!1,i="geographic";return c(r(n,"degrees"),i,v,e,t)}function A(n,e){const i=!1,u=e.normalize(r(n,"degrees").value,void 0,i);return P(t(u),v)}function Q(n){return d(n.value,{style:"percent"})}function k(n){return d(n,{style:"percent",maximumFractionDigits:0})}function P(n,e){return d(n.value,V(e))}function V(n){return{minimumFractionDigits:n,maximumFractionDigits:n}}function q(n,{parseOperand:e=g,sanitizeOperand:t}={}){const r=n.match(D);if(!r)return null;let[,i,u,a]=r;t&&(i=t(i),a=t(a));const l=e(i),o=e(a);if(null==l||null==o)return null;let c;switch(u){case"+":c=l+o;break;case"-":c=l-o;break;case"*":c=l*o;break;case"/":c=l/o}return Number.isFinite(c)?c:null}function T({createQuantity:n,parsePlainValue:e,sanitizeOperand:t}){return(r,i)=>{if(null==r)return null;const u=q(r,{sanitizeOperand:t});return null==u?e(r,i):n(u,i)}}function U({createQuantity:n,sanitize:e}){return T({createQuantity:n,parsePlainValue:(t,r)=>{e&&(t=e(t));const i=g(t);return null==i?null:n(i,r)},sanitizeOperand:e})}function Z(n){return T({createQuantity:n=>K(n),parsePlainValue:e=>n(e),sanitizeOperand:B})}function B(n){return n.replaceAll(/[*^~°º]/g,"")}const C=n=>{let e=`[-+]?[0-9${n.thousands}]+`;return""!==n.decimal&&(e+=`${n.decimal}[0-9]+`),new RegExp(`^(${e}\\s*)${n.separator}(\\s*${e})$`,"i")},E=" ",I=[];for(const X of[",","\\|","\\s+"])for(const n of["\\.",",",""])for(const e of["",",","\\.",E,"\\s+"])X!==n&&X!==e&&n!==e&&I.push({separator:X,decimal:n,thousands:e,pattern:C({decimal:n,thousands:e,separator:X})});function M(n){for(const{decimal:e,thousands:r,pattern:i}of I){i.lastIndex=0;const u=n.match(i);if(!u)continue;const a=g(N(u[1],e,r)),l=g(N(u[2],e,r));if(null!=a&&null!=l)return{x:t(a),y:t(l)}}return null}function N(n,e,t){let r=n.replaceAll(/[\s+]/g,"");return""!==t&&(r=r.replaceAll(t,"")),""!==e&&(r=r.replaceAll(e,".")),r}function G(n){if(!n||null!=g(n)||!s())return null;const e=f(n),t=K(e?.latitude),r=K(e?.longitude);return null!=r&&null!=t?{latitude:t,longitude:r}:null}function H(n){return K(p(n))}function J(n){return K(m(n))}function K(n){return null!=n?e(n,"degrees","geographic"):null}const S=new n(-180,180),W=new n(-90,90);export{N as cleanNumber,K as createGeographicCoordinate,w as formatLatitudeDecimalDegreesForInputMode,b as formatLongitudeDecimalDegreesForInputMode,x as getFormatters,Z as makeCoordinateExpressionParser,U as makeQuantityParser,J as parseLatitude,G as parseLatitudeLongitude,H as parseLongitude,q as parseSimpleNumericExpression,M as parseXY,B as sanitizeAngle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import r from"../../core/Collection.js";import{handlesGroup as t,makeHandle as i}from"../../core/handleUtils.js";import s from"../../core/Logger.js";import{debounce as a,ignoreAbortErrors as o}from"../../core/promiseUtils.js";import{sqlAnd as n,sqlNotIn as d}from"../../core/sql.js";import{property as l,subclass as p}from"../../core/accessorSupport/decorators.js";import y from"./LayerView.js";const u=Symbol();let m=class extends y{constructor(){super(...arguments),this.layerViews=new r,this._debouncedUpdate=a(async()=>{const{layer:e,parent:r}=this,t=r?.footprintLayerView;let i=[];const s=this._createQuery();if(s&&t){const{features:r}=await t.queryFeatures(s);this.suspended||(i=r.map(r=>e.acquireLayer(r)))}this.removeHandles(u),this.addHandles(i,u)})}get creatingLayerViews(){return this.view?.layerViewManager.isCreatingLayerViewsForLayer(this.layer)??!1}
|
|
2
|
+
import{__decorate as e}from"tslib";import r from"../../core/Collection.js";import{handlesGroup as t,makeHandle as i}from"../../core/handleUtils.js";import s from"../../core/Logger.js";import{debounce as a,ignoreAbortErrors as o}from"../../core/promiseUtils.js";import{sqlAnd as n,sqlNotIn as d}from"../../core/sql.js";import{property as l,subclass as p}from"../../core/accessorSupport/decorators.js";import y from"./LayerView.js";const u=Symbol();let m=class extends y{constructor(){super(...arguments),this.layerViews=new r,this._debouncedUpdate=a(async()=>{const{layer:e,parent:r}=this,t=r?.footprintLayerView;let i=[];const s=this._createQuery();if(s&&t){const{features:r}=await t.queryFeatures(s);this.suspended||(i=r.map(r=>e.acquireLayer(r)))}this.removeHandles(u),this.addHandles(i,u)})}get creatingLayerViews(){return this.view?.layerViewManager.isCreatingLayerViewsForLayer(this.layer)??!1}enableLayerUpdates(){return t([this._updatingHandles.addWhen(()=>!1===this.parent?.footprintLayerView?.dataUpdating,()=>this.updateLayers()),this._updatingHandles.add(()=>[this.layer.maximumVisibleSublayers,this.layer.parent?.orderBy,this.parent?.footprintLayerView?.filter,this.parent?.footprintLayerView?.timeExtent,this.suspended],()=>this.updateLayers()),i(()=>this.removeHandles(u))])}updateLayers(){this.suspended?this.removeHandles(u):this._updatingHandles.consumePromise(o(this._debouncedUpdate()).catch(e=>{s.getLogger(this).error(e)}))}isUpdating(){return this.layer.updating||this.creatingLayerViews||this.layerViews.some(e=>e.updating)}_createQuery(){const e=this.parent?.footprintLayerView,r=this.layer?.parent;if(!e||!r||r.destroyed)return null;const{layer:{maximumVisibleSublayers:t},view:{scale:i}}=this;if(!t)return null;const{itemTypeField:s,itemSourceField:a,itemNameField:o,minScaleField:l,maxScaleField:p,objectIdField:y,orderBy:u}=r,m=n(`${l} IS NULL OR ${i} <= ${l} OR ${l} = 0`,`${p} IS NULL OR ${i} >= ${p}`),h=u?.find(e=>e.field&&!e.valueExpression),c=e.createQuery();return c.returnGeometry=!1,c.num=t,c.outFields=[y,a,o],c.where=n(c.where,m),null!=this.unsupportedItemTypes&&(c.where=n(c.where,d(s,this.unsupportedItemTypes))),h?.field&&(c.orderByFields=[`${h.field} ${"descending"===h.order?"DESC":"ASC"}`],c.outFields.push(h.field)),c}};e([l({readOnly:!0})],m.prototype,"creatingLayerViews",null),e([l()],m.prototype,"layer",void 0),e([l()],m.prototype,"layerViews",void 0),e([l({readOnly:!0})],m.prototype,"unsupportedItemTypes",void 0),e([l()],m.prototype,"parent",void 0),m=e([p("esri.views.layers.CatalogDynamicGroupLayerView")],m);export{m as default};
|
|
@@ -68,11 +68,6 @@ export default abstract class ViewshedLayerView extends LayerView {
|
|
|
68
68
|
*
|
|
69
69
|
* Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/#interactive) to `true`.
|
|
70
70
|
*
|
|
71
|
-
* > [!WARNING]
|
|
72
|
-
* >
|
|
73
|
-
* > Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene.
|
|
74
|
-
* > _This behavior is subject to change in a future release._
|
|
75
|
-
*
|
|
76
71
|
* @param options - An object specifying additional options.
|
|
77
72
|
* @returns A promise which resolves when creation is completed successfully or rejected if it is
|
|
78
73
|
* canceled.
|
|
@@ -102,11 +97,6 @@ export default abstract class ViewshedLayerView extends LayerView {
|
|
|
102
97
|
*
|
|
103
98
|
* Calling this method sets [interactive](https://developers.arcgis.com/javascript/latest/references/core/views/layers/ViewshedLayerView/#interactive) to `true`.
|
|
104
99
|
*
|
|
105
|
-
* > [!WARNING]
|
|
106
|
-
* >
|
|
107
|
-
* > Note that when placing viewsheds interactively, the viewshed is created with a 1.5 meter vertical offset from the scene.
|
|
108
|
-
* > _This behavior is subject to change in a future release._
|
|
109
|
-
*
|
|
110
100
|
* @param options - An object specifying additional options.
|
|
111
101
|
* @returns A promise which
|
|
112
102
|
* resolves when the operation is completed successfully or rejected if it is canceled.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as
|
|
2
|
+
import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as m}from"./LayerLayerViewInfo.js";function u(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let g=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(y(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);r?(this._recyclingInfoMap.set(e.layer,e),this._watchUpdatingTracking.consumePromise(r),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{a(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),h)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}isRecyclingLayerViewForLayer(e){return this._recyclingInfoMap.has(e)}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&u(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new m(e,this.view,this.layerViewImporter);this._watchUpdatingTracking.consumePromise(r.promise),r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],g.prototype,"_workPromise",void 0),e([c({readOnly:!0})],g.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],g.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],g.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],g.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],g.prototype,"layerViewFilter",void 0),e([c()],g.prototype,"layerViewImporter",void 0),e([c({readOnly:!0})],g.prototype,"updating",null),e([c({readOnly:!0})],g.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],g.prototype,"view",void 0),g=e([p("esri.views.support.LayerViewManager")],g);const _=g;export{_ as default};
|