Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

14 lines
5.6 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("exports ../../core/mathUtils ../../core/libs/gl-matrix-2/math/vec2 ../../core/libs/gl-matrix-2/factories/vec2f64 ../../chunks/vec32 ../../core/libs/gl-matrix-2/factories/vec3f64 ../../core/libs/gl-matrix-2/math/common ../../geometry/support/plane ../3d/support/mathUtils ./geometry2dUtils".split(" "),function(h,R,p,v,e,l,x,y,S,q){function K(b,{start:a,end:f,type:c},d=l.create()){b=e.sub(z,b,a);f=e.sub(A,f,a);b=e.dot(b,f)/e.dot(f,f);return e.scaleAndAdd(d,a,f,c===q.LineType.RAY?Math.max(b,0):
b)}function L({start:b,end:a,type:f},c){const d=e.sub(z,c,b);a=e.sub(A,a,b);if(f===q.LineType.RAY&&e.dot(a,d)<-x.getEpsilon())return e.distance(b,c);b=e.cross(D,a,d);return e.len(b)/e.len(a)}function M(b,a){const f=b.start,c=a.start;var d=a.end;const k=e.sub(z,b.end,f);d=e.sub(A,d,c);var m=e.sub(D,c,f),g=e.cross(N,k,d),n=e.dot(m,g);if(!t(n,0))return[];n=e.sqrLen(g);if(t(n,0))return[];m=e.cross(O,m,d);g=e.dot(m,g)/n;g=e.scaleAndAdd(P,f,k,g);return b.type===q.LineType.RAY&&(b=e.sub(H,g,f),e.dot(k,b)<
-x.getEpsilon())||a.type===q.LineType.RAY&&(a=e.sub(H,g,c),e.dot(d,a)<-x.getEpsilon())?[]:[l.clone(g)]}function Q({start:b,end:a,type:f},c){const d=e.sub(z,c,b);b=e.sub(A,a,b);a=e.cross(D,b,d);a=e.sqrLen(a)/e.sqrLen(b);const k=x.getEpsilon();if(a<k)switch(f){case q.LineType.LINE:return[l.clone(c)];case q.LineType.RAY:return e.dot(b,d)<-k?[]:[l.clone(c)]}return[]}function B(b,a,{start:f,end:c,type:d}){e.set(b.start,f[0],f[1],a);e.set(b.end,c[0],c[1],a);b.type=T[d];return b}function t(b,a){return R.floatEqualAbsolute(Math.abs(b-
a),0,x.getEpsilon())}function E(b,a){return y.isPointInside(b,a)}const V=(()=>{const b=l.create(),a=l.create(),f=l.create();return({start:c,end:d},{center:k,radius:m,normal:g,slicePlane:n})=>{var r=y.fromPositionAndNormal(k,g,U);if(t(y.distance(r,c),0)&&t(y.distance(r,d),0)){S.tangentFrame(g,b,a);r=(w,u)=>{e.subtract(f,u,k);p.set(w,e.dot(f,b),e.dot(f,a));return w};d=q.intersectLineLikeAndCircle({start:r(C,c),end:r(F,d),type:q.LineType.LINE},v.ZEROS,m);c=[];for(const [w,u]of d)d=e.copy(l.create(),
k),e.scaleAndAdd(d,d,b,w),e.scaleAndAdd(d,d,a,u),n&&!E(n,d)||c.push(d);return c}g=l.create();return y.intersectLine(r,c,d,g)?!t(e.distance(g,k),m)||n&&!E(n,g)?[]:[g]:[]}})();h.VerticalPlaneType=void 0;(function(b){b[b.PLANE=0]="PLANE";b[b.HALF_PLANE=1]="HALF_PLANE"})(h.VerticalPlaneType||(h.VerticalPlaneType={}));const T={[h.VerticalPlaneType.PLANE]:q.LineType.LINE,[h.VerticalPlaneType.HALF_PLANE]:q.LineType.RAY},C=v.create(),F=v.create(),z=l.create(),A=l.create(),D=l.create(),N=l.create(),O=l.create(),
P=l.create(),H=l.create(),U=y.create(),G={start:l.create(),end:l.create(),type:q.LineType.LINE},W={start:l.create(),end:l.create(),type:q.LineType.LINE};Object.defineProperty(h,"LineType",{enumerable:!0,get:()=>q.LineType});h.intersectLineAndPoint=Q;h.intersectLineLikeAndCircle=V;h.intersectLineLikeAndVerticalCylinder=function({start:b,end:a,type:f},c,d){const k=[];a=e.subtract(z,a,b);var m=p.subtract(F,b,c);c=p.squaredLength(a);const g=2*p.dot(a,m);d=p.squaredLength(m)-d*d;d=g*g-4*c*d;0===d?(c=-g/
(2*c),(f===q.LineType.LINE||0<=c)&&k.push(e.scaleAndAdd(l.create(),b,a,c))):0<d&&(d=Math.sqrt(d),m=(-g+d)/(2*c),(f===q.LineType.LINE||0<=m)&&k.push(e.scaleAndAdd(l.create(),b,a,m)),c=(-g-d)/(2*c),(f===q.LineType.LINE||0<=c)&&k.push(e.scaleAndAdd(l.create(),b,a,c)));return k};h.intersectLineLikes=M;h.intersectVerticalCylinderAndPoint=function(b,a,f){return t(p.squaredDistance(f,b),a*a)?[l.clone(f)]:[]};h.intersectVerticalCylinders=function(b,a,f,c){const [d,k]=b,[m,g]=f;var n=m-d,r=g-k;const w=n*n+
r*r,u=Math.sqrt(w);if(u>a+c||u<Math.abs(a-c)||t(u,0)&&t(a,c))return[];c=(a*a-c*c+w)/(2*u);a=Math.sqrt(a*a-c*c);r=a*r/u;n=a*n/u;const [I,J]=p.lerp(C,b,f,c/u);return t(r,n)?[v.fromValues(I,J)]:[v.fromValues(I+r,J-n),v.fromValues(I-r,J+n)]};h.intersectVerticalPlaneAndLineLike=function(b,a){const f=b.start,c=p.subtract(C,b.end,f);var d=e.set(A,-c[1],c[0],0);const k=a.start,m=e.sub(D,a.end,k);var g=e.dot(m,d),n=e.set(N,f[0],f[1],0);n=e.sub(O,n,k);n=e.dot(n,d);d=x.getEpsilon();if(Math.abs(g)<d)return[];
g=e.scaleAndAdd(P,k,m,n/g);return a.type===q.LineType.RAY&&(a=e.sub(H,g,k),e.dot(a,m)<-d)||b.type===h.VerticalPlaneType.HALF_PLANE&&(b=p.sub(F,g,f),p.dot(b,c)<-d)?[]:[l.clone(g)]};h.intersectVerticalPlaneAndPoint=function(b,a){return Q(B(G,a[2],b),a)};h.intersectVerticalPlaneAndVerticalCylinder=function({start:b,end:a,type:f},c,d){const k=[];a=p.subtract(C,a,b);var m=p.subtract(F,b,c);c=p.squaredLength(a);const g=2*p.dot(a,m);d=p.squaredLength(m)-d*d;d=g*g-4*c*d;0===d?(c=-g/(2*c),(f===h.VerticalPlaneType.PLANE||
0<=c)&&k.push(p.scaleAndAdd(v.create(),b,a,c))):0<d&&(d=Math.sqrt(d),m=(-g+d)/(2*c),(f===h.VerticalPlaneType.PLANE||0<=m)&&k.push(p.scaleAndAdd(v.create(),b,a,m)),c=(-g-d)/(2*c),(f===h.VerticalPlaneType.PLANE||0<=c)&&k.push(p.scaleAndAdd(v.create(),b,a,c)));return k};h.intersectVerticalPlanes=function(b,a){b=B(G,0,b);a=B(W,0,a);return M(b,a).map(([f,c])=>v.fromValues(f,c))};h.isClose=t;h.isPointInsidePlane=E;h.pointToLineLikeDistance=L;h.pointToVerticalCylinderDistance=function(b,a,f){return p.distance(b,
a)-f};h.pointToVerticalPlaneDistance=function(b,a){return L(B(G,b[2],a),b)};h.pointsInsidePlane=function(b,a){return a.filter(f=>E(b,f))};h.projectPointToLineLike=K;h.projectPointToVerticalCylinder=function(b,a,f,c=l.create()){const d=p.subtract(C,b,a),k=p.length(d);p.scaleAndAdd(c,a,d,0===k?1:f/k);c[2]=b[2];return c};h.projectPointToVerticalPlane=function(b,a,f){return K(b,B(G,b[2],a),f)};h.vectorsHaveCloseZ=function(b,a){return t(b[2],a[2])};Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});