BIGEMPA Js API示例中心

甜甜圈源代码展示

代码编辑区 运行 下载 还原
                                    <!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title>Document</title>
  <link href="https://cdn.bootcss.com/Buttons/2.0.0/css/buttons.min.css" rel="stylesheet">
  <link href='http://www.bigemap.com:9000/bigemap.js/v2.1.0/bigemap.css' rel='stylesheet' />
  <script src='http://www.bigemap.com:9000/bigemap.js/v2.1.0/bigemap.js'></script>
  <script type="text/javascript" src="/Public/offline/js/bm.geometryutil.js"></script>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    #map {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 100%;
    }
  </style>
</head>

<body>
  <div id='map'></div>
  <svg>
    <defs>
      <radialGradient id="radia" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
        
          <stop offset="50%"  style="stop-color:rgb(242,165,173); "/>
          <stop offset="70%"  style="stop-color:rgb(245,183,190); "/>
          <stop offset="90%"  style="stop-color:rgb(248,209,212); "/>
          <stop offset="100%"  style="stop-color:rgb(242,165,173); "/>
      </radialGradient>
  </defs>
  </svg>
  <script>
    BM.Config.HTTP_URL = 'http://www.bigemap.com:9000';
    var map = BM.map('map', 'bigemap.amap-satellite', {
      center: [30.4, 104.5],
      zoom: 7,
      zoomControl: true,
      attributionControl: false
    });
    //扇形的半径
    var radius = 500000;
    var color = ["#f7acbc", "#deab8a", "#817936", "#444693"];
    var path = [];
    for (var i = 0; i <=360; i++) {
      path.push(BM.GeometryUtil.destination(map.getCenter(), i, radius));
    }
    path=[path,[]]
    for (var i = 360; i >=0; i--) {
      path[1].push(BM.GeometryUtil.destination(map.getCenter(), i, radius/2));
    }
    var polygon=BM.polygon(path, {
      fillColor:"url(#radia)",
      fillOpacity: 1
    }).addTo(map);
    //点击更换其边框颜色
    polygon.on('click',function(){
        polygon.setStyle({color:'yellow'})
    })
  </script>
</body>

</html>