/** * 专题图操作类 * */ 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+='
';
str+='
';
str+='
';
str+='
';
str+='
';
str+='
";
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,"+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