@arcgis/core 4.34.0-next.28 → 4.34.0-next.29
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/applications/Components/featureUtils.d.ts +6 -0
- package/applications/Components/featureUtils.js +5 -0
- package/arcade/arcade.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/track.js +5 -0
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/086f3bc5938bf9a37274.js +1 -0
- package/assets/esri/core/workers/chunks/{7e5d3735a9c718591d64.js → 22f38cad0213f2112394.js} +1 -1
- package/assets/esri/core/workers/chunks/{746c78e1c84f9612d69b.js → 2f54776ff86f397adc55.js} +1 -1
- package/assets/esri/core/workers/chunks/{edfd8b482182803b44ca.js → 2fdf457786d2d5d7414f.js} +1 -1
- package/assets/esri/core/workers/chunks/5192f38682f1f9be7da0.js +1 -0
- package/assets/esri/core/workers/chunks/{7ee50f75914d8d650af4.js → 63cb3dcd359e96733b1b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e49a95f2126ef9a994d3.js → 6ccd6171d3c572883034.js} +1 -1
- package/assets/esri/core/workers/chunks/89999baefa341bd3329c.js +1 -0
- package/assets/esri/core/workers/chunks/{629a924e99d5d6eb1998.js → 90a9b618058dc41294de.js} +1 -1
- package/assets/esri/core/workers/chunks/98f6d4ea026ed96fd3f3.js +1 -0
- package/assets/esri/core/workers/chunks/d3b1d1c389d70919fb02.js +1 -0
- package/assets/esri/core/workers/chunks/db81d881805f6f92a2e4.js +1 -0
- package/assets/esri/core/workers/chunks/e89698fc404379627349.js +1 -0
- package/assets/esri/core/workers/chunks/{0254ef9fb7f8ebb25304.js → ecc15622d6c434ea842b.js} +1 -1
- package/assets/esri/core/workers/chunks/{aa781b28dbe457427afc.js → fb71e533995c54cd806f.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/Terrain.glsl.js +11 -11
- package/chunks/UnitFactory.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/bundle.js +1 -1
- package/config.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
- package/interfaces.d.ts +80 -2
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/ParquetEncodingWkb.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/parquetUtils.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +2 -2
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSourceEndChunk.js +5 -0
- package/views/2d/layers/features/sources/strategies/chunks/ParquetSourceChunk.js +5 -0
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/features/support/XZOrder.js +5 -0
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/{ReadShadowMapConfiguration.js → ReceiveShadowsConfiguration.js} +1 -1
- package/views/draw/support/ConnectedReshapeManager.js +5 -0
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/layerUtils.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/16ff0bf4cb74f478ec1e.js +0 -1
- package/assets/esri/core/workers/chunks/1aff43dad2302677b4f4.js +0 -1
- package/assets/esri/core/workers/chunks/c6be02d2dff6e0734dab.js +0 -1
- package/assets/esri/core/workers/chunks/c8719205518e97131375.js +0 -1
- package/views/2d/layers/features/sources/strategies/ParquetLoadStrategy.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as t}from"./SimpleGeometryCursor.js";import{a as e,c as s,o as i,p as n,g as o,G as r,f as h,h as m,t as a}from"./Geometry.js";import{E as c,P as l}from"./Envelope.js";import{Envelope2D as u}from"./Envelope2D.js";import{P as f,S as g,L as _}from"./MultiPathImpl.js";import{p as d,P as p,d as P}from"./Point2D.js";import{T}from"./Transformation2D.js";import{O as b,j as D,m as S,i as I,ag as x,aH as F,L as C,V as N,U as y,T as w,R as E,a9 as G,aI as v,ac as z}from"./UnitFactory.js";import{c as k}from"./OperatorClip.js";function q(t){const e=t.getInputSR(),s=t.getOutputSR();let i=!1;do{if(e.equals(s)){i=!1;break}if(!O(e)||!O(s)){i=!1;break}if(2===e.getCoordinateSystemType()){i=!0;break}if(2===s.getCoordinateSystemType()){i=!0;break}const n=t.getGeographicTransformations();if(null!==n&&n.count()>0){i=!0;break}}while(0);return i}class L{constructor(t,e,s,i){this.m_horizon2Env=new u,this.m_horizon2=t,this.m_sr=e,this.m_bInclusive2=s,this.m_pannableExtent=i.clone(),this.m_segIter=null,this.m_qtIter=null,null!==t?(t.queryEnvelope(this.m_horizon2Env),this.m_gcs360=i.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,this.m_pannableFactor=1,this.m_horizon2Env.width()-this.m_gcs360>0&&(this.m_pannableFactor+=Math.ceil((this.m_horizon2Env.width()-this.m_gcs360)/this.m_gcs360)),this.m_period=this.m_gcs360):(this.m_horizon2Env.setEmpty(),this.m_gcs360=Number.NaN,this.m_gcs180=Number.NaN,this.m_gcs90=Number.NaN,this.m_pannableFactor=Number.NaN,this.m_period=Number.NaN),this.m_gcsTolerance=null!=e?e.getTolerance(0):Number.NaN}isPointStartInHorizon(t,e){if(!this.m_horizon2)return!0;let s=nt(new l(t),this.m_horizon2,!0,this.m_period);do{const e=t.clone();if(e.x-=s*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){let t;if(t=this.m_horizon2Env.contains(e)?N(this.m_horizon2,e,0):0,this.m_bInclusive2){if(0===t)return!1}else if(1===t)return!1}else{const t=this.m_horizon2Env.contains(e);if(this.m_bInclusive2){if(!t)return!1}else if(t)return!1}}while(this.m_horizon2Env.xmin+ ++s*this.m_period<t.x);return!0}isAdjoiningLineInHorizon(t,e,s){if(!this.m_horizon2)return!0;const i=new p,n=new p;rt(t,e,this.m_gcs90,this.m_gcs180,this.m_gcs360,i,n);const h=Math.max(i.x,n.x),m=new _;m.setStart2D(i),m.setEnd2D(n);let a=nt(m,this.m_horizon2,!0,this.m_period);const c=!1;do{const t=i.clone(),e=n.clone();if(t.x-=a*this.m_period,e.x-=a*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){const s=new _;s.setStartXY(t),s.setEndXY(e);const i=new u,n=new u;if(s.queryEnvelope(i),n.setCoords({env2D:i}),n.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance),this.m_horizon2Env.isIntersecting(n)){const t=this.m_horizon2.getImpl(),e=t.getAccelerators();if(null!==e){null!==e.getRasterizedGeometry()&&o(0)}{let i=null;if(null!==e&&(i=e.getQuadTree()),null!==i){this.m_qtIter||(this.m_qtIter=i.getIteratorForQT()),this.m_qtIter.resetIterator(s,this.m_gcsTolerance),this.m_segIter||(this.m_segIter=t.querySegmentIterator());for(let t=this.m_qtIter.next();-1!==t;t=this.m_qtIter.next()){const e=i.getElement(t);this.m_segIter.resetToVertex(e,-1);if(this.m_segIter.nextSegment().isIntersecting(s,this.m_gcsTolerance))return!1}}else for(this.m_segIter||(this.m_segIter=t.querySegmentIterator()),this.m_segIter.resetToFirstPath();this.m_segIter.nextPath();)for(;this.m_segIter.hasNextSegment();){const t=this.m_segIter.nextSegment(),e=new u;if(t.queryEnvelope(e),e.isIntersecting(n)&&t.isIntersecting(s,this.m_gcsTolerance))return!1}}}}else if(this.m_bInclusive2){const s=this.m_horizon2Env.contains(t),i=this.m_horizon2Env.contains(e);if(s&&i)return!0}else{const s=this.m_horizon2Env.clone();s.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);if(!(0===s.clipLine(t,e)))return!1}}while(this.m_horizon2Env.xmin+ ++a*this.m_period<h);return!this.m_bInclusive2||c}isEnvelopeInHorizon(t,e){if(!this.m_horizon2)return!0;const s=new c({env2D:t});let i=nt(s,this.m_horizon2,!0,this.m_period);do{const n=t.clone();n.move(-i*this.m_period,0),s.setCoords(n.xmin,n.ymin,n.xmax,n.ymax);if(!st(s,this.m_horizon2,this.m_sr,this.m_bInclusive2,e))return!1}while(this.m_horizon2Env.xmin+ ++i*this.m_period<t.xmax);return!0}}class R{constructor(t,e,s){this.m_splitLines2=null,this.m_scalars=[],this.m_splitIter=null,this.m_splitLines2=t,this.m_transform1=e,this.m_pannableExtent=s.clone(),this.m_gcs360=s.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,null!==e?(this.m_gcsTolerance=this.m_transform1.getOutputSR().getTolerance(0),this.m_halfGcsTolerance=.5*this.m_gcsTolerance,this.m_gcsToleranceSq=this.m_gcsTolerance*this.m_gcsTolerance):(this.m_gcsTolerance=Number.NaN,this.m_halfGcsTolerance=Number.NaN,this.m_gcsToleranceSq=Number.NaN)}hasSplitLines(){return null!=this.m_splitLines2}getSplitLineFactorEx(t,e,s,i,n,o){const r=new p,h=new p;rt(i,n,this.m_gcs90,this.m_gcs180,this.m_gcs360,r,h);const m=new _;for(m.setStartXY(r),m.setEndXY(h),this.m_splitIter?this.m_splitIter.resetToFirstPath():this.m_splitIter=this.m_splitLines2.getImpl().querySegmentIterator();this.m_splitIter.nextPath();)for(;this.m_splitIter.hasNextSegment();){const i=this.m_splitIter.nextSegment(),n=.5*(i.getStartX()+i.getEndX());Z(this.m_gcs180,this.m_gcs360,n,m);const r=new u;m.queryEnvelope(r),r.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);const h=new u;if(i.queryEnvelope(h),!r.isIntersecting(h))continue;this.m_scalars.length<2&&(this.m_scalars.length=2);if(1===m.intersect(i,null,this.m_scalars,null,this.m_gcsTolerance)&&(this.m_scalars[0]>0&&this.m_scalars[0]<1)){const n=ct(e,s,this.m_scalars[0]),r=V(t.getCoord2D(n),this.m_transform1);if(i.isIntersectingPoint(r,this.m_halfGcsTolerance))return n;return this.getSplitLineFactor(t,e,s,i,o)}}return-1}getSplitLineFactor(t,e,s,i,n){let o=e,r=s;const h=.5*(i.getStartX()+i.getEndX()),m=new _,a=t.getCoord2D(o),c=t.getCoord2D(r),l=V(a,this.m_transform1),u=V(c,this.m_transform1);for(;o<r;){const e=new p,s=new p;rt(l,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,s),m.setStartXY(e),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m);const n=p.sqrDistance(m.getStartXY(),m.getEndXY());if(n<=this.m_gcsToleranceSq)break;if(Number.isNaN(n))return Number.NaN;let f=ct(o,r,this.m_scalars[0]);if(o<f&&f<r||(f=.5*(r+o)),o===f||f===r)return f;const g=t.getCoord2D(f),_=V(g,this.m_transform1),d=new p;rt(l,_,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,d),m.setStartXY(e),m.setEndXY(d),Z(this.m_gcs180,this.m_gcs360,h,m);let P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance);if(0!==P){if(1===this.m_scalars[0])return f;r=f,c.setCoordsPoint2D(g),u.setCoordsPoint2D(_)}else{if(rt(_,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,d,s),m.setStartXY(d),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m),P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance),0===P)return f;if(0===this.m_scalars[0])return f;o=f,a.setCoordsPoint2D(g),l.setCoordsPoint2D(_)}}return.5*(r+o)}}class M{constructor(){this.m_bPrepared=!1,this.m_bNeedsShapePreservingProject=!1,this.m_inputTransform=null,this.m_transform1=null,this.m_transform2=null,this.m_extentFrom=null,this.m_horizon1=null,this.m_horizon2=null,this.m_pannableExtentFrom=new u,this.m_pannableExtentTo=new u,this.m_pannableExtentGcsTo=new u,this.m_bClipTopBottomFrom=!1,this.m_bNeedsGeoTransform=!1,this.m_bIsPannableFrom=!1,this.m_bIsPannableTo=!1,this.m_bInclusive1=!1,this.m_bInclusive2=!1,this.m_bSrFromIsPcs=!1,this.m_bSrToIsPcs=!1,this.m_fromTolerance=Number.NaN,this.m_toTolerance=Number.NaN,this.m_gcsToTolerance=Number.NaN,this.m_aFrom=Number.NaN,this.m_mpuFrom=Number.NaN,this.m_rpuFrom=Number.NaN,this.m_rpuGcsTo=Number.NaN,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN,this.m_stages=0}prepare(t,s,i){this.m_bPrepared&&n(""),t||e("");const r=t.getInputSR(),h=t.getOutputSR();O(r)&&O(h)||e("shape preserving project requires PCS or GCS");const m=r.getCoordinateSystemType(),a=h.getCoordinateSystemType();this.m_bSrFromIsPcs=2===m,this.m_bSrToIsPcs=2===a;let c=null,l=null,u=null,f=null;this.m_bSrFromIsPcs?(c=r,u=r.getGCS(),this.m_aFrom=at(u),this.m_mpuFrom=mt(c),this.m_rpuFrom=Number.NaN):(u=r,this.m_rpuFrom=ht(u),this.m_aFrom=Number.NaN),this.m_bSrToIsPcs?(l=h,f=h.getGCS(),this.m_aTo=at(f),this.m_mpuTo=mt(l)):(f=h,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN),this.m_rpuGcsTo=ht(f);const g=t.getGeographicTransformations();this.m_bNeedsGeoTransform=null!==g&&g.count()>0;const _=r.equals(h);if(this.m_bNeedsShapePreservingProject=!_&&(this.m_bSrFromIsPcs||this.m_bSrToIsPcs||this.m_bNeedsGeoTransform),!this.m_bNeedsShapePreservingProject)return this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,void(this.m_bPrepared=!0);if(this.m_bIsPannableFrom=r.isPannable(),this.m_bIsPannableTo=h.isPannable(),this.m_bIsPannableFrom&&(this.m_pannableExtentFrom=r.getPannableExtent()),this.m_bIsPannableTo&&(this.m_pannableExtentTo=h.getPannableExtent()),this.m_bSrToIsPcs){this.m_pannableExtentGcsTo=f.getPannableExtent();const t=l.getCentralMeridian(),e=this.m_pannableExtentGcsTo.getCenter();e.x=t,this.m_pannableExtentGcsTo.centerAt(e)}else this.m_pannableExtentGcsTo=this.m_pannableExtentTo.clone();this.m_fromTolerance=r.getTolerance(0),this.m_toTolerance=h.getTolerance(0),this.m_gcsToTolerance=f.getTolerance(0);{const e=t.getExtendedParams(),n=e.clipWithInputHorizon,o=e.clipWithOutputHorizon;n&&this.setHorizon1(t,s,i),o&&this.setHorizon2(t,i),this.checkAndSetStages(t,i)}const d=D();d.setFlag(1073741824,!0),d.setFlag(536870912,!0);const p=S();if(p.clipWithInputHorizon=!1,p.clipWithOutputHorizon=!1,1===this.m_stages)this.m_transform1=I(!1,r,h,g,p,d);else if(2===this.m_stages){d.setFlag(2147483648,!0),this.m_transform1=I(!1,r,f,g,p,d);const t=D();this.m_transform2=I(!1,f,h,null,p,t)}else{o(null!=l),p.centralMeridianOfOutputGCS=l.getCentralMeridian(),this.m_transform1=I(!1,r,f,g,p,d);const t=D();t.setFlag(2147483648,!0),this.m_transform2=I(!1,f,h,null,p,t)}this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,this.m_bPrepared=!0}execute(t,e,s,i){this.m_bPrepared||n(""),o(!t.hasAttribute(10));return this.execute_(t,e,s,i)}checkIfNeedsReset(t,e){return o(0),!1}setHorizon1(t,e,s){const i=t.getInputSR();let n,o=null;const r=new u;if(this.m_bSrFromIsPcs){n=!0,o=i.getPCSHorizon(),o.queryEnvelope(r),this.m_bIsPannableFrom&&(o=new c({xmin:this.m_pannableExtentFrom.xmin,ymin:r.ymin,xmax:this.m_pannableExtentFrom.xmax,ymax:r.ymax}));let t=!1;null!=e&&(t=et(e,o,i,n,this.m_bIsPannableFrom,this.m_pannableExtentFrom,s)),t||(this.m_horizon1=o,this.m_bInclusive1=n)}else this.m_bClipTopBottomFrom=!0,this.m_bInclusive1=!0}setHorizon2(t,e){const s=t.getOutputSR();if(1===s.getCoordinateSystemType())return this.m_horizon2=null,void(this.m_bInclusive2=!1);let i=null;const n=new u,o=s.getGCSHorisonIsInclusive();i=s.getGCSHorizon(),i.queryEnvelope(n);const r=s.getCentralMeridian();if(this.m_bIsPannableTo){const t=new c({xmin:this.m_pannableExtentGcsTo.xmin,ymin:n.ymin,xmax:this.m_pannableExtentGcsTo.xmax,ymax:n.ymax});t.centerAt(r,0),i=t}this.m_horizon2=i,this.m_bInclusive2=o}checkAndSetStages(t,e){const s=t.getOutputSR().getGCSSplitLines();if(!this.m_horizon2&&!s)return void(this.m_stages=1);if(this.m_horizon2.getGeometryType()===r.enumEnvelope){const t=new u;this.m_horizon2.queryEnvelope(t);const e=t.width(),s=t.height();e>=d/this.m_rpuGcsTo&&s>=Math.PI/this.m_rpuGcsTo&&(this.m_horizon2=null)}if(this.m_horizon2||s){if(null!==this.m_horizon2&&!this.m_bNeedsGeoTransform&&!this.m_bSrFromIsPcs){const e=t.getOutputSR().getGCS();return t.getInputSR().equals(e)?(this.m_horizon1=this.m_horizon2,this.m_bInclusive1=this.m_bInclusive2,this.m_bClipTopBottomFrom=!1,this.m_horizon2=null,this.m_bInclusive2=!1,void(this.m_stages=1)):void(this.m_stages=2)}this.m_stages=3}else this.m_stages=1}execute_(t,e,n,o){if(!this.m_bNeedsShapePreservingProject)return(new b).execute(t,this.m_inputTransform,o);if(!t)return null;s(t),i(t);let a,c=t.getGeometryType();return h(c)?(a=W(t),c=r.enumPolyline):a=t,a.isEmpty()?a:m(c)?this.executeEx(t,e,n,o):(new b).execute(t,this.m_inputTransform,o)}executeEx(t,e,s,i){let n;t.hasNonLinearSegments()&&a(""),n=this.m_bIsPannableFrom?(new b).foldInto360Range(t,this.m_transform1.getInputSR()):t;let o,r=s;return r>0||(r=100*this.m_toTolerance),o=1===this.m_stages?this.executeGood(n,e,r,i):2===this.m_stages?this.executeBad(n,e,r,i):this.executeUgly(n,e,r,i),this.filterOverDensification(o,this.m_inputTransform.getOutputSR(),r,i)}executeGood(t,e,s,i){const n=s*s;let o,r;return o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5),r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i),r=F(r,this.m_transform1.getOutputSR(),i),r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,o,n,i),r=(new b).execute(r,this.m_transform1,i),r}executeBad(t,e,s,i){let n;n=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5;const o=s*s;let r;return r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):t,r=(new b).execute(r,this.m_transform1,i),r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!0,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,n,o,i),r=(new b).execute(r,this.m_transform2,i),r}executeUgly(t,e,s,i){const n=s*s;let o;o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5);let r=null;r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i);let h=r;const m=new L(this.m_horizon2,this.m_transform2.getInputSR(),this.m_bInclusive2,this.m_pannableExtentGcsTo),a=this.m_transform2.getOutputSR().getGCSSplitLines(),c=new R(a,this.m_transform1,this.m_pannableExtentGcsTo);if(r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,this.m_transform2,m,this.m_pannableExtentGcsTo,c,o,n,i),null!==r){h=null,r=(new b).execute(r,this.m_transform1,i);const t=Math.PI/180/this.m_rpuGcsTo*2;return r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,t,i),r=(new b).execute(r,this.m_transform2,i),r}let l=Number.NaN;l=s>0?s:100*this.m_toTolerance,l/=this.m_rpuGcsTo*this.m_aTo/this.m_mpuTo;const u=l*l;let f;return r=j(h,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,this.m_pannableExtentGcsTo,null,null,null,null,o,u,i),h=null,r=(new b).execute(r,this.m_transform1,i),f=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5,r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,f,n,i),r=(new b).execute(r,this.m_transform2,i),r}getMinLengthInSrFrom(t){let e;return e=this.m_bSrFromIsPcs?this.m_aFrom*(t*Math.PI/180)/this.m_mpuFrom:t*Math.PI/180*(1/this.m_rpuFrom),e}filterOverDensification(t,e,s,i){let n=X(t,s);return n.dropAttribute(10),n!==t&&n.getGeometryType()===r.enumPolygon&&(n=(new C).execute(n,e,!1,i)),n}}function X(t,e){if(t.isEmpty()||!t.hasAttribute(10))return t;const s=e*e;let i=t.getAttributeStreamRef(10),n=!1;const o=new _,r=[];let h=!1;for(let a=0,c=t.getPathCount();a<c;a++){const e=t.getPathStart(a),m=t.getPathEnd(a),c=t.isClosedPath(a);if(!(m>e))continue;{const t=c?e:m-1;0===i.read(e)&&0===i.read(t)||(n||(i=i.clone(),n=!0),i.write(e,0),i.write(t,0))}const l=c?m+1:m;let u=e;for(let a=e;a<l;a++){const c=a===m?e:a;if(0===i.read(c)){if(a-u>1){r.push({from:u,to:a});const c=new p;for(;r.length>0;){const a=r.at(-1);r.pop(),o.setStartXY(t.getXY(a.from));const l=a.to===m?e:a.to;o.setEndXY(t.getXY(l));let u=s,f=-1;for(let e=a.from+1,s=a.to;e<s;e++){const s=t.getXY(e),i=o.getClosestCoordinate(s,!1);o.queryCoord2D(i,c);const n=p.sqrDistance(c,s);u<n&&(u=n,f=e)}f>=0?(n||(i=i.clone(),n=!0),i.write(f,0),f-a.from>1&&r.push({from:a.from,to:f}),a.to-f>1&&r.push({from:f,to:a.to})):h=!0}}u=c}}}if(!h)return t;const m=Y(t,i,1);return m.dropAttribute(10),m}function Y(t,e,s){const i=t.createInstance(),n=new l;for(let o=0,r=t.getPathCount();o<r;o++){let r=!0,h=0,m=0;const a=t.getPathStart(o),c=t.getPathEnd(o);let l=!0;for(let u=a;u<c;u++){e.read(u)===s?(!l&&m>0&&(i.addSegmentsFromPath(t,o,h-a,m,r),m=0),l=!0):l?(l=!1,t.getPointByVal(u,n),r?(i.startPathPoint(n),r=!1):i.lineToPoint(n),h=u):m++}m>0&&i.addSegmentsFromPath(t,o,h-a,m,r)}return i}const A=8;function H(t,e){const s=.5;for(let i=0;i<t;i++){let n=Math.ceil(i/2)/(t+1);i%2!=0&&(n=-n);const o=s+n;e[i]=o}}function O(t){if(!t)return!1;const e=t.getCoordinateSystemType();return 2===e||1===e}function j(t,e,s,i,n,o,r,h,m,a,c,l,u){const f=t.createInstance();f.addAttribute(10);const _=t.querySegmentIterator(),d=[],p=[],P=new g,T=t.getDescription().getAttributeCount()>1,b=new lt(e,s,i,n,o,r,h,a,c,l,T?p:null,d,u);for(;_.nextPath();)for(;_.hasNextSegment();){const t=_.nextSegment(),e=t.getStartXY(),s=t.getEndXY(),i=e.compare(s)>0,n=J(i,t,P);d.length=0,p.length=0;if(!b.densifySegment(_.isFirstSegmentInPath(),n))return null;i&&K(T?p:null,d),d.at(-1).setCoordsPoint2D(t.getEndXY());const o=f.getPointCount();if(T){const e=J(i,t,P);U(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),t,e,p,d,f)}else B(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),d,f);if(b.needsPostFiltering()){f.addAttribute(10);const t=f.getAttributeStreamRef(10);for(let e=1,s=d.length-1;e<s;e++)t.write(e+o,1)}}return f}function B(t,e,s,i){t&&i.insertPath2D(-1,null,0,0,!0);const n=i.getPathCount()-1;e?i.insertPointsFromPoints(n,-1,s,0,s.length,!0):i.insertPointsFromPoints(n,-1,s,0,s.length-1,!0)}function U(t,e,s,i,n,o,r){r.reserve(r.getPointCount()+o.length-1);const h=new l;if(s.queryStart(h),t?r.startPathPoint(h):r.lineToPoint(h),o.length>2){const t=i.calculateLength2D();for(let e=1;e<o.length-1;e++){const s=i.lengthToT(n[e]*t);i.queryCoord(s,h),h.setXY(o[e]),r.lineToPoint(h)}}e&&(s.queryEnd(h),r.lineToPoint(h))}function W(t){const e=new f({vd:t.getDescription()});return e.addSegment(t,!0),e}function V(t,e){const s=e.getInputSR(),i=e.getOutputSR(),n=new p;2===s.getCoordinateSystemType()?(n.setCoordsPoint2D(t),G(s,0,[n],1)):n.setCoordsPoint2D(t);const o=new p;o.setCoordsPoint2D(n),v(e,[o],null,1,!1);const r=new p;return 2===i.getCoordinateSystemType()?(r.setCoordsPoint2D(o),z(i,[r],1,!1)):r.setCoordsPoint2D(o),r}function Q(t,e,s,i,n,o,r,h){if(n){const n=o.width(),m=.5*n;if(i){const i=.25*n;let o=!1;const a=new p,c=new p;if(Math.abs(t.y)===i?(a.setCoords(s.x,t.y),c.setCoordsPoint2D(s),o=!0):Math.abs(s.y)===i&&(c.setCoords(t.x,s.y),a.setCoordsPoint2D(t),o=!0),Math.abs(e.y)===i&&(o||(a.setCoordsPoint2D(t),c.setCoordsPoint2D(s),o=!0),a.x=e.x),o)return ot(e,a,m,n,r),ot(e,c,m,n,h),!0}let a=0;t.x-e.x>m&&s.x-e.x>m?a-=n:e.x-t.x>m&&e.x-s.x>m&&(a+=n),Math.abs(e.x-(t.x+a))<m?(r.setCoordsPoint2D(t),ot(r,s,m,n,h),r.x+=a,h.x+=a):(r.setCoordsPoint2D(s),ot(r,t,m,n,h),r.x+=a,h.x+=a)}else r.setCoordsPoint2D(t),h.setCoordsPoint2D(s);return!1}function J(t,e,s){return t?(s.create(e.getGeometryType()),e.copyTo(s.get()),s.get().reverse(),s.get()):e}function K(t,e){e.reverse(),null!==t&&t.reverse()}function Z(t,e,s,i){const n=.5*(i.getStartX()+i.getEndX());if(n-s>t){const t=new T;t.setShiftCoords(-e,0),i.applyTransformation(t)}else if(s-n>t){const t=new T;t.setShiftCoords(e,0),i.applyTransformation(t)}}function $(t,e,s,i,n,o,r,h,m){const a=[!1];r&&tt(t,e,s,i,n,o,!0,h,a,m);let c=t;return a[0]||(c=tt(c,e,s,i,n,o,!1,h,null,m)),c=it(c,n,o,c!==t),c}function tt(t,e,s,i,n,o,h,m,a,c){if(h&&(a[0]=!1),null==s)return t;const l=new u,f=new u;s.queryEnvelope(l),t.queryEnvelope(f);const g=t.getGeometryType(),_=s.getGeometryType(),d=e.getTolerance(0);if(!n){if(h)return a[0]=st(t,s,e,i,c),null;let n;return n=i?_===r.enumEnvelope?k(t,l,d,m,c):(new y).execute(t,s,e,c):(new w).execute(t,s,e,c),n===s&&(n=s.clone()),n}const p=o.width(),P=p*Math.ceil(l.width()/p);let b=null;if(i){let o=nt(t,s,n,P),D=0;const S=new T;do{let n=null;if(_===r.enumEnvelope){const r=s.clone();if(S.setShiftCoords(o*P,0),r.applyTransformation(S),h){if(a[0]=st(t,r,e,i,c),!a[0])return null}else{const e=new u;r.queryEnvelope(e),n=k(t,e,d,m,c)}}else{const r=t.clone();if(S.setShiftCoords(-o*P,0),r.applyTransformation(S),h){if(a[0]=st(r,s,e,i,c),!a[0])return null}else n=(new y).execute(r,s,e,c),n===s&&(n=s.clone())}if(!h){if(n.isEmpty())continue;if(g===r.enumPolygon){const t=new u;if(n.queryEnvelope(t),t.width()<=d)continue}_===r.enumEnvelope&&(S.setShiftCoords(-o*P,0),n===t&&(n=n.clone()),n.applyTransformation(S)),null===b?b=n===t?n.clone():n:b.add(n,!1)}D++}while(l.xmin+ ++o*P<f.xmax);if(h)return null;null===b&&(b=t.createInstance()),g===r.enumPolygon&&D>1&&p-f.width()<=10*d&&(b=(new C).execute(b,e,!0,c))}else{let o=nt(t,s,n,P);if(b=t.clone(),0!==o){const t=new T;t.setShiftCoords(-o*P,0),b.applyTransformation(t)}do{if(h){if(a[0]=st(b,s,e,i,c),!a[0])return null}else if(b=(new w).execute(b,s,e,c),b===s&&(b=s.clone()),b.isEmpty())break;const t=new T;t.setShiftCoords(-P,0),b.applyTransformation(t)}while(l.xmin+ ++o*P<f.xmax);if(h)return null;if(!b.isEmpty()&&0!==o){const t=new T;t.setShiftCoords(o*P,0),b.applyTransformation(t)}}return b}function et(t,e,s,i,n,o,r){const h=[!1];return tt(t,s,e,i,n,o,!0,Number.NaN,h,r),h[0]}function st(t,e,s,i,n){let o;if(e.getGeometryType()===r.enumPolygon)if(i){o=E(e,t,s,64,n)}else{o=E(e,t,s,4,n)}else if(i){const s=new u,i=new u;e.queryEnvelope(s),t.queryEnvelope(i);o=s.containsEnvelope(i)}else{o=E(e,t,s,4,n)}return o}function it(t,e,s,i){let n;if(!e)return t;const o=s.getCenter().x,r=s.width(),h=.5*r,m=new u;t.queryEnvelope(m);const a=m.getCenter().x;let c=0;if(a-o>h){c=-Math.ceil((a-o-h)/r)*r}else if(o-a>h){c=Math.ceil((o-a-h)/r)*r}if(0!==c){n=i?t:t.clone();const e=new T;e.setShiftCoords(c,0),n.applyTransformation(e)}else n=t;return n}function nt(t,e,s,i){if(!s)return 0;let n=0;const o=new u;e.queryEnvelope(o);const r=new u;t.queryEnvelope(r);const h=o.xmin+i;for(;h+i+n*i>r.xmin;)n--;for(;h+n*i<r.xmin;)n++;return n}function ot(t,e,s,i,n){e.x-t.x>s?n.setCoords(e.x-i,e.y):t.x-e.x>s?n.setCoords(e.x+i,e.y):n.setCoordsPoint2D(e)}function rt(t,e,s,i,n,o,r){Math.abs(t.y)===s?(o.setCoords(e.x,t.y),r.setCoordsPoint2D(e)):Math.abs(e.y)===s?(o.setCoordsPoint2D(t),r.setCoords(t.x,e.y)):(o.setCoordsPoint2D(t),ot(o,e,i,n,r))}function ht(t){return t.getUnit().getUnitToBaseFactor()}function mt(t){return t.getUnit().getUnitToBaseFactor()}function at(t){return t.getPECoordSys().getDatum().getSpheroid().getAxis()}function ct(t,e,s){return s<=.5?t+(e-t)*s:e-(e-t)*(1-s)}class lt{checkSegment(){for(let t=0;t<this.n;t++){if(null!==this.pSplitLines2Info&&this.pSplitLines2Info.hasSplitLines()&&!this.bCheckIfNoDensificationNeededForCurve){const t=this.pSplitLines2Info.getSplitLineFactorEx(this.rectifiedSegment,this.leftFactor,this.rightFactor,this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker);if(Number.isNaN(t))return-1;if(-1!==t&&this.leftFactor<t&&t<this.rightFactor)return this.cutFactor=t,this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(V(this.cutFromDensifiedPoint,this.transform)),this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(V(this.cutGcsToDensifiedPoint,this.transform2)),this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint),1}if(this.cutFactor=ct(this.leftFactor,this.rightFactor,this.scalars[t]),this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(V(this.cutFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(V(this.cutGcsToDensifiedPoint,this.transform2))),0===t&&(this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint)),this.bIsPannableFrom&&!this.bCheckIfNoDensificationNeededForCurve&&Math.abs(this.leftFromDensifiedPoint.x-this.rightFromDensifiedPoint.x)>=.25*this.pannableExtentFrom.width())return 1;let e;if(this.bCheckIfNoDensificationNeededForCurve){const t=this.projCurveSegment.get().getClosestCoordinate(this.cutToDensifiedPoint,!1),s=this.projCurveSegment.get().getCoord2D(t);e=p.sqrDistance(this.cutToDensifiedPoint,s)}else{const s=new p,i=new p,n=Q(this.leftToDensifiedPoint,this.cutToDensifiedPoint,this.rightToDensifiedPoint,this.bSrToIsGcs,this.bIsPannableTo,this.pannableExtentTo,s,i);this.line.setStartXY(s),this.line.setEndXY(i);const o=this.line.getClosestCoordinate(this.cutToDensifiedPoint,!0);if(n||t>0||Math.abs(o-this.scalars[t])<.3){const t=this.line.getCoord2D(o);e=p.sqrDistance(this.cutToDensifiedPoint,t)}else e=2*this.maxDeviationInSrToSq,this.bNeedPostFiltering=!0}if(e>this.maxDeviationInSrToSq)return this.bCheckIfNoDensificationNeededForCurve=!1,1}return 0}constructor(t,e,s,i,n,o,r,h,m,a,c,l,f){this.leftFromDensifiedPoint=new p,this.rightFromDensifiedPoint=new p,this.cutFromDensifiedPoint=new p,this.midFromDensifiedPoint=new p,this.leftToDensifiedPoint=new p,this.rightToDensifiedPoint=new p,this.cutToDensifiedPoint=new p,this.midToDensifiedPoint=new p,this.line=new _,this.leftGcsToDensifiedPoint=new p,this.rightGcsToDensifiedPoint=new p,this.cutGcsToDensifiedPoint=new p,this.midGcsToDensifiedPoint=new p,this.bSrToIsGcs=!1,this.bIsCurve=!1,this.leftFactor=0,this.rightFactor=0,this.bIsFirstInPath=!1,this.rectifiedSegment=null,this.transform=null,this.bIsPannableFrom=!1,this.pannableExtentFrom=new u,this.bIsPannableTo=!1,this.bNeedPostFiltering=!1,this.pannableExtentTo=new u,this.transform2=null,this.pHorizon2Info=null,this.pSplitLines2Info=null,this.minLengthInSrFrom=0,this.maxDeviationInSrToSq=0,this.cutFactor=0,this.midFactor=0,this.pDensifiedFactors=null,this.pDensifiedPoints=[],this.rightFromDensifiedPointsStack=[],this.rightToDensifiedPointsStack=[],this.rightGcsToDensifiedPointsStack=[],this.rightFactorsStack=[],this.projCurveSegment=new g,this.n=0,this.bCheckIfNoDensificationNeededForCurve=!1,this.scalars=P(A-1,Number.NaN),this.progressTracker=f,this.transform=t,this.bIsPannableFrom=e,this.pannableExtentFrom.assign(s),this.bIsPannableTo=i,this.pannableExtentTo.assign(n),this.transform2=o,this.pHorizon2Info=r,this.pSplitLines2Info=h,this.minLengthInSrFrom=m,this.maxDeviationInSrToSq=a,this.pDensifiedFactors=c,this.pDensifiedPoints=l,this.progressTracker=f,this.bNeedPostFiltering=!1}needsPostFiltering(){return this.bNeedPostFiltering}densifySegment(t,e){if(this.bIsFirstInPath=t,this.rectifiedSegment=e,this.leftGcsToDensifiedPoint.setNAN(),this.rightGcsToDensifiedPoint.setNAN(),this.cutGcsToDensifiedPoint.setNAN(),this.midGcsToDensifiedPoint.setNAN(),this.bSrToIsGcs=null!=this.transform2?1===this.transform2.getOutputSR().getCoordinateSystemType():1===this.transform.getOutputSR().getCoordinateSystemType(),this.bIsCurve=this.rectifiedSegment.isCurve(),this.leftFactor=0,this.rightFactor=1,this.leftFromDensifiedPoint.assign(this.rectifiedSegment.getStartXY()),this.rightFromDensifiedPoint.assign(this.rectifiedSegment.getEndXY()),this.leftToDensifiedPoint.assign(V(this.leftFromDensifiedPoint,this.transform)),this.rightToDensifiedPoint.assign(V(this.rightFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.leftToDensifiedPoint),this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftToDensifiedPoint.assign(V(this.leftGcsToDensifiedPoint,this.transform2)),this.rightToDensifiedPoint.assign(V(this.rightGcsToDensifiedPoint,this.transform2)),this.bIsFirstInPath&&!this.pHorizon2Info.isPointStartInHorizon(this.leftGcsToDensifiedPoint,this.progressTracker)))return!1;this.rightFromDensifiedPointsStack.length=0,this.rightToDensifiedPointsStack.length=0,this.rightGcsToDensifiedPointsStack.length=0,this.rightFactorsStack.length=0,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!=this.transform2&&this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.leftFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.leftFactor),this.bIsCurve?this.rectifiedSegment.getGeometryType()===r.enumBezier?this.n=A-1:this.n=5:this.n=3,H(this.n,this.scalars);const s=this.rectifiedSegment.calculateLength2D();if(this.bCheckIfNoDensificationNeededForCurve=!1,this.bIsCurve){const t=new f({vd:this.rectifiedSegment.getDescription()});let e=(new b).execute(t,this.transform,this.progressTracker);if(null!==this.transform2){const t=new u;if(e.queryEnvelope(t),!this.pHorizon2Info.isEnvelopeInHorizon(t,this.progressTracker))return!1;e=(new b).execute(e,this.transform2,this.progressTracker)}e.getSegmentBuffer(0,this.projCurveSegment,!1),this.bCheckIfNoDensificationNeededForCurve=!0}for(;this.rightFromDensifiedPointsStack.length>0;){let t=!1;if(this.cutFactor=Number.NaN,this.midFactor=Number.NaN,this.midFromDensifiedPoint.setNAN(),this.midToDensifiedPoint.setNAN(),(this.rightFactor-this.leftFactor)*s>this.minLengthInSrFrom){const e=this.checkSegment();if(-1===e)return!1;t=0!==e}if(t)this.rightFromDensifiedPoint.setCoordsPoint2D(this.midFromDensifiedPoint),this.rightToDensifiedPoint.setCoordsPoint2D(this.midToDensifiedPoint),this.rightFactor=this.midFactor,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!==this.transform2&&(this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.midGcsToDensifiedPoint),this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()));else{if(null!==this.transform2&&!this.pHorizon2Info.isAdjoiningLineInHorizon(this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker))return!1;if(this.rightFromDensifiedPointsStack.pop(),this.rightToDensifiedPointsStack.pop(),this.rightFactorsStack.pop(),null!==this.transform2&&this.rightGcsToDensifiedPointsStack.pop(),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.rightFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.rightFactor),this.rightFromDensifiedPointsStack.length>0){this.leftFromDensifiedPoint.setCoordsPoint2D(this.rightFromDensifiedPoint),this.leftToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftFactor=this.rightFactor;const t=this.rightFromDensifiedPointsStack.at(-1),e=this.rightToDensifiedPointsStack.at(-1);if(this.rightFromDensifiedPoint.setCoordsPoint2D(t),this.rightToDensifiedPoint.setCoordsPoint2D(e),this.rightFactor=this.rightFactorsStack.at(-1),null!==this.transform2){this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.rightGcsToDensifiedPoint);const t=this.rightGcsToDensifiedPointsStack.at(-1);this.rightGcsToDensifiedPoint.setCoordsPoint2D(t)}}}}return!0}}class ut{getOperatorType(){return 10315}supportsCurves(){return!1}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,s,i,n,o){return q(s)?new ft(t,e,s,i,n,o):(new b).executeMany(t,s,o)}execute(t,e,s,i,n){if(!q(e))return(new b).execute(t,e,n);const o=new M;return o.prepare(e,null,n),o.execute(t,s,i,n)}}class ft extends t{constructor(t,s,i,n,o,r){super(),this.m_spp=null,this.m_index=-1,t||e(""),this.m_progressTracker=r,this.m_geometries=t,this.m_geometriesExtent=s?s.clone():null,this.m_transform=i,this.m_minSegmentLengthInDegrees=n,this.m_maxDeviationInSrTo=o}tock(){return!0}getRank(){return 1}next(){this.m_spp||(this.m_spp=new M,this.m_spp.prepare(this.m_transform,this.m_geometriesExtent,this.m_progressTracker));const t=this.m_geometries.next();return s(t),i(t),null!=t?(this.m_index=this.m_geometries.getGeometryID(),this.m_spp.execute(t,this.m_minSegmentLengthInDegrees,this.m_maxDeviationInSrTo,this.m_progressTracker)):null}getGeometryID(){return this.m_index}}export{ut as OperatorShapePreservingProject};
|
|
5
|
+
import{G as t}from"./SimpleGeometryCursor.js";import{a as e,c as s,o as i,p as n,g as o,G as r,f as h,h as m,t as a}from"./Geometry.js";import{E as c,P as l}from"./Envelope.js";import{Envelope2D as u}from"./Envelope2D.js";import{P as f,S as g,L as _}from"./MultiPathImpl.js";import{p as d,P as p,d as P}from"./Point2D.js";import{T}from"./Transformation2D.js";import{O as b,j as D,m as S,i as I,af as x,aH as F,L as C,V as N,U as y,T as w,R as E,ab as G,aI as v,aa as z}from"./UnitFactory.js";import{c as k}from"./OperatorClip.js";function q(t){const e=t.getInputSR(),s=t.getOutputSR();let i=!1;do{if(e.equals(s)){i=!1;break}if(!O(e)||!O(s)){i=!1;break}if(2===e.getCoordinateSystemType()){i=!0;break}if(2===s.getCoordinateSystemType()){i=!0;break}const n=t.getGeographicTransformations();if(null!==n&&n.count()>0){i=!0;break}}while(0);return i}class L{constructor(t,e,s,i){this.m_horizon2Env=new u,this.m_horizon2=t,this.m_sr=e,this.m_bInclusive2=s,this.m_pannableExtent=i.clone(),this.m_segIter=null,this.m_qtIter=null,null!==t?(t.queryEnvelope(this.m_horizon2Env),this.m_gcs360=i.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,this.m_pannableFactor=1,this.m_horizon2Env.width()-this.m_gcs360>0&&(this.m_pannableFactor+=Math.ceil((this.m_horizon2Env.width()-this.m_gcs360)/this.m_gcs360)),this.m_period=this.m_gcs360):(this.m_horizon2Env.setEmpty(),this.m_gcs360=Number.NaN,this.m_gcs180=Number.NaN,this.m_gcs90=Number.NaN,this.m_pannableFactor=Number.NaN,this.m_period=Number.NaN),this.m_gcsTolerance=null!=e?e.getTolerance(0):Number.NaN}isPointStartInHorizon(t,e){if(!this.m_horizon2)return!0;let s=nt(new l(t),this.m_horizon2,!0,this.m_period);do{const e=t.clone();if(e.x-=s*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){let t;if(t=this.m_horizon2Env.contains(e)?N(this.m_horizon2,e,0):0,this.m_bInclusive2){if(0===t)return!1}else if(1===t)return!1}else{const t=this.m_horizon2Env.contains(e);if(this.m_bInclusive2){if(!t)return!1}else if(t)return!1}}while(this.m_horizon2Env.xmin+ ++s*this.m_period<t.x);return!0}isAdjoiningLineInHorizon(t,e,s){if(!this.m_horizon2)return!0;const i=new p,n=new p;rt(t,e,this.m_gcs90,this.m_gcs180,this.m_gcs360,i,n);const h=Math.max(i.x,n.x),m=new _;m.setStart2D(i),m.setEnd2D(n);let a=nt(m,this.m_horizon2,!0,this.m_period);const c=!1;do{const t=i.clone(),e=n.clone();if(t.x-=a*this.m_period,e.x-=a*this.m_period,this.m_horizon2.getGeometryType()===r.enumPolygon){const s=new _;s.setStartXY(t),s.setEndXY(e);const i=new u,n=new u;if(s.queryEnvelope(i),n.setCoords({env2D:i}),n.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance),this.m_horizon2Env.isIntersecting(n)){const t=this.m_horizon2.getImpl(),e=t.getAccelerators();if(null!==e){null!==e.getRasterizedGeometry()&&o(0)}{let i=null;if(null!==e&&(i=e.getQuadTree()),null!==i){this.m_qtIter||(this.m_qtIter=i.getIteratorForQT()),this.m_qtIter.resetIterator(s,this.m_gcsTolerance),this.m_segIter||(this.m_segIter=t.querySegmentIterator());for(let t=this.m_qtIter.next();-1!==t;t=this.m_qtIter.next()){const e=i.getElement(t);this.m_segIter.resetToVertex(e,-1);if(this.m_segIter.nextSegment().isIntersecting(s,this.m_gcsTolerance))return!1}}else for(this.m_segIter||(this.m_segIter=t.querySegmentIterator()),this.m_segIter.resetToFirstPath();this.m_segIter.nextPath();)for(;this.m_segIter.hasNextSegment();){const t=this.m_segIter.nextSegment(),e=new u;if(t.queryEnvelope(e),e.isIntersecting(n)&&t.isIntersecting(s,this.m_gcsTolerance))return!1}}}}else if(this.m_bInclusive2){const s=this.m_horizon2Env.contains(t),i=this.m_horizon2Env.contains(e);if(s&&i)return!0}else{const s=this.m_horizon2Env.clone();s.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);if(!(0===s.clipLine(t,e)))return!1}}while(this.m_horizon2Env.xmin+ ++a*this.m_period<h);return!this.m_bInclusive2||c}isEnvelopeInHorizon(t,e){if(!this.m_horizon2)return!0;const s=new c({env2D:t});let i=nt(s,this.m_horizon2,!0,this.m_period);do{const n=t.clone();n.move(-i*this.m_period,0),s.setCoords(n.xmin,n.ymin,n.xmax,n.ymax);if(!st(s,this.m_horizon2,this.m_sr,this.m_bInclusive2,e))return!1}while(this.m_horizon2Env.xmin+ ++i*this.m_period<t.xmax);return!0}}class R{constructor(t,e,s){this.m_splitLines2=null,this.m_scalars=[],this.m_splitIter=null,this.m_splitLines2=t,this.m_transform1=e,this.m_pannableExtent=s.clone(),this.m_gcs360=s.width(),this.m_gcs180=.5*this.m_gcs360,this.m_gcs90=.25*this.m_gcs360,null!==e?(this.m_gcsTolerance=this.m_transform1.getOutputSR().getTolerance(0),this.m_halfGcsTolerance=.5*this.m_gcsTolerance,this.m_gcsToleranceSq=this.m_gcsTolerance*this.m_gcsTolerance):(this.m_gcsTolerance=Number.NaN,this.m_halfGcsTolerance=Number.NaN,this.m_gcsToleranceSq=Number.NaN)}hasSplitLines(){return null!=this.m_splitLines2}getSplitLineFactorEx(t,e,s,i,n,o){const r=new p,h=new p;rt(i,n,this.m_gcs90,this.m_gcs180,this.m_gcs360,r,h);const m=new _;for(m.setStartXY(r),m.setEndXY(h),this.m_splitIter?this.m_splitIter.resetToFirstPath():this.m_splitIter=this.m_splitLines2.getImpl().querySegmentIterator();this.m_splitIter.nextPath();)for(;this.m_splitIter.hasNextSegment();){const i=this.m_splitIter.nextSegment(),n=.5*(i.getStartX()+i.getEndX());Z(this.m_gcs180,this.m_gcs360,n,m);const r=new u;m.queryEnvelope(r),r.inflateCoords(this.m_gcsTolerance,this.m_gcsTolerance);const h=new u;if(i.queryEnvelope(h),!r.isIntersecting(h))continue;this.m_scalars.length<2&&(this.m_scalars.length=2);if(1===m.intersect(i,null,this.m_scalars,null,this.m_gcsTolerance)&&(this.m_scalars[0]>0&&this.m_scalars[0]<1)){const n=ct(e,s,this.m_scalars[0]),r=V(t.getCoord2D(n),this.m_transform1);if(i.isIntersectingPoint(r,this.m_halfGcsTolerance))return n;return this.getSplitLineFactor(t,e,s,i,o)}}return-1}getSplitLineFactor(t,e,s,i,n){let o=e,r=s;const h=.5*(i.getStartX()+i.getEndX()),m=new _,a=t.getCoord2D(o),c=t.getCoord2D(r),l=V(a,this.m_transform1),u=V(c,this.m_transform1);for(;o<r;){const e=new p,s=new p;rt(l,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,s),m.setStartXY(e),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m);const n=p.sqrDistance(m.getStartXY(),m.getEndXY());if(n<=this.m_gcsToleranceSq)break;if(Number.isNaN(n))return Number.NaN;let f=ct(o,r,this.m_scalars[0]);if(o<f&&f<r||(f=.5*(r+o)),o===f||f===r)return f;const g=t.getCoord2D(f),_=V(g,this.m_transform1),d=new p;rt(l,_,this.m_gcs90,this.m_gcs180,this.m_gcs360,e,d),m.setStartXY(e),m.setEndXY(d),Z(this.m_gcs180,this.m_gcs360,h,m);let P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance);if(0!==P){if(1===this.m_scalars[0])return f;r=f,c.setCoordsPoint2D(g),u.setCoordsPoint2D(_)}else{if(rt(_,u,this.m_gcs90,this.m_gcs180,this.m_gcs360,d,s),m.setStartXY(d),m.setEndXY(s),Z(this.m_gcs180,this.m_gcs360,h,m),P=m.intersect(i,null,this.m_scalars,null,this.m_halfGcsTolerance),0===P)return f;if(0===this.m_scalars[0])return f;o=f,a.setCoordsPoint2D(g),l.setCoordsPoint2D(_)}}return.5*(r+o)}}class M{constructor(){this.m_bPrepared=!1,this.m_bNeedsShapePreservingProject=!1,this.m_inputTransform=null,this.m_transform1=null,this.m_transform2=null,this.m_extentFrom=null,this.m_horizon1=null,this.m_horizon2=null,this.m_pannableExtentFrom=new u,this.m_pannableExtentTo=new u,this.m_pannableExtentGcsTo=new u,this.m_bClipTopBottomFrom=!1,this.m_bNeedsGeoTransform=!1,this.m_bIsPannableFrom=!1,this.m_bIsPannableTo=!1,this.m_bInclusive1=!1,this.m_bInclusive2=!1,this.m_bSrFromIsPcs=!1,this.m_bSrToIsPcs=!1,this.m_fromTolerance=Number.NaN,this.m_toTolerance=Number.NaN,this.m_gcsToTolerance=Number.NaN,this.m_aFrom=Number.NaN,this.m_mpuFrom=Number.NaN,this.m_rpuFrom=Number.NaN,this.m_rpuGcsTo=Number.NaN,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN,this.m_stages=0}prepare(t,s,i){this.m_bPrepared&&n(""),t||e("");const r=t.getInputSR(),h=t.getOutputSR();O(r)&&O(h)||e("shape preserving project requires PCS or GCS");const m=r.getCoordinateSystemType(),a=h.getCoordinateSystemType();this.m_bSrFromIsPcs=2===m,this.m_bSrToIsPcs=2===a;let c=null,l=null,u=null,f=null;this.m_bSrFromIsPcs?(c=r,u=r.getGCS(),this.m_aFrom=at(u),this.m_mpuFrom=mt(c),this.m_rpuFrom=Number.NaN):(u=r,this.m_rpuFrom=ht(u),this.m_aFrom=Number.NaN),this.m_bSrToIsPcs?(l=h,f=h.getGCS(),this.m_aTo=at(f),this.m_mpuTo=mt(l)):(f=h,this.m_aTo=Number.NaN,this.m_mpuTo=Number.NaN),this.m_rpuGcsTo=ht(f);const g=t.getGeographicTransformations();this.m_bNeedsGeoTransform=null!==g&&g.count()>0;const _=r.equals(h);if(this.m_bNeedsShapePreservingProject=!_&&(this.m_bSrFromIsPcs||this.m_bSrToIsPcs||this.m_bNeedsGeoTransform),!this.m_bNeedsShapePreservingProject)return this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,void(this.m_bPrepared=!0);if(this.m_bIsPannableFrom=r.isPannable(),this.m_bIsPannableTo=h.isPannable(),this.m_bIsPannableFrom&&(this.m_pannableExtentFrom=r.getPannableExtent()),this.m_bIsPannableTo&&(this.m_pannableExtentTo=h.getPannableExtent()),this.m_bSrToIsPcs){this.m_pannableExtentGcsTo=f.getPannableExtent();const t=l.getCentralMeridian(),e=this.m_pannableExtentGcsTo.getCenter();e.x=t,this.m_pannableExtentGcsTo.centerAt(e)}else this.m_pannableExtentGcsTo=this.m_pannableExtentTo.clone();this.m_fromTolerance=r.getTolerance(0),this.m_toTolerance=h.getTolerance(0),this.m_gcsToTolerance=f.getTolerance(0);{const e=t.getExtendedParams(),n=e.clipWithInputHorizon,o=e.clipWithOutputHorizon;n&&this.setHorizon1(t,s,i),o&&this.setHorizon2(t,i),this.checkAndSetStages(t,i)}const d=D();d.setFlag(1073741824,!0),d.setFlag(536870912,!0);const p=S();if(p.clipWithInputHorizon=!1,p.clipWithOutputHorizon=!1,1===this.m_stages)this.m_transform1=I(!1,r,h,g,p,d);else if(2===this.m_stages){d.setFlag(2147483648,!0),this.m_transform1=I(!1,r,f,g,p,d);const t=D();this.m_transform2=I(!1,f,h,null,p,t)}else{o(null!=l),p.centralMeridianOfOutputGCS=l.getCentralMeridian(),this.m_transform1=I(!1,r,f,g,p,d);const t=D();t.setFlag(2147483648,!0),this.m_transform2=I(!1,f,h,null,p,t)}this.m_inputTransform=t,this.m_extentFrom=s?s.clone():null,this.m_bPrepared=!0}execute(t,e,s,i){this.m_bPrepared||n(""),o(!t.hasAttribute(10));return this.execute_(t,e,s,i)}checkIfNeedsReset(t,e){return o(0),!1}setHorizon1(t,e,s){const i=t.getInputSR();let n,o=null;const r=new u;if(this.m_bSrFromIsPcs){n=!0,o=i.getPCSHorizon(),o.queryEnvelope(r),this.m_bIsPannableFrom&&(o=new c({xmin:this.m_pannableExtentFrom.xmin,ymin:r.ymin,xmax:this.m_pannableExtentFrom.xmax,ymax:r.ymax}));let t=!1;null!=e&&(t=et(e,o,i,n,this.m_bIsPannableFrom,this.m_pannableExtentFrom,s)),t||(this.m_horizon1=o,this.m_bInclusive1=n)}else this.m_bClipTopBottomFrom=!0,this.m_bInclusive1=!0}setHorizon2(t,e){const s=t.getOutputSR();if(1===s.getCoordinateSystemType())return this.m_horizon2=null,void(this.m_bInclusive2=!1);let i=null;const n=new u,o=s.getGCSHorisonIsInclusive();i=s.getGCSHorizon(),i.queryEnvelope(n);const r=s.getCentralMeridian();if(this.m_bIsPannableTo){const t=new c({xmin:this.m_pannableExtentGcsTo.xmin,ymin:n.ymin,xmax:this.m_pannableExtentGcsTo.xmax,ymax:n.ymax});t.centerAt(r,0),i=t}this.m_horizon2=i,this.m_bInclusive2=o}checkAndSetStages(t,e){const s=t.getOutputSR().getGCSSplitLines();if(!this.m_horizon2&&!s)return void(this.m_stages=1);if(this.m_horizon2.getGeometryType()===r.enumEnvelope){const t=new u;this.m_horizon2.queryEnvelope(t);const e=t.width(),s=t.height();e>=d/this.m_rpuGcsTo&&s>=Math.PI/this.m_rpuGcsTo&&(this.m_horizon2=null)}if(this.m_horizon2||s){if(null!==this.m_horizon2&&!this.m_bNeedsGeoTransform&&!this.m_bSrFromIsPcs){const e=t.getOutputSR().getGCS();return t.getInputSR().equals(e)?(this.m_horizon1=this.m_horizon2,this.m_bInclusive1=this.m_bInclusive2,this.m_bClipTopBottomFrom=!1,this.m_horizon2=null,this.m_bInclusive2=!1,void(this.m_stages=1)):void(this.m_stages=2)}this.m_stages=3}else this.m_stages=1}execute_(t,e,n,o){if(!this.m_bNeedsShapePreservingProject)return(new b).execute(t,this.m_inputTransform,o);if(!t)return null;s(t),i(t);let a,c=t.getGeometryType();return h(c)?(a=W(t),c=r.enumPolyline):a=t,a.isEmpty()?a:m(c)?this.executeEx(t,e,n,o):(new b).execute(t,this.m_inputTransform,o)}executeEx(t,e,s,i){let n;t.hasNonLinearSegments()&&a(""),n=this.m_bIsPannableFrom?(new b).foldInto360Range(t,this.m_transform1.getInputSR()):t;let o,r=s;return r>0||(r=100*this.m_toTolerance),o=1===this.m_stages?this.executeGood(n,e,r,i):2===this.m_stages?this.executeBad(n,e,r,i):this.executeUgly(n,e,r,i),this.filterOverDensification(o,this.m_inputTransform.getOutputSR(),r,i)}executeGood(t,e,s,i){const n=s*s;let o,r;return o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5),r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i),r=F(r,this.m_transform1.getOutputSR(),i),r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,o,n,i),r=(new b).execute(r,this.m_transform1,i),r}executeBad(t,e,s,i){let n;n=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5;const o=s*s;let r;return r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):t,r=(new b).execute(r,this.m_transform1,i),r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!0,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,n,o,i),r=(new b).execute(r,this.m_transform2,i),r}executeUgly(t,e,s,i){const n=s*s;let o;o=e>0?this.getMinLengthInSrFrom(e):this.getMinLengthInSrFrom(1e-5);let r=null;r=this.m_bClipTopBottomFrom?x(t,this.m_transform1.getInputSR()):$(t,this.m_transform1.getInputSR(),this.m_horizon1,this.m_bInclusive1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,Number.NaN,i);let h=r;const m=new L(this.m_horizon2,this.m_transform2.getInputSR(),this.m_bInclusive2,this.m_pannableExtentGcsTo),a=this.m_transform2.getOutputSR().getGCSSplitLines(),c=new R(a,this.m_transform1,this.m_pannableExtentGcsTo);if(r=j(r,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,this.m_bIsPannableTo,this.m_pannableExtentTo,this.m_transform2,m,this.m_pannableExtentGcsTo,c,o,n,i),null!==r){h=null,r=(new b).execute(r,this.m_transform1,i);const t=Math.PI/180/this.m_rpuGcsTo*2;return r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,t,i),r=(new b).execute(r,this.m_transform2,i),r}let l=Number.NaN;l=s>0?s:100*this.m_toTolerance,l/=this.m_rpuGcsTo*this.m_aTo/this.m_mpuTo;const u=l*l;let f;return r=j(h,this.m_transform1,this.m_bIsPannableFrom,this.m_pannableExtentFrom,!0,this.m_pannableExtentGcsTo,null,null,null,null,o,u,i),h=null,r=(new b).execute(r,this.m_transform1,i),f=e>0?e*(Math.PI/180/this.m_rpuGcsTo):Math.PI/180/this.m_rpuGcsTo*1e-5,r=$(r,this.m_transform2.getInputSR(),this.m_horizon2,this.m_bInclusive2,!0,this.m_pannableExtentGcsTo,!1,Number.NaN,i),r=F(r,this.m_transform2.getOutputSR(),i),r=j(r,this.m_transform2,!0,this.m_pannableExtentGcsTo,this.m_bIsPannableTo,this.m_pannableExtentTo,null,null,null,null,f,n,i),r=(new b).execute(r,this.m_transform2,i),r}getMinLengthInSrFrom(t){let e;return e=this.m_bSrFromIsPcs?this.m_aFrom*(t*Math.PI/180)/this.m_mpuFrom:t*Math.PI/180*(1/this.m_rpuFrom),e}filterOverDensification(t,e,s,i){let n=X(t,s);return n.dropAttribute(10),n!==t&&n.getGeometryType()===r.enumPolygon&&(n=(new C).execute(n,e,!1,i)),n}}function X(t,e){if(t.isEmpty()||!t.hasAttribute(10))return t;const s=e*e;let i=t.getAttributeStreamRef(10),n=!1;const o=new _,r=[];let h=!1;for(let a=0,c=t.getPathCount();a<c;a++){const e=t.getPathStart(a),m=t.getPathEnd(a),c=t.isClosedPath(a);if(!(m>e))continue;{const t=c?e:m-1;0===i.read(e)&&0===i.read(t)||(n||(i=i.clone(),n=!0),i.write(e,0),i.write(t,0))}const l=c?m+1:m;let u=e;for(let a=e;a<l;a++){const c=a===m?e:a;if(0===i.read(c)){if(a-u>1){r.push({from:u,to:a});const c=new p;for(;r.length>0;){const a=r.at(-1);r.pop(),o.setStartXY(t.getXY(a.from));const l=a.to===m?e:a.to;o.setEndXY(t.getXY(l));let u=s,f=-1;for(let e=a.from+1,s=a.to;e<s;e++){const s=t.getXY(e),i=o.getClosestCoordinate(s,!1);o.queryCoord2D(i,c);const n=p.sqrDistance(c,s);u<n&&(u=n,f=e)}f>=0?(n||(i=i.clone(),n=!0),i.write(f,0),f-a.from>1&&r.push({from:a.from,to:f}),a.to-f>1&&r.push({from:f,to:a.to})):h=!0}}u=c}}}if(!h)return t;const m=Y(t,i,1);return m.dropAttribute(10),m}function Y(t,e,s){const i=t.createInstance(),n=new l;for(let o=0,r=t.getPathCount();o<r;o++){let r=!0,h=0,m=0;const a=t.getPathStart(o),c=t.getPathEnd(o);let l=!0;for(let u=a;u<c;u++){e.read(u)===s?(!l&&m>0&&(i.addSegmentsFromPath(t,o,h-a,m,r),m=0),l=!0):l?(l=!1,t.getPointByVal(u,n),r?(i.startPathPoint(n),r=!1):i.lineToPoint(n),h=u):m++}m>0&&i.addSegmentsFromPath(t,o,h-a,m,r)}return i}const A=8;function H(t,e){const s=.5;for(let i=0;i<t;i++){let n=Math.ceil(i/2)/(t+1);i%2!=0&&(n=-n);const o=s+n;e[i]=o}}function O(t){if(!t)return!1;const e=t.getCoordinateSystemType();return 2===e||1===e}function j(t,e,s,i,n,o,r,h,m,a,c,l,u){const f=t.createInstance();f.addAttribute(10);const _=t.querySegmentIterator(),d=[],p=[],P=new g,T=t.getDescription().getAttributeCount()>1,b=new lt(e,s,i,n,o,r,h,a,c,l,T?p:null,d,u);for(;_.nextPath();)for(;_.hasNextSegment();){const t=_.nextSegment(),e=t.getStartXY(),s=t.getEndXY(),i=e.compare(s)>0,n=J(i,t,P);d.length=0,p.length=0;if(!b.densifySegment(_.isFirstSegmentInPath(),n))return null;i&&K(T?p:null,d),d.at(-1).setCoordsPoint2D(t.getEndXY());const o=f.getPointCount();if(T){const e=J(i,t,P);U(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),t,e,p,d,f)}else B(_.isFirstSegmentInPath(),_.isLastSegmentInPath()&&!_.isPathClosed(),d,f);if(b.needsPostFiltering()){f.addAttribute(10);const t=f.getAttributeStreamRef(10);for(let e=1,s=d.length-1;e<s;e++)t.write(e+o,1)}}return f}function B(t,e,s,i){t&&i.insertPath2D(-1,null,0,0,!0);const n=i.getPathCount()-1;e?i.insertPointsFromPoints(n,-1,s,0,s.length,!0):i.insertPointsFromPoints(n,-1,s,0,s.length-1,!0)}function U(t,e,s,i,n,o,r){r.reserve(r.getPointCount()+o.length-1);const h=new l;if(s.queryStart(h),t?r.startPathPoint(h):r.lineToPoint(h),o.length>2){const t=i.calculateLength2D();for(let e=1;e<o.length-1;e++){const s=i.lengthToT(n[e]*t);i.queryCoord(s,h),h.setXY(o[e]),r.lineToPoint(h)}}e&&(s.queryEnd(h),r.lineToPoint(h))}function W(t){const e=new f({vd:t.getDescription()});return e.addSegment(t,!0),e}function V(t,e){const s=e.getInputSR(),i=e.getOutputSR(),n=new p;2===s.getCoordinateSystemType()?(n.setCoordsPoint2D(t),G(s,0,[n],1)):n.setCoordsPoint2D(t);const o=new p;o.setCoordsPoint2D(n),v(e,[o],null,1,!1);const r=new p;return 2===i.getCoordinateSystemType()?(r.setCoordsPoint2D(o),z(i,[r],1,!1)):r.setCoordsPoint2D(o),r}function Q(t,e,s,i,n,o,r,h){if(n){const n=o.width(),m=.5*n;if(i){const i=.25*n;let o=!1;const a=new p,c=new p;if(Math.abs(t.y)===i?(a.setCoords(s.x,t.y),c.setCoordsPoint2D(s),o=!0):Math.abs(s.y)===i&&(c.setCoords(t.x,s.y),a.setCoordsPoint2D(t),o=!0),Math.abs(e.y)===i&&(o||(a.setCoordsPoint2D(t),c.setCoordsPoint2D(s),o=!0),a.x=e.x),o)return ot(e,a,m,n,r),ot(e,c,m,n,h),!0}let a=0;t.x-e.x>m&&s.x-e.x>m?a-=n:e.x-t.x>m&&e.x-s.x>m&&(a+=n),Math.abs(e.x-(t.x+a))<m?(r.setCoordsPoint2D(t),ot(r,s,m,n,h),r.x+=a,h.x+=a):(r.setCoordsPoint2D(s),ot(r,t,m,n,h),r.x+=a,h.x+=a)}else r.setCoordsPoint2D(t),h.setCoordsPoint2D(s);return!1}function J(t,e,s){return t?(s.create(e.getGeometryType()),e.copyTo(s.get()),s.get().reverse(),s.get()):e}function K(t,e){e.reverse(),null!==t&&t.reverse()}function Z(t,e,s,i){const n=.5*(i.getStartX()+i.getEndX());if(n-s>t){const t=new T;t.setShiftCoords(-e,0),i.applyTransformation(t)}else if(s-n>t){const t=new T;t.setShiftCoords(e,0),i.applyTransformation(t)}}function $(t,e,s,i,n,o,r,h,m){const a=[!1];r&&tt(t,e,s,i,n,o,!0,h,a,m);let c=t;return a[0]||(c=tt(c,e,s,i,n,o,!1,h,null,m)),c=it(c,n,o,c!==t),c}function tt(t,e,s,i,n,o,h,m,a,c){if(h&&(a[0]=!1),null==s)return t;const l=new u,f=new u;s.queryEnvelope(l),t.queryEnvelope(f);const g=t.getGeometryType(),_=s.getGeometryType(),d=e.getTolerance(0);if(!n){if(h)return a[0]=st(t,s,e,i,c),null;let n;return n=i?_===r.enumEnvelope?k(t,l,d,m,c):(new y).execute(t,s,e,c):(new w).execute(t,s,e,c),n===s&&(n=s.clone()),n}const p=o.width(),P=p*Math.ceil(l.width()/p);let b=null;if(i){let o=nt(t,s,n,P),D=0;const S=new T;do{let n=null;if(_===r.enumEnvelope){const r=s.clone();if(S.setShiftCoords(o*P,0),r.applyTransformation(S),h){if(a[0]=st(t,r,e,i,c),!a[0])return null}else{const e=new u;r.queryEnvelope(e),n=k(t,e,d,m,c)}}else{const r=t.clone();if(S.setShiftCoords(-o*P,0),r.applyTransformation(S),h){if(a[0]=st(r,s,e,i,c),!a[0])return null}else n=(new y).execute(r,s,e,c),n===s&&(n=s.clone())}if(!h){if(n.isEmpty())continue;if(g===r.enumPolygon){const t=new u;if(n.queryEnvelope(t),t.width()<=d)continue}_===r.enumEnvelope&&(S.setShiftCoords(-o*P,0),n===t&&(n=n.clone()),n.applyTransformation(S)),null===b?b=n===t?n.clone():n:b.add(n,!1)}D++}while(l.xmin+ ++o*P<f.xmax);if(h)return null;null===b&&(b=t.createInstance()),g===r.enumPolygon&&D>1&&p-f.width()<=10*d&&(b=(new C).execute(b,e,!0,c))}else{let o=nt(t,s,n,P);if(b=t.clone(),0!==o){const t=new T;t.setShiftCoords(-o*P,0),b.applyTransformation(t)}do{if(h){if(a[0]=st(b,s,e,i,c),!a[0])return null}else if(b=(new w).execute(b,s,e,c),b===s&&(b=s.clone()),b.isEmpty())break;const t=new T;t.setShiftCoords(-P,0),b.applyTransformation(t)}while(l.xmin+ ++o*P<f.xmax);if(h)return null;if(!b.isEmpty()&&0!==o){const t=new T;t.setShiftCoords(o*P,0),b.applyTransformation(t)}}return b}function et(t,e,s,i,n,o,r){const h=[!1];return tt(t,s,e,i,n,o,!0,Number.NaN,h,r),h[0]}function st(t,e,s,i,n){let o;if(e.getGeometryType()===r.enumPolygon)if(i){o=E(e,t,s,64,n)}else{o=E(e,t,s,4,n)}else if(i){const s=new u,i=new u;e.queryEnvelope(s),t.queryEnvelope(i);o=s.containsEnvelope(i)}else{o=E(e,t,s,4,n)}return o}function it(t,e,s,i){let n;if(!e)return t;const o=s.getCenter().x,r=s.width(),h=.5*r,m=new u;t.queryEnvelope(m);const a=m.getCenter().x;let c=0;if(a-o>h){c=-Math.ceil((a-o-h)/r)*r}else if(o-a>h){c=Math.ceil((o-a-h)/r)*r}if(0!==c){n=i?t:t.clone();const e=new T;e.setShiftCoords(c,0),n.applyTransformation(e)}else n=t;return n}function nt(t,e,s,i){if(!s)return 0;let n=0;const o=new u;e.queryEnvelope(o);const r=new u;t.queryEnvelope(r);const h=o.xmin+i;for(;h+i+n*i>r.xmin;)n--;for(;h+n*i<r.xmin;)n++;return n}function ot(t,e,s,i,n){e.x-t.x>s?n.setCoords(e.x-i,e.y):t.x-e.x>s?n.setCoords(e.x+i,e.y):n.setCoordsPoint2D(e)}function rt(t,e,s,i,n,o,r){Math.abs(t.y)===s?(o.setCoords(e.x,t.y),r.setCoordsPoint2D(e)):Math.abs(e.y)===s?(o.setCoordsPoint2D(t),r.setCoords(t.x,e.y)):(o.setCoordsPoint2D(t),ot(o,e,i,n,r))}function ht(t){return t.getUnit().getUnitToBaseFactor()}function mt(t){return t.getUnit().getUnitToBaseFactor()}function at(t){return t.getPECoordSys().getDatum().getSpheroid().getAxis()}function ct(t,e,s){return s<=.5?t+(e-t)*s:e-(e-t)*(1-s)}class lt{checkSegment(){for(let t=0;t<this.n;t++){if(null!==this.pSplitLines2Info&&this.pSplitLines2Info.hasSplitLines()&&!this.bCheckIfNoDensificationNeededForCurve){const t=this.pSplitLines2Info.getSplitLineFactorEx(this.rectifiedSegment,this.leftFactor,this.rightFactor,this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker);if(Number.isNaN(t))return-1;if(-1!==t&&this.leftFactor<t&&t<this.rightFactor)return this.cutFactor=t,this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(V(this.cutFromDensifiedPoint,this.transform)),this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(V(this.cutGcsToDensifiedPoint,this.transform2)),this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint),1}if(this.cutFactor=ct(this.leftFactor,this.rightFactor,this.scalars[t]),this.cutFromDensifiedPoint.assign(this.rectifiedSegment.getCoord2D(this.cutFactor)),this.cutToDensifiedPoint.assign(V(this.cutFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.cutGcsToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.cutToDensifiedPoint.assign(V(this.cutGcsToDensifiedPoint,this.transform2))),0===t&&(this.midFactor=this.cutFactor,this.midFromDensifiedPoint.setCoordsPoint2D(this.cutFromDensifiedPoint),this.midToDensifiedPoint.setCoordsPoint2D(this.cutToDensifiedPoint),this.midGcsToDensifiedPoint.setCoordsPoint2D(this.cutGcsToDensifiedPoint)),this.bIsPannableFrom&&!this.bCheckIfNoDensificationNeededForCurve&&Math.abs(this.leftFromDensifiedPoint.x-this.rightFromDensifiedPoint.x)>=.25*this.pannableExtentFrom.width())return 1;let e;if(this.bCheckIfNoDensificationNeededForCurve){const t=this.projCurveSegment.get().getClosestCoordinate(this.cutToDensifiedPoint,!1),s=this.projCurveSegment.get().getCoord2D(t);e=p.sqrDistance(this.cutToDensifiedPoint,s)}else{const s=new p,i=new p,n=Q(this.leftToDensifiedPoint,this.cutToDensifiedPoint,this.rightToDensifiedPoint,this.bSrToIsGcs,this.bIsPannableTo,this.pannableExtentTo,s,i);this.line.setStartXY(s),this.line.setEndXY(i);const o=this.line.getClosestCoordinate(this.cutToDensifiedPoint,!0);if(n||t>0||Math.abs(o-this.scalars[t])<.3){const t=this.line.getCoord2D(o);e=p.sqrDistance(this.cutToDensifiedPoint,t)}else e=2*this.maxDeviationInSrToSq,this.bNeedPostFiltering=!0}if(e>this.maxDeviationInSrToSq)return this.bCheckIfNoDensificationNeededForCurve=!1,1}return 0}constructor(t,e,s,i,n,o,r,h,m,a,c,l,f){this.leftFromDensifiedPoint=new p,this.rightFromDensifiedPoint=new p,this.cutFromDensifiedPoint=new p,this.midFromDensifiedPoint=new p,this.leftToDensifiedPoint=new p,this.rightToDensifiedPoint=new p,this.cutToDensifiedPoint=new p,this.midToDensifiedPoint=new p,this.line=new _,this.leftGcsToDensifiedPoint=new p,this.rightGcsToDensifiedPoint=new p,this.cutGcsToDensifiedPoint=new p,this.midGcsToDensifiedPoint=new p,this.bSrToIsGcs=!1,this.bIsCurve=!1,this.leftFactor=0,this.rightFactor=0,this.bIsFirstInPath=!1,this.rectifiedSegment=null,this.transform=null,this.bIsPannableFrom=!1,this.pannableExtentFrom=new u,this.bIsPannableTo=!1,this.bNeedPostFiltering=!1,this.pannableExtentTo=new u,this.transform2=null,this.pHorizon2Info=null,this.pSplitLines2Info=null,this.minLengthInSrFrom=0,this.maxDeviationInSrToSq=0,this.cutFactor=0,this.midFactor=0,this.pDensifiedFactors=null,this.pDensifiedPoints=[],this.rightFromDensifiedPointsStack=[],this.rightToDensifiedPointsStack=[],this.rightGcsToDensifiedPointsStack=[],this.rightFactorsStack=[],this.projCurveSegment=new g,this.n=0,this.bCheckIfNoDensificationNeededForCurve=!1,this.scalars=P(A-1,Number.NaN),this.progressTracker=f,this.transform=t,this.bIsPannableFrom=e,this.pannableExtentFrom.assign(s),this.bIsPannableTo=i,this.pannableExtentTo.assign(n),this.transform2=o,this.pHorizon2Info=r,this.pSplitLines2Info=h,this.minLengthInSrFrom=m,this.maxDeviationInSrToSq=a,this.pDensifiedFactors=c,this.pDensifiedPoints=l,this.progressTracker=f,this.bNeedPostFiltering=!1}needsPostFiltering(){return this.bNeedPostFiltering}densifySegment(t,e){if(this.bIsFirstInPath=t,this.rectifiedSegment=e,this.leftGcsToDensifiedPoint.setNAN(),this.rightGcsToDensifiedPoint.setNAN(),this.cutGcsToDensifiedPoint.setNAN(),this.midGcsToDensifiedPoint.setNAN(),this.bSrToIsGcs=null!=this.transform2?1===this.transform2.getOutputSR().getCoordinateSystemType():1===this.transform.getOutputSR().getCoordinateSystemType(),this.bIsCurve=this.rectifiedSegment.isCurve(),this.leftFactor=0,this.rightFactor=1,this.leftFromDensifiedPoint.assign(this.rectifiedSegment.getStartXY()),this.rightFromDensifiedPoint.assign(this.rectifiedSegment.getEndXY()),this.leftToDensifiedPoint.assign(V(this.leftFromDensifiedPoint,this.transform)),this.rightToDensifiedPoint.assign(V(this.rightFromDensifiedPoint,this.transform)),null!==this.transform2&&(this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.leftToDensifiedPoint),this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftToDensifiedPoint.assign(V(this.leftGcsToDensifiedPoint,this.transform2)),this.rightToDensifiedPoint.assign(V(this.rightGcsToDensifiedPoint,this.transform2)),this.bIsFirstInPath&&!this.pHorizon2Info.isPointStartInHorizon(this.leftGcsToDensifiedPoint,this.progressTracker)))return!1;this.rightFromDensifiedPointsStack.length=0,this.rightToDensifiedPointsStack.length=0,this.rightGcsToDensifiedPointsStack.length=0,this.rightFactorsStack.length=0,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!=this.transform2&&this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.leftFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.leftFactor),this.bIsCurve?this.rectifiedSegment.getGeometryType()===r.enumBezier?this.n=A-1:this.n=5:this.n=3,H(this.n,this.scalars);const s=this.rectifiedSegment.calculateLength2D();if(this.bCheckIfNoDensificationNeededForCurve=!1,this.bIsCurve){const t=new f({vd:this.rectifiedSegment.getDescription()});let e=(new b).execute(t,this.transform,this.progressTracker);if(null!==this.transform2){const t=new u;if(e.queryEnvelope(t),!this.pHorizon2Info.isEnvelopeInHorizon(t,this.progressTracker))return!1;e=(new b).execute(e,this.transform2,this.progressTracker)}e.getSegmentBuffer(0,this.projCurveSegment,!1),this.bCheckIfNoDensificationNeededForCurve=!0}for(;this.rightFromDensifiedPointsStack.length>0;){let t=!1;if(this.cutFactor=Number.NaN,this.midFactor=Number.NaN,this.midFromDensifiedPoint.setNAN(),this.midToDensifiedPoint.setNAN(),(this.rightFactor-this.leftFactor)*s>this.minLengthInSrFrom){const e=this.checkSegment();if(-1===e)return!1;t=0!==e}if(t)this.rightFromDensifiedPoint.setCoordsPoint2D(this.midFromDensifiedPoint),this.rightToDensifiedPoint.setCoordsPoint2D(this.midToDensifiedPoint),this.rightFactor=this.midFactor,this.rightFromDensifiedPointsStack.push(this.rightFromDensifiedPoint.clone()),this.rightToDensifiedPointsStack.push(this.rightToDensifiedPoint.clone()),this.rightFactorsStack.push(this.rightFactor),null!==this.transform2&&(this.rightGcsToDensifiedPoint.setCoordsPoint2D(this.midGcsToDensifiedPoint),this.rightGcsToDensifiedPointsStack.push(this.rightGcsToDensifiedPoint.clone()));else{if(null!==this.transform2&&!this.pHorizon2Info.isAdjoiningLineInHorizon(this.leftGcsToDensifiedPoint,this.rightGcsToDensifiedPoint,this.progressTracker))return!1;if(this.rightFromDensifiedPointsStack.pop(),this.rightToDensifiedPointsStack.pop(),this.rightFactorsStack.pop(),null!==this.transform2&&this.rightGcsToDensifiedPointsStack.pop(),null!==this.pDensifiedPoints&&this.pDensifiedPoints.push(this.rightFromDensifiedPoint.clone()),null!==this.pDensifiedFactors&&this.pDensifiedFactors.push(this.rightFactor),this.rightFromDensifiedPointsStack.length>0){this.leftFromDensifiedPoint.setCoordsPoint2D(this.rightFromDensifiedPoint),this.leftToDensifiedPoint.setCoordsPoint2D(this.rightToDensifiedPoint),this.leftFactor=this.rightFactor;const t=this.rightFromDensifiedPointsStack.at(-1),e=this.rightToDensifiedPointsStack.at(-1);if(this.rightFromDensifiedPoint.setCoordsPoint2D(t),this.rightToDensifiedPoint.setCoordsPoint2D(e),this.rightFactor=this.rightFactorsStack.at(-1),null!==this.transform2){this.leftGcsToDensifiedPoint.setCoordsPoint2D(this.rightGcsToDensifiedPoint);const t=this.rightGcsToDensifiedPointsStack.at(-1);this.rightGcsToDensifiedPoint.setCoordsPoint2D(t)}}}}return!0}}class ut{getOperatorType(){return 10315}supportsCurves(){return!1}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,s,i,n,o){return q(s)?new ft(t,e,s,i,n,o):(new b).executeMany(t,s,o)}execute(t,e,s,i,n){if(!q(e))return(new b).execute(t,e,n);const o=new M;return o.prepare(e,null,n),o.execute(t,s,i,n)}}class ft extends t{constructor(t,s,i,n,o,r){super(),this.m_spp=null,this.m_index=-1,t||e(""),this.m_progressTracker=r,this.m_geometries=t,this.m_geometriesExtent=s?s.clone():null,this.m_transform=i,this.m_minSegmentLengthInDegrees=n,this.m_maxDeviationInSrTo=o}tock(){return!0}getRank(){return 1}next(){this.m_spp||(this.m_spp=new M,this.m_spp.prepare(this.m_transform,this.m_geometriesExtent,this.m_progressTracker));const t=this.m_geometries.next();return s(t),i(t),null!=t?(this.m_index=this.m_geometries.getGeometryID(),this.m_spp.execute(t,this.m_minSegmentLengthInDegrees,this.m_maxDeviationInSrTo,this.m_progressTracker)):null}getGeometryID(){return this.m_index}}export{ut as OperatorShapePreservingProject};
|
package/chunks/Terrain.glsl.js
CHANGED
|
@@ -7,7 +7,7 @@ float z = 1.0 - abs(normalCompressed.x) - abs(normalCompressed.y);
|
|
|
7
7
|
vec3 n = vec3(normalCompressed + vec2(normalCompressed.x >= 0.0 ? 1.0 : -1.0,
|
|
8
8
|
normalCompressed.y >= 0.0 ? 1.0 : -1.0) * min(z, 0.0), z);
|
|
9
9
|
return normalize(n);
|
|
10
|
-
}`)};z(V,r),i.include(c,r);const{output:E,pbrMode:G,overlayMode:q,tileBorders:I,spherical:R,transparencyMode:J,screenSizePerspective:K,overlayEnabled:Q}=r,
|
|
10
|
+
}`)};z(V,r),i.include(c,r);const{output:E,pbrMode:G,overlayMode:q,tileBorders:I,spherical:R,transparencyMode:J,screenSizePerspective:K,overlayEnabled:Q,receiveShadows:X}=r,Y=2===J||3===J,Z=Q&&Y;switch(E){case 1:case 0:{i.include(S,r),i.include(w,r),Q&&(r.pbrMode=5===G?6:3,i.include(j,r),r.pbrMode=G);const l=2===q;l&&i.include(m,r),k.add("vnormal","vec3"),k.add("vpos","vec3",{invariant:!0}),k.add("vup","vec3"),H(),K&&T(V),X&&i.include(n,r),K&&(k.add("screenSizeDistanceToCamera","float"),k.add("screenSizeCosAngle","float")),V.main.add(N`
|
|
11
11
|
vpos = position;
|
|
12
12
|
vec3 positionWorld = position + localOrigin;
|
|
13
13
|
gl_Position = transformPosition(proj, view, vpos);
|
|
@@ -22,21 +22,21 @@ return normalize(n);
|
|
|
22
22
|
screenSizeDistanceToCamera = length(viewPos);
|
|
23
23
|
vec3 viewSpaceNormal = (viewNormal * vec4(normalize(positionWorld), 1.0)).xyz;
|
|
24
24
|
screenSizeCosAngle = abs(viewSpaceNormal.z);`)}
|
|
25
|
-
${M(
|
|
25
|
+
${M(X,"forwardLinearDepth();")}`),W.include(s,r),i.include(w,r),W.include(u,r),i.include(O,r),P(W,r),b(W),h(W),W.uniforms.add(V.uniforms.get("localOrigin"),new $("viewDirection",({camera:e})=>o(B,a(B,e.viewMatrix[12],e.viewMatrix[13],e.viewMatrix[14])))),l&&W.uniforms.add(new D("ovWaterTex",e=>e.overlay?.getTexture(3)),new A("view",({origin:r},{camera:o})=>e(U,o.viewMatrix,r)));const t=.2;W.code.add(N`float lum(vec3 c) {
|
|
26
26
|
return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
27
27
|
}`),C(W),y(W),W.main.add(N`
|
|
28
28
|
vec3 normal = normalize(vnormal);
|
|
29
29
|
float vndl = dot(normal, mainLightDirection);
|
|
30
30
|
|
|
31
31
|
float additionalAmbientScale = smoothstep(0.0, 1.0, clamp(vndl*2.5, 0.0, 1.0));
|
|
32
|
-
float shadow = ${
|
|
32
|
+
float shadow = ${X?"max(lightingGlobalFactor * (1.0 - additionalAmbientScale), readShadowMap(vpos, linearDepth))":R?"lightingGlobalFactor * (1.0 - additionalAmbientScale)":"0.0"};
|
|
33
33
|
|
|
34
34
|
float ssao = evaluateAmbientOcclusionInverse();
|
|
35
35
|
vec4 tileColor = getTileColor();
|
|
36
36
|
|
|
37
37
|
${M(Q,N`vec4 overlayColorOpaque = getOverlayColor(ovColorTex, vtcOverlay);
|
|
38
38
|
vec4 overlayColor = overlayOpacity * overlayColorOpaque;
|
|
39
|
-
${M(
|
|
39
|
+
${M(Y,`if (overlayColor.a < ${N.float(_)}) { discard; }`)}
|
|
40
40
|
vec4 groundColor = tileColor;
|
|
41
41
|
tileColor = tileColor * (1.0 - overlayColor.a) + overlayColor;`)}
|
|
42
42
|
|
|
@@ -48,7 +48,7 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
|
48
48
|
|
|
49
49
|
bool sliced = rejectBySlice(vpos);
|
|
50
50
|
if (sliced) {
|
|
51
|
-
tileColor *= ${N.float(
|
|
51
|
+
tileColor *= ${N.float(t)};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
vec3 albedo = tileColor.rgb;
|
|
@@ -66,7 +66,7 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
|
66
66
|
vec4 viewPosition = view*vec4(vpos, 1.0);
|
|
67
67
|
vec4 waterColorLinear = getOverlayWaterColor(overlayWaterMask, waterOverlayColor, -normalize(vpos - cameraPosition), shadow, vnormal, tbnMatrix, viewPosition.xyz, vpos + localOrigin);
|
|
68
68
|
vec4 waterColorNonLinear = delinearizeGamma(vec4(waterColorLinear.xyz, 1.0));
|
|
69
|
-
float opacity = sliced ? ${N.float(
|
|
69
|
+
float opacity = sliced ? ${N.float(t)} : 1.0;
|
|
70
70
|
// un-gamma the ground color to mix in linear space
|
|
71
71
|
fragColor = mix(groundColor, waterColorNonLinear, waterColorLinear.w) * opacity;
|
|
72
72
|
}`)}
|
|
@@ -93,13 +93,13 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5;
|
|
|
93
93
|
vec2 edgeFactors = smoothstep(vec2(0.0), 1.5 * dVuv, min(vuv0, 1.0 - vuv0));
|
|
94
94
|
float edgeFactor = 1.0 - min(edgeFactors.x, edgeFactors.y);
|
|
95
95
|
fragColor = mix(fragColor, vec4(1.0, 0.0, 0.0, 1.0), edgeFactor);`)}
|
|
96
|
-
fragColor = applySlice(fragColor, vpos);`)}break;case 2:
|
|
97
|
-
${M(
|
|
98
|
-
gl_Position = transformPosition(proj, view, position);`),W.main.add(`${M(
|
|
99
|
-
${M(
|
|
96
|
+
fragColor = applySlice(fragColor, vpos);`)}break;case 2:Z&&i.include(j,r),V.main.add(N`
|
|
97
|
+
${M(Z,"setOverlayVTC(uv0);")}
|
|
98
|
+
gl_Position = transformPosition(proj, view, position);`),W.main.add(`${M(Z,`if (getCombinedOverlayColor().a < ${N.float(_)}) discard;`)}`);break;case 4:case 5:case 6:case 7:i.include(g,r),l(i),t(i),V.main.add(N`gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth);`),W.main.add(N`outputDepth(linearDepth);`);break;case 3:Z&&i.include(j,r),k.add("vnormal","vec3"),T(V),H(),V.main.add(N`
|
|
99
|
+
${M(Z,"setOverlayVTC(uv0);")}
|
|
100
100
|
gl_Position = transformPosition(proj, view, position);
|
|
101
101
|
vnormal = normalize((viewNormal * vec4(getNormal(), 1.0)).xyz);`),W.main.add(N`
|
|
102
|
-
${M(
|
|
102
|
+
${M(Z,`if (getCombinedOverlayColor().a < ${N.float(_)}) discard;`)}
|
|
103
103
|
vec3 normal = normalize(vnormal);
|
|
104
104
|
if (gl_FrontFacing == false) {
|
|
105
105
|
normal = -normal;
|