@arcgis/core 5.2.0-next.88 → 5.2.0-next.89
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/Graphic.js +1 -1
- package/arcade/Dictionary.js +1 -1
- package/arcade/Pixel.js +1 -1
- package/arcade/Voxel.js +1 -1
- package/arcade/debug.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/stats.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/07613ecf13c38ad58b79.js +1 -0
- package/assets/esri/core/workers/chunks/090ea7a131f8f60203ed.js +1 -0
- package/assets/esri/core/workers/chunks/159b16f47665f94a0305.js +1 -0
- package/assets/esri/core/workers/chunks/15f4f7e34e14e3cf52e6.js +1 -0
- package/assets/esri/core/workers/chunks/1bf967c68d0c795d3fb4.js +1 -0
- package/assets/esri/core/workers/chunks/{304a36e862947fdb05c0.js → 20f6e681ccd8bf884b77.js} +1 -1
- package/assets/esri/core/workers/chunks/23addf8b11938e0c96e9.js +1 -0
- package/assets/esri/core/workers/chunks/30d816bdeea00f6fa1ca.js +1 -0
- package/assets/esri/core/workers/chunks/{b6f67302d0d5d57add66.js → 31a0620a6028e94c7532.js} +2 -2
- package/assets/esri/core/workers/chunks/39b6a5222f45cb8dbc94.js +1 -0
- package/assets/esri/core/workers/chunks/3aceedec9abfb2fdfa18.js +1 -0
- package/assets/esri/core/workers/chunks/3f82410d9f701e7ad8eb.js +1 -0
- package/assets/esri/core/workers/chunks/45858d1c6487f4a98e40.js +1 -0
- package/assets/esri/core/workers/chunks/45c1c90ac6c14657f3ff.js +1 -0
- package/assets/esri/core/workers/chunks/46f8c7ae7fb356c3410d.js +1 -0
- package/assets/esri/core/workers/chunks/486f1a3b7269ce6c3911.js +1 -0
- package/assets/esri/core/workers/chunks/4c7264e3f4156f92d613.js +1 -0
- package/assets/esri/core/workers/chunks/{a7727a2377470d586ff9.js → 51c9bd7c03d780fadebc.js} +1 -1
- package/assets/esri/core/workers/chunks/5bf65dbfd9c7a5ea187d.js +1 -0
- package/assets/esri/core/workers/chunks/607acd9f615f87e14075.js +1 -0
- package/assets/esri/core/workers/chunks/62ee6c247f783acabb74.js +1 -0
- package/assets/esri/core/workers/chunks/680557b8832fbdab7f46.js +1 -0
- package/assets/esri/core/workers/chunks/6b84982dfaf084a61b93.js +1 -0
- package/assets/esri/core/workers/chunks/777f2fdf1f4b9f243893.js +1 -0
- package/assets/esri/core/workers/chunks/{4d4ebb4e4d83c1123b63.js → 7e41cee4a0ae75e1490d.js} +1 -1
- package/assets/esri/core/workers/chunks/86c3d3c7015f1cd55fac.js +1 -0
- package/assets/esri/core/workers/chunks/87e0ceb1a64ab08e679a.js +1 -0
- package/assets/esri/core/workers/chunks/{dceaa6b68eee090073b1.js → 94453d075ce02eff4844.js} +1 -1
- package/assets/esri/core/workers/chunks/a176727a1148ca4fb432.js +1 -0
- package/assets/esri/core/workers/chunks/a6d4132a16c51323a38a.js +1 -0
- package/assets/esri/core/workers/chunks/a7e6382ecc91c876117f.js +1 -0
- package/assets/esri/core/workers/chunks/a88bf8ae93077e1b48cf.js +1 -0
- package/assets/esri/core/workers/chunks/bd1a7e95a797e1ed4a7b.js +1 -0
- package/assets/esri/core/workers/chunks/{70dc25f721c0ac5f3660.js → bdfffa5f88b559a4b42d.js} +1 -1
- package/assets/esri/core/workers/chunks/bf11319138facf44752c.js +1 -0
- package/assets/esri/core/workers/chunks/{0b7860a3f18d252b774a.js → c23943e51734254d31e8.js} +1 -1
- package/assets/esri/core/workers/chunks/c88bfa51d2a8a024fc24.js +1 -0
- package/assets/esri/core/workers/chunks/{fc4a5996fc03f6c32030.js → d58d6b55b2749a535eb3.js} +1 -1
- package/assets/esri/core/workers/chunks/{60f490afdbe299f89669.js → d871572997600930e017.js} +1 -1
- package/assets/esri/core/workers/chunks/e50adcfb392adfb3f79c.js +1 -0
- package/assets/esri/core/workers/chunks/eda04911553cf99fb99b.js +1 -0
- package/assets/esri/core/workers/chunks/f3716ce04d09af31cfb1.js +1 -0
- package/assets/esri/core/workers/chunks/f3e53be08ab9dbdf17ae.js +1 -0
- package/assets/esri/core/workers/chunks/{9eb3e6800f5034f1593f.js → f83c3597e9332bd991eb.js} +1 -1
- package/assets/esri/core/workers/chunks/f8a6d8cdcabcd1d511b6.js +1 -0
- package/chunks/array.js +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/Property.js +1 -1
- package/geometry/operators/support/projectionTransformation.js +1 -1
- package/geometry/support/convexPolyhedron.js +1 -1
- package/geometry/support/frustum.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/data/FlatFeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/views/2d/engine/webgl/util/Fader.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshNormals.js +1 -1
- package/views/3d/layers/i3s/SweptSphereVolume.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/support/sphericalTileUtils.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/LineMaterial.js +2 -0
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/PointMaterial.js +2 -0
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.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/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/popupAdapter.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/FeatureTable/support/types.d.ts +3 -1
- package/assets/esri/core/workers/chunks/0439d4f4dfd6e78be97e.js +0 -1
- package/assets/esri/core/workers/chunks/12a3b55195ce3244259d.js +0 -1
- package/assets/esri/core/workers/chunks/19aa4072764937743bd8.js +0 -1
- package/assets/esri/core/workers/chunks/2724900f7992a79fc442.js +0 -1
- package/assets/esri/core/workers/chunks/35d3e60d15294f268992.js +0 -1
- package/assets/esri/core/workers/chunks/37a2be4380796f14fe4e.js +0 -1
- package/assets/esri/core/workers/chunks/414093fa4957d17bf551.js +0 -1
- package/assets/esri/core/workers/chunks/466bb1b69aabaeabad6a.js +0 -1
- package/assets/esri/core/workers/chunks/47e60b2acec18ef37b6c.js +0 -1
- package/assets/esri/core/workers/chunks/4849849fc8330d05a8e6.js +0 -1
- package/assets/esri/core/workers/chunks/4f0804429d8989aa4c51.js +0 -1
- package/assets/esri/core/workers/chunks/55572cefc752b755cf0a.js +0 -1
- package/assets/esri/core/workers/chunks/59cf23cc8f91b5bea31a.js +0 -1
- package/assets/esri/core/workers/chunks/6a4f007f87d9f2a6fbc4.js +0 -1
- package/assets/esri/core/workers/chunks/7c1f989ee3d13dfe7ebd.js +0 -1
- package/assets/esri/core/workers/chunks/7ce9c84f90e9dd1deb38.js +0 -1
- package/assets/esri/core/workers/chunks/7fc3231768ce79e375ae.js +0 -1
- package/assets/esri/core/workers/chunks/7febb434f2de2436435f.js +0 -1
- package/assets/esri/core/workers/chunks/909a85cb6e0e9a3c8567.js +0 -1
- package/assets/esri/core/workers/chunks/922c24b9bb68f4201b03.js +0 -1
- package/assets/esri/core/workers/chunks/9407db0584c730591161.js +0 -1
- package/assets/esri/core/workers/chunks/a0300fac6a06e7d89a52.js +0 -1
- package/assets/esri/core/workers/chunks/ab9927a32350063cb5f0.js +0 -1
- package/assets/esri/core/workers/chunks/adc2620cbe735532004d.js +0 -1
- package/assets/esri/core/workers/chunks/c4f582dec07895d3bb93.js +0 -1
- package/assets/esri/core/workers/chunks/cd8b3c2fc27c239f9954.js +0 -1
- package/assets/esri/core/workers/chunks/d04a01dc1b4947478264.js +0 -1
- package/assets/esri/core/workers/chunks/d6b87134e0d120c68d2f.js +0 -1
- package/assets/esri/core/workers/chunks/db4c9a9103e979292948.js +0 -1
- package/assets/esri/core/workers/chunks/e32a14770e036fce79d9.js +0 -1
- package/assets/esri/core/workers/chunks/eacf216dcd6397c7bd7f.js +0 -1
- package/assets/esri/core/workers/chunks/eff359210893239ecec3.js +0 -1
- package/assets/esri/core/workers/chunks/f210cd8afb86b6eaf7a2.js +0 -1
- package/assets/esri/core/workers/chunks/f250a7aa571889c5ad4b.js +0 -1
- package/assets/esri/core/workers/chunks/f31330d628d7e741bf5b.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResultRay as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new
|
|
2
|
+
import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{set as d}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as c}from"../../terrain/Intersector.js";import{ChangeSet as l,RenderGeometryUpdate as m}from"./ChangeSet.js";import{IntersectorResultRay as g}from"./IntersectorResult.js";import{RendererBase as p}from"./RendererBase.js";import{noBudget as u}from"../../../support/Scheduler.js";let y=class extends p{constructor(e){super(e),this._pending=new _,this._changes=new l,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get _screenToWorldRatio(){return this.rendererContext.screenToWorldRatio}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,u,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new m;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersectRay(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;if(o){const s=n.boundingSphere.center,a=this._effectiveGeometryRadius(n);s[0]-a<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),s[0]+a>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)}i++}return i}*intersectScreenPolygon(e,r,t,s){for(const i of this._geometries.values()){if(!t(i))continue;this._intersectScreenPolygonRenderGeometry(i,r,0,e,s);const n=this.rendererContext.longitudeCyclical;if(n){const t=i.boundingSphere.center,o=this._effectiveGeometryRadius(i);t[0]-o<n.min&&this._intersectScreenPolygonRenderGeometry(i,r,n.range,e,s),t[0]+o>n.max&&this._intersectScreenPolygonRenderGeometry(i,r,-n.range,e,s)}s++,yield}return s}_effectiveGeometryRadius(e){const r=e.boundingSphere.radius;return r||this._screenToWorldRatio*C}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],G[0]=t[0]-s,G[1]=t[1]-o,e.material.intersectRayDraped(e,i,G,(t,s,o,a)=>{f(r,a,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r,this._screenToWorldRatio)}_intersectScreenPolygonRenderGeometry(e,r,t,s,i){if(!e.visible||!e.material.visible||!e.material.intersectScreenPolygonDraped)return;d(v,t+e.transformation[12],e.transformation[13]);const n=this._screenToWorldRatio;for(const o of r){const r=e.material.intersectScreenPolygonDraped(e,v,s,o,n);if(r)return void R(o.distance,r.primitiveIndex,i,e.material.renderPriority,s,e.layerViewUid,e.graphicUid)}}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],y.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],y.prototype,"rendererContext",void 0),e([o()],y.prototype,"updating",null),e([o()],y.prototype,"rctx",null),e([o()],y.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],y.prototype,"isEmpty",null),e([o()],y.prototype,"_geometries",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],y);class _{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function f(e,r,t,s,i,n,o){const a=new c(n,o,r),d=r=>{r.set(5,a,e.distance,e.renderDistance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.renderDistance||i.results.ground.renderDistance<=i.results.min.renderDistance)&&d(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.renderDistance||i.results.ground.renderDistance>i.results.max.renderDistance)&&d(i.results.max),2===i.options.store){const e=new g(i.ray);d(e),i.results.all.push(e)}}function R(e,r,t,s,i,n,o){i.polygonResults.add(5,new c(n,o,r),e,t,s)}const G=h(),v=h(),C=128;export{y as SortedRenderGeometryRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as f,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as D,create as R}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as C,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{evaluateModelTransformScale as j}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as T}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as U,isColor as M,isOIT as _}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as L}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{Material as F}from"../lib/Material.js";import{screenPolygonIntersectsBounds as B,screenPolygonIntersectsTriangle as H}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as W,Hit as N}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as G}from"../lib/screenSizePerspectiveUtils.js";import{assert as q}from"../lib/Util.js";import{writePosition as X,writeNormal as Y,writeColor as k,writeBufferVec2 as J,writeBufferFloat as K,writeBufferVec3 as Q,writeBufferZeros as Z,writeBufferVec4 as $}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ee}from"./internal/MaterialUtil.js";import{a as te}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as se,getInstanceLayout as re,HUDMaterialTechnique as ie}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ae}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ne}from"../../../../webscene/support/AlphaCutoff.js";class oe extends F{constructor(e,t,s=!1){super(e,He),this.geometryType=1,this.produces=new Map([[12,e=>U(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>U(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>U(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&U(e)]]),this._visible=!0,this._configuration=new ae(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,M(e.output)&&(s.debugDrawLabelBorder=!!T.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&_(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:h}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&h)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(Me,e,t,h))if(fe(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(xe[0]=c[0],xe[1]=c[1],xe[2]=S[2],h.unprojectFromRenderScreen(xe,me)){const t=y();f(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,me)*s,i=y();m(i,P,h.inverseViewMatrix),a(r,r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,Ve),{scaleX:c,scaleY:h}=Ne(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,D=r(ze,s);q(p.size>=3);const R="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(me,p.data[t],p.data[t+1],p.data[t+2]),m(me,me,s),m(me,me,i.viewMatrix),y){const e=r*y.size;g(ye,y.data[e],y.data[e+1],y.data[e+2])}else g(ye,0,0,0);if(!R&&(me[0]+=ye[0],me[1]+=ye[1],0!==ye[2])){const e=ye[2];S(ye,me),x(me,me,u(ye,ye,e))}const o=r*O.size;g(ge,O.data[o],O.data[o+1],O.data[o+2]),b(ge,ge,D);const{normal:l,cosAngle:V}=he(ge,i,Le),C=qe(n,me,V,i,de);if(v(me,me,l,C),i.applyProjection(me,Se),Se[0]>-1){if(R&&(ye[0]||ye[1])&&(Se[0]+=ye[0]*i.pixelRatio,0!==ye[1]&&(Se[1]+=de.alignmentEvaluator.apply(ye[1])*i.pixelRatio),i.unapplyProjection(Se,me)),Se[0]+=n.screenOffset[0]*i.pixelRatio,Se[1]+=n.screenOffset[1]*i.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),Fe[0]=P[0],Fe[1]=P[1],null!=d){const e=r*d.size;Fe[0]*=d.data[e],Fe[1]*=d.data[e+1]}de.evaluator.applyVec2(Fe,Fe);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*Fe[0])*i.pixelRatio/2}Fe[0]*=c,Fe[1]*=h,f(e.centerView,me),g(e.renderScreenPosition,Se[0],Se[1],Se[2]),a(e.screenSize,Fe),e.pixelRatioTolerance=Ie*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=te(n),yield e}}}*_forEachDrapedHUDInstance(e,t){const s=t.attributes.get("position"),r=t.attributes.get("size"),i=t.attributes.get("rotation"),n=this.parameters,o=n.size,l=t.attributes.get("featureAttribute"),c=null==l?null:V(l.data,Ve),{scaleX:h,scaleY:f}=Ne(c,n,t.screenToWorldRatio);e.pixelRatioTolerance=Ee*t.screenToWorldRatio,e.anchor=te(n);for(let p=0;p<s.data.length/s.size;p++){const l=p*s.size;if(e.x=s.data[l],e.y=s.data[l+1],Fe[0]=o[0],Fe[1]=o[1],null!=r){const e=p*r.size;Fe[0]*=r.data[e],Fe[1]*=r.data[e+1]}if(e.halfOutlineSize=0,n.textureIsSignedDistanceField){const s=Math.min(n.outlineSize,.5*Fe[0]);e.halfOutlineSize=s*t.screenToWorldRatio/2}Fe[0]*=h,Fe[1]*=f,a(e.screenSize,Fe),e.rotationAngle=n.rotation+(null!=i?i.data[p*i.size]:0),yield e}}intersectRayDraped(e,t,s,r,i){const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:h,rotationAngle:f,anchor:p}of this._forEachDrapedHUDInstance(_e,e))fe(s,n,o,l,c,h,f,a,p)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const i=this.parameters;for(const{x:a,y:n,screenSize:o,pixelRatioTolerance:l,halfOutlineSize:c,rotationAngle:h,anchor:f}of this._forEachDrapedHUDInstance(_e,e))if(pe(r,a+t[0],n+t[1],o,l,c,h,i,f,!1))return new W(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new N(1),h=1/o.pixelRatio;for(const{renderScreenPosition:f,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(Me,e,t,o)){const e=m(me,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=f[0]*h,i=(o.fullHeight-f[1])*h;if(je[0]=p[0]*h,je[1]=p[1]*h,pe(r,t,i,je,u*h,g*h,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new We(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(be,s,r(ze,i));const c=he(be,o,Le),h=Ge(p(t),o),f=qe(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,f+h),v(e,e,be,f+h);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&f(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return f(a,t);const c=e(Math.abs(s.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&f(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(ge,s),O(s,s,u(ge,ge,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&f(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&f(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=ne||t>=ne&&s[3]>=ne;return this._visible&&r}createGLMaterial(e){return new le(e)}calculateRelativeScreenBounds(e,t,s=C()){return ce(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class le extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ie,e)}}function ce(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function he(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Be),s}function fe(e,s,r,i,a,l,c,h,f){const p=ue(s,r,i,a,l,h,f,De);return n(Oe,s,r),o(ve,e,Oe,t(c)),ve[0]>p[0]&&ve[0]<p[2]&&ve[1]>p[1]&&ve[1]<p[3]}function pe(e,s,r,i,a,l,c,h,f,p){const u=ue(s,r,i,a,l,h,f,De,p);if(n(Re,u[0],u[1]),n(Ce,u[2],u[1]),n(we,u[2],u[3]),n(Ae,u[0],u[3]),0!==c){const e=t(c);n(Oe,s,r),o(Re,Re,Oe,e),o(Ce,Ce,Oe,e),o(we,we,Oe,e),o(Ae,Ae,Oe,e),w(u),A(u,Re),A(u,Ce),A(u,we),A(u,Ae)}return!!B(e,u)&&(H(e,Re,Ce,we)||H(e,Re,we,Ae))}function ue(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],h=c+s[0]+2*r;const f=l?1-n[1]:n[1];let p=t-r-s[1]*f,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),h-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,h+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=h,o[3]=u,o}const de=new G,me=y(),ge=y(),Se=R(),xe=s(),be=y(),ve=h(),Oe=h(),ze=i(),ye=y(),Pe=y(),Ve=R(),De=C(),Re=h(),Ce=h(),we=h(),Ae=h(),je=h();class Te{constructor(){this.renderScreenPosition=y(),this.screenSize=h(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}class Ue{constructor(){this.x=0,this.y=0,this.screenSize=h(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}const Me=new Te,_e=new Ue,Le={normal:y(),cosAngle:0},Ie=1,Ee=2,Fe=c(0,0),Be=P(0,0,1);class He extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=D,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=D,this.outlineSize=0,this.distanceFieldBoundingBox=R(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class We{constructor(e){this.baseInstanceLayout=se,this.layout=re(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r){if(null==r)return;const{buffer:i,offset:a}=r,{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:f,groundDistance:p,featureAttribute:u,uvi:d,olidColor:m}=i;X(s.get("position"),e,n,a),Y(s.get("normal"),t,o,a);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const n=a+e;d.setValues(n,t,s,r,i)}}}if(l&&k(s.get("color"),4,l,a),c&&J(s.get("size"),c,a),h&&K(s.get("rotation"),h,a),f&&(s.get("centerOffset")?Q(s.get("centerOffset"),f,a):Z(f,a,g)),s.get("groundDistance")?K(s.get("groundDistance"),p,a):Z(p,a,g),u&&(s.get("featureAttribute")?$(s.get("featureAttribute"),u,a):Z(u,a,g)),null!=m){const e=s.get("olidColor");null!=e?k(e,4,m,a):Z(m,a,g)}}writeBaseInstance(e,t){const{uv0:s}=t;J(e.get("uv0"),s,0)}}function Ne(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(j(Pe,t,e),{scaleX:Pe[0]*s,scaleY:Pe[1]*s})}function Ge(e,t){const s=t.computeRenderPixelSizeAtDist(e)*L;return(t.aboveGround?1:-1)*s}function qe(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ee(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{oe as HUDMaterial,He as Parameters};
|
|
2
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as f,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as D,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as R,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{evaluateModelTransformScale as j}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as U}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as _,isOIT as T}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as L}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{PointMaterial as F}from"../lib/PointMaterial.js";import{screenPolygonIntersectsBounds as B,screenPolygonIntersectsTriangle as H}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as N,Hit as G}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as q}from"../lib/screenSizePerspectiveUtils.js";import{assert as W}from"../lib/Util.js";import{writePosition as X,writeNormal as Y,writeColor as k,writeBufferVec2 as J,writeBufferFloat as K,writeBufferVec3 as Q,writeBufferZeros as Z,writeBufferVec4 as $}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ee}from"./internal/MaterialUtil.js";import{a as te}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as se,getInstanceLayout as re,HUDMaterialTechnique as ie}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ae}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ne}from"../../../../webscene/support/AlphaCutoff.js";class oe extends F{constructor(e,t,s=!1){super(e,He),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ae(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e.output)&&(s.debugDrawLabelBorder=!!U.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&T(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:h}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&h)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(_e,e,t,h))if(fe(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(xe[0]=c[0],xe[1]=c[1],xe[2]=S[2],h.unprojectFromRenderScreen(xe,me)){const t=y();f(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,me)*s,i=y();m(i,P,h.inverseViewMatrix),a(r,r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,Ve),{scaleX:c,scaleY:h}=Ge(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,D=r(ze,s);W(p.size>=3);const C="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(me,p.data[t],p.data[t+1],p.data[t+2]),m(me,me,s),m(me,me,i.viewMatrix),y){const e=r*y.size;g(ye,y.data[e],y.data[e+1],y.data[e+2])}else g(ye,0,0,0);if(!C&&(me[0]+=ye[0],me[1]+=ye[1],0!==ye[2])){const e=ye[2];S(ye,me),x(me,me,u(ye,ye,e))}const o=r*O.size;g(ge,O.data[o],O.data[o+1],O.data[o+2]),b(ge,ge,D);const{normal:l,cosAngle:V}=he(ge,i,Le),R=We(n,me,V,i,de);if(v(me,me,l,R),i.applyProjection(me,Se),Se[0]>-1){if(C&&(ye[0]||ye[1])&&(Se[0]+=ye[0]*i.pixelRatio,0!==ye[1]&&(Se[1]+=de.alignmentEvaluator.apply(ye[1])*i.pixelRatio),i.unapplyProjection(Se,me)),Se[0]+=n.screenOffset[0]*i.pixelRatio,Se[1]+=n.screenOffset[1]*i.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),Fe[0]=P[0],Fe[1]=P[1],null!=d){const e=r*d.size;Fe[0]*=d.data[e],Fe[1]*=d.data[e+1]}de.evaluator.applyVec2(Fe,Fe);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*Fe[0])*i.pixelRatio/2}Fe[0]*=c,Fe[1]*=h,f(e.centerView,me),g(e.renderScreenPosition,Se[0],Se[1],Se[2]),a(e.screenSize,Fe),e.pixelRatioTolerance=Ie*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=te(n),yield e}}}*_forEachDrapedHUDInstance(e,t,s){const r=t.attributes.get("position"),i=t.attributes.get("size"),n=t.attributes.get("rotation"),o=this.parameters,l=o.size,c=t.attributes.get("featureAttribute"),h=null==c?null:V(c.data,Ve),{scaleX:f,scaleY:p}=Ge(h,o,s);e.pixelRatioTolerance=Ee*s,e.anchor=te(o);for(let u=0;u<r.data.length/r.size;u++){const t=u*r.size;if(e.x=r.data[t],e.y=r.data[t+1],Fe[0]=l[0],Fe[1]=l[1],null!=i){const e=u*i.size;Fe[0]*=i.data[e],Fe[1]*=i.data[e+1]}if(e.halfOutlineSize=0,o.textureIsSignedDistanceField){const t=Math.min(o.outlineSize,.5*Fe[0]);e.halfOutlineSize=t*s/2}Fe[0]*=f,Fe[1]*=p,a(e.screenSize,Fe),e.rotationAngle=o.rotation+(null!=n?n.data[u*n.size]:0),yield e}}intersectRayDraped(e,t,s,r,i,a){const n=this.parameters;for(const{x:o,y:l,screenSize:c,pixelRatioTolerance:h,halfOutlineSize:f,rotationAngle:p,anchor:u}of this._forEachDrapedHUDInstance(Te,e,a))fe(s,o,l,c,h,f,p,n,u)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r,i){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:h,rotationAngle:f,anchor:p}of this._forEachDrapedHUDInstance(Te,e,i))if(pe(r,n+t[0],o+t[1],l,c,h,f,a,p,!1))return new N(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new G(1),h=1/o.pixelRatio;for(const{renderScreenPosition:f,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(_e,e,t,o)){const e=m(me,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=f[0]*h,i=(o.fullHeight-f[1])*h;if(je[0]=p[0]*h,je[1]=p[1]*h,pe(r,t,i,je,u*h,g*h,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new Ne(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(be,s,r(ze,i));const c=he(be,o,Le),h=qe(p(t),o),f=We(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,f+h),v(e,e,be,f+h);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&f(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return f(a,t);const c=e(Math.abs(s.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&f(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(ge,s),O(s,s,u(ge,ge,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&f(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&f(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=ne||t>=ne&&s[3]>=ne;return this._visible&&r}createGLMaterial(e){return new le(e)}calculateRelativeScreenBounds(e,t,s=R()){return ce(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class le extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ie,e)}}function ce(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function he(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Be),s}function fe(e,s,r,i,a,l,c,h,f){const p=ue(s,r,i,a,l,h,f,De);return n(Oe,s,r),o(ve,e,Oe,t(c)),ve[0]>p[0]&&ve[0]<p[2]&&ve[1]>p[1]&&ve[1]<p[3]}function pe(e,s,r,i,a,l,c,h,f,p){const u=ue(s,r,i,a,l,h,f,De,p);if(n(Ce,u[0],u[1]),n(Re,u[2],u[1]),n(we,u[2],u[3]),n(Ae,u[0],u[3]),0!==c){const e=t(c);n(Oe,s,r),o(Ce,Ce,Oe,e),o(Re,Re,Oe,e),o(we,we,Oe,e),o(Ae,Ae,Oe,e),w(u),A(u,Ce),A(u,Re),A(u,we),A(u,Ae)}return!!B(e,u)&&(H(e,Ce,Re,we)||H(e,Ce,we,Ae))}function ue(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],h=c+s[0]+2*r;const f=l?1-n[1]:n[1];let p=t-r-s[1]*f,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),h-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,h+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=h,o[3]=u,o}const de=new q,me=y(),ge=y(),Se=C(),xe=s(),be=y(),ve=h(),Oe=h(),ze=i(),ye=y(),Pe=y(),Ve=C(),De=R(),Ce=h(),Re=h(),we=h(),Ae=h(),je=h();class Ue{constructor(){this.renderScreenPosition=y(),this.screenSize=h(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}class Me{constructor(){this.x=0,this.y=0,this.screenSize=h(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}const _e=new Ue,Te=new Me,Le={normal:y(),cosAngle:0},Ie=1,Ee=2,Fe=c(0,0),Be=P(0,0,1);class He extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=D,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=D,this.outlineSize=0,this.distanceFieldBoundingBox=C(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ne{constructor(e){this.baseInstanceLayout=se,this.layout=re(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r){if(null==r)return;const{buffer:i,offset:a}=r,{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:f,groundDistance:p,featureAttribute:u,uvi:d,olidColor:m}=i;X(s.get("position"),e,n,a),Y(s.get("normal"),t,o,a);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const n=a+e;d.setValues(n,t,s,r,i)}}}if(l&&k(s.get("color"),4,l,a),c&&J(s.get("size"),c,a),h&&K(s.get("rotation"),h,a),f&&(s.get("centerOffset")?Q(s.get("centerOffset"),f,a):Z(f,a,g)),s.get("groundDistance")?K(s.get("groundDistance"),p,a):Z(p,a,g),u&&(s.get("featureAttribute")?$(s.get("featureAttribute"),u,a):Z(u,a,g)),null!=m){const e=s.get("olidColor");null!=e?k(e,4,m,a):Z(m,a,g)}}writeBaseInstance(e,t){const{uv0:s}=t;J(e.get("uv0"),s,0)}}function Ge(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(j(Pe,t,e),{scaleX:Pe[0]*s,scaleY:Pe[1]*s})}function qe(e,t){const s=t.computeRenderPixelSizeAtDist(e)*L;return(t.aboveGround?1:-1)*s}function We(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ee(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{oe as HUDMaterial,He as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{
|
|
2
|
+
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as s}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{PointMaterial as n}from"../lib/PointMaterial.js";import{writePosition2d as a,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as p}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class d extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends n{constructor(t){super(t,d),this.visible=!0,this.produces=new Map([[18,t=>s(t)]]),this.intersectScreenPolygonDraped=void 0,this._configuration=new m}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(r,s,i,n,a,o){const u=r.attributes.get("position"),{parameters:c}=this,{searchRadius:l}=c,f=l*o+h*o,p=f*f,m=u.data.length/u.size;for(let h=0;h<m;h++){const r=h*u.size,s=t(y,u.data[r],u.data[r+1]);e(s,i)<p&&n(a.distance,a.renderDistance,a.normal,-1)}}intersectScreenPolygon(){return null}createBufferWriter(){return new v(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class v{constructor(t){this.layout=t,this.baseInstanceLayout=p}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s){if(null==s)return;const{buffer:i,offset:n}=s;a(r.get("position"),t,i.position,n);const u="featureAttribute"in i?i.featureAttribute:null;u&&o(r.get("featureAttribute"),u,n)}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const y=r();export{b as HeatmapDensityMaterial,d as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{
|
|
2
|
+
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{LineMaterial as s}from"../lib/LineMaterial.js";import{MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as l,writeBufferVec3 as c,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,b),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new O(e)}createBufferWriter(){return new $}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:l,hasSlicePlane:c,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${l}:${c}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class b extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class ${constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i){if(null==i)return;const{buffer:s,offset:n}=i;o(r.get("position"),e,s.position,n),l(r.get("normal"),t,s.normal,n),c(r.get("centerOffset"),s.centerOffset,n),u(r.get("groundDistance"),s.groundDistance,n)}}export{m as LineCalloutMaterial,b as Parameters,S as uniqueMaterialIdentifier};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as n}from"../core/shaderLibrary/ShaderOutput.js";import h from"../lib/GLMaterial.js";import{
|
|
2
|
+
import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as n}from"../core/shaderLibrary/ShaderOutput.js";import h from"../lib/GLMaterial.js";import{LineMaterial as c}from"../lib/LineMaterial.js";import{VisualVariablePassParameters as l}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as p,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>n(e)&&8===this.parameters.renderOccluded],[11,e=>n(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersectRay(){}intersectScreenPolygon(){return null}createBufferWriter(){return new S(p(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends h{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends l{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,n){if(null==n)return;const{buffer:h,offset:c}=n,l=o.get("position").data,p=l.length/3;let u=[1,0,0];const d=o.get("normal");this._parameters.worldSpace&&null!=d&&(u=d.data);let f=1,g=0;this._parameters.vvSize?g=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(f=o.get("size").data[0]);let _=[1,1,1,1],v=0;this._parameters.vvColor?v=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(_=o.get("color").data);let S=0;this._parameters.vvOpacity&&(S=o.get("opacityFeatureAttribute").data[0]);const w=new Float32Array(h.buffer),y=s(h.buffer),O=new Uint8Array(h.buffer);let T=c*(this.layout.stride/4);const V=w.BYTES_PER_ELEMENT/y.BYTES_PER_ELEMENT,k=4/V,j=(e,t,r,i)=>{w[T++]=e[0],w[T++]=e[1],w[T++]=e[2],m(t,e,y,T*V),T+=k;let s=T*V;if(y[s++]=r[0],y[s++]=r[1],T=Math.ceil(s/V),this._parameters.vvColor)w[T++]=v;else{const e=Math.min(4*i,_.length-4),t=4*T++;O[t]=255*_[e],O[t+1]=255*_[e+1],O[t+2]=255*_[e+2],O[t+3]=255*_[e+3]}this._parameters.vvOpacity&&(w[T++]=S),s=T*V,this._parameters.vvSize?(w[T++]=g,s+=2):y[s++]=f,this._parameters.worldSpace&&(y[s++]=u[0],y[s++]=u[1],y[s++]=u[2]),T=Math.ceil(s/V)},M=(s,a)=>{const o=e(b,l[3*s],l[3*s+1],l[3*s+2]),n=P;let h=s+a;do{e(n,l[3*h],l[3*h+1],l[3*h+2]),h+=a}while(t(o,n)&&h>=0&&h<p);i&&(r(o,o,i),r(n,n,i)),j(o,n,[-1,-1],s),j(o,n,[1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,-1],s),j(o,n,[1,1],s),j(o,n,[-1,1],s)},x=this._parameters.placement;"begin"!==x&&"begin-end"!==x||M(0,1),"end"!==x&&"begin-end"!==x||M(p-1,-1)}}const b=i(),P=i();export{g as LineMarkerMaterial,v as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as
|
|
2
|
+
import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import c from"../lib/GLMaterial.js";import{LineMaterial as u}from"../lib/LineMaterial.js";import{MaterialParameters as p}from"../lib/Material.js";import{MeasurementArrowTechnique as f,layout as h}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends u{constructor(t){super(t,b),this._configuration=new m,this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&l(t)],[8,t=>this._transparent&&l(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(t){return new C(t)}createBufferWriter(){return new _}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends c{beginSlot(t){return this.getTechnique(f,t)}}class b extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1}}const w=n(),j=n(),v=n(),M=n(),O=n();class _{constructor(){this.layout=h}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,l,c){if(null==c)return;const{buffer:u,offset:p}=c,{data:f,indices:h}=l.get("position"),m=l.get("normal").data,d=f.length/3;h&&h.length!==2*(d-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=w,C=j,b=v,_=M,x=O,y=u.position,L=u.normal,S=u.uv0;let T=0;for(let w=0;w<d;++w){const l=3*w;if(t(g,f[l],f[l+1],f[l+2]),w<d-1){const o=3*(w+1);t(C,f[o],f[o+1],f[o+2]),t(x,m[o],m[o+1],m[o+2]),e(x,x),r(b,C,g),e(b,b),s(_,x,b),e(_,_)}const c=o(g,C);n&&a&&(i(g,g,n),i(C,C,n),i(_,_,a));const u=p+2*w,h=u+1;y.setVec(u,g),y.setVec(h,g),L.setVec(u,_),L.setVec(h,_),S.set(u,0,T),S.set(u,1,-1),S.set(h,0,T),S.set(h,1,1),w<d-1&&(T+=c)}const A=u.length;for(let t=0;t<2*d;++t)A.set(p+t,T)}}export{g as MeasurementArrowMaterial,b 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 r}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as t,createScreenPointArray as o}from"../../../../core/screenUtils.js";import{copy as i,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as a,subtract as c,dot as l,scale as f,add as m,copy as u,length as p,distance as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as j,fromPoints 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,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as a,subtract as c,dot as l,scale as f,add as m,copy as u,length as p,distance as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as d}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as j,fromPoints as b,closestLineSegmentPoint as y,projectPoint as v,create as x}from"../../../../geometry/support/lineSegment.js";import{fromPoints as L,signedDistance as S,getNormal as M,create as w}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as P}from"../core/shaderLibrary/ShaderOutput.js";import T from"../lib/GLMaterial.js";import{LineMaterial as C}from"../lib/LineMaterial.js";import{MaterialParameters as R}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as V,screenPolygonIntersectsBufferedSegment as _}from"../lib/screenPolygonOverlapUtils.js";import{Hit as A,DrapedHit as N}from"../lib/screenPolygonTriangleIntersections.js";import{isTranslationMatrix as U}from"../lib/Util.js";import{DefaultBufferWriter as D}from"./DefaultBufferWriter.js";import{PositionColorLayout as E,PositionLayout as O}from"./DefaultLayouts.js";import{NativeLineTechnique as q}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as B}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as X}from"../../../../webscene/support/AlphaCutoff.js";class F extends C{constructor(e){super(e,k),this._configuration=new B,this.produces=new Map([[2,e=>P(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]>=X}intersectRay(r,t,o,s,n,h){const{options:d,camera:v,rayBegin:x,rayEnd:w}=o;if(!d.selectionMode||!r.visible||!v)return;if(!U(t))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes.get("position").data,T=oe;i(T,o.point);const C=ge*v.pixelRatio;a(ce[0],T[0]-C,T[1]+C,0),a(ce[1],T[0]+C,T[1]+C,0),a(ce[2],T[0]+C,T[1]-C,0),a(ce[3],T[0]-C,T[1]-C,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(ce[e],le[e]))return;L(v.eye,le[0],le[1],fe),L(v.eye,le[1],le[2],me),L(v.eye,le[2],le[3],ue),L(v.eye,le[3],le[0],pe);let R=Number.MAX_VALUE,V=0;for(const e of I(H,J,P,t)){if(S(fe,H)<0&&S(fe,J)<0||S(me,H)<0&&S(me,J)<0||S(ue,H)<0&&S(ue,J)<0||S(pe,H)<0&&S(pe,J)<0)continue;const r=v.projectToRenderScreen(H,Y),t=v.projectToRenderScreen(J,Z);if(null==r||null==t)continue;if(r[2]<0&&t[2]>0){c(K,H,J);const e=v.frustum,t=-S(e[4],H)/l(K,M(e[4]));if(f(K,K,t),m(H,H,K),!v.projectToRenderScreen(H,r))continue}else if(r[2]>0&&t[2]<0){c(K,J,H);const e=v.frustum,r=-S(e[4],J)/l(K,M(e[4]));if(f(K,K,r),m(J,J,K),!v.projectToRenderScreen(J,t))continue}else if(r[2]<0&&t[2]<0)continue;r[2]=0,t[2]=0;const o=j(b(r,t,re),T);o<R&&(R=o,u($,H),u(ee,J),V=e)}if(R<C*C){let e=Number.MAX_VALUE;if(y(b($,ee,re),b(x,w,te),Q)){c(Q,Q,x);const r=p(Q);f(Q,Q,1/r),e=r/g(x,w)}h(e,e,Q,V)}}intersectScreenPolygon(r,t,o,i){const{options:s,camera:n,screenPolygonPrimitiveProcessor:a}=o;if(!s.selectionMode||!r.visible)return null;if(!U(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 A(4);for(const e of I(H,J,c,t))for(const[r,t]of a.processLineSegment(he,H,J))V(n,r,t,Y,Z)&&(n.renderToScreen(Y,ie),n.renderToScreen(Z,se),_(i,ie,se,ge)&&(v(b(r,t,te),n.eye,oe),l.updateIfCloserFromValues(g(n.eye,oe),e,oe,null)));return l}intersectRayDraped(e,t,o,i,s,n){if(!t.options.selectionMode)return;const a=o[0],c=o[1],l=W(e,n);let f=Number.MAX_VALUE,m=0;for(const u of z(ne,ae,e)){const e=a-ne[0],t=c-ne[1],o=ae[0]-ne[0],i=ae[1]-ne[1],s=r((o*e+i*t)/(o*o+i*i),0,1),n=o*s-e,l=i*s-t,p=n*n+l*l;p<f&&(f=p,m=u)}f<l*l&&i(s.distance,s.renderDistance,s.normal,m)}intersectScreenPolygonDraped(e,r,t,o,i){if(!t.options.selectionMode)return null;const s=W(e,i);for(const n of z(ne,ae,e,r))if(_(o,ne,ae,s))return new N(n);return null}createGLMaterial(e){return new G(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?E:O;return new D(e)}}class G extends T{beginSlot(e){return this.getTechnique(q,e)}}function*I(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}function W(e,r){const t=e.attributes.get("size");return(((t?t.data[0]:0)+1)/2+4)*r}function*z(e,r,t,o){const n=t.attributes.get("position").data,a=o?.[0]??0,c=o?.[1]??0;s(e,n[0]+a,n[1]+c);for(let l=3;l<n.length-2;l+=3){const t=l%n.length;s(r,n[t]+a,n[t+1]+c),yield l/3,i(e,r)}}class k extends R{constructor(){super(...arguments),this.color=d,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const H=h(),J=h(),K=h(),Q=h(),Y=t(),Z=t(),$=h(),ee=h(),re=x(),te=x(),oe=h(),ie=o(),se=o(),ne=n(),ae=n(),ce=[t(),t(),t(),t()],le=[h(),h(),h(),h()],fe=w(),me=w(),ue=w(),pe=w(),ge=2,he=[h(),h()];export{F as NativeLineMaterial,k 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,createScreenPointArray as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as o,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as v}from"../../../../geometry/support/float16.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as x,projectPoint as T,projectPointFraction as j,create as L}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as C,getNormal as A,create as M}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as R,BufferViewFloat as V,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as U,isColor as I,isDepth as N,isColorHighlightOLIDOrDepth as W,is2DGeometryOutput as k}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as D}from"../effects/geometry/olidUtils.js";import Y from"../lib/GLMaterial.js";import{Material as J}from"../lib/Material.js";import{projectWorldLineSegmentToRenderScreen as q,screenPolygonIntersectsBufferedSegment as X}from"../lib/screenPolygonOverlapUtils.js";import{Hit as G,DrapedHit as H}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as K}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as Q,assert as Z}from"../lib/Util.js";import{isImagePattern as $}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ee}from"./VisualVariablePassParameters.js";import{writeColor as te}from"./internal/bufferWriterUtils.js";import{n as re}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as ie,getTextureBufferLayout as se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ne}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as oe}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class le extends J{constructor(e,t){super(e,pe),this.geometryType=2,this.produces=new Map([[2,e=>U(e)||I(e)&&8===this.parameters.renderOccluded],[3,e=>N(e)],[10,e=>W(e)&&8===this.parameters.renderOccluded],[11,e=>W(e)&&8===this.parameters.renderOccluded],[4,e=>I(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>I(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>k(e)]]),this._configuration=new oe(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=_e(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&&ge(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]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}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,n,o){if(!i.options.selectionMode)return;const a=this._getLineSize(e,!0),l=s[0],c=s[1],p=fe(a,r);let u=Number.MAX_VALUE,m=0;for(const h of de(Pe,ve,this.parameters,e)){const e=l-Pe[0],r=c-Pe[1],i=ve[0]-Pe[0],s=ve[1]-Pe[1],n=t((i*e+s*r)/(i*i+s*s),0,1),o=i*n-e,a=s*n-r,p=o*o+a*a;p<u&&(u=p,m=h)}u<p*p&&n(o.distance,o.renderDistance,o.normal,m)}intersectRay(t,r,i,s,n,a){const{options:l,camera:_,rayBegin:b,rayEnd:S}=i;if(!l.selectionMode||!t.visible||!_)return;if(!Q(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const y=t.attributes,P=y.get("position").data,v=this._getLineSize(y),T=Le;o(T,i.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,M=j/2+L;c(Ie[0],T[0]-M,T[1]+M,0),c(Ie[1],T[0]+M,T[1]+M,0),c(Ie[2],T[0]+M,T[1]-M,0),c(Ie[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;z(_.eye,Ne[0],Ne[1],We),z(_.eye,Ne[1],Ne[2],ke),z(_.eye,Ne[2],Ne[3],De),z(_.eye,Ne[3],Ne[0],Ye);let R=Number.MAX_VALUE,V=0;for(const e of this._forEachTransformedLineSegment(Se,ye,P,r,he(this.parameters,y))){if(C(We,Se)<0&&C(We,ye)<0||C(ke,Se)<0&&C(ke,ye)<0||C(De,Se)<0&&C(De,ye)<0||C(Ye,Se)<0&&C(Ye,ye)<0)continue;const t=_.projectToRenderScreen(Se,ze),r=_.projectToRenderScreen(ye,Ce);if(null==t||null==r)continue;if(t[2]<0&&r[2]>0){p(Te,Se,ye);const e=_.frustum,r=-C(e[4],Se)/u(Te,A(e[4]));if(m(Te,Te,r),h(Se,Se,Te),!_.projectToRenderScreen(Se,t))continue}else if(t[2]>0&&r[2]<0){p(Te,ye,Se);const e=_.frustum,t=-C(e[4],ye)/u(Te,A(e[4]));if(m(Te,Te,t),h(ye,ye,Te),!_.projectToRenderScreen(ye,r))continue}else if(t[2]<0&&r[2]<0)continue;t[2]=0,r[2]=0;const i=w(t,r,Fe),s=E(i,T);if(!(s>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(i,Se,ye,T,_,v,L);if(s>=e*e)continue}R=s,f(Re,Se),f(Ve,ye),V=e}}if(R<M*M){let e=Number.MAX_VALUE;if(x(w(Re,Ve,Fe),w(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,e,je,V)}}intersectScreenPolygon(t,r,i,s){const{options:n,camera:o,screenPolygonPrimitiveProcessor:a}=i;if(!n.selectionMode||!t.visible)return null;if(!Q(r))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Je,m=u*o.pixelRatio,h=new G(4);for(const e of this._forEachTransformedLineSegment(Se,ye,c,r,he(this.parameters,l)))for(const[t,r]of a.processLineSegment(qe,Se,ye)){if(!q(o,t,r,ze,Ce))continue;const i=w(ze,Ce,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(Le,ze,Ce,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(i,t,r,Le,o,p,m)/o.pixelRatio)),o.renderToScreen(ze,Ae),o.renderToScreen(Ce,Me),X(s,Ae,Me,n)&&(T(w(t,r,Oe),o.eye,we),h.updateIfCloserFromValues(g(o.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e,screenToWorldRatio:t},r,i,s){if(!i.options.selectionMode)return null;const n=fe(this._getLineSize(e,!0),t);for(const o of de(Pe,ve,this.parameters,e,r))if(X(s,Pe,ve,n))return new H(o);return null}createBufferWriter(){return new ue(ie(this.parameters),se(this.parameters),this.parameters)}createGLMaterial(e){return new ce(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,n,o){const a=j(e,i);_(we,t,r,a),b(Ee,we,s.viewMatrix);const l=d(Ee),c=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,r){return r?S(je,e):c(je,0,0,1),p(xe,e,t.eye),S(xe,xe),Math.abs(u(je,xe))}_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 n=s?r.length-2:r.length-5;for(let o=0;o<n;o+=3){e[0]=r[o]+i[12],e[1]=r[o+1]+i[13],e[2]=r[o+2]+i[14];const s=(o+3)%r.length;t[0]=r[s]+i[12],t[1]=r[s+1]+i[13],t[2]=r[s+2]+i[14],yield o/3}}}class ce extends Y{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(ne,e)}}class pe extends ee{constructor(){super(...arguments),this._width=0,this.color=P,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=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(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 $(this.stipplePattern)&&null!=this.stippleTexture}}class ue{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=_e(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return he(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?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,n){null!=n&&this._writeTextureBuffer(e,r,n),null!=i&&this._writeVertexBuffer(e,r,i,s)}_writeTextureBuffer(e,t,r){const i=t.get("position"),s=i.data.length/3,n=this._isClosed(t),{buffer:o,offset:a}=r,l=o.getField("position",R),c=o.getField("u0",V),p=o.getField("sizeFeatureAttribute",V),u=o.getField("size",V),m=o.getField("colorFeatureAttribute",V),h=o.getField("color",F),d=o.getField("olidColor",F),_=o.getField("timeStamps",O),b=o.getField("opacityFeatureAttribute",V),S=t.get("sizeFeatureAttribute")?.data,y=t.get("size")?.data,P=t.get("colorFeatureAttribute")?.data,v=t.get("color")?.data,w=t.get("opacityFeatureAttribute")?.data,E=t.get("distanceToStart")?.data,x=t.get("timeStamps");Z(null!==l,"Expected valid position field in texture buffer"),Z(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let L=0;L<s;++L){this._getTransformedPosition(Ue,i.data,L,e),L>0&&(null!=E?T=E[L]??T:T+=g(Be,Ue));const t=a+L+1;if(l.setVec(t,Ue),c.set(t,T),f(Be,Ue),p&&p.set(t,1===S?.length?S[0]:S?.[L]??0),u&&u.set(t,1===y?.length?y[0]:y?.[L]??1),m&&m.set(t,1===P?.length?P[0]:P?.[L]??0),h)if(null!=v){const e=Math.min(4*L,v.length-4);h.setValues(t,v[e],v[e+1],v[e+2],v[e+3])}else h.setValues(t,1,1,1,1);b&&b.set(t,1===w?.length?w[0]:w?.[L]??0)}if(null!=_&&null!=x){Z(4===x.size);const e=x.data;for(let t=0;t<s;++t){const r=4*t,i=a+t+1;_.set(i,0,e[r]),_.set(i,1,e[r+1]),_.set(i,2,e[r+2]),_.set(i,3,e[r+3])}}if(n){const e=a,t=a+1,r=a+2,i=a+s,n=i+1,p=i+2;o.copyItem(i,e),o.copyItem(t,n),o.copyItem(r,p),l.getVec(i,Be),l.getVec(t,Ue);const u=T+g(Be,Ue);c.set(n,u)}else{const e=a,t=a+1,r=a+s,i=r+1;o.copyItem(t,e),o.copyItem(r,i)}const j=t.get("olidColor");D()&&null!=j&&null!=d&&te(j,4,d,a)}_writeVertexBuffer(e,t,r,i){const{buffer:s,offset:n}=r,{layout:o}=this,a=t.get("position"),l=a.indices,c=a.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",B);Z(null!=m,"Missing texture buffer index field"),Z(null!=i,"Using a texture layout, but the texture range for this instance was not provided");const h=i.from;Z(i.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=v(s.buffer),g=new Uint32Array(s.buffer),_=o.stride/4;let b=n*_;const S=b,y=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,P=(e,t,r)=>{const i=r+1;g[b]=h+i,b++;let s=b*y;d[s++]=e,d[s++]=t,b=Math.ceil(s/y)};b+=_;let w=0,E=0;p?(w=0,E=c):(P(1,-4,0),P(1,4,0),w=1,E=c-1);for(let v=w;v<E;v++){P(0,-1,v),P(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const r=(t+1)/(e+1);P(r,-1,v),P(r,1,v)}P(1,-2,v),P(1,2,v)}p?(P(0,-1,E),P(0,1,E)):(P(0,-5,E),P(0,5,E)),me(f,S+_,f,S,_);b=me(f,b-_,f,b,_),this._parameters.wireframe&&this._addWireframeVertices(s,S,b,_)}_getTransformedPosition(e,t,r,i){const s=3*r;c(e,t[s+0],t[s+1],t[s+2]),i&&b(e,e,i)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),o=i*Float32Array.BYTES_PER_ELEMENT;let a=0;const l=e=>a=me(n,e,s,a,o);for(let c=0;c<=n.length-4*o;c+=2*o)l(c),l(c+2*o),l(c+1*o),l(c+2*o),l(c+1*o),l(c+3*o)}}function me(e,t,r,i,s){for(let n=0;n<s;n++)r[i++]=e[t++];return i}function he(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function fe(e,t){return(e/2+Je)*t}function*de(e,t,r,i,s){const n=i.get("position").data,l=he(r,i)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;a(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const r=u%n.length;a(t,n[r]+c,n[r+1]+p),yield u/3,o(e,t)}}function ge(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function _e(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return re+r}}const be=new K,Se=y(),ye=y(),Pe=l(),ve=l(),we=y(),Ee=y(),xe=y(),Te=y(),je=y(),Le=y(),ze=r(),Ce=r(),Ae=i(),Me=i(),Re=y(),Ve=y(),Fe=L(),Oe=L(),Be=y(),Ue=y(),Ie=[r(),r(),r(),r()],Ne=[y(),y(),y(),y()],We=M(),ke=M(),De=M(),Ye=M(),Je=4,qe=[y(),y()];export{pe as Parameters,le as RibbonLineMaterial};
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as s,Seconds as n}from"../../../../core/time.js";import{copy as o,set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as c,subtract as p,dot as u,scale as m,add as h,copy as f,length as d,distance as g,lerp as _,transformMat4 as b,normalize as S}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 y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as v}from"../../../../geometry/support/float16.js";import{fromPoints as w,distance2 as E,closestLineSegmentPoint as x,projectPoint as T,projectPointFraction as j,create as L}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as C,getNormal as A,create as M}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as V,BufferViewFloat as R,BufferViewVec4Unorm8 as F,BufferViewVec4f16 as O,BufferViewUint32 as B}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as U,isColor as I,isDepth as N,isColorHighlightOLIDOrDepth as k,is2DGeometryOutput as W}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as D}from"../effects/geometry/olidUtils.js";import Y from"../lib/GLMaterial.js";import{LineMaterial as J}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as q,screenPolygonIntersectsBufferedSegment as X}from"../lib/screenPolygonOverlapUtils.js";import{Hit as G,DrapedHit as H}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as K}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as Q,assert as Z}from"../lib/Util.js";import{isImagePattern as $}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ee}from"./VisualVariablePassParameters.js";import{writeColor as te}from"./internal/bufferWriterUtils.js";import{n as ie}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as re,getTextureBufferLayout as se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as ne}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as oe}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class le extends J{constructor(e,t){super(e,pe),this.produces=new Map([[2,e=>U(e)||I(e)&&8===this.parameters.renderOccluded],[3,e=>N(e)],[10,e=>k(e)&&8===this.parameters.renderOccluded],[11,e=>k(e)&&8===this.parameters.renderOccluded],[4,e=>I(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>I(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>W(e)]]),this._configuration=new oe(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=_e(this.parameters.join,i),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&&ge(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&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=ae||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>ae}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},i,r,s,n,o){if(!i.options.selectionMode)return;const a=this._getLineSize(e,!0),l=r[0],c=r[1],p=fe(a,o);let u=Number.MAX_VALUE,m=0;for(const h of de(ye,ve,this.parameters,e)){const e=l-ye[0],i=c-ye[1],r=ve[0]-ye[0],s=ve[1]-ye[1],n=t((r*e+s*i)/(r*r+s*s),0,1),o=r*n-e,a=s*n-i,p=o*o+a*a;p<u&&(u=p,m=h)}u<p*p&&s(n.distance,n.renderDistance,n.normal,m)}intersectRay(t,i,r,s,n,a){const{options:l,camera:_,rayBegin:b,rayEnd:S}=r;if(!l.selectionMode||!t.visible||!_)return;if(!Q(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=t.attributes,y=P.get("position").data,v=this._getLineSize(P),T=Le;o(T,r.point);const j=v*_.pixelRatio,L=Je*_.pixelRatio,M=j/2+L;c(Ie[0],T[0]-M,T[1]+M,0),c(Ie[1],T[0]+M,T[1]+M,0),c(Ie[2],T[0]+M,T[1]-M,0),c(Ie[3],T[0]-M,T[1]-M,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(Ie[e],Ne[e]))return;z(_.eye,Ne[0],Ne[1],ke),z(_.eye,Ne[1],Ne[2],We),z(_.eye,Ne[2],Ne[3],De),z(_.eye,Ne[3],Ne[0],Ye);let V=Number.MAX_VALUE,R=0;for(const e of this._forEachTransformedLineSegment(Se,Pe,y,i,he(this.parameters,P))){if(C(ke,Se)<0&&C(ke,Pe)<0||C(We,Se)<0&&C(We,Pe)<0||C(De,Se)<0&&C(De,Pe)<0||C(Ye,Se)<0&&C(Ye,Pe)<0)continue;const t=_.projectToRenderScreen(Se,ze),i=_.projectToRenderScreen(Pe,Ce);if(null==t||null==i)continue;if(t[2]<0&&i[2]>0){p(Te,Se,Pe);const e=_.frustum,i=-C(e[4],Se)/u(Te,A(e[4]));if(m(Te,Te,i),h(Se,Se,Te),!_.projectToRenderScreen(Se,t))continue}else if(t[2]>0&&i[2]<0){p(Te,Pe,Se);const e=_.frustum,t=-C(e[4],Pe)/u(Te,A(e[4]));if(m(Te,Te,t),h(Pe,Pe,Te),!_.projectToRenderScreen(Pe,i))continue}else if(t[2]<0&&i[2]<0)continue;t[2]=0,i[2]=0;const r=w(t,i,Fe),s=E(r,T);if(!(s>=V)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(r,Se,Pe,T,_,v,L);if(s>=e*e)continue}V=s,f(Ve,Se),f(Re,Pe),R=e}}if(V<M*M){let e=Number.MAX_VALUE;if(x(w(Ve,Re,Fe),w(b,S,Oe),je)){p(je,je,b);const t=d(je);m(je,je,1/t),e=t/g(b,S)}a(e,e,je,R)}}intersectScreenPolygon(t,i,r,s){const{options:n,camera:o,screenPolygonPrimitiveProcessor:a}=r;if(!n.selectionMode||!t.visible)return null;if(!Q(i))return e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix"),null;const l=t.attributes,c=l.get("position").data,p=this._getLineSize(l),u=Je,m=u*o.pixelRatio,h=new G(4);for(const e of this._forEachTransformedLineSegment(Se,Pe,c,i,he(this.parameters,l)))for(const[t,i]of a.processLineSegment(qe,Se,Pe)){if(!q(o,t,i,ze,Ce))continue;const r=w(ze,Ce,Fe);let n=p/2+u;this.parameters.screenSizePerspective&&(_(Le,ze,Ce,.5),n=Math.max(n,this.computeScreenSizePerspectiveWidth(r,t,i,Le,o,p,m)/o.pixelRatio)),o.renderToScreen(ze,Ae),o.renderToScreen(Ce,Me),X(s,Ae,Me,n)&&(T(w(t,i,Oe),o.eye,we),h.updateIfCloserFromValues(g(o.eye,we),e,we,null))}return h}intersectScreenPolygonDraped({attributes:e},t,i,r,s){if(!i.options.selectionMode)return null;const n=fe(this._getLineSize(e,!0),s);for(const o of de(ye,ve,this.parameters,e,t))if(X(r,ye,ve,n))return new H(o);return null}createBufferWriter(){return new ue(re(this.parameters),se(this.parameters),this.parameters)}createGLMaterial(e){return new ce(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,i,r,s,n,o){const a=j(e,r);_(we,t,i,a),b(Ee,we,s.viewMatrix);const l=d(Ee),c=this.computeCameraAbsCosAngle(we,s,this._configuration.spherical);be.update(c,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return be.apply(n)*s.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,i){return i?S(je,e):c(je,0,0,1),p(xe,e,t.eye),S(xe,xe),Math.abs(u(je,xe))}_getLineSize(e,i=!1){let r=this.parameters.width;if(this.parameters.vvSize){const s=e.get("sizeFeatureAttribute").data[0];Number.isNaN(s)?i&&(r*=this.parameters.vvSize.fallback[0]):r*=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")&&(r*=e.get("size").data[0]);return r}*_forEachTransformedLineSegment(e,t,i,r,s){const n=s?i.length-2:i.length-5;for(let o=0;o<n;o+=3){e[0]=i[o]+r[12],e[1]=i[o+1]+r[13],e[2]=i[o+2]+r[14];const s=(o+3)%i.length;t[0]=i[s]+r[12],t[1]=i[s+1]+r[13],t[2]=i[s+2]+r[14],yield o/3}}}class ce extends Y{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(ne,e)}}class pe extends ee{constructor(){super(...arguments),this._width=0,this.color=y,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=n(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=n(0),this.endTime=n(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 $(this.stipplePattern)&&null!=this.stippleTexture}}class ue{constructor(e,t,i){this.layout=e,this.textureBufferLayout=t,this._parameters=i,this.numJoinSubdivisions=_e(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return he(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3+(this._isClosed(e)?3:2)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,n){null!=n&&this._writeTextureBuffer(e,i,n),null!=r&&this._writeVertexBuffer(e,i,r,s)}_writeTextureBuffer(e,t,i){const r=t.get("position"),s=r.data.length/3,n=this._isClosed(t),{buffer:o,offset:a}=i,l=o.getField("position",V),c=o.getField("u0",R),p=o.getField("sizeFeatureAttribute",R),u=o.getField("size",R),m=o.getField("colorFeatureAttribute",R),h=o.getField("color",F),d=o.getField("olidColor",F),_=o.getField("timeStamps",O),b=o.getField("opacityFeatureAttribute",R),S=t.get("sizeFeatureAttribute")?.data,P=t.get("size")?.data,y=t.get("colorFeatureAttribute")?.data,v=t.get("color")?.data,w=t.get("opacityFeatureAttribute")?.data,E=t.get("distanceToStart")?.data,x=t.get("timeStamps");Z(null!==l,"Expected valid position field in texture buffer"),Z(null!==c,"Expected valid u0 field in texture buffer");let T=0;for(let L=0;L<s;++L){this._getTransformedPosition(Ue,r.data,L,e),L>0&&(null!=E?T=E[L]??T:T+=g(Be,Ue));const t=a+L+1;if(l.setVec(t,Ue),c.set(t,T),f(Be,Ue),p&&p.set(t,1===S?.length?S[0]:S?.[L]??0),u&&u.set(t,1===P?.length?P[0]:P?.[L]??1),m&&m.set(t,1===y?.length?y[0]:y?.[L]??0),h)if(null!=v){const e=Math.min(4*L,v.length-4);h.setValues(t,v[e],v[e+1],v[e+2],v[e+3])}else h.setValues(t,1,1,1,1);b&&b.set(t,1===w?.length?w[0]:w?.[L]??0)}if(null!=_&&null!=x){Z(4===x.size);const e=x.data;for(let t=0;t<s;++t){const i=4*t,r=a+t+1;_.set(r,0,e[i]),_.set(r,1,e[i+1]),_.set(r,2,e[i+2]),_.set(r,3,e[i+3])}}if(n){const e=a,t=a+1,i=a+2,r=a+s,n=r+1,p=r+2;o.copyItem(r,e),o.copyItem(t,n),o.copyItem(i,p),l.getVec(r,Be),l.getVec(t,Ue);const u=T+g(Be,Ue);c.set(n,u)}else{const e=a,t=a+1,i=a+s,r=i+1;o.copyItem(t,e),o.copyItem(i,r)}const j=t.get("olidColor");D()&&null!=j&&null!=d&&te(j,4,d,a)}_writeVertexBuffer(e,t,i,r){const{buffer:s,offset:n}=i,{layout:o}=this,a=t.get("position"),l=a.indices,c=a.data.length/3,p=this._isClosed(t),u=c+(p?3:2);l&&l.length!==2*(c-1)&&console.warn("RibbonLineMaterial does not support indices");const m=s.getField("textureElementIndex",B);Z(null!=m,"Missing texture buffer index field"),Z(null!=r,"Using a texture layout, but the texture range for this instance was not provided");const h=r.from;Z(r.numElements===u,"Expected number of elements in TextureBuffer to equal number of points");const f=new Float32Array(s.buffer),d=v(s.buffer),g=new Uint32Array(s.buffer),_=o.stride/4;let b=n*_;const S=b,P=f.BYTES_PER_ELEMENT/d.BYTES_PER_ELEMENT,y=(e,t,i)=>{const r=i+1;g[b]=h+r,b++;let s=b*P;d[s++]=e,d[s++]=t,b=Math.ceil(s/P)};b+=_;let w=0,E=0;p?(w=0,E=c):(y(1,-4,0),y(1,4,0),w=1,E=c-1);for(let v=w;v<E;v++){y(0,-1,v),y(0,1,v);const e=this.numJoinSubdivisions;for(let t=0;t<e;++t){const i=(t+1)/(e+1);y(i,-1,v),y(i,1,v)}y(1,-2,v),y(1,2,v)}p?(y(0,-1,E),y(0,1,E)):(y(0,-5,E),y(0,5,E)),me(f,S+_,f,S,_);b=me(f,b-_,f,b,_),this._parameters.wireframe&&this._addWireframeVertices(s,S,b,_)}_getTransformedPosition(e,t,i,r){const s=3*i;c(e,t[s+0],t[s+1],t[s+2]),r&&b(e,e,r)}_addWireframeVertices(e,t,i,r){const s=new Uint8Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),n=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(i-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT;let a=0;const l=e=>a=me(n,e,s,a,o);for(let c=0;c<=n.length-4*o;c+=2*o)l(c),l(c+2*o),l(c+1*o),l(c+2*o),l(c+1*o),l(c+3*o)}}function me(e,t,i,r,s){for(let n=0;n<s;n++)i[r++]=e[t++];return r}function he(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function fe(e,t){return(e/2+Je)*t}function*de(e,t,i,r,s){const n=r.get("position").data,l=he(i,r)?n.length-2:n.length-5,c=s?.[0]??0,p=s?.[1]??0;a(e,n[0]+c,n[1]+p);for(let u=3;u<l+3;u+=3){const i=u%n.length;a(t,n[i]+c,n[i+1]+p),yield u/3,o(e,t)}}function ge(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function _e(e,t){const i=t?1:0;switch(e){case"miter":case"bevel":return i;case"round":return ie+i}}const be=new K,Se=P(),Pe=P(),ye=l(),ve=l(),we=P(),Ee=P(),xe=P(),Te=P(),je=P(),Le=P(),ze=i(),Ce=i(),Ae=r(),Me=r(),Ve=P(),Re=P(),Fe=L(),Oe=L(),Be=P(),Ue=P(),Ie=[i(),i(),i(),i()],Ne=[P(),P(),P(),P()],ke=M(),We=M(),De=M(),Ye=M(),Je=4,qe=[P(),P()];export{pe as Parameters,le as RibbonLineMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t,deg2rad as i}from"../../../../core/mathUtils.js";import{subtract as e,normalize as s,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{direction as h,set as o,cross as a,normalize as _,scale as c,dot as l,negate as p,add as g,lerp as d,equals as m,copy as u}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 D,fromPositionAndNormal as x,signedDistance as b,copy as V,
|
|
2
|
+
import{clamp as t,deg2rad as i}from"../../../../core/mathUtils.js";import{subtract as e,normalize as s,dot as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{direction as h,set as o,cross as a,normalize as _,scale as c,dot as l,negate as p,add as g,lerp as d,equals as m,copy as u}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 D,fromPositionAndNormal as x,signedDistance as b,copy as V,isPointInClosedPositiveHalfspace as N,projectPoint as y,getNormal as P,intersectLine as Z}from"../../../../geometry/support/plane.js";import{angle as X,projectPointSignedLength as Y}from"../../../../geometry/support/vector.js";import{intersectLineAndRay as T}from"../../../support/geometry2dUtils.js";class M{get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}constructor(t,i,e,s=0,n=0){this._helper=t,this._planeType=i,this._edge=e,this.distance=s,this._plane=D(),this._offsetPlane=D(),this._minDistance=-1/0,this._maxDistance=1/0,this._selectedArrow=1,0===n&&this._initialize()}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){const t=this._toXYZ(this._edge.leftVertex.pos),i=this._toXYZ(this._edge.leftVertex.leftSegment?.leftVertex?.pos),e=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ(this._edge.rightVertex.rightSegment?.rightVertex?.pos);this._edgeDirection=h(f(),t,e),i?(this._left=this._computeNeighbor(t,i,this._edgeDirection),this._right=this._computeNeighbor(e,s,this._edgeDirection,this._left)):(this._right=this._computeNeighbor(e,s,this._edgeDirection),this._left=this._computeNeighbor(t,i,this._edgeDirection,this._right))}_toXYZ(t){return null!=t?this._helper.toXYZ(t):null}_pointToXYZ(t){return this._toXYZ(this._helper.pointToVector(t))}_computeNeighbor(t,i,e,s){const n=f();if(i){h(n,t,i);const s=!this._passesBisectingAngleThreshold(n,e);return{start:t,end:i,direction:s?this._bisectVectorsPerpendicular(e,n):n,isOriginalDirection:!s}}return this._helper.hasZ()?s&&(a(n,e,s.direction),a(n,n,e),_(n,n),Math.sign(n[1])!==Math.sign(e[0])&&c(n,n,-1)):o(n,-e[1],e[0],0),{start:t,end:i,direction:n,isOriginalDirection:!0}}_passesBisectingAngleThreshold(t,i){const e=Math.abs(X(i,t));return e>=z&&e<=Math.PI-z}_bisectVectorsPerpendicular(t,i){const e=l(t,i)<0?t:p(f(),t),s=Math.abs(l(e,i));if(!(s<A||s>1-A))return this._bisectDirection(e,i);const n=a(f(),e,[0,0,1]);return _(n,n)}_bisectDirection(t,i){const e=g(f(),t,i);return _(e,e)}_initializePlane(){const t=this._computeNormalDirection(this._left),i=this._computeNormalDirection(this._right);l(t,i)<0&&p(i,i),x(this._left.start,this._bisectDirection(t,i),this._plane)}_computeNormalDirection(t){const i=a(f(),t.direction,this._edgeDirection);_(i,i);const e=a(f(),this._edgeDirection,i);return 1===this._planeType&&(e[2]=0),_(e,e)}_initializeDistanceConstraints(){null==this._left.end||this.requiresSplitEdgeLeft||this._updateDistanceConstraint(b(this._plane,this._left.end)),null==this._right.end||this.requiresSplitEdgeRight||this._updateDistanceConstraint(b(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(t){t<=0&&(this._minDistance=Math.max(this._minDistance,t)),t>=0&&(this._maxDistance=Math.min(this._maxDistance,t))}_updateIntersectDistanceConstraint(t){const i=P(t),h=this._edgeDirection,o=g(f(),this._left.start,this._left.direction),a=g(f(),this._right.start,this._right.direction),_=this._pointInBasis2D(r(),i,h,this._left.start),l=this._pointInBasis2D(r(),i,h,o),p=this._pointInBasis2D(r(),i,h,this._right.start),d=this._pointInBasis2D(r(),i,h,a),[m]=T({start:l,end:_,type:1},{start:d,end:p,type:1});if(!m)return;const u=e(r(),_,l);s(u,u);const D=e(r(),m,l),x=n(u,D),V=g(f(),o,c(f(),this._left.direction,-x)),N=b(t,V);this._updateDistanceConstraint(N)}_pointInBasis2D(t,i,e,s){return t[0]=Y(i,s),t[1]=Y(e,s),t}_offset(t,i){Number.isFinite(this._minDistance)&&(i=Math.max(this._minDistance,i)),Number.isFinite(this._maxDistance)&&(i=Math.min(this._maxDistance,i)),V(this._offsetPlane,this._plane),this._offsetPlane[3]-=i;const e=(t,i,e)=>null!=i&&Z(this._offsetPlane,t,g(f(),t,i),e),s=f();(t===this._edge.leftVertex?e(this._left.start,this._left.direction,s):e(this._right.start,this._right.direction,s))&&this._helper.copy(this._helper.fromXYZ(s,void 0,this._helper.getM(t.pos)),t.pos)}selectArrowFromStartPoint(t){this._selectedArrow=N(this.plane,this._pointToXYZ(t))?1:-1}get selectedArrow(){return this._selectedArrow}signedDistanceToPoint(t){return b(this.plane,this._pointToXYZ(t))}clampedStartAndEnd(i){const e=this._helper.toXYZ(this._helper.pointToVector(i)),s=y(this._plane,e,f()),n=b(this._plane,e),r=t(n,this._minDistance,this._maxDistance);return d(e,s,e,r/n),{start:s,end:e}}apply(t){this._offset(t,this.distance)}undo(t){this._offset(t,0)}canAccumulate(t){return t instanceof M&&this._edge.leftVertex.index===t._edge.leftVertex.index&&this._edge.rightVertex.index===t._edge.rightVertex.index&&this._edge.part===t._edge.part&&this._maybeEqualsVec3(this._left.direction,t._left.direction)&&this._maybeEqualsVec3(this._right.direction,t._right.direction)&&m(P(this._plane),P(t._plane))}accumulate(t,i){const e=this._plane[3]-i._plane[3]+i.distance;this._offset(t,e)}accumulateParams(t){const i=t.distance-t._plane[3];this.distance=i+this._plane[3]}clone(){const t=new M(this._helper,this._planeType,this._edge,this.distance,1);return V(t._plane,this._plane),V(t._offsetPlane,this._offsetPlane),t._maxDistance=this._maxDistance,t._minDistance=this._minDistance,t._left=this._cloneNeighbor(this._left),t._right=this._cloneNeighbor(this._right),t._edgeDirection=u(f(),this._edgeDirection),t}_maybeEqualsVec3(t,i){return null==t&&null==i||null!=t&&null!=i&&m(t,i)}_cloneNeighbor({start:t,end:i,direction:e,isOriginalDirection:s}){return{start:u(f(),t),end:null!=i?u(f(),i):null,direction:u(f(),e),isOriginalDirection:s}}}const z=i(15),A=.001;export{M as OffsetEdgeVertex};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as r}from"../../../core/mathUtils.js";import{exactEquals as s,set as n,dot as i,subtract as o,squaredDistance as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as a,set as h,squaredDistance as l,equals as f,copy as d,subtract as p,scaleAndAdd as m,sub as g,squaredLength as _,dot as x,cross as L,normalize as k}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UNIT_Z as y,create as v,fromValues as z,clone as M}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as P,dot as q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{directGeodeticSolver as w,inverseGeodeticSolver as j,InverseGeodeticSolverResult as D}from"../../../geometry/geodesicUtils.js";import{toRadians as b}from"../../../geometry/support/geodesicConstants.js";import{fromPositionAndNormal as R,create as A,fromPoints as U,intersectLine as Z,signedDistance as C,projectPoint as I,getNormal as O,distance as S}from"../../../geometry/support/plane.js";import{Sphere as E}from"../../../geometry/support/sphere.js";import{closestPointOnCurve as G}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as V,curveEquals as B}from"../../../geometry/support/curves/curveUtils.js";import{tangentFrame as F}from"../../3d/support/mathUtils.js";import{clone as H,create as J,fromValues as K,createWritable as N,asVec2 as Q,fromVec3 as W}from"./normalizedPoint.js";import{projectPointToVerticalCylinder as X,intersectLineLikes as Y,intersectVerticalPlaneAndLineLike as $,intersectLineLikeAndVerticalCylinder as tt,intersectLineLikeAndCircle as et,intersectVerticalPlanes as rt,intersectVerticalPlaneAndVerticalCylinder as st,intersectVerticalCylinders as nt,projectPointToVerticalPlane as it,intersectVerticalPlaneAndPoint as ot,vectorsHaveCloseZ as ct,isClose as ut,isPointInsidePlane as at,projectPointToLineLike as ht,pointsInsidePlane as lt}from"../../support/geometry3dUtils.js";class ft{intersect(t){return Vt(this,t)}closestPoints(t){return[this.closestTo(t)]}}class dt extends ft{constructor(t){super(),this.point=t}equals(t){return this===t||ge(t)&&a(this.point,t.point)}closestTo(){return H(this.point)}}class pt extends ft{constructor(t,e,r){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:r}}equals(t){return this===t||_e(t)&&this.lineLike.type===t.lineLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=N();return ht(t,this.lineLike,e),e}}class mt extends pt{constructor(t,e){super(t,e,1)}}class gt extends ft{constructor(t,e){super(),this.start=t,this.curve=e}closestTo(t){const{curvePoint:e,t:r}=G(this.start,this.curve,t),s=V(this.curve)[2]??0,n=this.start[2]*(1-r)+s*r;return J(e[0],e[1],n)}equals(t){return this===t||xe(t)&&a(this.start,t.start)&&B(this.curve,t.curve)}}class _t extends pt{constructor(t,e){super(t,e,0)}}class xt extends ft{constructor(t){super(),this.constraints=t}equals(t){return this===t||me(t)&&e(this.constraints,t.constraints,(t,e)=>t.equals(e))}closestTo(t){let e,r=1/0;for(const s of this.constraints){const n=s.closestTo(t),i=l(t,n);i<r&&(r=i,e=n)}return H(e??t)}closestPoints(t){return this.constraints.flatMap(e=>e===this?[]:e.closestPoints(t))}}class Lt extends ft{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ye(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=N();return X(t,this.center,this.radius,e),e}}class kt extends ft{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ve(t)&&a(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=N();return X(t,this.center,this.radius,e),e[2]=this.center[2],e}asCircle(){return new yt(H(this.center),this.radius,K(0,0,1))}}class yt extends ft{constructor(t,e,r,s){super(),this.center=t,this.radius=e,this.normal=r,this.slicePlane=s}equals(t){return this===t||ze(t)&&a(this.center,t.center)&&a(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:r}=this;I(this.getPlane(zt),t,vt);const s=g(vt,vt,e),n=_(s);if(ut(n,0))return H(t);const i=r/Math.sqrt(n),o=N();m(o,e,s,i);const{slicePlane:c}=this;if(c&&!at(c,o)){const e=Jt(c,this);return e?.closestTo(t)??H(t)}return o}getPlane(t=A()){return R(this.center,this.normal,t)}}const vt=v(),zt=A();class Mt extends ft{constructor(t){super(),this.z=t}equals(t){return this===t||Le(t)&&this.z===t.z}closestTo(t){return K(t[0],t[1],this.z)}getPlane(t=A()){return h(Pt,0,0,this.z),R(Pt,y,t)}}const Pt=v();class qt extends ft{constructor(t,e,r){super(),this.start=t,this.end=e,this.planeLike={start:Q(t),end:Q(e),type:r}}equals(t){return this===t||ke(t)&&this.planeLike.type===t.planeLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=N();return it(t,this.planeLike,e),e}closestEndTo(t){const{start:e,end:r}=this.planeLike;return Math.sign(i(o(Tt,r,e),o(wt,Q(t),e)))>0?this.end:this.start}getPlane(t=A()){const e=d(jt,this.end);return e[2]+=1,U(this.start,this.end,e,t)}getSlicePlane(t=A()){const{start:e,end:r,type:s}=this.planeLike;if(0===s)return;const n=h(jt,e[0],e[1],0),i=h(Dt,r[0],r[1],0),o=p(Dt,i,n);return R(n,o,t),t}}const Tt=u(),wt=u(),jt=v(),Dt=v();class bt extends qt{constructor(t,e){super(t,e,1)}}class Rt extends qt{constructor(t,e){super(t,e,0)}}class At extends ft{constructor(t,e){super(),this.sphere=new E(t,e),this._center=M(t)}equals(t){return this===t||Me(t)&&this.sphere.exactEquals(t.sphere)}closestTo(t){const e=N();return this.sphere.projectPoint(t,e),e}get center(){return this._center}get radius(){return this.sphere.radius}}class Ut extends ft{constructor(t,e,r){super(),this.start=t,this.end=e,this.getZ=r,this.planeLike={start:Q(t),end:Q(e),type:0}}equals(t){return this===t||Pe(t)&&a(this.start,t.start)&&a(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return Gt(this,t)}addIfOnTheGround(t,e){for(const r of e){const e=this.getZ(r[0],r[1])??0;ut(r[2],e)&&(r[2]=e,t.push(r))}}}class Zt extends ft{constructor(t,e,r){super(),this._x=t,this._y=e,this._z=r}equals(t){return this===t||Te(t)&&this._x===t._x&&this._y===t._y&&this._z===t._z}closestTo([t,e,r]){return J(this._x??t,this._y??e,this._z??r)}}class Ct extends ft{constructor(t,e,r,s,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=r,this._z=s,this._directionDegrees=n}equals(t){return this===t||qe(t)&&s(this._origin,t._origin)&&this._spatialReference===t._spatialReference&&this._distanceMeters===t._distanceMeters&&this._z===t._z&&this._directionDegrees===t._directionDegrees}closestTo([t,e,r]){return n(It,t,e),s(It,this._origin)||this._applyDirectionAndDistance(It),J(It[0],It[1],this._z??r)}_applyDirectionAndDistance(t){if(null!=this._directionDegrees&&null!=this._distanceMeters)w(t,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)St(t,this._origin,this._directionDegrees,t,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:e}=j(Ot,this._origin,t,this._spatialReference);w(t,this._origin,e??0,this._distanceMeters,this._spatialReference)}}}const It=[0,0],Ot=new D;function St(t,e,r,s,n){let{azimuth:i,distance:o}=j(Et,e,s,n);i??=0;let c=o*Math.cos((i-r)*b);c=Math.max(0,c),w(t,e,r,c,n)}const Et=new D;function Gt(t,e){const r=N();return it(e,t.planeLike,r),r[2]=t.getZ(r[0],r[1])??we,r}function Vt(t,e){if(me(t)){const r=[];for(const s of t.constraints){const t=s.intersect(e);t&&r.push(t)}return pe(r)}if(me(e))return Vt(e,t);if(Pe(t))return he(t,e);if(Pe(e))return he(e,t);if(ge(t)){const{point:r}=t;if(ge(e))return a(r,e.point)?t:void 0;const s=e.closestTo(r);return f(s,r)?t:void 0}if(_e(t)){if(ge(e))return Vt(e,t);if(_e(e))return fe(Y(t.lineLike,e.lineLike));if(Le(e))return Bt(t,e);if(ke(e))return fe($(e.planeLike,t.lineLike));if(ye(e))return fe(tt(t.lineLike,e.center,e.radius));if(ze(e))return fe(et(t.lineLike,e));if(ve(e))return Ft(t,e);if(Me(e))return Ht(t,e)}else if(xe(t)){if(ge(e))return Vt(e,t)}else if(Le(t)){if(ge(e)||_e(e))return Vt(e,t);if(Le(e))return Kt(t,e);if(ke(e))return Nt(t,e);if(ye(e))return Qt(t,e);if(ze(e))return Xt(t,e);if(ve(e))return Wt(t,e);if(Me(e))return Yt(t,e)}else if(ke(t)){if(ge(e)||_e(e)||Le(e))return Vt(e,t);if(ke(e))return le(rt(t.planeLike,e.planeLike));if(ye(e))return le(st(t.planeLike,e.center,e.radius));if(ze(e))return te(t,e);if(ve(e))return $t(t,e);if(Me(e))return ee(t,e)}else if(ye(t)){if(ge(e)||_e(e)||Le(e)||ke(e))return Vt(e,t);if(ye(e))return le(nt(Q(t.center),t.radius,Q(e.center),e.radius));if(ze(e))return re();if(ve(e))return se(t,e);if(Me(e))return ne()}else if(ze(t)){if(ge(e)||_e(e)||Le(e)||ke(e)||ye(e))return Vt(e,t);if(ze(e))return ie();if(ve(e))return ie(e.asCircle());if(Me(e))return oe()}else if(ve(t)){if(ge(e)||_e(e)||Le(e)||ke(e)||ye(e)||ze(e))return Vt(e,t);if(ve(e))return ce(e,t);if(Me(e))return ue()}else if(Me(t)){if(ge(e)||_e(e)||Le(e)||ke(e)||ye(e)||ve(e))return Vt(e,t);if(Me(e))return ae()}}const Bt=(()=>{const t=A();return(e,r)=>{const{start:s,end:n}=e;if(ct(s,n)&&ut(s[2],r.z))return e;const i=N();return Z(r.getPlane(t),s,n,i)?new dt(i):void 0}})();function Ft({lineLike:t},{center:e,radius:r}){const s=e[2];return fe(tt(t,e,r).filter(t=>ut(t[2],s)))}function Ht({lineLike:t},{sphere:e}){return fe(e.intersectLine(t.start,t.end))}const Jt=(()=>{const t=T(),e=v(),s=v();return(n,i,o)=>{const{normal:c,center:u,radius:a}=i;F(c,e,s);const h=O(n),l=a*x(h,e),f=a*x(h,s);P(t,u[0],u[1],u[2],1);const d=q(n,t),p=Math.hypot(l,f),g=ut(p,0);if(ut(S(n,u),0)){if(g)return i;if(ut(a,0))return!o||at(o,u)?new dt(H(u)):void 0;L(e,h,c),k(e,e);const t=new Array,r=M(u);m(r,r,e,a),o&&!at(o,r)||t.push(r);const s=M(u);return m(s,s,e,-a),o&&!at(o,s)||t.push(s),fe(t)}if(g)return;const _=-d/p;if(Math.abs(_)>1||ut(_,1))return;const y=Math.atan(l/f),z=r(_)-y,T=Math.PI-z,w=new Array,j=v();m(j,u,e,a*Math.cos(z)),m(j,j,s,a*Math.sin(z)),w.push(j);const D=v();return m(D,u,e,a*Math.cos(T)),m(D,D,s,a*Math.sin(T)),w.push(D),fe(o?lt(o,w):w)}})();function Kt(t,e){return ut(t.z,e.z)?t:void 0}function Nt({z:t},{planeLike:e}){const[r,s]=e.start,[n,i]=e.end,o=K(r,s,t),c=K(n,i,t);return 0===e.type?new mt(o,c):new _t(o,c)}function Qt(t,e){const[r,s]=e.center;return new kt(K(r,s,t.z),e.radius)}function Wt(t,e){return ut(e.center[2],t.z)?e:void 0}const Xt=(()=>{const t=A();return(e,r)=>Jt(e.getPlane(t),r,r.slicePlane)})();function Yt(t,{center:e,radius:r}){const s=Math.abs(e[2]-t.z);if(s>r&&!ut(s,r))return;const n=K(e[0],e[1],t.z),i=Math.sqrt(r**2-s**2);return ut(i,0)?void 0:new kt(n,i)}const $t=(()=>{const t=A();return(e,{center:r,radius:s})=>{const n=st(e.planeLike,r,s),i=r[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];at(t,e)&&o.push(e)}return fe(o)}})(),te=(()=>{const t=A(),e=A();return(r,s)=>Jt(r.getPlane(t),s,r.getSlicePlane(e))})(),ee=(()=>{const t=A();return(e,{center:r,radius:s})=>{const n=e.getPlane(t),i=C(n,r),o=Math.abs(i);if(o>s&&!ut(o,s))return;const c=Math.sqrt(s**2-i**2);if(ut(c,0)){const t=N();return I(n,r,t),new dt(t)}const u=N(),a=M(O(n));return m(u,r,a,i),new yt(u,c,a,e.getSlicePlane())}})();function re(t,e){}function se(t,e){const r=c(Q(t.center),Q(e.center));if(ut(r,0)&&ut(t.radius,e.radius))return e;return de(nt(Q(t.center),t.radius,Q(e.center),e.radius),e.center[2])}function ne(t,e){}function ie(t,e){}function oe(t,e){}function ce(t,e){if(!ct(t.center,e.center))return;const r=c(Q(t.center),Q(e.center));if(ut(r,0)&&ut(t.radius,e.radius))return t;return de(nt(Q(t.center),t.radius,Q(e.center),e.radius),t.center[2])}function ue(t,e){}function ae(t,e){}function he(t,e){const{planeLike:r,getZ:s}=t,n=new Array;if(ge(e))t.addIfOnTheGround(n,ot(r,e.point));else if(_e(e))t.addIfOnTheGround(n,$(r,e.lineLike));else if(ye(e))for(const[i,o]of st(r,e.center,e.radius)){const t=s(i,o);null!=t&&n.push(z(i,o,t))}else if(ke(e)||Pe(e))for(const[i,o]of rt(r,e.planeLike)){const t=s(i,o)??we;n.push(z(i,o,t))}return fe(n)}function le(t){return pe(t.map(([t,e])=>{const r=K(t,e,0),s=K(t,e,1);return new mt(r,s)}))}function fe(t){return pe(t.map(t=>t?new dt(W(t)):void 0))}function de(t,e){return fe(t.map(([t,r])=>[t,r,e]))}function pe(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new xt(e.filter(t))}function me(t){return t instanceof xt}function ge(t){return t instanceof dt}function _e(t){return t instanceof pt}function xe(t){return t instanceof gt}function Le(t){return t instanceof Mt}function ke(t){return t instanceof qt}function ye(t){return t instanceof Lt}function ve(t){return t instanceof kt}function ze(t){return t instanceof yt}function Me(t){return t instanceof At}function Pe(t){return t instanceof Ut}function qe(t){return t instanceof Ct}function Te(t){return t instanceof Zt}const we=0;export{yt as CircleConstraint,ft as Constraint,Zt as CoordinateConstraint,gt as CurveConstraint,Ut as DrapedLineConstraint,Ct as GeodesicConstraint,kt as HorizontalCircleConstraint,Mt as HorizontalPlaneConstraint,mt as LineConstraint,pt as LineLikeConstraint,dt as PointConstraint,_t as RayConstraint,xt as SetConstraint,At as SphereConstraint,Lt as VerticalCylinderConstraint,bt as VerticalHalfPlaneConstraint,Rt as VerticalPlaneConstraint,qt as VerticalPlaneLikeConstraint,pe as constraintOrSet,xe as isCurve,Pe as isDrapedLine,_e as isLine,ge as isPoint};
|
|
2
|
+
import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as r}from"../../../core/mathUtils.js";import{exactEquals as s,set as n,dot as i,subtract as o,squaredDistance as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as a,set as h,squaredDistance as l,equals as f,copy as d,subtract as p,scaleAndAdd as m,sub as g,squaredLength as _,dot as x,cross as L,normalize as k}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UNIT_Z as y,create as v,fromValues as z,clone as M}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as P,dot as q}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{directGeodeticSolver as w,inverseGeodeticSolver as j,InverseGeodeticSolverResult as D}from"../../../geometry/geodesicUtils.js";import{toRadians as b}from"../../../geometry/support/geodesicConstants.js";import{fromPositionAndNormal as R,create as A,fromPoints as U,intersectLine as Z,signedDistance as C,projectPoint as I,getNormal as O,distance as S}from"../../../geometry/support/plane.js";import{Sphere as E}from"../../../geometry/support/sphere.js";import{closestPointOnCurve as G}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as V,curveEquals as B}from"../../../geometry/support/curves/curveUtils.js";import{tangentFrame as F}from"../../3d/support/mathUtils.js";import{clone as H,create as J,fromValues as K,createWritable as N,asVec2 as Q,fromVec3 as W}from"./normalizedPoint.js";import{projectPointToVerticalCylinder as X,intersectLineLikes as Y,intersectVerticalPlaneAndLineLike as $,intersectLineLikeAndVerticalCylinder as tt,intersectLineLikeAndCircle as et,intersectVerticalPlanes as rt,intersectVerticalPlaneAndVerticalCylinder as st,intersectVerticalCylinders as nt,projectPointToVerticalPlane as it,intersectVerticalPlaneAndPoint as ot,vectorsHaveCloseZ as ct,isClose as ut,isPointInClosedPositiveHalfspace as at,projectPointToLineLike as ht,arePointsInClosedPositiveHalfspace as lt}from"../../support/geometry3dUtils.js";class ft{intersect(t){return Vt(this,t)}closestPoints(t){return[this.closestTo(t)]}}class dt extends ft{constructor(t){super(),this.point=t}equals(t){return this===t||ge(t)&&a(this.point,t.point)}closestTo(){return H(this.point)}}class pt extends ft{constructor(t,e,r){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:r}}equals(t){return this===t||_e(t)&&this.lineLike.type===t.lineLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=N();return ht(t,this.lineLike,e),e}}class mt extends pt{constructor(t,e){super(t,e,1)}}class gt extends ft{constructor(t,e){super(),this.start=t,this.curve=e}closestTo(t){const{curvePoint:e,t:r}=G(this.start,this.curve,t),s=V(this.curve)[2]??0,n=this.start[2]*(1-r)+s*r;return J(e[0],e[1],n)}equals(t){return this===t||xe(t)&&a(this.start,t.start)&&B(this.curve,t.curve)}}class _t extends pt{constructor(t,e){super(t,e,0)}}class xt extends ft{constructor(t){super(),this.constraints=t}equals(t){return this===t||me(t)&&e(this.constraints,t.constraints,(t,e)=>t.equals(e))}closestTo(t){let e,r=1/0;for(const s of this.constraints){const n=s.closestTo(t),i=l(t,n);i<r&&(r=i,e=n)}return H(e??t)}closestPoints(t){return this.constraints.flatMap(e=>e===this?[]:e.closestPoints(t))}}class Lt extends ft{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ye(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=N();return X(t,this.center,this.radius,e),e}}class kt extends ft{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ve(t)&&a(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=N();return X(t,this.center,this.radius,e),e[2]=this.center[2],e}asCircle(){return new yt(H(this.center),this.radius,K(0,0,1))}}class yt extends ft{constructor(t,e,r,s){super(),this.center=t,this.radius=e,this.normal=r,this.slicePlane=s}equals(t){return this===t||ze(t)&&a(this.center,t.center)&&a(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:r}=this;I(this.getPlane(zt),t,vt);const s=g(vt,vt,e),n=_(s);if(ut(n,0))return H(t);const i=r/Math.sqrt(n),o=N();m(o,e,s,i);const{slicePlane:c}=this;if(c&&!at(c,o)){const e=Jt(c,this);return e?.closestTo(t)??H(t)}return o}getPlane(t=A()){return R(this.center,this.normal,t)}}const vt=v(),zt=A();class Mt extends ft{constructor(t){super(),this.z=t}equals(t){return this===t||Le(t)&&this.z===t.z}closestTo(t){return K(t[0],t[1],this.z)}getPlane(t=A()){return h(Pt,0,0,this.z),R(Pt,y,t)}}const Pt=v();class qt extends ft{constructor(t,e,r){super(),this.start=t,this.end=e,this.planeLike={start:Q(t),end:Q(e),type:r}}equals(t){return this===t||ke(t)&&this.planeLike.type===t.planeLike.type&&a(this.start,t.start)&&a(this.end,t.end)}closestTo(t){const e=N();return it(t,this.planeLike,e),e}closestEndTo(t){const{start:e,end:r}=this.planeLike;return Math.sign(i(o(Tt,r,e),o(wt,Q(t),e)))>0?this.end:this.start}getPlane(t=A()){const e=d(jt,this.end);return e[2]+=1,U(this.start,this.end,e,t)}getSlicePlane(t=A()){const{start:e,end:r,type:s}=this.planeLike;if(0===s)return;const n=h(jt,e[0],e[1],0),i=h(Dt,r[0],r[1],0),o=p(Dt,i,n);return R(n,o,t),t}}const Tt=u(),wt=u(),jt=v(),Dt=v();class bt extends qt{constructor(t,e){super(t,e,1)}}class Rt extends qt{constructor(t,e){super(t,e,0)}}class At extends ft{constructor(t,e){super(),this.sphere=new E(t,e),this._center=M(t)}equals(t){return this===t||Me(t)&&this.sphere.exactEquals(t.sphere)}closestTo(t){const e=N();return this.sphere.projectPoint(t,e),e}get center(){return this._center}get radius(){return this.sphere.radius}}class Ut extends ft{constructor(t,e,r){super(),this.start=t,this.end=e,this.getZ=r,this.planeLike={start:Q(t),end:Q(e),type:0}}equals(t){return this===t||Pe(t)&&a(this.start,t.start)&&a(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return Gt(this,t)}addIfOnTheGround(t,e){for(const r of e){const e=this.getZ(r[0],r[1])??0;ut(r[2],e)&&(r[2]=e,t.push(r))}}}class Zt extends ft{constructor(t,e,r){super(),this._x=t,this._y=e,this._z=r}equals(t){return this===t||Te(t)&&this._x===t._x&&this._y===t._y&&this._z===t._z}closestTo([t,e,r]){return J(this._x??t,this._y??e,this._z??r)}}class Ct extends ft{constructor(t,e,r,s,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=r,this._z=s,this._directionDegrees=n}equals(t){return this===t||qe(t)&&s(this._origin,t._origin)&&this._spatialReference===t._spatialReference&&this._distanceMeters===t._distanceMeters&&this._z===t._z&&this._directionDegrees===t._directionDegrees}closestTo([t,e,r]){return n(It,t,e),s(It,this._origin)||this._applyDirectionAndDistance(It),J(It[0],It[1],this._z??r)}_applyDirectionAndDistance(t){if(null!=this._directionDegrees&&null!=this._distanceMeters)w(t,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)St(t,this._origin,this._directionDegrees,t,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:e}=j(Ot,this._origin,t,this._spatialReference);w(t,this._origin,e??0,this._distanceMeters,this._spatialReference)}}}const It=[0,0],Ot=new D;function St(t,e,r,s,n){let{azimuth:i,distance:o}=j(Et,e,s,n);i??=0;let c=o*Math.cos((i-r)*b);c=Math.max(0,c),w(t,e,r,c,n)}const Et=new D;function Gt(t,e){const r=N();return it(e,t.planeLike,r),r[2]=t.getZ(r[0],r[1])??we,r}function Vt(t,e){if(me(t)){const r=[];for(const s of t.constraints){const t=s.intersect(e);t&&r.push(t)}return pe(r)}if(me(e))return Vt(e,t);if(Pe(t))return he(t,e);if(Pe(e))return he(e,t);if(ge(t)){const{point:r}=t;if(ge(e))return a(r,e.point)?t:void 0;const s=e.closestTo(r);return f(s,r)?t:void 0}if(_e(t)){if(ge(e))return Vt(e,t);if(_e(e))return fe(Y(t.lineLike,e.lineLike));if(Le(e))return Bt(t,e);if(ke(e))return fe($(e.planeLike,t.lineLike));if(ye(e))return fe(tt(t.lineLike,e.center,e.radius));if(ze(e))return fe(et(t.lineLike,e));if(ve(e))return Ft(t,e);if(Me(e))return Ht(t,e)}else if(xe(t)){if(ge(e))return Vt(e,t)}else if(Le(t)){if(ge(e)||_e(e))return Vt(e,t);if(Le(e))return Kt(t,e);if(ke(e))return Nt(t,e);if(ye(e))return Qt(t,e);if(ze(e))return Xt(t,e);if(ve(e))return Wt(t,e);if(Me(e))return Yt(t,e)}else if(ke(t)){if(ge(e)||_e(e)||Le(e))return Vt(e,t);if(ke(e))return le(rt(t.planeLike,e.planeLike));if(ye(e))return le(st(t.planeLike,e.center,e.radius));if(ze(e))return te(t,e);if(ve(e))return $t(t,e);if(Me(e))return ee(t,e)}else if(ye(t)){if(ge(e)||_e(e)||Le(e)||ke(e))return Vt(e,t);if(ye(e))return le(nt(Q(t.center),t.radius,Q(e.center),e.radius));if(ze(e))return re();if(ve(e))return se(t,e);if(Me(e))return ne()}else if(ze(t)){if(ge(e)||_e(e)||Le(e)||ke(e)||ye(e))return Vt(e,t);if(ze(e))return ie();if(ve(e))return ie(e.asCircle());if(Me(e))return oe()}else if(ve(t)){if(ge(e)||_e(e)||Le(e)||ke(e)||ye(e)||ze(e))return Vt(e,t);if(ve(e))return ce(e,t);if(Me(e))return ue()}else if(Me(t)){if(ge(e)||_e(e)||Le(e)||ke(e)||ye(e)||ve(e))return Vt(e,t);if(Me(e))return ae()}}const Bt=(()=>{const t=A();return(e,r)=>{const{start:s,end:n}=e;if(ct(s,n)&&ut(s[2],r.z))return e;const i=N();return Z(r.getPlane(t),s,n,i)?new dt(i):void 0}})();function Ft({lineLike:t},{center:e,radius:r}){const s=e[2];return fe(tt(t,e,r).filter(t=>ut(t[2],s)))}function Ht({lineLike:t},{sphere:e}){return fe(e.intersectLine(t.start,t.end))}const Jt=(()=>{const t=T(),e=v(),s=v();return(n,i,o)=>{const{normal:c,center:u,radius:a}=i;F(c,e,s);const h=O(n),l=a*x(h,e),f=a*x(h,s);P(t,u[0],u[1],u[2],1);const d=q(n,t),p=Math.hypot(l,f),g=ut(p,0);if(ut(S(n,u),0)){if(g)return i;if(ut(a,0))return!o||at(o,u)?new dt(H(u)):void 0;L(e,h,c),k(e,e);const t=new Array,r=M(u);m(r,r,e,a),o&&!at(o,r)||t.push(r);const s=M(u);return m(s,s,e,-a),o&&!at(o,s)||t.push(s),fe(t)}if(g)return;const _=-d/p;if(Math.abs(_)>1||ut(_,1))return;const y=Math.atan(l/f),z=r(_)-y,T=Math.PI-z,w=new Array,j=v();m(j,u,e,a*Math.cos(z)),m(j,j,s,a*Math.sin(z)),w.push(j);const D=v();return m(D,u,e,a*Math.cos(T)),m(D,D,s,a*Math.sin(T)),w.push(D),fe(o?lt(o,w):w)}})();function Kt(t,e){return ut(t.z,e.z)?t:void 0}function Nt({z:t},{planeLike:e}){const[r,s]=e.start,[n,i]=e.end,o=K(r,s,t),c=K(n,i,t);return 0===e.type?new mt(o,c):new _t(o,c)}function Qt(t,e){const[r,s]=e.center;return new kt(K(r,s,t.z),e.radius)}function Wt(t,e){return ut(e.center[2],t.z)?e:void 0}const Xt=(()=>{const t=A();return(e,r)=>Jt(e.getPlane(t),r,r.slicePlane)})();function Yt(t,{center:e,radius:r}){const s=Math.abs(e[2]-t.z);if(s>r&&!ut(s,r))return;const n=K(e[0],e[1],t.z),i=Math.sqrt(r**2-s**2);return ut(i,0)?void 0:new kt(n,i)}const $t=(()=>{const t=A();return(e,{center:r,radius:s})=>{const n=st(e.planeLike,r,s),i=r[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];at(t,e)&&o.push(e)}return fe(o)}})(),te=(()=>{const t=A(),e=A();return(r,s)=>Jt(r.getPlane(t),s,r.getSlicePlane(e))})(),ee=(()=>{const t=A();return(e,{center:r,radius:s})=>{const n=e.getPlane(t),i=C(n,r),o=Math.abs(i);if(o>s&&!ut(o,s))return;const c=Math.sqrt(s**2-i**2);if(ut(c,0)){const t=N();return I(n,r,t),new dt(t)}const u=N(),a=M(O(n));return m(u,r,a,i),new yt(u,c,a,e.getSlicePlane())}})();function re(t,e){}function se(t,e){const r=c(Q(t.center),Q(e.center));if(ut(r,0)&&ut(t.radius,e.radius))return e;return de(nt(Q(t.center),t.radius,Q(e.center),e.radius),e.center[2])}function ne(t,e){}function ie(t,e){}function oe(t,e){}function ce(t,e){if(!ct(t.center,e.center))return;const r=c(Q(t.center),Q(e.center));if(ut(r,0)&&ut(t.radius,e.radius))return t;return de(nt(Q(t.center),t.radius,Q(e.center),e.radius),t.center[2])}function ue(t,e){}function ae(t,e){}function he(t,e){const{planeLike:r,getZ:s}=t,n=new Array;if(ge(e))t.addIfOnTheGround(n,ot(r,e.point));else if(_e(e))t.addIfOnTheGround(n,$(r,e.lineLike));else if(ye(e))for(const[i,o]of st(r,e.center,e.radius)){const t=s(i,o);null!=t&&n.push(z(i,o,t))}else if(ke(e)||Pe(e))for(const[i,o]of rt(r,e.planeLike)){const t=s(i,o)??we;n.push(z(i,o,t))}return fe(n)}function le(t){return pe(t.map(([t,e])=>{const r=K(t,e,0),s=K(t,e,1);return new mt(r,s)}))}function fe(t){return pe(t.map(t=>t?new dt(W(t)):void 0))}function de(t,e){return fe(t.map(([t,r])=>[t,r,e]))}function pe(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new xt(e.filter(t))}function me(t){return t instanceof xt}function ge(t){return t instanceof dt}function _e(t){return t instanceof pt}function xe(t){return t instanceof gt}function Le(t){return t instanceof Mt}function ke(t){return t instanceof qt}function ye(t){return t instanceof Lt}function ve(t){return t instanceof kt}function ze(t){return t instanceof yt}function Me(t){return t instanceof At}function Pe(t){return t instanceof Ut}function qe(t){return t instanceof Ct}function Te(t){return t instanceof Zt}const we=0;export{yt as CircleConstraint,ft as Constraint,Zt as CoordinateConstraint,gt as CurveConstraint,Ut as DrapedLineConstraint,Ct as GeodesicConstraint,kt as HorizontalCircleConstraint,Mt as HorizontalPlaneConstraint,mt as LineConstraint,pt as LineLikeConstraint,dt as PointConstraint,_t as RayConstraint,xt as SetConstraint,At as SphereConstraint,Lt as VerticalCylinderConstraint,bt as VerticalHalfPlaneConstraint,Rt as VerticalPlaneConstraint,qt as VerticalPlaneLikeConstraint,pe as constraintOrSet,xe as isCurve,Pe as isDrapedLine,_e as isLine,ge as isPoint};
|
package/views/popupAdapter.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const e="popup",n="manual";function
|
|
2
|
+
const e="popup",n="manual";function t(e){const{popupElement:n,popup:t}=e||{};return n??t??null}function o(e){return null!=e&&"open"in e&&"declaredClass"in e}function i(e){return!!e&&"arcgis-popup"===e.tagName.toLowerCase()&&"open"in e}function p(t,p,a){const[u,l,c]=p;if(a){const[n,t,p]=a;n&&o(t)&&(t.view=null,n.remove(t,e),t!==l&&l&&t.destroy()),n&&p&&i(p)&&(p.view=null,n.remove(p,e),p!==c&&c&&p.remove())}u&&o(l)&&(l.view=t,u.add(l,{key:e,position:n,internal:!0})),u&&c&&i(c)&&(c.view=t,u.add(c,{key:e,position:n,internal:!0}))}async function a(e,n){const{popup:t,popupElement:p}=e;o(t)?await s(e,t,null,n):p&&i(p)?await s(e,null,p,n):n?.defer(async()=>{await e.setupPopup();const{popup:t,popupElement:p}=e;o(t)&&!e.destroyed&&e.ready&&e.popupEnabled?await s(e,t,null,n):p&&i(p)&&await s(e,null,p,n)}).catch(()=>{})}function u(e,n){const{popup:t,popupElement:p}=e;if(o(t))return t.open(n);if(p&&i(p)){if(n){const{fetchFeatures:e,title:t,...o}=n;delete n.fetchFeatures,Object.assign(p,o),void 0!==t&&(p.heading=t)}p.open=!0}}function l(e,n){o(e)&&e.close(),n&&i(n)&&(n.visible=!1)}async function c(e,n,t,o){const i=e.fetchPopupFeatures(t.screenPoint,{pointerType:t.pointerType});o?await o.open({location:t.mapPoint??void 0,featureStream:i}):(n.location=t.mapPoint??null,n.featureStream=i,n.open=!0)}async function s(e,n,t,p){if(o(n)){const e=await n.viewModel.handleViewClick(p);return void(e?.promises?.length?n.open(e):n.visible&&n.close())}t&&i(t)&&await c(e,t,p)}export{p as addPopup,l as closePopup,c as handlePopupElementClick,o as isPopup,i as isPopupElement,u as openPopupWithOptions,a as openPopupWithViewClick,t as popupFromView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{floatEqualAbsolute as t}from"../../core/mathUtils.js";import{subtract as
|
|
2
|
+
import{floatEqualAbsolute as t}from"../../core/mathUtils.js";import{subtract as n,length as r,scaleAndAdd as s,sub as e,dot as o,squaredLength as c,lerp as i,set as u,squaredDistance as a,distance as f}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as p,fromValues as m,ZEROS as d}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{sub as l,cross as h,dot as y,sqrLen as b,scaleAndAdd as j,set as M,subtract as g,copy as x,distance as v,len as q}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as A,clone as P}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as U}from"../../core/libs/gl-matrix-2/math/common.js";import{fromPositionAndNormal as C,distance as L,intersectLine as k,create as w,isPointInClosedPositiveHalfspace as H}from"../../geometry/support/plane.js";import{tangentFrame as I}from"../3d/support/mathUtils.js";import{intersectLineLikeAndCircle as z}from"./geometry2dUtils.js";function B({start:t,end:r,type:e},i,u){const a=[],f=n(rt,r,t),m=n(st,t,i),d=c(f),l=2*o(f,m),h=l*l-4*d*(c(m)-u*u);if(0===h){const n=-l/(2*d);(0===e||n>=0)&&a.push(s(p(),t,f,n))}else if(h>0){const n=Math.sqrt(h),r=(-l+n)/(2*d);(0===e||r>=0)&&a.push(s(p(),t,f,r));const o=(-l-n)/(2*d);(0===e||o>=0)&&a.push(s(p(),t,f,o))}return a}function D(t,r){const s=t.start,c=t.end,i=n(rt,c,s),u=M(ot,-i[1],i[0],0),a=r.start,f=r.end,p=l(ct,f,a),m=y(p,u),d=M(it,s[0],s[1],0),h=l(ut,d,a),b=y(h,u),g=U();if(Math.abs(m)<g)return Math.abs(b),[];const x=j(at,a,p,b/m);if(0===r.type){const t=l(ft,x,a);if(y(t,p)<-g)return[]}if(1===t.type){const t=e(st,x,s);if(o(t,i)<-g)return[]}return[P(x)]}function E(t,n){return V(Y(mt,n[2],t),n)}function F(t,n){const r=0;return T(Y(mt,r,t),Y(dt,r,n)).map(([t,n])=>m(t,n))}function G(t,n,r){return O(t,Y(mt,t[2],n),r)}function J(t,n){return Q(Y(mt,t[2],n),t)}function K(t,e,o,c=A()){const i=n(rt,t,e),u=r(i);return s(c,e,i,0===u?1:o/u),c[2]=t[2],c}function N(t,n,r){return f(t,n)-r}function O(t,{start:n,end:r,type:s},e=A()){const o=l(et,t,n),c=l(ot,r,n),i=y(o,c)/y(c,c);return j(e,n,c,0===s?Math.max(i,0):i)}function Q({start:t,end:n,type:r},s){const e=l(et,s,t),o=l(ot,n,t);if(0===r&&y(o,e)<-U())return v(t,s);const c=h(ct,o,e);return q(c)/q(o)}const R=(()=>{const t=A(),n=A(),r=A();return({start:s,end:e},{center:o,radius:c,normal:i,slicePlane:a})=>{const f=C(o,i,pt);if($(L(f,s),0)&&$(L(f,e),0)){I(i,t,n);const f=(s,e)=>(g(r,e,o),u(s,y(r,t),y(r,n)),s),p=z({start:f(rt,s),end:f(st,e),type:1},d,c),m=[];for(const[r,s]of p){const e=x(A(),o);j(e,e,t,r),j(e,e,n,s),a&&!tt(a,e)||m.push(e)}return m}const p=A();return k(f,s,e,p)?!$(v(p,o),c)||a&&!tt(a,p)?[]:[p]:[]}})();function S({start:t,end:r,type:s},e,i){const u=[],a=g(et,r,t),f=n(st,t,e),p=c(a),m=2*o(a,f),d=m*m-4*p*(c(f)-i*i);if(0===d){const n=-m/(2*p);(1===s||n>=0)&&u.push(j(A(),t,a,n))}else if(d>0){const n=Math.sqrt(d),r=(-m+n)/(2*p);(1===s||r>=0)&&u.push(j(A(),t,a,r));const e=(-m-n)/(2*p);(1===s||e>=0)&&u.push(j(A(),t,a,e))}return u}function T(t,n){const r=t.start,s=t.end,e=n.start,o=n.end,c=l(et,s,r),i=l(ot,o,e),u=l(ct,e,r),a=h(it,c,i);if(!$(y(u,a),0))return[];const f=b(a);if($(f,0))return[];const p=h(ut,u,i),m=y(p,a)/f,d=j(at,r,c,m);if(0===t.type){const t=l(ft,d,r);if(y(c,t)<-U())return[]}if(0===n.type){const t=l(ft,d,e);if(y(i,t)<-U())return[]}return[P(d)]}function V({start:t,end:n,type:r},s){const e=l(et,s,t),o=l(ot,n,t),c=h(ct,o,e),i=b(c)/b(o),u=U();if(i<u)switch(r){case 1:return[P(s)];case 0:return y(o,e)<-u?[]:[P(s)]}return[]}function W(t,n,r){return $(a(r,t),n*n)?[P(r)]:[]}function X(t,n,r,s){const[e,o]=t,[c,u]=r,a=c-e,f=u-o,p=a*a+f*f,d=Math.sqrt(p);if(d>n+s)return[];if(d<Math.abs(n-s))return[];if($(d,0)&&$(n,s))return[];const l=(n*n-s*s+p)/(2*d),h=Math.sqrt(n*n-l*l),y=h*f/d,b=h*a/d,[j,M]=i(rt,t,r,l/d);return $(y,b)?[m(j,M)]:[m(j+y,M-b),m(j-y,M+b)]}function Y(t,n,{start:r,end:s,type:e}){return M(t.start,r[0],r[1],n),M(t.end,s[0],s[1],n),t.type=nt[e],t}function Z(t,n){return $(t[2],n[2])}function $(n,r){return t(Math.abs(n-r),0,U())}function _(t,n){return n.filter(n=>tt(t,n))}function tt(t,n){return H(t,n)}const nt={0:1,1:0},rt=p(),st=p(),et=A(),ot=A(),ct=A(),it=A(),ut=A(),at=A(),ft=A(),pt=w(),mt={start:A(),end:A(),type:1},dt={start:A(),end:A(),type:1};export{_ as arePointsInClosedPositiveHalfspace,V as intersectLineAndPoint,R as intersectLineLikeAndCircle,S as intersectLineLikeAndVerticalCylinder,T as intersectLineLikes,W as intersectVerticalCylinderAndPoint,X as intersectVerticalCylinders,D as intersectVerticalPlaneAndLineLike,E as intersectVerticalPlaneAndPoint,B as intersectVerticalPlaneAndVerticalCylinder,F as intersectVerticalPlanes,$ as isClose,tt as isPointInClosedPositiveHalfspace,Q as pointToLineLikeDistance,N as pointToVerticalCylinderDistance,J as pointToVerticalPlaneDistance,O as projectPointToLineLike,K as projectPointToVerticalCylinder,G as projectPointToVerticalPlane,Z as vectorsHaveCloseZ};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type Graphic from "../../../Graphic.js";
|
|
2
2
|
import type EsriError from "../../../core/Error.js";
|
|
3
|
+
import type AnnotationFeatureLayer from "../../../layers/AnnotationFeatureLayer.js";
|
|
3
4
|
import type CSVLayer from "../../../layers/CSVLayer.js";
|
|
5
|
+
import type DimensionFeatureLayer from "../../../layers/DimensionFeatureLayer.js";
|
|
4
6
|
import type FeatureLayer from "../../../layers/FeatureLayer.js";
|
|
5
7
|
import type GeoJSONLayer from "../../../layers/GeoJSONLayer.js";
|
|
6
8
|
import type ImageryLayer from "../../../layers/ImageryLayer.js";
|
|
@@ -82,7 +84,7 @@ export interface FormatFunctionParameters {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
/** @since 5.0 */
|
|
85
|
-
export type FeatureTableSupportedLayer = CatalogFootprintLayer | CSVLayer | FeatureLayer | GeoJSONLayer | ImageryLayer | KnowledgeGraphSublayer |
|
|
87
|
+
export type FeatureTableSupportedLayer = AnnotationFeatureLayer | CatalogFootprintLayer | CSVLayer | DimensionFeatureLayer | FeatureLayer | GeoJSONLayer | ImageryLayer | KnowledgeGraphSublayer | OrientedImageryLayer | ParquetLayer | SceneLayer | Sublayer | SubtypeSublayer | WFSLayer;
|
|
86
88
|
|
|
87
89
|
/** @since 5.0 */
|
|
88
90
|
export type FeatureTableSupportedColumn = Column;
|