@arcgis/core 4.33.0-next.20250501 → 4.33.0-next.20250502
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{de16b771d2c8d816c738.js → 05c80002c37002ac99e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d40c4783f58af1ae0dc.js → 0e8181e7fc1386d08ffc.js} +1 -1
- package/assets/esri/core/workers/chunks/{96e5d192c8d23c1e324f.js → 13e68c43acc8916520db.js} +1 -1
- package/assets/esri/core/workers/chunks/{e6a5911ea21bef32834b.js → 1bc22af4cc4effcbcf2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b2ab27159500315fbc1.js → 26850ec0917ee355ddb7.js} +1 -1
- package/assets/esri/core/workers/chunks/{1bd4fe77ba6fb25322e7.js → 29e2b105f55adafc3a6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d63dfa5a60c88e03b28.js → 2c77a543a174e5bc736a.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0ddf4f1c6a351b447c7.js → 30d7d2c7d6e9e5e2ecb9.js} +1 -1
- package/assets/esri/core/workers/chunks/{febae745a29a17ca130a.js → 4480e4b61affb3b2e9d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d4a271351fd288277d2.js → 49085a0b3a74e158f32f.js} +1 -1
- package/assets/esri/core/workers/chunks/{392e64a573f67817db02.js → 4cb199b547e5b97e65fb.js} +1 -1
- package/assets/esri/core/workers/chunks/4df36ee2406861c7afa8.js +1 -0
- package/assets/esri/core/workers/chunks/{ba917175ca2a6681501e.js → 563594357f3648652a5c.js} +1 -1
- package/assets/esri/core/workers/chunks/{abfc5f9ac16c3e885c5f.js → 56db71ea7eb8a5652d98.js} +1 -1
- package/assets/esri/core/workers/chunks/{e56647e61296643c5f84.js → 5719471414810b6a9aec.js} +1 -1
- package/assets/esri/core/workers/chunks/{235efd948ae470a6f238.js → 60b1365d25581ccf0485.js} +1 -1
- package/assets/esri/core/workers/chunks/{3795793643f4db64af0e.js → 63c25455b9cf1b3df76a.js} +1 -1
- package/assets/esri/core/workers/chunks/{909be86782af3deb448e.js → 654fe135d41af81daa13.js} +1 -1
- package/assets/esri/core/workers/chunks/{cd9343c78a7c3acdbbcd.js → 681b2662f6ce936afd7e.js} +1 -1
- package/assets/esri/core/workers/chunks/{65f2b22d8fc12e6d4a87.js → 7000d9158da929a16071.js} +1 -1
- package/assets/esri/core/workers/chunks/{7551011117c3d36ff3db.js → 743cdbff5c4616ddc2b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{968956284f44187f0622.js → 8540fb31bd0b29ff1906.js} +1 -1
- package/assets/esri/core/workers/chunks/8c5cea49e48f8858f115.js +1 -0
- package/assets/esri/core/workers/chunks/{237a965bd41ba8903e03.js → 921c040d0497031fd8ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{96d2a0777f5c418055fb.js → 92b48e3365d1cc933113.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d485c07848164099859.js → 95a4da3150ad8e8e36d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{46fb6ba8900286d18b6f.js → 9d564f79b82d427fc1da.js} +1 -1
- package/assets/esri/core/workers/chunks/{00612d6e05b1c8647668.js → 9fff43ffcd5602ccc50f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1cc5c566e68f2255d035.js → a6ca68ef6311ffc365b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{5a51c75a2932d9da001a.js → a8d043b73e087bee7c40.js} +1 -1
- package/assets/esri/core/workers/chunks/{ebfa4a0334401f5e004a.js → c12765e0c8b44e349c2a.js} +1 -1
- package/assets/esri/core/workers/chunks/{afddb94ff4e1a70022c7.js → c3b2b05996e2008adbe3.js} +1 -1
- package/assets/esri/core/workers/chunks/{4fb4884d2de42792abe3.js → d1a9e8db5ba403abe721.js} +1 -1
- package/assets/esri/core/workers/chunks/d35cd309ba7bb8968a22.js +1 -0
- package/assets/esri/core/workers/chunks/{6e6422eda398774acbc7.js → d60da671aba70485050e.js} +1 -1
- package/assets/esri/core/workers/chunks/{7a8df1225abd54ff68ed.js → db298b292a4e43cba72d.js} +1 -1
- package/assets/esri/core/workers/chunks/{2bda2cfc6e81818d7d33.js → dcaeb57c69d432118604.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb455fd89b74b70a6a2b.js → e613df03ceb39e29befa.js} +1 -1
- package/assets/esri/core/workers/chunks/{05d7d8ff3e4cbad32580.js → e8dcaa7837b6fe7bff20.js} +1 -1
- package/assets/esri/core/workers/chunks/ec1a4b82cbc44ba45f83.js +1 -0
- package/assets/esri/core/workers/chunks/ec778cc7a55068f51937.js +1 -0
- package/assets/esri/core/workers/chunks/{51339193abddfe37745d.js → f2b63597ae956db74eb3.js} +1 -1
- package/chunks/Bufferer-CicaNej1.js +1 -1
- package/chunks/Distance2DCalculator-C1KHhZwD.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/Envelope2D.js +1 -1
- package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/GeometryCleaner-BEJM7I4l.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/containsOperator.js +1 -1
- package/chunks/disjointOperator.js +1 -1
- package/chunks/equalsOperator.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/containsOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/interfaces.d.ts +31 -0
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
- package/widgets/Directions/css.js +5 -0
- package/widgets/Directions.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/assets/esri/core/workers/chunks/11b55e7e76e50fe11bbe.js +0 -1
- package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +0 -1
- package/assets/esri/core/workers/chunks/84d7ed2cf5fe23a0888f.js +0 -1
- package/assets/esri/core/workers/chunks/86931186095c23e47c0c.js +0 -1
- package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9187],{79187:(i,t,s)=>{s.r(t),s.d(t,{Envelope2D:()=>x});var m=s(55537),h=s(83661);class x{static construct(i,t,s,m){return new x(i,t,s,m)}constructor(i,t,s,m){this.m_EnvelopeType=2,void 0===i?(this.xmin=Number.NaN,this.ymin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN):"number"==typeof i?(this.xmin=i,this.ymin=t,this.xmax=s,this.ymax=m):(this.xmin=i.xmin,this.ymin=i.ymin,this.xmax=i.xmax,this.ymax=i.ymax),this.normalize()}static constructEmpty(){return new x(Number.NaN,Number.NaN,Number.NaN,Number.NaN)}clone(){return new x(this)}assign(i){return this.xmin=i.xmin,this.xmax=i.xmax,this.ymin=i.ymin,this.ymax=i.ymax,this}width(){return this.xmax-this.xmin}height(){return this.ymax-this.ymin}maxDimension(){return Math.max(this.width(),this.height())}minDimension(){return Math.min(this.width(),this.height())}sqrDiagonal(){const i=this.width(),t=this.height();return i*i+t*t}diagonal(){return Math.sqrt(this.sqrDiagonal())}getCenterX(){return.5*(this.xmin+this.xmax)}getCenterY(){return.5*(this.ymin+this.ymax)}getCenter(){return h.P.construct(this.getCenterX(),this.getCenterY())}queryCenter(i){i.x=.5*(this.xmin+this.xmax),i.y=.5*(this.ymin+this.ymax)}setEmpty(){this.xmin=Number.NaN,this.ymin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN}setInfinite(){this.xmin=Number.NEGATIVE_INFINITY,this.xmax=Number.POSITIVE_INFINITY,this.ymin=Number.NEGATIVE_INFINITY,this.ymax=Number.POSITIVE_INFINITY}isDegenerate(i){return!this.isEmpty()&&(this.width()<=i||this.height()<=i)}isZero(){return!(this.isEmpty()||this.width()&&this.height())}isEmpty(){return Number.isNaN(this.xmin)||Number.isNaN(this.ymin)||Number.isNaN(this.xmax)||Number.isNaN(this.ymax)}mergeNeCoords(i,t){this.xmin>i?this.xmin=i:this.xmax<i&&(this.xmax=i),this.ymin>t?this.ymin=t:this.ymax<t&&(this.ymax=t)}mergeNe(i){this.mergeNeCoords(i.x,i.y)}mergeCoords(i,t){this.isEmpty()?(this.xmin=i,this.ymin=t,this.xmax=i,this.ymax=t):(this.xmin>i?this.xmin=i:this.xmax<i&&(this.xmax=i),this.ymin>t?this.ymin=t:this.ymax<t&&(this.ymax=t))}merge(i){this.mergeCoords(i.x,i.y)}mergeEnvelope2D(i){i.isEmpty()||(this.mergeCoords(i.xmin,i.ymin),this.mergeNeCoords(i.xmax,i.ymax))}mergePoints(i,t){for(let s=0;s<t;){if(!this.isEmpty()){for(let m=s;m<t;m++)this.mergeNe(i[m]);break}this.setCoords(i[s]),s++}}mergePointsInterleaved(i,t,s){for(let m=2*t,h=m+2*s;m<h;m+=2)this.mergeCoords(i.read(m),i.read(m+1))}inflateCoords(i,t){this.isEmpty()||(this.xmin-=i,this.xmax+=i,this.ymin-=t,this.ymax+=t,(this.xmin>this.xmax||this.ymin>this.ymax)&&this.setEmpty())}getInflatedCoords(i,t){const s=this.clone();return s.inflateCoords(i,t),s}inflate(i){this.inflateCoords(i,i)}getInflated(i){const t=this.clone();return t.inflateCoords(i,i),t}zoom(i,t){this.isEmpty()||this.setCoords({center:this.getCenter(),width:i*this.width(),height:t*this.height()})}scale(i){i<0&&this.setEmpty(),this.xmin*=i,this.xmax*=i,this.ymin*=i,this.ymax*=i}equals(i,t){return!(!this.isEmpty()||!i.isEmpty())||(t?Math.abs(this.xmin-i.xmin)<=t&&Math.abs(this.ymin-i.ymin)<=t&&Math.abs(this.xmax-i.xmax)<=t&&Math.abs(this.ymax-i.ymax)<=t:this.xmin===i.xmin&&this.ymin===i.ymin&&this.xmax===i.xmax&&this.ymax===i.ymax)}setCoords(i){void 0!==i.xmin?(this.xmin=i.xmin,this.xmax=i.xmax,this.ymin=i.ymin,this.ymax=i.ymax):void 0!==i.x?(this.xmin=i.x,this.xmax=i.x,this.ymin=i.y,this.ymax=i.y):void 0!==i.pt1?(this.xmin=i.pt1.x,this.ymin=i.pt1.y,this.xmax=i.pt2.x,this.ymax=i.pt2.y,this.normalize()):void 0!==i.env2D?(this.xmin=i.env2D.xmin,this.xmax=i.env2D.xmax,this.ymin=i.env2D.ymin,this.ymax=i.env2D.ymax,this.normalize()):void 0!==i.pt?(this.xmin=i.pt.x,this.xmax=i.pt.x,this.ymin=i.pt.y,this.ymax=i.pt.y):void 0!==i.center?(this.xmin=i.center.x-.5*i.width,this.xmax=this.xmin+i.width,this.ymin=i.center.y-.5*i.height,this.ymax=this.ymin+i.height,this.normalize()):(0,m.b)("unrecognized input type for setCoords"),this.normalize()}queryIntervalX(i){this.isEmpty()?i.setEmpty():i.setCoords(this.xmin,this.xmax)}queryIntervalY(i){this.isEmpty()?i.setEmpty():i.setCoords(this.ymin,this.ymax)}setFromPoints(i,t){if(0===t)return void this.setEmpty();if(Array.isArray(i)){const s=i;this.setCoords(s[0]);for(let i=1;i<t;){if(!this.isEmpty()){for(let m=i;m<t;m++)this.mergeNe(s[m]);return}this.setCoords(s[i]),i++}return}const s=i;this.setCoords({x:s[0],y:s[1]});for(let i=1,m=2*t;i<m;i+=2){if(!this.isEmpty()){for(let m=i,h=2*t;m<h;m+=2)this.mergeNeCoords(s[m],s[m+1]);return}this.setCoords({x:s[i],y:s[i+1]}),i+=2}}normalize(){let i=!1;this.xmin<=this.xmax||([this.xmin,this.xmax]=[this.xmax,this.xmin],i=!0),this.ymin<=this.ymax||([this.ymin,this.ymax]=[this.ymax,this.ymin],i=!0),!i||this.xmin<=this.xmax&&this.ymin<=this.ymax||this.setEmpty()}isValid(){return this.isEmpty()||this.xmin<=this.xmax&&this.ymin<=this.ymax}getLowerLeft(){return new h.P(this.xmin,this.ymin)}getLowerRight(){return new h.P(this.xmax,this.ymin)}getUpperLeft(){return new h.P(this.xmin,this.ymax)}getUpperRight(){return new h.P(this.xmax,this.ymax)}move(i,t){this.isEmpty()||(this.xmin+=i,this.ymin+=t,this.xmax+=i,this.ymax+=t)}centerAtCoords(i,t){this.move(i-this.getCenterX(),t-this.getCenterY())}centerAt(i){this.centerAtCoords(i.x,i.y)}containsCoords(i,t){return i>=this.xmin&&i<=this.xmax&&t>=this.ymin&&t<=this.ymax}contains(i){return this.containsCoords(i.x,i.y)}containsEnvelope(i){return i.xmin>=this.xmin&&i.xmax<=this.xmax&&i.ymin>=this.ymin&&i.ymax<=this.ymax}containsExclusiveCoords(i,t){return i>this.xmin&&i<this.xmax&&t>this.ymin&&t<this.ymax}containsExclusive(i){return this.containsExclusiveCoords(i.x,i.y)}containsExclusiveEnvelope(i){return i.xmin>this.xmin&&i.xmax<this.xmax&&i.ymin>this.ymin&&i.ymax<this.ymax}isIntersecting(i){return(this.xmin<=i.xmin?this.xmax>=i.xmin:i.xmax>=this.xmin)&&(this.ymin<=i.ymin?this.ymax>=i.ymin:i.ymax>=this.ymin)}isIntersectingNe(i){return(this.xmin<=i.xmin?this.xmax>=i.xmin:i.xmax>=this.xmin)&&(this.ymin<=i.ymin?this.ymax>=i.ymin:i.ymax>=this.ymin)}intersect(i){if(this.isEmpty())return!1;if(i.isEmpty())return this.setEmpty(),!1;i.xmin>this.xmin&&(this.xmin=i.xmin),i.xmax<this.xmax&&(this.xmax=i.xmax),i.ymin>this.ymin&&(this.ymin=i.ymin),i.ymax<this.ymax&&(this.ymax=i.ymax);const t=this.xmin<=this.xmax&&this.ymin<=this.ymax;return t||this.setEmpty(),t}queryCorner(i){switch(3&i){case 0:return new h.P(this.xmin,this.ymin);case 1:return new h.P(this.xmin,this.ymax);case 2:return new h.P(this.xmax,this.ymax);default:return new h.P(this.xmax,this.ymin)}}queryCorners(i){i[0].setCoords(this.xmin,this.ymin),i[1].setCoords(this.xmin,this.ymax),i[2].setCoords(this.xmax,this.ymax),i[3].setCoords(this.xmax,this.ymin)}queryCornersReversed(i){i[0].setCoords(this.xmin,this.ymin),i[1].setCoords(this.xmax,this.ymin),i[2].setCoords(this.xmax,this.ymax),i[3].setCoords(this.xmin,this.ymax)}reaspect(i,t){if(this.isEmpty())return;const s=i/t,m=.5*this.width(),h=.5*this.height()*s;if(m<=h){const i=this.getCenterX();this.xmin=i-h,this.xmax=i+h}else{const i=m/s,t=this.getCenterY();this.ymin=t-i,this.ymax=t+i}this.normalize()}getArea(){return this.isEmpty()?0:this.width()*this.height()}getLength(){return this.isEmpty()?0:2*(this.width()+this.height())}clipCode(i){return(i.x<this.xmin?1:0)|(i.x>this.xmax?1:0)<<1|(i.y<this.ymin?1:0)<<2|(i.y>this.ymax?1:0)<<3}clipLine(i,t){let s=this.clipCode(i),m=this.clipCode(t);if(s&m)return 0;if(!(s|m))return 4;const h=(s?1:0)|(m?2:0);do{const h=t.x-i.x,n=t.y-i.y;if(Math.abs(h)>Math.abs(n)?s&x.XMASK?(s&x.XLESSXMIN?(i.y+=n*(this.xmin-i.x)/h,i.x=this.xmin):(i.y+=n*(this.xmax-i.x)/h,i.x=this.xmax),s=this.clipCode(i)):m&x.XMASK?(m&x.XLESSXMIN?(t.y+=n*(this.xmin-t.x)/h,t.x=this.xmin):(t.y+=n*(this.xmax-t.x)/h,t.x=this.xmax),m=this.clipCode(t)):s?(s&x.YLESSYMIN?(i.x+=h*(this.ymin-i.y)/n,i.y=this.ymin):(i.x+=h*(this.ymax-i.y)/n,i.y=this.ymax),s=this.clipCode(i)):(m&x.YLESSYMIN?(t.x+=h*(this.ymin-t.y)/n,t.y=this.ymin):(t.x+=h*(this.ymax-t.y)/n,t.y=this.ymax),m=this.clipCode(t)):s&x.YMASK?(s&x.YLESSYMIN?(i.x+=h*(this.ymin-i.y)/n,i.y=this.ymin):(i.x+=h*(this.ymax-i.y)/n,i.y=this.ymax),s=this.clipCode(i)):m&x.YMASK?(m&x.YLESSYMIN?(t.x+=h*(this.ymin-t.y)/n,t.y=this.ymin):(t.x+=h*(this.ymax-t.y)/n,t.y=this.ymax),m=this.clipCode(t)):s?(s&x.XLESSXMIN?(i.y+=n*(this.xmin-i.x)/h,i.x=this.xmin):(i.y+=n*(this.xmax-i.x)/h,i.x=this.xmax),s=this.clipCode(i)):(m&x.XLESSXMIN?(t.y+=n*(this.xmin-t.x)/h,t.x=this.xmin):(t.y+=n*(this.xmax-t.x)/h,t.x=this.xmax),m=this.clipCode(t)),s&m)return 0}while(s|m);return h}distanceFromEnvelope(i){return Math.sqrt(this.sqrDistanceEnvelope(i,null,null))}distance(i){return Math.sqrt(this.sqrDistance(i))}sqrDistanceEnvelope(i,t,s){if(!t&&!s){if(this.isEmpty()||i.isEmpty())return Number.NaN;let t,s=0,m=0;return t=this.xmin-i.xmax,t>s&&(s=t),t=this.ymin-i.ymax,t>m&&(m=t),t=i.xmin-this.xmax,t>s&&(s=t),t=i.ymin-this.ymax,t>m&&(m=t),s*s+m*m}if(this.isEmpty()||i.isEmpty())return t&&t.setNAN(),s&&s.setNAN(),Number.NaN;let m,h=0,x=0;const n=Math.max(this.xmin,i.xmin),e=Math.max(this.ymin,i.ymin);return t&&t.setCoords(n,e),s&&s.setCoords(n,e),m=this.xmin-i.xmax,m>h&&(h=m,t&&(t.x=this.xmin),s&&(s.x=i.xmax)),m=this.ymin-i.ymax,m>x&&(x=m,t&&(t.y=this.ymin),s&&(s.y=i.ymax)),m=i.xmin-this.xmax,m>h&&(h=m,t&&(t.x=this.xmax),s&&(s.x=i.xmin)),m=i.ymin-this.ymax,m>x&&(x=m,t&&(t.y=this.ymax),s&&(s.y=i.ymin)),h*h+x*x}sqrDistance(i,t){if(void 0===t){if(this.isEmpty()||i.isNAN())return Number.NaN;let t,s=0,m=0;return t=this.xmin-i.x,t>s&&(s=t),t=this.ymin-i.y,t>m&&(m=t),t=i.x-this.xmax,t>s&&(s=t),t=i.y-this.ymax,t>m&&(m=t),s*s+m*m}if(this.isEmpty()||i.isNAN())return t.setNAN(),Number.NaN;t.assign(i);let s,m=0,h=0;return s=this.xmin-i.x,s>m&&(m=s,t.x=this.xmin),s=this.ymin-i.y,s>h&&(h=s,t.y=this.ymin),s=i.x-this.xmax,s>m&&(m=s,t.x=this.xmax),s=i.y-this.ymax,s>h&&(h=s,t.y=this.ymax),m*m+h*h}sqrMaxMinDistanceEnvelope(i){if(this.isEmpty()||i.isEmpty())return Number.NaN;let t=Number.MAX_VALUE;{const s=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmax,i.ymin),m=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmax,i.ymax),x=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmax,i.ymin),n=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmax,i.ymax),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}{const s=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmin,i.ymax),m=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmax,i.ymax),x=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmin,i.ymax),n=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmax,i.ymax),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}{const s=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmin,i.ymin),m=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmin,i.ymax),x=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmin,i.ymin),n=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmin,i.ymax),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}{const s=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmin,i.ymin),m=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmax,i.ymin),x=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmin,i.ymin),n=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmax,i.ymin),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}return t}sqrMaxDistanceEnvelope(i){if(this.isEmpty()||i.isEmpty())return Number.NaN;let t=0;const s=(0,h.m)(h.P,4);this.queryCorners(s);const m=(0,h.m)(h.P,4);i.queryCorners(m);for(let i=0;i<4;i++)for(let x=0;x<4;x++){const n=h.P.sqrDistance(s[i],m[x]);n>t&&(t=n)}return t}sqrMaxMinDistance(i){const t=h.P.sqrDistance(i,this.getLowerLeft()),s=h.P.sqrDistance(i,this.getUpperLeft()),m=h.P.sqrDistance(i,this.getLowerRight()),x=h.P.sqrDistance(i,this.getUpperRight());let n,e=Math.max(t,s);return n=Math.max(t,m),e>n&&(e=n),n=Math.max(s,x),e>n&&(e=n),n=Math.max(m,x),e>n&&(e=n),e}sqrMinDistance(i){return this.contains(i)?0:this.sqrDistance(i)}sqrMaxDistance(i){let t=h.P.sqrDistance(i,this.getLowerLeft());return t=Math.max(h.P.sqrDistance(i,this.getUpperLeft()),t),t=Math.max(h.P.sqrDistance(i,this.getUpperRight()),t),t=Math.max(h.P.sqrDistance(i,this.getLowerRight()),t),t}snapToBoundary(i){if(i.isNAN())return!1;if(this.isEmpty())return i.setNAN(),!0;let t=!0;if(i.x<this.xmin?i.x=this.xmin:i.x>this.xmax?i.x=this.xmax:t=!1,i.y<this.ymin?i.y=this.ymin:i.y>this.ymax?i.y=this.ymax:t=!1,t)return!0;if(i.x===this.xmin||i.x===this.xmax||i.y===this.ymin||i.y===this.ymax)return!1;const s=this.xmax-i.x,m=i.x-this.xmin,h=this.ymax-i.y,x=i.y-this.ymin;return Math.max(s,m)>Math.max(h,x)?i.y=x<h?this.ymin:this.ymax:i.x=m<s?this.xmin:this.xmax,!0}snapClip(i){const t=(0,h.c)(i.x,this.xmin,this.xmax),s=(0,h.c)(i.y,this.ymin,this.ymax);return h.P.construct(t,s)}boundaryDistance(i){if(this.isEmpty()||i.isNAN())return Number.NaN;if(i.x===this.xmin)return i.y-this.ymin;const t=this.ymax-this.ymin,s=this.xmax-this.xmin;if(i.y===this.ymax)return t+i.x-this.xmin;if(i.x===this.xmax)return t+s+this.ymax-i.y;if(i.y===this.ymin)return 2*t+s+this.xmax-i.x;const m=new h.P;return m.setCoordsPoint2D(i),this.snapToBoundary(m),this.boundaryDistance(m)}envelopeSide(i){if(this.isEmpty())return-1;let t=this.boundaryDistance(i);const s=this.ymax-this.ymin,m=this.xmax-this.xmin;return t<s?0:(t-=s)<m?1:t-m<s?2:3}querySide(i,t){switch(i){case 0:t.constructFromCoords(this.xmin,this.ymin,this.xmin,this.ymax);break;case 1:t.constructFromCoords(this.xmin,this.ymax,this.xmax,this.ymax);break;case 2:t.constructFromCoords(this.xmax,this.ymax,this.xmax,this.ymin);break;case 3:t.constructFromCoords(this.xmax,this.ymin,this.xmin,this.ymin);break;default:(0,m.t)("query_side")}return t}isPointOnBoundary(i,t){return Math.abs(i.x-this.xmin)<=t||Math.abs(i.x-this.xmax)<=t||Math.abs(i.y-this.ymin)<=t||Math.abs(i.y-this.ymax)<=t}calculateToleranceFromEnvelope(){return this.isEmpty()?(0,h.g)():(Math.abs(this.xmin)+Math.abs(this.xmax)+Math.abs(this.ymin)+Math.abs(this.ymax)+1)*(0,h.g)()}toString(){return`[${this.xmin}, ${this.ymin}, ${this.xmax}, ${this.ymax}]`}}x.XLESSXMIN=1,x.YLESSYMIN=4,x.XMASK=3,x.YMASK=12}}]);
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9187],{79187:(i,t,s)=>{s.r(t),s.d(t,{Envelope2D:()=>x});var m=s(55537),h=s(83661);class x{static construct(i,t,s,m){return new x(i,t,s,m)}constructor(i,t,s,m){this.m_EnvelopeType=2,void 0===i?(this.xmin=Number.NaN,this.ymin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN):"number"==typeof i?(this.xmin=i,this.ymin=t,this.xmax=s,this.ymax=m):(this.xmin=i.xmin,this.ymin=i.ymin,this.xmax=i.xmax,this.ymax=i.ymax),this.normalize()}static constructEmpty(){return new x(Number.NaN,Number.NaN,Number.NaN,Number.NaN)}clone(){return new x(this)}assign(i){return this.xmin=i.xmin,this.xmax=i.xmax,this.ymin=i.ymin,this.ymax=i.ymax,this}width(){return this.xmax-this.xmin}height(){return this.ymax-this.ymin}maxDimension(){return Math.max(this.width(),this.height())}minDimension(){return Math.min(this.width(),this.height())}sqrDiagonal(){const i=this.width(),t=this.height();return i*i+t*t}diagonal(){return Math.sqrt(this.sqrDiagonal())}getCenterX(){return.5*(this.xmin+this.xmax)}getCenterY(){return.5*(this.ymin+this.ymax)}getCenter(){return h.P.construct(this.getCenterX(),this.getCenterY())}queryCenter(i){i.x=.5*(this.xmin+this.xmax),i.y=.5*(this.ymin+this.ymax)}setEmpty(){this.xmin=Number.NaN,this.ymin=Number.NaN,this.xmax=Number.NaN,this.ymax=Number.NaN}setInfinite(){this.xmin=Number.NEGATIVE_INFINITY,this.xmax=Number.POSITIVE_INFINITY,this.ymin=Number.NEGATIVE_INFINITY,this.ymax=Number.POSITIVE_INFINITY}isDegenerate(i){return!this.isEmpty()&&(this.width()<=i||this.height()<=i)}isZero(){return!(this.isEmpty()||this.width()&&this.height())}isEmpty(){return Number.isNaN(this.xmin)||Number.isNaN(this.ymin)||Number.isNaN(this.xmax)||Number.isNaN(this.ymax)}mergeNeCoords(i,t){this.xmin>i?this.xmin=i:this.xmax<i&&(this.xmax=i),this.ymin>t?this.ymin=t:this.ymax<t&&(this.ymax=t)}mergeNe(i){this.mergeNeCoords(i.x,i.y)}mergeCoords(i,t){this.isEmpty()?(this.xmin=i,this.ymin=t,this.xmax=i,this.ymax=t):(this.xmin>i?this.xmin=i:this.xmax<i&&(this.xmax=i),this.ymin>t?this.ymin=t:this.ymax<t&&(this.ymax=t))}merge(i){this.mergeCoords(i.x,i.y)}mergeEnvelope2D(i){i.isEmpty()||(this.mergeCoords(i.xmin,i.ymin),this.mergeNeCoords(i.xmax,i.ymax))}mergePoints(i,t){for(let s=0;s<t;){if(!this.isEmpty()){for(let m=s;m<t;m++)this.mergeNe(i[m]);break}this.setCoords(i[s]),s++}}mergePointsInterleaved(i,t,s){for(let m=2*t,h=m+2*s;m<h;m+=2)this.mergeCoords(i.read(m),i.read(m+1))}inflateCoords(i,t){this.isEmpty()||(this.xmin-=i,this.xmax+=i,this.ymin-=t,this.ymax+=t,(this.xmin>this.xmax||this.ymin>this.ymax)&&this.setEmpty())}getInflatedCoords(i,t){const s=this.clone();return s.inflateCoords(i,t),s}inflate(i){this.inflateCoords(i,i)}getInflated(i){const t=this.clone();return t.inflateCoords(i,i),t}zoom(i,t){this.isEmpty()||this.setCoords({center:this.getCenter(),width:i*this.width(),height:t*this.height()})}scale(i){i<0&&this.setEmpty(),this.xmin*=i,this.xmax*=i,this.ymin*=i,this.ymax*=i}equals(i,t){return!(!this.isEmpty()||!i.isEmpty())||(t?Math.abs(this.xmin-i.xmin)<=t&&Math.abs(this.ymin-i.ymin)<=t&&Math.abs(this.xmax-i.xmax)<=t&&Math.abs(this.ymax-i.ymax)<=t:this.xmin===i.xmin&&this.ymin===i.ymin&&this.xmax===i.xmax&&this.ymax===i.ymax)}setCoords(i){void 0!==i.xmin?(this.xmin=i.xmin,this.xmax=i.xmax,this.ymin=i.ymin,this.ymax=i.ymax):void 0!==i.x?(this.xmin=i.x,this.xmax=i.x,this.ymin=i.y,this.ymax=i.y):void 0!==i.pt1?(this.xmin=i.pt1.x,this.ymin=i.pt1.y,this.xmax=i.pt2.x,this.ymax=i.pt2.y,this.normalize()):void 0!==i.env2D?(this.xmin=i.env2D.xmin,this.xmax=i.env2D.xmax,this.ymin=i.env2D.ymin,this.ymax=i.env2D.ymax,this.normalize()):void 0!==i.pt?(this.xmin=i.pt.x,this.xmax=i.pt.x,this.ymin=i.pt.y,this.ymax=i.pt.y):void 0!==i.center?(this.xmin=i.center.x-.5*i.width,this.xmax=this.xmin+i.width,this.ymin=i.center.y-.5*i.height,this.ymax=this.ymin+i.height,this.normalize()):(0,m.t)("unrecognized input type for setCoords"),this.normalize()}queryIntervalX(i){this.isEmpty()?i.setEmpty():i.setCoords(this.xmin,this.xmax)}queryIntervalY(i){this.isEmpty()?i.setEmpty():i.setCoords(this.ymin,this.ymax)}setFromPoints(i,t){if(0===t)return void this.setEmpty();if(Array.isArray(i)){const s=i;this.setCoords(s[0]);for(let i=1;i<t;){if(!this.isEmpty()){for(let m=i;m<t;m++)this.mergeNe(s[m]);return}this.setCoords(s[i]),i++}return}const s=i;this.setCoords({x:s[0],y:s[1]});for(let i=1,m=2*t;i<m;i+=2){if(!this.isEmpty()){for(let m=i,h=2*t;m<h;m+=2)this.mergeNeCoords(s[m],s[m+1]);return}this.setCoords({x:s[i],y:s[i+1]}),i+=2}}normalize(){let i=!1;this.xmin<=this.xmax||([this.xmin,this.xmax]=[this.xmax,this.xmin],i=!0),this.ymin<=this.ymax||([this.ymin,this.ymax]=[this.ymax,this.ymin],i=!0),!i||this.xmin<=this.xmax&&this.ymin<=this.ymax||this.setEmpty()}isValid(){return this.isEmpty()||this.xmin<=this.xmax&&this.ymin<=this.ymax}getLowerLeft(){return new h.P(this.xmin,this.ymin)}getLowerRight(){return new h.P(this.xmax,this.ymin)}getUpperLeft(){return new h.P(this.xmin,this.ymax)}getUpperRight(){return new h.P(this.xmax,this.ymax)}move(i,t){this.isEmpty()||(this.xmin+=i,this.ymin+=t,this.xmax+=i,this.ymax+=t)}centerAtCoords(i,t){this.move(i-this.getCenterX(),t-this.getCenterY())}centerAt(i){this.centerAtCoords(i.x,i.y)}containsCoords(i,t){return i>=this.xmin&&i<=this.xmax&&t>=this.ymin&&t<=this.ymax}contains(i){return this.containsCoords(i.x,i.y)}containsEnvelope(i){return i.xmin>=this.xmin&&i.xmax<=this.xmax&&i.ymin>=this.ymin&&i.ymax<=this.ymax}containsExclusiveCoords(i,t){return i>this.xmin&&i<this.xmax&&t>this.ymin&&t<this.ymax}containsExclusive(i){return this.containsExclusiveCoords(i.x,i.y)}containsExclusiveEnvelope(i){return i.xmin>this.xmin&&i.xmax<this.xmax&&i.ymin>this.ymin&&i.ymax<this.ymax}isIntersecting(i){return(this.xmin<=i.xmin?this.xmax>=i.xmin:i.xmax>=this.xmin)&&(this.ymin<=i.ymin?this.ymax>=i.ymin:i.ymax>=this.ymin)}isIntersectingNe(i){return(this.xmin<=i.xmin?this.xmax>=i.xmin:i.xmax>=this.xmin)&&(this.ymin<=i.ymin?this.ymax>=i.ymin:i.ymax>=this.ymin)}intersect(i){if(this.isEmpty())return!1;if(i.isEmpty())return this.setEmpty(),!1;i.xmin>this.xmin&&(this.xmin=i.xmin),i.xmax<this.xmax&&(this.xmax=i.xmax),i.ymin>this.ymin&&(this.ymin=i.ymin),i.ymax<this.ymax&&(this.ymax=i.ymax);const t=this.xmin<=this.xmax&&this.ymin<=this.ymax;return t||this.setEmpty(),t}queryCorner(i){switch(3&i){case 0:return new h.P(this.xmin,this.ymin);case 1:return new h.P(this.xmin,this.ymax);case 2:return new h.P(this.xmax,this.ymax);default:return new h.P(this.xmax,this.ymin)}}queryCorners(i){i[0].setCoords(this.xmin,this.ymin),i[1].setCoords(this.xmin,this.ymax),i[2].setCoords(this.xmax,this.ymax),i[3].setCoords(this.xmax,this.ymin)}queryCornersReversed(i){i[0].setCoords(this.xmin,this.ymin),i[1].setCoords(this.xmax,this.ymin),i[2].setCoords(this.xmax,this.ymax),i[3].setCoords(this.xmin,this.ymax)}reaspect(i,t){if(this.isEmpty())return;const s=i/t,m=.5*this.width(),h=.5*this.height()*s;if(m<=h){const i=this.getCenterX();this.xmin=i-h,this.xmax=i+h}else{const i=m/s,t=this.getCenterY();this.ymin=t-i,this.ymax=t+i}this.normalize()}getArea(){return this.isEmpty()?0:this.width()*this.height()}getLength(){return this.isEmpty()?0:2*(this.width()+this.height())}clipCode(i){return(i.x<this.xmin?1:0)|(i.x>this.xmax?1:0)<<1|(i.y<this.ymin?1:0)<<2|(i.y>this.ymax?1:0)<<3}clipLine(i,t){let s=this.clipCode(i),m=this.clipCode(t);if(s&m)return 0;if(!(s|m))return 4;const h=(s?1:0)|(m?2:0);do{const h=t.x-i.x,n=t.y-i.y;if(Math.abs(h)>Math.abs(n)?s&x.XMASK?(s&x.XLESSXMIN?(i.y+=n*(this.xmin-i.x)/h,i.x=this.xmin):(i.y+=n*(this.xmax-i.x)/h,i.x=this.xmax),s=this.clipCode(i)):m&x.XMASK?(m&x.XLESSXMIN?(t.y+=n*(this.xmin-t.x)/h,t.x=this.xmin):(t.y+=n*(this.xmax-t.x)/h,t.x=this.xmax),m=this.clipCode(t)):s?(s&x.YLESSYMIN?(i.x+=h*(this.ymin-i.y)/n,i.y=this.ymin):(i.x+=h*(this.ymax-i.y)/n,i.y=this.ymax),s=this.clipCode(i)):(m&x.YLESSYMIN?(t.x+=h*(this.ymin-t.y)/n,t.y=this.ymin):(t.x+=h*(this.ymax-t.y)/n,t.y=this.ymax),m=this.clipCode(t)):s&x.YMASK?(s&x.YLESSYMIN?(i.x+=h*(this.ymin-i.y)/n,i.y=this.ymin):(i.x+=h*(this.ymax-i.y)/n,i.y=this.ymax),s=this.clipCode(i)):m&x.YMASK?(m&x.YLESSYMIN?(t.x+=h*(this.ymin-t.y)/n,t.y=this.ymin):(t.x+=h*(this.ymax-t.y)/n,t.y=this.ymax),m=this.clipCode(t)):s?(s&x.XLESSXMIN?(i.y+=n*(this.xmin-i.x)/h,i.x=this.xmin):(i.y+=n*(this.xmax-i.x)/h,i.x=this.xmax),s=this.clipCode(i)):(m&x.XLESSXMIN?(t.y+=n*(this.xmin-t.x)/h,t.x=this.xmin):(t.y+=n*(this.xmax-t.x)/h,t.x=this.xmax),m=this.clipCode(t)),s&m)return 0}while(s|m);return h}distanceFromEnvelope(i){return Math.sqrt(this.sqrDistanceEnvelope(i,null,null))}distance(i){return Math.sqrt(this.sqrDistance(i))}sqrDistanceEnvelope(i,t,s){if(!t&&!s){if(this.isEmpty()||i.isEmpty())return Number.NaN;let t,s=0,m=0;return t=this.xmin-i.xmax,t>s&&(s=t),t=this.ymin-i.ymax,t>m&&(m=t),t=i.xmin-this.xmax,t>s&&(s=t),t=i.ymin-this.ymax,t>m&&(m=t),s*s+m*m}if(this.isEmpty()||i.isEmpty())return t&&t.setNAN(),s&&s.setNAN(),Number.NaN;let m,h=0,x=0;const n=Math.max(this.xmin,i.xmin),e=Math.max(this.ymin,i.ymin);return t&&t.setCoords(n,e),s&&s.setCoords(n,e),m=this.xmin-i.xmax,m>h&&(h=m,t&&(t.x=this.xmin),s&&(s.x=i.xmax)),m=this.ymin-i.ymax,m>x&&(x=m,t&&(t.y=this.ymin),s&&(s.y=i.ymax)),m=i.xmin-this.xmax,m>h&&(h=m,t&&(t.x=this.xmax),s&&(s.x=i.xmin)),m=i.ymin-this.ymax,m>x&&(x=m,t&&(t.y=this.ymax),s&&(s.y=i.ymin)),h*h+x*x}sqrDistance(i,t){if(void 0===t){if(this.isEmpty()||i.isNAN())return Number.NaN;let t,s=0,m=0;return t=this.xmin-i.x,t>s&&(s=t),t=this.ymin-i.y,t>m&&(m=t),t=i.x-this.xmax,t>s&&(s=t),t=i.y-this.ymax,t>m&&(m=t),s*s+m*m}if(this.isEmpty()||i.isNAN())return t.setNAN(),Number.NaN;t.assign(i);let s,m=0,h=0;return s=this.xmin-i.x,s>m&&(m=s,t.x=this.xmin),s=this.ymin-i.y,s>h&&(h=s,t.y=this.ymin),s=i.x-this.xmax,s>m&&(m=s,t.x=this.xmax),s=i.y-this.ymax,s>h&&(h=s,t.y=this.ymax),m*m+h*h}sqrMaxMinDistanceEnvelope(i){if(this.isEmpty()||i.isEmpty())return Number.NaN;let t=Number.MAX_VALUE;{const s=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmax,i.ymin),m=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmax,i.ymax),x=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmax,i.ymin),n=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmax,i.ymax),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}{const s=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmin,i.ymax),m=h.P.sqrDistanceCoords(this.xmin,this.ymin,i.xmax,i.ymax),x=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmin,i.ymax),n=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmax,i.ymax),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}{const s=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmin,i.ymin),m=h.P.sqrDistanceCoords(this.xmax,this.ymin,i.xmin,i.ymax),x=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmin,i.ymin),n=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmin,i.ymax),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}{const s=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmin,i.ymin),m=h.P.sqrDistanceCoords(this.xmin,this.ymax,i.xmax,i.ymin),x=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmin,i.ymin),n=h.P.sqrDistanceCoords(this.xmax,this.ymax,i.xmax,i.ymin),e=Math.max(s,m),a=Math.max(x,n),r=Math.max(e,a);t=Math.min(r,t)}return t}sqrMaxDistanceEnvelope(i){if(this.isEmpty()||i.isEmpty())return Number.NaN;let t=0;const s=(0,h.m)(h.P,4);this.queryCorners(s);const m=(0,h.m)(h.P,4);i.queryCorners(m);for(let i=0;i<4;i++)for(let x=0;x<4;x++){const n=h.P.sqrDistance(s[i],m[x]);n>t&&(t=n)}return t}sqrMaxMinDistance(i){const t=h.P.sqrDistance(i,this.getLowerLeft()),s=h.P.sqrDistance(i,this.getUpperLeft()),m=h.P.sqrDistance(i,this.getLowerRight()),x=h.P.sqrDistance(i,this.getUpperRight());let n,e=Math.max(t,s);return n=Math.max(t,m),e>n&&(e=n),n=Math.max(s,x),e>n&&(e=n),n=Math.max(m,x),e>n&&(e=n),e}sqrMinDistance(i){return this.contains(i)?0:this.sqrDistance(i)}sqrMaxDistance(i){let t=h.P.sqrDistance(i,this.getLowerLeft());return t=Math.max(h.P.sqrDistance(i,this.getUpperLeft()),t),t=Math.max(h.P.sqrDistance(i,this.getUpperRight()),t),t=Math.max(h.P.sqrDistance(i,this.getLowerRight()),t),t}snapToBoundary(i){if(i.isNAN())return!1;if(this.isEmpty())return i.setNAN(),!0;let t=!0;if(i.x<this.xmin?i.x=this.xmin:i.x>this.xmax?i.x=this.xmax:t=!1,i.y<this.ymin?i.y=this.ymin:i.y>this.ymax?i.y=this.ymax:t=!1,t)return!0;if(i.x===this.xmin||i.x===this.xmax||i.y===this.ymin||i.y===this.ymax)return!1;const s=this.xmax-i.x,m=i.x-this.xmin,h=this.ymax-i.y,x=i.y-this.ymin;return Math.max(s,m)>Math.max(h,x)?i.y=x<h?this.ymin:this.ymax:i.x=m<s?this.xmin:this.xmax,!0}snapClip(i){const t=(0,h.s)(i.x,this.xmin,this.xmax),s=(0,h.s)(i.y,this.ymin,this.ymax);return h.P.construct(t,s)}boundaryDistance(i){if(this.isEmpty()||i.isNAN())return Number.NaN;if(i.x===this.xmin)return i.y-this.ymin;const t=this.ymax-this.ymin,s=this.xmax-this.xmin;if(i.y===this.ymax)return t+i.x-this.xmin;if(i.x===this.xmax)return t+s+this.ymax-i.y;if(i.y===this.ymin)return 2*t+s+this.xmax-i.x;const m=new h.P;return m.setCoordsPoint2D(i),this.snapToBoundary(m),this.boundaryDistance(m)}envelopeSide(i){if(this.isEmpty())return-1;let t=this.boundaryDistance(i);const s=this.ymax-this.ymin,m=this.xmax-this.xmin;return t<s?0:(t-=s)<m?1:t-m<s?2:3}querySide(i,t){switch(i){case 0:t.constructFromCoords(this.xmin,this.ymin,this.xmin,this.ymax);break;case 1:t.constructFromCoords(this.xmin,this.ymax,this.xmax,this.ymax);break;case 2:t.constructFromCoords(this.xmax,this.ymax,this.xmax,this.ymin);break;case 3:t.constructFromCoords(this.xmax,this.ymin,this.xmin,this.ymin);break;default:(0,m.a)("query_side")}return t}isPointOnBoundary(i,t){return Math.abs(i.x-this.xmin)<=t||Math.abs(i.x-this.xmax)<=t||Math.abs(i.y-this.ymin)<=t||Math.abs(i.y-this.ymax)<=t}calculateToleranceFromEnvelope(){return this.isEmpty()?(0,h.g)():(Math.abs(this.xmin)+Math.abs(this.xmax)+Math.abs(this.ymin)+Math.abs(this.ymax)+1)*(0,h.g)()}toString(){return`[${this.xmin}, ${this.ymin}, ${this.xmax}, ${this.ymax}]`}}x.XLESSXMIN=1,x.YLESSYMIN=4,x.XMASK=3,x.YMASK=12}}]);
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{b as e,c as t}from"./tslib.es6.js";import{G as s,t as i,j as n,b as r,k as m,e as o,l as a,m as h,f as l,c,g as u}from"./Geometry.js";import{G as f}from"./SimpleGeometryCursor.js";import{C as _,a as g,P as d,E as p,s as b}from"./Envelope.js";import{i as y,m as P,P as x,h as C,d as D,s as w}from"./Point2D.js";import{L as T,D as v,a as S,P as I,i as M,E,n as V}from"./QuadraticBezier.js";import{Envelope2D as k}from"./Envelope2D.js";import{T as B}from"./Transformation2D.js";import{c as R}from"./GeometryCleaner-BEJM7I4l.js";import{h as A,g as X,p as Y}from"./ProjectionTransformation.js";import{O as j}from"./OperatorSimplifyOGC.js";import{O as z}from"./OperatorGeneralize.js";var F;function L(e,t,s,i,n,r){return{m_from:e.clone(),m_to:t.clone(),m_center:s.clone(),m_next:n,m_type:i}}function q(e,t,s,i,n){return{m_from:e.clone(),m_to:t.clone(),m_next:s,m_type:4,m_center:new x}}!function(e){e[e.enumDummy=256]="enumDummy",e[e.enumLine=1]="enumLine",e[e.enumArc=2]="enumArc",e[e.enumMiter=8]="enumMiter",e[e.enumBevel=16]="enumBevel",e[e.enumJoinMask=26]="enumJoinMask",e[e.enumConnectionMask=27]="enumConnectionMask"}(F||(F={}));class G extends f{constructor(e,t,s,i,n,r,m,o,a,h){super(),this.m_index=0,this.m_bufferedPolygon=null,this.m_x=0,this.m_y=0,this.m_progressTracker=h,this.m_parent=e,this.m_mp=t,this.m_distance=s,this.m_spatialReference=i,this.m_densifyDist=o,this.m_maxVertexInCompleteCircle=a,this.m_joins=n,this.m_caps=r,this.m_miterLimit=m}next(){const e=new d;for(;;){if(this.m_index===this.m_mp.getPointCount())return null;if(1===this.m_caps)return this.m_index=this.m_mp.getPointCount(),new S({vd:this.m_mp.getDescription()});if(this.m_mp.getPointByVal(this.m_index,e),this.m_index++,!e.isEmpty())break}let t,s=!1;if(null===this.m_bufferedPolygon&&(this.m_x=e.getX(),this.m_y=e.getY(),this.m_bufferedPolygon=this.m_parent.buffer(e,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle),s=!0),t=this.m_index<this.m_mp.getPointCount()?this.m_bufferedPolygon.clone():this.m_bufferedPolygon,!s){const s=new B,i=e.getX()-this.m_x,n=e.getY()-this.m_y;s.setShiftCoords(i,n),t.applyTransformation(s)}return b(t,0),t}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class N extends f{constructor(e){super(),this.m_currentPathIndex=0,this.m_polyline=e}next(){if(!this.m_polyline)return null;const e=this.m_polyline.getImpl(),t=e.getPathCount();if(this.m_currentPathIndex<t){const t=this.m_currentPathIndex;if(this.m_currentPathIndex++,!e.isClosedPathInXYPlane(t)){let s=e.getXY(e.getPathEnd(t)-1);for(;this.m_currentPathIndex<e.getPathCount();){const t=e.getXY(e.getPathStart(this.m_currentPathIndex));if(e.isClosedPathInXYPlane(this.m_currentPathIndex))break;if(!t.equals(s))break;s=e.getXY(e.getPathEnd(this.m_currentPathIndex)-1),this.m_currentPathIndex++}}if(0===t&&this.m_currentPathIndex===this.m_polyline.getPathCount()){const e=this.m_polyline;return this.m_polyline=null,e}const s=new I({vd:this.m_polyline.getDescription()});s.addPath(this.m_polyline,t,!0);for(let i=t+1;i<this.m_currentPathIndex;i++)s.addSegmentsFromPath(this.m_polyline,i,0,e.getSegmentCountPath(i),!1);return this.m_currentPathIndex===this.m_polyline.getPathCount()&&(this.m_polyline=null),s}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class O extends f{constructor(e,t,s){super(),this.m_geometry=null,this.m_index=0,this.m_bufferer=e,this.m_geoms=t,this.m_index=0,this.m_bFilter=s}next(){if(null===this.m_geometry&&(this.m_index=0,this.m_geometry=this.m_geoms.next(),!this.m_geometry))return null;const e=this.m_geometry.getImpl();if(this.m_index<e.getPathCount()){const e=this.m_index;this.m_index++;return this.m_bufferer.bufferPolylinePath(this.m_geometry,e,this.m_bFilter)}return this.m_geometry=null,this.next()}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class J extends f{constructor(e){super(),this.m_index=0,this.m_bufferer=e}next(){const e=this.m_bufferer.m_geometry;if(this.m_index<e.getPathCount()){const t=this.m_index,s=e.calculateRingArea2D(this.m_index);for(u(s>0),this.m_index++;this.m_index<e.getPathCount();){if(e.calculateRingArea2D(this.m_index)>0)break;this.m_index++}let i;return i=0===t&&this.m_index===e.getPathCount()?this.m_bufferer.bufferPolygonImpl(e,0,e.getPathCount()):this.m_bufferer.bufferPolygonImpl(e,t,this.m_index),i}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class U{constructor(e){this.m_geometry=null,this.m_bufferCommands=[],this.m_originalGeomType=s.enumUnknown,this.m_maxVertexInCompleteCircle=-1,this.m_circleTemplateSize=-1,this.m_oldCircleTemplateSize=0,this.m_spatialReference=null,this.m_tolerance=new _(0,0),this.m_smallTolerance=new _(0,0),this.m_filterTolerance=0,this.m_densifyDist=-1,this.m_distance=Number.NaN,this.m_absDistance=0,this.m_absDistanceReversed=0,this.m_dA=-1,this.m_miterLimit=4,this.m_joins=0,this.m_caps=0,this.m_bRoundBuffer=!0,this.m_bOutputLoops=!0,this.m_bFilter=!0,this.m_circleTemplate=[],this.m_leftStack=[],this.m_middleStack=[],this.m_helperLine1=new T,this.m_helperLine2=new T,this.m_helperArray=[],this.m_progressCounter=0,this.m_densificator=v.constructDefault(e),this.m_progressTracker=e}buffer(e,t,s,l,c,u,f,_){if(e||i("Geometry.Bufferer.Impl.Buffer"),f<0&&i("Geometry.Bufferer.Impl.Buffer"),n(e.getGeometryType())&&r("Unsupported geometry type."),e.isEmpty())return new S({vd:e.getDescription()});if(this.m_joins=l,this.m_caps=c,this.m_bRoundBuffer=!1,this.m_miterLimit=u,this.m_originalGeomType=e.getGeometryType(),m(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_joins:o(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_caps:a(this.m_originalGeomType)&&(this.m_bRoundBuffer=0===this.m_joins&&0===this.m_caps),this.m_bFilter=this.m_bRoundBuffer,this.m_geometry=R(e),this.m_geometry.isEmpty())return new S({vd:e.getDescription()});const d=new k;this.m_geometry.queryLooseEnvelope(d),t>0&&d.inflateCoords(t,t),this.m_tolerance=g(s,d,!0),this.m_smallTolerance=g(null,d,!0),_<=0&&(_=96),this.m_spatialReference=s,this.m_distance=t,this.m_absDistance=Math.abs(this.m_distance),this.m_absDistanceReversed=0!==this.m_absDistance?1/this.m_absDistance:0,Number.isNaN(f)||0===f?f=1e-5*this.m_absDistance:f>.5*this.m_absDistance&&(f=.5*this.m_absDistance),_<12&&(_=12);const p=Math.abs(t)*(1-Math.cos(Math.PI/_));if(p>f)f=p;else if(0!==t){const e=Math.PI/Math.acos(1-f/Math.abs(t));e<_-1&&(_=Math.trunc(e))<12&&(_=12,f=Math.abs(t)*(1-Math.cos(Math.PI/_)))}this.m_densifyDist=f,this.m_maxVertexInCompleteCircle=_,this.m_filterTolerance=this.m_bRoundBuffer?Math.min(this.m_smallTolerance.total(),.25*this.m_densifyDist):0,this.m_circleTemplateSize=this.calcN(),this.m_circleTemplateSize!==this.m_oldCircleTemplateSize&&(this.m_circleTemplate.length=0,this.m_oldCircleTemplateSize=this.m_circleTemplateSize),this.m_densifyDist>0&&h(this.m_geometry)&&(this.m_geometry=this.m_densificator.densifyEx(this.m_geometry,0,this.m_densifyDist,0,0!==this.m_joins,y()));const b=this.bufferImpl();return this.m_geometry=null,b}generateCircleTemplate(){if(this.m_circleTemplate.length)return;const e=this.m_circleTemplateSize,t=Math.trunc((e+3)/4),s=.5*Math.PI/t;this.m_dA=s,this.m_circleTemplate=P(x,4*t);const i=Math.cos(s),n=Math.sin(s),r=x.construct(0,1);for(let m=0;m<t;m++)this.m_circleTemplate[m+0*t].setCoords(r.y,-r.x),this.m_circleTemplate[m+1*t].setCoords(-r.x,-r.y),this.m_circleTemplate[m+2*t].setCoords(-r.y,r.x),this.m_circleTemplate[m+3*t].setCoords(r.x,r.y),r.rotateReverse(i,n)}bufferImpl(){const e=this.m_geometry.getGeometryType();if(l(e)){const e=new I({vd:this.m_geometry.getDescription()});return e.addSegment(this.m_geometry,!0),this.m_geometry=e,this.bufferImpl()}if(this.m_distance<=this.m_tolerance.total()){if(!m(e))return new S({vd:this.m_geometry.getDescription()});if(this.m_distance<0){const e=new k;if(this.m_geometry.queryEnvelope(e),e.width()<=2*this.m_absDistance||e.height()<=2*this.m_absDistance)return new S({vd:this.m_geometry.getDescription()})}}switch(this.m_geometry.getGeometryType()){case s.enumPoint:return this.bufferPoint();case s.enumMultiPoint:return this.bufferMultiPoint();case s.enumPolyline:return this.bufferPolyline();case s.enumPolygon:return this.bufferPolygon();case s.enumEnvelope:return this.bufferEnvelope();default:c("")}}bufferPolyline(){if(this.isDegenerateGeometry(this.m_geometry)){const e=new d;this.m_geometry.getPointByVal(0,e);const t=new k;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const e=this.m_geometry,t=this.m_geometry.getDescription();this.m_geometry=null;const s=new N(e);let i,n;i=0===this.m_joins?(new z).executeMany(s,.25*this.m_densifyDist,!1,this.m_progressTracker):s,n=this.m_bRoundBuffer?(new j).executeMany(i,null,!0,this.m_progressTracker):i;const r=new O(this,n,this.m_bFilter),m=(new A).executeMany(r,this.m_spatialReference,this.m_progressTracker,2),o=(new X).executeMany(m,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==o?o:new S({vd:t})}bufferPolygon(){if(0===this.m_distance)return this.m_geometry;this.generateCircleTemplate();const e=(new X).execute(this.m_geometry,null,!1,this.m_progressTracker);if(this.m_distance<0){if(this.m_geometry=e,this.m_geometry.isEmpty())return this.m_geometry;const t=this.m_geometry,s=this.bufferPolygonImpl(t,0,t.getPathCount());return(new X).execute(s,this.m_spatialReference,!1,this.m_progressTracker)}{if(this.m_geometry=e,this.isDegenerateGeometry(this.m_geometry)){const e=new d;this.m_geometry.getPointByVal(0,e);const t=new k;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const t=new J(this),s=(new A).executeMany(t,this.m_spatialReference,this.m_progressTracker,2),i=(new X).executeMany(s,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==i?i:new S({vd:this.m_geometry.getDescription()})}}bufferPolygonImpl(e,t,s){const i=e,n=i.getImpl();let r=new S({vd:e.getDescription()});for(let m=t;m<s;m++){if(n.getPathSize(m)<1)continue;const t=n.calculateRingArea2D(m),s=new k;if(n.queryPathEnvelope(m,s),this.m_distance>0)if(t>0)if(this.isDegeneratePath(n,m)){const e=new d;n.getPointByVal(n.getPathStart(m),e),e.setXY(s.getCenter()),r.add(this.bufferDegeneratePath(e,!0),!1)}else{const t=new I({vd:e.getDescription()}),s=t.getImpl();if(M(this.m_geometry,m)){const e=this.bufferConvexPath(i,m);r.add(e,!1)}else{this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,1);const e=this.bufferCleanup(t);r.add(e,!1)}}else{if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new I({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,1),!t.isEmpty()){const e=s,n=Math.max(1,this.m_absDistance),m=e.clone();m.inflateCoords(n,n),i.addEnvelope(m,!1);const o=this.bufferCleanup(t);r.reserve(r.getPointCount()+o.getPointCount()-4),ee(o,r,m,!0)}}else if(t>0){if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new I({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,-1),!t.isEmpty()){const e=new k;i.queryLooseEnvelope(e);const s=Math.max(1,this.m_absDistance),n=e.clone();n.inflateCoords(s,s),i.addEnvelope(n,!1);ee(this.bufferCleanup(t),r,n,!0)}}else{const t=new I({vd:e.getDescription()}),s=t.getImpl();this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,-1);const i=this.bufferCleanup(t);for(let e=0,n=i.getPathCount();e<n;e++)r.addPath(i,e,!0)}}if(this.m_distance>0){if(r.getPathCount()>1){return this.bufferCleanup(r)}return Q(r)}{const e=new k;if(r.queryLooseEnvelope(e),r.isEmpty())return Q(r);{const t=Math.max(1,this.m_absDistance),s=e.clone();s.inflateCoords(t,t),r.addEnvelope(s,!1);const i=this.bufferCleanup(r);r=new S;const n=new S({vd:i.getDescription()});return ee(i,n,s,!1),Q(n)}}}bufferPoint(){return this.bufferPointImpl(this.m_geometry)}bufferPointImpl(e){const t=new S({vd:e.getDescription()});return 0===this.m_caps?(this.addCircle(t.getImpl(),e),this.setStrongSimple(t)):2===this.m_caps?(this.addSquare(t.getImpl(),e),this.setStrongSimple(t)):t}bufferDegeneratePath(e,t){const s=new S({vd:e.getDescription()});return t&&0===this.m_joins||!t&&0===this.m_caps?(this.addCircle(s.getImpl(),e),this.setStrongSimple(s)):t||2!==this.m_caps?s:(this.addSquare(s.getImpl(),e),this.setStrongSimple(s))}bufferMultiPoint(){const e=new G(this,this.m_geometry,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle,this.m_progressTracker);return(new A).executeMany(e,this.m_spatialReference,this.m_progressTracker,2).next()}bufferEnvelope(){let e=new S({vd:this.m_geometry.getDescription()});if(this.m_distance<=0){if(0===this.m_distance)e.addEnvelope(this.m_geometry,!1),H(this.m_geometry,this.m_tolerance.total())&&(e=this.setStrongSimple(e));else{const t=new p;this.m_geometry.queryEnvelope(t),t.inflateCoords(this.m_distance,this.m_distance),e.addEnvelope(t,!1),H(t,this.m_tolerance.total())&&(e=this.setStrongSimple(e))}return e}if(1===this.m_joins){const t=new p({copy:this.m_geometry});return t.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(t,!1),e}const t=this.m_geometry.clone();if(0===t.width()||0===t.height()){if(0===t.width()&&0===t.height()){const e=new d({vd:this.m_geometry.getDescription()});return t.queryCornerByVal(0,e),this.m_geometry=e,this.bufferImpl()}const e=new I({vd:this.m_geometry.getDescription()}),s=new d;return t.queryCornerByVal(0,s),e.startPathPoint(s),t.queryCornerByVal(2,s),e.lineToPoint(s),this.m_geometry=e,this.bufferImpl()}return e.addEnvelope(this.m_geometry,!1),this.m_geometry=e,this.bufferConvexPath(e,0)}bufferConvexPath(e,t){this.generateCircleTemplate();const s=e.hasAttribute(10),i=new S({vd:e.getDescription()}),n=i.getImpl();i.reserve((this.m_circleTemplate.length/10+4)*e.getPathSize(t));const r=new x,m=new x,o=new x,a=new x(0,0),h=new x,l=new x,u=e.getImpl(),f=e.getPathSize(t),_=e.getPathStart(t);for(let g=0,d=e.getPathSize(t);g<d;g++){const e=u.getXY(_+g),t=u.getXY(_+(g+1)%f),i=u.getXY(_+(g+2)%f);h.setSub(t,e),0===h.length()&&c("");const d=s&&!!(1&u.getAttributeAsInt(10,(g+1)%f,0));h.normalize();const p=h.clone();h.leftPerpendicularThis(),h.scale(this.m_absDistance),r.setAdd(h,e),m.setAdd(h,t),0===g?n.startPath(r):n.lineTo(r),n.lineTo(m),l.setSub(i,t),0===l.length()&&c(""),l.normalize();const b=l.clone();l.leftPerpendicularThis(),l.scale(this.m_absDistance),o.setAdd(l,t);let y=F.enumArc;const P=d?0:this.m_joins;if(2===P)y=F.enumBevel;else if(1===P){const e=-p.crossProduct(b);a.setSub(p,b),a.scale(this.m_absDistance/e),a.length()<this.m_miterLimit*this.m_absDistance?(a.addThis(t),y=F.enumMiter):y=F.enumBevel}else a.assign(t);this.addJoin(y,n,a,m,o,!1,!1)}return Q(i)}bufferPolylinePath(e,t,s){this.generateCircleTemplate();const i=e,n=i.getImpl();if(n.getPathSize(t)<1)return null;let r;if(r=this.m_bRoundBuffer?n.isClosedPathInXYPlane(t):n.isClosedPath(t),this.isDegeneratePath(n,t)&&this.m_distance>0){const e=new d;n.getPointByVal(n.getPathStart(t),e);const s=new k;return n.queryPathEnvelope(t,s),e.setXY(s.getCenter()),this.bufferDegeneratePath(e,r)}const m=new I({vd:e.getDescription()});m.reserve((Math.trunc(this.m_circleTemplate.length/10)+4)*n.getPathSize(t));const o=m.getImpl();return r?2!==this.bufferClosedPath(i,t,o,s,1)&&this.bufferClosedPath(i,t,o,s,-1):this.bufferOpenPath(i,t,o,s),this.bufferCleanup(m)}progress_(){}bufferCleanup(e,t=!1){const s=t?this.m_tolerance:this.m_smallTolerance;return Y(e,s,!0,!t,-1,this.m_progressTracker,0,!1)}calcN(){const e=4;if(0===this.m_densifyDist)return this.m_maxVertexInCompleteCircle;const t=1-this.m_densifyDist*Math.abs(this.m_absDistanceReversed);let s=e;return s=t<-1?e:2*Math.PI/Math.acos(t)+.5,s<e?s=e:s>this.m_maxVertexInCompleteCircle&&(s=this.m_maxVertexInCompleteCircle),Math.trunc(s)}addJoin(e,t,s,i,n,r,m){if(this.generateCircleTemplate(),r&&(t.startPath(i),r=!1),e===F.enumBevel)return void(m&&t.lineTo(n));if(e===F.enumMiter){const e=s.clone();return t.lineTo(e),void(m&&t.lineTo(n))}const o=new x;o.setSub(i,s),o.scale(this.m_absDistanceReversed);const a=new x;a.setSub(n,s),a.scale(this.m_absDistanceReversed);let h=Math.atan2(o.y,o.x)/this.m_dA;h<0&&(h=this.m_circleTemplate.length+h),h=this.m_circleTemplate.length-h;let l=Math.atan2(a.y,a.x)/this.m_dA;l<0&&(l=this.m_circleTemplate.length+l),l=this.m_circleTemplate.length-l,l<h&&(l+=this.m_circleTemplate.length);let c=Math.trunc(l),u=Math.ceil(h),f=this.m_circleTemplate[u%this.m_circleTemplate.length].clone();f.scaleAddThis(this.m_absDistance,s);const _=10*this.m_tolerance.total();f.sub(i).length()<_&&(u+=1),f=this.m_circleTemplate[c%this.m_circleTemplate.length].clone(),f.scaleAddThis(this.m_absDistance,s),f.sub(n).length()<_&&(c-=1);let g=c-u;g++;for(let d=0,p=u%this.m_circleTemplate.length;d<g;d++,p=(p+1)%this.m_circleTemplate.length)f=this.m_circleTemplate[p].clone(),f.scaleAddThis(this.m_absDistance,s),t.lineTo(f),this.progress_();m&&t.lineTo(n)}bufferClosedPath(e,t,s,i,n){const r=new E,m=r.addPathFromMultiPath(e,t,!0);return this.bufferClosedPathImpl(r,m,s,i,n)}bufferClosedPathImpl(e,t,s,i,n){const r=e.getFirstVertex(e.getFirstPath(t)),m=new d;e.queryPoint(r,m),e.filterClosePoints(this.m_filterTolerance,!1,!1,!1,-1);if(e.getPointCount(t)<2)return n<0?0:(this.m_bRoundBuffer&&this.addCircle(s,m),2);u(e.getFirstPath(t)!==V),u(e.getFirstVertex(e.getFirstPath(t))!==V);const o=e.getXY(e.getFirstVertex(e.getFirstPath(t))),a=new B;if(a.setShift(o.negate()),e.applyTransformation(a),i){const i=$(e,t,n,!0,this.m_absDistance,this.m_filterTolerance,this.m_densifyDist);if(u(1===i),e.getPointCount(t)<2)return n<0?0:(this.addCircle(s,m),2)}const h=0!==this.m_joins&&e.getVertexDescription().hasAttribute(10);this.m_bufferCommands.length=0;const l=e.getFirstPath(t);let c=e.getFirstVertex(l),f=1===n?e.getPrevVertex(c):e.getNextVertex(c),_=1===n?e.getNextVertex(c):e.getPrevVertex(c),g=!0;const p=new x,b=new x,y=new x,P=new x,C=new x,D=new x,w=new x,T=new x,v=this.m_absDistance,S=e.getPathSize(l),I=new x(0,0);for(let u=0;u<S;u++){b.assign(e.getXY(_)),g&&(p.assign(e.getXY(c)),y.assign(e.getXY(f)),D.setSub(p,y),D.normalize(),T.leftPerpendicularOther(D),T.scale(v),P.setAdd(T,p));const t=h&&!!(1&e.getAttributeAsDbl(10,c,0));C.setSub(b,p),C.normalize(),w.leftPerpendicularOther(C),w.scale(v);const s=new x;s.setAdd(p,w);const i=D.crossProduct(C),r=D.dotProduct(C);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8){let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;I.setSub(D,C),I.scale(this.m_absDistance/t),I.length()<this.m_miterLimit*this.m_absDistance&&(I.addThis(p),e=!0),this.m_bufferCommands.push(L(P,s,I,e?F.enumMiter:F.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(L(P,s,p,0===n?F.enumArc:F.enumBevel,this.m_bufferCommands.length+1))}else P.equals(s)||(this.m_bufferCommands.push(q(P,p,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(q(p,s,this.m_bufferCommands.length+1)));const m=new x;m.setAdd(b,w),this.m_bufferCommands.push(L(s,m,p,F.enumLine,this.m_bufferCommands.length+1)),P.setCoordsPoint2D(m),T.setCoordsPoint2D(w),y.setCoordsPoint2D(p),p.setCoordsPoint2D(b),D.setCoordsPoint2D(C),f=c,c=_,g=!1,_=1===n?e.getNextVertex(c):e.getPrevVertex(c)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),a.setShift(o),s.applyTransformationToPath(a,s.getPathCount()-1),1}bufferOpenPath(e,t,s,i){if(this.m_bRoundBuffer){const n=new I({vd:e.getDescription()});return n.addPath(e,t,!1),n.addSegmentsFromPath(e,t,0,e.getSegmentCountPath(t),!1),this.bufferClosedPath(n,0,s,i,1)}let n=0;const r=new I({vd:e.getDescription()}),m=new x(0,0);{const i=new E,o=i.addPathFromMultiPath(e,t,!1),a=i.getFirstVertex(i.getFirstPath(o)),h=new d;i.queryPoint(a,h),m.assign(h.getXY()),i.filterClosePoints(0,!1,!1,!1,-1);if(i.getPointCount(o)<2)return this.m_bRoundBuffer&&this.addCircle(s,h),2;const l=i.getGeometry(i.getFirstGeometry());r.addPath(l,0,!1),n=r.getPointCount()-1,r.addSegmentsFromPath(l,0,0,l.getSegmentCountPath(0)-1,!1)}const o=new E,a=o.addPathFromMultiPath(r,0,!0);u(o.getFirstPath(a)!==V),u(o.getFirstVertex(o.getFirstPath(a))!==V);const h=new B;h.setShift(m.negate()),o.applyTransformation(h),this.m_bufferCommands.length=0;const l=o.getFirstPath(a),c=0!==this.m_joins&&o.getVertexDescription().hasAttribute(10);let f=o.getFirstVertex(l),_=o.getPrevVertex(f),g=o.getNextVertex(f),p=!0;const b=new x,y=new x,P=new x,C=new x,D=new x,w=new x,T=new x,v=new x,S=this.m_absDistance,M=o.getPathSize(l),k=new x(0,0);for(let u=0;u<M;u++){let e=!1;0!==u&&u!==n||(e=!0),y.assign(o.getXY(g)),p&&(b.assign(o.getXY(f)),P.assign(o.getXY(_)),w.setSub(b,P),w.normalize(),v.leftPerpendicularOther(w),v.scale(S),C.setAdd(v,b));const t=c&&!!(1&o.getAttributeAsDbl(10,f,0));D.setSub(y,b),D.normalize(),T.leftPerpendicularOther(D),T.scale(S);const s=new x;s.setAdd(b,T);const i=w.crossProduct(D),r=w.dotProduct(D);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8)if(e)if(0===this.m_caps)this.m_bufferCommands.push(L(C,s,b,F.enumArc,this.m_bufferCommands.length+1));else if(1===this.m_caps)this.m_bufferCommands.push(L(C,s,b,F.enumLine,this.m_bufferCommands.length+1));else{const e=D.mul(this.m_absDistance).negate(),t=e.clone();e.addThis(C),t.addThis(s),this.m_bufferCommands.push(L(C,e,b,F.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(L(e,t,b,F.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(L(t,s,b,F.enumLine,this.m_bufferCommands.length+1))}else{let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;k.setSub(w,D),k.scale(this.m_absDistance/t),k.length()<this.m_miterLimit*this.m_absDistance&&(k.addThis(b),e=!0),this.m_bufferCommands.push(L(C,s,k,e?F.enumMiter:F.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(L(C,s,b,0===n?F.enumArc:F.enumBevel,this.m_bufferCommands.length+1))}else C.equals(s)||(this.m_bufferCommands.push(q(C,b,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(q(b,s,this.m_bufferCommands.length+1)));const m=new x;m.setAdd(y,T),this.m_bufferCommands.push(L(s,m,b,F.enumLine,this.m_bufferCommands.length+1)),C.setCoordsPoint2D(m),v.setCoordsPoint2D(T),P.setCoordsPoint2D(b),b.setCoordsPoint2D(y),w.setCoordsPoint2D(D),_=f,f=g,p=!1,g=o.getNextVertex(f)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),h.setShift(m),s.applyTransformationToPath(h,s.getPathCount()-1),1}processBufferCommands(e){const t=this.cleanupBufferCommands();let s=!0,i=t+1;for(let n=t;i!==t;n=i){const t=this.m_bufferCommands[n];i=-1!==t.m_next?t.m_next:(n+1)%this.m_bufferCommands.length,t.m_type&&(s&&(e.startPath(t.m_from),s=!1),t.m_type&F.enumJoinMask?this.addJoin(t.m_type,e,t.m_center,t.m_from,t.m_to,!1,!0):e.lineTo(t.m_to))}}cleanupBufferCommands(){this.m_helperArray=P(x,9);let e=0;for(let s=0,i=this.m_bufferCommands.length;s<i;){const t=this.m_bufferCommands[s];if(t.m_type&F.enumConnectionMask){e=s;break}s=t.m_next}let t=e+1;for(let s=e;t!==e;s=t){const e=this.m_bufferCommands[s];t=e.m_next;let i=1,n=null;for(;t!==s&&(n=this.m_bufferCommands[t],!(n.m_type&F.enumConnectionMask));)t=n.m_next,i++;if(1!==i&&(e.m_type&n.m_type)===F.enumLine){this.m_helperLine1.setStartXY(e.m_from),this.m_helperLine1.setEndXY(e.m_to),this.m_helperLine2.setStartXY(n.m_from),this.m_helperLine2.setEndXY(n.m_to);1===this.m_helperLine1.intersect(this.m_helperLine2,this.m_helperArray,null,null,this.m_smallTolerance.total())&&(e.m_to.assign(this.m_helperArray[0]),n.m_from.assign(this.m_helperArray[0]),e.m_next=t)}}return e}isDegeneratePath(e,t){if(1===e.getPathSize(t))return!0;if(0===this.m_joins&&0===this.m_caps){const s=new k;if(e.queryPathEnvelope(t,s),Math.max(s.width(),s.height())<.5*this.m_densifyDist)return!0}return!1}isDegenerateGeometry(e){if(0===this.m_joins&&0===this.m_caps){const t=new k;if(e.queryEnvelope(t),Math.max(t.width(),t.height())<.5*this.m_densifyDist)return!0}return!1}addCircle(e,t){const s=t.getXY();if(0!==this.m_circleTemplate.length){let t=this.m_circleTemplate[0].clone();t.scaleAddThis(this.m_absDistance,s),e.startPath(t);for(let i=1,n=this.m_circleTemplate.length;i<n;i++)t=this.m_circleTemplate[i].clone(),t.scaleAddThis(this.m_absDistance,s),e.lineTo(t);return}const i=this.m_circleTemplateSize,n=Math.trunc((i+3)/4),r=.5*Math.PI/n;e.reserve(4*n);const m=Math.cos(r),o=Math.sin(r);for(let a=3;a>=0;a--){const t=x.construct(0,this.m_absDistance);switch(a){case 0:for(let i=0;i<n;i++)e.lineToCoords(t.x+s.x,t.y+s.y),t.rotateReverse(m,o);break;case 1:for(let i=0;i<n;i++)e.lineToCoords(-t.y+s.x,t.x+s.y),t.rotateReverse(m,o);break;case 2:for(let i=0;i<n;i++)e.lineToCoords(-t.x+s.x,-t.y+s.y),t.rotateReverse(m,o);break;default:e.startPathCoords(t.y+s.x,-t.x+s.y);for(let i=1;i<n;i++)t.rotateReverse(m,o),e.lineToCoords(t.y+s.x,-t.x+s.y)}this.progress_()}}addSquare(e,t){const s=new p({vd:t.getDescription()});s.setCoords(t.getX(),t.getY(),t.getX(),t.getY()),s.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(s,!1)}setStrongSimple(e){return e.getImpl().setIsSimple(4,this.m_tolerance.total()),e.getImpl().updateOGCFlagsProtected(),e}}function Q(e){return b(e,0),e}function H(e,t){return!!e.isEmpty()||Math.min(e.width(),e.height())>t}function K(e,t,s,i,n,r,m,o){const a=e.getXY(s),h=e.getXY(i);if(a.equals(h))return-1;const l=.25*m,c=.25*m,f=new x;f.setSub(h,a);const _=f.length(),g=_*_*.25,d=r*r-g;if(d<=g)return-1;const p=Math.sqrt(d);f.normalize();const b=f.clone();b.rightPerpendicularThis();const y=g/p,P=y<=c,C=x.lerp(h,a,.5),T=b.clone(),v=y-l;T.scaleAddThis(Math.max(0,v),C);b.negate().scaleAddThis(p,C);const S=3.61*w(r-c),I=T.sub(a),M=T.sub(h);let E=!1,V=0;const k=D(64,0);u(o===k.length);{for(let o=e.getPrevVertexEx(i,n);o!==s;){if(1===e.getUserIndex(o,t))return-1;if(!e.getXY(o).equals(h))break;{const t=e.getPrevVertexEx(o,n);e.removeVertex(o,!1),o=t}}const r=new x,m=a.clone();k[V++]=1;for(let o=e.getNextVertexEx(s,n);o!==i;){if(1===e.getUserIndex(o,t))return-1;const s=e.getXY(o);if(s.equals(m)){const t=e.getNextVertexEx(o,n);e.removeVertex(o,!1),o=t;continue}k[V++]=0;const i=new x;if(i.setSub(s,a),i.dotProduct(b)<0)return 0;(x.sqrDistance(s,a)>S||x.sqrDistance(s,h)>S)&&(E=!0);let l=0;s.sub(a).crossProduct(I)>=0&&(l=1);if(s.sub(h).crossProduct(M)<=0&&(l|=2),0===l)return 0;k[V-1]=l,r.assign(m),m.assign(s),o=e.getNextVertexEx(o,n)}if(1===V)return 0;u(V<k.length),k[V++]=2}let B=!0;for(let u=1,x=0;u<V;u++)if(k[u]!==k[u-1]&&(x++,B=x<3&&(1===x&&3===k[u]||2===x&&2===k[u]),!B))return 0;if(V>2&&B&&(3===V||!E)){let t=0,r=e.getNextVertexEx(s,n);for(P||(e.setXY(r,T),r=e.getNextVertexEx(r,n));r!==i;){const s=e.getNextVertexEx(r,n);e.removeVertex(r,!1),r=s,++t}return t}if(u(3!==V),E&&V>3)return 0;const R=a.clone();let A=s;const X=a.clone();let Y=1,j=-1,z=A,F=0;for(V=1;z!==i;){z=e.getNextVertexEx(z,n);const t=k[V++];if(0===t){if(z===i)break;continue}const s=e.getXY(z);if(-1!==j){if(3&(j&Y&t)){e.removeVertex(A,!0),F++,A=z,X.setCoordsPoint2D(s),Y=t;continue}if(3===Y&&0!==j&&0!==t){if(X.setCoordsPoint2D(T),P||X.equals(R)){e.removeVertex(A,!0),F++,A=z,X.setCoordsPoint2D(s),Y=t;continue}e.setXY(A,X)}}j=Y,R.setCoordsPoint2D(X),A=z,Y=t,X.setCoordsPoint2D(s)}return F}function W(e,t,s,i){let n=-1;const r=new x,m=new x,o=new x;for(let a=0,h=e.getPathSize(i),l=e.getFirstVertex(i);a<h;++a){-1===n&&(e.queryXY(l,m),n=e.getPrevVertex(l),-1!==n&&(e.queryXY(n,r),o.setSub(m,r),o.normalize()));const s=e.getNextVertex(l);if(-1===s)break;const i=e.getXY(s),a=i.sub(m);if(a.normalize(),-1!==n){a.dotProduct(o)<-.99&&Math.abs(a.crossProduct(o))<1e-7&&e.setUserIndex(l,t,1)}n=l,l=s,r.assign(m),m.assign(i),o.assign(a)}}function Z(s,i,n,r,m,o,a){const h={stack:[],error:void 0,hasError:!1};try{const t=s.getFirstPath(i),r=s.createUserIndex();e(h,C((()=>{s.removeUserIndex(r)}),!1),!1),W(s,r,i,t);for(let e=0;e<100;++e){if(0===s.getPathSize(t))return 1;let e=s.getFirstVertex(t),i=s.getPathSize(t);if(i<3)return 1;s.isClosedPath(t)||(i-=1);const o=64;let h=0,l=!1;for(let t=0;t<i&&e!==V;t++){let c=0,u=e;for(let h=1,l=Math.min(o,i-t);h<l;h++)if(u=s.getNextVertexEx(u,n),h>1){const t=K(s,r,e,u,n,m,a,o);if(-1===t)break;c+=t,i-=t}if(h+=c,l=c>0,l){const t=s.getPrevVertexEx(e,n);if(-1!==t){e=t,i++;continue}}e=s.getNextVertexEx(e,n)}if(0===h)break}return s.filterClosePoints(o,!1,!1,!1,-1),1}catch(l){h.error=l,h.hasError=!0}finally{t(h)}}function $(e,t,s,i,n,r,m){return Z(e,t,s,i,n,r,m)}function ee(e,t,s,i){for(let n=0,r=e.getPathCount();n<r;n++){const r=e.getXY(e.getPathStart(n));r.x!==s.xmin&&r.x!==s.xmax&&t.addPath(e,n,i)}}export{U as B};
|
|
5
|
+
import{b as e,c as t}from"./tslib.es6.js";import{G as s,a as i,j as n,t as r,k as m,e as o,l as a,m as h,f as l,c,g as u}from"./Geometry.js";import{G as f}from"./SimpleGeometryCursor.js";import{C as _,c as g,P as d,E as p,s as b}from"./Envelope.js";import{i as y,m as P,P as x,h as C,d as D,a as w}from"./Point2D.js";import{L as T,D as v,a as S,P as I,i as M,E,n as V}from"./QuadraticBezier.js";import{Envelope2D as k}from"./Envelope2D.js";import{T as B}from"./Transformation2D.js";import{c as R}from"./GeometryCleaner-BEJM7I4l.js";import{j as A,O as X,p as Y}from"./ProjectionTransformation.js";import{O as j}from"./OperatorSimplifyOGC.js";import{O as z}from"./OperatorGeneralize.js";var F;function L(e,t,s,i,n,r){return{m_from:e.clone(),m_to:t.clone(),m_center:s.clone(),m_next:n,m_type:i}}function q(e,t,s,i,n){return{m_from:e.clone(),m_to:t.clone(),m_next:s,m_type:4,m_center:new x}}!function(e){e[e.enumDummy=256]="enumDummy",e[e.enumLine=1]="enumLine",e[e.enumArc=2]="enumArc",e[e.enumMiter=8]="enumMiter",e[e.enumBevel=16]="enumBevel",e[e.enumJoinMask=26]="enumJoinMask",e[e.enumConnectionMask=27]="enumConnectionMask"}(F||(F={}));class G extends f{constructor(e,t,s,i,n,r,m,o,a,h){super(),this.m_index=0,this.m_bufferedPolygon=null,this.m_x=0,this.m_y=0,this.m_progressTracker=h,this.m_parent=e,this.m_mp=t,this.m_distance=s,this.m_spatialReference=i,this.m_densifyDist=o,this.m_maxVertexInCompleteCircle=a,this.m_joins=n,this.m_caps=r,this.m_miterLimit=m}next(){const e=new d;for(;;){if(this.m_index===this.m_mp.getPointCount())return null;if(1===this.m_caps)return this.m_index=this.m_mp.getPointCount(),new S({vd:this.m_mp.getDescription()});if(this.m_mp.getPointByVal(this.m_index,e),this.m_index++,!e.isEmpty())break}let t,s=!1;if(null===this.m_bufferedPolygon&&(this.m_x=e.getX(),this.m_y=e.getY(),this.m_bufferedPolygon=this.m_parent.buffer(e,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle),s=!0),t=this.m_index<this.m_mp.getPointCount()?this.m_bufferedPolygon.clone():this.m_bufferedPolygon,!s){const s=new B,i=e.getX()-this.m_x,n=e.getY()-this.m_y;s.setShiftCoords(i,n),t.applyTransformation(s)}return b(t,0),t}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class N extends f{constructor(e){super(),this.m_currentPathIndex=0,this.m_polyline=e}next(){if(!this.m_polyline)return null;const e=this.m_polyline.getImpl(),t=e.getPathCount();if(this.m_currentPathIndex<t){const t=this.m_currentPathIndex;if(this.m_currentPathIndex++,!e.isClosedPathInXYPlane(t)){let s=e.getXY(e.getPathEnd(t)-1);for(;this.m_currentPathIndex<e.getPathCount();){const t=e.getXY(e.getPathStart(this.m_currentPathIndex));if(e.isClosedPathInXYPlane(this.m_currentPathIndex))break;if(!t.equals(s))break;s=e.getXY(e.getPathEnd(this.m_currentPathIndex)-1),this.m_currentPathIndex++}}if(0===t&&this.m_currentPathIndex===this.m_polyline.getPathCount()){const e=this.m_polyline;return this.m_polyline=null,e}const s=new I({vd:this.m_polyline.getDescription()});s.addPath(this.m_polyline,t,!0);for(let i=t+1;i<this.m_currentPathIndex;i++)s.addSegmentsFromPath(this.m_polyline,i,0,e.getSegmentCountPath(i),!1);return this.m_currentPathIndex===this.m_polyline.getPathCount()&&(this.m_polyline=null),s}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class O extends f{constructor(e,t,s){super(),this.m_geometry=null,this.m_index=0,this.m_bufferer=e,this.m_geoms=t,this.m_index=0,this.m_bFilter=s}next(){if(null===this.m_geometry&&(this.m_index=0,this.m_geometry=this.m_geoms.next(),!this.m_geometry))return null;const e=this.m_geometry.getImpl();if(this.m_index<e.getPathCount()){const e=this.m_index;this.m_index++;return this.m_bufferer.bufferPolylinePath(this.m_geometry,e,this.m_bFilter)}return this.m_geometry=null,this.next()}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class J extends f{constructor(e){super(),this.m_index=0,this.m_bufferer=e}next(){const e=this.m_bufferer.m_geometry;if(this.m_index<e.getPathCount()){const t=this.m_index,s=e.calculateRingArea2D(this.m_index);for(u(s>0),this.m_index++;this.m_index<e.getPathCount();){if(e.calculateRingArea2D(this.m_index)>0)break;this.m_index++}let i;return i=0===t&&this.m_index===e.getPathCount()?this.m_bufferer.bufferPolygonImpl(e,0,e.getPathCount()):this.m_bufferer.bufferPolygonImpl(e,t,this.m_index),i}return null}getGeometryID(){return 0}getRank(){return 1}tock(){return!0}}class U{constructor(e){this.m_geometry=null,this.m_bufferCommands=[],this.m_originalGeomType=s.enumUnknown,this.m_maxVertexInCompleteCircle=-1,this.m_circleTemplateSize=-1,this.m_oldCircleTemplateSize=0,this.m_spatialReference=null,this.m_tolerance=new _(0,0),this.m_smallTolerance=new _(0,0),this.m_filterTolerance=0,this.m_densifyDist=-1,this.m_distance=Number.NaN,this.m_absDistance=0,this.m_absDistanceReversed=0,this.m_dA=-1,this.m_miterLimit=4,this.m_joins=0,this.m_caps=0,this.m_bRoundBuffer=!0,this.m_bOutputLoops=!0,this.m_bFilter=!0,this.m_circleTemplate=[],this.m_leftStack=[],this.m_middleStack=[],this.m_helperLine1=new T,this.m_helperLine2=new T,this.m_helperArray=[],this.m_progressCounter=0,this.m_densificator=v.constructDefault(e),this.m_progressTracker=e}buffer(e,t,s,l,c,u,f,_){if(e||i("Geometry.Bufferer.Impl.Buffer"),f<0&&i("Geometry.Bufferer.Impl.Buffer"),n(e.getGeometryType())&&r("Unsupported geometry type."),e.isEmpty())return new S({vd:e.getDescription()});if(this.m_joins=l,this.m_caps=c,this.m_bRoundBuffer=!1,this.m_miterLimit=u,this.m_originalGeomType=e.getGeometryType(),m(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_joins:o(this.m_originalGeomType)?this.m_bRoundBuffer=0===this.m_caps:a(this.m_originalGeomType)&&(this.m_bRoundBuffer=0===this.m_joins&&0===this.m_caps),this.m_bFilter=this.m_bRoundBuffer,this.m_geometry=R(e),this.m_geometry.isEmpty())return new S({vd:e.getDescription()});const d=new k;this.m_geometry.queryLooseEnvelope(d),t>0&&d.inflateCoords(t,t),this.m_tolerance=g(s,d,!0),this.m_smallTolerance=g(null,d,!0),_<=0&&(_=96),this.m_spatialReference=s,this.m_distance=t,this.m_absDistance=Math.abs(this.m_distance),this.m_absDistanceReversed=0!==this.m_absDistance?1/this.m_absDistance:0,Number.isNaN(f)||0===f?f=1e-5*this.m_absDistance:f>.5*this.m_absDistance&&(f=.5*this.m_absDistance),_<12&&(_=12);const p=Math.abs(t)*(1-Math.cos(Math.PI/_));if(p>f)f=p;else if(0!==t){const e=Math.PI/Math.acos(1-f/Math.abs(t));e<_-1&&(_=Math.trunc(e))<12&&(_=12,f=Math.abs(t)*(1-Math.cos(Math.PI/_)))}this.m_densifyDist=f,this.m_maxVertexInCompleteCircle=_,this.m_filterTolerance=this.m_bRoundBuffer?Math.min(this.m_smallTolerance.total(),.25*this.m_densifyDist):0,this.m_circleTemplateSize=this.calcN(),this.m_circleTemplateSize!==this.m_oldCircleTemplateSize&&(this.m_circleTemplate.length=0,this.m_oldCircleTemplateSize=this.m_circleTemplateSize),this.m_densifyDist>0&&h(this.m_geometry)&&(this.m_geometry=this.m_densificator.densifyEx(this.m_geometry,0,this.m_densifyDist,0,0!==this.m_joins,y()));const b=this.bufferImpl();return this.m_geometry=null,b}generateCircleTemplate(){if(this.m_circleTemplate.length)return;const e=this.m_circleTemplateSize,t=Math.trunc((e+3)/4),s=.5*Math.PI/t;this.m_dA=s,this.m_circleTemplate=P(x,4*t);const i=Math.cos(s),n=Math.sin(s),r=x.construct(0,1);for(let m=0;m<t;m++)this.m_circleTemplate[m+0*t].setCoords(r.y,-r.x),this.m_circleTemplate[m+1*t].setCoords(-r.x,-r.y),this.m_circleTemplate[m+2*t].setCoords(-r.y,r.x),this.m_circleTemplate[m+3*t].setCoords(r.x,r.y),r.rotateReverse(i,n)}bufferImpl(){const e=this.m_geometry.getGeometryType();if(l(e)){const e=new I({vd:this.m_geometry.getDescription()});return e.addSegment(this.m_geometry,!0),this.m_geometry=e,this.bufferImpl()}if(this.m_distance<=this.m_tolerance.total()){if(!m(e))return new S({vd:this.m_geometry.getDescription()});if(this.m_distance<0){const e=new k;if(this.m_geometry.queryEnvelope(e),e.width()<=2*this.m_absDistance||e.height()<=2*this.m_absDistance)return new S({vd:this.m_geometry.getDescription()})}}switch(this.m_geometry.getGeometryType()){case s.enumPoint:return this.bufferPoint();case s.enumMultiPoint:return this.bufferMultiPoint();case s.enumPolyline:return this.bufferPolyline();case s.enumPolygon:return this.bufferPolygon();case s.enumEnvelope:return this.bufferEnvelope();default:c("")}}bufferPolyline(){if(this.isDegenerateGeometry(this.m_geometry)){const e=new d;this.m_geometry.getPointByVal(0,e);const t=new k;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const e=this.m_geometry,t=this.m_geometry.getDescription();this.m_geometry=null;const s=new N(e);let i,n;i=0===this.m_joins?(new z).executeMany(s,.25*this.m_densifyDist,!1,this.m_progressTracker):s,n=this.m_bRoundBuffer?(new j).executeMany(i,null,!0,this.m_progressTracker):i;const r=new O(this,n,this.m_bFilter),m=(new A).executeMany(r,this.m_spatialReference,this.m_progressTracker,2),o=(new X).executeMany(m,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==o?o:new S({vd:t})}bufferPolygon(){if(0===this.m_distance)return this.m_geometry;this.generateCircleTemplate();const e=(new X).execute(this.m_geometry,null,!1,this.m_progressTracker);if(this.m_distance<0){if(this.m_geometry=e,this.m_geometry.isEmpty())return this.m_geometry;const t=this.m_geometry,s=this.bufferPolygonImpl(t,0,t.getPathCount());return(new X).execute(s,this.m_spatialReference,!1,this.m_progressTracker)}{if(this.m_geometry=e,this.isDegenerateGeometry(this.m_geometry)){const e=new d;this.m_geometry.getPointByVal(0,e);const t=new k;return this.m_geometry.queryEnvelope(t),e.setXY(t.getCenter()),this.bufferDegeneratePath(e,!0)}const t=new J(this),s=(new A).executeMany(t,this.m_spatialReference,this.m_progressTracker,2),i=(new X).executeMany(s,this.m_spatialReference,!1,this.m_progressTracker).next();return null!==i?i:new S({vd:this.m_geometry.getDescription()})}}bufferPolygonImpl(e,t,s){const i=e,n=i.getImpl();let r=new S({vd:e.getDescription()});for(let m=t;m<s;m++){if(n.getPathSize(m)<1)continue;const t=n.calculateRingArea2D(m),s=new k;if(n.queryPathEnvelope(m,s),this.m_distance>0)if(t>0)if(this.isDegeneratePath(n,m)){const e=new d;n.getPointByVal(n.getPathStart(m),e),e.setXY(s.getCenter()),r.add(this.bufferDegeneratePath(e,!0),!1)}else{const t=new I({vd:e.getDescription()}),s=t.getImpl();if(M(this.m_geometry,m)){const e=this.bufferConvexPath(i,m);r.add(e,!1)}else{this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,1);const e=this.bufferCleanup(t);r.add(e,!1)}}else{if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new I({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,1),!t.isEmpty()){const e=s,n=Math.max(1,this.m_absDistance),m=e.clone();m.inflateCoords(n,n),i.addEnvelope(m,!1);const o=this.bufferCleanup(t);r.reserve(r.getPointCount()+o.getPointCount()-4),ee(o,r,m,!0)}}else if(t>0){if(s.width()+this.m_tolerance.total()<=2*this.m_absDistance||s.height()+this.m_tolerance.total()<=2*this.m_absDistance)continue;const t=new I({vd:e.getDescription()}),i=t.getImpl();if(this.bufferClosedPath(this.m_geometry,m,i,this.m_bRoundBuffer,-1),!t.isEmpty()){const e=new k;i.queryLooseEnvelope(e);const s=Math.max(1,this.m_absDistance),n=e.clone();n.inflateCoords(s,s),i.addEnvelope(n,!1);ee(this.bufferCleanup(t),r,n,!0)}}else{const t=new I({vd:e.getDescription()}),s=t.getImpl();this.bufferClosedPath(this.m_geometry,m,s,this.m_bRoundBuffer,-1);const i=this.bufferCleanup(t);for(let e=0,n=i.getPathCount();e<n;e++)r.addPath(i,e,!0)}}if(this.m_distance>0){if(r.getPathCount()>1){return this.bufferCleanup(r)}return Q(r)}{const e=new k;if(r.queryLooseEnvelope(e),r.isEmpty())return Q(r);{const t=Math.max(1,this.m_absDistance),s=e.clone();s.inflateCoords(t,t),r.addEnvelope(s,!1);const i=this.bufferCleanup(r);r=new S;const n=new S({vd:i.getDescription()});return ee(i,n,s,!1),Q(n)}}}bufferPoint(){return this.bufferPointImpl(this.m_geometry)}bufferPointImpl(e){const t=new S({vd:e.getDescription()});return 0===this.m_caps?(this.addCircle(t.getImpl(),e),this.setStrongSimple(t)):2===this.m_caps?(this.addSquare(t.getImpl(),e),this.setStrongSimple(t)):t}bufferDegeneratePath(e,t){const s=new S({vd:e.getDescription()});return t&&0===this.m_joins||!t&&0===this.m_caps?(this.addCircle(s.getImpl(),e),this.setStrongSimple(s)):t||2!==this.m_caps?s:(this.addSquare(s.getImpl(),e),this.setStrongSimple(s))}bufferMultiPoint(){const e=new G(this,this.m_geometry,this.m_distance,this.m_spatialReference,this.m_joins,this.m_caps,this.m_miterLimit,this.m_densifyDist,this.m_maxVertexInCompleteCircle,this.m_progressTracker);return(new A).executeMany(e,this.m_spatialReference,this.m_progressTracker,2).next()}bufferEnvelope(){let e=new S({vd:this.m_geometry.getDescription()});if(this.m_distance<=0){if(0===this.m_distance)e.addEnvelope(this.m_geometry,!1),H(this.m_geometry,this.m_tolerance.total())&&(e=this.setStrongSimple(e));else{const t=new p;this.m_geometry.queryEnvelope(t),t.inflateCoords(this.m_distance,this.m_distance),e.addEnvelope(t,!1),H(t,this.m_tolerance.total())&&(e=this.setStrongSimple(e))}return e}if(1===this.m_joins){const t=new p({copy:this.m_geometry});return t.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(t,!1),e}const t=this.m_geometry.clone();if(0===t.width()||0===t.height()){if(0===t.width()&&0===t.height()){const e=new d({vd:this.m_geometry.getDescription()});return t.queryCornerByVal(0,e),this.m_geometry=e,this.bufferImpl()}const e=new I({vd:this.m_geometry.getDescription()}),s=new d;return t.queryCornerByVal(0,s),e.startPathPoint(s),t.queryCornerByVal(2,s),e.lineToPoint(s),this.m_geometry=e,this.bufferImpl()}return e.addEnvelope(this.m_geometry,!1),this.m_geometry=e,this.bufferConvexPath(e,0)}bufferConvexPath(e,t){this.generateCircleTemplate();const s=e.hasAttribute(10),i=new S({vd:e.getDescription()}),n=i.getImpl();i.reserve((this.m_circleTemplate.length/10+4)*e.getPathSize(t));const r=new x,m=new x,o=new x,a=new x(0,0),h=new x,l=new x,u=e.getImpl(),f=e.getPathSize(t),_=e.getPathStart(t);for(let g=0,d=e.getPathSize(t);g<d;g++){const e=u.getXY(_+g),t=u.getXY(_+(g+1)%f),i=u.getXY(_+(g+2)%f);h.setSub(t,e),0===h.length()&&c("");const d=s&&!!(1&u.getAttributeAsInt(10,(g+1)%f,0));h.normalize();const p=h.clone();h.leftPerpendicularThis(),h.scale(this.m_absDistance),r.setAdd(h,e),m.setAdd(h,t),0===g?n.startPath(r):n.lineTo(r),n.lineTo(m),l.setSub(i,t),0===l.length()&&c(""),l.normalize();const b=l.clone();l.leftPerpendicularThis(),l.scale(this.m_absDistance),o.setAdd(l,t);let y=F.enumArc;const P=d?0:this.m_joins;if(2===P)y=F.enumBevel;else if(1===P){const e=-p.crossProduct(b);a.setSub(p,b),a.scale(this.m_absDistance/e),a.length()<this.m_miterLimit*this.m_absDistance?(a.addThis(t),y=F.enumMiter):y=F.enumBevel}else a.assign(t);this.addJoin(y,n,a,m,o,!1,!1)}return Q(i)}bufferPolylinePath(e,t,s){this.generateCircleTemplate();const i=e,n=i.getImpl();if(n.getPathSize(t)<1)return null;let r;if(r=this.m_bRoundBuffer?n.isClosedPathInXYPlane(t):n.isClosedPath(t),this.isDegeneratePath(n,t)&&this.m_distance>0){const e=new d;n.getPointByVal(n.getPathStart(t),e);const s=new k;return n.queryPathEnvelope(t,s),e.setXY(s.getCenter()),this.bufferDegeneratePath(e,r)}const m=new I({vd:e.getDescription()});m.reserve((Math.trunc(this.m_circleTemplate.length/10)+4)*n.getPathSize(t));const o=m.getImpl();return r?2!==this.bufferClosedPath(i,t,o,s,1)&&this.bufferClosedPath(i,t,o,s,-1):this.bufferOpenPath(i,t,o,s),this.bufferCleanup(m)}progress_(){}bufferCleanup(e,t=!1){const s=t?this.m_tolerance:this.m_smallTolerance;return Y(e,s,!0,!t,-1,this.m_progressTracker,0,!1)}calcN(){const e=4;if(0===this.m_densifyDist)return this.m_maxVertexInCompleteCircle;const t=1-this.m_densifyDist*Math.abs(this.m_absDistanceReversed);let s=e;return s=t<-1?e:2*Math.PI/Math.acos(t)+.5,s<e?s=e:s>this.m_maxVertexInCompleteCircle&&(s=this.m_maxVertexInCompleteCircle),Math.trunc(s)}addJoin(e,t,s,i,n,r,m){if(this.generateCircleTemplate(),r&&(t.startPath(i),r=!1),e===F.enumBevel)return void(m&&t.lineTo(n));if(e===F.enumMiter){const e=s.clone();return t.lineTo(e),void(m&&t.lineTo(n))}const o=new x;o.setSub(i,s),o.scale(this.m_absDistanceReversed);const a=new x;a.setSub(n,s),a.scale(this.m_absDistanceReversed);let h=Math.atan2(o.y,o.x)/this.m_dA;h<0&&(h=this.m_circleTemplate.length+h),h=this.m_circleTemplate.length-h;let l=Math.atan2(a.y,a.x)/this.m_dA;l<0&&(l=this.m_circleTemplate.length+l),l=this.m_circleTemplate.length-l,l<h&&(l+=this.m_circleTemplate.length);let c=Math.trunc(l),u=Math.ceil(h),f=this.m_circleTemplate[u%this.m_circleTemplate.length].clone();f.scaleAddThis(this.m_absDistance,s);const _=10*this.m_tolerance.total();f.sub(i).length()<_&&(u+=1),f=this.m_circleTemplate[c%this.m_circleTemplate.length].clone(),f.scaleAddThis(this.m_absDistance,s),f.sub(n).length()<_&&(c-=1);let g=c-u;g++;for(let d=0,p=u%this.m_circleTemplate.length;d<g;d++,p=(p+1)%this.m_circleTemplate.length)f=this.m_circleTemplate[p].clone(),f.scaleAddThis(this.m_absDistance,s),t.lineTo(f),this.progress_();m&&t.lineTo(n)}bufferClosedPath(e,t,s,i,n){const r=new E,m=r.addPathFromMultiPath(e,t,!0);return this.bufferClosedPathImpl(r,m,s,i,n)}bufferClosedPathImpl(e,t,s,i,n){const r=e.getFirstVertex(e.getFirstPath(t)),m=new d;e.queryPoint(r,m),e.filterClosePoints(this.m_filterTolerance,!1,!1,!1,-1);if(e.getPointCount(t)<2)return n<0?0:(this.m_bRoundBuffer&&this.addCircle(s,m),2);u(e.getFirstPath(t)!==V),u(e.getFirstVertex(e.getFirstPath(t))!==V);const o=e.getXY(e.getFirstVertex(e.getFirstPath(t))),a=new B;if(a.setShift(o.negate()),e.applyTransformation(a),i){const i=$(e,t,n,!0,this.m_absDistance,this.m_filterTolerance,this.m_densifyDist);if(u(1===i),e.getPointCount(t)<2)return n<0?0:(this.addCircle(s,m),2)}const h=0!==this.m_joins&&e.getVertexDescription().hasAttribute(10);this.m_bufferCommands.length=0;const l=e.getFirstPath(t);let c=e.getFirstVertex(l),f=1===n?e.getPrevVertex(c):e.getNextVertex(c),_=1===n?e.getNextVertex(c):e.getPrevVertex(c),g=!0;const p=new x,b=new x,y=new x,P=new x,C=new x,D=new x,w=new x,T=new x,v=this.m_absDistance,S=e.getPathSize(l),I=new x(0,0);for(let u=0;u<S;u++){b.assign(e.getXY(_)),g&&(p.assign(e.getXY(c)),y.assign(e.getXY(f)),D.setSub(p,y),D.normalize(),T.leftPerpendicularOther(D),T.scale(v),P.setAdd(T,p));const t=h&&!!(1&e.getAttributeAsDbl(10,c,0));C.setSub(b,p),C.normalize(),w.leftPerpendicularOther(C),w.scale(v);const s=new x;s.setAdd(p,w);const i=D.crossProduct(C),r=D.dotProduct(C);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8){let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;I.setSub(D,C),I.scale(this.m_absDistance/t),I.length()<this.m_miterLimit*this.m_absDistance&&(I.addThis(p),e=!0),this.m_bufferCommands.push(L(P,s,I,e?F.enumMiter:F.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(L(P,s,p,0===n?F.enumArc:F.enumBevel,this.m_bufferCommands.length+1))}else P.equals(s)||(this.m_bufferCommands.push(q(P,p,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(q(p,s,this.m_bufferCommands.length+1)));const m=new x;m.setAdd(b,w),this.m_bufferCommands.push(L(s,m,p,F.enumLine,this.m_bufferCommands.length+1)),P.setCoordsPoint2D(m),T.setCoordsPoint2D(w),y.setCoordsPoint2D(p),p.setCoordsPoint2D(b),D.setCoordsPoint2D(C),f=c,c=_,g=!1,_=1===n?e.getNextVertex(c):e.getPrevVertex(c)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),a.setShift(o),s.applyTransformationToPath(a,s.getPathCount()-1),1}bufferOpenPath(e,t,s,i){if(this.m_bRoundBuffer){const n=new I({vd:e.getDescription()});return n.addPath(e,t,!1),n.addSegmentsFromPath(e,t,0,e.getSegmentCountPath(t),!1),this.bufferClosedPath(n,0,s,i,1)}let n=0;const r=new I({vd:e.getDescription()}),m=new x(0,0);{const i=new E,o=i.addPathFromMultiPath(e,t,!1),a=i.getFirstVertex(i.getFirstPath(o)),h=new d;i.queryPoint(a,h),m.assign(h.getXY()),i.filterClosePoints(0,!1,!1,!1,-1);if(i.getPointCount(o)<2)return this.m_bRoundBuffer&&this.addCircle(s,h),2;const l=i.getGeometry(i.getFirstGeometry());r.addPath(l,0,!1),n=r.getPointCount()-1,r.addSegmentsFromPath(l,0,0,l.getSegmentCountPath(0)-1,!1)}const o=new E,a=o.addPathFromMultiPath(r,0,!0);u(o.getFirstPath(a)!==V),u(o.getFirstVertex(o.getFirstPath(a))!==V);const h=new B;h.setShift(m.negate()),o.applyTransformation(h),this.m_bufferCommands.length=0;const l=o.getFirstPath(a),c=0!==this.m_joins&&o.getVertexDescription().hasAttribute(10);let f=o.getFirstVertex(l),_=o.getPrevVertex(f),g=o.getNextVertex(f),p=!0;const b=new x,y=new x,P=new x,C=new x,D=new x,w=new x,T=new x,v=new x,S=this.m_absDistance,M=o.getPathSize(l),k=new x(0,0);for(let u=0;u<M;u++){let e=!1;0!==u&&u!==n||(e=!0),y.assign(o.getXY(g)),p&&(b.assign(o.getXY(f)),P.assign(o.getXY(_)),w.setSub(b,P),w.normalize(),v.leftPerpendicularOther(w),v.scale(S),C.setAdd(v,b));const t=c&&!!(1&o.getAttributeAsDbl(10,f,0));D.setSub(y,b),D.normalize(),T.leftPerpendicularOther(D),T.scale(S);const s=new x;s.setAdd(b,T);const i=w.crossProduct(D),r=w.dotProduct(D);if(i<0||r<0&&i<Math.abs(r)*Number.EPSILON*8)if(e)if(0===this.m_caps)this.m_bufferCommands.push(L(C,s,b,F.enumArc,this.m_bufferCommands.length+1));else if(1===this.m_caps)this.m_bufferCommands.push(L(C,s,b,F.enumLine,this.m_bufferCommands.length+1));else{const e=D.mul(this.m_absDistance).negate(),t=e.clone();e.addThis(C),t.addThis(s),this.m_bufferCommands.push(L(C,e,b,F.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(L(e,t,b,F.enumLine,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(L(t,s,b,F.enumLine,this.m_bufferCommands.length+1))}else{let e=!1;const n=t?0:this.m_joins;if(1===n){const t=-i;k.setSub(w,D),k.scale(this.m_absDistance/t),k.length()<this.m_miterLimit*this.m_absDistance&&(k.addThis(b),e=!0),this.m_bufferCommands.push(L(C,s,k,e?F.enumMiter:F.enumBevel,this.m_bufferCommands.length+1))}else this.m_bufferCommands.push(L(C,s,b,0===n?F.enumArc:F.enumBevel,this.m_bufferCommands.length+1))}else C.equals(s)||(this.m_bufferCommands.push(q(C,b,this.m_bufferCommands.length+1)),this.m_bufferCommands.push(q(b,s,this.m_bufferCommands.length+1)));const m=new x;m.setAdd(y,T),this.m_bufferCommands.push(L(s,m,b,F.enumLine,this.m_bufferCommands.length+1)),C.setCoordsPoint2D(m),v.setCoordsPoint2D(T),P.setCoordsPoint2D(b),b.setCoordsPoint2D(y),w.setCoordsPoint2D(D),_=f,f=g,p=!1,g=o.getNextVertex(f)}return this.m_bufferCommands.at(-1).m_next=0,this.processBufferCommands(s),h.setShift(m),s.applyTransformationToPath(h,s.getPathCount()-1),1}processBufferCommands(e){const t=this.cleanupBufferCommands();let s=!0,i=t+1;for(let n=t;i!==t;n=i){const t=this.m_bufferCommands[n];i=-1!==t.m_next?t.m_next:(n+1)%this.m_bufferCommands.length,t.m_type&&(s&&(e.startPath(t.m_from),s=!1),t.m_type&F.enumJoinMask?this.addJoin(t.m_type,e,t.m_center,t.m_from,t.m_to,!1,!0):e.lineTo(t.m_to))}}cleanupBufferCommands(){this.m_helperArray=P(x,9);let e=0;for(let s=0,i=this.m_bufferCommands.length;s<i;){const t=this.m_bufferCommands[s];if(t.m_type&F.enumConnectionMask){e=s;break}s=t.m_next}let t=e+1;for(let s=e;t!==e;s=t){const e=this.m_bufferCommands[s];t=e.m_next;let i=1,n=null;for(;t!==s&&(n=this.m_bufferCommands[t],!(n.m_type&F.enumConnectionMask));)t=n.m_next,i++;if(1!==i&&(e.m_type&n.m_type)===F.enumLine){this.m_helperLine1.setStartXY(e.m_from),this.m_helperLine1.setEndXY(e.m_to),this.m_helperLine2.setStartXY(n.m_from),this.m_helperLine2.setEndXY(n.m_to);1===this.m_helperLine1.intersect(this.m_helperLine2,this.m_helperArray,null,null,this.m_smallTolerance.total())&&(e.m_to.assign(this.m_helperArray[0]),n.m_from.assign(this.m_helperArray[0]),e.m_next=t)}}return e}isDegeneratePath(e,t){if(1===e.getPathSize(t))return!0;if(0===this.m_joins&&0===this.m_caps){const s=new k;if(e.queryPathEnvelope(t,s),Math.max(s.width(),s.height())<.5*this.m_densifyDist)return!0}return!1}isDegenerateGeometry(e){if(0===this.m_joins&&0===this.m_caps){const t=new k;if(e.queryEnvelope(t),Math.max(t.width(),t.height())<.5*this.m_densifyDist)return!0}return!1}addCircle(e,t){const s=t.getXY();if(0!==this.m_circleTemplate.length){let t=this.m_circleTemplate[0].clone();t.scaleAddThis(this.m_absDistance,s),e.startPath(t);for(let i=1,n=this.m_circleTemplate.length;i<n;i++)t=this.m_circleTemplate[i].clone(),t.scaleAddThis(this.m_absDistance,s),e.lineTo(t);return}const i=this.m_circleTemplateSize,n=Math.trunc((i+3)/4),r=.5*Math.PI/n;e.reserve(4*n);const m=Math.cos(r),o=Math.sin(r);for(let a=3;a>=0;a--){const t=x.construct(0,this.m_absDistance);switch(a){case 0:for(let i=0;i<n;i++)e.lineToCoords(t.x+s.x,t.y+s.y),t.rotateReverse(m,o);break;case 1:for(let i=0;i<n;i++)e.lineToCoords(-t.y+s.x,t.x+s.y),t.rotateReverse(m,o);break;case 2:for(let i=0;i<n;i++)e.lineToCoords(-t.x+s.x,-t.y+s.y),t.rotateReverse(m,o);break;default:e.startPathCoords(t.y+s.x,-t.x+s.y);for(let i=1;i<n;i++)t.rotateReverse(m,o),e.lineToCoords(t.y+s.x,-t.x+s.y)}this.progress_()}}addSquare(e,t){const s=new p({vd:t.getDescription()});s.setCoords(t.getX(),t.getY(),t.getX(),t.getY()),s.inflateCoords(this.m_absDistance,this.m_absDistance),e.addEnvelope(s,!1)}setStrongSimple(e){return e.getImpl().setIsSimple(4,this.m_tolerance.total()),e.getImpl().updateOGCFlagsProtected(),e}}function Q(e){return b(e,0),e}function H(e,t){return!!e.isEmpty()||Math.min(e.width(),e.height())>t}function K(e,t,s,i,n,r,m,o){const a=e.getXY(s),h=e.getXY(i);if(a.equals(h))return-1;const l=.25*m,c=.25*m,f=new x;f.setSub(h,a);const _=f.length(),g=_*_*.25,d=r*r-g;if(d<=g)return-1;const p=Math.sqrt(d);f.normalize();const b=f.clone();b.rightPerpendicularThis();const y=g/p,P=y<=c,C=x.lerp(h,a,.5),T=b.clone(),v=y-l;T.scaleAddThis(Math.max(0,v),C);b.negate().scaleAddThis(p,C);const S=3.61*w(r-c),I=T.sub(a),M=T.sub(h);let E=!1,V=0;const k=D(64,0);u(o===k.length);{for(let o=e.getPrevVertexEx(i,n);o!==s;){if(1===e.getUserIndex(o,t))return-1;if(!e.getXY(o).equals(h))break;{const t=e.getPrevVertexEx(o,n);e.removeVertex(o,!1),o=t}}const r=new x,m=a.clone();k[V++]=1;for(let o=e.getNextVertexEx(s,n);o!==i;){if(1===e.getUserIndex(o,t))return-1;const s=e.getXY(o);if(s.equals(m)){const t=e.getNextVertexEx(o,n);e.removeVertex(o,!1),o=t;continue}k[V++]=0;const i=new x;if(i.setSub(s,a),i.dotProduct(b)<0)return 0;(x.sqrDistance(s,a)>S||x.sqrDistance(s,h)>S)&&(E=!0);let l=0;s.sub(a).crossProduct(I)>=0&&(l=1);if(s.sub(h).crossProduct(M)<=0&&(l|=2),0===l)return 0;k[V-1]=l,r.assign(m),m.assign(s),o=e.getNextVertexEx(o,n)}if(1===V)return 0;u(V<k.length),k[V++]=2}let B=!0;for(let u=1,x=0;u<V;u++)if(k[u]!==k[u-1]&&(x++,B=x<3&&(1===x&&3===k[u]||2===x&&2===k[u]),!B))return 0;if(V>2&&B&&(3===V||!E)){let t=0,r=e.getNextVertexEx(s,n);for(P||(e.setXY(r,T),r=e.getNextVertexEx(r,n));r!==i;){const s=e.getNextVertexEx(r,n);e.removeVertex(r,!1),r=s,++t}return t}if(u(3!==V),E&&V>3)return 0;const R=a.clone();let A=s;const X=a.clone();let Y=1,j=-1,z=A,F=0;for(V=1;z!==i;){z=e.getNextVertexEx(z,n);const t=k[V++];if(0===t){if(z===i)break;continue}const s=e.getXY(z);if(-1!==j){if(3&(j&Y&t)){e.removeVertex(A,!0),F++,A=z,X.setCoordsPoint2D(s),Y=t;continue}if(3===Y&&0!==j&&0!==t){if(X.setCoordsPoint2D(T),P||X.equals(R)){e.removeVertex(A,!0),F++,A=z,X.setCoordsPoint2D(s),Y=t;continue}e.setXY(A,X)}}j=Y,R.setCoordsPoint2D(X),A=z,Y=t,X.setCoordsPoint2D(s)}return F}function W(e,t,s,i){let n=-1;const r=new x,m=new x,o=new x;for(let a=0,h=e.getPathSize(i),l=e.getFirstVertex(i);a<h;++a){-1===n&&(e.queryXY(l,m),n=e.getPrevVertex(l),-1!==n&&(e.queryXY(n,r),o.setSub(m,r),o.normalize()));const s=e.getNextVertex(l);if(-1===s)break;const i=e.getXY(s),a=i.sub(m);if(a.normalize(),-1!==n){a.dotProduct(o)<-.99&&Math.abs(a.crossProduct(o))<1e-7&&e.setUserIndex(l,t,1)}n=l,l=s,r.assign(m),m.assign(i),o.assign(a)}}function Z(s,i,n,r,m,o,a){const h={stack:[],error:void 0,hasError:!1};try{const t=s.getFirstPath(i),r=s.createUserIndex();e(h,C((()=>{s.removeUserIndex(r)}),!1),!1),W(s,r,i,t);for(let e=0;e<100;++e){if(0===s.getPathSize(t))return 1;let e=s.getFirstVertex(t),i=s.getPathSize(t);if(i<3)return 1;s.isClosedPath(t)||(i-=1);const o=64;let h=0,l=!1;for(let t=0;t<i&&e!==V;t++){let c=0,u=e;for(let h=1,l=Math.min(o,i-t);h<l;h++)if(u=s.getNextVertexEx(u,n),h>1){const t=K(s,r,e,u,n,m,a,o);if(-1===t)break;c+=t,i-=t}if(h+=c,l=c>0,l){const t=s.getPrevVertexEx(e,n);if(-1!==t){e=t,i++;continue}}e=s.getNextVertexEx(e,n)}if(0===h)break}return s.filterClosePoints(o,!1,!1,!1,-1),1}catch(l){h.error=l,h.hasError=!0}finally{t(h)}}function $(e,t,s,i,n,r,m){return Z(e,t,s,i,n,r,m)}function ee(e,t,s,i){for(let n=0,r=e.getPathCount();n<r;n++){const r=e.getXY(e.getPathStart(n));r.x!==s.xmin&&r.x!==s.xmax&&t.addPath(e,n,i)}}export{U as B};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{b as e,c as t}from"./tslib.es6.js";import{G as n,v as i}from"./Geometry.js";import{s as r,S as s,a as o}from"./QuadraticBezier.js";import{i as m}from"./ProjectionTransformation.js";import{d as a,P as u,b as c,c as h,i as l,h as g,j as y}from"./Point2D.js";import{Envelope2D as _}from"./Envelope2D.js";import{P as D,E as p}from"./Envelope.js";function v(){return{outPoint:new u,index:-1,t:Number.NaN}}function N(e,t,n){return{outPoint:e.clone(),index:t,t:n}}function f(e,t,n,i){e.outPoint.assign(t),e.index=n,e.t=i}function P(e,t){e.outPoint.assign(t.outPoint),e.index=t.index,e.t=t.t}function I(e,t,n,i){e.index=n,e.t=i,t.queryCoord2D(e.t,e.outPoint)}function d(e,t){const n=v();P(n,e),P(e,t),P(t,n)}function q(e,t,i,r,s,o){if(e.getGeometryType()===n.enumPolygon){for(;r.nextPath();)if(r.hasNextSegment()){const t=r.nextSegment();if(0!==m(e,t.getEndXY(),0))return f(s,t.getEndXY(),-1,Number.NaN),f(o,t.getEndXY(),-1,Number.NaN),!0}r.resetToFirstPath()}if(t.getGeometryType()===n.enumPolygon){for(;i.nextPath();)if(i.hasNextSegment()){const e=i.nextSegment();if(0!==m(t,e.getEndXY(),0))return f(s,e.getEndXY(),-1,Number.NaN),f(o,e.getEndXY(),-1,Number.NaN),!0}i.resetToFirstPath()}return!1}function M(e){const t=e.getPathCount(),n=a(e.getSegmentCount(),0);let i=0;for(let r=0;r<t;++r){const t=i+e.getSegmentCountPath(r);for(let s=i,o=e.getPathStart(r);s<t;++s,++o)n[s]=o;i=t}return r(e.getPointCount(),n),n}function x(e,t){return!!Number.isNaN(t)||e<=t}function E(e){const t=new o;return t.addEnvelope(e,!1),t}class b{constructor(e,t){if(this.m_env2DgeometryA=null,this.m_env2DgeometryB=null,this.m_progressCounter=0,this.m_progressTracker=t,this.m_maxSqrDistance=e*e,this.m_maxDistance=e,this.m_bIsNearCalc=!1,Number.isNaN(this.m_maxDistance)?this.m_maxDistance=Number.POSITIVE_INFINITY:this.m_maxDistance=e,this.m_maxSqrDistance=this.m_maxDistance*this.m_maxDistance,Number.isFinite(this.m_maxSqrDistance)){let e=Math.sqrt(this.m_maxSqrDistance);for(;e<this.m_maxDistance;)this.m_maxSqrDistance*=1+Number.EPSILON,e=Math.sqrt(this.m_maxSqrDistance)}}calculate(e,t,n,i){if(e.getGeometryType()!==D.type||t.getGeometryType()!==D.type){this.m_env2DgeometryA=new _,this.m_env2DgeometryB=new _,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB);if(!x(this.m_env2DgeometryA.distanceFromEnvelope(this.m_env2DgeometryB),this.m_maxDistance))return Number.POSITIVE_INFINITY}const r=N(new u,y(),Number.NaN),s=N(new u,y(),Number.NaN),o=this._ExecuteBruteForce(e,t,r,s);return x(o,this.m_maxDistance)?(null!==n&&P(n,r),null!==i&&P(i,s),o):Number.POSITIVE_INFINITY}isNear(e,t){if(this.m_bIsNearCalc=!0,e.isEmpty()||t.isEmpty())return!1;if(e===t)return!0;let n=!0;if(e.getGeometryType()!==D.type&&e.getGeometryType()!==p.type||t.getGeometryType()!==D.type&&t.getGeometryType()!==p.type||(n=!1),n){if(this.m_env2DgeometryA=new _,this.m_env2DgeometryB=new _,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB),!(this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)>this.m_maxSqrDistance))return!0;if(this.m_env2DgeometryA.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>this.m_maxSqrDistance)return!1}const i=N(new u,y(),Number.NaN),r=N(new u,y(),Number.NaN);return this._ExecuteBruteForce(e,t,i,r)<=this.m_maxDistance}progress_(e=!1){}_ExecuteBruteForce(e,t,i,r){switch(e.getGeometryType()){case n.enumPoint:return this.distancePointGeometry(e,t,i,r);case n.enumMultiPoint:return this.distanceMultipointGeometry(e,t,i,r);case n.enumEnvelope:return this.distanceEnvelopeGeometry(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathGeometry(e,t,i,r);default:return Number.NaN}}distancePointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointPoint(e,t,i,r);case n.enumMultiPoint:return this.distancePointMultipoint(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distancePointMultipath(e,t,i,r);case n.enumEnvelope:return this.distancePointEnvelope(e,t,i,r);default:return Number.NaN}}distancePointPoint(e,t,n,i){const r=e.getXY(),s=t.getXY();return f(n,r,0,0),f(i,s,0,0),Math.sqrt(u.sqrDistance(r,s))}distancePointMultipoint(e,t,n,i){const r=e.getXY();let s=this.m_maxSqrDistance,o=s,m=!1;const a=t.getPointCount(),c=new u;for(let h=0;h<a;++h)if(t.queryXY(h,c),o=u.sqrDistance(r,c),this.m_bIsNearCalc){if(o<=s)return 0}else if(!(o>s)&&(!m&&o===s||o<s)&&(s=o,f(n,r,0,0),f(i,c,h,0),m=!0,0===s))return 0;return m?Math.sqrt(s):Number.POSITIVE_INFINITY}distancePointMultipath(e,t,i,r){const s=!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB),o=e.getXY();if(!s&&t.getGeometryType()===n.enumPolygon&&0!==m(t,o,0))return f(i,o,0,0),f(r,o,-1,Number.NaN),0;t.getImpl().getAccelerators();let a=this.m_maxSqrDistance,c=a,h=-1;const l=new _,g=t.querySegmentIterator();let y=!1;for(;g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();e.queryEnvelope(l);const t=l.sqrDistance(o);if(t>a)continue;if(!this.m_bIsNearCalc&&y&&t===a)continue;h=e.getClosestCoordinate(o,!1);const n=e.getCoord2D(h);if(c=u.sqrDistance(o,n),this.m_bIsNearCalc){if(c<=a)return 0}else if(!(c>a)&&(!y||c<a)&&(a=c,f(i,o,0,0),f(r,n,g.getStartPointIndex(),h),y=!0,0===a))return 0}return y?Math.sqrt(a):Number.POSITIVE_INFINITY}distancePointEnvelope(e,t,n,i){const r=e.getXY();f(n,r,0,0),f(i,r,-1,Number.NaN);const s=t.asEnvelope2D();return!s.contains(r)?Math.sqrt(s.sqrDistance(r,i.outPoint)):0}distanceMultipointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipoint(t,e,r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:return this.distanceMultipointMultipoint(e,t,i,r,1,1);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipointMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipointMultipath(e,E(t),i,r);default:return Number.NaN}}distanceMultipointMultipoint(n,i,r,s,o,m){const a={stack:[],error:void 0,hasError:!1};try{if(this.m_bIsNearCalc&&1===o&&1===m){const e=Math.trunc(h(Math.sqrt(n.getPointCount())+1,1,l())),t=Math.trunc(h(Math.sqrt(i.getPointCount())+1,1,l()));if((e>=4||t>=4)&&this.distanceMultipointMultipoint(n,i,r,s,e,t)<=this.m_maxSqrDistance)return 0}let t=this.m_maxSqrDistance;const y=[n],_=[i],D=this.swapGeometriesIfBGtA(y,_);D&&(this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),m=c(o,o=m),d(r,s)),e(a,g((()=>{d(r,s),this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!D),!1);const p=y[0].getImpl(),v=_[0].getImpl(),N=p.getPointCount(),P=v.getPointCount(),I=P>1;let q=!1;const M=new u,x=new u;for(let e=0;e<N;e+=o){if(p.queryXY(e,M),I){const e=this.m_env2DgeometryB.sqrDistance(M);if(this.m_bIsNearCalc){if(e>t)continue;if(this.m_env2DgeometryB.sqrMaxMinDistance(M)<=t)return 0}else if(e>=t)continue}for(let n=0;n<P;n+=m){v.queryXY(n,x);const i=u.sqrDistance(M,x);if(this.m_bIsNearCalc){if(i<=t)return 0}else if(!(i>t||q&&i===t)&&(!q||i<t)&&(f(r,M,e,0),f(s,x,n,0),q=!0,t=i,0===t))return q?Math.sqrt(t):Number.POSITIVE_INFINITY}}return q?Math.sqrt(t):Number.POSITIVE_INFINITY}catch(y){a.error=y,a.hasError=!0}finally{t(a)}}distanceMultipointMultipath(e,t,i,r){let s=!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)&&t.getGeometryType()===n.enumPolygon;const o=t.querySegmentIterator();o.stripAttributes();const a=new _,c=new u;let h=this.m_maxSqrDistance;const l=e.getImpl(),g=l.getPointCount(),y=g>1;let D=!1;for(;o.nextPath();)for(;o.hasNextSegment();){const e=o.nextSegment();if(e.queryLooseEnvelope(a),y){const e=a.sqrDistanceEnvelope(this.m_env2DgeometryA,null,null);if(this.m_bIsNearCalc){if(e>h)continue}else if(e>h||D&&e===h)continue}for(let n=0;n<g;n++){if(l.queryXY(n,c),s&&0!==m(t,c,0))return f(i,c,-1,Number.NaN),f(r,c,n,0),0;{const e=a.sqrDistance(c);if(this.m_bIsNearCalc){if(e>h)continue}else if(e>h)continue}const u=e.getClosestCoordinate(c,!1),g=e.getCoord2D(u);c.subThis(g);const y=c.sqrLength();if(this.m_bIsNearCalc){if(y<=h)return 0}else if(!(y>h)&&(!D||y<h)&&(h=y,f(i,l.getXY(n),n,0),f(r,g,o.getStartPointIndex(),u),D=!0,0===h))return 0}s=!1}return D?Math.sqrt(h):Number.POSITIVE_INFINITY}distanceEnvelopeGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointEnvelope(t,e,r,i);case n.enumMultiPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,E(e),r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(E(e),t,i,r);case n.enumEnvelope:return this.distanceEnvelopeEnvelope(e,t,i,r);default:return Number.NaN}}distanceEnvelopeEnvelope(e,t,n,i){n.t=Number.NaN,n.index=-1,i.t=Number.NaN,i.index=-1;const r=e.asEnvelope2D(),s=t.asEnvelope2D();return Math.sqrt(r.sqrDistanceEnvelope(s,n.outPoint,i.outPoint))}distanceMultipathGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipath(t,e,r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,e,r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipathMultipath(e,E(t),i,r);default:return Number.NaN}}distanceMultipathMultipath(n,i,r,o){const m={stack:[],error:void 0,hasError:!1};try{const t=[n],a=[i],u=this.swapGeometriesIfAGtB(t,a);u&&(this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),d(r,o)),e(m,g((()=>{d(r,o),this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!u),!1);const y=t[0],D=a[0],p=y.querySegmentIterator();p.stripAttributes();const N=D.querySegmentIterator();if(N.stripAttributes(),this.m_bIsNearCalc&&this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)<=this.m_maxSqrDistance)return 0;if(this.m_bIsNearCalc){const e=Math.trunc(h(Math.sqrt(y.getPointCount())+1,1,l())),t=Math.trunc(h(Math.sqrt(y.getPointCount())+1,1,l()));if(this.distanceMultipointMultipoint(y,D,r,o,e,t)<=this.m_maxSqrDistance)return 0}if(!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)){const e=v(),t=v();if(q(y,D,p,N,e,t))return P(r,e),P(o,t),0}const f=M(y),x=[],E=new s,b=new _,B=new _,S=new _;let A=this.m_maxSqrDistance,T=!0,C=!1;for(let e=0,n=f.length;e<n;++e){y.querySegment(f[e],E,!0);const t=E.get();if(t.queryEnvelope(b),!(b.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>A)){if(this.m_bIsNearCalc&&b.sqrMaxDistanceEnvelope(this.m_env2DgeometryB)<=A)return 0;for(;N.nextPath();){if(this.progress_(),T)D.queryPathEnvelope(N.getPathIndex(),S),x[N.getPathIndex()]=S.clone();else if(b.sqrDistanceEnvelope(x[N.getPathIndex()],null,null)>A)continue;for(;N.hasNextSegment();){const n=N.nextSegment();if(n.queryEnvelope(B),b.sqrDistanceEnvelope(B,null,null)<=A){const i=!b.isIntersecting(B),s=[0],m=[0];let a=t.distance(n,i,s,m);if(a*=a,this.m_bIsNearCalc&&a<=this.m_maxSqrDistance)return 0;if(a<A||a===A&&f[e]<r.index){if(C=!0,I(r,t,f[e],s[0]),I(o,n,N.getStartPointIndex(),m[0]),0===a)return 0;A=a}}}}N.resetToFirstPath(),T=!1}}return C?Math.sqrt(A):Number.POSITIVE_INFINITY}catch(a){m.error=a,m.hasError=!0}finally{t(m)}}swapGeometriesIfAGtB(e,t){return i(e[0])>i(t[0])&&(t[0]=c(e[0],e[0]=t[0]),!0)}swapGeometriesIfBGtA(e,t){return this.swapGeometriesIfAGtB(t,e)}}export{b as D,v as m,M as s,q as w};
|
|
5
|
+
import{b as e,c as t}from"./tslib.es6.js";import{G as n,v as i}from"./Geometry.js";import{s as r,S as s,a as o}from"./QuadraticBezier.js";import{h as m}from"./ProjectionTransformation.js";import{d as a,P as u,c,s as h,i as l,h as g,j as y}from"./Point2D.js";import{Envelope2D as _}from"./Envelope2D.js";import{P as D,E as p}from"./Envelope.js";function v(){return{outPoint:new u,index:-1,t:Number.NaN}}function N(e,t,n){return{outPoint:e.clone(),index:t,t:n}}function f(e,t,n,i){e.outPoint.assign(t),e.index=n,e.t=i}function P(e,t){e.outPoint.assign(t.outPoint),e.index=t.index,e.t=t.t}function I(e,t,n,i){e.index=n,e.t=i,t.queryCoord2D(e.t,e.outPoint)}function d(e,t){const n=v();P(n,e),P(e,t),P(t,n)}function q(e,t,i,r,s,o){if(e.getGeometryType()===n.enumPolygon){for(;r.nextPath();)if(r.hasNextSegment()){const t=r.nextSegment();if(0!==m(e,t.getEndXY(),0))return f(s,t.getEndXY(),-1,Number.NaN),f(o,t.getEndXY(),-1,Number.NaN),!0}r.resetToFirstPath()}if(t.getGeometryType()===n.enumPolygon){for(;i.nextPath();)if(i.hasNextSegment()){const e=i.nextSegment();if(0!==m(t,e.getEndXY(),0))return f(s,e.getEndXY(),-1,Number.NaN),f(o,e.getEndXY(),-1,Number.NaN),!0}i.resetToFirstPath()}return!1}function M(e){const t=e.getPathCount(),n=a(e.getSegmentCount(),0);let i=0;for(let r=0;r<t;++r){const t=i+e.getSegmentCountPath(r);for(let s=i,o=e.getPathStart(r);s<t;++s,++o)n[s]=o;i=t}return r(e.getPointCount(),n),n}function x(e,t){return!!Number.isNaN(t)||e<=t}function E(e){const t=new o;return t.addEnvelope(e,!1),t}class b{constructor(e,t){if(this.m_env2DgeometryA=null,this.m_env2DgeometryB=null,this.m_progressCounter=0,this.m_progressTracker=t,this.m_maxSqrDistance=e*e,this.m_maxDistance=e,this.m_bIsNearCalc=!1,Number.isNaN(this.m_maxDistance)?this.m_maxDistance=Number.POSITIVE_INFINITY:this.m_maxDistance=e,this.m_maxSqrDistance=this.m_maxDistance*this.m_maxDistance,Number.isFinite(this.m_maxSqrDistance)){let e=Math.sqrt(this.m_maxSqrDistance);for(;e<this.m_maxDistance;)this.m_maxSqrDistance*=1+Number.EPSILON,e=Math.sqrt(this.m_maxSqrDistance)}}calculate(e,t,n,i){if(e.getGeometryType()!==D.type||t.getGeometryType()!==D.type){this.m_env2DgeometryA=new _,this.m_env2DgeometryB=new _,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB);if(!x(this.m_env2DgeometryA.distanceFromEnvelope(this.m_env2DgeometryB),this.m_maxDistance))return Number.POSITIVE_INFINITY}const r=N(new u,y(),Number.NaN),s=N(new u,y(),Number.NaN),o=this._ExecuteBruteForce(e,t,r,s);return x(o,this.m_maxDistance)?(null!==n&&P(n,r),null!==i&&P(i,s),o):Number.POSITIVE_INFINITY}isNear(e,t){if(this.m_bIsNearCalc=!0,e.isEmpty()||t.isEmpty())return!1;if(e===t)return!0;let n=!0;if(e.getGeometryType()!==D.type&&e.getGeometryType()!==p.type||t.getGeometryType()!==D.type&&t.getGeometryType()!==p.type||(n=!1),n){if(this.m_env2DgeometryA=new _,this.m_env2DgeometryB=new _,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB),!(this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)>this.m_maxSqrDistance))return!0;if(this.m_env2DgeometryA.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>this.m_maxSqrDistance)return!1}const i=N(new u,y(),Number.NaN),r=N(new u,y(),Number.NaN);return this._ExecuteBruteForce(e,t,i,r)<=this.m_maxDistance}progress_(e=!1){}_ExecuteBruteForce(e,t,i,r){switch(e.getGeometryType()){case n.enumPoint:return this.distancePointGeometry(e,t,i,r);case n.enumMultiPoint:return this.distanceMultipointGeometry(e,t,i,r);case n.enumEnvelope:return this.distanceEnvelopeGeometry(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathGeometry(e,t,i,r);default:return Number.NaN}}distancePointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointPoint(e,t,i,r);case n.enumMultiPoint:return this.distancePointMultipoint(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distancePointMultipath(e,t,i,r);case n.enumEnvelope:return this.distancePointEnvelope(e,t,i,r);default:return Number.NaN}}distancePointPoint(e,t,n,i){const r=e.getXY(),s=t.getXY();return f(n,r,0,0),f(i,s,0,0),Math.sqrt(u.sqrDistance(r,s))}distancePointMultipoint(e,t,n,i){const r=e.getXY();let s=this.m_maxSqrDistance,o=s,m=!1;const a=t.getPointCount(),c=new u;for(let h=0;h<a;++h)if(t.queryXY(h,c),o=u.sqrDistance(r,c),this.m_bIsNearCalc){if(o<=s)return 0}else if(!(o>s)&&(!m&&o===s||o<s)&&(s=o,f(n,r,0,0),f(i,c,h,0),m=!0,0===s))return 0;return m?Math.sqrt(s):Number.POSITIVE_INFINITY}distancePointMultipath(e,t,i,r){const s=!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB),o=e.getXY();if(!s&&t.getGeometryType()===n.enumPolygon&&0!==m(t,o,0))return f(i,o,0,0),f(r,o,-1,Number.NaN),0;t.getImpl().getAccelerators();let a=this.m_maxSqrDistance,c=a,h=-1;const l=new _,g=t.querySegmentIterator();let y=!1;for(;g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();e.queryEnvelope(l);const t=l.sqrDistance(o);if(t>a)continue;if(!this.m_bIsNearCalc&&y&&t===a)continue;h=e.getClosestCoordinate(o,!1);const n=e.getCoord2D(h);if(c=u.sqrDistance(o,n),this.m_bIsNearCalc){if(c<=a)return 0}else if(!(c>a)&&(!y||c<a)&&(a=c,f(i,o,0,0),f(r,n,g.getStartPointIndex(),h),y=!0,0===a))return 0}return y?Math.sqrt(a):Number.POSITIVE_INFINITY}distancePointEnvelope(e,t,n,i){const r=e.getXY();f(n,r,0,0),f(i,r,-1,Number.NaN);const s=t.asEnvelope2D();return!s.contains(r)?Math.sqrt(s.sqrDistance(r,i.outPoint)):0}distanceMultipointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipoint(t,e,r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:return this.distanceMultipointMultipoint(e,t,i,r,1,1);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipointMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipointMultipath(e,E(t),i,r);default:return Number.NaN}}distanceMultipointMultipoint(n,i,r,s,o,m){const a={stack:[],error:void 0,hasError:!1};try{if(this.m_bIsNearCalc&&1===o&&1===m){const e=Math.trunc(h(Math.sqrt(n.getPointCount())+1,1,l())),t=Math.trunc(h(Math.sqrt(i.getPointCount())+1,1,l()));if((e>=4||t>=4)&&this.distanceMultipointMultipoint(n,i,r,s,e,t)<=this.m_maxSqrDistance)return 0}let t=this.m_maxSqrDistance;const y=[n],_=[i],D=this.swapGeometriesIfBGtA(y,_);D&&(this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),m=c(o,o=m),d(r,s)),e(a,g((()=>{d(r,s),this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!D),!1);const p=y[0].getImpl(),v=_[0].getImpl(),N=p.getPointCount(),P=v.getPointCount(),I=P>1;let q=!1;const M=new u,x=new u;for(let e=0;e<N;e+=o){if(p.queryXY(e,M),I){const e=this.m_env2DgeometryB.sqrDistance(M);if(this.m_bIsNearCalc){if(e>t)continue;if(this.m_env2DgeometryB.sqrMaxMinDistance(M)<=t)return 0}else if(e>=t)continue}for(let n=0;n<P;n+=m){v.queryXY(n,x);const i=u.sqrDistance(M,x);if(this.m_bIsNearCalc){if(i<=t)return 0}else if(!(i>t||q&&i===t)&&(!q||i<t)&&(f(r,M,e,0),f(s,x,n,0),q=!0,t=i,0===t))return q?Math.sqrt(t):Number.POSITIVE_INFINITY}}return q?Math.sqrt(t):Number.POSITIVE_INFINITY}catch(y){a.error=y,a.hasError=!0}finally{t(a)}}distanceMultipointMultipath(e,t,i,r){let s=!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)&&t.getGeometryType()===n.enumPolygon;const o=t.querySegmentIterator();o.stripAttributes();const a=new _,c=new u;let h=this.m_maxSqrDistance;const l=e.getImpl(),g=l.getPointCount(),y=g>1;let D=!1;for(;o.nextPath();)for(;o.hasNextSegment();){const e=o.nextSegment();if(e.queryLooseEnvelope(a),y){const e=a.sqrDistanceEnvelope(this.m_env2DgeometryA,null,null);if(this.m_bIsNearCalc){if(e>h)continue}else if(e>h||D&&e===h)continue}for(let n=0;n<g;n++){if(l.queryXY(n,c),s&&0!==m(t,c,0))return f(i,c,-1,Number.NaN),f(r,c,n,0),0;{const e=a.sqrDistance(c);if(this.m_bIsNearCalc){if(e>h)continue}else if(e>h)continue}const u=e.getClosestCoordinate(c,!1),g=e.getCoord2D(u);c.subThis(g);const y=c.sqrLength();if(this.m_bIsNearCalc){if(y<=h)return 0}else if(!(y>h)&&(!D||y<h)&&(h=y,f(i,l.getXY(n),n,0),f(r,g,o.getStartPointIndex(),u),D=!0,0===h))return 0}s=!1}return D?Math.sqrt(h):Number.POSITIVE_INFINITY}distanceEnvelopeGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointEnvelope(t,e,r,i);case n.enumMultiPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,E(e),r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(E(e),t,i,r);case n.enumEnvelope:return this.distanceEnvelopeEnvelope(e,t,i,r);default:return Number.NaN}}distanceEnvelopeEnvelope(e,t,n,i){n.t=Number.NaN,n.index=-1,i.t=Number.NaN,i.index=-1;const r=e.asEnvelope2D(),s=t.asEnvelope2D();return Math.sqrt(r.sqrDistanceEnvelope(s,n.outPoint,i.outPoint))}distanceMultipathGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipath(t,e,r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:{this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,e,r,i);return this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipathMultipath(e,E(t),i,r);default:return Number.NaN}}distanceMultipathMultipath(n,i,r,o){const m={stack:[],error:void 0,hasError:!1};try{const t=[n],a=[i],u=this.swapGeometriesIfAGtB(t,a);u&&(this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),d(r,o)),e(m,g((()=>{d(r,o),this.m_env2DgeometryB=c(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!u),!1);const y=t[0],D=a[0],p=y.querySegmentIterator();p.stripAttributes();const N=D.querySegmentIterator();if(N.stripAttributes(),this.m_bIsNearCalc&&this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)<=this.m_maxSqrDistance)return 0;if(this.m_bIsNearCalc){const e=Math.trunc(h(Math.sqrt(y.getPointCount())+1,1,l())),t=Math.trunc(h(Math.sqrt(y.getPointCount())+1,1,l()));if(this.distanceMultipointMultipoint(y,D,r,o,e,t)<=this.m_maxSqrDistance)return 0}if(!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)){const e=v(),t=v();if(q(y,D,p,N,e,t))return P(r,e),P(o,t),0}const f=M(y),x=[],E=new s,b=new _,B=new _,S=new _;let A=this.m_maxSqrDistance,T=!0,C=!1;for(let e=0,n=f.length;e<n;++e){y.querySegment(f[e],E,!0);const t=E.get();if(t.queryEnvelope(b),!(b.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>A)){if(this.m_bIsNearCalc&&b.sqrMaxDistanceEnvelope(this.m_env2DgeometryB)<=A)return 0;for(;N.nextPath();){if(this.progress_(),T)D.queryPathEnvelope(N.getPathIndex(),S),x[N.getPathIndex()]=S.clone();else if(b.sqrDistanceEnvelope(x[N.getPathIndex()],null,null)>A)continue;for(;N.hasNextSegment();){const n=N.nextSegment();if(n.queryEnvelope(B),b.sqrDistanceEnvelope(B,null,null)<=A){const i=!b.isIntersecting(B),s=[0],m=[0];let a=t.distance(n,i,s,m);if(a*=a,this.m_bIsNearCalc&&a<=this.m_maxSqrDistance)return 0;if(a<A||a===A&&f[e]<r.index){if(C=!0,I(r,t,f[e],s[0]),I(o,n,N.getStartPointIndex(),m[0]),0===a)return 0;A=a}}}}N.resetToFirstPath(),T=!1}}return C?Math.sqrt(A):Number.POSITIVE_INFINITY}catch(a){m.error=a,m.hasError=!0}finally{t(m)}}swapGeometriesIfAGtB(e,t){return i(e[0])>i(t[0])&&(t[0]=c(e[0],e[0]=t[0]),!0)}swapGeometriesIfBGtA(e,t){return this.swapGeometriesIfAGtB(t,e)}}export{b as D,v as m,M as s,q as w};
|