@arcgis/core 4.30.0-next.20240321 → 4.30.0-next.20240322
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/arcade/Dictionary.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/parser.js +1 -1
- package/arcade/validation/arcadeValidator.js +1 -1
- package/arcade/validation/languageKeywords.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{4e4ad7ac43a72a2f88a1.js → 0005267c754235ae6784.js} +1 -1
- package/assets/esri/core/workers/chunks/07fd6804c7eaa8d2ac3f.js +1 -0
- package/assets/esri/core/workers/chunks/{ff4151d794ec73064fac.js → 10b4fbdc0f8be85737f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{8fc69ac4cce6d4dd5513.js → 18a9b472007d4f2b7bbb.js} +1 -1
- package/assets/esri/core/workers/chunks/{f484d2a3deb3c60d7038.js → 1ad1cdde4db5ab793623.js} +1 -1
- package/assets/esri/core/workers/chunks/36dfc55dc536b1831918.js +1 -0
- package/assets/esri/core/workers/chunks/{cee492b97e841a6d4678.js → 5b41ec1bd24314f6f153.js} +1 -1
- package/assets/esri/core/workers/chunks/{d518a0adc3d88700235c.js → 65680926c761bf53fd14.js} +1 -1
- package/assets/esri/core/workers/chunks/{9c78ccff1c7f8ae90b06.js → 671892e733d8976e48bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{4be6d5660ec1c8ac7606.js → 70188e0aa47da1aa1a7f.js} +1 -1
- package/assets/esri/core/workers/chunks/7c212395100080cf122e.js +1 -0
- package/assets/esri/core/workers/chunks/8c07e1000522c3251ac0.js +1 -0
- package/assets/esri/core/workers/chunks/9d240e70a24520b2a810.js +1 -0
- package/assets/esri/core/workers/chunks/{ee1345b212cde1ff4755.js → a7ac2c5e701f44a67aa3.js} +1 -1
- package/assets/esri/core/workers/chunks/{5a747af5273646ab848c.js → c38c6cae22627fbf6f3b.js} +1 -1
- package/assets/esri/core/workers/chunks/c4d2ff515fc70b07cb5f.js +1 -0
- package/assets/esri/core/workers/chunks/{96fd6fd8cbb3a2ee088e.js → caa03837b9c173ea493f.js} +1 -1
- package/assets/esri/core/workers/chunks/{dd5a078b7919f749ba3e.js → d90ee005599c44bfb6ad.js} +1 -1
- package/assets/esri/core/workers/chunks/dc3a6ab23a13ec5deed7.js +1 -0
- package/assets/esri/core/workers/chunks/{eb3e82ed1653ecf348da.js → e1a2f7282d889e251809.js} +1 -1
- package/assets/esri/core/workers/chunks/{52274afa07468bc555aa.js → ec52127b5ada8410acf3.js} +13 -13
- package/assets/esri/core/workers/chunks/f8693321bbd8a93666c7.js +1 -0
- package/assets/esri/core/workers/chunks/{fe7dfb8546d0fc40843c.js → fec0d24e8841ba1994f0.js} +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/index.js +5 -0
- package/chunks/languageUtils.js +1 -1
- package/core/number.js +1 -1
- package/core/workers/loaderConfig.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/undoredo/support/DataEditingContext.js +5 -0
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/ComputedMarkerParams.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/utils.js +5 -0
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/TableList.js +1 -1
- package/arcade/lib/arcade-parser.js +0 -5
- package/arcade/lib/assert.js +0 -5
- package/arcade/lib/character.js +0 -5
- package/arcade/lib/comment-handler.js +0 -5
- package/arcade/lib/error-handler.js +0 -5
- package/arcade/lib/parser.js +0 -5
- package/arcade/lib/scanner.js +0 -5
- package/arcade/lib/tokenizer.js +0 -5
- package/arcade/lib/types.js +0 -5
- package/assets/esri/core/workers/chunks/12b95408753cea053a40.js +0 -1
- package/assets/esri/core/workers/chunks/16397420fb6067b47b25.js +0 -1
- package/assets/esri/core/workers/chunks/1fdbeb110fae52b96bb3.js +0 -1
- package/assets/esri/core/workers/chunks/689a122c77b39e5c73eb.js +0 -1
- package/assets/esri/core/workers/chunks/7b07f3bc68a54974cd03.js +0 -1
- package/assets/esri/core/workers/chunks/ad95daa3f4ad7030bf24.js +0 -1
- package/assets/esri/core/workers/chunks/c2573c1cb7c714435acc.js +0 -1
- package/assets/esri/core/workers/chunks/df38774f63984be0a478.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{NumericIdentifiableMixin as o}from"../../../core/Identifiable.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";var a;let c=a=class extends(o(t)){constructor(e){super(e),this._lodByScale={},this._scales=[],this.effectiveLODs=null,this.effectiveMinZoom=-1,this.effectiveMaxZoom=-1,this.effectiveMinScale=0,this.effectiveMaxScale=0,this.lods=null,this.minZoom=-1,this.maxZoom=-1,this.minScale=0,this.maxScale=0,this.snapToZoom=!0}initialize(){let e,{lods:t,minScale:o,maxScale:s,minZoom:i,maxZoom:a}=this,c=-1,
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{NumericIdentifiableMixin as o}from"../../../core/Identifiable.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";var a;let c=a=class extends(o(t)){constructor(e){super(e),this._lodByScale={},this._scales=[],this.effectiveLODs=null,this.effectiveMinZoom=-1,this.effectiveMaxZoom=-1,this.effectiveMinScale=0,this.effectiveMaxScale=0,this.lods=null,this.minZoom=-1,this.maxZoom=-1,this.minScale=0,this.maxScale=0,this.snapToZoom=!0}initialize(){let e,{lods:t,minScale:o,maxScale:s,minZoom:i,maxZoom:a}=this,c=-1,l=-1,r=!1,n=!1;if(0!==o&&0!==s&&o<s&&([o,s]=[s,o]),!t?.length)return this._set("effectiveMinScale",o),void this._set("effectiveMaxScale",s);t=t.map((e=>e.clone())),t.sort(((e,t)=>t.scale-e.scale)),t.forEach(((e,t)=>e.level=t));for(const f of t)!r&&o>0&&o>=f.scale&&(c=f.level,r=!0),!n&&s>0&&s>=f.scale&&(l=e?e.level:-1,n=!0),e=f;-1===i&&(i=0===o?0:c),-1===a&&(a=0===s?t.length-1:l),i=Math.max(i,0),i=Math.min(i,t.length-1),a=Math.max(a,0),a=Math.min(a,t.length-1),i>a&&([i,a]=[a,i]),o=t[i].scale,s=t[a].scale,t.splice(0,i),t.splice(a-i+1,t.length),t.forEach(((e,t)=>{this._lodByScale[e.scale]=e,this._scales[t]=e.scale})),this._set("effectiveLODs",t),this._set("effectiveMinZoom",i),this._set("effectiveMaxZoom",a),this._set("effectiveMinScale",o),this._set("effectiveMaxScale",s)}constrain(e,t){if(t&&e.scale===t.scale)return e;const o=this.effectiveMinScale,s=this.effectiveMaxScale,i=e.targetGeometry,a=t&&t.targetGeometry,c=0!==s&&e.scale<s,l=0!==o&&e.scale>o;if(c||l){const c=l?o:s;if(t&&a){const o=(c-t.scale)/(e.scale-t.scale);i.x=a.x+(i.x-a.x)*o,i.y=a.y+(i.y-a.y)*o}e.scale=c}return this.snapToZoom&&this.effectiveLODs&&(e.scale=this._getClosestScale(e.scale)),e}fit(e){if(!this.effectiveLODs||!this.snapToZoom)return this.constrain(e,null);const t=this.scaleToZoom(e.scale),o=Math.abs(t-Math.floor(t));return e.scale=this.zoomToScale(o>.99?Math.round(t):Math.floor(t)),e}zoomToScale(e){if(!this.effectiveLODs)return 0;e-=this.effectiveMinZoom,e=Math.max(0,e);const t=this._scales;if(e<=0)return t[0];if(e>=t.length)return t[t.length-1];const o=Math.floor(e),s=Math.ceil(e);return t[o]+(e-o)*(t[s]-t[o])}scaleToZoom(e){if(!this.effectiveLODs)return-1;const t=this._scales;let o,s;if(e>=t[0])return this.effectiveMinZoom;if(e<=t[t.length-1])return this.effectiveMaxZoom;for(let i=0;i<t.length-1;i++){if(o=t[i],s=t[i+1],s===e){return i+this.effectiveMinZoom+1}if(o>e&&s<e){return i+this.effectiveMinZoom+1-(e-s)/(o-s)}}return-1}snapToClosestScale(e){if(!this.effectiveLODs)return e;const t=this.scaleToZoom(e);return this.zoomToScale(Math.round(t))}snapToNextScale(e,t=.5){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o+1)}snapToPreviousScale(e,t=2){if(!this.effectiveLODs)return e*t;const o=Math.round(this.scaleToZoom(e));return this.zoomToScale(o-1)}clone(){return new a({lods:this.lods,minZoom:this.minZoom,maxZoom:this.maxZoom,minScale:this.minScale,maxScale:this.maxScale})}_getClosestScale(e){return this._lodByScale[e]||(e=this._scales.reduce(((t,o)=>Math.abs(o-e)<=Math.abs(t-e)?o:t),this._scales[0])),this._lodByScale[e].scale}};e([s({readOnly:!0})],c.prototype,"effectiveLODs",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxZoom",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMinScale",void 0),e([s({readOnly:!0})],c.prototype,"effectiveMaxScale",void 0),e([s()],c.prototype,"lods",void 0),e([s()],c.prototype,"minZoom",void 0),e([s()],c.prototype,"maxZoom",void 0),e([s()],c.prototype,"minScale",void 0),e([s()],c.prototype,"maxScale",void 0),e([s()],c.prototype,"snapToZoom",void 0),c=a=e([i("esri.views.2d.constraints.ZoomConstraint")],c);const l=c;export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{Alignment as e}from"../../../../../../../symbols/cim/enums.js";import{applyParentTransform as i}from"../../../../../../../symbols/cim/utils.js";import{spritePadding as o}from"../../../definitions.js";class s{static from(t){return"width"in t?this.fromSimpleMeshParams(t):this.fromComplexMeshParams(t)}static fromSimpleMeshParams(e){const i=new s(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects),{type:o,width:h,height:r,angle:a,outlineSize:
|
|
5
|
+
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{Alignment as e}from"../../../../../../../symbols/cim/enums.js";import{applyParentTransform as i}from"../../../../../../../symbols/cim/utils.js";import{spritePadding as o}from"../../../definitions.js";class s{static from(t){return"width"in t?this.fromSimpleMeshParams(t):this.fromComplexMeshParams(t)}static fromSimpleMeshParams(e){const i=new s(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects),{type:o,width:h,height:r,angle:n,alignment:a,outlineSize:c,referenceSize:l,sprite:m,overrideOutlineColor:f}=e;i.rawWidth=t(h),i.rawHeight=t(r),i.angle=n,i.alignment=a,i.outlineSize=t(c),i.referenceSize=t(l),i.overrideOutlineColor=f,i.offsetX=t(e.offsetX),i.offsetY=t(e.offsetY),"simple"!==o||m.sdf||(i.rawWidth=m.width,i.rawHeight=m.height);const d=2;return i.sizeRatio=m.sdf?d:1,i._computeSize(e,!1),i}static fromComplexMeshParams(e){const o=new s(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects);let{alignment:h,transforms:r,size:n,scaleX:a,anchorX:c,anchorY:l,angle:m,colorLocked:f,frameHeight:d,widthRatio:u,offsetX:p,offsetY:g,outlineSize:x,referenceSize:w,scaleFactor:z,sizeRatio:S,isAbsoluteAnchorPoint:X,rotateClockwise:Y,scaleSymbolsProportionally:H,sprite:M}=e;if(r&&r.infos.length>0){const t=i(n,m,Y,p,g,r);n=t.size,m=t.rotation,p=t.offsetX,g=t.offsetY,Y=!1}z&&(n*=z,p*=z,g*=z);const C=a*(M.width/M.height);o.alignment=h,o.rawHeight=t(n),o.rawWidth=o.rawHeight*C,o.referenceSize=t(w),o.sizeRatio=S,o.angle=m,o.rotateClockwise=Y,o.anchorX=c,o.anchorY=l,o.offsetX=t(p),o.offsetY=t(g),X&&n&&(M.sdf?o.anchorX=c/(n*u):o.anchorX=c/(n*C),o.anchorY=l/n);const W=H&&d?n/d:1;return o.outlineSize=0===x||isNaN(x)?0:t(x)*W,o.scaleSymbolsProportionally=H,o.colorLocked=f,o._computeSize(e,!0),o}constructor(t,i,o,s,h,r,n){this.sprite=t,this.color=i,this.outlineColor=o,this.minPixelBuffer=s,this.placement=h,this.scaleInfo=r,this.effects=n,this.rawWidth=0,this.rawHeight=0,this.angle=0,this.outlineSize=0,this.referenceSize=0,this.sizeRatio=1,this.alignment=e.SCREEN,this.scaleSymbolsProportionally=!1,this.overrideOutlineColor=!1,this.colorLocked=!1,this.anchorX=0,this.anchorY=0,this.computedWidth=0,this.computedHeight=0,this.texXmin=0,this.texYmin=0,this.texXmax=0,this.texYmax=0,this.offsetX=0,this.offsetY=0,this.rotateClockwise=!0}get boundsInfo(){return{size:Math.max(this.computedHeight,this.computedWidth),offsetX:this.offsetX,offsetY:this.offsetY}}_computeSize(t,e){const{sprite:i,hasSizeVV:s}=t,h=!!i.sdf,{rawWidth:r,rawHeight:n,sizeRatio:a,outlineSize:c}=this,l=r*a,m=n*a;if(h&&!s){const t=e&&r>n?l:r,i=n,o=c+2*1;this.computedWidth=Math.min(t+o,l),this.computedHeight=Math.min(i+o,m)}else this.computedWidth=l,this.computedHeight=m;const f=h?Math.max(i.width,i.height)/Math.max(l,m):1,d=.5*(l-this.computedWidth)*f,u=.5*(m-this.computedHeight)*f,p=i.rect.x+o+d,g=i.rect.y+o+u,x=p+i.width-2*d,w=g+i.height-2*u;this.texXmin=Math.floor(p),this.texYmin=Math.floor(g),this.texXmax=Math.ceil(x),this.texYmax=Math.ceil(w),this.computedWidth*=(this.texXmax-this.texXmin)/(x-p),this.computedHeight*=(this.texYmax-this.texYmin)/(w-g),this.anchorX*=l/this.computedWidth,this.anchorY*=m/this.computedHeight}}export{s as ComputedMarkerParams};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{CIMSymbolHelper as e}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{defaultCIMValues as a}from"../../../../../../../symbols/cim/defaultCIMValues.js";import{Techniques as i}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{noVisualVariables as l,getMaxSizeVVSize as o}from"../VisualVariablesSchema.js";function
|
|
5
|
+
import{CIMSymbolHelper as e}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{defaultCIMValues as a}from"../../../../../../../symbols/cim/defaultCIMValues.js";import{Techniques as i}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{noVisualVariables as l,getMaxSizeVVSize as o}from"../VisualVariablesSchema.js";import{hasSizeVVUniform as r}from"./utils.js";function s(e){return e.minScale||e.maxScale?{minScale:e.minScale??0,maxScale:e.maxScale??0}:null}function t(e){if(null==e)return null;if(Array.isArray(e)){const[a,i,l,o]=e;return[a,i,l,255*o]}return"string"==typeof e?e:{...e,defaultValue:t(e?.defaultValue)}}async function n(a,i){const{cimResourceManager:l,cimAnalyzer:o,scaleExpression:r}=i.schemaOptions;await Promise.all(e.fetchResources(a.symbol,l,[]));const t=o.analyzeSymbolReference(a,!1),n={scaleInfo:s(a),scaleExpression:r},u=[];for(const e of t)switch(e.type){case"marker":u.push(...c(e,i,n));break;case"fill":u.push(...m(e,i,n));break;case"line":u.push(...b(e,i,n));break;case"text":u.push(...v(e,i,n))}return u}function c(e,a,o){const{uniforms:r,schemaOptions:s}=a,{store:t}=s,n=e.isOutline?{...l,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue,visualVariableRotation:r.visualVariableRotation};return u(t.ensureInstance(i.marker,{geometry:n},{zoomRange:!!o.scaleInfo}),e,r,o)}function u(e,i,l,{scaleInfo:s,scaleExpression:n}){const c=r(l);return[e.createMeshInfo({params:{size:i.size,scaleX:i.scaleX,anchorX:i.anchorPoint.x,anchorY:i.anchorPoint.y,angle:i.rotation,color:t(i.color)??[0,0,0,0],colorLocked:i.colorLocked,frameHeight:i.frameHeight,widthRatio:i.widthRatio,scaleInfo:s,offsetX:i.offsetX,offsetY:i.offsetY,outlineColor:t(i.outlineColor)??[0,0,0,0],outlineSize:i.outlineWidth,referenceSize:i.referenceSize||a.CIMVectorMarker.size,rotateClockwise:i.rotateClockwise,scaleFactor:n??1,sizeRatio:i.sizeRatio,alignment:i.alignment,isAbsoluteAnchorPoint:i.isAbsoluteAnchorPoint,scaleSymbolsProportionally:i.scaleSymbolsProportionally,sprite:i.spriteRasterizationParam,hasSizeVV:c,placement:i.markerPlacement,effects:i.effects?{type:"cim-effect-infos",effectInfos:i.effects}:null,transforms:i.transform,minPixelBuffer:o(l)}})]}function f(e,a,l){const{uniforms:o,schemaOptions:r}=a,{store:s}=r;return p(s.ensureInstance(i.fill,{geometry:{visualVariableColor:e.colorLocked?null:o.visualVariableColor,visualVariableOpacity:o.visualVariableOpacity}},{zoomRange:!!l.scaleInfo}),e,l)}function p(e,a,{scaleInfo:i}){return[e.createMeshInfo({params:{color:t(a.color)??[0,0,0,0],scaleInfo:i,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null}})]}function m(e,a,l){if(!e.spriteRasterizationParam)return f(e,a,l);const{uniforms:o,schemaOptions:r}=a,{store:s}=r;return S(s.ensureInstance(i.complexFill,{geometry:{visualVariableColor:e.colorLocked?null:o.visualVariableColor,visualVariableOpacity:o.visualVariableOpacity}},{zoomRange:!!l.scaleInfo}),e,null!=o.visualVariableColor,l)}function S(e,a,i,{scaleInfo:l}){if(!a.spriteRasterizationParam)throw new Error("InternalError: Sprite should always be defined");const o=!!a.hasUnresolvedReplacementColor&&(!i||a.colorLocked),r=a.sampleAlphaOnly&&!o,s=a.spriteRasterizationParam;return[e.createMeshInfo({params:{color:t(a.color)??[0,0,0,0],height:a.height,aspectRatio:a.scaleX,offsetX:a.offsetX,offsetY:a.offsetY,scaleX:1,scaleY:1,angle:a.angle,applyRandomOffset:a.applyRandomOffset,sampleAlphaOnly:r,scaleProportionally:"CIMHatchFill"===s.resource.type,sprite:s,scaleInfo:l,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null}})]}function b(e,a,o){const{uniforms:r,schemaOptions:s}=a,{store:t}=s,n=e.isOutline?{...l,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops}:{visualVariableColor:e.colorLocked?null:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeMinMaxValue:r.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:r.visualVariableSizeScaleStops,visualVariableSizeStops:r.visualVariableSizeStops,visualVariableSizeUnitValue:r.visualVariableSizeUnitValue},c={geometry:n},u=!!(n.visualVariableSizeMinMaxValue||n.visualVariableSizeScaleStops||n.visualVariableSizeStops||n.visualVariableSizeUnitValue);if(!e.spriteRasterizationParam){return h(t.ensureInstance(i.line,c,{zoomRange:!!o.scaleInfo}),e,u,o)}return z(t.ensureInstance(i.texturedLine,c,{zoomRange:!!o.scaleInfo}),e,u,o)}function V(e,a,{scaleInfo:i}){return{params:{color:t(e.color)??[0,0,0,0],width:e.width,referenceWidth:e.referenceWidth,capType:e.cap,joinType:e.join,miterLimit:e.miterLimit,scaleInfo:i,hasSizeVV:a,effects:e.effects?{type:"cim-effect-infos",effectInfos:e.effects}:null}}}function h(e,a,i,l){if(a.spriteRasterizationParam)throw new Error("InternalError: Sprite should not be defined");return[e.createMeshInfo({params:V(a,i,l).params})]}function z(e,a,i,l){const{spriteRasterizationParam:o,scaleDash:r,sampleAlphaOnly:s}=a;if(!o)throw new Error("InternalError: Sprite should be defined");return[e.createMeshInfo({params:{...V(a,i,l).params,shouldScaleDash:r??!1,shouldSampleAlphaOnly:s,isSDF:"CIMPictureStroke"!==o.resource.type,sprite:o}})]}function v(e,a,l){const{uniforms:o,schemaOptions:r}=a,{store:s}=r;return y(s.ensureInstance(i.text,{geometry:{visualVariableColor:e.colorLocked?null:o.visualVariableColor,visualVariableOpacity:o.visualVariableOpacity,visualVariableRotation:o.visualVariableRotation,visualVariableSizeMinMaxValue:o.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:o.visualVariableSizeScaleStops,visualVariableSizeStops:o.visualVariableSizeStops,visualVariableSizeUnitValue:o.visualVariableSizeUnitValue}},{zoomRange:!!l.scaleInfo,referenceSymbol:!1,clipAngle:!1}),e,o,l)}function y(e,a,i,{scaleInfo:l,scaleExpression:r}){return[e.createMeshInfo({params:{boxBackgroundColor:t(a.backgroundColor),boxBorderLineColor:t(a.borderLineColor),boxBorderLineSize:a.borderLineWidth??0,color:t(a.color)??[0,0,0,0],offsetX:a.offsetX,offsetY:a.offsetY,postAngle:a.angle,fontSize:a.size,referenceSize:a.referenceSize,decoration:a.decoration,haloColor:t(a.outlineColor)??[0,0,0,0],haloFontSize:a.outlineSize,lineWidth:a.lineWidth||512,lineHeightRatio:1,horizontalAlignment:a.horizontalAlignment??"center",verticalAlignment:a.verticalAlignment??"baseline",useCIMAngleBehavior:!1,glyphs:a.textRasterizationParam,scaleInfo:l,effects:a.effects?{type:"cim-effect-infos",effectInfos:a.effects}:null,placement:a.markerPlacement,transforms:a.transform,scaleFactor:r??1,minPixelBuffer:o(i),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,isLineLabel:!1}})]}export{S as createComplexFillMeshInfos,u as createComplexMarkerMeshInfos,p as createComplexSimpleFillMeshInfos,h as createComplexSimpleLineMeshInfos,n as createComplexSymbolInstances,y as createComplexTextMeshInfos,z as createComplexTexturedLineMeshInfos,s as getScaleInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../../../symbols.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{generateGradient as a}from"../../../../../../../renderers/support/heatmapUtils.js";import{CIMSymbolHelper as l,slsDashToTemplateArray as i,capTypeToEnum as r}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{ExtremityPlacement as t}from"../../../../../../../symbols/cim/enums.js";import{getSDFInfo as o}from"../../../../../../../symbols/cim/SDFHelper.js";import{getAlignmentFromPlacement as s}from"../../../../../engine/webgl/alignmentUtils.js";import{writeColor as n}from"../../../../../engine/webgl/color.js";import{dotDensityMaxFields as u}from"../../../../../engine/webgl/definitions.js";import{Techniques as c}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{premultiplyColor as p}from"../schemaUtils.js";import{createVisualVariableUniforms as f,getMaxSizeVVSize as m,noVisualVariables as b}from"../VisualVariablesSchema.js";import{createComplexSymbolInstances as S,hasSizeVVUniform as V}from"./ComplexSymbolSchema.js";import y from"../../../../../../../symbols/SimpleFillSymbol.js";async function v(e,a){if(!e)return[];switch(e.type){case"simple-fill":return R(e,a);case"picture-fill":return k(e,a);case"simple-marker":return x(e,a);case"picture-marker":return M(e,a);case"simple-line":return U(e,a,!1);case"text":return I(e,a);case"label":return O(e,a);case"cim":return S(e.data,a);case"web-style":{const l=await e.fetchCIMSymbol();return S(l.data,a)}default:throw new Error(`symbol not supported ${e.type}`)}}async function h(e,a){const{schemaOptions:l}=a,{store:i}=l,r=new Array(u),t=new Array(u/4);for(let c=0;c<u;c++){const a=c<e.attributes.length?e.attributes[c].color:null;r[c]=[0,0,0,0],n(r[c],a)}for(let n=0;n<u/4;n++)t[n]=[0,0,0,0],t[n][0]=4*n<e.attributes.length?1:0,t[n][1]=4*n+1<e.attributes.length?1:0,t[n][2]=4*n+2<e.attributes.length?1:0,t[n][3]=4*n+3<e.attributes.length?1:0;const o={isActive:t,colors:r,dotValue:e.dotValue,dotScale:e.referenceScale,blending:e.dotBlendingEnabled,dotSize:e.dotSize,seed:e.seed},s=i.ensureInstance(c.dotDensity,o,{}).createMeshInfo({params:{effects:null}}),p=[];if(e.backgroundColor){const l=new y({color:e.backgroundColor,outline:null}),i=await v(l,a);p.push(...i)}if(p.push(s),e.outline){const l=U(e.outline,a,!0);p.push(...l)}return p}async function z(l,i){const{store:r}=i,{radius:t,minDensity:o,maxDensity:s,referenceScale:n,field:u,valueExpression:p,colorStops:f}=l,m=a(f);return[r.ensureInstance(c.heatmap,{radius:e(t),minDensity:o,maxDensity:s,referenceScale:n,isFieldActive:!(!u&&!p),gradient:m,gradientHash:m.join(",")},{}).createMeshInfo({params:{effects:null}})]}function d(a,l){const{store:i}=l,r=a.outline?.width||0,t=f(a),o=i.ensureInstance(c.pieChart,{geometry:{outlineWidth:Math.round(e(r)),defaultColor:p(a.defaultColor),outlineColor:p(a.outline?.color),othersColor:p(a.othersCategory?.color),donutRatio:a.holePercentage,sectorThreshold:a.othersCategory?.threshold||0,colors:a.attributes.map((e=>p(e.color))),visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue,hittestUniforms:null},numberOfFields:a.attributes.length},{}).createMeshInfo({params:{size:a.size,outlineWidth:r,effects:null,scaleInfo:null,minPixelBuffer:m(t)}});return[...a.backgroundFillSymbol?R(a.backgroundFillSymbol,{schemaOptions:l,path:"",uniforms:b}):[],o]}function g(e){if("path"===e.style){if(null==e.path)throw new Error("Symbol with a style of type path must define a path");return{type:"sprite-rasterization-param",overrides:[],resource:{type:"path",path:e.path,asFill:!0}}}const a=l.fromSimpleMarker(e);if("outline"in e&&e.outline&&"none"!==e.outline.style){if("solid"!==e.outline.style){if(!a||!a.symbolLayers)throw new Error("Error handling marker! ");return{type:"sprite-rasterization-param",resource:a.symbolLayers[0],overrides:[]}}}return{type:"sprite-rasterization-param",resource:o(a),overrides:[]}}async function x(e,a){const{uniforms:i,schemaOptions:r}=a,{store:t}=r;if("path"===e.style||e.outline&&"solid"!==e.outline.style&&"none"!==e.outline.style){const i=l.fromSimpleMarker(e);if(!i||!i.symbolLayers)throw new Error("Error handling marker! ");if("path"!==e.style){const e=i.symbolLayers[0];if(V(a.uniforms)){const l=m(a.uniforms,0,1);if(l>e.size){const a=l/e.size;e.size=l;const i=e.markerGraphics?.[0].symbol;(i.symbolLayers&&i.symbolLayers[0]).width*=a}}}return S({type:"CIMSymbolReference",symbol:i},a)}const o=t.ensureInstance(c.marker,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation}},{zoomRange:!1}),s=g(e);let n=e.color?.toArray()??[0,0,0,0];"CIMVectorMarker"===s.resource.type&&(n=[255,255,255,255]);const u="triangle"===e.style?124/116:1,p=e.size,f=p*u,b=null!=i.visualVariableColor&&("cross"===e.style||"x"===e.style);return[o.createMeshInfo({params:{type:"simple",color:n,height:p,width:f,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,outlineColor:e.outline?.color?.toArray()??[0,0,0,0],outlineSize:e.outline?.width??1,referenceSize:p,sprite:s,overrideOutlineColor:b,hasSizeVV:V(i),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:m(i)}})]}function M(e,a){const{uniforms:i,schemaOptions:r}=a,{store:t}=r,o=t.ensureInstance(c.marker,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation}},{zoomRange:!1}),s=l.createPictureMarkerRasterizationParam(e);if(!s)return[];return[o.createMeshInfo({params:{type:"picture",color:[255,255,255,255],height:e.height,width:e.width,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,outlineColor:null,outlineSize:0,referenceSize:e.height,sprite:s,overrideOutlineColor:!1,hasSizeVV:V(i),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:m(i)}})]}function C(e,a,l){const{uniforms:i,schemaOptions:r}=l,{store:o}=r,s=o.ensureInstance(c.marker,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation}},{zoomRange:!1}),n=g(e),u=6,p=u*a.width,f=p,b=e.color?.toArray()??a.color?.toArray()??[0,0,0,0],S="cross"===e.style||"x"===e.style;let y;switch(e.placement){case"begin-end":y=t.Both;break;case"begin":y=t.JustBegin;break;case"end":y=t.JustEnd;break;default:y=t.None}const v={type:"cim-marker-placement-info",placement:{type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:y,offsetAlongLine:0},overrides:[]};return[s.createMeshInfo({params:{type:"simple",color:b,height:f,width:p,offsetX:0,offsetY:0,angle:0,outlineColor:b,outlineSize:S?a.width:0,referenceSize:f/u,sprite:n,overrideOutlineColor:S&&null!=i.visualVariableColor,hasSizeVV:V(i),placement:v,transforms:null,effects:null,scaleInfo:null,minPixelBuffer:m(i)}})]}function I(e,a){const{uniforms:i,schemaOptions:r}=a,{store:t}=r;return[t.ensureInstance(c.text,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableRotation:i.visualVariableRotation,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue}},{zoomRange:!1,clipAngle:!1,referenceSymbol:!1}).createMeshInfo({params:{boxBackgroundColor:e.backgroundColor?.toArray(),boxBorderLineColor:e.borderLineColor?.toArray(),boxBorderLineSize:e.borderLineSize??0,color:e.color?.toArray()??[0,0,0,0],offsetX:e.xoffset,offsetY:e.yoffset,postAngle:e.angle,fontSize:e.font.size,decoration:e.font.decoration,haloColor:e.haloColor?.toArray()??[0,0,0,0],haloFontSize:e.haloSize??0,lineWidth:e.lineWidth,lineHeightRatio:e.lineHeight,horizontalAlignment:e.horizontalAlignment,verticalAlignment:e.verticalAlignment,useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:e.font.toJSON(),textString:e.text,symbol:l.createCIMTextSymbolfromTextSymbol(e)},overrides:[]},referenceSize:null,effects:null,placement:null,scaleInfo:null,transforms:null,scaleFactor:1,minPixelBuffer:m(i),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,isLineLabel:!1}})]}function O(a,i){const{schemaOptions:r,uniforms:t}=i,{store:o}=r,n=a.symbol,{allowOverrun:u,repeatLabel:p,repeatLabelDistance:f}=a,b={maxScale:a.maxScale??0,minScale:a.minScale??0},S=o.ensureInstance(c.label,{geometry:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:t.visualVariableRotation,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue}},{zoomRange:!0,clipAngle:!0,referenceSymbol:!0}),V=a.labelPlacement,[y,v]=s(V);return[S.createMeshInfo({params:{boxBackgroundColor:n.backgroundColor?.toArray(),boxBorderLineColor:n.borderLineColor?.toArray(),boxBorderLineSize:n.borderLineSize??0,color:n.color?.toArray()??[0,0,0,0],offsetX:n.xoffset,offsetY:n.yoffset,postAngle:n.angle,fontSize:n.font.size,decoration:n.font.decoration,haloColor:n.haloColor?.toArray()??[0,0,0,0],haloFontSize:n.haloSize??0,lineWidth:n.lineWidth,lineHeightRatio:n.lineHeight,horizontalAlignment:y,verticalAlignment:v,repeatLabel:p,repeatLabelDistance:e(f),allowOverrun:u,labelPosition:a.labelPosition,scaleInfo:b,minPixelBuffer:m(t),useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:n.font.toJSON(),textString:n.text,symbol:l.createCIMTextSymbolfromTextSymbol(n),primitiveName:"label-override"},useLegacyLabelEvaluationRules:null==a.labelExpressionInfo?.expression,overrides:[{type:"CIMPrimitiveOverride",valueExpressionInfo:{type:"CIMExpressionInfo",expression:a.labelExpressionInfo?.expression??a.labelExpression,returnType:"String"},primitiveName:"label-override",propertyName:"textString",defaultValue:""}]},referenceSize:null,effects:null,placement:null,transforms:null,scaleFactor:1,isLineLabel:!1}})]}function w(e,a){const l=e.width;return{outlineColor:e.color?.toArray()||[0,0,0,1],width:l,referenceWidth:l,capType:e.cap??"round",joinType:e.join??"round",miterLimit:e.miterLimit,hasSizeVV:a}}function A(e,a){const{uniforms:l,schemaOptions:i}=a,{store:r}=i,t=e.color?.toArray()??[0,0,0,0],o={type:"sprite-rasterization-param",resource:{type:"fill-style",style:e.style},overrides:[]};if("solid"===e.outline?.style){return[r.ensureInstance(c.patternOutlineFill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeScaleStops:l.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null}},{zoomRange:!1}).createMeshInfo({params:{color:t,...w(e.outline,!!l.visualVariableSizeOutlineScaleStops),sprite:o,scaleInfo:null,effects:null}})]}const s=[],n=r.ensureInstance(c.patternFill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity}},{zoomRange:!1}).createMeshInfo({params:{color:e.color?.toArray()??[0,0,0,0],sprite:o,scaleInfo:null,effects:null}});return s.push(n),e.outline&&s.push(...U(e.outline,a,!0)),s}function L(e,a){const{uniforms:l,schemaOptions:i}=a,{store:r}=i,t=e.color?.toArray()??[0,0,0,0];if("none"!==e.style&&"solid"===e.outline?.style){return[r.ensureInstance(c.outlineFill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeScaleStops:l.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null}},{zoomRange:!1}).createMeshInfo({params:{color:t,...w(e.outline,!!l.visualVariableSizeOutlineScaleStops),scaleInfo:null,effects:null}})]}const o=[];if("none"!==e.style){const e=r.ensureInstance(c.fill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity}},{zoomRange:!1}).createMeshInfo({params:{color:t,scaleInfo:null,effects:null}});o.push(e)}return e.outline&&o.push(...U(e.outline,a,!0)),o}function R(e,a){const{style:l}=e;return l&&"none"!==l&&"solid"!==l?A(e,a):L(e,a)}function k(e,a){const{outline:i}=e,{uniforms:r,schemaOptions:t}=a,{store:o}=t,s=[],n=l.createPictureFillRasterizationParam(e);if(!n)return[];const{width:u,height:p,xoffset:f,yoffset:m,xscale:b,yscale:S}=e,V={color:[255,255,255,255],sprite:n,height:p,aspectRatio:u/p,offsetX:f,offsetY:m,scaleX:b,scaleY:S,angle:0,applyRandomOffset:!1,sampleAlphaOnly:!1,scaleProportionally:!1,effects:null,scaleInfo:null};if("solid"===i?.style){return[o.ensureInstance(c.complexOutlineFill,{geometry:{visualVariableColor:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null}},{zoomRange:!1}).createMeshInfo({params:{...V,...w(i,!!r.visualVariableSizeOutlineScaleStops)}})]}const y=o.ensureInstance(c.complexFill,{geometry:{visualVariableColor:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity}},{zoomRange:!1});return s.push(y.createMeshInfo({params:V})),i&&s.push(...U(i,a,!0)),s}function U(e,a,l){const{color:t,style:o,width:s,cap:n,join:u}=e,{schemaOptions:p}=a,{store:f}=p,m=[],S=l?{...b,visualVariableSizeScaleStops:a.uniforms.visualVariableSizeOutlineScaleStops}:a.uniforms,y={geometry:{visualVariableColor:S.visualVariableColor,visualVariableOpacity:S.visualVariableOpacity,visualVariableSizeMinMaxValue:S.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:S.visualVariableSizeScaleStops,visualVariableSizeStops:S.visualVariableSizeStops,visualVariableSizeUnitValue:S.visualVariableSizeUnitValue}},v={color:t?.toArray()??[0,0,0,0],width:s,referenceWidth:s,capType:n,joinType:u,miterLimit:e.miterLimit,hasSizeVV:V(S),effects:null,scaleInfo:null};if(null==o||"solid"===o){const e=f.ensureInstance(c.line,y,{zoomRange:!1}).createMeshInfo({params:v});m.push(e)}else if("none"!==o){const e=f.ensureInstance(c.texturedLine,y,{zoomRange:!1}).createMeshInfo({params:{...v,shouldScaleDash:!0,shouldSampleAlphaOnly:!1,isSDF:!0,sprite:{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:i(o,n),capStyle:r(n)},overrides:[]}}});m.push(e)}return null!=e.marker&&m.push(...C(e.marker,e,a)),m}export{h as createDotDensityMeshSchemas,z as createHeatmapMeshSchemas,U as createLineInstance,d as createPieChartMeshSchemas,v as createSymbolMeshSchemas};
|
|
5
|
+
import"../../../../../../../symbols.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{generateGradient as a}from"../../../../../../../renderers/support/heatmapUtils.js";import{CIMSymbolHelper as l,slsDashToTemplateArray as i,capTypeToEnum as r}from"../../../../../../../symbols/cim/CIMSymbolHelper.js";import{Alignment as t,ExtremityPlacement as o}from"../../../../../../../symbols/cim/enums.js";import{getSDFInfo as s}from"../../../../../../../symbols/cim/SDFHelper.js";import{getAlignmentFromPlacement as n}from"../../../../../engine/webgl/alignmentUtils.js";import{writeColor as u}from"../../../../../engine/webgl/color.js";import{dotDensityMaxFields as c}from"../../../../../engine/webgl/definitions.js";import{Techniques as p}from"../../../../../engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import{premultiplyColor as f}from"../schemaUtils.js";import{createVisualVariableUniforms as m,getMaxSizeVVSize as b,noVisualVariables as S}from"../VisualVariablesSchema.js";import{createComplexSymbolInstances as V}from"./ComplexSymbolSchema.js";import{hasSizeVVUniform as y,hasRotationVVUniform as v}from"./utils.js";import h from"../../../../../../../symbols/SimpleFillSymbol.js";async function z(e,a){if(!e)return[];switch(e.type){case"simple-fill":return E(e,a);case"picture-fill":return P(e,a);case"simple-marker":return C(e,a);case"picture-marker":return I(e,a);case"simple-line":return U(e,a,!1);case"text":return A(e,a);case"label":return w(e,a);case"cim":return V(e.data,a);case"web-style":{const l=await e.fetchCIMSymbol();return V(l.data,a)}default:throw new Error(`symbol not supported ${e.type}`)}}async function d(e,a){const{schemaOptions:l}=a,{store:i}=l,r=new Array(c),t=new Array(c/4);for(let p=0;p<c;p++){const a=p<e.attributes.length?e.attributes[p].color:null;r[p]=[0,0,0,0],u(r[p],a)}for(let u=0;u<c/4;u++)t[u]=[0,0,0,0],t[u][0]=4*u<e.attributes.length?1:0,t[u][1]=4*u+1<e.attributes.length?1:0,t[u][2]=4*u+2<e.attributes.length?1:0,t[u][3]=4*u+3<e.attributes.length?1:0;const o={isActive:t,colors:r,dotValue:e.dotValue,dotScale:e.referenceScale,blending:e.dotBlendingEnabled,dotSize:e.dotSize,seed:e.seed},s=i.ensureInstance(p.dotDensity,o,{}).createMeshInfo({params:{effects:null}}),n=[];if(e.backgroundColor){const l=new h({color:e.backgroundColor,outline:null}),i=await z(l,a);n.push(...i)}if(n.push(s),e.outline){const l=U(e.outline,a,!0);n.push(...l)}return n}async function g(l,i){const{store:r}=i,{radius:t,minDensity:o,maxDensity:s,referenceScale:n,field:u,valueExpression:c,colorStops:f}=l,m=a(f);return[r.ensureInstance(p.heatmap,{radius:e(t),minDensity:o,maxDensity:s,referenceScale:n,isFieldActive:!(!u&&!c),gradient:m,gradientHash:m.join(",")},{}).createMeshInfo({params:{effects:null}})]}function x(a,l){const{store:i}=l,r=a.outline?.width||0,t=m(a),o=i.ensureInstance(p.pieChart,{geometry:{outlineWidth:Math.round(e(r)),defaultColor:f(a.defaultColor),outlineColor:f(a.outline?.color),othersColor:f(a.othersCategory?.color),donutRatio:a.holePercentage,sectorThreshold:a.othersCategory?.threshold||0,colors:a.attributes.map((e=>f(e.color))),visualVariableOpacity:t.visualVariableOpacity,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue,hittestUniforms:null},numberOfFields:a.attributes.length},{}).createMeshInfo({params:{size:a.size,outlineWidth:r,effects:null,scaleInfo:null,minPixelBuffer:b(t)}});return[...a.backgroundFillSymbol?E(a.backgroundFillSymbol,{schemaOptions:l,path:"",uniforms:S}):[],o]}function M(e){if("path"===e.style){if(null==e.path)throw new Error("Symbol with a style of type path must define a path");return{type:"sprite-rasterization-param",overrides:[],resource:{type:"path",path:e.path,asFill:!0}}}const a=l.fromSimpleMarker(e);if("outline"in e&&e.outline&&"none"!==e.outline.style){if("solid"!==e.outline.style){if(!a||!a.symbolLayers)throw new Error("Error handling marker! ");return{type:"sprite-rasterization-param",resource:a.symbolLayers[0],overrides:[]}}}return{type:"sprite-rasterization-param",resource:s(a),overrides:[]}}async function C(e,a){const{uniforms:i,schemaOptions:r}=a,{store:o}=r;if("path"===e.style||e.outline&&"solid"!==e.outline.style&&"none"!==e.outline.style){const r=l.fromSimpleMarker(e);if(!r||!r.symbolLayers)throw new Error("Error handling marker! ");if(i.visualVariableRotation&&(r.angleAlignment="Map"),"path"!==e.style){const e=r.symbolLayers[0];if(y(a.uniforms)){const l=b(a.uniforms,0,1);if(l>e.size){const a=l/e.size;e.size=l;const i=e.markerGraphics?.[0].symbol;(i.symbolLayers&&i.symbolLayers[0]).width*=a}}}return V({type:"CIMSymbolReference",symbol:r},a)}const s=o.ensureInstance(p.marker,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation}},{zoomRange:!1}),n=M(e);let u=e.color?.toArray()??[0,0,0,0];"CIMVectorMarker"===n.resource.type&&(u=[255,255,255,255]);const c="triangle"===e.style?124/116:1,f=e.size,m=f*c,S=null!=i.visualVariableColor&&("cross"===e.style||"x"===e.style);return[s.createMeshInfo({params:{type:"simple",color:u,height:f,width:m,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,alignment:v(i)?t.MAP:t.SCREEN,outlineColor:e.outline?.color?.toArray()??[0,0,0,0],outlineSize:e.outline?.width??1,referenceSize:f,sprite:n,overrideOutlineColor:S,hasSizeVV:y(i),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:b(i)}})]}function I(e,a){const{uniforms:i,schemaOptions:r}=a,{store:o}=r,s=o.ensureInstance(p.marker,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation}},{zoomRange:!1}),n=l.createPictureMarkerRasterizationParam(e);if(!n)return[];return[s.createMeshInfo({params:{type:"picture",color:[255,255,255,255],height:e.height,width:e.width,offsetX:e.xoffset,offsetY:e.yoffset,angle:e.angle,alignment:v(i)?t.MAP:t.SCREEN,outlineColor:null,outlineSize:0,referenceSize:e.height,sprite:n,overrideOutlineColor:!1,hasSizeVV:y(i),placement:null,effects:null,transforms:null,scaleInfo:null,minPixelBuffer:b(i)}})]}function O(e,a,l){const{uniforms:i,schemaOptions:r}=l,{store:s}=r,n=s.ensureInstance(p.marker,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue,visualVariableRotation:i.visualVariableRotation}},{zoomRange:!1}),u=M(e),c=6,f=c*a.width,m=f,S=e.color?.toArray()??a.color?.toArray()??[0,0,0,0],V="cross"===e.style||"x"===e.style;let h;switch(e.placement){case"begin-end":h=o.Both;break;case"begin":h=o.JustBegin;break;case"end":h=o.JustEnd;break;default:h=o.None}const z={type:"cim-marker-placement-info",placement:{type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:h,offsetAlongLine:0},overrides:[]};return[n.createMeshInfo({params:{type:"simple",color:S,height:m,width:f,offsetX:0,offsetY:0,angle:0,alignment:v(i)?t.MAP:t.SCREEN,outlineColor:S,outlineSize:V?a.width:0,referenceSize:m/c,sprite:u,overrideOutlineColor:V&&null!=i.visualVariableColor,hasSizeVV:y(i),placement:z,transforms:null,effects:null,scaleInfo:null,minPixelBuffer:b(i)}})]}function A(e,a){const{uniforms:i,schemaOptions:r}=a,{store:t}=r;return[t.ensureInstance(p.text,{geometry:{visualVariableColor:i.visualVariableColor,visualVariableOpacity:i.visualVariableOpacity,visualVariableRotation:i.visualVariableRotation,visualVariableSizeMinMaxValue:i.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:i.visualVariableSizeScaleStops,visualVariableSizeStops:i.visualVariableSizeStops,visualVariableSizeUnitValue:i.visualVariableSizeUnitValue}},{zoomRange:!1,clipAngle:!1,referenceSymbol:!1}).createMeshInfo({params:{boxBackgroundColor:e.backgroundColor?.toArray(),boxBorderLineColor:e.borderLineColor?.toArray(),boxBorderLineSize:e.borderLineSize??0,color:e.color?.toArray()??[0,0,0,0],offsetX:e.xoffset,offsetY:e.yoffset,postAngle:e.angle,fontSize:e.font.size,decoration:e.font.decoration,haloColor:e.haloColor?.toArray()??[0,0,0,0],haloFontSize:e.haloSize??0,lineWidth:e.lineWidth,lineHeightRatio:e.lineHeight,horizontalAlignment:e.horizontalAlignment,verticalAlignment:e.verticalAlignment,useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:e.font.toJSON(),textString:e.text,symbol:l.createCIMTextSymbolfromTextSymbol(e)},overrides:[]},referenceSize:null,effects:null,placement:null,scaleInfo:null,transforms:null,scaleFactor:1,minPixelBuffer:b(i),repeatLabel:null,repeatLabelDistance:null,allowOverrun:null,labelPosition:null,isLineLabel:!1}})]}function w(a,i){const{schemaOptions:r,uniforms:t}=i,{store:o}=r,s=a.symbol,{allowOverrun:u,repeatLabel:c,repeatLabelDistance:f}=a,m={maxScale:a.maxScale??0,minScale:a.minScale??0},S=o.ensureInstance(p.label,{geometry:{visualVariableColor:null,visualVariableOpacity:null,visualVariableRotation:t.visualVariableRotation,visualVariableSizeMinMaxValue:t.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:t.visualVariableSizeScaleStops,visualVariableSizeStops:t.visualVariableSizeStops,visualVariableSizeUnitValue:t.visualVariableSizeUnitValue}},{zoomRange:!0,clipAngle:!0,referenceSymbol:!0}),V=a.labelPlacement,[y,v]=n(V);return[S.createMeshInfo({params:{boxBackgroundColor:s.backgroundColor?.toArray(),boxBorderLineColor:s.borderLineColor?.toArray(),boxBorderLineSize:s.borderLineSize??0,color:s.color?.toArray()??[0,0,0,0],offsetX:s.xoffset,offsetY:s.yoffset,postAngle:s.angle,fontSize:s.font.size,decoration:s.font.decoration,haloColor:s.haloColor?.toArray()??[0,0,0,0],haloFontSize:s.haloSize??0,lineWidth:s.lineWidth,lineHeightRatio:s.lineHeight,horizontalAlignment:y,verticalAlignment:v,repeatLabel:c,repeatLabelDistance:e(f),allowOverrun:u,labelPosition:a.labelPosition,scaleInfo:m,minPixelBuffer:b(t),useCIMAngleBehavior:!1,glyphs:{type:"text-rasterization-param",resource:{type:"text",font:s.font.toJSON(),textString:s.text,symbol:l.createCIMTextSymbolfromTextSymbol(s),primitiveName:"label-override"},useLegacyLabelEvaluationRules:null==a.labelExpressionInfo?.expression,overrides:[{type:"CIMPrimitiveOverride",valueExpressionInfo:{type:"CIMExpressionInfo",expression:a.labelExpressionInfo?.expression??a.labelExpression,returnType:"String"},primitiveName:"label-override",propertyName:"textString",defaultValue:""}]},referenceSize:null,effects:null,placement:null,transforms:null,scaleFactor:1,isLineLabel:!1}})]}function R(e,a){const l=e.width;return{outlineColor:e.color?.toArray()||[0,0,0,1],width:l,referenceWidth:l,capType:e.cap??"round",joinType:e.join??"round",miterLimit:e.miterLimit,hasSizeVV:a}}function L(e,a){const{uniforms:l,schemaOptions:i}=a,{store:r}=i,t=e.color?.toArray()??[0,0,0,0],o={type:"sprite-rasterization-param",resource:{type:"fill-style",style:e.style},overrides:[]};if("solid"===e.outline?.style){return[r.ensureInstance(p.patternOutlineFill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeScaleStops:l.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null}},{zoomRange:!1}).createMeshInfo({params:{color:t,...R(e.outline,!!l.visualVariableSizeOutlineScaleStops),sprite:o,scaleInfo:null,effects:null}})]}const s=[],n=r.ensureInstance(p.patternFill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity}},{zoomRange:!1}).createMeshInfo({params:{color:e.color?.toArray()??[0,0,0,0],sprite:o,scaleInfo:null,effects:null}});return s.push(n),e.outline&&s.push(...U(e.outline,a,!0)),s}function k(e,a){const{uniforms:l,schemaOptions:i}=a,{store:r}=i,t=e.color?.toArray()??[0,0,0,0];if("none"!==e.style&&"solid"===e.outline?.style){return[r.ensureInstance(p.outlineFill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity,visualVariableSizeScaleStops:l.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null}},{zoomRange:!1}).createMeshInfo({params:{color:t,...R(e.outline,!!l.visualVariableSizeOutlineScaleStops),scaleInfo:null,effects:null}})]}const o=[];if("none"!==e.style){const e=r.ensureInstance(p.fill,{geometry:{visualVariableColor:l.visualVariableColor,visualVariableOpacity:l.visualVariableOpacity}},{zoomRange:!1}).createMeshInfo({params:{color:t,scaleInfo:null,effects:null}});o.push(e)}return e.outline&&o.push(...U(e.outline,a,!0)),o}function E(e,a){const{style:l}=e;return l&&"none"!==l&&"solid"!==l?L(e,a):k(e,a)}function P(e,a){const{outline:i}=e,{uniforms:r,schemaOptions:t}=a,{store:o}=t,s=[],n=l.createPictureFillRasterizationParam(e);if(!n)return[];const{width:u,height:c,xoffset:f,yoffset:m,xscale:b,yscale:S}=e,V={color:[255,255,255,255],sprite:n,height:c,aspectRatio:u/c,offsetX:f,offsetY:m,scaleX:b,scaleY:S,angle:0,applyRandomOffset:!1,sampleAlphaOnly:!1,scaleProportionally:!1,effects:null,scaleInfo:null};if("solid"===i?.style){return[o.ensureInstance(p.complexOutlineFill,{geometry:{visualVariableColor:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity,visualVariableSizeScaleStops:r.visualVariableSizeOutlineScaleStops,visualVariableSizeMinMaxValue:null,visualVariableSizeStops:null,visualVariableSizeUnitValue:null}},{zoomRange:!1}).createMeshInfo({params:{...V,...R(i,!!r.visualVariableSizeOutlineScaleStops)}})]}const y=o.ensureInstance(p.complexFill,{geometry:{visualVariableColor:r.visualVariableColor,visualVariableOpacity:r.visualVariableOpacity}},{zoomRange:!1});return s.push(y.createMeshInfo({params:V})),i&&s.push(...U(i,a,!0)),s}function U(e,a,l){const{color:t,style:o,width:s,cap:n,join:u}=e,{schemaOptions:c}=a,{store:f}=c,m=[],b=l?{...S,visualVariableSizeScaleStops:a.uniforms.visualVariableSizeOutlineScaleStops}:a.uniforms,V={geometry:{visualVariableColor:b.visualVariableColor,visualVariableOpacity:b.visualVariableOpacity,visualVariableSizeMinMaxValue:b.visualVariableSizeMinMaxValue,visualVariableSizeScaleStops:b.visualVariableSizeScaleStops,visualVariableSizeStops:b.visualVariableSizeStops,visualVariableSizeUnitValue:b.visualVariableSizeUnitValue}},v={color:t?.toArray()??[0,0,0,0],width:s,referenceWidth:s,capType:n,joinType:u,miterLimit:e.miterLimit,hasSizeVV:y(b),effects:null,scaleInfo:null};if(null==o||"solid"===o){const e=f.ensureInstance(p.line,V,{zoomRange:!1}).createMeshInfo({params:v});m.push(e)}else if("none"!==o){const e=f.ensureInstance(p.texturedLine,V,{zoomRange:!1}).createMeshInfo({params:{...v,shouldScaleDash:!0,shouldSampleAlphaOnly:!1,isSDF:!0,sprite:{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:i(o,n),capStyle:r(n)},overrides:[]}}});m.push(e)}return null!=e.marker&&m.push(...O(e.marker,e,a)),m}export{d as createDotDensityMeshSchemas,g as createHeatmapMeshSchemas,U as createLineInstance,x as createPieChartMeshSchemas,z as createSymbolMeshSchemas};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
function a(a){return!!(a.visualVariableSizeMinMaxValue||a.visualVariableSizeScaleStops||a.visualVariableSizeStops||a.visualVariableSizeUnitValue||a.visualVariableSizeOutlineScaleStops)}function i(a){return!!a.visualVariableRotation}export{i as hasRotationVVUniform,a as hasSizeVVUniform};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidMbs as t}from"./I3SUtil.js";import{I3sTarget as i}from"./Intersector.js";import{newIntersectorResult as r}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as s,StoreResults as n}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{
|
|
5
|
+
import{ViewingMode as e}from"../../../ViewingMode.js";import{isValidMbs as t}from"./I3SUtil.js";import{I3sTarget as i}from"./Intersector.js";import{newIntersectorResult as r}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as s,StoreResults as n}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as l}from"../../webgl-engine/lib/RayIntersections.js";import{getVerticalOffsetI3S as o}from"../../webgl-engine/lib/verticalOffsetUtils.js";class c{constructor(e){this.type=s.I3S,this._needVerticalOffset=!1,this.layerUid=e.layerUid,this.sublayerUid=e.sublayerUid,this._collection=e.collection,this._traverseNodeHierarchy=e.traverseNodeHierarchy,this.slicePlaneEnabled=e.slicePlaneEnabled,this.isGround=e.isGround}updateElevationAlignState(t,i){this._needVerticalOffset=t&&i===e.Global}intersect(e,s,c,d,u,b){const f=b??!1,m=e.results,h=e.options.store===n.ALL,y=e.ray.direction,p=e.tolerance;let R=e=>e,g=e=>e;const I=o(e.verticalOffset??(this._needVerticalOffset?0:null));null!=e.verticalOffset&&null!=I&&(R=e=>I.applyToMbs(e),g=e=>I.applyToObb(e));const v=new l(f,e.options.normalRequired),O=(n,l)=>{if(0===n.childrenLoaded)return!1;const o=n.serviceObbInRenderSR?.isValid?n.serviceObbInRenderSR:null;return!(o&&!g(o).intersectRay(c,y,p))&&(!l||!o&&t(n.serviceMbsInRenderSR)&&!a(R(n.serviceMbsInRenderSR),c,y,p)||null!=n.geometryObbInRenderSR&&!g(n.geometryObbInRenderSR).intersectRay(c,y,p)||this._collection.intersect(l,c,d,p,I,v,((t,l,o,a)=>{if(l<0||null!=s&&!s(c,d,l))return;const u=e=>{const r=new i(this.layerUid,this.sublayerUid,n.index,t,a);e.set(this.type,r,l,o)};if(this.isGround&&(null==m.ground.dist||l<m.ground.dist)&&u(m.ground),!e.options.isFiltered&&((null==m.min.dist||l<m.min.dist)&&u(m.min),(null==m.max.dist||l>m.max.dist)&&u(m.max),h)){const t=r(e.ray);u(t),e.results.all.push(t)}})),!0)};this._traverseNodeHierarchy(O)}}function a(e,t,i,r=0){const s=e[3]+r,n=t[0]-e[0],l=t[1]-e[1],o=t[2]-e[2],c=i[0],a=i[1],d=i[2],u=c*n+a*l+d*o;return u*u-(c*c+a*a+d*d)*(n*n+l*l+o*o-s*s)>=0}export{c as I3SIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import o from"../../../../core/Logger.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromQuat as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as l,e as c}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as m}from"../../../../geometry/projection/projectBoundingSphere.js";import{empty as u,expand as h}from"../../../../geometry/support/aaBoundingRect.js";import{f as d}from"../../../../chunks/sphere.js";import{ElevationRange as f}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{newIntersector as g}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";let x=class extends(r.EventedMixin(t)){constructor(e){super(e),this._tmpEvent=new v,this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource}initialize(){this._intersector=g(this.view.state.viewingMode),this._intersector.options.store=E.MIN,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,n){const i=this._renderCoordsHelper,s=l(R,e,t,r);if(!i.toRenderCoords(s,n,s))return o.getLogger(this).error("could not project point to compute elevation"),null;const{layerElevationSource:a,_intersector:c,intersectionHandler:p}=this,m=a.fullExtent,u=null!=m&&Number.isFinite(m.xmin)&&Number.isFinite(m.xmax)&&Number.isFinite(m.ymin)&&Number.isFinite(m.ymax)&&Number.isFinite(m.zmin)&&Number.isFinite(m.zmax)?new f(m.zmin,m.zmax):a.elevationRange;if(null==u)return null;const h=a.elevationOffset,d=u.elevationRangeMin+h,v=u.elevationRangeMax+h,g=i.setAltitude(y,v,s),E=i.setAltitude(b,d,s);return c.reset(g,E,null),p.intersect(c,null,g,E,null,!0),c.results.min.getIntersectionPoint(s)?i.getAltitude(s):null}getSphereElevationBounds(e,t){return m(e,t,j,this._renderSR),this._layerElevationSource.getElevationRange(j)}getRootElevationBounds(){const e=this.layerElevationSource.fullExtent;return e?.hasZ?new f(e.zmin,e.zmax):null}objectsChanged(e){this.spatialReference&&(this._computeLayerExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}objectChanged(e){this.spatialReference&&(this._computeObjectExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(e,t){u(t),this._expandExtent(e,t)}_computeLayerExtent(e,t){u(t);for(const r of e)this._expandExtent(r,t)}_expandExtent(e,t){const r=this.spatialReference;if(null==r)return;if(null==e)return;s(_,e.quaternion),_[12]=e.center[0],_[13]=e.center[1],_[14]=e.center[2];const o=e.halfSize;for(let n=0;n<8;++n)R[0]=1&n?o[0]:-o[0],R[1]=2&n?o[1]:-o[1],R[2]=4&n?o[2]:-o[2],c(R,R,_),this._renderCoordsHelper.fromRenderCoords(R,R,r),h(t,R,t)}};e([n({constructOnly:!0})],x.prototype,"layerElevationSource",void 0),e([n({constructOnly:!0})],x.prototype,"intersectionHandler",void 0),e([n({constructOnly:!0})],x.prototype,"view",void 0),e([n()],x.prototype,"spatialReference",null),x=e([i("esri.views.3d.layers.i3s.LayerElevationProvider")],x);const _=a(),j=d(0,0,0,0),R=p(),y=p(),b=p();export{x as LayerElevationProvider};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import o from"../../../../core/Logger.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromQuat as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as l,e as c}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as m}from"../../../../geometry/projection/projectBoundingSphere.js";import{empty as u,expand as h}from"../../../../geometry/support/aaBoundingRect.js";import{f as d}from"../../../../chunks/sphere.js";import{ElevationRange as f}from"../../support/ElevationRange.js";import{ElevationUpdateEvent as v}from"../../support/ElevationUpdateEvent.js";import{newIntersector as g}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";let x=class extends(r.EventedMixin(t)){constructor(e){super(e),this._tmpEvent=new v,this._renderCoordsHelper=e.view.renderCoordsHelper,this._renderSR=this._renderCoordsHelper.spatialReference,this._layerElevationSource=e.layerElevationSource}initialize(){this._intersector=g(this.view.state.viewingMode),this._intersector.options.store=E.MIN,this._intersector.options.normalRequired=!1,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}get spatialReference(){return this.view?.elevationProvider?.spatialReference}getElevation(e,t,r,n){const i=this._renderCoordsHelper,s=l(R,e,t,r);if(!i.toRenderCoords(s,n,s))return o.getLogger(this).error("could not project point to compute elevation"),null;const{layerElevationSource:a,_intersector:c,intersectionHandler:p}=this,m=a.fullExtent,u=null!=m&&Number.isFinite(m.xmin)&&Number.isFinite(m.xmax)&&Number.isFinite(m.ymin)&&Number.isFinite(m.ymax)&&Number.isFinite(m.zmin)&&Number.isFinite(m.zmax)?new f(m.zmin,m.zmax):a.elevationRange;if(null==u)return null;const h=a.elevationOffset,d=u.elevationRangeMin+h,v=u.elevationRangeMax+h,g=i.setAltitude(y,v,s),E=i.setAltitude(b,d,s);return c.reset(g,E,null),p.intersect(c,null,g,E,null,!0),c.results.min.getIntersectionPoint(s)?i.getAltitude(s):null}getSphereElevationBounds(e,t){return m(e,t,j,this._renderSR),this._layerElevationSource.getElevationRange(j)}getRootElevationBounds(){const e=this.layerElevationSource.fullExtent;return e?.hasZ?new f(e.zmin,e.zmax):null}objectsChanged(e){this.spatialReference&&(this._computeLayerExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}objectChanged(e){this.spatialReference&&(this._computeObjectExtent(e,this._tmpEvent.extent),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(e,t){u(t),this._expandExtent(e,t)}_computeLayerExtent(e,t){u(t);for(const r of e)this._expandExtent(r,t)}_expandExtent(e,t){const r=this.spatialReference;if(null==r)return;if(null==e)return;s(_,e.quaternion),_[12]=e.center[0],_[13]=e.center[1],_[14]=e.center[2];const o=e.halfSize;for(let n=0;n<8;++n)R[0]=1&n?o[0]:-o[0],R[1]=2&n?o[1]:-o[1],R[2]=4&n?o[2]:-o[2],c(R,R,_),this._renderCoordsHelper.fromRenderCoords(R,R,r),h(t,R,t)}};e([n({constructOnly:!0})],x.prototype,"layerElevationSource",void 0),e([n({constructOnly:!0})],x.prototype,"intersectionHandler",void 0),e([n({constructOnly:!0})],x.prototype,"view",void 0),e([n()],x.prototype,"spatialReference",null),x=e([i("esri.views.3d.layers.i3s.LayerElevationProvider")],x);const _=a(),j=d(0,0,0,0),R=p(),y=p(),b=p();export{x as LayerElevationProvider};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";class
|
|
5
|
+
import e from"../../../../Graphic.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{newIntersectorResult as t}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as r,StoreResults as s}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{MeshIntersectionOptions as n}from"../../webgl-engine/lib/RayIntersections.js";class l{constructor(e){this.layerUid=[],this.type=r.TILES3D,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerUid.push(e.layer.uid)}intersect(e,r,l,o){const a=e.results,c=e.options.store===s.ALL;if(e.options.filteredLayerUids.includes(this.layerView.layer.uid))return;const u=this.layerView.view._stage.renderView.componentObjectCollection,d=new n(!1,e.options.normalRequired);this.layerView.objects.forEach((s=>{s.visible&&s.intersectionGeometry&&u.intersect(s,l,o,e.tolerance,null,d,((s,n,u,d)=>{if(n>=0){if(null!=r&&!r(l,o,n))return;const s=e=>{const t=new i(this.layerView.layer.uid,(()=>this._createTiles3DGraphic(this.layerView.layer,{})));e.set(this.type,t,n,u)};if(this.isGround&&(null==a.ground.dist||n<a.ground.dist)&&s(a.ground),e.options.isFiltered)return;if((null==a.min.dist||n<a.min.dist)&&s(a.min),(null==a.max.dist||n>a.max.dist)&&s(a.max),c){const i=t(e.ray);s(i),e.results.all.push(i)}}}))}))}_createTiles3DGraphic(i,t){return new e({layer:i,sourceLayer:i,attributes:t})}}export{l as Tiles3DIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/unitUtils.js";import{g as i,n as s,k as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,copy as a,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as g}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as I}from"../../support/geometryUtils/ray.js";import{defaultTolerance as v,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";class U{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=v,this._tmpRay=m(),this._tmpRegion=c(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),T(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,T(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(D,r,n),D[0]+=.0466,D[1]-=.0123,_(e,D,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(n)&&n.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=v){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return I(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==g.Local||null==e||i(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,l=0,c=null){if(null==e)return null;const a=this._view,{renderCoordsHelper:u}=a,h=n(a.spatialReference),d=null!=r?r.mode:"absolute-height",p=f(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:g}=a.state;if("absolute-height"===d){const t=u?.getAltitude(g.eye),r=o(s(F,e.direction),u.worldUpAtPosition(g.eye,S));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,F)){const e=R(a,F);return e.z??=0,e.z-=p,e}return null}const _=t(y.get());g.projectToRenderScreen(e.origin,_);const I=new A(null,this._forEachLayer),{slicePlane:v}=a,j=null!=v?M(v):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m;const x=e.origin,E=i(y.get(),x,e.direction);U.reset(x,E,g),U.point=_;const H=c?"type"in c&&"graphics"===c.type?e=>e.layerUid!==c.uid:e=>e.graphicUid!==c.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!H||H(e))&&!!e.lastValidElevationBB;U.intersect(I.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(F)){const e=R(a,F);return e.z=l,e}return null}computeIntersection(e,r,n,s){if(null==e)return;const o=this._view.state.camera,l=t(y.get());o.projectToRenderScreen(e.origin,l);const c=new A(n,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n);const a=e.origin,u=i(y.get(),e.origin,e.direction);r.reset(a,u,o),r.intersect(c.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(c.sliceableLayers,l,this._tolerance,d);const p=n&&(n.requiresGroundFeedback||n.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,n=Array.isArray(t),i=n?t:[t];n&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of i){!c.filterLayerUid(s)?n&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,a,u,l,s)}}));const m=y.get(),f=this._view.basemapTerrain;if(n&&n.enableDraped&&null!=f.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=f.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,n=y.get();this._view.renderCoordsHelper.fromRenderCoords(m,n,f.spatialReference),n[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,n,r.results.ground,(e=>c.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;a(this._tmpRegion,u);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new H(e);r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),n.push(t),p(i,t.screenPoint)};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const a of t.all)t.min.target.object!==a.target.object&&t.max.target.object!==a.target.object&&s(a);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,l=r.fullHeight,c=Math.max(0,i[0]-x),m=Math.max(0,i[1]-x),y=Math.min(h(i)+2*x,o-c),f=Math.min(d(i)+2*x,l-m);if(y<=0||f<=0)return;const g=new Uint8Array(y*f*4);this._view._stage.renderer.readHUDVisibility(c,m,y,f,g);let R=!0;const _=null==e.results.max.dist;let I=0;for(const a of n)for(const t of E){const r=4*(Math.min(a.screenPoint[0]+t[0],o)-i[0]+(Math.min(a.screenPoint[1]+t[1],l)-i[1])*y);if(!(r<0||r>=g.length)&&g[r]){R&&(e.results.min.copy(a.result),R=!1),_&&e.results.max.copy(a.result),e.options.store===w.ALL&&e.results.all.splice(I++,0,a.result);break}}}}const x=1,E=(()=>{const e=[],t=x;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function T(e){return L&&L.viewingMode===e||(L=b(e)),L}class A{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function k(e){return"object"==typeof e&&"intersect"in e}const F=l(),S=l(),D=r();export{U as SceneIntersectionHelper,k as isIntersectionHandler};
|
|
5
|
+
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/unitUtils.js";import{g as i,n as s,k as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as c,copy as a,negativeInfinity as u,width as h,height as d,expandPointInPlace as p}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as g}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as R}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as I}from"../../support/geometryUtils/ray.js";import{defaultTolerance as v,newIntersector as b}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as w,IntersectorType as P}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as j,sliceFilterPredicate as M}from"../../webgl-engine/lib/intersectorUtils.js";class U{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=v,this._tmpRay=m(),this._tmpRegion=c(),this._validateHUDIntersector=b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),T(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,T(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=w.MIN,this.computeIntersection(e,t,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(D,r,n),D[0]+=.0466,D[1]-=.0123,_(e,D,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||j(n)&&n.intersector!==P.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=v){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===P.TERRAIN?1:t.type===P.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return I(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==g.Local||null==e||i(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,l=0,c=null){if(null==e)return null;const a=this._view,{renderCoordsHelper:u}=a,h=n(a.spatialReference),d=null!=r?r.mode:"absolute-height",p=f(r)/h,m=("on-the-ground"!==d?p+l:0)*h/u.unitInMeters,{camera:g}=a.state;if("absolute-height"===d){const t=u?.getAltitude(g.eye),r=o(s(F,e.direction),u.worldUpAtPosition(g.eye,S));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,F)){const e=R(a,F);return e.z??=0,e.z-=p,e}return null}const _=t(y.get());g.projectToRenderScreen(e.origin,_);const I=new A(null,this._forEachLayer),{slicePlane:v}=a,j=null!=v?M(v):null,U=b(this.viewingMode);U.options.store=w.MIN,U.options.verticalOffset=m,U.options.normalRequired=!1;const x=e.origin,E=i(y.get(),x,e.direction);U.reset(x,E,g),U.point=_;const H=c?"type"in c&&"graphics"===c.type?e=>e.layerUid!==c.uid:e=>e.graphicUid!==c.uid:null;switch(d){case"relative-to-scene":{const e=e=>(!H||H(e))&&!!e.lastValidElevationBB;U.intersect(I.layers,_,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===P.I3S||e.type===P.TERRAIN||e.type===P.TILES3D){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?j:null;e.intersect(U,t,U.rayBegin,U.rayEnd,_)}}))}if(U.results.min.getIntersectionPoint(F)){const e=R(a,F);return e.z=l,e}return null}computeIntersection(e,r,n,s){if(null==e)return;const o=this._view.state.camera,l=t(y.get());o.projectToRenderScreen(e.origin,l);const c=new A(n,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n);const a=e.origin,u=i(y.get(),e.origin,e.direction);r.reset(a,u,o),r.intersect(c.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?M(h):null;r.intersect(c.sliceableLayers,l,this._tolerance,d);const p=n&&(n.requiresGroundFeedback||n.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,n=Array.isArray(t),i=n?t:[t];n&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of i){!c.filterLayerUid(s)?n&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,a,u,l,s)}}));const m=y.get(),f=this._view.basemapTerrain;if(n&&n.enableDraped&&null!=f.spatialReference&&r.results.ground.getIntersectionPoint(m)){const e=f.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,n=y.get();this._view.renderCoordsHelper.fromRenderCoords(m,n,f.spatialReference),n[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],t,"ground")??0,e.intersect(r,n,r.results.ground,(e=>c.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;a(this._tmpRegion,u);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new H(e);r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),n.push(t),p(i,t.screenPoint)};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const a of t.all)t.min.target.object!==a.target.object&&t.max.target.object!==a.target.object&&s(a);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,l=r.fullHeight,c=Math.max(0,i[0]-x),m=Math.max(0,i[1]-x),y=Math.min(h(i)+2*x,o-c),f=Math.min(d(i)+2*x,l-m);if(y<=0||f<=0)return;const g=new Uint8Array(y*f*4);this._view._stage.renderer.readHUDVisibility(c,m,y,f,g);let R=!0;const _=null==e.results.max.dist;let I=0;for(const a of n)for(const t of E){const r=4*(Math.min(a.screenPoint[0]+t[0],o)-i[0]+(Math.min(a.screenPoint[1]+t[1],l)-i[1])*y);if(!(r<0||r>=g.length)&&g[r]){R&&(e.results.min.copy(a.result),R=!1),_&&e.results.max.copy(a.result),e.options.store===w.ALL&&e.results.all.splice(I++,0,a.result);break}}}}const x=1,E=(()=>{const e=[],t=x;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class H{constructor(e){this.result=e,this.screenPoint=r()}}let L;function T(e){return L&&L.viewingMode===e||(L=b(e)),L}class A{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function k(e){return"object"==typeof e&&"intersect"in e}const F=l(),S=l(),D=r();export{U as SceneIntersectionHelper,k as isIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as h}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as c,s as d,k as u}from"../../../chunks/vec32.js";import{ZEROS as p,fromValues as _,create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as C}from"./LayerClass.js";import{OverlayContent as R}from"./OverlayContent.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as w}from"./TileRenderer.js";import{TileUpdate as q}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as j,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as I}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as U,ConsumesDepth as G,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as M}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as V}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as W,StoreResults as Y}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as X,intersectTriangles as K}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as Z}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as $}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ee,getVerticalOffsetTerrain as te}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as ie}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as re}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as se}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ne}from"../../webgl/enums.js";const ae=7,oe=10,le=g();var he;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(he||(he={}));let ce=class extends U{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=W.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new se,this._passParameters=new L,this._drawParameters=new ie,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._transparencyState=he.Opaque,this._castShadows=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[Z.OPAQUE_TERRAIN,()=>this._produces()],[Z.TRANSPARENT_TERRAIN,()=>this._produces()],[Z.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?x:Q.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?G:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===he.TransparentWithDraped||e===he.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ee}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,q.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===q.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[C.ELEVATION])i.pendingUpdates&=~q.GEOMETRY;e.resetPendingUpdate(q.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=oe-ae,i=Math.max(0,Math.floor((e.level-t)/ae)*ae);if(this._isGlobal&&0===i)return p;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new w(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==he.Opaque)return;const s=de,n=ue;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,p=e.options.store===Y.MIN,_=!!e.results.ground.target,f=te(e.verticalOffset),m=e.tolerance;let g,T=p&&null!=a.dist?a.dist:1/0;const O=d=>{const _=d.renderData;if(!_?.vao)return;const O=_.geometry;b(le,O.boundingBox);const C=_.localOrigin;null!=f&&(f.localOrigin=C,f.applyToAabb(le));const R=le;if(pe[0]=i[0]-C[0],pe[1]=i[1]-C[1],pe[2]=i[2]-C[2],!X(R,pe,n,m,T))return;const x=(e,t,i)=>{e.set(this.type,d,t,i,h),T=p&&null!=a.dist?a.dist:1/0},P=(n,h)=>{if(null!=h&&n>=0&&(e.options.backfacesTerrain||u(h,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&x(l,n,h),e.options.isFiltered)return;e.options.store===Y.ALL&&(null==g?(g=V(e.ray),x(g,n,h),e.results.all.push(g)):n<g.dist&&x(g,n,h)),(null==a.dist||n<a.dist)&&x(a,n,h),e.options.store!==Y.MIN&&(null==o.dist||n>o.dist)&&x(o,n,h)}},v=_e;c(v,r,C);const{indices:D,indexCount:S}=O,w=O.vertexAttributes,q=w.getField($.POSITION,y),E=new M(q.typedBuffer,3,w.stride/4),A=S/3;if(!f&&A>j){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(D,0,A,E)),e.intersectionData.intersectRay(pe,v,P)}else K(pe,v,0,A,D,E,f,P)},C=this._rootTiles;if(null!=C){(()=>{const t=this._tileIterator;t.reset(C);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,m,T)||_&&this._useStencilForTile(e)?t.skipSubtree():O(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0),e.bindParameters.slot===Z.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&x))return null}else{const t=this.transparency===he.Opaque?Z.OPAQUE_TERRAIN:Z.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===he.Empty)return null;switch(e.output){case I.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(I.Color,e.bindParameters.slot===Z.OCCLUDED_TERRAIN);case I.Shadow:case I.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Shadow,!1)):null;case I.LinearDepth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.LinearDepth,!1);case I.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Normal,!1);case I.ObjectAndLayerIdColor:return this._updateTechnique(I.ObjectAndLayerIdColor,!1);case I.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case I.Color:{const i=e.bindParameters.slot===Z.OCCLUDED_TERRAIN?R.Occluded:R.Color;this._renderMaterialPass(e,t,i);break}case I.LinearDepth:case I.Normal:this._renderAuxiliaryPass(e,t,R.Color,this._visiblePatchesByOrigin);break;case I.Highlight:this._renderAuxiliaryPass(e,t,R.Highlight,this._visiblePatchesByOrigin);break;case I.Shadow:case I.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case I.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,R.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort(((e,t)=>N(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ne.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=J(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===R.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",p),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:p;this._techniqueConfiguration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const h=this.wireframe?ne.LINES:ne.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const r=d[0].renderData.localOrigin;t.program.bindDraw(new ie(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of d){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,h,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const h=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const c=a.geometry.indexCount;e.rctx.bindVAO(o),h.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,c,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(re,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([o({readOnly:!0})],ce.prototype,"_isGlobal",null),e([o()],ce.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],ce.prototype,"renderingDisabled",null),e([o({value:!0})],ce.prototype,"visible",null),e([o()],ce.prototype,"renderPatchBorders",null),e([o()],ce.prototype,"visualizeNormals",null),e([o()],ce.prototype,"cullBackFaces",null),e([o({value:v.FRONT_TO_BACK})],ce.prototype,"renderOrder",null),e([o()],ce.prototype,"wireframe",null),ce=e([l("esri.views.3d.terrain.TerrainRenderer")],ce);const de=f(),ue=f(),pe=f(),_e=f();export{ce as TerrainRenderer,he as TransparencyMode};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as h,s as d,k as u}from"../../../chunks/vec32.js";import{ZEROS as p,fromValues as _,create as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as m}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as g,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as C}from"./OverlayContent.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{PatchRenderData as P}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as w}from"./TileRenderer.js";import{TileUpdate as q}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as A,compareTiles as N}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as j,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as I}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as F}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as U,ConsumesDepth as G,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as M}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as z}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as V}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as W,StoreResults as Y}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as Q}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as X,intersectTriangles as K,MeshIntersectionOptions as Z}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as J}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as $}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as ee}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as te,getVerticalOffsetTerrain as ie}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as re}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as se}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ne}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as ae}from"../../webgl/enums.js";const oe=7,le=10,ce=g();var he;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(he||(he={}));let de=class extends U{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniqueRepository}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=W.TERRAIN,this.isGround=!0,this._tileSize=256,this._techniqueConfiguration=new ne,this._passParameters=new L,this._drawParameters=new re,this._renderDataPool=new s(P),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._transparencyState=he.Opaque,this._castShadows=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=Q.Occlude,this.produces=new Map([[J.OPAQUE_TERRAIN,()=>this._produces()],[J.TRANSPARENT_TERRAIN,()=>this._produces()],[J.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?x:Q.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?G:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===he.TransparentWithDraped||e===he.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return te}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,q.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===q.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~q.GEOMETRY;e.resetPendingUpdate(q.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=le-oe,i=Math.max(0,Math.floor((e.level-t)/oe)*oe);if(this._isGlobal&&0===i)return p;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=z.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=z.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=z.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new w(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==he.Opaque)return;const s=ue,n=pe;h(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,p=e.options.store===Y.MIN,_=!!e.results.ground.target,f=ie(e.verticalOffset),m=e.tolerance;let g,T=p&&null!=a.dist?a.dist:1/0;const O=e.options,R=O.normalRequired||!O.backfacesTerrain,C=new Z(!1,R),x=d=>{const _=d.renderData;if(!_?.vao)return;const x=_.geometry;b(ce,x.boundingBox);const P=_.localOrigin;null!=f&&(f.localOrigin=P,f.applyToAabb(ce));const v=ce;if(_e[0]=i[0]-P[0],_e[1]=i[1]-P[1],_e[2]=i[2]-P[2],!X(v,_e,n,m,T))return;const D=(e,t,i)=>{e.set(this.type,d,t,i,c),T=p&&null!=a.dist?a.dist:1/0},S=(n,c,h)=>{if((!R||null!=h)&&n>=0&&(O.backfacesTerrain||u(h,s)<0)&&(O.invisibleTerrain||!O.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,h),O.isFiltered)return;O.store===Y.ALL&&(null==g?(g=V(e.ray),D(g,n,h),e.results.all.push(g)):n<g.dist&&D(g,n,h)),(null==a.dist||n<a.dist)&&D(a,n,h),O.store!==Y.MIN&&(null==o.dist||n>o.dist)&&D(o,n,h)}},w=fe;h(w,r,P);const{indices:q,indexCount:E}=x,A=x.vertexAttributes,N=A.getField(ee.POSITION,y),I=new M(N.typedBuffer,3,A.stride/4),L=E/3;if(!f&&L>j){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(q,0,L,I)),e.intersectionData.intersectRay(_e,w,C,S)}else K(_e,w,0,L,q,I,f,C,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,m,T)||_&&this._useStencilForTile(e)?t.skipSubtree():x(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0),e.bindParameters.slot===J.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&x))return null}else{const t=this.transparency===he.Opaque?J.OPAQUE_TERRAIN:J.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===he.Empty)return null;switch(e.output){case I.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(I.Color,e.bindParameters.slot===J.OCCLUDED_TERRAIN);case I.Shadow:case I.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Shadow,!1)):null;case I.LinearDepth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.LinearDepth,!1);case I.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Normal,!1);case I.ObjectAndLayerIdColor:return this._updateTechnique(I.ObjectAndLayerIdColor,!1);case I.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(I.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case I.Color:{const i=e.bindParameters.slot===J.OCCLUDED_TERRAIN?C.Occluded:C.Color;this._renderMaterialPass(e,t,i);break}case I.LinearDepth:case I.Normal:this._renderAuxiliaryPass(e,t,C.Color,this._visiblePatchesByOrigin);break;case I.Highlight:this._renderAuxiliaryPass(e,t,C.Highlight,this._visiblePatchesByOrigin);break;case I.Shadow:case I.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case I.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,C.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?F.GridComposite:null!=i.backgroundColor?F.ColorComposite:F.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)A(this.renderOrder,i,t);e.sort(((e,t)=>N(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],ae.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=$(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===C.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",p),n.setUniform4fv("texOffsetAndScale",m));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:p;this._techniqueConfiguration.tileBlendInput===F.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?ae.LINES:ae.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const h=this._visiblePatchesByOrigin;for(const d of h.values()){const r=d[0].renderData.localOrigin;t.program.bindDraw(new re(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of d){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const h=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,h,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(se,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([o({readOnly:!0})],de.prototype,"_isGlobal",null),e([o()],de.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],de.prototype,"renderingDisabled",null),e([o({value:!0})],de.prototype,"visible",null),e([o()],de.prototype,"renderPatchBorders",null),e([o()],de.prototype,"visualizeNormals",null),e([o()],de.prototype,"cullBackFaces",null),e([o({value:v.FRONT_TO_BACK})],de.prototype,"renderOrder",null),e([o()],de.prototype,"wireframe",null),de=e([l("esri.views.3d.terrain.TerrainRenderer")],de);const ue=f(),pe=f(),_e=f(),fe=f();export{de as TerrainRenderer,he as TransparencyMode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectRayTriangles as n}from"../../lib/RayIntersections.js";const
|
|
5
|
+
import{clamp as t}from"../../../../../core/mathUtils.js";import{create as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectRayTriangles as n,MeshIntersectionOptions as r}from"../../lib/RayIntersections.js";const s=200,o=40,a=.8,c=10,h=1e-6;function d(t,e,i){const n=e,r=i;let s=0,o=1/0;for(let a=0;a<3;++a){{const e=t[a];if(n[a]<e){if(r[a]<=h)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]<=-h){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}{const e=t[a+3];if(n[a]>e){if(r[a]>=-h)return!1;const t=(e-n[a])/r[a];s=Math.max(s,t)}else if(r[a]>=h){const t=(e-n[a])/r[a];o=Math.min(o,t)}if(s>o)return!1}}return!0}class l{constructor(t,e,i,n,r){this.aabb=t,this.axis=e,this.d=i,this.midStartIndex=n,this.rightStartIndex=r}}class f{constructor(i,n,r,s){this.globalTriangleVertexIndices=i,this.firstTriangleIndex=n,this.positions=s,this._rayDirection=e(),this._intersectionOptions=I,this.bspNodeTree=new Array;const h=r-n,d=new(h<N?Uint8Array:h<b?Uint16Array:Uint32Array)(h);this.triangleIndexMap=d;for(let t=0;t<h;++t)d[t]=t;{const e=p(i,n,r,s.data,s.stride),f=t(Math.log2(h/o),2,c),m=(t,i,n)=>{const r=x(d,e,t,i),s=i-t;if(s<=o){const e=new l(r,void 0,0,t,i);return this.bspNodeTree.push(e),e}const{axis:c,midValue:h}=y(r),u=g(d,e,t,i,c,h),p=(t,e)=>{if(n>f)return;const i=e-t;return i<o||i>=a*s?void 0:m(t,e,n+1)},N=new l(r,c,h,u.next,u.mid);return this.bspNodeTree.push(N),N.leftNode=p(t,u.next),N.rightNode=p(u.mid,i),N};m(0,h,0)}}intersectRayTriangleRange(t,e){if(t>=e)return;const i=this.positions;n(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,i.data,i.stride,this._intersectionOptions,this._callback,this.triangleIndexMap,this.firstTriangleIndex),f.numFacesTested+=e-t}intersectRay(t,e,i,n){f.numFacesTested=0;const r=t,s=e,o=s[0]-r[0],a=s[1]-r[1],c=s[2]-r[2];if(o*o+a*a+c*c<h)return;this._rayFrom=r;const d=this._rayDirection;d[0]=o,d[1]=a,d[2]=c;const l=this.triangleIndexMap.length;this._callback=n,this._intersectionOptions=i;const m=this.bspNodeTree[0];this.intersectRayBSP(m,0,l)}intersectRayBSP(t,e,i){const n=this._rayFrom,r=this._rayDirection;if(!d(t.aabb,n,r))return;const s=t.axis,o=t.d;if(n[s]<o||r[s]<0){const i=e,n=t.midStartIndex;if(i<n){const e=t.leftNode;void 0!==e?this.intersectRayBSP(e,i,n):this.intersectRayTriangleRange(i,n)}}if(this.intersectRayTriangleRange(t.midStartIndex,t.rightStartIndex),n[s]>o||r[s]>0){const e=t.rightStartIndex,n=i;if(e<n){const i=t.rightNode;void 0!==i?this.intersectRayBSP(i,e,n):this.intersectRayTriangleRange(e,n)}}}get estimatedMemoryUsage(){return this.triangleIndexMap.byteLength}}f.numFacesTested=0;const m=[1/0,1/0,1/0],u=[-1/0,-1/0,-1/0];function g(t,e,i,n,r,s){let o=i,a=n;for(;o<a;){const i=t[o];e[6*i+r+3]<=s?++o:(--a,t[o]=t[a],t[a]=i)}let c=o;for(a=n;c<a;){const i=t[a-1];e[6*i+r]>=s?--a:(t[a-1]=t[c],t[c]=i,++c)}return{next:o,mid:c}}function x(t,e,n,r){if(r<=n)return i(NaN,NaN,NaN,NaN,NaN,NaN);{const i=6*t[n];for(let t=0;t<3;++t)m[t]=e[i+0+t],u[t]=e[i+3+t]}for(let i=n+1;i<r;++i){const n=6*t[i];for(let t=0;t<3;++t)m[t]=Math.min(m[t],e[n+0+t]),u[t]=Math.max(u[t],e[n+3+t])}return i(m[0],m[1],m[2],u[0],u[1],u[2])}function y(t){const e=t[3]-t[0],i=t[4]-t[1],n=t[5]-t[2],r=e>i?e>n?0:i>n?1:2:i>n?1:n>e?2:0;return{axis:r,midValue:(t[r]+t[r+3])/2}}function p(t,e,i,n,r){const s=i-e,o=new Float32Array(6*s);for(let a=0;a<s;++a){const i=3*(a+e),s=t[i]*r,c=t[i+1]*r,h=t[i+2]*r;for(let t=0;t<3;++t){const e=n[s+t],i=n[c+t],r=n[h+t];o[6*a+t]=Math.min(e,i,r),o[6*a+3+t]=Math.max(e,i,r)}}return o}const N=255,b=65535,I=new r;export{f as ComponentIntersectionData,s as componentMinimalSizeForIntersectionData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import t from"../../../../../core/PooledArray.js";import{isArray as o}from"../../../../../core/typedArrayUtil.js";import{a as n}from"../../../../../chunks/vec32.js";import{clone as i}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as s}from"../../../../../geometry/support/Indices.js";import{c as a}from"../../../../../chunks/vec3.js";import{c as l}from"../../../../../chunks/vec33.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{ColorMixModeEnum as m,encodeSymbolColor as h}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as f}from"../../../support/orientedBoundingBox.js";import{glLayout as p}from"../../../support/buffer/glUtil.js";import{newLayout as u}from"../../../support/buffer/InterleavedLayout.js";import d from"./ComponentData.js";import{ComponentObject as g}from"./ComponentObject.js";import b from"./IntersectionGeometry.js";import{Renderable as y}from"./Renderable.js";import{RenderGeometry as v}from"./RenderGeometry.js";import{RenderSubmitSystem as C}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as _}from"./SourceGeometry.js";import{UniformComponentParameters as j}from"./UniformComponentParameters.js";import{ComponentParametersVarying as M,ComponentParametersUniform as x,ComponentParameterSummary as O,ComponentMaterial as w}from"./Material/ComponentMaterial.js";import{attributeLocations as A}from"./Material/ComponentTechnique.js";import{encodeElevationOffset as R}from"./Material/shader/ComponentData.glsl.js";import{getVisibility as D,updateVisibilityWithCount as I}from"../../lib/ComponentUtils.js";import{assert as S}from"../../lib/Util.js";import{VertexAttribute as E}from"../../lib/VertexAttribute.js";import{getVerticalOffsetI3S as V}from"../../lib/verticalOffsetUtils.js";import{EdgeInputBufferLayout as P}from"../../lib/edgeRendering/bufferLayouts.js";import{extractComponentsEdgeLocationsLayout as B}from"../../lib/edgeRendering/edgeProcessing.js";import{BufferManager as N}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as U}from"../../../../webgl/BufferObject.js";import{Usage as T,PrimitiveType as L}from"../../../../webgl/enums.js";import{VertexArrayObject as G}from"../../../../webgl/VertexArrayObject.js";const k=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class q{constructor(e,o){this._renderManager=e,this._viewingMode=o,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._visible=new t,this._hidden=new t,this._renderSubmit=new C(this),this._renderManager.register(this._renderSubmit),this._hasObjectAndLayerId=has("enable-feature:objectAndLayerId-rendering"),this._componentBufferManager=new N(e.rctx,2+(this._hasObjectAndLayerId?1:0))}destroy(){S(0===this._hidden.length&&0===this._visible.length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy(),this._visible.forAll((e=>e.destroy())),this._hidden.forAll((e=>e.destroy())),this._visible.clear(),this._hidden.clear()}createObject(e){const t=e.geometry,o=new d(this._componentBufferManager,s(t.componentOffsets)),n=this._createRenderable(e,o),i=new b(this._viewingMode,t.positionData,o),r=new g(e.transform,e.toMapSpace,e.obb.clone(),o,n,i);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const o=e;t!==o.visible&&(t?(this._hidden.removeUnordered(o),this._visible.push(o)):(this._visible.removeUnordered(o),this._hidden.push(o)),o.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll((e=>e.renderable.meta.cameraDepthSquared=n(t,e.obb.center)))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const o=e.renderable.material;t(o),o.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const o=e;o.components.visibility.reset(t),o.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.components.visibility.forEachComponent(t)}getComponentCount(e){const t=e,o=t.components.visibility.componentCount;return{visible:o,invisible:t.components.count-o}}setComponentData(e,t){const o=e,n=o.renderable.material,i=o.components,r=i.materialDataBuffer,s=i.materialDataIndices,a=new j,l=r.textureBuffer,c=new Uint8Array(4),p=new Uint32Array(c.buffer);let u=0,d=0,g=0,b=i.verticalOffsets,y=1/0,v=-1/0,C=!1,_=!1,w=0;for(let f=0;f<i.count;f++){t(f,a),u+=+(a.externalColor[3]<1),d+=+(a.externalColorMixMode===m.Replace&&1===a.externalColor[3]),g+=+a.castShadows,h(a.externalColor,a.externalColorMixMode,c),c[2]=254&c[2]|+a.castShadows,l.setData(s[f],0,c[0],c[1],c[2],c[3]),C||=f>0&&w!==p[0],w=p[0],_||=0!==a.elevationOffset,_&&null==b&&(b=new Array(f).fill(0)),null!=b&&(b[f]=a.elevationOffset),y=Math.min(y,a.elevationOffset),v=Math.max(v,a.elevationOffset),R(a.elevationOffset,c),l.setData(s[f],1,c[0],c[1],c[2],c[3]);const e=a.objectAndLayerIdColor;null!=e&&l.setData(s[f],2,e[0],e[1],e[2],e[3]),a.pickable!==D(i.pickability,f)&&(i.pickability=I(i.pickability,i.count,f,a.pickable))}i.verticalOffsets=_?b:null,o.offsetObb=_?f(o.obb,y,v,this._viewingMode,o.offsetObb??o.obb.clone()):null,C||_||this._hasObjectAndLayerId?(n.componentParameters=new M,n.componentParameters.castShadows=H(g,i.count),n.componentParameters.transparent=H(u,i.count),n.componentParameters.opaqueOverride=H(d,i.count),n.componentParameters.texture=l,l.updateTexture()):(n.componentParameters=new x,n.componentParameters.castShadows=a.castShadows?O.All:O.None,n.componentParameters.externalColor=a.externalColor,n.componentParameters.externalColorMixMode=a.externalColorMixMode),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,o,n=!1){e.intersectionGeometry.getComponentAabb(t,o);const i=e,r=i.components.verticalOffsets;if(n||null==r)return o;const s=r[t];if(this._viewingMode===c.Local||0===s)return o[2]+=s,o[5]+=s,o;const a=V(s);return a.localOrigin=i.transform.position,a.applyToAabb(o)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,o){return e.intersectionGeometry.getComponentPositions(t,o)}expandRangeWithComponentObjectElevationRange(e,t,o,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const i=e,r=i.components,s=r.count,a=r.verticalOffsets,l=i.intersectionGeometry,m=this._viewingMode===c.Local,h=l.getComponentAabbs(),f=X;let p=1/0,u=-1/0;for(let c=0;c<s;c++){const e=6*c,r=a?.[c]??0;let s=1/0,l=-1/0;if(m)s=h[e+2]+r+t,l=h[e+5]+r+t;else{if(f[0]=h[e],f[1]=h[e+1],f[2]=h[e+2],f[3]=h[e+3],f[4]=h[e+4],f[5]=h[e+5],0!==r){const e=V(r);e.localOrigin=i.transform.position,e.applyToAabb(f)}const s=Math.max(Math.abs(f[3]),Math.abs(f[0])),a=Math.max(Math.abs(f[4]),Math.abs(f[1])),l=t+f[5]+o;n.expandElevationRangeValues(t+f[2],Math.sqrt(s*s+a*a+l*l)-o)}n.expandElevationRangeValues(s,l),p=Math.min(p,s),u=Math.max(u,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=u}intersect(e,t,o,n,i,r,s){const a=e,{transform:l}=a,{position:c}=l;return null!=i&&(i.localOrigin=c),a.intersectionGeometry.intersect(t,o,n,i,a.components.verticalOffsets,r,l,s??!1)}addEdges(e,t,o,n){const i=e,{indices:r,positions:s}=i.intersectionGeometry,a=i.components.offsets;return t.addComponentObject(i,s,r,a,o,n)}async extractEdgeInformation(e,t,o){const n=e,r=n.components.visibility;if(r.allInvisible())return{buffer:B.createBuffer(0),origin:[0,0,0]};const{indices:s,positions:c}=n.intersectionGeometry,m=n.components.offsets,h=P.createBuffer(c.length/3);l(h.position.typedBuffer,c,h.position.typedBufferStride,3),a(h.position,h.position,n.transform.rotationScale),this._setComponentIndices(h.componentIndex,s,m);const f=h.count,p=this._computeVisibilityIndices(s,r,m,f);return{origin:i(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:p,indicesLength:p.length,skipDeduplicate:!0,data:h,writerSettings:{reducedPrecision:!1,variants:0}},o)}}_setComponentIndices(e,t,o){let n=0;for(let i=0;i<o.length-1;i++){const r=o[i],s=o[i+1];for(let o=r;o<s;o++){const i=t?t[o]:o;e.set(i,n)}n++}}_computeVisibilityIndices(e,t,n,i){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange(((e,t)=>(r+=n[t]-n[e],!0)));const s=o(e)?new Array(r):2===e?.BYTES_PER_ELEMENT||i<=65536?new Uint16Array(r):new Uint32Array(r);let a=0;return t.forEachComponentRange(((t,o)=>{const i=n[t],r=n[o];for(let n=i;n<r;n++)s[a++]=e?e[n]:n;return!0})),s}addComponentHighlight(e,t){const o=e.components;null==o.highlightCounts&&(o.highlightCounts=new Uint32Array(o.count+1));0===o.highlightCounts[t]++&&(o.highlightsDirty(),this._notifyDirty()),o.highlightCounts[o.count]++}removeComponentHighlight(e,t){const o=e.components;if(null==o.highlightCounts)return void k().warn("Removing non-existing highlight.");const n=o.highlightCounts[t],i=o.highlightCounts[o.count];if(0!==n){if(n>1)return o.highlightCounts[t]=n-1,void(o.highlightCounts[o.count]=i-1);o.highlightCounts[t]=0,o.highlightsDirty(),this._notifyDirty(),1===i?o.highlightCounts=null:o.highlightCounts[o.count]=i-1}else k().warn("Removing non-existing highlight.")}clearHighlights(e){const t=e.components;null!=t.highlightCounts&&(t.highlightCounts=null,t.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t){const o=this._renderManager.rctx,n=e.geometry,i=n.vertices.layoutParameters,r=U.createVertex(o,T.STATIC_DRAW,n.vertices.data),s=n.indices?U.createIndex(o,T.STATIC_DRAW,n.indices):null,a=p(_(i)),l=new Uint16Array(n.vertices.count);for(let p=0;p<t.count;p++){const e=t.offsets[p],o=t.offsets[p+1],i=t.materialDataIndices[p];if(null!=n.indices)for(let t=e;t<o;t++){l[n.indices[t]]=i}else for(let t=e;t<o;t++)l[t]=i}const c=U.createVertex(o,T.STATIC_DRAW,l.buffer),m=new w(e.transform,e.toMapSpace),h=new G(o,A,{data:a,componentIndices:W},{data:r,componentIndices:c},s),f=new v(h,L.TRIANGLES,i,null!=s),u={cameraDepthSquared:.5,gpuMemoryEstimate:r.usedMemory+c.usedMemory+(null!=s?s.usedMemory:0)};return new y(m,f,u)}_notifyDirty(){this._renderManager.notifyDirty()}}const W=p(u().u16(E.COMPONENTINDEX));function H(e,t){return e===t?O.All:0===e?O.None:O.Some}const X=r();export{q as ComponentObjectCollection};
|
|
5
|
+
import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import t from"../../../../../core/PooledArray.js";import{isArray as o}from"../../../../../core/typedArrayUtil.js";import{a as n}from"../../../../../chunks/vec32.js";import{clone as i}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as s}from"../../../../../geometry/support/Indices.js";import{c as a}from"../../../../../chunks/vec3.js";import{c as l}from"../../../../../chunks/vec33.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{ColorMixModeEnum as m,encodeSymbolColor as h}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as f}from"../../../support/orientedBoundingBox.js";import{glLayout as p}from"../../../support/buffer/glUtil.js";import{newLayout as u}from"../../../support/buffer/InterleavedLayout.js";import d from"./ComponentData.js";import{ComponentObject as g}from"./ComponentObject.js";import b from"./IntersectionGeometry.js";import{Renderable as y}from"./Renderable.js";import{RenderGeometry as v}from"./RenderGeometry.js";import{RenderSubmitSystem as C}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as _}from"./SourceGeometry.js";import{UniformComponentParameters as j}from"./UniformComponentParameters.js";import{ComponentParametersVarying as M,ComponentParametersUniform as x,ComponentParameterSummary as O,ComponentMaterial as w}from"./Material/ComponentMaterial.js";import{attributeLocations as A}from"./Material/ComponentTechnique.js";import{encodeElevationOffset as R}from"./Material/shader/ComponentData.glsl.js";import{getVisibility as D,updateVisibilityWithCount as I}from"../../lib/ComponentUtils.js";import{assert as S}from"../../lib/Util.js";import{VertexAttribute as E}from"../../lib/VertexAttribute.js";import{getVerticalOffsetI3S as V}from"../../lib/verticalOffsetUtils.js";import{EdgeInputBufferLayout as P}from"../../lib/edgeRendering/bufferLayouts.js";import{extractComponentsEdgeLocationsLayout as B}from"../../lib/edgeRendering/edgeProcessing.js";import{BufferManager as N}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as U}from"../../../../webgl/BufferObject.js";import{Usage as T,PrimitiveType as L}from"../../../../webgl/enums.js";import{VertexArrayObject as G}from"../../../../webgl/VertexArrayObject.js";const k=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class q{constructor(e,o){this._renderManager=e,this._viewingMode=o,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._visible=new t,this._hidden=new t,this._renderSubmit=new C(this),this._renderManager.register(this._renderSubmit),this._hasObjectAndLayerId=has("enable-feature:objectAndLayerId-rendering"),this._componentBufferManager=new N(e.rctx,2+(this._hasObjectAndLayerId?1:0))}destroy(){S(0===this._hidden.length&&0===this._visible.length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy(),this._visible.forAll((e=>e.destroy())),this._hidden.forAll((e=>e.destroy())),this._visible.clear(),this._hidden.clear()}createObject(e){const t=e.geometry,o=new d(this._componentBufferManager,s(t.componentOffsets)),n=this._createRenderable(e,o),i=new b(this._viewingMode,t.positionData,o),r=new g(e.transform,e.toMapSpace,e.obb.clone(),o,n,i);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const o=e;t!==o.visible&&(t?(this._hidden.removeUnordered(o),this._visible.push(o)):(this._visible.removeUnordered(o),this._hidden.push(o)),o.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll((e=>e.renderable.meta.cameraDepthSquared=n(t,e.obb.center)))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const o=e.renderable.material;t(o),o.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const o=e;o.components.visibility.reset(t),o.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.components.visibility.forEachComponent(t)}getComponentCount(e){const t=e,o=t.components.visibility.componentCount;return{visible:o,invisible:t.components.count-o}}setComponentData(e,t){const o=e,n=o.renderable.material,i=o.components,r=i.materialDataBuffer,s=i.materialDataIndices,a=new j,l=r.textureBuffer,c=new Uint8Array(4),p=new Uint32Array(c.buffer);let u=0,d=0,g=0,b=i.verticalOffsets,y=1/0,v=-1/0,C=!1,_=!1,w=0;for(let f=0;f<i.count;f++){t(f,a),u+=+(a.externalColor[3]<1),d+=+(a.externalColorMixMode===m.Replace&&1===a.externalColor[3]),g+=+a.castShadows,h(a.externalColor,a.externalColorMixMode,c),c[2]=254&c[2]|+a.castShadows,l.setData(s[f],0,c[0],c[1],c[2],c[3]),C||=f>0&&w!==p[0],w=p[0],_||=0!==a.elevationOffset,_&&null==b&&(b=new Array(f).fill(0)),null!=b&&(b[f]=a.elevationOffset),y=Math.min(y,a.elevationOffset),v=Math.max(v,a.elevationOffset),R(a.elevationOffset,c),l.setData(s[f],1,c[0],c[1],c[2],c[3]);const e=a.objectAndLayerIdColor;null!=e&&l.setData(s[f],2,e[0],e[1],e[2],e[3]),a.pickable!==D(i.pickability,f)&&(i.pickability=I(i.pickability,i.count,f,a.pickable))}i.verticalOffsets=_?b:null,o.offsetObb=_?f(o.obb,y,v,this._viewingMode,o.offsetObb??o.obb.clone()):null,C||_||this._hasObjectAndLayerId?(n.componentParameters=new M,n.componentParameters.castShadows=H(g,i.count),n.componentParameters.transparent=H(u,i.count),n.componentParameters.opaqueOverride=H(d,i.count),n.componentParameters.texture=l,l.updateTexture()):(n.componentParameters=new x,n.componentParameters.castShadows=a.castShadows?O.All:O.None,n.componentParameters.externalColor=a.externalColor,n.componentParameters.externalColorMixMode=a.externalColorMixMode),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,o,n=!1){e.intersectionGeometry.getComponentAabb(t,o);const i=e,r=i.components.verticalOffsets;if(n||null==r)return o;const s=r[t];if(this._viewingMode===c.Local||0===s)return o[2]+=s,o[5]+=s,o;const a=V(s);return a.localOrigin=i.transform.position,a.applyToAabb(o)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,o){return e.intersectionGeometry.getComponentPositions(t,o)}expandRangeWithComponentObjectElevationRange(e,t,o,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const i=e,r=i.components,s=r.count,a=r.verticalOffsets,l=i.intersectionGeometry,m=this._viewingMode===c.Local,h=l.getComponentAabbs(),f=X;let p=1/0,u=-1/0;for(let c=0;c<s;c++){const e=6*c,r=a?.[c]??0;let s=1/0,l=-1/0;if(m)s=h[e+2]+r+t,l=h[e+5]+r+t;else{if(f[0]=h[e],f[1]=h[e+1],f[2]=h[e+2],f[3]=h[e+3],f[4]=h[e+4],f[5]=h[e+5],0!==r){const e=V(r);e.localOrigin=i.transform.position,e.applyToAabb(f)}const s=Math.max(Math.abs(f[3]),Math.abs(f[0])),a=Math.max(Math.abs(f[4]),Math.abs(f[1])),l=t+f[5]+o;n.expandElevationRangeValues(t+f[2],Math.sqrt(s*s+a*a+l*l)-o)}n.expandElevationRangeValues(s,l),p=Math.min(p,s),u=Math.max(u,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=u}intersect(e,t,o,n,i,r,s){const a=e,{transform:l}=a,{position:c}=l;return null!=i&&(i.localOrigin=c),a.intersectionGeometry.intersect(t,o,n,i,a.components.verticalOffsets,l,r,s)}addEdges(e,t,o,n){const i=e,{indices:r,positions:s}=i.intersectionGeometry,a=i.components.offsets;return t.addComponentObject(i,s,r,a,o,n)}async extractEdgeInformation(e,t,o){const n=e,r=n.components.visibility;if(r.allInvisible())return{buffer:B.createBuffer(0),origin:[0,0,0]};const{indices:s,positions:c}=n.intersectionGeometry,m=n.components.offsets,h=P.createBuffer(c.length/3);l(h.position.typedBuffer,c,h.position.typedBufferStride,3),a(h.position,h.position,n.transform.rotationScale),this._setComponentIndices(h.componentIndex,s,m);const f=h.count,p=this._computeVisibilityIndices(s,r,m,f);return{origin:i(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:p,indicesLength:p.length,skipDeduplicate:!0,data:h,writerSettings:{reducedPrecision:!1,variants:0}},o)}}_setComponentIndices(e,t,o){let n=0;for(let i=0;i<o.length-1;i++){const r=o[i],s=o[i+1];for(let o=r;o<s;o++){const i=t?t[o]:o;e.set(i,n)}n++}}_computeVisibilityIndices(e,t,n,i){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange(((e,t)=>(r+=n[t]-n[e],!0)));const s=o(e)?new Array(r):2===e?.BYTES_PER_ELEMENT||i<=65536?new Uint16Array(r):new Uint32Array(r);let a=0;return t.forEachComponentRange(((t,o)=>{const i=n[t],r=n[o];for(let n=i;n<r;n++)s[a++]=e?e[n]:n;return!0})),s}addComponentHighlight(e,t){const o=e.components;null==o.highlightCounts&&(o.highlightCounts=new Uint32Array(o.count+1));0===o.highlightCounts[t]++&&(o.highlightsDirty(),this._notifyDirty()),o.highlightCounts[o.count]++}removeComponentHighlight(e,t){const o=e.components;if(null==o.highlightCounts)return void k().warn("Removing non-existing highlight.");const n=o.highlightCounts[t],i=o.highlightCounts[o.count];if(0!==n){if(n>1)return o.highlightCounts[t]=n-1,void(o.highlightCounts[o.count]=i-1);o.highlightCounts[t]=0,o.highlightsDirty(),this._notifyDirty(),1===i?o.highlightCounts=null:o.highlightCounts[o.count]=i-1}else k().warn("Removing non-existing highlight.")}clearHighlights(e){const t=e.components;null!=t.highlightCounts&&(t.highlightCounts=null,t.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t){const o=this._renderManager.rctx,n=e.geometry,i=n.vertices.layoutParameters,r=U.createVertex(o,T.STATIC_DRAW,n.vertices.data),s=n.indices?U.createIndex(o,T.STATIC_DRAW,n.indices):null,a=p(_(i)),l=new Uint16Array(n.vertices.count);for(let p=0;p<t.count;p++){const e=t.offsets[p],o=t.offsets[p+1],i=t.materialDataIndices[p];if(null!=n.indices)for(let t=e;t<o;t++){l[n.indices[t]]=i}else for(let t=e;t<o;t++)l[t]=i}const c=U.createVertex(o,T.STATIC_DRAW,l.buffer),m=new w(e.transform,e.toMapSpace),h=new G(o,A,{data:a,componentIndices:W},{data:r,componentIndices:c},s),f=new v(h,L.TRIANGLES,i,null!=s),u={cameraDepthSquared:.5,gpuMemoryEstimate:r.usedMemory+c.usedMemory+(null!=s?s.usedMemory:0)};return new y(m,f,u)}_notifyDirty(){this._renderManager.notifyDirty()}}const W=p(u().u16(E.COMPONENTINDEX));function H(e,t){return e===t?O.All:0===e?O.None:O.Some}const X=r();export{q as ComponentObjectCollection};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{invert as t,transpose as n}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{z as e,t as s,F as i,s as a,n as m,c,k as p,b as r,o as h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as x}from"../../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../../geometry/support/FloatArray.js";import{compactIndices as _,getContinuousIndexArray as I}from"../../../../../geometry/support/Indices.js";import{ViewingMode as f}from"../../../../ViewingMode.js";import{componentMinimalSizeForIntersectionData as C,ComponentIntersectionData as u}from"./ComponentIntersectionData.js";import{Vertices as M}from"../../lib/Attribute.js";import{getVisibility as g}from"../../lib/ComponentUtils.js";import{computeInvDir as A,intersectAabbInvDir as
|
|
5
|
+
import{invert as t,transpose as n}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{z as e,t as s,F as i,s as a,n as m,c,k as p,b as r,o as h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as x}from"../../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../../geometry/support/FloatArray.js";import{compactIndices as _,getContinuousIndexArray as I}from"../../../../../geometry/support/Indices.js";import{ViewingMode as f}from"../../../../ViewingMode.js";import{componentMinimalSizeForIntersectionData as C,ComponentIntersectionData as u}from"./ComponentIntersectionData.js";import{Vertices as M}from"../../lib/Attribute.js";import{getVisibility as g}from"../../lib/ComponentUtils.js";import{computeInvDir as A,intersectAabbInvDir as y,intersectTriangles as j}from"../../lib/RayIntersections.js";class B{constructor(t,n,o){this.viewingMode=t,this.positionData=n,this._components=o,this._planetCenter=d(),this._planetNorth=d(),this._componentIndicesForBsp=null,this._componentBspNodes=[],this._aabb=[0,0,0,0,0,0],this._indices=n.indices?_(n.indices):I(n.positions.length/3),this._positions=n.positions,this._componentIntersectionData=new Array(o.count)}destroy(){this._positions=null,this._indices=null,this._componentIntersectionData.length=0,this._perComponentAabbs=null}getComponentAabb(t,n){const o=this._ensureComponentAabbs(),e=6*t;return n[0]=o[e],n[1]=o[e+1],n[2]=o[e+2],n[3]=o[e+3],n[4]=o[e+4],n[5]=o[e+5],n}getComponentAabbs(){return this._ensureComponentAabbs()}_ensureComponentAabbs(){return this._perComponentAabbs||(this._perComponentAabbs=this._computePerComponentAabbs()),this._perComponentAabbs}getComponentPositions(t,n){n.indices=this._indices,n.data=this._positions,n.stride=3,n.startIndex=this._components.offsets[t],n.endIndex=this._components.offsets[t+1]}intersect(o,p,r,h,d,l,x,b){const{position:_}=l,I=e(D,o,_),g=e(F,p,_),B=t(R,l.rotationScale);s(I,I,B),s(g,g,B);const w=n(P,B),k=new M(this._positions,3),z=this._indices,E=this._components.offsets,G=A(I,g,v);if(this.viewingMode===f.Global){const t=this._planetCenter;i(t,_),s(t,t,B);const n=this._planetNorth;a(n,0,0,1),s(n,n,B),m(n,n)}const L=c(V,I),O=c(U,g),S=e(q,g,I);m(S,S);const{isVerticalRay:T}=x,H=t=>{const n=this.getComponentAabb(t,N);if(null!=d){const n=d[t];null==h||T?(I[2]=L[2]-n,g[2]=O[2]-n):h.componentOffset=n}if(null==h||T||h.applyToAabb(n),!y(n,I,G,r))return;const o=E[t]/3,e=E[t+1]/3,i=(n,o,e)=>b(t,n,e?s(e,e,w):null,o);(null==h||T)&&e-o>C?(null==this._componentIntersectionData[t]&&(this._componentIntersectionData[t]=new u(this._indices,o,e,k)),this._componentIntersectionData[t].intersectRay(I,g,x,i)):j(I,g,o,e,z,k,h,x,i)};this._intersectComponents(H,T,I,g)}_intersectComponents(t,n,o,s){const i=this._components.pickability,a=this._components.visibility;if(this._components.visibility.componentCount<H){const n=n=>(g(i,n)&&t(n),!0);return void a.forEachComponent(n)}0===this._componentBspNodes.length&&this._generateComponentBspRoot();const c=this._componentIndicesForBsp,r=n=>{g(i,n)&&a.isVisible(n)&&t(n)},h=(t,n)=>{for(let o=t;o<n;++o)r(c[o])};if(n){let t=0;for(;t>=0;){const n=this._componentBspNodes[t],e=n.plane;if(!e||-1===n.child0&&-1===n.child1){h(n.minComponentIndexIndex,n.maxComponentIndexIndex);break}{h(n.minMidComponentIndexIndex,n.maxMidComponentIndexIndex);const s=p(e,o)-e[3];if(s<0){if(-1===n.child0){h(n.minComponentIndexIndex,n.minMidComponentIndexIndex);break}t=n.child0}else{if(!(s>0))break;if(-1===n.child1){h(n.maxMidComponentIndexIndex,n.maxComponentIndexIndex);break}t=n.child1}}}}else{const t=J;e(t,s,o),m(t,t);const n=this._componentBspNodes,i=e=>{const s=n[e],a=s.plane;if(!a||-1===s.child0&&-1===s.child1)h(s.minComponentIndexIndex,s.maxComponentIndexIndex);else{const n=p(a,o)-a[3],e=p(a,t);s.minComponentIndexIndex<s.minMidComponentIndexIndex&&(n<=0||e<0)&&(-1!==s.child0?i(s.child0):h(s.minComponentIndexIndex,s.minMidComponentIndexIndex)),h(s.minMidComponentIndexIndex,s.maxMidComponentIndexIndex),s.maxMidComponentIndexIndex<s.maxComponentIndexIndex&&(n>=0||e>0)&&(-1!==s.child1?i(s.child1):h(s.maxMidComponentIndexIndex,s.maxComponentIndexIndex))}};i(0)}}_generateComponentBspRoot(){const t=this._components.count,n=new Uint16Array(t);this._componentIndicesForBsp=n;for(let e=0;e<t;++e)n[e]=e;const o=this._ensureComponentAabbs(),s=this._planetCenter,d=this._planetNorth,x=G;i(x,s),m(x,x);r(L,d,x);const b=this._aabb,_=b[2],I=[];let C=0;const u=this._componentBspNodes;u.length=0;const M=(t,n)=>{const e=6*t,s=o[e],i=o[e+1],m=o[e+2],c=o[e+3],r=o[e+4],h=o[e+5],d=a(O,.5*(s+c),.5*(i+r),.5*(m+h)),l=.5*(c-s),x=.5*(r-i),b=.5*(h-m),_=Math.sqrt(l*l+x*x+b*b),I=n,f=n[3],C=p(I,d)-f;return Math.abs(C)>_?Math.sign(C):0},g=(t,e,s)=>{let i=1/0,a=1/0,m=1/0,c=-1/0,p=-1/0,r=-1/0;for(let h=e;h<s;++h){const t=6*n[h];i=Math.min(i,o[t]),c=Math.max(c,o[t+3]),a=Math.min(a,o[t+1]),p=Math.max(p,o[t+4]),m=Math.min(m,o[t+2]),r=Math.max(r,o[t+5])}t[0]=i,t[1]=a,t[2]=m,t[3]=c,t[4]=p,t[5]=r},A=this.viewingMode===f.Local;let y=!1;if(!A){const t=a(O,.5*(b[0]+b[3]),.5*(b[1]+b[4]),.5*(b[2]+b[5])),n=h(s,t);y=_>.5*n}const j=(t,o,i,h,x)=>{const b=u.length;let _;if(y||i>=T||o-t<S)_=new w(t,o,o,o,null);else{g(k,t,o);const h=k[0],x=k[1],f=k[2],C=k[3],u=k[4],y=C-h,B=u-x,v=l(),N=v;if(A)y>=B?(a(N,1,0,0),v[3]=-.5*(h+C)):(a(N,0,1,0),v[3]=-.5*(x+u));else{const t=z,n=E;a(t,.5*(h+C),.5*(x+u),f),e(t,t,s),m(t,t),r(n,t,d),m(n,n),y>=B?c(N,n):(r(N,n,t),m(N,N)),v[3]=p(N,s)}let D,F;{let e=t,s=o;for(;e<s;){const t=n[e];M(t,v)<0?++e:(--s,n[e]=n[s],n[s]=t)}D=e;let i=e;for(s=o;i<s;){const t=n[s-1];M(t,v)>0?--s:(n[s-1]=n[i],n[i]=t,++i)}F=s}_=new w(t,D,F,o,v),D>=t+S&&I.push((()=>j(t,D,i+1,b,!0))),o>=F+S&&I.push((()=>j(F,o,i+1,b,!1)))}if(u.push(_),-1!==h){const t=u[h];x?t.child0=b:t.child1=b}};for(I.push((()=>j(0,t,0,-1,!1)));C<I.length;){(0,I[C])(),++C}}_computePerComponentAabbs(){const t=this._components.count,n=b(6*t),o=this._indices,e=this._positions,s=this._components.offsets;let i=0,a=1/0,m=1/0,c=1/0,p=-1/0,r=-1/0,h=-1/0;for(let d=0;d<t;d++){const t=s[d],l=s[d+1];let x=1/0,b=1/0,_=1/0,I=-1/0,f=-1/0,C=-1/0;for(let n=t;n<l;n++){const t=3*o[n],s=e[t],i=e[t+1],a=e[t+2];x=Math.min(x,s),b=Math.min(b,i),_=Math.min(_,a),I=Math.max(I,s),f=Math.max(f,i),C=Math.max(C,a)}n[i++]=x,n[i++]=b,n[i++]=_,n[i++]=I,n[i++]=f,n[i++]=C,a=Math.min(a,x),m=Math.min(m,b),c=Math.min(c,_),p=Math.max(p,I),r=Math.max(r,f),h=Math.max(h,C)}return this._aabb[0]=a,this._aabb[1]=m,this._aabb[2]=c,this._aabb[3]=p,this._aabb[4]=r,this._aabb[5]=h,n}get positions(){return this._positions}get indices(){return this._indices}get aabb(){return this._ensureComponentAabbs(),this._aabb}}class w{constructor(t,n,o,e,s){this.minComponentIndexIndex=t,this.minMidComponentIndexIndex=n,this.maxMidComponentIndexIndex=o,this.maxComponentIndexIndex=e,this.plane=s,this.child0=-1,this.child1=-1}}const v=d(),N=x(),k=[0,0,0,0,0,0],D=d(),F=d(),R=o(),P=o(),V=d(),U=d(),q=d(),z=d(),E=d(),G=d(),L=d(),O=d(),S=5,T=10,H=7,J=d();export{B as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var i,
|
|
5
|
+
var i,e;!function(i){i[i.OBJECT=0]="OBJECT",i[i.HUD=1]="HUD",i[i.TERRAIN=2]="TERRAIN",i[i.OVERLAY=3]="OVERLAY",i[i.I3S=4]="I3S",i[i.PCL=5]="PCL",i[i.LOD=6]="LOD",i[i.VOXEL=7]="VOXEL",i[i.TILES3D=8]="TILES3D"}(i||(i={}));class t{constructor(){this.verticalOffset=0,this.selectionMode=!1,this.hud=!0,this.selectOpaqueTerrainOnly=!0,this.invisibleTerrain=!1,this.backfacesTerrain=!0,this.isFiltered=!1,this.filteredLayerUids=[],this.store=e.ALL,this.normalRequired=!0}}!function(i){i[i.MIN=0]="MIN",i[i.MINMAX=1]="MINMAX",i[i.ALL=2]="ALL"}(e||(e={}));export{t as IntersectorOptions,i as IntersectorType,e as StoreResults};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as t,length as e,normalize as r,dot as i,scale as s,add as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as n,b as h}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as b}from"../../../../geometry/support/Indices.js";import{Attribute as v,Vertices as m}from"./Attribute.js";import{compressNormal as p}from"./Normals.js";import{intersectTriangles as x}from"./RayIntersections.js";import{VertexAttribute as A}from"./VertexAttribute.js";class d{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class f extends d{constructor(t){super(t),this.vertexAttributeColor=c(255,255,255,255),this.size=new Array,this.vertexAttributePosition=u(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(a){this.size=a;const{numVerticesTotal:l,pathVertexData:c,path:u,positions:b,profileRightAxes:v,profileUpAxes:m,profileVertexAndNormals:x}=this.builder;for(let A=0;A<l;++A){let l=c[A];const d=0===l||l===u.vertices.length-1;l*=3;const f=V;let g=0,D=0;const N=4*A,j=n(R,v[N],v[N+1],v[N+2]),E=n(w,m[N],m[N+1],m[N+2]),y=t(P,x[N]*a[0],x[N+1]*a[1]);if(d)h(f,E,j),g=v[N+3]*a[0],D=m[N+3];else{const a=I,h=C;t(a,v[N+3],m[N+3]);const l=e(a);r(a,a);const c=i(y,a);if(Math.abs(c)>l){t(h,-a[1],a[0]);const e=i(y,h);s(a,a,l*Math.sign(c)),s(h,h,e),o(y,a,h)}n(f,0,0,0)}const T=n(O,j[0]*y[0]+E[0]*y[1],j[1]*y[0]+E[1]*y[1],j[2]*y[0]+E[2]*y[1]),L=3*A;this.vertexAttributePosition[L]=b[l]+T[0]+f[0]*g,this.vertexAttributePosition[L+1]=b[l+1]+T[1]+f[1]*g,this.vertexAttributePosition[L+2]=b[l+2]+T[2]+f[2]*g;const M=t(P,x[N+2],x[N+3]);p(this.vertexAttributeNormal,A,j[0]*M[0]+E[0]*M[1]+f[0]*D,j[1]*M[0]+E[1]*M[1]+f[1]*D,j[2]*M[0]+E[2]*M[1]+f[2]*D)}}createGeometryData(){const t=this.builder.vertexIndices.length,{normalIndices:e,vertexIndices:r}=this.builder;return[[A.POSITION,new v(this.vertexAttributePosition,r,3,!0)],[A.NORMALCOMPRESSED,new v(this.vertexAttributeNormal,e,2,!0)],[A.COLOR,new v(this.vertexAttributeColor,b(t),4)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,r){const
|
|
5
|
+
import{set as t,length as e,normalize as r,dot as i,scale as s,add as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as n,b as h}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as b}from"../../../../geometry/support/Indices.js";import{Attribute as v,Vertices as m}from"./Attribute.js";import{compressNormal as p}from"./Normals.js";import{intersectTriangles as x}from"./RayIntersections.js";import{VertexAttribute as A}from"./VertexAttribute.js";class d{constructor(t){this.builder=t}onPathChanged(t){this.builder.onPathChanged()}}class f extends d{constructor(t){super(t),this.vertexAttributeColor=c(255,255,255,255),this.size=new Array,this.vertexAttributePosition=u(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(t){this.vertexAttributeColor[0]=255*t[0],this.vertexAttributeColor[1]=255*t[1],this.vertexAttributeColor[2]=255*t[2],this.vertexAttributeColor[3]=255*(t.length>3?t[3]:1)}bake(a){this.size=a;const{numVerticesTotal:l,pathVertexData:c,path:u,positions:b,profileRightAxes:v,profileUpAxes:m,profileVertexAndNormals:x}=this.builder;for(let A=0;A<l;++A){let l=c[A];const d=0===l||l===u.vertices.length-1;l*=3;const f=V;let g=0,D=0;const N=4*A,j=n(R,v[N],v[N+1],v[N+2]),E=n(w,m[N],m[N+1],m[N+2]),y=t(P,x[N]*a[0],x[N+1]*a[1]);if(d)h(f,E,j),g=v[N+3]*a[0],D=m[N+3];else{const a=I,h=C;t(a,v[N+3],m[N+3]);const l=e(a);r(a,a);const c=i(y,a);if(Math.abs(c)>l){t(h,-a[1],a[0]);const e=i(y,h);s(a,a,l*Math.sign(c)),s(h,h,e),o(y,a,h)}n(f,0,0,0)}const T=n(O,j[0]*y[0]+E[0]*y[1],j[1]*y[0]+E[1]*y[1],j[2]*y[0]+E[2]*y[1]),L=3*A;this.vertexAttributePosition[L]=b[l]+T[0]+f[0]*g,this.vertexAttributePosition[L+1]=b[l+1]+T[1]+f[1]*g,this.vertexAttributePosition[L+2]=b[l+2]+T[2]+f[2]*g;const M=t(P,x[N+2],x[N+3]);p(this.vertexAttributeNormal,A,j[0]*M[0]+E[0]*M[1]+f[0]*D,j[1]*M[0]+E[1]*M[1]+f[1]*D,j[2]*M[0]+E[2]*M[1]+f[2]*D)}}createGeometryData(){const t=this.builder.vertexIndices.length,{normalIndices:e,vertexIndices:r}=this.builder;return[[A.POSITION,new v(this.vertexAttributePosition,r,3,!0)],[A.NORMALCOMPRESSED,new v(this.vertexAttributeNormal,e,2,!0)],[A.COLOR,new v(this.vertexAttributeColor,b(t),4)]]}onPathChanged(t){super.onPathChanged(t),this.bake(this.size)}intersect(t,e,r,i){const s=this.builder.vertexIndices,o=new m(this.vertexAttributePosition,3),a=s.length/3;x(t,e,0,a,s,o,void 0,r,((t,e,r)=>{i(t,r,e,!1)}))}}class g extends d{constructor(t,e,r,i){super(t),this.sizeAttributeValue=e,this.colorAttributeValue=r,this.opacityAttributeValue=i,this.vvData=null,this.baked=new f(t),this.vvData=u(4*this.builder.path.vertices.length);for(let s=0;s<this.builder.path.vertices.length;++s){this.vvData[4*s]=e,this.vvData[4*s+1]=r,this.vvData[4*s+2]=i;const t=0===s||s===this.builder.path.vertices.length-1;this.vvData[4*s+3]=t?1:0}}createGeometryData(){const{positions:t,profileRightAxes:e,profileUpAxes:r,profileVertexAndNormals:i,pathVertexIndices:s,vertexIndices:o}=this.builder;return[[A.POSITION,new v(t,s,3,!0)],[A.PROFILERIGHT,new v(e,o,4,!0)],[A.PROFILEUP,new v(r,o,4,!0)],[A.PROFILEVERTEXANDNORMAL,new v(i,o,4,!0)],[A.FEATUREVALUE,new v(this.vvData,s,4,!0)]]}onPathChanged(t){super.onPathChanged(t);const e=t.getMutableAttribute(A.POSITION);e&&(e.data=this.builder.positions)}}const P=a(),I=a(),C=a(),O=l(),V=l(),R=l(),w=l();export{g as FastUpdatePathGeometry,d as PathGeometryData,f as StaticPathGeometry};
|