-
Notifications
You must be signed in to change notification settings - Fork 0
/
069619cd.js
1 lines (1 loc) · 3 KB
/
069619cd.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{"/pBb":function(w,f,e){"use strict";e.r(f),e.d(f,"default",function(){return H});var n=e("nKUr"),z=e.n(n),F=e("y8nQ"),M=e("Vl3Y"),W=e("c1Ei"),o=e.n(W),p=e("5Tp6"),B=e("XKWP"),I=e("N7Kx"),K=e("kFHX"),y=e("4jIl"),G=e("OaEy"),P=e("2fM7"),L=e("q1tI"),R=e.n(L),l=e("VphZ"),S=P.a.Option,H=function($){Object(K.a)(d,$);var b=Object(y.a)(d);function d(){var t;Object(B.a)(this,d);for(var u=arguments.length,i=new Array(u),a=0;a<u;a++)i[a]=arguments[a];return t=b.call.apply(b,[this].concat(i)),t.svgWidth=960,t.svgHeight=500,t.drawSvg=Object(p.a)(o.a.mark(function s(){var c,m,E,r,h,C,v,g,A,j,U,T,O=arguments;return o.a.wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return c=O.length>0&&O[0]!==void 0?O[0]:{},m=c.projectionType,E=m===void 0?0:m,r=l.select(".geo-test"),r.selectAll("svg").remove(),h=r.append("svg").attr("width",t.svgWidth).attr("height",t.svgHeight).style("border","1px solid black"),C="./geo/world-110m.geojson",_.next=7,l.json(C);case 7:return v=_.sent,g=t.projections[E].value().fitSize([t.svgWidth,t.svgHeight],v),A=l.geoPath().projection(g),j=h.selectAll("path").data(v.features),j.enter().append("path").attr("d",A).attr("fill","#42dcbe"),j.exit().remove(),_.next=15,l.json("./geo/ne_50m_populated_places_simple.geojson");case 15:U=_.sent,T=h.selectAll("circle").data(U.features),T.enter().append("circle").attr("cx",function(D){return g(D.geometry.coordinates)[0]}).attr("cy",function(D){return g(D.geometry.coordinates)[1]}).attr("fill","rgba(0,0,0,0)").attr("stroke","red").transition().duration(500).ease(l.easeCircleOut).attr("r",2);case 18:case"end":return _.stop()}},s)})),t.projections=["geoAzimuthalEqualArea","geoAzimuthalEquidistant","geoGnomonic","geoOrthographic","geoStereographic","geoAlbersUsa","geoAlbers","geoConicConformal","geoConicEquidistant","geoEquirectangular","geoMercator","geoTransverseMercator","geoNaturalEarth1","geoGraticule"].map(function(s){return{label:s,value:l[s]}}),t.handProjection=function(){var s=Object(p.a)(o.a.mark(function c(m){return o.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,t.drawSvg({projectionType:m});case 3:r.next=8;break;case 5:r.prev=5,r.t0=r.catch(0),console.error(r.t0);case 8:case"end":return r.stop()}},c,null,[[0,5]])}));return function(c){return s.apply(this,arguments)}}(),t}return Object(I.a)(d,[{key:"componentDidMount",value:function(){var t=Object(p.a)(o.a.mark(function i(){return o.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,this.drawSvg();case 2:case"end":return s.stop()}},i,this)}));function u(){return t.apply(this,arguments)}return u}()},{key:"render",value:function(){return Object(n.jsxs)(n.Fragment,{children:[Object(n.jsx)(M.a,{children:Object(n.jsx)(M.a.Item,{label:"\u6295\u5F71\u7C7B\u578B",children:Object(n.jsx)(P.a,{defaultValue:0,onChange:this.handProjection,children:this.projections.map(function(u,i){var a=u.label;return Object(n.jsx)(S,{value:i,children:a},a)})})})}),Object(n.jsx)("div",{className:"geo-test"})]})}}]),d}(R.a.Component)}}]);