⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newmapobj.js

📁 正在使用的大型OA系统
💻 JS
字号:
//地图标点后显示在图标旁边的文字样式
var jsFONT_Width = 60;  
var jsFONT_Size = 12;
var jsFONT_Color = "005c9a";
var jsFONT_BorderColor = "#FFFFFF";
var jsFONT_BorderWidth = 3;
var jsFONT_Family = "宋体";
var jsNameDiv_BackgroundColor = "#FFFFCC"; //图标旁标题区域背景色

var mapConfig = {
	currentCityCode  : '010',
	currentCityName  : '北京市'
};

var mapPoiConfig = {
	poiIcon      : 'images/tack.gif'
};

var mapLineConfig = {
	lineColor    : '#FF0000',
	lineStroke   : 3
};

function MapInfo() {

	this.poiCount = 0;
	this.lineCount = 0;
	
	this.currentCityCode = mapConfig.currentCityCode;
	this.currentCityName = mapConfig.currentCityName;
}

function MapPoi() {
	this.objId = new Date().getTime()+""+parseInt(Math.random()*10000); //对象的唯一id
	
	this.tr; //标点对象 对应 列表上的Tr对象
	this.marker; //标点对象 对应 地图显示的MMarker对象
	this.color = jsFONT_Color; //标注点在地图上icon旁边的Name颜色
	this.type = 0;  //标点类型
	
	this.id = 0; //数据对应数据库的id
	this.name = ""; //标点名称
	this.phone = ""; //电话
	this.address = ""; //地址
	this.description = ""; //简介、描述
	this.url = ""; //超链接

	this.lat = 0; //纬度
	this.lon = 0; //经度
	this.strlatlon = ""; //加密后经纬度字符串
  this.preIcon = null; //图标的预读
  this.preIconReadSign = 0; //图标预读保护,避免死循环
	this.icon = mapPoiConfig.poiIcon; //使用图标
	this.iconWidth = -1; //用于输出icon时使用
	this.iconHeight = -1;
	this.showIconName = true; //false时只显示图标,不显示后面的文字
	
	this.citycode = "010"; //城市代码 默认为北京
	
	
	//自动生成地图标注点的marker信息 标题(可用html标签,可根据需要进行修改)
	this.tmpMarkerTitle = ""; //临时Title,如果给Title赋值,则增加点时将不再执行getMarkerTitle方法
	this.getMarkerTitle = function() {
		var sHtml = "";
		if(this.tmpMarkerTitle.length>0) {
			sHtml = this.tmpMarkerTitle;
		}else{
			sHtml = this.name;
		}
		return sHtml; 
	}
	//自动生成地图标注点的marker信息 内容(可用html标签,可根据需要进行修改)
	this.tmpMarkerContent = "";
	this.getMarkerContent = function() {
		var sHtml = "";
		if(this.tmpMarkerContent.length>0) {
			sHtml = this.tmpMarkerContent;
		}else{
			if(this.phone.length>0) sHtml += "<b>电话</b>" + this.phone;
			if(this.address.length>0) sHtml += "<br><b>地址</b>" + this.address;
			if(this.description.length>0) sHtml += "<br><b>简介</b>" + this.description;
		}
		return sHtml;
	}
	//自动生成地图标注点的marker信息 图标(可用html标签,可根据需要进行修改)
	this.tmpMarkerIcon = "";
	this.getMarkerIcon = function() {
		var sHtml = "";
		if(this.tmpMarkerIcon.length>0) {
			sHtml = this.tmpMarkerIcon;
		}else{
			//sHtml = "<div unselectable=on style=position:absolute;left:0;white-space:nowrap;FONT-SIZE:"+jsFONT_Size+"px;filter:glow(color="+jsFONT_BorderColor+",strength="+jsFONT_BorderWidth+");height:0px;color="+jsFONT_Color+";font-family:"+jsFONT_Family+";><img onclick=\"javascript:return false;\" src="+this.icon+" "+((this.iconWidth<0)?"":("width="+this.iconWidth))+" "+((this.iconHeight<0)?"":("height="+this.iconHeight))+" ><div unselectable=on style=position:relative;left:0;white-space:nowrap;BACKGROUND-COLOR:yellow;>"+this.name+"</div></div>";
			if(this.name.length>0 && this.showIconName) {
				sHtml = "<div unselectable=on style=position:absolute;left:0;white-space:nowrap;><table border=0 cellpadding=0 cellspacing=0><tr><td unselectable=on style=white-space:nowrap;><img onclick=\"javascript:return false;\" src="+this.icon+" "+((this.iconWidth<0)?"":("width="+this.iconWidth))+" "+((this.iconHeight<0)?"":("height="+this.iconHeight))+" ></td><td><table border=0 cellpadding=1 cellspacing=1 bgcolor="+this.color+"><tr><td unselectable=on height=20 valign=middle style=white-space:nowrap;BACKGROUND-COLOR:"+jsNameDiv_BackgroundColor+";FONT-SIZE:"+jsFONT_Size+"px;filter:glow(color="+jsFONT_BorderColor+",strength="+jsFONT_BorderWidth+");color:"+this.color+";font-family:"+jsFONT_Family+";>"+this.name+"</td></tr></table></td></tr></table></div>";
			} else {
				sHtml = "<div unselectable=on style=position:absolute;left:0;white-space:nowrap;><table border=0 cellpadding=0 cellspacing=0><tr><td unselectable=on style=white-space:nowrap;><img onclick=\"javascript:return false;\" src="+this.icon+" "+((this.iconWidth<0)?"":("width="+this.iconWidth))+" "+((this.iconHeight<0)?"":("height="+this.iconHeight))+" ></td></tr></table></div>";
			}
		}		
		return sHtml;
	}
}

