UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines 3.69 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8125],{78125(e,t,n){n.r(t),n.d(t,{fromExtent:()=>y,fromGeometry:()=>g,fromMultipoint:()=>C,fromPoint:()=>M,fromPolygon:()=>V,fromPolyline:()=>x,fromPolylineUsingImportOperator:()=>P,fromSpatialReference:()=>G,getSpatialReference:()=>p,toExtent:()=>v,toGeometry:()=>Z,toMultipoint:()=>w,toPoint:()=>R,toPolygon:()=>E,toPolyline:()=>X});var a=n(83661),r=(n(79187),n(55537)),s=n(95213),o=n(88885),u=n(5443),i=n(48526),c=n(86738),l=n(39829),h=n(82799),m=(n(90293),n(83299));const f="_gxVersion";function p(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function g(e){switch(e.type){case"point":return M(e);case"multipoint":return C(e);case"polyline":return x(e);case"polygon":return V(e);case"extent":return y(e);default:throw new Error(`Unsupported geometry type: ${e.type}`)}}function y(e){if(!e.getCacheValue(f)){const t=new s.E;t.setCoords(e.xmin,e.ymin,e.xmax,e.ymax),e.hasM&&t.setInterval(2,0,e.mmin,e.mmax),e.hasZ&&t.setInterval(1,0,e.zmin,e.zmax),e.setCacheValue(f,t)}return e.getCacheValue(f)}function C(e){if(!e.getCacheValue(f)){const t=new o.M,n=new s.P,a=e.points,r=e.hasM,u=e.hasZ,i=u?3:2;for(let e=0,s=a.length;e<s;e++){const s=a[e];n.setXYCoords(s[0],s[1]),u&&n.setZ(s[2]??0),r&&n.setM(s[i]??NaN),t.add(n)}e.setCacheValue(f,t)}return e.getCacheValue(f)}function M(e){if(!e.getCacheValue(f)){const t=new s.P;t.setXYCoords(e.x,e.y),e.hasM&&t.setM(e.m),e.hasZ&&t.setZ(e.z),e.setCacheValue(f,t)}return e.getCacheValue(f)}function V(e){if(!e.getCacheValue(f)){const{curveRings:t,hasM:n,hasZ:a,rings:r}=e,s=(0,m.fromGeometryToGXGeometry)({curveRings:t,hasM:n,hasZ:a,rings:r});e.setCacheValue(f,s)}return e.getCacheValue(f)}function x(e){if(!e.getCacheValue(f)){const{curvePaths:t,hasM:n,hasZ:a,paths:r}=e,s=(0,m.fromGeometryToGXGeometry)({curvePaths:t,hasM:n,hasZ:a,paths:r});e.setCacheValue(f,s)}return e.getCacheValue(f)}function P(e){if(!e.getCacheValue(f)){const{curvePaths:t,hasM:n,hasZ:a,paths:r}=e,s=(0,m.fromGeometryToGXGeometryUsingImportOperator)({curvePaths:t,hasM:n,hasZ:a,paths:r});e.setCacheValue(f,s)}return e.getCacheValue(f)}function G(e){return(0,m.fromSpatialReference)(e)}function Z(e,t){if(e)switch(e.getGeometryType()){case r.G.enumPoint:return R(e,t);case r.G.enumEnvelope:return v(e,t);case r.G.enumMultiPoint:return w(e,t);case r.G.enumPolyline:return X(e,t);case r.G.enumPolygon:return E(e,t)}return null}function v(e,t){if(e.isEmpty())return null;const n=new u.A({xmin:e.getXMin(),ymin:e.getYMin(),xmax:e.getXMax(),ymax:e.getYMax(),spatialReference:t}),a=e.getDescription();if(a.hasM()){const t=e.queryInterval(2,0);n.mmin=t.vmin,n.mmax=t.vmax}if(a.hasZ()){const t=e.queryInterval(1,0);n.zmin=t.vmin,n.zmax=t.vmax}return n.setCacheValue(f,e),n}function w(e,t){if(e.isEmpty())return null;const n=e.getDescription(),a=n.hasM(),r=n.hasZ(),o=[],u=new s.P;for(let t=0,n=e.getPointCount();t<n;t++){e.getPointByVal(t,u);const n=[u.getX(),u.getY()];r&&n.push(u.getZ()),a&&n.push(u.getM()),o.push(n)}const c=new i.A({hasM:a,hasZ:r,points:o,spatialReference:t});return c.setCacheValue(f,e),c}function R(e,t){if(e instanceof a.P)return new c.A({x:e.x,y:e.y,spatialReference:t});if(e.isEmpty())return null;const n=new c.A({x:e.getX(),y:e.getY(),spatialReference:t}),r=e.getDescription();return r.hasM()&&(n.m=e.getM()),r.hasZ()&&(n.z=e.getZ()),n.setCacheValue(f,e),n}function E(e,t){if(e.isEmpty())return null;const n=l.A.fromJSON({...(0,m.toGeometry)(e,null),spatialReference:t});return n.setCacheValue(f,e),n}function X(e,t){if(e.isEmpty())return null;const n=h.A.fromJSON({...(0,m.toGeometry)(e,null),spatialReference:t});return n.setCacheValue(f,e),n}}}]);