/** * 专题图操作类 * */ function themeLabel(a) { this.b=a; this.m_XMLTheme=new ActiveXObject("Microsoft.XMLDOM"); this.x=0; this.y=0; //应该留一个公共接口来处理这些 Event.addListener(a.map,"zoom",this.eventHandler("refresh")); //Event.addListener(a.map,"moveend",this.eventHandler("refresh")); this.themetype=null; this.customerdata =null; } //客户刷新接口 themeLabel.prototype.refresh =function() { //edit by mmm 每次修改的时候就刷新专题图层 // alert(1); //直接个那一层 var x=14900; var y=20220; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); var nwidth = (mapc.map.zoomLevel+1)*76; var str='
'; str+='' + '' + '' + '' + '' + ''; str+='
'; var x=13534.0; var y=19468.0; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; var x=11900; var y=15000; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; var x=18900; var y=13000; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; var x=13900; var y=17000; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; var x=15900; var y=18000; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; var x=15700; var y=18500; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; var x=15200; var y=19000; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; var x=16900; var y=18000; var d=mapc.map.spec.getBitmapCoordinate(y,x,mapc.map.zoomLevel); var e=mapc.map.getDivCoordinate(d.x,d.y); str+='
'; str+=''; str+='
'; //alert(poistr);a var ttt=''; var strpts = poistr.split("|"); for(var i=0;i1) this.b.map.themeDiv.innerHTML=str; //先清空。然后再做操作 return ; // if(mapc.map.zoomLevel<2) // this.b.map.themeDiv.innerHTML=""; //先清空。然后再做操作 //return; // this.b.map.InfoDiv.innerHTML=""; //先清空。然后再做操作 // this.drawdemoRect(); // alert(this.b.map.tilePaddingOffset.width); // alert(this.b.map.tilePaddingOffset.height); //alert(this.b.map.currentPanOffset.width); //alert(this.b.map.currentPanOffset.height); // var k=this.b.map.topLeftTile.x; // var j= -this.b.map.topLeftTile.y; //alert((-k)+"_"+(j)); // alert(this.b.map.tileImages[]); for(var b=0;b'; str+='客户代码:'+code+''; str+='客户类型:'+strtype+''; str+=''; str+=''; this.infoWindow.offscreenArea.innerHTML=str;//写呀串对应的东西 var h=i=IconClass.get("default"); // this.b.map.cancelPan(); this.showSizedInfoWindow(x,y,h,true); } /* *GPS---window */ themeLabel.prototype.showSizedInfoWindow=function(a,b,c,c2) { if(!this.infoWindow) return; var d=Ticket.create("infoWindowOffscreen"); this.infoWindow.prepareOffscreen(); var e=this; var f=function() { if(d.isValid()) { e.infoWindow.flipOffscreenAndSize(); e.infoWindow.positionAt(a,b,c); e.infoWindow.show(); //if(!c2) e.panToInfoWindow(); Event.trigger(e,"infowindowopen",e.infoWindow.feature) } }; window.setTimeout(f,0) }; //关闭信息窗口 themeLabel.prototype.closeInfoWindow=function() { //alert("close"); if(this.infoWindow&&this.infoWindow.isVisible()) { this.infoWindow.hide(); this.resetCenterScreen(); Event.trigger(this,"infowindowclose",this.infoWindow.feature); this.infoWindow.feature=null; } }; /* *关闭信息窗口 */ themeLabel.prototype.onInfoCloseClick=function() { this.closeInfoWindow(); }; themeLabel.prototype.showPointInfo=function(id) { var sDlgFeature = 'dialogHeight:330px;dialogWidth:207px;edge:Raised;center:Yes;help:no;resizable:no;status:no;'; var sRev = window.showModalDialog('selectpoint.jsp?ID='+id, null, sDlgFeature); } themeLabel.prototype.showDocInfo=function(id) { var sDlgFeature = 'dialogHeight:330px;dialogWidth:207px;edge:Raised;center:Yes;help:no;resizable:no;status:no;'; window.open("biandian.htm","变电站信息","width=210,height=300"); // var sRev = window.showModalDialog('selectpoint.jsp?ID='+id, null, sDlgFeature); } var showLineInfo=function(id) { var sDlgFeature = 'dialogHeight:330px;dialogWidth:207px;edge:Raised;center:Yes;help:no;resizable:no;status:no;'; var sRev = window.showModalDialog('selectline.jsp?ID='+id, null, sDlgFeature); } /*Points对象*/ function Points() { this.add = _add; this.get = _get; this.size = _size; this.sortX = _sortX; this.sortY = _sortY; var collection = new Array(); this.collection = collection; /*向Points中添加Point*/ function _add(point) { collection[collection.length] = point; } /*从Points中取Point*/ function _get(i) { return collection[i]; } /*得到Points中Point的数量*/ function _size() { return collection.length; } /*按X排序*/ function _sortX() { collection.sort(SortX); } /*按Y排序*/ function _sortY() { collection.sort(SortY); } /*按X排序算法*/ function SortX(pt1, pt2) { if ( pt1.X == pt2.X ) return 0; return ( pt1.X < pt2.X ) ? -1 : 1; } /*按Y排序算法*/ function SortY(pt1, pt2) { if ( pt1.Y == pt2.Y ) return 0; return ( pt1.Y < pt2.Y ) ? -1 : 1; } } /*Point对象*/ function PointLong(x, y, url) { this.x = x; this.y = y; this.URL= url; } /****** edit by mmm demo 管线 ***/ //增加管线道的点的信息 themeLabel.prototype.addDemoPoint=function() { //先增加n多点 var a =this.b; var pts = new Points(); pts.add(new PointLong(116.8109375,40.90078125,'D3')); pts.add(new PointLong(116.81328125,40.87578125,'D4')); pts.add(new PointLong(116.81484375,40.8484375,'D5')); pts.add(new PointLong(116.81796875,40.8234375,'D6')); pts.add(new PointLong(116.8203125,40.7890625,'D7')); pts.add(new PointLong(116.82109375,40.76328125,'D8')); pts.add(new PointLong(116.8265625,40.74375,'D9')); pts.add(new PointLong(116.83515625,40.715625,'D10')); pts.add(new PointLong(116.84609375,40.6890625,'D11')); pts.add(new PointLong(116.85,40.6703125,'D12')); pts.add(new PointLong(116.8546875,40.65546875,'D13')); for( i=0;i"+id+""; var d = this.b.map.themeDiv; var nLevel = this.b.map.zoomLevel; var f=document.createElement("span"); f.style.position="absolute"; f.style.left=_pixel(x-3*nLevel); f.style.top=_pixel(y-8*nLevel); f.style.width=_pixel(200); f.innerText = id; f.style.fontSize=4*nLevel+"pt"; // f.style.fontsize=_pixel(23); f.style.zIndex =100; f.style.color="red"; d.appendChild(f); d.style.display=""; var img1= document.createElement("img"); img1.src="images/circle.gif"; var w =(nLevel+1)*4; img1.style.width=_pixel(w); img1.style.height=_pixel(w); img1.style.left=_pixel(x-w/2); img1.style.top=_pixel(y-w/2); /* img1.style.width=_pixel(20); img1.style.height=_pixel(20); img1.style.left=_pixel(x-10); img1.style.top=_pixel(y-10);*/ img1.style.position="absolute"; img1.style.zIndex =2; var o=this; img1.onclick=function(){ o.showPointInfo(id); } d.appendChild(img1); //d.innerHTML=str+""; }; //电力点demo画点,x,y,为像素坐标 themeLabel.prototype.drawBiandianPoint=function(x,y,id) { // var str =""+id+""; var strid=""; if(id==1) strid="A变电站"; if(id==2) strid="B变电站" if(id==3) strid="C变电站" var d = this.b.map.themeDiv; var nLevel = this.b.map.zoomLevel; var f=document.createElement("span"); f.style.position="absolute"; f.style.left=_pixel(x-3*nLevel); f.style.top=_pixel(y-8*nLevel); f.style.width=_pixel(200); f.innerText = strid; f.style.fontSize=4*nLevel+"pt"; // f.style.fontsize=_pixel(23); f.style.zIndex =100; f.style.color="red"; d.appendChild(f); d.style.display=""; var img1= document.createElement("img"); img1.src="images/SD.gif"; var w =(nLevel+1)*8; img1.style.width=_pixel(w); img1.style.height=_pixel(w); img1.style.left=_pixel(x-w/2); img1.style.top=_pixel(y-w/2); /* img1.style.width=_pixel(20); img1.style.height=_pixel(20); img1.style.left=_pixel(x-10); img1.style.top=_pixel(y-10);*/ img1.style.position="absolute"; img1.style.zIndex =2; var o=this; img1.onclick=function(){ o.showDocInfo(id); } d.appendChild(img1); //d.innerHTML=str+""; }; themeLabel.prototype.drawLine=function(strPoints,id) { var obj = null; var strid="car_"+id; var t= document.getElementById(strid); var d = this.b.map.themeDiv; var nLevel = this.b.map.zoomLevel; var vpl = document.createElement("v:polyline"); vpl.id ="car_"+id; vpl.unselectable = "on"; vpl.strokecolor = "#ff0000"; vpl.strokeweight = nLevel + "pt"; vpl.fill = false; vpl.filled = false; vpl.points=strPoints; vpl.onclick="showLineInfo("+id+")"; vstroke = document.createElement("v:stroke"); vstroke.opacity = (60 / 100); vstroke.joinstyle = "round"; vstroke.endcap = "round"; vstroke.fill = "false"; vpl.appendChild(vstroke); d.appendChild(vpl); d.innerHTML += vpl.outerHTML; } function drawPolygon(strPoints,id) { //alert(strPoints); var obj = null; var strid="car_"+id; var t= document.getElementById(strid); var d = mapc.map.InfoDiv; var nLevel = mapc.map.zoomLevel; var vpl = document.createElement("v:polyline"); vpl.id ="car_"+id; vpl.unselectable = "on"; vpl.strokecolor = "#ffff00"; // vpl.strokeweight = nLevel + "pt"; vpl.strokeweight = 0 + "pt"; vpl.fill = true; vpl.transparent = 50; vpl.filled = true; vpl.style.filter="alpha(opacity=1,style=0)";//隐藏起来,click的时候可以show出来 vpl.points=strPoints; // var strxy= strPoints.split(","); // vpl.onmouseover="mapc.map.showGPSInfoWindow("+strxy[0]+","+strxy[1]+",'test')"; // vpl.onmouseout="mapc.map.closeInfogpsWindow('out')"; // vpl.onmousemove="mapc.map.showGPSInfoWindow("+strxy[0]+","+strxy[1]+",'test')"; vpl.onmouseout="mapc.map.tipDiv.style.display='none'"; vpl.onmouseup="mapc.map.tipDiv.style.display='block';mapc.map.tipDiv.innerHTML='"+id+"'"; vpl.onmouseover="mapc.map.tipDiv.style.display='block';mapc.map.tipDiv.innerHTML='"+id+"'"; vpl.onmousemove="mapc.map.tipDiv.style.display='block';mapc.map.tipDiv.innerHTML='"+id+"'"; // vpl.onmouseup="return false;"; vstroke = document.createElement("v:stroke"); vstroke.opacity = (50/ 100); vstroke.joinstyle = "round"; vstroke.endcap = "round"; vstroke.fill = "false"; vpl.appendChild(vstroke); d.appendChild(vpl); d.innerHTML += vpl.outerHTML; } themeLabel.prototype.drawdemoRect=function() { var pts = new Points(); // pts.add(new PointLong(116.7125,40.6140625,'xxxxx')); // pts.add(new PointLong(116.74453125,40.62578125,'xxxxx')); //pts.add(new PointLong(116.85078125,40.60109375,'xxxxx')); //pts.add(new PointLong(116.85078125,39.60109375,'xxxxx')); var strpts=''; var a=this.b; // alert(strpts) //构造相应的rect参数 for(var i=0;i"; document.getElementById('output').innerHTML += "

,"+d.x + ","+d.y // document.getElementById('output').style.display="none"; } var arrinfo=[]; function loadJs(x, y, z) { //将数据和图形分离服务器就靠这个东西 var xmljsid = "xmljs" + z + "," + x + "," + y; // alert(xmljsid); if (!document.getElementById(xmljsid)) { var xmljselm = document.createElement("script"); xmljselm.language = "javascript"; xmljselm.id = xmljsid; xmljselm.src = "http://localhost:8888/km/" + "/abc.jsp?x=" + x + "&y=" + y + "&z=" + z + "&t="+parseInt( Math.random() * 123255); document.body.appendChild(xmljselm); }else{ //如果存在就直接画 // alert(xmljsid); var str= eval("arrinfo['"+xmljsid+"']"); // alert(str); drawVML(str); // alert("exit"); } } function drawVML(strpoints){ // alert(strpoints); var pts= strpoints.split("&"); // alert(pts.length); for(var i=0;i