BIGEMPA Js API示例中心
<!DOCTYPE html> <html> <head> <title>draw</title> <!-- 以下CSS地址請在安裝軟件了替換成本地的地址 CSS地址請使用: http://localhost:9000/bigemap.js/v2.1.0/bigemap.css JS地址請使用: http://localhost:9000/bigemap.js/v2.1.0/bigemap.js 軟件下載地址 http://www.kenshimo.com/reader/download/detail201802017.html --> <link href='http://www.kenshimo.com:9000/bigemap.js/v2.1.0/bigemap.css' rel='stylesheet' /> <script src='http://www.kenshimo.com:9000/bigemap.js/v2.1.0/bigemap.js'></script> <!--引入鼠標繪制的JS+CSS--> <!--對應下面的CSS+JS的下載地址 請直接訪問 http://bigemap.com/public/mouse_draw/mouse_draw.zip 來下載--> <link rel="stylesheet" href="/Public/mouse_draw/Bigemap.draw.css"/> <script src="/Public/js/bm.draw.min.js"></script> </head> <style type="text/css"> html,body,#map{ width: 100%; height: 100%; } .bigemap-draw-section{top:50px;} </style> <body> <div id="map"> </div> <script> //軟件配置信息地址,軟件安裝完成之后使用本地地址,如: //http://localhost:9000 BM.Config.HTTP_URL = 'http://www.kenshimo.com:9000'; // 在ID為map的元素中實例化一個地圖,并設置地圖的ID號為 bigemap.arcgis-satellite,ID號程序自動生成,無需手動配置,并設置地圖的投影為百度地圖 ,中心點,默認的級別和顯示級別控件 var map = BM.map('map', 'bigemap.arcgis-satellite', {center: [30, 104], zoom: 8, zoomControl: true,attributionControl:false }); //創建一個圖形覆蓋物的集合來保存點線面 var drawnItems = new BM.FeatureGroup(); //添加在地圖上 map.addLayer(drawnItems); // 為多邊形設置一個標題 BM.drawLocal.draw.toolbar.buttons.polygon = '添加一個多邊形'; //實例化鼠標繪制的控件 var drawControl = new BM.Control.Draw({ position: 'topright',//位置 //控制繪制的圖形 draw: { polyline: { //單獨設置線的顏色為紅色,其它為默認顏色 shapeOptions:{ color:'red' } }, polygon: true, circle: true, marker: true }, edit: { featureGroup: drawnItems } }); map.addControl(drawControl); //監聽繪畫完成事件 map.on(BM.Draw.Event.CREATED, function (e) { var type = e.layerType, layer = e.layer; if (type === 'marker') { //如果是標注,實現一個點擊出現的提示 layer.bindPopup('A popup!'); } drawnItems.addLayer(layer); }); </script> </body> </html>