function _hasAncestor(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}BM.drawVersion="0.4.2",BM.Draw={},BM.drawLocal={draw:{toolbar:{actions:{title:"取消",text:"取消"},finish:{title:"完成",text:"完成"},undo:{title:"删除最后一个点",text:"删除最后一个点"},buttons:{polyline:"线条",polygon:"多边形",rectangle:"矩形",circle:"圆",marker:"标注",circlemarker:"圆标注"}},handlers:{circle:{tooltip:{start:"单击开始"},radius:"半径"},circlemarker:{tooltip:{start:"单击地图开始"}},marker:{tooltip:{start:"单击地图开始"}},polygon:{tooltip:{start:"单击地图开始",cont:"",end:"双击完成"}},polyline:{error:"Error: 边界出错!",tooltip:{start:"单击地图开始",cont:"",end:"双击点完成"}},rectangle:{tooltip:{start:"单击地图开始"}},simpleshape:{tooltip:{end:"松开鼠标结束"}}}},edit:{toolbar:{actions:{save:{title:"保存",text:"保存"},cancel:{title:"取消",text:"Cancel"},clearAll:{title:"全部取消",text:"全部取消"}},buttons:{edit:"编辑",editDisabled:"请先选择一个要素",remove:"删除",removeDisabled:"没有删除的要素"}},handlers:{edit:{tooltip:{text:"单击定位点来编辑",subtext:""}},remove:{tooltip:{text:"删除"}}}}},BM.Draw.Event={},BM.Draw.Event.CREATED="draw:created",BM.Draw.Event.EDITED="draw:edited",BM.Draw.Event.DELETED="draw:deleted",BM.Draw.Event.DRAWSTART="draw:drawstart",BM.Draw.Event.DRAWSTOP="draw:drawstop",BM.Draw.Event.DRAWVERTEX="draw:drawvertex",BM.Draw.Event.EDITSTART="draw:editstart",BM.Draw.Event.EDITMOVE="draw:editmove",BM.Draw.Event.EDITRESIZE="draw:editresize",BM.Draw.Event.EDITVERTEX="draw:editvertex",BM.Draw.Event.EDITSTOP="draw:editstop",BM.Draw.Event.DELETESTART="draw:deletestart",BM.Draw.Event.DELETESTOP="draw:deletestop",BM.Draw.Event.TOOLBAROPENED="draw:toolbaropened",BM.Draw.Event.TOOLBARCLOSED="draw:toolbarclosed",BM.Draw.Event.MARKERCONTEXT="draw:markercontext",BM.Draw=BM.Draw||{},BM.Draw.Feature=BM.Handler.extend({initialize:function(t,e){this._map=t,this._container=t._container,this._overlayPane=t._panes.overlayPane,this._popupPane=t._panes.popupPane,e&&e.shapeOptions&&(e.shapeOptions=BM.Util.extend({},this.options.shapeOptions,e.shapeOptions)),BM.setOptions(this,e);var i=BM.version.split(".");1===parseInt(i[0],10)&&2<=parseInt(i[1],10)?BM.Draw.Feature.include(BM.Evented.prototype):BM.Draw.Feature.include(BM.Mixin.Events)},enable:function(){this._enabled||(BM.Handler.prototype.enable.call(this),this.fire("enabled",{handler:this.type}),this._map.fire(BM.Draw.Event.DRAWSTART,{layerType:this.type}))},disable:function(){this._enabled&&(BM.Handler.prototype.disable.call(this),this._map.fire(BM.Draw.Event.DRAWSTOP,{layerType:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var t=this._map;t&&(BM.DomUtil.disableTextSelection(),t.getContainer().focus(),this._tooltip=new BM.Draw.Tooltip(this._map),BM.DomEvent.on(this._container,"keyup",this._cancelDrawing,this))},removeHooks:function(){this._map&&(BM.DomUtil.enableTextSelection(),this._tooltip.dispose(),this._tooltip=null,BM.DomEvent.off(this._container,"keyup",this._cancelDrawing,this))},setOptions:function(t){BM.setOptions(this,t)},_fireCreatedEvent:function(t){this._map.fire(BM.Draw.Event.CREATED,{layer:t,layerType:this.type})},_cancelDrawing:function(t){27===t.keyCode&&(this._map.fire("draw:canceled",{layerType:this.type}),this.disable())}}),BM.Draw.Polyline=BM.Draw.Feature.extend({statics:{TYPE:"polyline"},Poly:BM.Polyline,options:{allowIntersection:!0,repeatMode:!1,drawError:{color:"#b00b00",timeout:2500},icon:new BM.DivIcon({iconSize:new BM.Point(8,8),className:"bigemap-div-icon bigemap-editing-icon"}),touchIcon:new BM.DivIcon({iconSize:new BM.Point(20,20),className:"bigemap-div-icon bigemap-editing-icon bigemap-touch-icon"}),guidelineDistance:20,maxGuideLineLength:4e3,shapeOptions:{stroke:!0,color:"#3388ff",weight:4,opacity:.5,fill:!1,clickable:!0},metric:!0,feet:!0,nautic:!1,showLength:!0,zIndexOffset:2e3,factor:1,maxPoints:0},initialize:function(t,e){BM.Browser.touch&&(this.options.icon=this.options.touchIcon),this.options.drawError.message=BM.drawLocal.draw.handlers.polyline.error,e&&e.drawError&&(e.drawError=BM.Util.extend({},this.options.drawError,e.drawError)),this.type=BM.Draw.Polyline.TYPE,BM.Draw.Feature.prototype.initialize.call(this,t,e)},addHooks:function(){BM.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._markers=[],this._markerGroup=new BM.LayerGroup,this._map.addLayer(this._markerGroup),this._clickHandle=!0,this._poly=new BM.Polyline([],this.options.shapeOptions),this._tooltip.updateContent(this._getTooltipText()),this._mouseMarker||(this._mouseMarker=BM.marker(this._map.getCenter(),{icon:BM.divIcon({className:"bigemap-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._map.on("mouseup",this._upEvent,this).on("mousemove",this._onMouseMove,this).on("zoomlevelschange",this._onZoomEnd,this).on("dragstart",this._dragStart,this).on("zoomend",this._onZoomEnd,this),this._map.getContainer()._bindTouch||(this._map.getContainer()._bindTouch=!0,this._map.getContainer().addEventListener("touchend",this._upEvent.bind(this))))},_dragStart:function(){this._drag=!0},_upEvent:function(t){if(!BM.Draw._clickHandled&&(BM.Draw._clickHandled=!0,setTimeout(function(){BM.Draw._clickHandled=!1},100),this._clickHandle)){if(this._drag)return this._drag=!1;var e,i=t.originalEvent||t.changedTouches[0],o=i.clientX,n=i.clientY;this._disableNewMarkers(),this._startPoint.call(this,o,n),t.latlng||(e=this._map.mouseEventToLayerPoint(i),t.latlng=this._map.layerPointToLatLng(e)),this._endPoint.call(this,o,n,t),this._tttt||(this._tttt={x:0,y:0}),5"+BM.GeometryUtil.readableArea(t,this.options.metric,this.options.precision)),e):null},_shapeIsValid:function(){return 3<=this._markers.length},_vertexChanged:function(t,e){var i;!this.options.allowIntersection&&this.options.showArea&&(i=this._poly.getLatLngs(),this._area=BM.GeometryUtil.geodesicArea(i)),BM.Draw.Polyline.prototype._vertexChanged.call(this,t,e)},_cleanUpShape:function(){var t=this._markers.length;0e&&(t._index+=i)})},_createMiddleMarker:function(e,i){var o,n,t,a=this._getMiddleLatLng(e,i),s=this._createMarker(a);s.setOpacity(.6),e._middleRight=i._middleLeft=s,n=function(){s.off("touchmove",n,this);var t=i._index;s._index=t,s.off("click",o,this).on("click",this._onMarkerClick,this),a.lat=s.getLatLng().lat,a.lng=s.getLatLng().lng,this._spliceLatLngs(t,0,a),this._markers.splice(t,0,s),s.setOpacity(1),this._updateIndexes(t,1),i._index++,this._updatePrevNext(e,s),this._updatePrevNext(s,i),this._poly.fire("editstart")},t=function(){s.off("dragstart",n,this),s.off("dragend",t,this),s.off("touchmove",n,this),this._createMiddleMarker(e,s),this._createMiddleMarker(s,i)},o=function(){n.call(this),t.call(this),this._fireEdit()},s.on("click",o,this).on("dragstart",n,this).on("dragend",t,this).on("touchmove",n,this),this._markerGroup.addLayer(s)},_updatePrevNext:function(t,e){t&&(t._next=e),e&&(e._prev=t)},_getMiddleLatLng:function(t,e){var i=this._poly._map,o=i.project(t.getLatLng()),n=i.project(e.getLatLng());return i.unproject(o._add(n)._divideBy(2))}}),BM.Polyline.addInitHook(function(){this.editing||(BM.Edit.Poly&&(this.editing=new BM.Edit.Poly(this),this.options.editable&&this.editing.enable()),this.on("add",function(){this.editing&&this.editing.enabled()&&this.editing.addHooks()}),this.on("remove",function(){this.editing&&this.editing.enabled()&&this.editing.removeHooks()}))}),BM.Edit=BM.Edit||{},BM.Edit.SimpleShape=BM.Handler.extend({options:{moveIcon:new BM.DivIcon({iconSize:new BM.Point(8,8),className:"bigemap-div-icon bigemap-editing-icon bigemap-edit-move"}),resizeIcon:new BM.DivIcon({iconSize:new BM.Point(8,8),className:"bigemap-div-icon bigemap-editing-icon bigemap-edit-resize"}),touchMoveIcon:new BM.DivIcon({iconSize:new BM.Point(15,15),className:"bigemap-div-icon bigemap-editing-icon bigemap-edit-move bigemap-touch-icon"}),touchResizeIcon:new BM.DivIcon({iconSize:new BM.Point(15,15),className:"bigemap-div-icon bigemap-editing-icon bigemap-edit-resize bigemap-touch-icon"})},initialize:function(t,e){BM.Browser.touch&&(this.options.moveIcon=this.options.touchMoveIcon,this.options.resizeIcon=this.options.touchResizeIcon),this._shape=t,BM.Util.setOptions(this,e)},addHooks:function(){var t=this._shape;this._shape._map&&(this._map=this._shape._map,t.setStyle(t.options.editing),t._map&&(this._map=t._map,this._markerGroup||this._initMarkers(),this._map.addLayer(this._markerGroup)))},removeHooks:function(){var t=this._shape;if(t.setStyle(t.options.original),t._map){this._unbindMarker(this._moveMarker);for(var e=0,i=this._resizeMarkers.length;e"+BM.drawLocal.edit.handlers.edit.tooltip.text,subtext:BM.drawLocal.draw.handlers.circle.radius+": "+BM.GeometryUtil.readableDistance(radius,!0,this.options.feet,this.options.nautic)}),this._shape.setRadius(radius),this._map.fire(BM.Draw.Event.EDITRESIZE,{layer:this._shape})}}),BM.Circle.addInitHook(function(){BM.Edit.Circle&&(this.editing=new BM.Edit.Circle(this),this.options.editable&&this.editing.enable())}),BM.Map.mergeOptions({touchExtend:!0}),BM.Map.TouchExtend=BM.Handler.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane},addHooks:function(){BM.DomEvent.on(this._container,"touchstart",this._onTouchStart,this),BM.DomEvent.on(this._container,"touchend",this._onTouchEnd,this),BM.DomEvent.on(this._container,"touchmove",this._onTouchMove,this),this._detectIE()?(BM.DomEvent.on(this._container,"MSPointerDown",this._onTouchStart,this),BM.DomEvent.on(this._container,"MSPointerUp",this._onTouchEnd,this),BM.DomEvent.on(this._container,"MSPointerMove",this._onTouchMove,this),BM.DomEvent.on(this._container,"MSPointerCancel",this._onTouchCancel,this)):(BM.DomEvent.on(this._container,"touchcancel",this._onTouchCancel,this),BM.DomEvent.on(this._container,"touchleave",this._onTouchLeave,this))},removeHooks:function(){BM.DomEvent.off(this._container,"touchstart",this._onTouchStart,this),BM.DomEvent.off(this._container,"touchend",this._onTouchEnd,this),BM.DomEvent.off(this._container,"touchmove",this._onTouchMove,this),this._detectIE()?(BM.DomEvent.off(this._container,"MSPointerDown",this._onTouchStart,this),BM.DomEvent.off(this._container,"MSPointerUp",this._onTouchEnd,this),BM.DomEvent.off(this._container,"MSPointerMove",this._onTouchMove,this),BM.DomEvent.off(this._container,"MSPointerCancel",this._onTouchCancel,this)):(BM.DomEvent.off(this._container,"touchcancel",this._onTouchCancel,this),BM.DomEvent.off(this._container,"touchleave",this._onTouchLeave,this))},_touchEvent:function(t,e){var i={};if(void 0!==t.touches){if(!t.touches.length)return;i=t.touches[0]}else{if("touch"!==t.pointerType)return;if(i=t,!this._filterClick(t))return}var o=this._map.mouseEventToContainerPoint(i),n=this._map.mouseEventToLayerPoint(i),a=this._map.layerPointToLatLng(n);this._map.fire(e,{latlng:a,layerPoint:n,containerPoint:o,pageX:i.pageX,pageY:i.pageY,originalEvent:t})},_filterClick:function(t){var e=t.timeStamp||t.originalEvent.timeStamp,i=BM.DomEvent._lastClick&&e-BM.DomEvent._lastClick;return i&&100(e.y-t.y)*(i.x-t.x)}}),BM.Polyline.include({intersects:function(){var t,e,i,o=this._getProjectedPoints(),n=o?o.length:0;if(this._tooFewPointsForIntersection())return!1;for(t=n-1;3<=t;t--)if(e=o[t-1],i=o[t],this._lineSegmentsIntersectsRange(e,i,t-2))return!0;return!1},newLatLngIntersects:function(t,e){return!!this._map&&this.newPointIntersects(this._map.latLngToLayerPoint(t),e)},newPointIntersects:function(t,e){var i=this._getProjectedPoints(),o=i?i.length:0,n=i?i[o-1]:null,a=o-2;return!this._tooFewPointsForIntersection(1)&&this._lineSegmentsIntersectsRange(n,t,a,e?1:0)},_tooFewPointsForIntersection:function(t){var e=this._getProjectedPoints(),i=e?e.length:0;return i+=t||0,!e||i<=3},_lineSegmentsIntersectsRange:function(t,e,i,o){var n,a,s=this._getProjectedPoints();o=o||0;for(var r=i;o'+t.subtext+"
":"")+""+t.text+"",t.text||t.subtext?(this._visible=!0,this._container.style.visibility="inherit"):(this._visible=!1,this._container.style.visibility="hidden")),this},updatePosition:function(t){var e=this._map.latLngToLayerPoint(t),i=this._container;return this._container&&(this._visible&&(i.style.visibility="inherit"),BM.DomUtil.setPosition(i,e)),this},showAsError:function(){return this._container&&BM.DomUtil.addClass(this._container,"bigemap-error-draw-tooltip"),this},removeError:function(){return this._container&&BM.DomUtil.removeClass(this._container,"bigemap-error-draw-tooltip"),this},_onMouseOut:function(){this._container&&(this._container.style.visibility="hidden")}}),BM.Toolbar=BM.Class.extend({initialize:function(t){BM.setOptions(this,t),this._modes={},this._actionButtons=[],this._activeMode=null;var e=BM.version.split(".");1===parseInt(e[0],10)&&2<=parseInt(e[1],10)?BM.Toolbar.include(BM.Evented.prototype):BM.Toolbar.include(BM.Mixin.Events)},enabled:function(){return null!==this._activeMode},disable:function(){this.enabled()&&this._activeMode.handler.disable()},addToolbar:function(t){var e,i=BM.DomUtil.create("div","bigemap-draw-section"),o=0,n=this._toolbarClass||"",a=this.getModeHandlers(t);for(this._toolbarContainer=BM.DomUtil.create("div","bigemap-draw-toolbar bigemap-bar"),this._map=t,e=0;e