//工具条移位操作
function Shift(){
	//鼠标按下事件对象
	Shift.mouseDown=null;
	//鼠标拖拽事件对象
	Shift.mouseDrag=null;
	//鼠标松开事件对象
	Shift.mouseUp=null;
}
Shift.init=function (){
	Shift();
};
//地图设备移动实现
Shift.moveHandlerFunction=function(event){
	var graphic=event.graphic;
   	 //鼠标移动设备事件
	var name = graphic.attributes.name;
	Shift.mouseDrag=MapAPI.getMap().on("mouse-drag", function(e) {
			var data=null;
 			var point = MapAPI.getMap().toMap(e.screenPoint);
 			
 		    if(event.graphic!=undefined){
	    	    data={
	    			tdmc:name,
	    			xh:graphic.attributes.xh,
	    			jd:point.x,
	    			wd:point.y,
	    			imgUrl:graphic.symbol.url
	    	    };
	    		var html="<div class='bcontent'><div><span style='color:#75767A'>"+data.tdmc+"</span></div>" +
				"<ul  class='bcontentItem'>" +
					"<li onclick='Label.realtimeVideo(\""+data.xh+"\")'>视频</li>" +
//					"<li onclick='Label.artificialAlarm(\""+item.xh+"\")'>人工告警</li><br/>" +
					"<li onclick='Label.recordNav(\""+data.xh+"\")'>录像</li><br/>" +
					"<li onclick='Label.detailInformation(\""+data.xh+"\")'>详细信息</li>" +
					"<li onclick='removeCamera(\""+data.xh+"\")'>删除</li>" +
				"</ul></div>";
 		    	 MapAPI.getCameraGraphicsLayer().remove(graphic);
// 		    	 console.log("data：",data);
 		    	 graphic= MapUtil.addPoint(data,html);
 		     }
			if(Shift.mouseUp){
				Shift.mouseUp.remove();
			}
			//鼠标松开事件 清除相关事件
			Shift.mouseUp=MapAPI.getMap().on("mouse-up",function(ee){
				Shift.mouseDown.remove();
				Shift.mouseDrag.remove();
				Shift.mouseUp.remove();
				MapAPI.getMap().enablePan();
				var xh = data.xh;
				if(xh!=null && xh!=''){
					$.ajax({
						 type:'post',
						 dataType : 'json',
						 url:'sbtdspsrAction!update_Sbtdspsr.do',
						 data:data,
						 success:function(flag){
							 if(flag == "success"){
								 $.showMsg("设备移位成功!");
							 }else{
								 $.showMsg("设备移位失败!");
							 }
						 }
					});
				}			
				
			  });
 		});
 };
