-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopo-lite.min.js
More file actions
1 lines (1 loc) · 1.42 KB
/
Copy pathtopo-lite.min.js
File metadata and controls
1 lines (1 loc) · 1.42 KB
1
!function(e){"use strict";function t(e,t){const o=[];for(let n=0;n<e.length;n++){let r=e[n];const i=r<0;i&&(r=~r);const s=t[r],l=s.length,a=n?1:0;if(i)for(let e=l-1-a;e>=0;e--)o.push(s[e]);else for(let e=a;e<l;e++)o.push(s[e])}return o}function o(e,r,i){const s=e.type;if("GeometryCollection"===s)return{type:s,geometries:e.geometries.map(e=>o(e,r,i))};let l;if("Point"===s)l=n(e.coordinates,i);else if("MultiPoint"===s)l=e.coordinates.map(e=>n(e,i));else if("LineString"===s)l=t(e.arcs,r);else if("MultiLineString"===s||"Polygon"===s)l=e.arcs.map(e=>t(e,r));else{if("MultiPolygon"!==s)return null;l=e.arcs.map(e=>e.map(e=>t(e,r)))}return{type:s,coordinates:l}}function n(e,t){return t?[e[0]*t.scale[0]+t.translate[0],e[1]*t.scale[1]+t.translate[1]]:e.slice()}const r={feature:function(e,t){const n=e.__arcosLite||(e.__arcosLite=function(e){const t=e.transform,o=t?t.scale[0]:1,n=t?t.scale[1]:1,r=t?t.translate[0]:0,i=t?t.translate[1]:0,s=e.arcs,l=s.length,a=new Array(l);for(let e=0;e<l;e++){const l=s[e],c=l.length,u=new Array(c);let f=0,p=0;for(let e=0;e<c;e++){const s=l[e];t?(f+=s[0],p+=s[1],u[e]=[f*o+r,p*n+i]):u[e]=[s[0],s[1]]}a[e]=u}return a}(e)),r=t=>({type:"Feature",id:void 0!==t.id?t.id:void 0,properties:t.properties||{},geometry:o(t,n,e.transform)});return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(r)}:r(t)}};e.TopoLite=r,e.topojson||(e.topojson=r)}("undefined"!=typeof window?window:globalThis);