function MapLine() {
	this.objId = new Date().getTime()+""+parseInt(Math.random()*10000); //对象的唯一id
	this.tr; //线、面对象 对应 列表上的Tr对象
	this.marker; //线、面对象 对应 地图显示的MMarker对象
	this.color = mapLineConfig.lineColor; //线颜色
	this.stroke = mapLineConfig.lineStroke; //线粗细
	this.type = 0; //线、面类型 0:线;1:带阴影面积
	
	this.id = 0; //数据对应数据库的id
	this.name = ""; //线段名称
	this.phone = ""; //电话
	this.address = ""; //地址
	this.description = ""; //简介、描述
	this.url = ""; //超链接

	
	this.strlatlon = ""; //线段各点经纬度字符串
	this.centerlatlon = ""; //线段中心点经纬度字符串
	this.citycode = "010"; //城市代码 默认为北京
	
	//自动生成地图线、面的marker信息 标题(可用html标签,可根据需要进行修改)
	this.tmpMarkerTitle = ""; //临时Title,如果给Title赋值,则增加点时将不再执行getMarkerTitle方法
	this.getMarkerTitle = function() {
		var sHtml = "";
		if(this.tmpMarkerTitle.length>0) {
			sHtml = this.tmpMarkerTitle;
		}else{
			sHtml = this.name;
		}
		return sHtml; 
	}
	//自动生成地图线、面的marker信息 内容(可用html标签,可根据需要进行修改)
	this.tmpMarkerContent = "";
	this.getMarkerContent = function() {
		var sHtml = "";
		if(this.tmpMarkerContent.length>0) {
			sHtml = this.tmpMarkerContent;
		}else{
			if(this.phone.length>0) sHtml += "<b>电话</b>" + this.phone;
			if(this.address.length>0) sHtml += "<br><b>地址</b>" + this.address;
			if(this.description.length>0) sHtml += "<br><b>简介</b>" + this.description;
		}
		return sHtml;
	}
	
	//根据this.strlatlon自动生成线段各端点的Array集合
	this.getMPointArray = function() {
		var mpArray = new Array();
		var pArray = this.strlatlon.split(",");
		for(var i=0;i<pArray.length;i++) {
			if(pArray[i].length>0) {
				mpArray.push(new MPoint(pArray[i]));
			}
		}
		return mpArray;
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -