Comparing version 1.7.1 to 1.8.1
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-geo/ Version 1.7.1. Copyright 2017 Mike Bostock. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],t):t(n.d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";function r(){this.reset()}function i(n,t,r){var i=n.s=t+r,e=i-t,o=i-e;n.t=t-o+(r-e)}function e(n){return n>1?0:n<-1?kt:Math.acos(n)}function o(n){return n>1?Ft:n<-1?-Ft:Math.asin(n)}function u(n){return(n=Wt(n/2))*n}function c(){}function a(n,t){n&&ir.hasOwnProperty(n.type)&&ir[n.type](n,t)}function l(n,t,r){var i,e=-1,o=n.length-r;for(t.lineStart();++e<o;)i=n[e],t.point(i[0],i[1],i[2]);t.lineEnd()}function f(n,t){var r=-1,i=n.length;for(t.polygonStart();++r<i;)l(n[r],t,1);t.polygonEnd()}function s(){cr.point=h}function p(){g(ot,ut)}function h(n,t){cr.point=g,ot=n,ut=t,ct=n*=Ut,at=Ht(t=(t*=Ut)/2+It),lt=Wt(t)}function g(n,t){t=(t*=Ut)/2+It;var r=(n*=Ut)-ct,i=r>=0?1:-1,e=i*r,o=Ht(t),u=Wt(t),c=lt*u,a=at*o+c*Ht(e),l=c*i*Wt(e);or.add(Zt(l,a)),ct=n,at=o,lt=u}function v(n){return[Zt(n[1],n[0]),o(n[2])]}function d(n){var t=n[0],r=n[1],i=Ht(r);return[i*Ht(t),i*Wt(t),Wt(r)]}function E(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function y(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function S(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function m(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function M(n){var t=nr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function x(n,t){yt.push(St=[ft=n,pt=n]),t<st&&(st=t),t>ht&&(ht=t)}function _(n,t){var r=d([n*Ut,t*Ut]);if(Et){var i=y(Et,r),e=y([i[1],-i[0],0],i);M(e),e=v(e);var o,u=n-gt,c=u>0?1:-1,a=e[0]*Dt*c,l=Xt(u)>180;l^(c*gt<a&&a<c*n)?(o=e[1]*Dt)>ht&&(ht=o):(a=(a+360)%360-180,l^(c*gt<a&&a<c*n)?(o=-e[1]*Dt)<st&&(st=o):(t<st&&(st=t),t>ht&&(ht=t))),l?n<gt?C(ft,n)>C(ft,pt)&&(pt=n):C(n,pt)>C(ft,pt)&&(ft=n):pt>=ft?(n<ft&&(ft=n),n>pt&&(pt=n)):n>gt?C(ft,n)>C(ft,pt)&&(pt=n):C(n,pt)>C(ft,pt)&&(ft=n)}else yt.push(St=[ft=n,pt=n]);t<st&&(st=t),t>ht&&(ht=t),Et=r,gt=n}function N(){lr.point=_}function w(){St[0]=ft,St[1]=pt,lr.point=x,Et=null}function P(n,t){if(Et){var r=n-gt;ar.add(Xt(r)>180?r+(r>0?360:-360):r)}else vt=n,dt=t;cr.point(n,t),_(n,t)}function R(){cr.lineStart()}function A(){P(vt,dt),cr.lineEnd(),Xt(ar)>Tt&&(ft=-(pt=180)),St[0]=ft,St[1]=pt,Et=null}function C(n,t){return(t-=n)<0?t+360:t}function j(n,t){return n[0]-t[0]}function q(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}function z(n,t){n*=Ut;var r=Ht(t*=Ut);b(r*Ht(n),r*Wt(n),Wt(t))}function b(n,t,r){xt+=(n-xt)/++mt,_t+=(t-_t)/mt,Nt+=(r-Nt)/mt}function L(){fr.point=O}function O(n,t){n*=Ut;var r=Ht(t*=Ut);bt=r*Ht(n),Lt=r*Wt(n),Ot=Wt(t),fr.point=G,b(bt,Lt,Ot)}function G(n,t){n*=Ut;var r=Ht(t*=Ut),i=r*Ht(n),e=r*Wt(n),o=Wt(t),u=Zt(nr((u=Lt*o-Ot*e)*u+(u=Ot*i-bt*o)*u+(u=bt*e-Lt*i)*u),bt*i+Lt*e+Ot*o);Mt+=u,wt+=u*(bt+(bt=i)),Pt+=u*(Lt+(Lt=e)),Rt+=u*(Ot+(Ot=o)),b(bt,Lt,Ot)}function T(){fr.point=z}function k(){fr.point=I}function F(){B(qt,zt),fr.point=z}function I(n,t){qt=n,zt=t,n*=Ut,t*=Ut,fr.point=B;var r=Ht(t);bt=r*Ht(n),Lt=r*Wt(n),Ot=Wt(t),b(bt,Lt,Ot)}function B(n,t){n*=Ut;var r=Ht(t*=Ut),i=r*Ht(n),e=r*Wt(n),u=Wt(t),c=Lt*u-Ot*e,a=Ot*i-bt*u,l=bt*e-Lt*i,f=nr(c*c+a*a+l*l),s=o(f),p=f&&-s/f;At+=p*c,Ct+=p*a,jt+=p*l,Mt+=s,wt+=s*(bt+(bt=i)),Pt+=s*(Lt+(Lt=e)),Rt+=s*(Ot+(Ot=u)),b(bt,Lt,Ot)}function D(n,t){return[n>kt?n-Bt:n<-kt?n+Bt:n,t]}function U(n,t,r){return(n%=Bt)?t||r?pr(Y(n),Z(t,r)):Y(n):t||r?Z(t,r):D}function X(n){return function(t,r){return t+=n,[t>kt?t-Bt:t<-kt?t+Bt:t,r]}}function Y(n){var t=X(n);return t.invert=X(-n),t}function Z(n,t){function r(n,t){var r=Ht(t),a=Ht(n)*r,l=Wt(n)*r,f=Wt(t),s=f*i+a*e;return[Zt(l*u-s*c,a*i-f*e),o(s*u+l*c)]}var i=Ht(n),e=Wt(n),u=Ht(t),c=Wt(t);return r.invert=function(n,t){var r=Ht(t),a=Ht(n)*r,l=Wt(n)*r,f=Wt(t),s=f*u-l*c;return[Zt(l*u+f*c,a*i+s*e),o(s*i-a*e)]},r}function H(n,t,r,i,e,o){if(r){var u=Ht(t),c=Wt(t),a=i*r;null==e?(e=t+i*Bt,o=t-a/2):(e=J(u,e),o=J(u,o),(i>0?e<o:e>o)&&(e+=i*Bt));for(var l,f=e;i>0?f>o:f<o;f-=a)l=v([u,-c*Ht(f),-c*Wt(f)]),n.point(l[0],l[1])}}function J(n,t){(t=d(t))[0]-=n,M(t);var r=e(-t[1]);return((-t[2]<0?-r:r)+Bt-Tt)%Bt}function K(n,t,r,i){this.x=n,this.z=t,this.o=r,this.e=i,this.v=!1,this.n=this.p=null}function Q(n){if(t=n.length){for(var t,r,i=0,e=n[0];++i<t;)e.n=r=n[i],r.p=e,e=r;e.n=r=n[0],r.p=e}}function V(n,r,i,e){function o(t,o){return n<=t&&t<=i&&r<=o&&o<=e}function u(t,o,u,a){var f=0,s=0;if(null==t||(f=c(t,u))!==(s=c(o,u))||l(t,o)<0^u>0)do{a.point(0===f||3===f?n:i,f>1?e:r)}while((f=(f+u+4)%4)!==s);else a.point(o[0],o[1])}function c(t,e){return Xt(t[0]-n)<Tt?e>0?0:3:Xt(t[0]-i)<Tt?e>0?2:1:Xt(t[1]-r)<Tt?e>0?1:0:e>0?3:2}function a(n,t){return l(n.x,t.x)}function l(n,t){var r=c(n,1),i=c(t,1);return r!==i?r-i:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(c){function l(n,t){o(n,t)&&_.point(n,t)}function f(){for(var t=0,r=0,i=h.length;r<i;++r)for(var o,u,c=h[r],a=1,l=c.length,f=c[0],s=f[0],p=f[1];a<l;++a)o=s,u=p,s=(f=c[a])[0],p=f[1],u<=e?p>e&&(s-o)*(e-u)>(p-u)*(n-o)&&++t:p<=e&&(s-o)*(e-u)<(p-u)*(n-o)&&--t;return t}function s(t,u){var c=o(t,u);if(h&&g.push([t,u]),M)v=t,d=u,E=c,M=!1,c&&(_.lineStart(),_.point(t,u));else if(c&&m)_.point(t,u);else{var a=[y=Math.max(jr,Math.min(Cr,y)),S=Math.max(jr,Math.min(Cr,S))],l=[t=Math.max(jr,Math.min(Cr,t)),u=Math.max(jr,Math.min(Cr,u))];Pr(a,l,n,r,i,e)?(m||(_.lineStart(),_.point(a[0],a[1])),_.point(l[0],l[1]),c||_.lineEnd(),x=!1):c&&(_.lineStart(),_.point(t,u),x=!1)}y=t,S=u,m=c}var p,h,g,v,d,E,y,S,m,M,x,_=c,N=wr(),w={point:l,lineStart:function(){w.point=s,h&&h.push(g=[]),M=!0,m=!1,y=S=NaN},lineEnd:function(){p&&(s(v,d),E&&m&&N.rejoin(),p.push(N.result())),w.point=l,m&&_.lineEnd()},polygonStart:function(){_=N,p=[],h=[],x=!0},polygonEnd:function(){var n=f(),r=x&&n,i=(p=t.merge(p)).length;(r||i)&&(c.polygonStart(),r&&(c.lineStart(),u(null,null,1,c),c.lineEnd()),i&&Ar(p,a,n,u,c),c.polygonEnd()),_=c,p=h=g=null}};return w}}function W(){Lr.point=Lr.lineEnd=c}function $(n,t){hr=n*=Ut,gr=Wt(t*=Ut),vr=Ht(t),Lr.point=nn}function nn(n,t){n*=Ut;var r=Wt(t*=Ut),i=Ht(t),e=Xt(n-hr),o=Ht(e),u=i*Wt(e),c=vr*r-gr*i*o,a=gr*r+vr*i*o;br.add(Zt(nr(u*u+c*c),a)),hr=n,gr=r,vr=i}function tn(n,t){return!(!n||!Ir.hasOwnProperty(n.type))&&Ir[n.type](n,t)}function rn(n,t){return 0===kr(n,t)}function en(n,t){var r=kr(n[0],n[1]);return kr(n[0],t)+kr(t,n[1])<=r+Tt}function on(n,t){return!!zr(n.map(un),cn(t))}function un(n){return(n=n.map(cn)).pop(),n}function cn(n){return[n[0]*Ut,n[1]*Ut]}function an(n,r,i){var e=t.range(n,r-Tt,i).concat(r);return function(n){return e.map(function(t){return[n,t]})}}function ln(n,r,i){var e=t.range(n,r-Tt,i).concat(r);return function(n){return e.map(function(t){return[t,n]})}}function fn(){function n(){return{type:"MultiLineString",coordinates:r()}}function r(){return t.range(Jt(u/E)*E,o,E).map(h).concat(t.range(Jt(f/y)*y,l,y).map(g)).concat(t.range(Jt(e/v)*v,i,v).filter(function(n){return Xt(n%E)>Tt}).map(s)).concat(t.range(Jt(a/d)*d,c,d).filter(function(n){return Xt(n%y)>Tt}).map(p))}var i,e,o,u,c,a,l,f,s,p,h,g,v=10,d=v,E=90,y=360,S=2.5;return n.lines=function(){return r().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(l).slice(1),h(o).reverse().slice(1),g(f).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.extentMajor(t).extentMinor(t):n.extentMinor()},n.extentMajor=function(t){return arguments.length?(u=+t[0][0],o=+t[1][0],f=+t[0][1],l=+t[1][1],u>o&&(t=u,u=o,o=t),f>l&&(t=f,f=l,l=t),n.precision(S)):[[u,f],[o,l]]},n.extentMinor=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],a=+t[0][1],c=+t[1][1],e>i&&(t=e,e=i,i=t),a>c&&(t=a,a=c,c=t),n.precision(S)):[[e,a],[i,c]]},n.step=function(t){return arguments.length?n.stepMajor(t).stepMinor(t):n.stepMinor()},n.stepMajor=function(t){return arguments.length?(E=+t[0],y=+t[1],n):[E,y]},n.stepMinor=function(t){return arguments.length?(v=+t[0],d=+t[1],n):[v,d]},n.precision=function(t){return arguments.length?(S=+t,s=an(a,c,90),p=ln(e,i,S),h=an(f,l,90),g=ln(u,o,S),n):S},n.extentMajor([[-180,-90+Tt],[180,90-Tt]]).extentMinor([[-180,-80-Tt],[180,80+Tt]])}function sn(){Xr.point=pn}function pn(n,t){Xr.point=hn,dr=yr=n,Er=Sr=t}function hn(n,t){Ur.add(Sr*n-yr*t),yr=n,Sr=t}function gn(){hn(dr,Er)}function vn(n,t){Qr+=n,Vr+=t,++Wr}function dn(){oi.point=En}function En(n,t){oi.point=yn,vn(xr=n,_r=t)}function yn(n,t){var r=n-xr,i=t-_r,e=nr(r*r+i*i);$r+=e*(xr+n)/2,ni+=e*(_r+t)/2,ti+=e,vn(xr=n,_r=t)}function Sn(){oi.point=vn}function mn(){oi.point=xn}function Mn(){_n(mr,Mr)}function xn(n,t){oi.point=_n,vn(mr=xr=n,Mr=_r=t)}function _n(n,t){var r=n-xr,i=t-_r,e=nr(r*r+i*i);$r+=e*(xr+n)/2,ni+=e*(_r+t)/2,ti+=e,ri+=(e=_r*n-xr*t)*(xr+n),ii+=e*(_r+t),ei+=3*e,vn(xr=n,_r=t)}function Nn(n){this._context=n}function wn(n,t){pi.point=Pn,ci=li=n,ai=fi=t}function Pn(n,t){li-=n,fi-=t,si.add(nr(li*li+fi*fi)),li=n,fi=t}function Rn(){this._string=[]}function An(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Cn(n){return n.length>1}function jn(n,t){return((n=n.x)[0]<0?n[1]-Ft-Tt:Ft-n[1])-((t=t.x)[0]<0?t[1]-Ft-Tt:Ft-t[1])}function qn(n,t,r,i){var e,o,u=Wt(n-r);return Xt(u)>Tt?Yt((Wt(t)*(o=Ht(i))*Wt(r)-Wt(i)*(e=Ht(t))*Wt(n))/(e*o*u)):(t+i)/2}function zn(n){return function(t){var r=new bn;for(var i in n)r[i]=n[i];return r.stream=t,r}}function bn(){}function Ln(n,t,r){var i=t[1][0]-t[0][0],e=t[1][1]-t[0][1],o=n.clipExtent&&n.clipExtent();n.scale(150).translate([0,0]),null!=o&&n.clipExtent(null),er(r,n.stream(Kr));var u=Kr.result(),c=Math.min(i/(u[1][0]-u[0][0]),e/(u[1][1]-u[0][1])),a=+t[0][0]+(i-c*(u[1][0]+u[0][0]))/2,l=+t[0][1]+(e-c*(u[1][1]+u[0][1]))/2;return null!=o&&n.clipExtent(o),n.scale(150*c).translate([a,l])}function On(n,t,r){return Ln(n,[[0,0],t],r)}function Gn(n){return zn({point:function(t,r){t=n(t,r),this.stream.point(t[0],t[1])}})}function Tn(n,t){function r(i,e,u,c,a,l,f,s,p,h,g,v,d,E){var y=f-i,S=s-e,m=y*y+S*S;if(m>4*t&&d--){var M=c+h,x=a+g,_=l+v,N=nr(M*M+x*x+_*_),w=o(_/=N),P=Xt(Xt(_)-1)<Tt||Xt(u-p)<Tt?(u+p)/2:Zt(x,M),R=n(P,w),A=R[0],C=R[1],j=A-i,q=C-e,z=S*j-y*q;(z*z/m>t||Xt((y*j+S*q)/m-.5)>.3||c*h+a*g+l*v<Ei)&&(r(i,e,u,c,a,l,A,C,P,M/=N,x/=N,_,d,E),E.point(A,C),r(A,C,P,M,x,_,f,s,p,h,g,v,d,E))}}return function(t){function i(r,i){r=n(r,i),t.point(r[0],r[1])}function e(){y=NaN,_.point=o,t.lineStart()}function o(i,e){var o=d([i,e]),u=n(i,e);r(y,S,E,m,M,x,y=u[0],S=u[1],E=i,m=o[0],M=o[1],x=o[2],di,t),t.point(y,S)}function u(){_.point=i,t.lineEnd()}function c(){e(),_.point=a,_.lineEnd=l}function a(n,t){o(f=n,t),s=y,p=S,h=m,g=M,v=x,_.point=o}function l(){r(y,S,E,m,M,x,s,p,f,h,g,v,di,t),_.lineEnd=u,u()}var f,s,p,h,g,v,E,y,S,m,M,x,_={point:i,lineStart:e,lineEnd:u,polygonStart:function(){t.polygonStart(),_.lineStart=c},polygonEnd:function(){t.polygonEnd(),_.lineStart=e}};return _}}function kn(n){return Fn(function(){return n})()}function Fn(n){function t(n){return n=f(n[0]*Ut,n[1]*Ut),[n[0]*d+c,a-n[1]*d]}function r(n){return(n=f.invert((n[0]-c)/d,(a-n[1])/d))&&[n[0]*Dt,n[1]*Dt]}function i(n,t){return n=u(n,t),[n[0]*d+c,a-n[1]*d]}function e(){f=pr(l=U(M,x,_),u);var n=u(S,m);return c=E-n[0]*d,a=y+n[1]*d,o()}function o(){return g=v=null,t}var u,c,a,l,f,s,p,h,g,v,d=150,E=480,y=250,S=0,m=0,M=0,x=0,_=0,N=null,w=gi,P=null,R=Br,A=.5,C=yi(i,A);return t.stream=function(n){return g&&v===n?g:g=Si(w(l,C(R(v=n))))},t.clipAngle=function(n){return arguments.length?(w=+n?vi(N=n*Ut,6*Ut):(N=null,gi),o()):N*Dt},t.clipExtent=function(n){return arguments.length?(R=null==n?(P=s=p=h=null,Br):V(P=+n[0][0],s=+n[0][1],p=+n[1][0],h=+n[1][1]),o()):null==P?null:[[P,s],[p,h]]},t.scale=function(n){return arguments.length?(d=+n,e()):d},t.translate=function(n){return arguments.length?(E=+n[0],y=+n[1],e()):[E,y]},t.center=function(n){return arguments.length?(S=n[0]%360*Ut,m=n[1]%360*Ut,e()):[S*Dt,m*Dt]},t.rotate=function(n){return arguments.length?(M=n[0]%360*Ut,x=n[1]%360*Ut,_=n.length>2?n[2]%360*Ut:0,e()):[M*Dt,x*Dt,_*Dt]},t.precision=function(n){return arguments.length?(C=yi(i,A=n*n),o()):nr(A)},t.fitExtent=function(n,r){return Ln(t,n,r)},t.fitSize=function(n,r){return On(t,n,r)},function(){return u=n.apply(this,arguments),t.invert=u.invert&&r,e()}}function In(n){var t=0,r=kt/3,i=Fn(n),e=i(t,r);return e.parallels=function(n){return arguments.length?i(t=n[0]*Ut,r=n[1]*Ut):[t*Dt,r*Dt]},e}function Bn(n){function t(n,t){return[n*r,Wt(t)/r]}var r=Ht(n);return t.invert=function(n,t){return[n/r,o(t*r)]},t}function Dn(n,t){function r(n,t){var r=nr(u-2*e*Wt(t))/e;return[r*Wt(n*=e),c-r*Ht(n)]}var i=Wt(n),e=(i+Wt(t))/2;if(Xt(e)<Tt)return Bn(n);var u=1+i*(2*e-i),c=nr(u)/e;return r.invert=function(n,t){var r=c-t;return[Zt(n,Xt(r))/e*$t(r),o((u-(n*n+r*r)*e*e)/(2*e))]},r}function Un(n){var t=n.length;return{point:function(r,i){for(var e=-1;++e<t;)n[e].point(r,i)},sphere:function(){for(var r=-1;++r<t;)n[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)n[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)n[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)n[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)n[r].polygonEnd()}}}function Xn(n){return function(t,r){var i=Ht(t),e=Ht(r),o=n(i*e);return[o*e*Wt(t),o*Wt(r)]}}function Yn(n){return function(t,r){var i=nr(t*t+r*r),e=n(i),u=Wt(e),c=Ht(e);return[Zt(t*u,i*c),o(i&&r*u/i)]}}function Zn(n,t){return[n,Qt(tr((Ft+t)/2))]}function Hn(n){function t(){var t=kt*c(),u=o(Nr(o.rotate()).invert([0,0]));return l(null==f?[[u[0]-t,u[1]-t],[u[0]+t,u[1]+t]]:n===Zn?[[Math.max(u[0]-t,f),r],[Math.min(u[0]+t,i),e]]:[[f,Math.max(u[1]-t,r)],[i,Math.min(u[1]+t,e)]])}var r,i,e,o=kn(n),u=o.center,c=o.scale,a=o.translate,l=o.clipExtent,f=null;return o.scale=function(n){return arguments.length?(c(n),t()):c()},o.translate=function(n){return arguments.length?(a(n),t()):a()},o.center=function(n){return arguments.length?(u(n),t()):u()},o.clipExtent=function(n){return arguments.length?(null==n?f=r=i=e=null:(f=+n[0][0],r=+n[0][1],i=+n[1][0],e=+n[1][1]),t()):null==f?null:[[f,r],[i,e]]},t()}function Jn(n){return tr((Ft+n)/2)}function Kn(n,t){function r(n,t){o>0?t<-Ft+Tt&&(t=-Ft+Tt):t>Ft-Tt&&(t=Ft-Tt);var r=o/Vt(Jn(t),e);return[r*Wt(e*n),o-r*Ht(e*n)]}var i=Ht(n),e=n===t?Wt(n):Qt(i/Ht(t))/Qt(Jn(t)/Jn(n)),o=i*Vt(Jn(n),e)/e;return e?(r.invert=function(n,t){var r=o-t,i=$t(e)*nr(n*n+r*r);return[Zt(n,Xt(r))/e*$t(r),2*Yt(Vt(o/i,1/e))-Ft]},r):Zn}function Qn(n,t){return[n,t]}function Vn(n,t){function r(n,t){var r=o-t,i=e*n;return[r*Wt(i),o-r*Ht(i)]}var i=Ht(n),e=n===t?Wt(n):(i-Ht(t))/(t-n),o=i/e+n;return Xt(e)<Tt?Qn:(r.invert=function(n,t){var r=o-t;return[Zt(n,Xt(r))/e*$t(r),o-$t(e)*nr(n*n+r*r)]},r)}function Wn(n,t){var r=Ht(t),i=Ht(n)*r;return[r*Wt(n)/i,Wt(t)/i]}function $n(n,t,r,i){return 1===n&&1===t&&0===r&&0===i?Br:zn({point:function(e,o){this.stream.point(e*n+r,o*t+i)}})}function nt(n,t){var r=t*t,i=r*r;return[n*(.8707-.131979*r+i*(i*(.003971*r-.001529*i)-.013791)),t*(1.007226+r*(.015085+i*(.028874*r-.044475-.005916*i)))]}function tt(n,t){return[Ht(t)*Wt(n),Wt(t)]}function rt(n,t){var r=Ht(t),i=1+Ht(n)*r;return[r*Wt(n)/i,Wt(t)/i]}function it(n,t){return[Qt(tr((Ft+t)/2)),-n]}var et=function(){return new r};r.prototype={constructor:r,reset:function(){this.s=this.t=0},add:function(n){i(Gt,n,this.t),i(this,Gt.s,this.s),this.s?this.t+=Gt.t:this.s=Gt.t},valueOf:function(){return this.s}};var ot,ut,ct,at,lt,ft,st,pt,ht,gt,vt,dt,Et,yt,St,mt,Mt,xt,_t,Nt,wt,Pt,Rt,At,Ct,jt,qt,zt,bt,Lt,Ot,Gt=new r,Tt=1e-6,kt=Math.PI,Ft=kt/2,It=kt/4,Bt=2*kt,Dt=180/kt,Ut=kt/180,Xt=Math.abs,Yt=Math.atan,Zt=Math.atan2,Ht=Math.cos,Jt=Math.ceil,Kt=Math.exp,Qt=Math.log,Vt=Math.pow,Wt=Math.sin,$t=Math.sign||function(n){return n>0?1:n<0?-1:0},nr=Math.sqrt,tr=Math.tan,rr={Feature:function(n,t){a(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)a(r[i].geometry,t)}},ir={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)n=r[i],t.point(n[0],n[1],n[2])},LineString:function(n,t){l(n.coordinates,t,0)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)l(r[i],t,0)},Polygon:function(n,t){f(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)f(r[i],t)},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)a(r[i],t)}},er=function(n,t){n&&rr.hasOwnProperty(n.type)?rr[n.type](n,t):a(n,t)},or=et(),ur=et(),cr={point:c,lineStart:c,lineEnd:c,polygonStart:function(){or.reset(),cr.lineStart=s,cr.lineEnd=p},polygonEnd:function(){var n=+or;ur.add(n<0?Bt+n:n),this.lineStart=this.lineEnd=this.point=c},sphere:function(){ur.add(Bt)}},ar=et(),lr={point:x,lineStart:N,lineEnd:w,polygonStart:function(){lr.point=P,lr.lineStart=R,lr.lineEnd=A,ar.reset(),cr.polygonStart()},polygonEnd:function(){cr.polygonEnd(),lr.point=x,lr.lineStart=N,lr.lineEnd=w,or<0?(ft=-(pt=180),st=-(ht=90)):ar>Tt?ht=90:ar<-Tt&&(st=-90),St[0]=ft,St[1]=pt}},fr={sphere:c,point:z,lineStart:L,lineEnd:T,polygonStart:function(){fr.lineStart=k,fr.lineEnd=F},polygonEnd:function(){fr.lineStart=L,fr.lineEnd=T}},sr=function(n){return function(){return n}},pr=function(n,t){function r(r,i){return r=n(r,i),t(r[0],r[1])}return n.invert&&t.invert&&(r.invert=function(r,i){return(r=t.invert(r,i))&&n.invert(r[0],r[1])}),r};D.invert=D;var hr,gr,vr,dr,Er,yr,Sr,mr,Mr,xr,_r,Nr=function(n){function t(t){return t=n(t[0]*Ut,t[1]*Ut),t[0]*=Dt,t[1]*=Dt,t}return n=U(n[0]*Ut,n[1]*Ut,n.length>2?n[2]*Ut:0),t.invert=function(t){return t=n.invert(t[0]*Ut,t[1]*Ut),t[0]*=Dt,t[1]*=Dt,t},t},wr=function(){var n,t=[];return{point:function(t,r){n.push([t,r])},lineStart:function(){t.push(n=[])},lineEnd:c,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}},Pr=function(n,t,r,i,e,o){var u,c=n[0],a=n[1],l=0,f=1,s=t[0]-c,p=t[1]-a;if(u=r-c,s||!(u>0)){if(u/=s,s<0){if(u<l)return;u<f&&(f=u)}else if(s>0){if(u>f)return;u>l&&(l=u)}if(u=e-c,s||!(u<0)){if(u/=s,s<0){if(u>f)return;u>l&&(l=u)}else if(s>0){if(u<l)return;u<f&&(f=u)}if(u=i-a,p||!(u>0)){if(u/=p,p<0){if(u<l)return;u<f&&(f=u)}else if(p>0){if(u>f)return;u>l&&(l=u)}if(u=o-a,p||!(u<0)){if(u/=p,p<0){if(u>f)return;u>l&&(l=u)}else if(p>0){if(u<l)return;u<f&&(f=u)}return l>0&&(n[0]=c+l*s,n[1]=a+l*p),f<1&&(t[0]=c+f*s,t[1]=a+f*p),!0}}}}},Rr=function(n,t){return Xt(n[0]-t[0])<Tt&&Xt(n[1]-t[1])<Tt},Ar=function(n,t,r,i,e){var o,u,c=[],a=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,r,i=n[0],u=n[t];if(Rr(i,u)){for(e.lineStart(),o=0;o<t;++o)e.point((i=n[o])[0],i[1]);e.lineEnd()}else c.push(r=new K(i,n,null,!0)),a.push(r.o=new K(i,null,r,!1)),c.push(r=new K(u,n,null,!1)),a.push(r.o=new K(u,null,r,!0))}}),c.length){for(a.sort(t),Q(c),Q(a),o=0,u=a.length;o<u;++o)a[o].e=r=!r;for(var l,f,s=c[0];;){for(var p=s,h=!0;p.v;)if((p=p.n)===s)return;l=p.z,e.lineStart();do{if(p.v=p.o.v=!0,p.e){if(h)for(o=0,u=l.length;o<u;++o)e.point((f=l[o])[0],f[1]);else i(p.x,p.n.x,1,e);p=p.n}else{if(h)for(l=p.p.z,o=l.length-1;o>=0;--o)e.point((f=l[o])[0],f[1]);else i(p.x,p.p.x,-1,e);p=p.p}l=(p=p.o).z,h=!h}while(!p.v);e.lineEnd()}}},Cr=1e9,jr=-Cr,qr=et(),zr=function(n,t){var r=t[0],i=t[1],e=[Wt(r),-Ht(r),0],u=0,c=0;qr.reset();for(var a=0,l=n.length;a<l;++a)if(s=(f=n[a]).length)for(var f,s,p=f[s-1],h=p[0],g=p[1]/2+It,v=Wt(g),E=Ht(g),S=0;S<s;++S,h=x,v=N,E=w,p=m){var m=f[S],x=m[0],_=m[1]/2+It,N=Wt(_),w=Ht(_),P=x-h,R=P>=0?1:-1,A=R*P,C=A>kt,j=v*N;if(qr.add(Zt(j*R*Wt(A),E*w+j*Ht(A))),u+=C?P+R*Bt:P,C^h>=r^x>=r){var q=y(d(p),d(m));M(q);var z=y(e,q);M(z);var b=(C^P>=0?-1:1)*o(z[2]);(i>b||i===b&&(q[0]||q[1]))&&(c+=C^P>=0?1:-1)}}return(u<-Tt||u<Tt&&qr<-Tt)^1&c},br=et(),Lr={sphere:c,point:c,lineStart:function(){Lr.point=$,Lr.lineEnd=W},lineEnd:c,polygonStart:c,polygonEnd:c},Or=function(n){return br.reset(),er(n,Lr),+br},Gr=[null,null],Tr={type:"LineString",coordinates:Gr},kr=function(n,t){return Gr[0]=n,Gr[1]=t,Or(Tr)},Fr={Feature:function(n,t){return tn(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)if(tn(r[i].geometry,t))return!0;return!1}},Ir={Sphere:function(){return!0},Point:function(n,t){return rn(n.coordinates,t)},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)if(rn(r[i],t))return!0;return!1},LineString:function(n,t){return en(n.coordinates,t)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)if(en(r[i],t))return!0;return!1},Polygon:function(n,t){return on(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)if(on(r[i],t))return!0;return!1},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)if(tn(r[i],t))return!0;return!1}},Br=function(n){return n},Dr=et(),Ur=et(),Xr={point:c,lineStart:c,lineEnd:c,polygonStart:function(){Xr.lineStart=sn,Xr.lineEnd=gn},polygonEnd:function(){Xr.lineStart=Xr.lineEnd=Xr.point=c,Dr.add(Xt(Ur)),Ur.reset()},result:function(){var n=Dr/2;return Dr.reset(),n}},Yr=1/0,Zr=Yr,Hr=-Yr,Jr=Hr,Kr={point:function(n,t){n<Yr&&(Yr=n),n>Hr&&(Hr=n),t<Zr&&(Zr=t),t>Jr&&(Jr=t)},lineStart:c,lineEnd:c,polygonStart:c,polygonEnd:c,result:function(){var n=[[Yr,Zr],[Hr,Jr]];return Hr=Jr=-(Zr=Yr=1/0),n}},Qr=0,Vr=0,Wr=0,$r=0,ni=0,ti=0,ri=0,ii=0,ei=0,oi={point:vn,lineStart:dn,lineEnd:Sn,polygonStart:function(){oi.lineStart=mn,oi.lineEnd=Mn},polygonEnd:function(){oi.point=vn,oi.lineStart=dn,oi.lineEnd=Sn},result:function(){var n=ei?[ri/ei,ii/ei]:ti?[$r/ti,ni/ti]:Wr?[Qr/Wr,Vr/Wr]:[NaN,NaN];return Qr=Vr=Wr=$r=ni=ti=ri=ii=ei=0,n}};Nn.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:this._context.moveTo(n,t),this._point=1;break;case 1:this._context.lineTo(n,t);break;default:this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Bt)}},result:c};var ui,ci,ai,li,fi,si=et(),pi={point:c,lineStart:function(){pi.point=wn},lineEnd:function(){ui&&Pn(ci,ai),pi.point=c},polygonStart:function(){ui=!0},polygonEnd:function(){ui=null},result:function(){var n=+si;return si.reset(),n}};Rn.prototype={_radius:4.5,_circle:An(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:this._string.push("M",n,",",t),this._point=1;break;case 1:this._string.push("L",n,",",t);break;default:null==this._circle&&(this._circle=An(this._radius)),this._string.push("M",n,",",t,this._circle)}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}return null}};var hi=function(n,r,i,e){return function(o,u){function c(t,r){var i=o(t,r);n(t=i[0],r=i[1])&&u.point(t,r)}function a(n,t){var r=o(n,t);E.point(r[0],r[1])}function l(){x.point=a,E.lineStart()}function f(){x.point=c,E.lineEnd()}function s(n,t){d.push([n,t]);var r=o(n,t);m.point(r[0],r[1])}function p(){m.lineStart(),d=[]}function h(){s(d[0][0],d[0][1]),m.lineEnd();var n,t,r,i,e=m.clean(),o=S.result(),c=o.length;if(d.pop(),g.push(d),d=null,c)if(1&e){if(r=o[0],(t=r.length-1)>0){for(M||(u.polygonStart(),M=!0),u.lineStart(),n=0;n<t;++n)u.point((i=r[n])[0],i[1]);u.lineEnd()}}else c>1&&2&e&&o.push(o.pop().concat(o.shift())),v.push(o.filter(Cn))}var g,v,d,E=r(u),y=o.invert(e[0],e[1]),S=wr(),m=r(S),M=!1,x={point:c,lineStart:l,lineEnd:f,polygonStart:function(){x.point=s,x.lineStart=p,x.lineEnd=h,v=[],g=[]},polygonEnd:function(){x.point=c,x.lineStart=l,x.lineEnd=f,v=t.merge(v);var n=zr(g,y);v.length?(M||(u.polygonStart(),M=!0),Ar(v,jn,n,i,u)):n&&(M||(u.polygonStart(),M=!0),u.lineStart(),i(null,null,1,u),u.lineEnd()),M&&(u.polygonEnd(),M=!1),v=g=null},sphere:function(){u.polygonStart(),u.lineStart(),i(null,null,1,u),u.lineEnd(),u.polygonEnd()}};return x}},gi=hi(function(){return!0},function(n){var t,r=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var c=o>0?kt:-kt,a=Xt(o-r);Xt(a-kt)<Tt?(n.point(r,i=(i+u)/2>0?Ft:-Ft),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),n.point(o,i),t=0):e!==c&&a>=kt&&(Xt(r-e)<Tt&&(r-=e*Tt),Xt(o-c)<Tt&&(o-=c*Tt),i=qn(r,i,o,u),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),t=0),n.point(r=o,i=u),e=c},lineEnd:function(){n.lineEnd(),r=i=NaN},clean:function(){return 2-t}}},function(n,t,r,i){var e;if(null==n)e=r*Ft,i.point(-kt,e),i.point(0,e),i.point(kt,e),i.point(kt,0),i.point(kt,-e),i.point(0,-e),i.point(-kt,-e),i.point(-kt,0),i.point(-kt,e);else if(Xt(n[0]-t[0])>Tt){var o=n[0]<t[0]?kt:-kt;e=r*o/2,i.point(-o,e),i.point(0,e),i.point(o,e)}else i.point(t[0],t[1])},[-kt,-Ft]),vi=function(n,t){function r(n,t){return Ht(n)*Ht(t)>o}function i(n,t,r){var i=[1,0,0],e=y(d(n),d(t)),u=E(e,e),c=e[0],a=u-c*c;if(!a)return!r&&n;var l=o*u/a,f=-o*c/a,s=y(i,e),p=m(i,l);S(p,m(e,f));var h=s,g=E(p,h),M=E(h,h),x=g*g-M*(E(p,p)-1);if(!(x<0)){var _=nr(x),N=m(h,(-g-_)/M);if(S(N,p),N=v(N),!r)return N;var w,P=n[0],R=t[0],A=n[1],C=t[1];R<P&&(w=P,P=R,R=w);var j=R-P,q=Xt(j-kt)<Tt,z=q||j<Tt;if(!q&&C<A&&(w=A,A=C,C=w),z?q?A+C>0^N[1]<(Xt(N[0]-P)<Tt?A:C):A<=N[1]&&N[1]<=C:j>kt^(P<=N[0]&&N[0]<=R)){var b=m(h,(-g+_)/M);return S(b,p),[N,v(b)]}}}function e(t,r){var i=u?n:kt-n,e=0;return t<-i?e|=1:t>i&&(e|=2),r<-i?e|=4:r>i&&(e|=8),e}var o=Ht(n),u=o>0,c=Xt(o)>Tt;return hi(r,function(n){var t,o,a,l,f;return{lineStart:function(){l=a=!1,f=1},point:function(s,p){var h,g=[s,p],v=r(s,p),d=u?v?0:e(s,p):v?e(s+(s<0?kt:-kt),p):0;if(!t&&(l=a=v)&&n.lineStart(),v!==a&&(!(h=i(t,g))||Rr(t,h)||Rr(g,h))&&(g[0]+=Tt,g[1]+=Tt,v=r(g[0],g[1])),v!==a)f=0,v?(n.lineStart(),h=i(g,t),n.point(h[0],h[1])):(h=i(t,g),n.point(h[0],h[1]),n.lineEnd()),t=h;else if(c&&t&&u^v){var E;d&o||!(E=i(g,t,!0))||(f=0,u?(n.lineStart(),n.point(E[0][0],E[0][1]),n.point(E[1][0],E[1][1]),n.lineEnd()):(n.point(E[1][0],E[1][1]),n.lineEnd(),n.lineStart(),n.point(E[0][0],E[0][1])))}!v||t&&Rr(t,g)||n.point(g[0],g[1]),t=g,a=v,o=d},lineEnd:function(){a&&n.lineEnd(),t=null},clean:function(){return f|(l&&a)<<1}}},function(r,i,e,o){H(o,n,t,e,r,i)},u?[0,-n]:[-kt,n-kt])};bn.prototype={constructor:bn,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var di=16,Ei=Ht(30*Ut),yi=function(n,t){return+t?Tn(n,t):Gn(n)},Si=zn({point:function(n,t){this.stream.point(n*Ut,t*Ut)}}),mi=function(){return In(Dn).scale(155.424).center([0,33.6442])},Mi=function(){return mi().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])},xi=Xn(function(n){return nr(2/(1+n))});xi.invert=Yn(function(n){return 2*o(n/2)});var _i=Xn(function(n){return(n=e(n))&&n/Wt(n)});_i.invert=Yn(function(n){return n});Zn.invert=function(n,t){return[n,2*Yt(Kt(t))-Ft]};Qn.invert=Qn;Wn.invert=Yn(Yt);nt.invert=function(n,t){var r,i=t,e=25;do{var o=i*i,u=o*o;i-=r=(i*(1.007226+o*(.015085+u*(.028874*o-.044475-.005916*u)))-t)/(1.007226+o*(.045255+u*(.259866*o-.311325-.005916*11*u)))}while(Xt(r)>Tt&&--e>0);return[n/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]};tt.invert=Yn(o);rt.invert=Yn(function(n){return 2*Yt(n)});it.invert=function(n,t){return[-t,2*Yt(Kt(n))-Ft]};n.geoArea=function(n){return ur.reset(),er(n,cr),2*ur},n.geoBounds=function(n){var t,r,i,e,o,u,c;if(ht=pt=-(ft=st=1/0),yt=[],er(n,lr),r=yt.length){for(yt.sort(j),t=1,o=[i=yt[0]];t<r;++t)q(i,(e=yt[t])[0])||q(i,e[1])?(C(i[0],e[1])>C(i[0],i[1])&&(i[1]=e[1]),C(e[0],i[1])>C(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(u=-1/0,t=0,i=o[r=o.length-1];t<=r;i=e,++t)e=o[t],(c=C(i[1],e[0]))>u&&(u=c,ft=e[0],pt=i[1])}return yt=St=null,ft===1/0||st===1/0?[[NaN,NaN],[NaN,NaN]]:[[ft,st],[pt,ht]]},n.geoCentroid=function(n){mt=Mt=xt=_t=Nt=wt=Pt=Rt=At=Ct=jt=0,er(n,fr);var t=At,r=Ct,i=jt,e=t*t+r*r+i*i;return e<1e-12&&(t=wt,r=Pt,i=Rt,Mt<Tt&&(t=xt,r=_t,i=Nt),(e=t*t+r*r+i*i)<1e-12)?[NaN,NaN]:[Zt(r,t)*Dt,o(i/nr(e))*Dt]},n.geoCircle=function(){function n(){var n=i.apply(this,arguments),c=e.apply(this,arguments)*Ut,a=o.apply(this,arguments)*Ut;return t=[],r=U(-n[0]*Ut,-n[1]*Ut,0).invert,H(u,c,a,1),n={type:"Polygon",coordinates:[t]},t=r=null,n}var t,r,i=sr([0,0]),e=sr(90),o=sr(6),u={point:function(n,i){t.push(n=r(n,i)),n[0]*=Dt,n[1]*=Dt}};return n.center=function(t){return arguments.length?(i="function"==typeof t?t:sr([+t[0],+t[1]]),n):i},n.radius=function(t){return arguments.length?(e="function"==typeof t?t:sr(+t),n):e},n.precision=function(t){return arguments.length?(o="function"==typeof t?t:sr(+t),n):o},n},n.geoClipExtent=function(){var n,t,r,i=0,e=0,o=960,u=500;return r={stream:function(r){return n&&t===r?n:n=V(i,e,o,u)(t=r)},extent:function(c){return arguments.length?(i=+c[0][0],e=+c[0][1],o=+c[1][0],u=+c[1][1],n=t=null,r):[[i,e],[o,u]]}}},n.geoContains=function(n,t){return(n&&Fr.hasOwnProperty(n.type)?Fr[n.type]:tn)(n,t)},n.geoDistance=kr,n.geoGraticule=fn,n.geoGraticule10=function(){return fn()()},n.geoInterpolate=function(n,t){var r=n[0]*Ut,i=n[1]*Ut,e=t[0]*Ut,c=t[1]*Ut,a=Ht(i),l=Wt(i),f=Ht(c),s=Wt(c),p=a*Ht(r),h=a*Wt(r),g=f*Ht(e),v=f*Wt(e),d=2*o(nr(u(c-i)+a*f*u(e-r))),E=Wt(d),y=d?function(n){var t=Wt(n*=d)/E,r=Wt(d-n)/E,i=r*p+t*g,e=r*h+t*v,o=r*l+t*s;return[Zt(e,i)*Dt,Zt(o,nr(i*i+e*e))*Dt]}:function(){return[r*Dt,i*Dt]};return y.distance=d,y},n.geoLength=Or,n.geoPath=function(n,t){function r(n){return n&&("function"==typeof o&&e.pointRadius(+o.apply(this,arguments)),er(n,i(e))),e.result()}var i,e,o=4.5;return r.area=function(n){return er(n,i(Xr)),Xr.result()},r.measure=function(n){return er(n,i(pi)),pi.result()},r.bounds=function(n){return er(n,i(Kr)),Kr.result()},r.centroid=function(n){return er(n,i(oi)),oi.result()},r.projection=function(t){return arguments.length?(i=null==t?(n=null,Br):(n=t).stream,r):n},r.context=function(n){return arguments.length?(e=null==n?(t=null,new Rn):new Nn(t=n),"function"!=typeof o&&e.pointRadius(o),r):t},r.pointRadius=function(n){return arguments.length?(o="function"==typeof n?n:(e.pointRadius(+n),+n),r):o},r.projection(n).context(t)},n.geoAlbers=Mi,n.geoAlbersUsa=function(){function n(n){var t=n[0],r=n[1];return c=null,e.point(t,r),c||(o.point(t,r),c)||(u.point(t,r),c)}function t(){return r=i=null,n}var r,i,e,o,u,c,a=Mi(),l=mi().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=mi().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(n,t){c=[n,t]}};return n.invert=function(n){var t=a.scale(),r=a.translate(),i=(n[0]-r[0])/t,e=(n[1]-r[1])/t;return(e>=.12&&e<.234&&i>=-.425&&i<-.214?l:e>=.166&&e<.234&&i>=-.214&&i<-.115?f:a).invert(n)},n.stream=function(n){return r&&i===n?r:r=Un([a.stream(i=n),l.stream(n),f.stream(n)])},n.precision=function(n){return arguments.length?(a.precision(n),l.precision(n),f.precision(n),t()):a.precision()},n.scale=function(t){return arguments.length?(a.scale(t),l.scale(.35*t),f.scale(t),n.translate(a.translate())):a.scale()},n.translate=function(n){if(!arguments.length)return a.translate();var r=a.scale(),i=+n[0],c=+n[1];return e=a.translate(n).clipExtent([[i-.455*r,c-.238*r],[i+.455*r,c+.238*r]]).stream(s),o=l.translate([i-.307*r,c+.201*r]).clipExtent([[i-.425*r+Tt,c+.12*r+Tt],[i-.214*r-Tt,c+.234*r-Tt]]).stream(s),u=f.translate([i-.205*r,c+.212*r]).clipExtent([[i-.214*r+Tt,c+.166*r+Tt],[i-.115*r-Tt,c+.234*r-Tt]]).stream(s),t()},n.fitExtent=function(t,r){return Ln(n,t,r)},n.fitSize=function(t,r){return On(n,t,r)},n.scale(1070)},n.geoAzimuthalEqualArea=function(){return kn(xi).scale(124.75).clipAngle(179.999)},n.geoAzimuthalEqualAreaRaw=xi,n.geoAzimuthalEquidistant=function(){return kn(_i).scale(79.4188).clipAngle(179.999)},n.geoAzimuthalEquidistantRaw=_i,n.geoConicConformal=function(){return In(Kn).scale(109.5).parallels([30,30])},n.geoConicConformalRaw=Kn,n.geoConicEqualArea=mi,n.geoConicEqualAreaRaw=Dn,n.geoConicEquidistant=function(){return In(Vn).scale(131.154).center([0,13.9389])},n.geoConicEquidistantRaw=Vn,n.geoEquirectangular=function(){return kn(Qn).scale(152.63)},n.geoEquirectangularRaw=Qn,n.geoGnomonic=function(){return kn(Wn).scale(144.049).clipAngle(60)},n.geoGnomonicRaw=Wn,n.geoIdentity=function(){function n(){return e=o=null,u}var t,r,i,e,o,u,c=1,a=0,l=0,f=1,s=1,p=Br,h=null,g=Br;return u={stream:function(n){return e&&o===n?e:e=p(g(o=n))},clipExtent:function(e){return arguments.length?(g=null==e?(h=t=r=i=null,Br):V(h=+e[0][0],t=+e[0][1],r=+e[1][0],i=+e[1][1]),n()):null==h?null:[[h,t],[r,i]]},scale:function(t){return arguments.length?(p=$n((c=+t)*f,c*s,a,l),n()):c},translate:function(t){return arguments.length?(p=$n(c*f,c*s,a=+t[0],l=+t[1]),n()):[a,l]},reflectX:function(t){return arguments.length?(p=$n(c*(f=t?-1:1),c*s,a,l),n()):f<0},reflectY:function(t){return arguments.length?(p=$n(c*f,c*(s=t?-1:1),a,l),n()):s<0},fitExtent:function(n,t){return Ln(u,n,t)},fitSize:function(n,t){return On(u,n,t)}}},n.geoProjection=kn,n.geoProjectionMutator=Fn,n.geoMercator=function(){return Hn(Zn).scale(961/Bt)},n.geoMercatorRaw=Zn,n.geoNaturalEarth1=function(){return kn(nt).scale(175.295)},n.geoNaturalEarth1Raw=nt,n.geoOrthographic=function(){return kn(tt).scale(249.5).clipAngle(90+Tt)},n.geoOrthographicRaw=tt,n.geoStereographic=function(){return kn(rt).scale(250).clipAngle(142)},n.geoStereographicRaw=rt,n.geoTransverseMercator=function(){var n=Hn(it),t=n.center,r=n.rotate;return n.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)},n.geoTransverseMercatorRaw=it,n.geoRotation=Nr,n.geoStream=er,n.geoTransform=function(n){return{stream:zn(n)}},Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-geo/ Version 1.8.1. Copyright 2017 Mike Bostock. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],t):t(n.d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";function r(){this.reset()}function i(n,t,r){var i=n.s=t+r,e=i-t,o=i-e;n.t=t-o+(r-e)}function e(n){return n>1?0:n<-1?Ft:Math.acos(n)}function o(n){return n>1?It:n<-1?-It:Math.asin(n)}function u(n){return(n=$t(n/2))*n}function c(){}function a(n,t){n&&er.hasOwnProperty(n.type)&&er[n.type](n,t)}function l(n,t,r){var i,e=-1,o=n.length-r;for(t.lineStart();++e<o;)i=n[e],t.point(i[0],i[1],i[2]);t.lineEnd()}function f(n,t){var r=-1,i=n.length;for(t.polygonStart();++r<i;)l(n[r],t,1);t.polygonEnd()}function p(){ar.point=h}function s(){g(ut,ct)}function h(n,t){ar.point=g,ut=n,ct=t,at=n*=Xt,lt=Jt(t=(t*=Xt)/2+Bt),ft=$t(t)}function g(n,t){t=(t*=Xt)/2+Bt;var r=(n*=Xt)-at,i=r>=0?1:-1,e=i*r,o=Jt(t),u=$t(t),c=ft*u,a=lt*o+c*Jt(e),l=c*i*$t(e);ur.add(Ht(l,a)),at=n,lt=o,ft=u}function v(n){return[Ht(n[1],n[0]),o(n[2])]}function d(n){var t=n[0],r=n[1],i=Jt(r);return[i*Jt(t),i*$t(t),$t(r)]}function E(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function y(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function S(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function m(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function M(n){var t=tr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function x(n,t){St.push(mt=[pt=n,ht=n]),t<st&&(st=t),t>gt&&(gt=t)}function _(n,t){var r=d([n*Xt,t*Xt]);if(yt){var i=y(yt,r),e=y([i[1],-i[0],0],i);M(e),e=v(e);var o,u=n-vt,c=u>0?1:-1,a=e[0]*Ut*c,l=Yt(u)>180;l^(c*vt<a&&a<c*n)?(o=e[1]*Ut)>gt&&(gt=o):(a=(a+360)%360-180,l^(c*vt<a&&a<c*n)?(o=-e[1]*Ut)<st&&(st=o):(t<st&&(st=t),t>gt&&(gt=t))),l?n<vt?A(pt,n)>A(pt,ht)&&(ht=n):A(n,ht)>A(pt,ht)&&(pt=n):ht>=pt?(n<pt&&(pt=n),n>ht&&(ht=n)):n>vt?A(pt,n)>A(pt,ht)&&(ht=n):A(n,ht)>A(pt,ht)&&(pt=n)}else St.push(mt=[pt=n,ht=n]);t<st&&(st=t),t>gt&&(gt=t),yt=r,vt=n}function N(){fr.point=_}function w(){mt[0]=pt,mt[1]=ht,fr.point=x,yt=null}function C(n,t){if(yt){var r=n-vt;lr.add(Yt(r)>180?r+(r>0?360:-360):r)}else dt=n,Et=t;ar.point(n,t),_(n,t)}function P(){ar.lineStart()}function R(){C(dt,Et),ar.lineEnd(),Yt(lr)>kt&&(pt=-(ht=180)),mt[0]=pt,mt[1]=ht,yt=null}function A(n,t){return(t-=n)<0?t+360:t}function j(n,t){return n[0]-t[0]}function q(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}function z(n,t){n*=Xt;var r=Jt(t*=Xt);b(r*Jt(n),r*$t(n),$t(t))}function b(n,t,r){_t+=(n-_t)/++Mt,Nt+=(t-Nt)/Mt,wt+=(r-wt)/Mt}function L(){pr.point=O}function O(n,t){n*=Xt;var r=Jt(t*=Xt);Lt=r*Jt(n),Ot=r*$t(n),Gt=$t(t),pr.point=G,b(Lt,Ot,Gt)}function G(n,t){n*=Xt;var r=Jt(t*=Xt),i=r*Jt(n),e=r*$t(n),o=$t(t),u=Ht(tr((u=Ot*o-Gt*e)*u+(u=Gt*i-Lt*o)*u+(u=Lt*e-Ot*i)*u),Lt*i+Ot*e+Gt*o);xt+=u,Ct+=u*(Lt+(Lt=i)),Pt+=u*(Ot+(Ot=e)),Rt+=u*(Gt+(Gt=o)),b(Lt,Ot,Gt)}function T(){pr.point=z}function k(){pr.point=I}function F(){B(zt,bt),pr.point=z}function I(n,t){zt=n,bt=t,n*=Xt,t*=Xt,pr.point=B;var r=Jt(t);Lt=r*Jt(n),Ot=r*$t(n),Gt=$t(t),b(Lt,Ot,Gt)}function B(n,t){n*=Xt;var r=Jt(t*=Xt),i=r*Jt(n),e=r*$t(n),u=$t(t),c=Ot*u-Gt*e,a=Gt*i-Lt*u,l=Lt*e-Ot*i,f=tr(c*c+a*a+l*l),p=o(f),s=f&&-p/f;At+=s*c,jt+=s*a,qt+=s*l,xt+=p,Ct+=p*(Lt+(Lt=i)),Pt+=p*(Ot+(Ot=e)),Rt+=p*(Gt+(Gt=u)),b(Lt,Ot,Gt)}function D(n,t){return[n>Ft?n-Dt:n<-Ft?n+Dt:n,t]}function U(n,t,r){return(n%=Dt)?t||r?hr(Y(n),Z(t,r)):Y(n):t||r?Z(t,r):D}function X(n){return function(t,r){return t+=n,[t>Ft?t-Dt:t<-Ft?t+Dt:t,r]}}function Y(n){var t=X(n);return t.invert=X(-n),t}function Z(n,t){function r(n,t){var r=Jt(t),a=Jt(n)*r,l=$t(n)*r,f=$t(t),p=f*i+a*e;return[Ht(l*u-p*c,a*i-f*e),o(p*u+l*c)]}var i=Jt(n),e=$t(n),u=Jt(t),c=$t(t);return r.invert=function(n,t){var r=Jt(t),a=Jt(n)*r,l=$t(n)*r,f=$t(t),p=f*u-l*c;return[Ht(l*u+f*c,a*i+p*e),o(p*i-a*e)]},r}function H(n,t,r,i,e,o){if(r){var u=Jt(t),c=$t(t),a=i*r;null==e?(e=t+i*Dt,o=t-a/2):(e=J(u,e),o=J(u,o),(i>0?e<o:e>o)&&(e+=i*Dt));for(var l,f=e;i>0?f>o:f<o;f-=a)l=v([u,-c*Jt(f),-c*$t(f)]),n.point(l[0],l[1])}}function J(n,t){(t=d(t))[0]-=n,M(t);var r=e(-t[1]);return((-t[2]<0?-r:r)+Dt-kt)%Dt}function K(n,t,r,i){this.x=n,this.z=t,this.o=r,this.e=i,this.v=!1,this.n=this.p=null}function Q(n){if(t=n.length){for(var t,r,i=0,e=n[0];++i<t;)e.n=r=n[i],r.p=e,e=r;e.n=r=n[0],r.p=e}}function V(n){return n.length>1}function W(n,t){return((n=n.x)[0]<0?n[1]-It-kt:It-n[1])-((t=t.x)[0]<0?t[1]-It-kt:It-t[1])}function $(n,t,r,i){var e,o,u=$t(n-r);return Yt(u)>kt?Zt(($t(t)*(o=Jt(i))*$t(r)-$t(i)*(e=Jt(t))*$t(n))/(e*o*u)):(t+i)/2}function nn(n,r,i,e){function o(t,o){return n<=t&&t<=i&&r<=o&&o<=e}function u(t,o,u,a){var f=0,p=0;if(null==t||(f=c(t,u))!==(p=c(o,u))||l(t,o)<0^u>0)do{a.point(0===f||3===f?n:i,f>1?e:r)}while((f=(f+u+4)%4)!==p);else a.point(o[0],o[1])}function c(t,e){return Yt(t[0]-n)<kt?e>0?0:3:Yt(t[0]-i)<kt?e>0?2:1:Yt(t[1]-r)<kt?e>0?1:0:e>0?3:2}function a(n,t){return l(n.x,t.x)}function l(n,t){var r=c(n,1),i=c(t,1);return r!==i?r-i:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(c){function l(n,t){o(n,t)&&_.point(n,t)}function f(){for(var t=0,r=0,i=h.length;r<i;++r)for(var o,u,c=h[r],a=1,l=c.length,f=c[0],p=f[0],s=f[1];a<l;++a)o=p,u=s,p=(f=c[a])[0],s=f[1],u<=e?s>e&&(p-o)*(e-u)>(s-u)*(n-o)&&++t:s<=e&&(p-o)*(e-u)<(s-u)*(n-o)&&--t;return t}function p(t,u){var c=o(t,u);if(h&&g.push([t,u]),M)v=t,d=u,E=c,M=!1,c&&(_.lineStart(),_.point(t,u));else if(c&&m)_.point(t,u);else{var a=[y=Math.max(Gr,Math.min(Or,y)),S=Math.max(Gr,Math.min(Or,S))],l=[t=Math.max(Gr,Math.min(Or,t)),u=Math.max(Gr,Math.min(Or,u))];Lr(a,l,n,r,i,e)?(m||(_.lineStart(),_.point(a[0],a[1])),_.point(l[0],l[1]),c||_.lineEnd(),x=!1):c&&(_.lineStart(),_.point(t,u),x=!1)}y=t,S=u,m=c}var s,h,g,v,d,E,y,S,m,M,x,_=c,N=Cr(),w={point:l,lineStart:function(){w.point=p,h&&h.push(g=[]),M=!0,m=!1,y=S=NaN},lineEnd:function(){s&&(p(v,d),E&&m&&N.rejoin(),s.push(N.result())),w.point=l,m&&_.lineEnd()},polygonStart:function(){_=N,s=[],h=[],x=!0},polygonEnd:function(){var n=f(),r=x&&n,i=(s=t.merge(s)).length;(r||i)&&(c.polygonStart(),r&&(c.lineStart(),u(null,null,1,c),c.lineEnd()),i&&Rr(s,a,n,u,c),c.polygonEnd()),_=c,s=h=g=null}};return w}}function tn(){kr.point=kr.lineEnd=c}function rn(n,t){gr=n*=Xt,vr=$t(t*=Xt),dr=Jt(t),kr.point=en}function en(n,t){n*=Xt;var r=$t(t*=Xt),i=Jt(t),e=Yt(n-gr),o=Jt(e),u=i*$t(e),c=dr*r-vr*i*o,a=vr*r+dr*i*o;Tr.add(Ht(tr(u*u+c*c),a)),gr=n,vr=r,dr=i}function on(n,t){return!(!n||!Xr.hasOwnProperty(n.type))&&Xr[n.type](n,t)}function un(n,t){return 0===Dr(n,t)}function cn(n,t){var r=Dr(n[0],n[1]);return Dr(n[0],t)+Dr(t,n[1])<=r+kt}function an(n,t){return!!jr(n.map(ln),fn(t))}function ln(n){return(n=n.map(fn)).pop(),n}function fn(n){return[n[0]*Xt,n[1]*Xt]}function pn(n,r,i){var e=t.range(n,r-kt,i).concat(r);return function(n){return e.map(function(t){return[n,t]})}}function sn(n,r,i){var e=t.range(n,r-kt,i).concat(r);return function(n){return e.map(function(t){return[t,n]})}}function hn(){function n(){return{type:"MultiLineString",coordinates:r()}}function r(){return t.range(Kt(u/E)*E,o,E).map(h).concat(t.range(Kt(f/y)*y,l,y).map(g)).concat(t.range(Kt(e/v)*v,i,v).filter(function(n){return Yt(n%E)>kt}).map(p)).concat(t.range(Kt(a/d)*d,c,d).filter(function(n){return Yt(n%y)>kt}).map(s))}var i,e,o,u,c,a,l,f,p,s,h,g,v=10,d=v,E=90,y=360,S=2.5;return n.lines=function(){return r().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(l).slice(1),h(o).reverse().slice(1),g(f).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.extentMajor(t).extentMinor(t):n.extentMinor()},n.extentMajor=function(t){return arguments.length?(u=+t[0][0],o=+t[1][0],f=+t[0][1],l=+t[1][1],u>o&&(t=u,u=o,o=t),f>l&&(t=f,f=l,l=t),n.precision(S)):[[u,f],[o,l]]},n.extentMinor=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],a=+t[0][1],c=+t[1][1],e>i&&(t=e,e=i,i=t),a>c&&(t=a,a=c,c=t),n.precision(S)):[[e,a],[i,c]]},n.step=function(t){return arguments.length?n.stepMajor(t).stepMinor(t):n.stepMinor()},n.stepMajor=function(t){return arguments.length?(E=+t[0],y=+t[1],n):[E,y]},n.stepMinor=function(t){return arguments.length?(v=+t[0],d=+t[1],n):[v,d]},n.precision=function(t){return arguments.length?(S=+t,p=pn(a,c,90),s=sn(e,i,S),h=pn(f,l,90),g=sn(u,o,S),n):S},n.extentMajor([[-180,-90+kt],[180,90-kt]]).extentMinor([[-180,-80-kt],[180,80+kt]])}function gn(){Jr.point=vn}function vn(n,t){Jr.point=dn,Er=Sr=n,yr=mr=t}function dn(n,t){Hr.add(mr*n-Sr*t),Sr=n,mr=t}function En(){dn(Er,yr)}function yn(n,t){ni+=n,ti+=t,++ri}function Sn(){li.point=mn}function mn(n,t){li.point=Mn,yn(_r=n,Nr=t)}function Mn(n,t){var r=n-_r,i=t-Nr,e=tr(r*r+i*i);ii+=e*(_r+n)/2,ei+=e*(Nr+t)/2,oi+=e,yn(_r=n,Nr=t)}function xn(){li.point=yn}function _n(){li.point=wn}function Nn(){Cn(Mr,xr)}function wn(n,t){li.point=Cn,yn(Mr=_r=n,xr=Nr=t)}function Cn(n,t){var r=n-_r,i=t-Nr,e=tr(r*r+i*i);ii+=e*(_r+n)/2,ei+=e*(Nr+t)/2,oi+=e,ui+=(e=Nr*n-_r*t)*(_r+n),ci+=e*(Nr+t),ai+=3*e,yn(_r=n,Nr=t)}function Pn(n){this._context=n}function Rn(n,t){di.point=An,pi=hi=n,si=gi=t}function An(n,t){hi-=n,gi-=t,vi.add(tr(hi*hi+gi*gi)),hi=n,gi=t}function jn(){this._string=[]}function qn(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function zn(n){return function(t){var r=new bn;for(var i in n)r[i]=n[i];return r.stream=t,r}}function bn(){}function Ln(n,t,r){var i=t[1][0]-t[0][0],e=t[1][1]-t[0][1],o=n.clipExtent&&n.clipExtent();n.scale(150).translate([0,0]),null!=o&&n.clipExtent(null),or(r,n.stream($r));var u=$r.result(),c=Math.min(i/(u[1][0]-u[0][0]),e/(u[1][1]-u[0][1])),a=+t[0][0]+(i-c*(u[1][0]+u[0][0]))/2,l=+t[0][1]+(e-c*(u[1][1]+u[0][1]))/2;return null!=o&&n.clipExtent(o),n.scale(150*c).translate([a,l])}function On(n,t,r){return Ln(n,[[0,0],t],r)}function Gn(n){return zn({point:function(t,r){t=n(t,r),this.stream.point(t[0],t[1])}})}function Tn(n,t){function r(i,e,u,c,a,l,f,p,s,h,g,v,d,E){var y=f-i,S=p-e,m=y*y+S*S;if(m>4*t&&d--){var M=c+h,x=a+g,_=l+v,N=tr(M*M+x*x+_*_),w=o(_/=N),C=Yt(Yt(_)-1)<kt||Yt(u-s)<kt?(u+s)/2:Ht(x,M),P=n(C,w),R=P[0],A=P[1],j=R-i,q=A-e,z=S*j-y*q;(z*z/m>t||Yt((y*j+S*q)/m-.5)>.3||c*h+a*g+l*v<yi)&&(r(i,e,u,c,a,l,R,A,C,M/=N,x/=N,_,d,E),E.point(R,A),r(R,A,C,M,x,_,f,p,s,h,g,v,d,E))}}return function(t){function i(r,i){r=n(r,i),t.point(r[0],r[1])}function e(){y=NaN,_.point=o,t.lineStart()}function o(i,e){var o=d([i,e]),u=n(i,e);r(y,S,E,m,M,x,y=u[0],S=u[1],E=i,m=o[0],M=o[1],x=o[2],Ei,t),t.point(y,S)}function u(){_.point=i,t.lineEnd()}function c(){e(),_.point=a,_.lineEnd=l}function a(n,t){o(f=n,t),p=y,s=S,h=m,g=M,v=x,_.point=o}function l(){r(y,S,E,m,M,x,p,s,f,h,g,v,Ei,t),_.lineEnd=u,u()}var f,p,s,h,g,v,E,y,S,m,M,x,_={point:i,lineStart:e,lineEnd:u,polygonStart:function(){t.polygonStart(),_.lineStart=c},polygonEnd:function(){t.polygonEnd(),_.lineStart=e}};return _}}function kn(n){return zn({point:function(t,r){var i=n(t,r);return this.stream.point(i[0],i[1])}})}function Fn(n){return In(function(){return n})()}function In(n){function t(n){return n=f(n[0]*Xt,n[1]*Xt),[n[0]*d+c,a-n[1]*d]}function r(n){return(n=f.invert((n[0]-c)/d,(a-n[1])/d))&&[n[0]*Ut,n[1]*Ut]}function i(n,t){return n=u(n,t),[n[0]*d+c,a-n[1]*d]}function e(){f=hr(l=U(M,x,_),u);var n=u(S,m);return c=E-n[0]*d,a=y+n[1]*d,o()}function o(){return g=v=null,t}var u,c,a,l,f,p,s,h,g,v,d=150,E=480,y=250,S=0,m=0,M=0,x=0,_=0,N=null,w=zr,C=null,P=Yr,R=.5,A=Si(i,R);return t.stream=function(n){return g&&v===n?g:g=mi(kn(l)(w(A(P(v=n)))))},t.preclip=function(n){return arguments.length?(w=n,N=void 0,o()):w},t.postclip=function(n){return arguments.length?(P=n,C=p=s=h=null,o()):P},t.clipAngle=function(n){return arguments.length?(w=+n?br(N=n*Xt):(N=null,zr),o()):N*Ut},t.clipExtent=function(n){return arguments.length?(P=null==n?(C=p=s=h=null,Yr):nn(C=+n[0][0],p=+n[0][1],s=+n[1][0],h=+n[1][1]),o()):null==C?null:[[C,p],[s,h]]},t.scale=function(n){return arguments.length?(d=+n,e()):d},t.translate=function(n){return arguments.length?(E=+n[0],y=+n[1],e()):[E,y]},t.center=function(n){return arguments.length?(S=n[0]%360*Xt,m=n[1]%360*Xt,e()):[S*Ut,m*Ut]},t.rotate=function(n){return arguments.length?(M=n[0]%360*Xt,x=n[1]%360*Xt,_=n.length>2?n[2]%360*Xt:0,e()):[M*Ut,x*Ut,_*Ut]},t.precision=function(n){return arguments.length?(A=Si(i,R=n*n),o()):tr(R)},t.fitExtent=function(n,r){return Ln(t,n,r)},t.fitSize=function(n,r){return On(t,n,r)},function(){return u=n.apply(this,arguments),t.invert=u.invert&&r,e()}}function Bn(n){var t=0,r=Ft/3,i=In(n),e=i(t,r);return e.parallels=function(n){return arguments.length?i(t=n[0]*Xt,r=n[1]*Xt):[t*Ut,r*Ut]},e}function Dn(n){function t(n,t){return[n*r,$t(t)/r]}var r=Jt(n);return t.invert=function(n,t){return[n/r,o(t*r)]},t}function Un(n,t){function r(n,t){var r=tr(u-2*e*$t(t))/e;return[r*$t(n*=e),c-r*Jt(n)]}var i=$t(n),e=(i+$t(t))/2;if(Yt(e)<kt)return Dn(n);var u=1+i*(2*e-i),c=tr(u)/e;return r.invert=function(n,t){var r=c-t;return[Ht(n,Yt(r))/e*nr(r),o((u-(n*n+r*r)*e*e)/(2*e))]},r}function Xn(n){var t=n.length;return{point:function(r,i){for(var e=-1;++e<t;)n[e].point(r,i)},sphere:function(){for(var r=-1;++r<t;)n[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)n[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)n[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)n[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)n[r].polygonEnd()}}}function Yn(n){return function(t,r){var i=Jt(t),e=Jt(r),o=n(i*e);return[o*e*$t(t),o*$t(r)]}}function Zn(n){return function(t,r){var i=tr(t*t+r*r),e=n(i),u=$t(e),c=Jt(e);return[Ht(t*u,i*c),o(i&&r*u/i)]}}function Hn(n,t){return[n,Vt(rr((It+t)/2))]}function Jn(n){function t(){var t=Ft*c(),u=o(wr(o.rotate()).invert([0,0]));return l(null==f?[[u[0]-t,u[1]-t],[u[0]+t,u[1]+t]]:n===Hn?[[Math.max(u[0]-t,f),r],[Math.min(u[0]+t,i),e]]:[[f,Math.max(u[1]-t,r)],[i,Math.min(u[1]+t,e)]])}var r,i,e,o=Fn(n),u=o.center,c=o.scale,a=o.translate,l=o.clipExtent,f=null;return o.scale=function(n){return arguments.length?(c(n),t()):c()},o.translate=function(n){return arguments.length?(a(n),t()):a()},o.center=function(n){return arguments.length?(u(n),t()):u()},o.clipExtent=function(n){return arguments.length?(null==n?f=r=i=e=null:(f=+n[0][0],r=+n[0][1],i=+n[1][0],e=+n[1][1]),t()):null==f?null:[[f,r],[i,e]]},t()}function Kn(n){return rr((It+n)/2)}function Qn(n,t){function r(n,t){o>0?t<-It+kt&&(t=-It+kt):t>It-kt&&(t=It-kt);var r=o/Wt(Kn(t),e);return[r*$t(e*n),o-r*Jt(e*n)]}var i=Jt(n),e=n===t?$t(n):Vt(i/Jt(t))/Vt(Kn(t)/Kn(n)),o=i*Wt(Kn(n),e)/e;return e?(r.invert=function(n,t){var r=o-t,i=nr(e)*tr(n*n+r*r);return[Ht(n,Yt(r))/e*nr(r),2*Zt(Wt(o/i,1/e))-It]},r):Hn}function Vn(n,t){return[n,t]}function Wn(n,t){function r(n,t){var r=o-t,i=e*n;return[r*$t(i),o-r*Jt(i)]}var i=Jt(n),e=n===t?$t(n):(i-Jt(t))/(t-n),o=i/e+n;return Yt(e)<kt?Vn:(r.invert=function(n,t){var r=o-t;return[Ht(n,Yt(r))/e*nr(r),o-nr(e)*tr(n*n+r*r)]},r)}function $n(n,t){var r=Jt(t),i=Jt(n)*r;return[r*$t(n)/i,$t(t)/i]}function nt(n,t,r,i){return 1===n&&1===t&&0===r&&0===i?Yr:zn({point:function(e,o){this.stream.point(e*n+r,o*t+i)}})}function tt(n,t){var r=t*t,i=r*r;return[n*(.8707-.131979*r+i*(i*(.003971*r-.001529*i)-.013791)),t*(1.007226+r*(.015085+i*(.028874*r-.044475-.005916*i)))]}function rt(n,t){return[Jt(t)*$t(n),$t(t)]}function it(n,t){var r=Jt(t),i=1+Jt(n)*r;return[r*$t(n)/i,$t(t)/i]}function et(n,t){return[Vt(rr((It+t)/2)),-n]}var ot=function(){return new r};r.prototype={constructor:r,reset:function(){this.s=this.t=0},add:function(n){i(Tt,n,this.t),i(this,Tt.s,this.s),this.s?this.t+=Tt.t:this.s=Tt.t},valueOf:function(){return this.s}};var ut,ct,at,lt,ft,pt,st,ht,gt,vt,dt,Et,yt,St,mt,Mt,xt,_t,Nt,wt,Ct,Pt,Rt,At,jt,qt,zt,bt,Lt,Ot,Gt,Tt=new r,kt=1e-6,Ft=Math.PI,It=Ft/2,Bt=Ft/4,Dt=2*Ft,Ut=180/Ft,Xt=Ft/180,Yt=Math.abs,Zt=Math.atan,Ht=Math.atan2,Jt=Math.cos,Kt=Math.ceil,Qt=Math.exp,Vt=Math.log,Wt=Math.pow,$t=Math.sin,nr=Math.sign||function(n){return n>0?1:n<0?-1:0},tr=Math.sqrt,rr=Math.tan,ir={Feature:function(n,t){a(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)a(r[i].geometry,t)}},er={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)n=r[i],t.point(n[0],n[1],n[2])},LineString:function(n,t){l(n.coordinates,t,0)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)l(r[i],t,0)},Polygon:function(n,t){f(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)f(r[i],t)},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)a(r[i],t)}},or=function(n,t){n&&ir.hasOwnProperty(n.type)?ir[n.type](n,t):a(n,t)},ur=ot(),cr=ot(),ar={point:c,lineStart:c,lineEnd:c,polygonStart:function(){ur.reset(),ar.lineStart=p,ar.lineEnd=s},polygonEnd:function(){var n=+ur;cr.add(n<0?Dt+n:n),this.lineStart=this.lineEnd=this.point=c},sphere:function(){cr.add(Dt)}},lr=ot(),fr={point:x,lineStart:N,lineEnd:w,polygonStart:function(){fr.point=C,fr.lineStart=P,fr.lineEnd=R,lr.reset(),ar.polygonStart()},polygonEnd:function(){ar.polygonEnd(),fr.point=x,fr.lineStart=N,fr.lineEnd=w,ur<0?(pt=-(ht=180),st=-(gt=90)):lr>kt?gt=90:lr<-kt&&(st=-90),mt[0]=pt,mt[1]=ht}},pr={sphere:c,point:z,lineStart:L,lineEnd:T,polygonStart:function(){pr.lineStart=k,pr.lineEnd=F},polygonEnd:function(){pr.lineStart=L,pr.lineEnd=T}},sr=function(n){return function(){return n}},hr=function(n,t){function r(r,i){return r=n(r,i),t(r[0],r[1])}return n.invert&&t.invert&&(r.invert=function(r,i){return(r=t.invert(r,i))&&n.invert(r[0],r[1])}),r};D.invert=D;var gr,vr,dr,Er,yr,Sr,mr,Mr,xr,_r,Nr,wr=function(n){function t(t){return t=n(t[0]*Xt,t[1]*Xt),t[0]*=Ut,t[1]*=Ut,t}return n=U(n[0]*Xt,n[1]*Xt,n.length>2?n[2]*Xt:0),t.invert=function(t){return t=n.invert(t[0]*Xt,t[1]*Xt),t[0]*=Ut,t[1]*=Ut,t},t},Cr=function(){var n,t=[];return{point:function(t,r){n.push([t,r])},lineStart:function(){t.push(n=[])},lineEnd:c,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}},Pr=function(n,t){return Yt(n[0]-t[0])<kt&&Yt(n[1]-t[1])<kt},Rr=function(n,t,r,i,e){var o,u,c=[],a=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,r,i=n[0],u=n[t];if(Pr(i,u)){for(e.lineStart(),o=0;o<t;++o)e.point((i=n[o])[0],i[1]);e.lineEnd()}else c.push(r=new K(i,n,null,!0)),a.push(r.o=new K(i,null,r,!1)),c.push(r=new K(u,n,null,!1)),a.push(r.o=new K(u,null,r,!0))}}),c.length){for(a.sort(t),Q(c),Q(a),o=0,u=a.length;o<u;++o)a[o].e=r=!r;for(var l,f,p=c[0];;){for(var s=p,h=!0;s.v;)if((s=s.n)===p)return;l=s.z,e.lineStart();do{if(s.v=s.o.v=!0,s.e){if(h)for(o=0,u=l.length;o<u;++o)e.point((f=l[o])[0],f[1]);else i(s.x,s.n.x,1,e);s=s.n}else{if(h)for(l=s.p.z,o=l.length-1;o>=0;--o)e.point((f=l[o])[0],f[1]);else i(s.x,s.p.x,-1,e);s=s.p}l=(s=s.o).z,h=!h}while(!s.v);e.lineEnd()}}},Ar=ot(),jr=function(n,t){var r=t[0],i=t[1],e=[$t(r),-Jt(r),0],u=0,c=0;Ar.reset();for(var a=0,l=n.length;a<l;++a)if(p=(f=n[a]).length)for(var f,p,s=f[p-1],h=s[0],g=s[1]/2+Bt,v=$t(g),E=Jt(g),S=0;S<p;++S,h=x,v=N,E=w,s=m){var m=f[S],x=m[0],_=m[1]/2+Bt,N=$t(_),w=Jt(_),C=x-h,P=C>=0?1:-1,R=P*C,A=R>Ft,j=v*N;if(Ar.add(Ht(j*P*$t(R),E*w+j*Jt(R))),u+=A?C+P*Dt:C,A^h>=r^x>=r){var q=y(d(s),d(m));M(q);var z=y(e,q);M(z);var b=(A^C>=0?-1:1)*o(z[2]);(i>b||i===b&&(q[0]||q[1]))&&(c+=A^C>=0?1:-1)}}return(u<-kt||u<kt&&Ar<-kt)^1&c},qr=function(n,r,i,e){return function(o){function u(t,r){n(t,r)&&o.point(t,r)}function c(n,t){d.point(n,t)}function a(){m.point=c,d.lineStart()}function l(){m.point=u,d.lineEnd()}function f(n,t){v.push([n,t]),y.point(n,t)}function p(){y.lineStart(),v=[]}function s(){f(v[0][0],v[0][1]),y.lineEnd();var n,t,r,i,e=y.clean(),u=E.result(),c=u.length;if(v.pop(),h.push(v),v=null,c)if(1&e){if(r=u[0],(t=r.length-1)>0){for(S||(o.polygonStart(),S=!0),o.lineStart(),n=0;n<t;++n)o.point((i=r[n])[0],i[1]);o.lineEnd()}}else c>1&&2&e&&u.push(u.pop().concat(u.shift())),g.push(u.filter(V))}var h,g,v,d=r(o),E=Cr(),y=r(E),S=!1,m={point:u,lineStart:a,lineEnd:l,polygonStart:function(){m.point=f,m.lineStart=p,m.lineEnd=s,g=[],h=[]},polygonEnd:function(){m.point=u,m.lineStart=a,m.lineEnd=l,g=t.merge(g);var n=jr(h,e);g.length?(S||(o.polygonStart(),S=!0),Rr(g,W,n,i,o)):n&&(S||(o.polygonStart(),S=!0),o.lineStart(),i(null,null,1,o),o.lineEnd()),S&&(o.polygonEnd(),S=!1),g=h=null},sphere:function(){o.polygonStart(),o.lineStart(),i(null,null,1,o),o.lineEnd(),o.polygonEnd()}};return m}},zr=qr(function(){return!0},function(n){var t,r=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var c=o>0?Ft:-Ft,a=Yt(o-r);Yt(a-Ft)<kt?(n.point(r,i=(i+u)/2>0?It:-It),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),n.point(o,i),t=0):e!==c&&a>=Ft&&(Yt(r-e)<kt&&(r-=e*kt),Yt(o-c)<kt&&(o-=c*kt),i=$(r,i,o,u),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),t=0),n.point(r=o,i=u),e=c},lineEnd:function(){n.lineEnd(),r=i=NaN},clean:function(){return 2-t}}},function(n,t,r,i){var e;if(null==n)e=r*It,i.point(-Ft,e),i.point(0,e),i.point(Ft,e),i.point(Ft,0),i.point(Ft,-e),i.point(0,-e),i.point(-Ft,-e),i.point(-Ft,0),i.point(-Ft,e);else if(Yt(n[0]-t[0])>kt){var o=n[0]<t[0]?Ft:-Ft;e=r*o/2,i.point(-o,e),i.point(0,e),i.point(o,e)}else i.point(t[0],t[1])},[-Ft,-It]),br=function(n){function t(n,t){return Jt(n)*Jt(t)>e}function r(n,t,r){var i=[1,0,0],o=y(d(n),d(t)),u=E(o,o),c=o[0],a=u-c*c;if(!a)return!r&&n;var l=e*u/a,f=-e*c/a,p=y(i,o),s=m(i,l);S(s,m(o,f));var h=p,g=E(s,h),M=E(h,h),x=g*g-M*(E(s,s)-1);if(!(x<0)){var _=tr(x),N=m(h,(-g-_)/M);if(S(N,s),N=v(N),!r)return N;var w,C=n[0],P=t[0],R=n[1],A=t[1];P<C&&(w=C,C=P,P=w);var j=P-C,q=Yt(j-Ft)<kt,z=q||j<kt;if(!q&&A<R&&(w=R,R=A,A=w),z?q?R+A>0^N[1]<(Yt(N[0]-C)<kt?R:A):R<=N[1]&&N[1]<=A:j>Ft^(C<=N[0]&&N[0]<=P)){var b=m(h,(-g+_)/M);return S(b,s),[N,v(b)]}}}function i(t,r){var i=u?n:Ft-n,e=0;return t<-i?e|=1:t>i&&(e|=2),r<-i?e|=4:r>i&&(e|=8),e}var e=Jt(n),o=6*Xt,u=e>0,c=Yt(e)>kt;return qr(t,function(n){var e,o,a,l,f;return{lineStart:function(){l=a=!1,f=1},point:function(p,s){var h,g=[p,s],v=t(p,s),d=u?v?0:i(p,s):v?i(p+(p<0?Ft:-Ft),s):0;if(!e&&(l=a=v)&&n.lineStart(),v!==a&&(!(h=r(e,g))||Pr(e,h)||Pr(g,h))&&(g[0]+=kt,g[1]+=kt,v=t(g[0],g[1])),v!==a)f=0,v?(n.lineStart(),h=r(g,e),n.point(h[0],h[1])):(h=r(e,g),n.point(h[0],h[1]),n.lineEnd()),e=h;else if(c&&e&&u^v){var E;d&o||!(E=r(g,e,!0))||(f=0,u?(n.lineStart(),n.point(E[0][0],E[0][1]),n.point(E[1][0],E[1][1]),n.lineEnd()):(n.point(E[1][0],E[1][1]),n.lineEnd(),n.lineStart(),n.point(E[0][0],E[0][1])))}!v||e&&Pr(e,g)||n.point(g[0],g[1]),e=g,a=v,o=d},lineEnd:function(){a&&n.lineEnd(),e=null},clean:function(){return f|(l&&a)<<1}}},function(t,r,i,e){H(e,n,o,i,t,r)},u?[0,-n]:[-Ft,n-Ft])},Lr=function(n,t,r,i,e,o){var u,c=n[0],a=n[1],l=0,f=1,p=t[0]-c,s=t[1]-a;if(u=r-c,p||!(u>0)){if(u/=p,p<0){if(u<l)return;u<f&&(f=u)}else if(p>0){if(u>f)return;u>l&&(l=u)}if(u=e-c,p||!(u<0)){if(u/=p,p<0){if(u>f)return;u>l&&(l=u)}else if(p>0){if(u<l)return;u<f&&(f=u)}if(u=i-a,s||!(u>0)){if(u/=s,s<0){if(u<l)return;u<f&&(f=u)}else if(s>0){if(u>f)return;u>l&&(l=u)}if(u=o-a,s||!(u<0)){if(u/=s,s<0){if(u>f)return;u>l&&(l=u)}else if(s>0){if(u<l)return;u<f&&(f=u)}return l>0&&(n[0]=c+l*p,n[1]=a+l*s),f<1&&(t[0]=c+f*p,t[1]=a+f*s),!0}}}}},Or=1e9,Gr=-Or,Tr=ot(),kr={sphere:c,point:c,lineStart:function(){kr.point=rn,kr.lineEnd=tn},lineEnd:c,polygonStart:c,polygonEnd:c},Fr=function(n){return Tr.reset(),or(n,kr),+Tr},Ir=[null,null],Br={type:"LineString",coordinates:Ir},Dr=function(n,t){return Ir[0]=n,Ir[1]=t,Fr(Br)},Ur={Feature:function(n,t){return on(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)if(on(r[i].geometry,t))return!0;return!1}},Xr={Sphere:function(){return!0},Point:function(n,t){return un(n.coordinates,t)},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)if(un(r[i],t))return!0;return!1},LineString:function(n,t){return cn(n.coordinates,t)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)if(cn(r[i],t))return!0;return!1},Polygon:function(n,t){return an(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)if(an(r[i],t))return!0;return!1},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)if(on(r[i],t))return!0;return!1}},Yr=function(n){return n},Zr=ot(),Hr=ot(),Jr={point:c,lineStart:c,lineEnd:c,polygonStart:function(){Jr.lineStart=gn,Jr.lineEnd=En},polygonEnd:function(){Jr.lineStart=Jr.lineEnd=Jr.point=c,Zr.add(Yt(Hr)),Hr.reset()},result:function(){var n=Zr/2;return Zr.reset(),n}},Kr=1/0,Qr=Kr,Vr=-Kr,Wr=Vr,$r={point:function(n,t){n<Kr&&(Kr=n),n>Vr&&(Vr=n),t<Qr&&(Qr=t),t>Wr&&(Wr=t)},lineStart:c,lineEnd:c,polygonStart:c,polygonEnd:c,result:function(){var n=[[Kr,Qr],[Vr,Wr]];return Vr=Wr=-(Qr=Kr=1/0),n}},ni=0,ti=0,ri=0,ii=0,ei=0,oi=0,ui=0,ci=0,ai=0,li={point:yn,lineStart:Sn,lineEnd:xn,polygonStart:function(){li.lineStart=_n,li.lineEnd=Nn},polygonEnd:function(){li.point=yn,li.lineStart=Sn,li.lineEnd=xn},result:function(){var n=ai?[ui/ai,ci/ai]:oi?[ii/oi,ei/oi]:ri?[ni/ri,ti/ri]:[NaN,NaN];return ni=ti=ri=ii=ei=oi=ui=ci=ai=0,n}};Pn.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:this._context.moveTo(n,t),this._point=1;break;case 1:this._context.lineTo(n,t);break;default:this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Dt)}},result:c};var fi,pi,si,hi,gi,vi=ot(),di={point:c,lineStart:function(){di.point=Rn},lineEnd:function(){fi&&An(pi,si),di.point=c},polygonStart:function(){fi=!0},polygonEnd:function(){fi=null},result:function(){var n=+vi;return vi.reset(),n}};jn.prototype={_radius:4.5,_circle:qn(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:this._string.push("M",n,",",t),this._point=1;break;case 1:this._string.push("L",n,",",t);break;default:null==this._circle&&(this._circle=qn(this._radius)),this._string.push("M",n,",",t,this._circle)}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}return null}};bn.prototype={constructor:bn,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Ei=16,yi=Jt(30*Xt),Si=function(n,t){return+t?Tn(n,t):Gn(n)},mi=zn({point:function(n,t){this.stream.point(n*Xt,t*Xt)}}),Mi=function(){return Bn(Un).scale(155.424).center([0,33.6442])},xi=function(){return Mi().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])},_i=Yn(function(n){return tr(2/(1+n))});_i.invert=Zn(function(n){return 2*o(n/2)});var Ni=Yn(function(n){return(n=e(n))&&n/$t(n)});Ni.invert=Zn(function(n){return n});Hn.invert=function(n,t){return[n,2*Zt(Qt(t))-It]};Vn.invert=Vn;$n.invert=Zn(Zt);tt.invert=function(n,t){var r,i=t,e=25;do{var o=i*i,u=o*o;i-=r=(i*(1.007226+o*(.015085+u*(.028874*o-.044475-.005916*u)))-t)/(1.007226+o*(.045255+u*(.259866*o-.311325-.005916*11*u)))}while(Yt(r)>kt&&--e>0);return[n/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]};rt.invert=Zn(o);it.invert=Zn(function(n){return 2*Zt(n)});et.invert=function(n,t){return[-t,2*Zt(Qt(n))-It]};n.geoArea=function(n){return cr.reset(),or(n,ar),2*cr},n.geoBounds=function(n){var t,r,i,e,o,u,c;if(gt=ht=-(pt=st=1/0),St=[],or(n,fr),r=St.length){for(St.sort(j),t=1,o=[i=St[0]];t<r;++t)q(i,(e=St[t])[0])||q(i,e[1])?(A(i[0],e[1])>A(i[0],i[1])&&(i[1]=e[1]),A(e[0],i[1])>A(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(u=-1/0,t=0,i=o[r=o.length-1];t<=r;i=e,++t)e=o[t],(c=A(i[1],e[0]))>u&&(u=c,pt=e[0],ht=i[1])}return St=mt=null,pt===1/0||st===1/0?[[NaN,NaN],[NaN,NaN]]:[[pt,st],[ht,gt]]},n.geoCentroid=function(n){Mt=xt=_t=Nt=wt=Ct=Pt=Rt=At=jt=qt=0,or(n,pr);var t=At,r=jt,i=qt,e=t*t+r*r+i*i;return e<1e-12&&(t=Ct,r=Pt,i=Rt,xt<kt&&(t=_t,r=Nt,i=wt),(e=t*t+r*r+i*i)<1e-12)?[NaN,NaN]:[Ht(r,t)*Ut,o(i/tr(e))*Ut]},n.geoCircle=function(){function n(){var n=i.apply(this,arguments),c=e.apply(this,arguments)*Xt,a=o.apply(this,arguments)*Xt;return t=[],r=U(-n[0]*Xt,-n[1]*Xt,0).invert,H(u,c,a,1),n={type:"Polygon",coordinates:[t]},t=r=null,n}var t,r,i=sr([0,0]),e=sr(90),o=sr(6),u={point:function(n,i){t.push(n=r(n,i)),n[0]*=Ut,n[1]*=Ut}};return n.center=function(t){return arguments.length?(i="function"==typeof t?t:sr([+t[0],+t[1]]),n):i},n.radius=function(t){return arguments.length?(e="function"==typeof t?t:sr(+t),n):e},n.precision=function(t){return arguments.length?(o="function"==typeof t?t:sr(+t),n):o},n},n.geoClipAntimeridian=zr,n.geoClipCircle=br,n.geoClipExtent=function(){var n,t,r,i=0,e=0,o=960,u=500;return r={stream:function(r){return n&&t===r?n:n=nn(i,e,o,u)(t=r)},extent:function(c){return arguments.length?(i=+c[0][0],e=+c[0][1],o=+c[1][0],u=+c[1][1],n=t=null,r):[[i,e],[o,u]]}}},n.geoClipRectangle=nn,n.geoContains=function(n,t){return(n&&Ur.hasOwnProperty(n.type)?Ur[n.type]:on)(n,t)},n.geoDistance=Dr,n.geoGraticule=hn,n.geoGraticule10=function(){return hn()()},n.geoInterpolate=function(n,t){var r=n[0]*Xt,i=n[1]*Xt,e=t[0]*Xt,c=t[1]*Xt,a=Jt(i),l=$t(i),f=Jt(c),p=$t(c),s=a*Jt(r),h=a*$t(r),g=f*Jt(e),v=f*$t(e),d=2*o(tr(u(c-i)+a*f*u(e-r))),E=$t(d),y=d?function(n){var t=$t(n*=d)/E,r=$t(d-n)/E,i=r*s+t*g,e=r*h+t*v,o=r*l+t*p;return[Ht(e,i)*Ut,Ht(o,tr(i*i+e*e))*Ut]}:function(){return[r*Ut,i*Ut]};return y.distance=d,y},n.geoLength=Fr,n.geoPath=function(n,t){function r(n){return n&&("function"==typeof o&&e.pointRadius(+o.apply(this,arguments)),or(n,i(e))),e.result()}var i,e,o=4.5;return r.area=function(n){return or(n,i(Jr)),Jr.result()},r.measure=function(n){return or(n,i(di)),di.result()},r.bounds=function(n){return or(n,i($r)),$r.result()},r.centroid=function(n){return or(n,i(li)),li.result()},r.projection=function(t){return arguments.length?(i=null==t?(n=null,Yr):(n=t).stream,r):n},r.context=function(n){return arguments.length?(e=null==n?(t=null,new jn):new Pn(t=n),"function"!=typeof o&&e.pointRadius(o),r):t},r.pointRadius=function(n){return arguments.length?(o="function"==typeof n?n:(e.pointRadius(+n),+n),r):o},r.projection(n).context(t)},n.geoAlbers=xi,n.geoAlbersUsa=function(){function n(n){var t=n[0],r=n[1];return c=null,e.point(t,r),c||(o.point(t,r),c)||(u.point(t,r),c)}function t(){return r=i=null,n}var r,i,e,o,u,c,a=xi(),l=Mi().rotate([154,0]).center([-2,58.5]).parallels([55,65]),f=Mi().rotate([157,0]).center([-3,19.9]).parallels([8,18]),p={point:function(n,t){c=[n,t]}};return n.invert=function(n){var t=a.scale(),r=a.translate(),i=(n[0]-r[0])/t,e=(n[1]-r[1])/t;return(e>=.12&&e<.234&&i>=-.425&&i<-.214?l:e>=.166&&e<.234&&i>=-.214&&i<-.115?f:a).invert(n)},n.stream=function(n){return r&&i===n?r:r=Xn([a.stream(i=n),l.stream(n),f.stream(n)])},n.precision=function(n){return arguments.length?(a.precision(n),l.precision(n),f.precision(n),t()):a.precision()},n.scale=function(t){return arguments.length?(a.scale(t),l.scale(.35*t),f.scale(t),n.translate(a.translate())):a.scale()},n.translate=function(n){if(!arguments.length)return a.translate();var r=a.scale(),i=+n[0],c=+n[1];return e=a.translate(n).clipExtent([[i-.455*r,c-.238*r],[i+.455*r,c+.238*r]]).stream(p),o=l.translate([i-.307*r,c+.201*r]).clipExtent([[i-.425*r+kt,c+.12*r+kt],[i-.214*r-kt,c+.234*r-kt]]).stream(p),u=f.translate([i-.205*r,c+.212*r]).clipExtent([[i-.214*r+kt,c+.166*r+kt],[i-.115*r-kt,c+.234*r-kt]]).stream(p),t()},n.fitExtent=function(t,r){return Ln(n,t,r)},n.fitSize=function(t,r){return On(n,t,r)},n.scale(1070)},n.geoAzimuthalEqualArea=function(){return Fn(_i).scale(124.75).clipAngle(179.999)},n.geoAzimuthalEqualAreaRaw=_i,n.geoAzimuthalEquidistant=function(){return Fn(Ni).scale(79.4188).clipAngle(179.999)},n.geoAzimuthalEquidistantRaw=Ni,n.geoConicConformal=function(){return Bn(Qn).scale(109.5).parallels([30,30])},n.geoConicConformalRaw=Qn,n.geoConicEqualArea=Mi,n.geoConicEqualAreaRaw=Un,n.geoConicEquidistant=function(){return Bn(Wn).scale(131.154).center([0,13.9389])},n.geoConicEquidistantRaw=Wn,n.geoEquirectangular=function(){return Fn(Vn).scale(152.63)},n.geoEquirectangularRaw=Vn,n.geoGnomonic=function(){return Fn($n).scale(144.049).clipAngle(60)},n.geoGnomonicRaw=$n,n.geoIdentity=function(){function n(){return e=o=null,u}var t,r,i,e,o,u,c=1,a=0,l=0,f=1,p=1,s=Yr,h=null,g=Yr;return u={stream:function(n){return e&&o===n?e:e=s(g(o=n))},postclip:function(e){return arguments.length?(g=e,h=t=r=i=null,n()):g},clipExtent:function(e){return arguments.length?(g=null==e?(h=t=r=i=null,Yr):nn(h=+e[0][0],t=+e[0][1],r=+e[1][0],i=+e[1][1]),n()):null==h?null:[[h,t],[r,i]]},scale:function(t){return arguments.length?(s=nt((c=+t)*f,c*p,a,l),n()):c},translate:function(t){return arguments.length?(s=nt(c*f,c*p,a=+t[0],l=+t[1]),n()):[a,l]},reflectX:function(t){return arguments.length?(s=nt(c*(f=t?-1:1),c*p,a,l),n()):f<0},reflectY:function(t){return arguments.length?(s=nt(c*f,c*(p=t?-1:1),a,l),n()):p<0},fitExtent:function(n,t){return Ln(u,n,t)},fitSize:function(n,t){return On(u,n,t)}}},n.geoProjection=Fn,n.geoProjectionMutator=In,n.geoMercator=function(){return Jn(Hn).scale(961/Dt)},n.geoMercatorRaw=Hn,n.geoNaturalEarth1=function(){return Fn(tt).scale(175.295)},n.geoNaturalEarth1Raw=tt,n.geoOrthographic=function(){return Fn(rt).scale(249.5).clipAngle(90+kt)},n.geoOrthographicRaw=rt,n.geoStereographic=function(){return Fn(it).scale(250).clipAngle(142)},n.geoStereographicRaw=it,n.geoTransverseMercator=function(){var n=Jn(et),t=n.center,r=n.rotate;return n.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)},n.geoTransverseMercatorRaw=et,n.geoRotation=wr,n.geoStream=or,n.geoTransform=function(n){return{stream:zn(n)}},Object.defineProperty(n,"__esModule",{value:!0})}); |
@@ -5,3 +5,6 @@ export {default as geoArea} from "./src/area"; | ||
export {default as geoCircle} from "./src/circle"; | ||
export {default as geoClipAntimeridian} from "./src/clip/antimeridian"; | ||
export {default as geoClipCircle} from "./src/clip/circle"; | ||
export {default as geoClipExtent} from "./src/clip/extent"; // DEPRECATED! Use d3.geoIdentity().clipExtent(…). | ||
export {default as geoClipRectangle} from "./src/clip/rectangle"; | ||
export {default as geoContains} from "./src/contains"; | ||
@@ -8,0 +11,0 @@ export {default as geoDistance} from "./src/distance"; |
{ | ||
"name": "d3-geo", | ||
"version": "1.7.1", | ||
"version": "1.8.1", | ||
"description": "Shapes and calculators for spherical coordinates.", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"test": "tape 'test/**/*-test.js' && mkdir -p test/output && eslint index.js src", | ||
"prepublishOnly": "npm run test && test/compare-images && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3-geo.js -c -m -o build/d3-geo.min.js", | ||
"prepare": "npm run test && test/compare-images && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3-geo.js -c -m -o build/d3-geo.min.js", | ||
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-geo/build/d3-geo.js d3-geo.v1.js && cp ../d3-geo/build/d3-geo.min.js d3-geo.v1.min.js && git add d3-geo.v1.js d3-geo.v1.min.js && git commit -m \"d3-geo ${npm_package_version}\" && git push && cd - && zip -j build/d3-geo.zip -- LICENSE README.md build/d3-geo.js build/d3-geo.min.js" | ||
@@ -40,3 +40,3 @@ }, | ||
"package-preamble": "0.1", | ||
"rollup": "0.49", | ||
"rollup": "0.50", | ||
"tape": "4", | ||
@@ -43,0 +43,0 @@ "topojson-client": "3", |
@@ -49,2 +49,3 @@ # d3-geo | ||
* [Transforms](#transforms) | ||
* [Clipping](#clipping) | ||
@@ -157,2 +158,10 @@ ### Paths | ||
<a href="#projection_preclip" name="projection_preclip">#</a> <i>projection</i>.<b>preclip</b>([<i>preclip</i>]) | ||
If *preclip* is specified, sets the projection’s spherical clipping to the specified function and returns the projection. If *preclip* is not specified, returns the current spherical clipping function (see [preclip](#preclip)). | ||
<a href="#projection_postclip" name="projection_postclip">#</a> <i>projection</i>.<b>postclip</b>([<i>postclip</i>]) | ||
If *postclip* is specified, sets the projection’s cartesian clipping to the specified function and returns the projection. If *postclip* is not specified, returns the current cartesian clipping function (see [postclip](#postclip)). | ||
<a href="#projection_clipAngle" name="projection_clipAngle">#</a> <i>projection</i>.<b>clipAngle</b>([<i>angle</i>]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js#L52 "Source") | ||
@@ -162,2 +171,4 @@ | ||
See also [*projection*.preclip](#projection_preclip), [d3.geoClipAntimeridian](#geoClipAntimeridian), [d3.geoClipCircle](#geoClipCircle). | ||
<a href="#projection_clipExtent" name="projection_clipExtent">#</a> <i>projection</i>.<b>clipExtent</b>([<i>extent</i>]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js#L56 "Source") | ||
@@ -167,2 +178,4 @@ | ||
See also [*projection*.postclip](#projection_postclip), [d3.geoClipRectangle](#geoClipRectangle). | ||
<a href="#projection_scale" name="projection_scale">#</a> <i>projection</i>.<b>scale</b>([<i>scale</i>]) [<>](https://github.com/d3/d3-geo/blob/master/src/projection/index.js#L60 "Source") | ||
@@ -624,1 +637,31 @@ | ||
If *reflect* is specified, sets whether or not the *y*-dimension is reflected (negated) in the output. If *reflect* is not specified, returns true if *y*-reflection is enabled, which defaults to false. This is especially useful for transforming from standard [spatial reference systems](https://en.wikipedia.org/wiki/Spatial_reference_system), which treat positive *y* as pointing up, to display coordinate systems such as Canvas and SVG, which treat positive *y* as pointing down. | ||
### Clipping | ||
Projections perform cutting or clipping of geometries in two stages. | ||
<a name="preclip" href="#preclip">#</a> <i>preclip</i>(<i>stream</i>) | ||
Pre-clipping occurs in geographic coordinates. Cutting along the antimeridian line, or clipping along a small circle are the most common strategies. | ||
See [*projection*.preclip](#projection_preclip). | ||
<a name="postclip" href="#postclip">#</a> <i>postclip</i>(<i>stream</i>) | ||
Post-clipping occurs on the plane, when a projection is bounded to a certain extent such as a rectangle. | ||
See [*projection*.postclip](#projection_postclip). | ||
Clipping functions are implemented as transformations of a [projection stream](#streams). Pre-clipping operates on spherical coordinates, in radians. Post-clipping operates on planar coordinates, in pixels. | ||
<a name="geoClipAntimeridian" href="#geoClipAntimeridian">#</a> d3.<b>geoClipAntimeridian</b> | ||
Returns a stream where geometries (lines or polygons) that cross the antimeridian line are cut in two, one on each side. Typically used for pre-clipping. | ||
<a name="geoClipCircle" href="#geoClipCircle">#</a> d3.<b>geoClipCircle</b>(<i>angle</i>) | ||
Returns a stream where geometries are bounded by a small circle of radius *angle* around the projection’s [center](#projection_center). Typically used for pre-clipping. | ||
<a name="geoClipRectangle" href="#geoClipRectangle">#</a> d3.<b>geoClipRectangle</b>(<i>x0</i>, <i>y0</i>, <i>x1</i>, <i>y1</i>) | ||
Returns a stream where geometries are bounded by a rectangle of coordinates [[<i>x0</i>, <i>y0</i>], [<i>x1</i>, <i>y1</i>]]. Typically used for post-clipping. |
@@ -0,15 +1,14 @@ | ||
const definition = require("./package.json"); | ||
const dependencies = Object.keys(definition.dependencies); | ||
export default { | ||
input: "index", | ||
external: [ | ||
"d3-array" | ||
], | ||
external: dependencies, | ||
output: { | ||
extend: true, | ||
file: "build/d3-geo.js", | ||
file: `build/${definition.name}.js`, | ||
format: "umd", | ||
globals: { | ||
"d3-array": "d3" | ||
}, | ||
globals: dependencies.reduce((p, v) => (p[v] = "d3", p), {}), | ||
name: "d3" | ||
} | ||
}; |
import {cartesian, cartesianAddInPlace, cartesianCross, cartesianDot, cartesianScale, spherical} from "../cartesian"; | ||
import {circleStream} from "../circle"; | ||
import {abs, cos, epsilon, pi, sqrt} from "../math"; | ||
import {abs, cos, epsilon, pi, radians, sqrt} from "../math"; | ||
import pointEqual from "../pointEqual"; | ||
import clip from "./index"; | ||
export default function(radius, delta) { | ||
export default function(radius) { | ||
var cr = cos(radius), | ||
delta = 6 * radians, | ||
smallRadius = cr > 0, | ||
@@ -10,0 +11,0 @@ notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case |
@@ -1,170 +0,3 @@ | ||
import {abs, epsilon} from "../math"; | ||
import clipBuffer from "./buffer"; | ||
import clipLine from "./line"; | ||
import clipPolygon from "./polygon"; | ||
import {merge} from "d3-array"; | ||
import clipRectangle from "./rectangle"; | ||
var clipMax = 1e9, clipMin = -clipMax; | ||
// TODO Use d3-polygon’s polygonContains here for the ring check? | ||
// TODO Eliminate duplicate buffering in clipBuffer and polygon.push? | ||
export function clipExtent(x0, y0, x1, y1) { | ||
function visible(x, y) { | ||
return x0 <= x && x <= x1 && y0 <= y && y <= y1; | ||
} | ||
function interpolate(from, to, direction, stream) { | ||
var a = 0, a1 = 0; | ||
if (from == null | ||
|| (a = corner(from, direction)) !== (a1 = corner(to, direction)) | ||
|| comparePoint(from, to) < 0 ^ direction > 0) { | ||
do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); | ||
while ((a = (a + direction + 4) % 4) !== a1); | ||
} else { | ||
stream.point(to[0], to[1]); | ||
} | ||
} | ||
function corner(p, direction) { | ||
return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3 | ||
: abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1 | ||
: abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0 | ||
: direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon | ||
} | ||
function compareIntersection(a, b) { | ||
return comparePoint(a.x, b.x); | ||
} | ||
function comparePoint(a, b) { | ||
var ca = corner(a, 1), | ||
cb = corner(b, 1); | ||
return ca !== cb ? ca - cb | ||
: ca === 0 ? b[1] - a[1] | ||
: ca === 1 ? a[0] - b[0] | ||
: ca === 2 ? a[1] - b[1] | ||
: b[0] - a[0]; | ||
} | ||
return function(stream) { | ||
var activeStream = stream, | ||
bufferStream = clipBuffer(), | ||
segments, | ||
polygon, | ||
ring, | ||
x__, y__, v__, // first point | ||
x_, y_, v_, // previous point | ||
first, | ||
clean; | ||
var clipStream = { | ||
point: point, | ||
lineStart: lineStart, | ||
lineEnd: lineEnd, | ||
polygonStart: polygonStart, | ||
polygonEnd: polygonEnd | ||
}; | ||
function point(x, y) { | ||
if (visible(x, y)) activeStream.point(x, y); | ||
} | ||
function polygonInside() { | ||
var winding = 0; | ||
for (var i = 0, n = polygon.length; i < n; ++i) { | ||
for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { | ||
a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; | ||
if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; } | ||
else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; } | ||
} | ||
} | ||
return winding; | ||
} | ||
// Buffer geometry within a polygon and then clip it en masse. | ||
function polygonStart() { | ||
activeStream = bufferStream, segments = [], polygon = [], clean = true; | ||
} | ||
function polygonEnd() { | ||
var startInside = polygonInside(), | ||
cleanInside = clean && startInside, | ||
visible = (segments = merge(segments)).length; | ||
if (cleanInside || visible) { | ||
stream.polygonStart(); | ||
if (cleanInside) { | ||
stream.lineStart(); | ||
interpolate(null, null, 1, stream); | ||
stream.lineEnd(); | ||
} | ||
if (visible) { | ||
clipPolygon(segments, compareIntersection, startInside, interpolate, stream); | ||
} | ||
stream.polygonEnd(); | ||
} | ||
activeStream = stream, segments = polygon = ring = null; | ||
} | ||
function lineStart() { | ||
clipStream.point = linePoint; | ||
if (polygon) polygon.push(ring = []); | ||
first = true; | ||
v_ = false; | ||
x_ = y_ = NaN; | ||
} | ||
// TODO rather than special-case polygons, simply handle them separately. | ||
// Ideally, coincident intersection points should be jittered to avoid | ||
// clipping issues. | ||
function lineEnd() { | ||
if (segments) { | ||
linePoint(x__, y__); | ||
if (v__ && v_) bufferStream.rejoin(); | ||
segments.push(bufferStream.result()); | ||
} | ||
clipStream.point = point; | ||
if (v_) activeStream.lineEnd(); | ||
} | ||
function linePoint(x, y) { | ||
var v = visible(x, y); | ||
if (polygon) ring.push([x, y]); | ||
if (first) { | ||
x__ = x, y__ = y, v__ = v; | ||
first = false; | ||
if (v) { | ||
activeStream.lineStart(); | ||
activeStream.point(x, y); | ||
} | ||
} else { | ||
if (v && v_) activeStream.point(x, y); | ||
else { | ||
var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], | ||
b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))]; | ||
if (clipLine(a, b, x0, y0, x1, y1)) { | ||
if (!v_) { | ||
activeStream.lineStart(); | ||
activeStream.point(a[0], a[1]); | ||
} | ||
activeStream.point(b[0], b[1]); | ||
if (!v) activeStream.lineEnd(); | ||
clean = false; | ||
} else if (v) { | ||
activeStream.lineStart(); | ||
activeStream.point(x, y); | ||
clean = false; | ||
} | ||
} | ||
} | ||
x_ = x, y_ = y, v_ = v; | ||
} | ||
return clipStream; | ||
}; | ||
} | ||
export default function() { | ||
@@ -181,3 +14,3 @@ var x0 = 0, | ||
stream: function(stream) { | ||
return cache && cacheStream === stream ? cache : cache = clipExtent(x0, y0, x1, y1)(cacheStream = stream); | ||
return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream); | ||
}, | ||
@@ -184,0 +17,0 @@ extent: function(_) { |
import clipBuffer from "./buffer"; | ||
import clipPolygon from "./polygon"; | ||
import clipRejoin from "./rejoin"; | ||
import {epsilon, halfPi} from "../math"; | ||
@@ -8,5 +8,4 @@ import polygonContains from "../polygonContains"; | ||
export default function(pointVisible, clipLine, interpolate, start) { | ||
return function(rotate, sink) { | ||
return function(sink) { | ||
var line = clipLine(sink), | ||
rotatedStart = rotate.invert(start[0], start[1]), | ||
ringBuffer = clipBuffer(), | ||
@@ -35,6 +34,6 @@ ringSink = clipLine(ringBuffer), | ||
segments = merge(segments); | ||
var startInside = polygonContains(polygon, rotatedStart); | ||
var startInside = polygonContains(polygon, start); | ||
if (segments.length) { | ||
if (!polygonStarted) sink.polygonStart(), polygonStarted = true; | ||
clipPolygon(segments, compareIntersection, startInside, interpolate, sink); | ||
clipRejoin(segments, compareIntersection, startInside, interpolate, sink); | ||
} else if (startInside) { | ||
@@ -59,9 +58,7 @@ if (!polygonStarted) sink.polygonStart(), polygonStarted = true; | ||
function point(lambda, phi) { | ||
var point = rotate(lambda, phi); | ||
if (pointVisible(lambda = point[0], phi = point[1])) sink.point(lambda, phi); | ||
if (pointVisible(lambda, phi)) sink.point(lambda, phi); | ||
} | ||
function pointLine(lambda, phi) { | ||
var point = rotate(lambda, phi); | ||
line.point(point[0], point[1]); | ||
line.point(lambda, phi); | ||
} | ||
@@ -81,4 +78,3 @@ | ||
ring.push([lambda, phi]); | ||
var point = rotate(lambda, phi); | ||
ringSink.point(point[0], point[1]); | ||
ringSink.point(lambda, phi); | ||
} | ||
@@ -85,0 +81,0 @@ |
@@ -1,2 +0,2 @@ | ||
import {clipExtent} from "../clip/extent"; | ||
import clipRectangle from "../clip/rectangle"; | ||
import identity from "../identity"; | ||
@@ -16,3 +16,4 @@ import {transformer} from "../transform"; | ||
var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform = identity, // scale, translate and reflect | ||
x0 = null, y0, x1, y1, clip = identity, // clip extent | ||
x0 = null, y0, x1, y1, // clip extent | ||
postclip = identity, | ||
cache, | ||
@@ -29,6 +30,9 @@ cacheStream, | ||
stream: function(stream) { | ||
return cache && cacheStream === stream ? cache : cache = transform(clip(cacheStream = stream)); | ||
return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); | ||
}, | ||
postclip: function(_) { | ||
return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; | ||
}, | ||
clipExtent: function(_) { | ||
return arguments.length ? (clip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; | ||
return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; | ||
}, | ||
@@ -35,0 +39,0 @@ scale: function(_) { |
import clipAntimeridian from "../clip/antimeridian"; | ||
import clipCircle from "../clip/circle"; | ||
import {clipExtent} from "../clip/extent"; | ||
import clipRectangle from "../clip/rectangle"; | ||
import compose from "../compose"; | ||
@@ -18,2 +18,11 @@ import identity from "../identity"; | ||
function transformRotate(rotate) { | ||
return transformer({ | ||
point: function(x, y) { | ||
var r = rotate(x, y); | ||
return this.stream.point(r[0], r[1]); | ||
} | ||
}); | ||
} | ||
export default function projection(project) { | ||
@@ -50,11 +59,19 @@ return projectionMutator(function() { return project; })(); | ||
projection.stream = function(stream) { | ||
return cache && cacheStream === stream ? cache : cache = transformRadians(preclip(rotate, projectResample(postclip(cacheStream = stream)))); | ||
return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); | ||
}; | ||
projection.preclip = function(_) { | ||
return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; | ||
}; | ||
projection.postclip = function(_) { | ||
return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; | ||
}; | ||
projection.clipAngle = function(_) { | ||
return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians, 6 * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees; | ||
return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees; | ||
}; | ||
projection.clipExtent = function(_) { | ||
return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; | ||
return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; | ||
}; | ||
@@ -61,0 +78,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1875412
82
5310
663