婷婷久久网-婷婷久久久久-婷婷久久久-婷婷久-国产微拍精品一区-国产网址在线观看

BIGEMPA Js API示例中心

標注聚合顯示源代碼展示

代碼編輯區 運行 下載 還原
<!DOCTYPE html>

<html>
<head>
	<meta charset='UTF-8' />
	<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
	<!--
        以下CSS地址請在安裝軟件了替換成本地的地址
        CSS地址請使用:
        http://localhost:9000/bigemap.js/v2.1.0/bigemap.css
        軟件下載地址 http://www.xjqqc.cn/reader/download/detail201802017.html
    -->
	<link href="http://ua.bigemap.com:30081/bmsdk/bigemap.js/v2.1.0/bigemap.css" rel="stylesheet"/>
	<!--
        JS地址請使用:
        http://localhost:9000/bigemap.js/v2.1.0/bigemap.js
    -->
	<script src="http://ua.bigemap.com:30081/bmsdk/bigemap.js/v2.1.0/bigemap.js"></script>
	<!--引入對應的JS+CSS 相關下載地址 http://www.xjqqc.cn/Public/offline/marker_cluster/cluster.zip-->
	<link rel="stylesheet" href="/Public/offline/marker_cluster/MarkerCluster.Default.css" />
	<script src="/Public/offline/marker_cluster/bm.markercluster-src.js"></script>
	<style type="text/css">
		*{
			padding: 0;
			margin: 0;
		}
		html,body,#map{
			width: 100%;
			height: 100%;
		}
	</style>
</head>
<body>
  <div id='map'></div>
  <script>
    BM.Config.HTTP_URL = "http://ua.bigemap.com:30081/bmsdk/"
    var map = BM.map('map', 'bigemap.dc-satellite', {
        crs: BM.CRS.EPSG4326,
      center: [30.6, 104.5],
      zoom: 7,
      zoomControl: true,
      attributionControl: false
    });
    //登陸聚合對象
    var markers = new BM.MarkerClusterGroup({
      showCoverageOnHover: false, //不顯示邊界
      zoomToBoundsOnClick: true,//點擊放大到對應位置
      removeOutsideVisibleBounds: false,
      animate: true,//動畫
      maxClusterRadius: 100,//縮放半徑,
      disableClusteringAtZoom:null,//在指定級別以下禁用縮放
      //使用定義的圖標來顯示
      // iconCreateFunction: function (cluster) {
      //   var markers = cluster.getAllChildMarkers();

      //   // BM.icon({iconUrl:'http://www.xjqqc.cn/mapoffline/marker/2.png'}) 
      //   return BM.divIcon({
      //     html: `<div class="icon">${markers.length}</div>`,
      //     iconSize: BM.point(40, 40)
      //   });
      // }
    })
    // BM.marker([i*5,j*5],{icon:BM.icon({iconUrl:'http://www.xjqqc.cn/mapoffline/marker/'+20+'.png'})}).addTo(map);
    var markersList = [];
    //生成2000個點推入標記數組
    function populate() {
      for (let i = 0; i < 2000; i++) {
        let m = new BM.marker(getRandomLatLng(map), {
          icon: BM.icon({
            iconUrl: 'http://www.xjqqc.cn/mapoffline/marker/' + 2 + '.png'
          })
        })
        markersList.push(m);
        markers.addLayer(m);
      }
      return false
    }
    //根據當前的范圍生成隨機的點
    function getRandomLatLng(map) {
      let bounds = map.getBounds(),
        southWest = bounds.getSouthWest(),
        northEast = bounds.getNorthEast(),
        lngSpan = northEast.lng - southWest.lng,
        latSpan = northEast.lat - southWest.lat;
      return new BM.LatLng(
        southWest.lat + latSpan * Math.random(),
        southWest.lng + lngSpan * Math.random());
    }
    //對聚合的實例添加點擊事件
    markers.on('clusterclick', function (a) {
      console.log('cluster' + a.layer.getAllChildMarkers().length);
    })
    //對標注添加一個點擊事件
    markers.on('click', function (a) {
      alert('marker ' + a.layer);
    });
    populate();
    map.addLayer(markers);
  </script>
</body>

</html>            
主站蜘蛛池模板: 女生被艹网站| 热情电影| paigeturnah大白臀| a day to remember英语作文| 书柜效果图大全2023款| 二次曝光电影有删减吗| 戚继光电影| 漂亮孕妇突然肚子疼视频| 电影《忌讳》完整版| 路易斯·帕特里奇| 桜木郁| 巴霍巴利王2国语版在线观看免费| 安全员c证考试免费题库| 电影 英雄| 人流后吃什么| 国产精品欧美大片| 281封信电视剧演员表| 陈智熙| love 电影| 英雄第二季| 男情难了完整版电影| 破冰 电影| 洛可希佛帝的电影| 91天堂素人97年清纯嫩模| 鬼吹灯之精绝古城演员表| 散文诗二首批注| 小红书如何开通店铺| 变形金刚2演员表| 87电影| 蒙古族民歌《酒歌》| 1881年| 花守由美里| 男男女女 电影| 渝火先孕后爱小说免费阅读| 削发| 青春派电视剧免费完整版在线观看| 彩云曲 电影| 秦皇岛电视台| 出轨幻想| 黄霄云个人资料| 唐人街探案一免费观看完整版高清 |