- 浏览: 149042 次
- 性别:
- 来自: 南昌
文章分类
- 全部博客 (123)
- Hibernate (10)
- Struts2 (6)
- Spring (5)
- Maven (11)
- Eclipse (5)
- Mysql (14)
- Html (3)
- IIS (4)
- Svn (2)
- Jquery (3)
- Apahce (1)
- Jsp (4)
- 其它 (10)
- ssh2 (2)
- java (14)
- js (8)
- Flex (4)
- barcode4j (1)
- powerdesiger (1)
- ibaits (2)
- googlemap (1)
- 淘宝客 (1)
- linux (7)
- idea (1)
- Query全屏滚动插件FullPage.js中文帮助文档API (1)
- 编写 (0)
最新评论
-
a276664990:
<pre name="code" c ...
googleMap.js -
xm_koma:
有没有将JFreeChart生成的图表导出到Excel中的例子 ...
在Web上用iText和JFreeChart将图形报表导出到PDF -
chong2230:
多谢 借用了
js复制当前链接 -
mikkjl:
非常感谢 按照你的做法 成功解决了问题 呵呵
struts2配置多个配置文件 -
yadsun:
推荐你用ActivePort,一个小工具300k不到,最重要的 ...
端口查看
/* 屏蔽js页面所有的错误
function killErrors() {
return true;
}
window.onerror = killErrors;
*/
window.jltourGoogleMapObject = function(){
var mapMeObj;
mapMeObj= this;
mapMeObj.map;//当前的地图地象
mapMeObj.showType ='city';//地图显示类型
mapMeObj.mapDiv='googleMap';//地图显示的div id 名字
mapMeObj.gecoder =null;//当前的地图查询对象
mapMeObj.cityName ='深圳';//当前城市的名字
mapMeObj.cityId = '70002';//城市id
mapMeObj.longtNo=114.123402;//默认显示的经度
mapMeObj.lattNo =22.542169;//默认显示的纬度
mapMeObj.baseIcon;//显示图片
mapMeObj.marker;//显示窗口对象
mapMeObj.arrayMarker;//页面上的Marker对象
mapMeObj.isAuth=false;//是否开启描点
mapMeObj.centerSize=16;//当前地图的缩放级别
mapMeObj.arrayPolygon;//页面上所有的polygon数组
mapMeObj.arrayCenterMarker;//页面上所有的polygon数组
mapMeObj.iconHere;//当前位置
mapMeObj.isClear = true;//是否清空
mapMeObj.markerMessage;//地图提示Marker对象
//初始化地图
mapMeObj.init = function (){
if (GBrowserIsCompatible()) {
mapMeObj.arrayMarker = new Array();
mapMeObj.arrayPolygon = new Array();
mapMeObj.arrayCenterMarker = new Array();
//longtNo = mapMeObj.longtNo;
//lattNo = mapMeObj.lattNo;
var mapElem = document.getElementById(mapMeObj.mapDiv);
mapMeObj.map = new GMap2(mapElem);
// mapMeObj.map.addControl(new GSmallMapControl());//放大缩小 22.542089,114.1225 彭年酒店
mapMeObj.map.addControl(new GMapTypeControl());//地图类型 地图 卫星
mapMeObj.map.addControl(new GLargeMapControl());//放大缩小
mapMeObj.map.addControl(new GScaleControl());//比例尺
mapMeObj.map.enableScrollWheelZoom(); //设置地图可以由鼠标滚轮控制缩放(默认是不会)。
var geoPoint0= new GLatLng(mapMeObj.lattNo,mapMeObj.longtNo);//22.542169,114.123402
//mapMeObj.map.setCenter(geoPoint0, mapMeObj.centerSize);
mapMeObj.geocoder = new GClientGeocoder();
mapMeObj.baseIcon = new GIcon();
mapMeObj.baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
mapMeObj.baseIcon.iconSize = new GSize(15, 15);
mapMeObj.baseIcon.shadowSize = new GSize(15, 15);
mapMeObj.baseIcon.iconAnchor = new GPoint(9, 34);
mapMeObj.baseIcon.infoWindowAnchor = new GPoint(9, 2);
mapMeObj.baseIcon.infoShadowAnchor = new GPoint(18, 25);
mapMeObj.iconHere = new GIcon(mapMeObj.baseIcon);
mapMeObj.iconHere.image ="/images/googleImage/hereBg.gif";
//var marker = new GMarker(geoPoint0,mapMeObj.iconHere);
//mapMeObj.marker =marker;
//mapMeObj.map.addOverlay(marker);//当前位置
mapMeObj.centerSize=16;//当前地图的缩放级别
//mapMeObj.putDragend(geoPoint0);//当前位置
//alert(geoPoint0.x);
}
}
mapMeObj.showAddress = function (adress){
if(isNullValue(adress)){
return false;
}
mapMeObj.cityName =getCityNameByCityId(document.getElementById("city_id").value);
if(isNullValue(mapMeObj.cityName)){
alert("城市不能为空");
return false;
}
var adressInput =mapMeObj.cityName+"市 "+adress;
if (mapMeObj.geocoder) {
mapMeObj.geocoder.getLatLng(adressInput,function(point){
if (!point) {
alert("不能解析: " + adress);
} else {
mapMeObj.centerSize =13;
mapMeObj.map.setCenter(point,mapMeObj.centerSize);
var baseIconQuery = new GIcon();
baseIconQuery.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIconQuery.iconSize = new GSize(15, 15);
baseIconQuery.shadowSize = new GSize(15, 15);
baseIconQuery.iconAnchor = new GPoint(9, 34);
baseIconQuery.infoWindowAnchor = new GPoint(9, 2);
baseIconQuery.infoShadowAnchor = new GPoint(18, 25);
baseIconQuery.dragCrossSize = new GSize(0, 0);
var iconHere = new GIcon(baseIconQuery);
iconHere.image ="/images/googleImage/hereSelect.gif";
mapMeObj.clearMarker(mapMeObj.arrayMarker);
mapMeObj.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,{icon: iconHere,draggable: true});
GEvent.addListener(marker, "dragstart", function() {
mapMeObj.map.closeInfoWindow();
});
GEvent.addListener(marker, "dragend", function() {
var pointNew = marker.getPoint();
mapMeObj.longtNo = pointNew.x;//默认显示的经度
mapMeObj.lattNo = pointNew.y;//默认显示的纬度
mapMeObj.rimHotels();//查找该周边酒店
});
mapMeObj.map.addOverlay(marker);
//mapMeObj.marker.openInfoWindowHtml(adress);
mapMeObj.longtNo = point.x;//默认显示的经度
mapMeObj.lattNo = point.y;//默认显示的纬度
document.getElementById('longLatId').value = point.x+","+point.y;
mapMeObj.marker =marker;
}
});
}
}
mapMeObj.putDragend = function(point){
//alert("1");
mapMeObj.map.setCenter(point,mapMeObj.centerSize);
var baseIconQuery = new GIcon();
baseIconQuery.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIconQuery.iconSize = new GSize(15, 15);
baseIconQuery.shadowSize = new GSize(15, 15);
baseIconQuery.iconAnchor = new GPoint(9, 34);
baseIconQuery.infoWindowAnchor = new GPoint(9, 2);
baseIconQuery.infoShadowAnchor = new GPoint(18, 25);
baseIconQuery.dragCrossSize = new GSize(0, 0);
var iconHere = new GIcon(baseIconQuery);
iconHere.image ="/images/googleImage/hereSelect.gif";
mapMeObj.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,{icon: iconHere,draggable: true});
GEvent.addListener(marker, "dragstart", function() {
mapMeObj.map.closeInfoWindow();
});
GEvent.addListener(marker, "dragend", function() {
var pointNew = marker.getPoint();
mapMeObj.longtNo = pointNew.x;//默认显示的经度
mapMeObj.lattNo = pointNew.y;//默认显示的纬度
mapMeObj.rimHotels();//查找该周边酒店
});
mapMeObj.map.addOverlay(marker);
//mapMeObj.marker.openInfoWindowHtml(adress);
mapMeObj.longtNo = point.x;//默认显示的经度
mapMeObj.lattNo = point.y;//默认显示的纬度
document.getElementById('longLatId').value = point.x+","+point.y;
mapMeObj.marker =marker;
}
//通过地名查找坐标
mapMeObj.getPointByAdress = function(adress){
if(isNullValue(adress)){
return false;
}
mapMeObj.cityId=document.getElementById("city_id").value;
mapMeObj.cityName =getCityNameByCityId(mapMeObj.cityId);
if(isNullValue(mapMeObj.cityName)){
alert("城市不能为空");
return false;
}
var adressInput =mapMeObj.cityName+"市 "+adress;
if (mapMeObj.geocoder) {
mapMeObj.geocoder.getLatLng(adressInput,function(point){
if (!point) {
alert("不能解析: " + adress);
} else {
mapMeObj.longtNo = point.x;//默认显示的经度
mapMeObj.lattNo = point.y;//默认显示的纬度
var point = new GLatLng(point.y,point.x);
mapMeObj.map.setCenter(point, mapMeObj.centerSize);
mapMeObj.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,mapMeObj.iconHere);
mapMeObj.map.closeInfoWindow();
mapMeObj.map.addOverlay(marker);
mapMeObj.marker = marker;
}
});
}
}
//生成marker
mapMeObj.createMarker = function(points, hnames,hotelid,ic) {
var icon = new GIcon();
icon.image = "/images/googleImage/mm_20_yellow0.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(15, 25);
icon.shadowSize = new GSize(15, 25);
icon.iconAnchor = new GPoint(15, 25);
icon.infoWindowAnchor = new GPoint(15, 25);
//var icon = new GIcon(mapMeObj.baseIcon);
//icon.image ="/images/googleImage/lianzhong.gif";
//icon.alt=hnames;
var marker = new google.maps.LabelMarker(points,{icon: icon});
GEvent.addListener(marker, "click", function() {
mapMeObj.marker = marker;
//alert("点的酒店:"+hotelid);
if(mapMeObj.isAuth){
window.location.hash="hotel"+hotelid;
}
mapMeObj.getHotelInfoByBotelId(hotelid);//调用酒店信息方法 不弹出窗口
});
GEvent.addListener(marker, "mouseover", function() {
mapMeObj.markerMessage = new google.maps.MessagesMarker(points,{labelText:hnames});
mapMeObj.map.addOverlay(mapMeObj.markerMessage);
});
GEvent.addListener(marker, "mouseout", function() {
mapMeObj.map.removeOverlay(mapMeObj.markerMessage);//移除
//mapMeObj.map.removeControl(mapMeObj.markerMessage);
});
mapMeObj.arrayMarker.push(marker);//页面中所有的Marker
return marker;
}
//周边查找
mapMeObj.rimHotels= function(){
if(isNullValue(document.getElementById("city_id").value))
{
alert("城市为空");
return;
}
if(isNullValue(mapMeObj.longtNo) || isNullValue(mapMeObj.lattNo)){
alert("坐标为空");
return;
}
if(isNullValue(document.getElementById("range").value)){
alert("周边为空");
return;
}
commonDwrAction.getHotelsByLongLatAndLim(document.getElementById("city_id").value,mapMeObj.longtNo,mapMeObj.lattNo,document.getElementById("range").value,getHotelsByLongLatAndLimHander);
}
//请空地图上的所有的Marker
mapMeObj.clearMarker = function(arrayMarkers){
if(arrayMarkers){
var arrays = arrayMarkers;
var aLength = arrayMarkers.length;
for(var m=0;m<aLength;m++){
mapMeObj.map.removeOverlay(arrays[m]);//移除
mapMeObj.map.removeControl(arrays[m]);
}
}
}
//清除当前页面上的Marker
mapMeObj.clearCenterMarker = function (){
if(mapMeObj.marker){
mapMeObj.map.removeOverlay(mapMeObj.marker);//移除
mapMeObj.map.removeControl(mapMeObj.marker);
}
}
//放入地图中 周边
mapMeObj.inputMapLim = function(){
if(isNullValue(hotelsJosnStr)){
alert("当前暂无酒店");
return;
}
mapMeObj.clearMarker(mapMeObj.arrayMarker);//将地图上之前Marker的请空
var hotels = window.eval('('+hotelsJosnStr+')').hotels;
if(hotels){
mapMeObj.arrayMarkers = new Array();
for(var i=0;i<hotels.length;i++){
var points = new GLatLng(+hotels[i].latt,hotels[i].longt);
mapMeObj.map.addOverlay(mapMeObj.createMarker(points,hotels[i].hotelchn,hotels[i].hotelid,i+1));
}
}
}
mapMeObj.getHotelInfoByBotelId = function (hotelId){
if(isNullValue(hotelId)){
alert("酒店Id为空");
return;
}
commonDwrAction.GetHotelInfoByHotelId(hotelId,GetHotelInfoByHotelIdHander);
}
//查找该行政区的所有酒店
mapMeObj.getHotelsByZoneId = function(zoneId){
if(-1 == zoneId){
alert("请选择行政区");
return;
}
mapMeObj.centerSize = 12;//设置地图显示大小
mapMeObj.cityId=document.getElementById("city_id").value;
mapMeObj.clearMarker(mapMeObj.arrayMarker);//将地图上之前Marker的请空
//mapMeObj.clearMarker(mapMeObj.arrayCenterMarker);//请除所有的中心Marker
mapMeObj.arrayMarkers = new Array();
if(mapMeObj.isClear){
//mapMeObj.clearMarker(mapMeObj.arrayPolygon);//请除所有的及polygon;
}
//var zoneName = getZoneNameByCityIdAndZoneId(mapMeObj.cityId,zoneId);//由于要数据库中有中心,所以不用
//mapMeObj.getPointByAdress(zoneName);//查找对应的工业区及显示进地图中
commonDwrAction.getHotelsByZoneIdAndCity(mapMeObj.cityId,zoneId,getHotelsByZoneIdHander);
}
//查找显示该商业区内的所有的酒店
mapMeObj.getHotelsByBizzId = function(bizzId){
if(-1 == bizzId){
alert("请选择行政区");
return;
}
mapMeObj.centerSize = 12;//设置地图显示大小
mapMeObj.cityId=document.getElementById("city_id").value;
mapMeObj.clearMarker(mapMeObj.arrayMarker);//将地图上之前Marker的请空
mapMeObj.clearMarker(mapMeObj.arrayCenterMarker);//请除所有的中心Marker
mapMeObj.arrayMarkers = new Array();
if(mapMeObj.isClear){
//mapMeObj.clearMarker(mapMeObj.arrayPolygon);//请除所有的及polygon;
}
//var bizName = getBizzonesByCityIdAndBizId(mapMeObj.cityId,bizzId);
//mapMeObj.getPointByAdress(bizName);//查找对应的工业区及显示进地图中
commonDwrAction.getHotelsByBizIdAndCity(mapMeObj.cityId,bizzId,getHotelsByBizzIdHander);
}
//改变页面中的hotelid的值
mapMeObj.changHotelsInput = function (){
var hotels = window.eval('('+hotelsJosnStr+')').hotels;
var hotelids ="";
for(var i=0;i<hotels.length;i++){
hotelids = hotelids+hotels[i].hotelid+",";
}
if(!isNullValue(hotelids)){
hotelids=hotelids.substr(0,hotelids.length-1);
document.getElementById('hotelkeyids').value=hotelids;
}
//alert(hotelids);
}
//画圈对象
mapMeObj.polygon = function (){
var polygons = window.eval('('+zonesJosnStr+')').result;
if(polygons){
var centerZones = polygons.centerlonglat;
if(polygons.length>0){
mapMeObj.centerSize =12;
var arraysLangLat = polygons[0].longlatArray[0];
var point = new GLatLng(arraysLangLat.weidu,arraysLangLat.jingdu);
//mapMeObj.longtNo = point.x;//默认显示的经度
//mapMeObj.lattNo = point.y;//默认显示的纬度
//mapMeObj.map.setCenter(point, mapMeObj.centerSize);
mapMeObj.clearCenterMarker();//清除之前的Marker
mapMeObj.clearMarker(mapMeObj.arrayCenterMarker);//请除所有的中心Marker
mapMeObj.clearMarker(mapMeObj.arrayPolygon);//请除所有的及polygon;
mapMeObj.arrayPolygon = new Array();
mapMeObj.putDragend(point);
//var marker = new GMarker(point,mapMeObj.iconHere);
//mapMeObj.map.closeInfoWindow();
// mapMeObj.map.addOverlay(marker);
//mapMeObj.marker = marker;
}
for(var zi=0;zi<polygons.length;zi++){
mapMeObj.polygonToMap(polygons[zi].longlatArray,polygons[zi].zoneid,polygons[zi].centerlonglat);
}
}
}
//按该点画图
mapMeObj.polygonToMap = function(longlatArray,zoneid,centerlonglat){
var gLatLngarray = new Array();
var gLatLng;
//再中心点
if(centerlonglat && notEmpty(centerlonglat.weidu) && notEmpty(centerlonglat.jingdu)){
var zonesPolyMarker = new google.maps.ZonesMarker(new GLatLng(centerlonglat.weidu,centerlonglat.jingdu),{labelText:centerlonglat.zoneName});
mapMeObj.map.addOverlay(zonesPolyMarker);
mapMeObj.arrayCenterMarker.push(zonesPolyMarker);//中心点 Marker
}
for(var a=0;a<longlatArray.length;a++){
gLatLng = new GLatLng(longlatArray[a].weidu,longlatArray[a].jingdu);
gLatLngarray.push(gLatLng);
}
var polygon = new GPolygon(gLatLngarray, "#ff0000",2, 0.3, "#6666FF", 0.4);
GEvent.addListener(polygon, "mouseover", function() {
var GPolyStyleOptions = { opacity:1,color:"#CC3333",weight:2};//
polygon.setStrokeStyle(GPolyStyleOptions);
var GPolyStyleOptionss = { opacity:0.1,color:"#CC0000",weight:2};
polygon.setFillStyle(GPolyStyleOptionss);
});
GEvent.addListener(polygon, "mouseout", function() {
var GPolyStyleOptions = { opacity:0.3,color:"#ff0000",weight:2};//
polygon.setStrokeStyle(GPolyStyleOptions);//线条
var GPolyStyleOptions = { opacity:0.4,color:"#6666FF",weight:0.2};
polygon.setFillStyle(GPolyStyleOptions);//添充
//mapMeObj.clearMarker(mapMeObj.arrayMarker);//请除所有的及Marker;
});
GEvent.addListener(polygon, "click", function() {
mapMeObj.isClear = false;//不清空
mapMeObj.getHotelsByZoneId(zoneid);//查看该区内的所有的酒店
});
mapMeObj.arrayPolygon.push(polygon);//由于polygon 和 Marker通用,则放在一起
mapMeObj.map.addOverlay(polygon);
}
//选区域
mapMeObj.getCityPolygonLongtLatByCityIdAndType = function(cityId,types){
if(isNullValue(cityId) || isNullValue(types) || '-1' == cityId){
alert("城市信息和类型没有");
return;
}
commonDwrAction.getCityPolygonLongtLatByCityIdAndType(cityId,types,getCityPolygonLongtLatByCityIdAndTypeHander)
}
mapMeObj.setCenters = function (jin,wei){
if(notEmpty(jin) && notEmpty(wei)){
mapMeObj.longtNo=jin;//默认显示的经度
mapMeObj.lattNo =wei;//默认显示的纬度
mapMeObj.centerSize=15;
var geoPoint0= new GLatLng(mapMeObj.lattNo,mapMeObj.longtNo);//22.542169,114.123402
mapMeObj.map.setCenter(geoPoint0, mapMeObj.centerSize);
}
}
}
function getHotelsByBizzIdHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无该酒店信息");
return;
}
hotelsJosnStr = resultrp;
//jltourGoogleMap.map.setCenter(new GLatLng(jltourGoogleMap.lattNo,jltourGoogleMap.longtNo),jltourGoogleMap.centerSize);
var centerLongLat = window.eval('('+hotelsJosnStr+')').centerLongLat;
if(centerLongLat && notEmpty(centerLongLat.latt) && notEmpty(centerLongLat.longt)){
jltourGoogleMap.lattNo = centerLongLat.latt;
jltourGoogleMap.longtNo=centerLongLat.longt;
var point = new GLatLng(centerLongLat.latt,centerLongLat.longt);
jltourGoogleMap.map.setCenter(point,jltourGoogleMap.centerSize);
jltourGoogleMap.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,jltourGoogleMap.iconHere);
jltourGoogleMap.map.closeInfoWindow();
jltourGoogleMap.map.addOverlay(marker);
jltourGoogleMap.marker = marker;
}
jltourGoogleMap.inputMapLim();
jltourGoogleMap.changHotelsInput();
}
function getHotelsByZoneIdHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无该酒店信息");
return;
}
hotelsJosnStr = resultrp;
var centerLongLat = window.eval('('+hotelsJosnStr+')').centerLongLat;
if(centerLongLat && notEmpty(centerLongLat.latt) && notEmpty(centerLongLat.longt)){
//jltourGoogleMap.lattNo = centerLongLat.latt;
//jltourGoogleMap.longtNo=centerLongLat.longt;
var point = new GLatLng(centerLongLat.latt,centerLongLat.longt);
//jltourGoogleMap.map.setCenter(point,jltourGoogleMap.centerSize);
jltourGoogleMap.clearCenterMarker();//清除之前的Marker
//var marker = new GMarker(point,jltourGoogleMap.iconHere);
//jltourGoogleMap.map.closeInfoWindow();
//jltourGoogleMap.map.addOverlay(marker);
//jltourGoogleMap.marker = marker;
jltourGoogleMap.putDragend(point);
}
jltourGoogleMap.inputMapLim();
jltourGoogleMap.changHotelsInput();
//document.getElementById('test').innerHTML = hotelsJosnStr;
}
function GetHotelInfoByHotelIdHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无该酒店信息");
return;
}
//map.openInfoWindowHtml(point,"<span style='color:red'>这是定位的位置</span>"); 上面的文字气球形式也可以这样显示
jltourGoogleMap.marker.openInfoWindowHtml("<div style='width:350px;float:left;FONT-SIZE:13pt'>"+resultrp+"</div>");
}
function getHotelsByLongLatAndLimHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无酒店");
return;
}
hotelsJosnStr = resultrp;
//document.getElementById('test').innerHTML = hotelsJosnStr;
jltourGoogleMap.centerSize = 13;
jltourGoogleMap.map.setCenter(new GLatLng(jltourGoogleMap.lattNo,jltourGoogleMap.longtNo),jltourGoogleMap.centerSize);
document.getElementById('longLatId').value = jltourGoogleMap.longtNo+","+jltourGoogleMap.lattNo;
document.getElementById('adress').value='';
jltourGoogleMap.inputMapLim();
jltourGoogleMap.changHotelsInput();
}
function getCityPolygonLongtLatByCityIdAndTypeHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无坐标信息");
return;
}
zonesJosnStr = resultrp;
jltourGoogleMap.polygon();//画图像
}
// Array的删除事件
Array.prototype.remove = function(obj) {
for (var i = 0; i < this.length; ++i) {
if (this[i] == obj) {
if (i > this.length / 2) {
for (var j = i; j < this.length - 1; ++j) {
this[j] = this[j + 1];
}
this.pop();
}
else {
for (var j = i; j > 0; --j) {
this[j] = this[j - 1];
}
this.shift();
}
break;
}
}
};
google.maps.ZonesMarker = function(latlng, options){
this.latlng = latlng;
this.labelText = options.labelText || '';
this.labelClass = options.labelClass || 'writeb';
this.labelOffset = options.labelOffset || new google.maps.Size(8, -33);
options.icon = options.icon || getTextIcon();
google.maps.Marker.apply(this, arguments);
}
google.maps.ZonesMarker.prototype = new google.maps.Marker(new google.maps.LatLng(0, 0));
google.maps.ZonesMarker.prototype.initialize = function(map){
google.maps.Marker.prototype.initialize.call(this, map);
var label = document.createElement('div');
label.className = this.labelClass;
label.innerHTML = this.labelText;
label.style.position = 'absolute';
label.style.width = '40px';
label.style.border="1px solid #6666FF";
label.style.background="#FFFFFF";
//label.style.color="#910044";
map.getPane(G_MAP_MARKER_PANE).appendChild(label);
this.map = map;
this.label = label;
}
google.maps.ZonesMarker.prototype.redraw = function(force){
google.maps.Marker.prototype.redraw.call(this, jltourGoogleMap.map);
if(!force)
{
return;
}
var point = this.map.fromLatLngToDivPixel(this.latlng);
var z = google.maps.Overlay.getZIndex(this.latlng.lat());
this.label.style.left = (point.x + this.labelOffset.width-40) + 'px';
this.label.style.top = (point.y + this.labelOffset.height-10) + 'px';
// this.label.style.left = (point.x+ this.labelOffset.width)+ 'px';
//this.label.style.top = (point.y+ this.labelOffset.height) + 'px';
this.label.style.zIndex = z + 1;
}
google.maps.ZonesMarker.prototype.remove = function(){
this.label.parentNode.removeChild(this.label);
this.label = null;
google.maps.Marker.prototype.remove.call(this);
}
google.maps.LabelMarker = function(latlng, options){
this.latlng = latlng;
this.labelText = options.labelText || '';
this.labelClass = options.labelClass || 'writeb';
this.labelOffset = options.labelOffset || new google.maps.Size(8, -33);
options.icon = options.icon || getTextIcon();
google.maps.Marker.apply(this, arguments);
}
google.maps.LabelMarker.prototype = new google.maps.Marker(new google.maps.LatLng(0, 0));
google.maps.LabelMarker.prototype.initialize = function(map){
google.maps.Marker.prototype.initialize.call(this, map);
var label = document.createElement('div');
label.className = this.labelClass;
label.innerHTML = this.labelText;
label.style.position = 'absolute';
label.style.width = '90px';
//label.style.border="1px solid #FFF";
//label.style.background="#3399CC";
label.style.color="#910044";
map.getPane(G_MAP_MARKER_PANE).appendChild(label);
this.map = map;
this.label = label;
}
google.maps.LabelMarker.prototype.redraw = function(force){
google.maps.Marker.prototype.redraw.call(this, jltourGoogleMap.map);
if(!force)
{
return;
}
var point = this.map.fromLatLngToDivPixel(this.latlng);
var z = google.maps.Overlay.getZIndex(this.latlng.lat());
this.label.style.left = (point.x + this.labelOffset.width-40) + 'px';
this.label.style.top = (point.y + this.labelOffset.height-10) + 'px';
// this.label.style.left = (point.x+ this.labelOffset.width)+ 'px';
//this.label.style.top = (point.y+ this.labelOffset.height) + 'px';
this.label.style.zIndex = z + 1;
}
google.maps.LabelMarker.prototype.remove = function(){
this.label.parentNode.removeChild(this.label);
this.label = null;
google.maps.Marker.prototype.remove.call(this);
}
function getTextIcon(){
var icon = new google.maps.Icon();
//icon.image = "/images/googleImage/1.png";
icon.iconSize = new GSize(48, 40);
icon.iconAnchor = new GPoint(0, 40);
icon.infoWindowAnchor = new GPoint(5, 1);
return icon;
}
google.maps.MessagesMarker = function(latlng, options){
this.latlng = latlng;
this.labelText = options.labelText || '';
this.labelClass = options.labelClass || 'writeb';
this.labelOffset = options.labelOffset || new google.maps.Size(8, -33);
options.icon = options.icon || getTextIcon();
google.maps.Marker.apply(this, arguments);
}
google.maps.MessagesMarker.prototype = new google.maps.Marker(new google.maps.LatLng(0, 0));
google.maps.MessagesMarker.prototype.initialize = function(map){
google.maps.Marker.prototype.initialize.call(this, map);
var label = document.createElement('div');
label.className = this.labelClass;
label.innerHTML = this.labelText;
label.style.position = 'absolute';
label.style.width = '140px';
label.style.textAlign="left";
label.style.border="1px solid #FF9752";
label.style.background="#F8F6F3 ";
label.style.color="#910044";
map.getPane(G_MAP_MARKER_PANE).appendChild(label);
this.map = map;
this.label = label;
}
google.maps.MessagesMarker.prototype.redraw = function(force){
google.maps.Marker.prototype.redraw.call(this, jltourGoogleMap.map);
if(!force)
{
return;
}
var point = this.map.fromLatLngToDivPixel(this.latlng);
var z = google.maps.Overlay.getZIndex(this.latlng.lat());
this.label.style.left = (point.x + this.labelOffset.width-8) + 'px';
this.label.style.top = (point.y + this.labelOffset.height+10) + 'px';
// this.label.style.left = (point.x+ this.labelOffset.width)+ 'px';
//this.label.style.top = (point.y+ this.labelOffset.height) + 'px';
this.label.style.zIndex = z + 1;
}
google.maps.MessagesMarker.prototype.remove = function(){
this.label.parentNode.removeChild(this.label);
this.label = null;
google.maps.Marker.prototype.remove.call(this);
}
function killErrors() {
return true;
}
window.onerror = killErrors;
*/
window.jltourGoogleMapObject = function(){
var mapMeObj;
mapMeObj= this;
mapMeObj.map;//当前的地图地象
mapMeObj.showType ='city';//地图显示类型
mapMeObj.mapDiv='googleMap';//地图显示的div id 名字
mapMeObj.gecoder =null;//当前的地图查询对象
mapMeObj.cityName ='深圳';//当前城市的名字
mapMeObj.cityId = '70002';//城市id
mapMeObj.longtNo=114.123402;//默认显示的经度
mapMeObj.lattNo =22.542169;//默认显示的纬度
mapMeObj.baseIcon;//显示图片
mapMeObj.marker;//显示窗口对象
mapMeObj.arrayMarker;//页面上的Marker对象
mapMeObj.isAuth=false;//是否开启描点
mapMeObj.centerSize=16;//当前地图的缩放级别
mapMeObj.arrayPolygon;//页面上所有的polygon数组
mapMeObj.arrayCenterMarker;//页面上所有的polygon数组
mapMeObj.iconHere;//当前位置
mapMeObj.isClear = true;//是否清空
mapMeObj.markerMessage;//地图提示Marker对象
//初始化地图
mapMeObj.init = function (){
if (GBrowserIsCompatible()) {
mapMeObj.arrayMarker = new Array();
mapMeObj.arrayPolygon = new Array();
mapMeObj.arrayCenterMarker = new Array();
//longtNo = mapMeObj.longtNo;
//lattNo = mapMeObj.lattNo;
var mapElem = document.getElementById(mapMeObj.mapDiv);
mapMeObj.map = new GMap2(mapElem);
// mapMeObj.map.addControl(new GSmallMapControl());//放大缩小 22.542089,114.1225 彭年酒店
mapMeObj.map.addControl(new GMapTypeControl());//地图类型 地图 卫星
mapMeObj.map.addControl(new GLargeMapControl());//放大缩小
mapMeObj.map.addControl(new GScaleControl());//比例尺
mapMeObj.map.enableScrollWheelZoom(); //设置地图可以由鼠标滚轮控制缩放(默认是不会)。
var geoPoint0= new GLatLng(mapMeObj.lattNo,mapMeObj.longtNo);//22.542169,114.123402
//mapMeObj.map.setCenter(geoPoint0, mapMeObj.centerSize);
mapMeObj.geocoder = new GClientGeocoder();
mapMeObj.baseIcon = new GIcon();
mapMeObj.baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
mapMeObj.baseIcon.iconSize = new GSize(15, 15);
mapMeObj.baseIcon.shadowSize = new GSize(15, 15);
mapMeObj.baseIcon.iconAnchor = new GPoint(9, 34);
mapMeObj.baseIcon.infoWindowAnchor = new GPoint(9, 2);
mapMeObj.baseIcon.infoShadowAnchor = new GPoint(18, 25);
mapMeObj.iconHere = new GIcon(mapMeObj.baseIcon);
mapMeObj.iconHere.image ="/images/googleImage/hereBg.gif";
//var marker = new GMarker(geoPoint0,mapMeObj.iconHere);
//mapMeObj.marker =marker;
//mapMeObj.map.addOverlay(marker);//当前位置
mapMeObj.centerSize=16;//当前地图的缩放级别
//mapMeObj.putDragend(geoPoint0);//当前位置
//alert(geoPoint0.x);
}
}
mapMeObj.showAddress = function (adress){
if(isNullValue(adress)){
return false;
}
mapMeObj.cityName =getCityNameByCityId(document.getElementById("city_id").value);
if(isNullValue(mapMeObj.cityName)){
alert("城市不能为空");
return false;
}
var adressInput =mapMeObj.cityName+"市 "+adress;
if (mapMeObj.geocoder) {
mapMeObj.geocoder.getLatLng(adressInput,function(point){
if (!point) {
alert("不能解析: " + adress);
} else {
mapMeObj.centerSize =13;
mapMeObj.map.setCenter(point,mapMeObj.centerSize);
var baseIconQuery = new GIcon();
baseIconQuery.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIconQuery.iconSize = new GSize(15, 15);
baseIconQuery.shadowSize = new GSize(15, 15);
baseIconQuery.iconAnchor = new GPoint(9, 34);
baseIconQuery.infoWindowAnchor = new GPoint(9, 2);
baseIconQuery.infoShadowAnchor = new GPoint(18, 25);
baseIconQuery.dragCrossSize = new GSize(0, 0);
var iconHere = new GIcon(baseIconQuery);
iconHere.image ="/images/googleImage/hereSelect.gif";
mapMeObj.clearMarker(mapMeObj.arrayMarker);
mapMeObj.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,{icon: iconHere,draggable: true});
GEvent.addListener(marker, "dragstart", function() {
mapMeObj.map.closeInfoWindow();
});
GEvent.addListener(marker, "dragend", function() {
var pointNew = marker.getPoint();
mapMeObj.longtNo = pointNew.x;//默认显示的经度
mapMeObj.lattNo = pointNew.y;//默认显示的纬度
mapMeObj.rimHotels();//查找该周边酒店
});
mapMeObj.map.addOverlay(marker);
//mapMeObj.marker.openInfoWindowHtml(adress);
mapMeObj.longtNo = point.x;//默认显示的经度
mapMeObj.lattNo = point.y;//默认显示的纬度
document.getElementById('longLatId').value = point.x+","+point.y;
mapMeObj.marker =marker;
}
});
}
}
mapMeObj.putDragend = function(point){
//alert("1");
mapMeObj.map.setCenter(point,mapMeObj.centerSize);
var baseIconQuery = new GIcon();
baseIconQuery.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIconQuery.iconSize = new GSize(15, 15);
baseIconQuery.shadowSize = new GSize(15, 15);
baseIconQuery.iconAnchor = new GPoint(9, 34);
baseIconQuery.infoWindowAnchor = new GPoint(9, 2);
baseIconQuery.infoShadowAnchor = new GPoint(18, 25);
baseIconQuery.dragCrossSize = new GSize(0, 0);
var iconHere = new GIcon(baseIconQuery);
iconHere.image ="/images/googleImage/hereSelect.gif";
mapMeObj.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,{icon: iconHere,draggable: true});
GEvent.addListener(marker, "dragstart", function() {
mapMeObj.map.closeInfoWindow();
});
GEvent.addListener(marker, "dragend", function() {
var pointNew = marker.getPoint();
mapMeObj.longtNo = pointNew.x;//默认显示的经度
mapMeObj.lattNo = pointNew.y;//默认显示的纬度
mapMeObj.rimHotels();//查找该周边酒店
});
mapMeObj.map.addOverlay(marker);
//mapMeObj.marker.openInfoWindowHtml(adress);
mapMeObj.longtNo = point.x;//默认显示的经度
mapMeObj.lattNo = point.y;//默认显示的纬度
document.getElementById('longLatId').value = point.x+","+point.y;
mapMeObj.marker =marker;
}
//通过地名查找坐标
mapMeObj.getPointByAdress = function(adress){
if(isNullValue(adress)){
return false;
}
mapMeObj.cityId=document.getElementById("city_id").value;
mapMeObj.cityName =getCityNameByCityId(mapMeObj.cityId);
if(isNullValue(mapMeObj.cityName)){
alert("城市不能为空");
return false;
}
var adressInput =mapMeObj.cityName+"市 "+adress;
if (mapMeObj.geocoder) {
mapMeObj.geocoder.getLatLng(adressInput,function(point){
if (!point) {
alert("不能解析: " + adress);
} else {
mapMeObj.longtNo = point.x;//默认显示的经度
mapMeObj.lattNo = point.y;//默认显示的纬度
var point = new GLatLng(point.y,point.x);
mapMeObj.map.setCenter(point, mapMeObj.centerSize);
mapMeObj.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,mapMeObj.iconHere);
mapMeObj.map.closeInfoWindow();
mapMeObj.map.addOverlay(marker);
mapMeObj.marker = marker;
}
});
}
}
//生成marker
mapMeObj.createMarker = function(points, hnames,hotelid,ic) {
var icon = new GIcon();
icon.image = "/images/googleImage/mm_20_yellow0.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(15, 25);
icon.shadowSize = new GSize(15, 25);
icon.iconAnchor = new GPoint(15, 25);
icon.infoWindowAnchor = new GPoint(15, 25);
//var icon = new GIcon(mapMeObj.baseIcon);
//icon.image ="/images/googleImage/lianzhong.gif";
//icon.alt=hnames;
var marker = new google.maps.LabelMarker(points,{icon: icon});
GEvent.addListener(marker, "click", function() {
mapMeObj.marker = marker;
//alert("点的酒店:"+hotelid);
if(mapMeObj.isAuth){
window.location.hash="hotel"+hotelid;
}
mapMeObj.getHotelInfoByBotelId(hotelid);//调用酒店信息方法 不弹出窗口
});
GEvent.addListener(marker, "mouseover", function() {
mapMeObj.markerMessage = new google.maps.MessagesMarker(points,{labelText:hnames});
mapMeObj.map.addOverlay(mapMeObj.markerMessage);
});
GEvent.addListener(marker, "mouseout", function() {
mapMeObj.map.removeOverlay(mapMeObj.markerMessage);//移除
//mapMeObj.map.removeControl(mapMeObj.markerMessage);
});
mapMeObj.arrayMarker.push(marker);//页面中所有的Marker
return marker;
}
//周边查找
mapMeObj.rimHotels= function(){
if(isNullValue(document.getElementById("city_id").value))
{
alert("城市为空");
return;
}
if(isNullValue(mapMeObj.longtNo) || isNullValue(mapMeObj.lattNo)){
alert("坐标为空");
return;
}
if(isNullValue(document.getElementById("range").value)){
alert("周边为空");
return;
}
commonDwrAction.getHotelsByLongLatAndLim(document.getElementById("city_id").value,mapMeObj.longtNo,mapMeObj.lattNo,document.getElementById("range").value,getHotelsByLongLatAndLimHander);
}
//请空地图上的所有的Marker
mapMeObj.clearMarker = function(arrayMarkers){
if(arrayMarkers){
var arrays = arrayMarkers;
var aLength = arrayMarkers.length;
for(var m=0;m<aLength;m++){
mapMeObj.map.removeOverlay(arrays[m]);//移除
mapMeObj.map.removeControl(arrays[m]);
}
}
}
//清除当前页面上的Marker
mapMeObj.clearCenterMarker = function (){
if(mapMeObj.marker){
mapMeObj.map.removeOverlay(mapMeObj.marker);//移除
mapMeObj.map.removeControl(mapMeObj.marker);
}
}
//放入地图中 周边
mapMeObj.inputMapLim = function(){
if(isNullValue(hotelsJosnStr)){
alert("当前暂无酒店");
return;
}
mapMeObj.clearMarker(mapMeObj.arrayMarker);//将地图上之前Marker的请空
var hotels = window.eval('('+hotelsJosnStr+')').hotels;
if(hotels){
mapMeObj.arrayMarkers = new Array();
for(var i=0;i<hotels.length;i++){
var points = new GLatLng(+hotels[i].latt,hotels[i].longt);
mapMeObj.map.addOverlay(mapMeObj.createMarker(points,hotels[i].hotelchn,hotels[i].hotelid,i+1));
}
}
}
mapMeObj.getHotelInfoByBotelId = function (hotelId){
if(isNullValue(hotelId)){
alert("酒店Id为空");
return;
}
commonDwrAction.GetHotelInfoByHotelId(hotelId,GetHotelInfoByHotelIdHander);
}
//查找该行政区的所有酒店
mapMeObj.getHotelsByZoneId = function(zoneId){
if(-1 == zoneId){
alert("请选择行政区");
return;
}
mapMeObj.centerSize = 12;//设置地图显示大小
mapMeObj.cityId=document.getElementById("city_id").value;
mapMeObj.clearMarker(mapMeObj.arrayMarker);//将地图上之前Marker的请空
//mapMeObj.clearMarker(mapMeObj.arrayCenterMarker);//请除所有的中心Marker
mapMeObj.arrayMarkers = new Array();
if(mapMeObj.isClear){
//mapMeObj.clearMarker(mapMeObj.arrayPolygon);//请除所有的及polygon;
}
//var zoneName = getZoneNameByCityIdAndZoneId(mapMeObj.cityId,zoneId);//由于要数据库中有中心,所以不用
//mapMeObj.getPointByAdress(zoneName);//查找对应的工业区及显示进地图中
commonDwrAction.getHotelsByZoneIdAndCity(mapMeObj.cityId,zoneId,getHotelsByZoneIdHander);
}
//查找显示该商业区内的所有的酒店
mapMeObj.getHotelsByBizzId = function(bizzId){
if(-1 == bizzId){
alert("请选择行政区");
return;
}
mapMeObj.centerSize = 12;//设置地图显示大小
mapMeObj.cityId=document.getElementById("city_id").value;
mapMeObj.clearMarker(mapMeObj.arrayMarker);//将地图上之前Marker的请空
mapMeObj.clearMarker(mapMeObj.arrayCenterMarker);//请除所有的中心Marker
mapMeObj.arrayMarkers = new Array();
if(mapMeObj.isClear){
//mapMeObj.clearMarker(mapMeObj.arrayPolygon);//请除所有的及polygon;
}
//var bizName = getBizzonesByCityIdAndBizId(mapMeObj.cityId,bizzId);
//mapMeObj.getPointByAdress(bizName);//查找对应的工业区及显示进地图中
commonDwrAction.getHotelsByBizIdAndCity(mapMeObj.cityId,bizzId,getHotelsByBizzIdHander);
}
//改变页面中的hotelid的值
mapMeObj.changHotelsInput = function (){
var hotels = window.eval('('+hotelsJosnStr+')').hotels;
var hotelids ="";
for(var i=0;i<hotels.length;i++){
hotelids = hotelids+hotels[i].hotelid+",";
}
if(!isNullValue(hotelids)){
hotelids=hotelids.substr(0,hotelids.length-1);
document.getElementById('hotelkeyids').value=hotelids;
}
//alert(hotelids);
}
//画圈对象
mapMeObj.polygon = function (){
var polygons = window.eval('('+zonesJosnStr+')').result;
if(polygons){
var centerZones = polygons.centerlonglat;
if(polygons.length>0){
mapMeObj.centerSize =12;
var arraysLangLat = polygons[0].longlatArray[0];
var point = new GLatLng(arraysLangLat.weidu,arraysLangLat.jingdu);
//mapMeObj.longtNo = point.x;//默认显示的经度
//mapMeObj.lattNo = point.y;//默认显示的纬度
//mapMeObj.map.setCenter(point, mapMeObj.centerSize);
mapMeObj.clearCenterMarker();//清除之前的Marker
mapMeObj.clearMarker(mapMeObj.arrayCenterMarker);//请除所有的中心Marker
mapMeObj.clearMarker(mapMeObj.arrayPolygon);//请除所有的及polygon;
mapMeObj.arrayPolygon = new Array();
mapMeObj.putDragend(point);
//var marker = new GMarker(point,mapMeObj.iconHere);
//mapMeObj.map.closeInfoWindow();
// mapMeObj.map.addOverlay(marker);
//mapMeObj.marker = marker;
}
for(var zi=0;zi<polygons.length;zi++){
mapMeObj.polygonToMap(polygons[zi].longlatArray,polygons[zi].zoneid,polygons[zi].centerlonglat);
}
}
}
//按该点画图
mapMeObj.polygonToMap = function(longlatArray,zoneid,centerlonglat){
var gLatLngarray = new Array();
var gLatLng;
//再中心点
if(centerlonglat && notEmpty(centerlonglat.weidu) && notEmpty(centerlonglat.jingdu)){
var zonesPolyMarker = new google.maps.ZonesMarker(new GLatLng(centerlonglat.weidu,centerlonglat.jingdu),{labelText:centerlonglat.zoneName});
mapMeObj.map.addOverlay(zonesPolyMarker);
mapMeObj.arrayCenterMarker.push(zonesPolyMarker);//中心点 Marker
}
for(var a=0;a<longlatArray.length;a++){
gLatLng = new GLatLng(longlatArray[a].weidu,longlatArray[a].jingdu);
gLatLngarray.push(gLatLng);
}
var polygon = new GPolygon(gLatLngarray, "#ff0000",2, 0.3, "#6666FF", 0.4);
GEvent.addListener(polygon, "mouseover", function() {
var GPolyStyleOptions = { opacity:1,color:"#CC3333",weight:2};//
polygon.setStrokeStyle(GPolyStyleOptions);
var GPolyStyleOptionss = { opacity:0.1,color:"#CC0000",weight:2};
polygon.setFillStyle(GPolyStyleOptionss);
});
GEvent.addListener(polygon, "mouseout", function() {
var GPolyStyleOptions = { opacity:0.3,color:"#ff0000",weight:2};//
polygon.setStrokeStyle(GPolyStyleOptions);//线条
var GPolyStyleOptions = { opacity:0.4,color:"#6666FF",weight:0.2};
polygon.setFillStyle(GPolyStyleOptions);//添充
//mapMeObj.clearMarker(mapMeObj.arrayMarker);//请除所有的及Marker;
});
GEvent.addListener(polygon, "click", function() {
mapMeObj.isClear = false;//不清空
mapMeObj.getHotelsByZoneId(zoneid);//查看该区内的所有的酒店
});
mapMeObj.arrayPolygon.push(polygon);//由于polygon 和 Marker通用,则放在一起
mapMeObj.map.addOverlay(polygon);
}
//选区域
mapMeObj.getCityPolygonLongtLatByCityIdAndType = function(cityId,types){
if(isNullValue(cityId) || isNullValue(types) || '-1' == cityId){
alert("城市信息和类型没有");
return;
}
commonDwrAction.getCityPolygonLongtLatByCityIdAndType(cityId,types,getCityPolygonLongtLatByCityIdAndTypeHander)
}
mapMeObj.setCenters = function (jin,wei){
if(notEmpty(jin) && notEmpty(wei)){
mapMeObj.longtNo=jin;//默认显示的经度
mapMeObj.lattNo =wei;//默认显示的纬度
mapMeObj.centerSize=15;
var geoPoint0= new GLatLng(mapMeObj.lattNo,mapMeObj.longtNo);//22.542169,114.123402
mapMeObj.map.setCenter(geoPoint0, mapMeObj.centerSize);
}
}
}
function getHotelsByBizzIdHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无该酒店信息");
return;
}
hotelsJosnStr = resultrp;
//jltourGoogleMap.map.setCenter(new GLatLng(jltourGoogleMap.lattNo,jltourGoogleMap.longtNo),jltourGoogleMap.centerSize);
var centerLongLat = window.eval('('+hotelsJosnStr+')').centerLongLat;
if(centerLongLat && notEmpty(centerLongLat.latt) && notEmpty(centerLongLat.longt)){
jltourGoogleMap.lattNo = centerLongLat.latt;
jltourGoogleMap.longtNo=centerLongLat.longt;
var point = new GLatLng(centerLongLat.latt,centerLongLat.longt);
jltourGoogleMap.map.setCenter(point,jltourGoogleMap.centerSize);
jltourGoogleMap.clearCenterMarker();//清除之前的Marker
var marker = new GMarker(point,jltourGoogleMap.iconHere);
jltourGoogleMap.map.closeInfoWindow();
jltourGoogleMap.map.addOverlay(marker);
jltourGoogleMap.marker = marker;
}
jltourGoogleMap.inputMapLim();
jltourGoogleMap.changHotelsInput();
}
function getHotelsByZoneIdHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无该酒店信息");
return;
}
hotelsJosnStr = resultrp;
var centerLongLat = window.eval('('+hotelsJosnStr+')').centerLongLat;
if(centerLongLat && notEmpty(centerLongLat.latt) && notEmpty(centerLongLat.longt)){
//jltourGoogleMap.lattNo = centerLongLat.latt;
//jltourGoogleMap.longtNo=centerLongLat.longt;
var point = new GLatLng(centerLongLat.latt,centerLongLat.longt);
//jltourGoogleMap.map.setCenter(point,jltourGoogleMap.centerSize);
jltourGoogleMap.clearCenterMarker();//清除之前的Marker
//var marker = new GMarker(point,jltourGoogleMap.iconHere);
//jltourGoogleMap.map.closeInfoWindow();
//jltourGoogleMap.map.addOverlay(marker);
//jltourGoogleMap.marker = marker;
jltourGoogleMap.putDragend(point);
}
jltourGoogleMap.inputMapLim();
jltourGoogleMap.changHotelsInput();
//document.getElementById('test').innerHTML = hotelsJosnStr;
}
function GetHotelInfoByHotelIdHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无该酒店信息");
return;
}
//map.openInfoWindowHtml(point,"<span style='color:red'>这是定位的位置</span>"); 上面的文字气球形式也可以这样显示
jltourGoogleMap.marker.openInfoWindowHtml("<div style='width:350px;float:left;FONT-SIZE:13pt'>"+resultrp+"</div>");
}
function getHotelsByLongLatAndLimHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无酒店");
return;
}
hotelsJosnStr = resultrp;
//document.getElementById('test').innerHTML = hotelsJosnStr;
jltourGoogleMap.centerSize = 13;
jltourGoogleMap.map.setCenter(new GLatLng(jltourGoogleMap.lattNo,jltourGoogleMap.longtNo),jltourGoogleMap.centerSize);
document.getElementById('longLatId').value = jltourGoogleMap.longtNo+","+jltourGoogleMap.lattNo;
document.getElementById('adress').value='';
jltourGoogleMap.inputMapLim();
jltourGoogleMap.changHotelsInput();
}
function getCityPolygonLongtLatByCityIdAndTypeHander(resultrp){
if(isNullValue(resultrp)){
alert("暂无坐标信息");
return;
}
zonesJosnStr = resultrp;
jltourGoogleMap.polygon();//画图像
}
// Array的删除事件
Array.prototype.remove = function(obj) {
for (var i = 0; i < this.length; ++i) {
if (this[i] == obj) {
if (i > this.length / 2) {
for (var j = i; j < this.length - 1; ++j) {
this[j] = this[j + 1];
}
this.pop();
}
else {
for (var j = i; j > 0; --j) {
this[j] = this[j - 1];
}
this.shift();
}
break;
}
}
};
google.maps.ZonesMarker = function(latlng, options){
this.latlng = latlng;
this.labelText = options.labelText || '';
this.labelClass = options.labelClass || 'writeb';
this.labelOffset = options.labelOffset || new google.maps.Size(8, -33);
options.icon = options.icon || getTextIcon();
google.maps.Marker.apply(this, arguments);
}
google.maps.ZonesMarker.prototype = new google.maps.Marker(new google.maps.LatLng(0, 0));
google.maps.ZonesMarker.prototype.initialize = function(map){
google.maps.Marker.prototype.initialize.call(this, map);
var label = document.createElement('div');
label.className = this.labelClass;
label.innerHTML = this.labelText;
label.style.position = 'absolute';
label.style.width = '40px';
label.style.border="1px solid #6666FF";
label.style.background="#FFFFFF";
//label.style.color="#910044";
map.getPane(G_MAP_MARKER_PANE).appendChild(label);
this.map = map;
this.label = label;
}
google.maps.ZonesMarker.prototype.redraw = function(force){
google.maps.Marker.prototype.redraw.call(this, jltourGoogleMap.map);
if(!force)
{
return;
}
var point = this.map.fromLatLngToDivPixel(this.latlng);
var z = google.maps.Overlay.getZIndex(this.latlng.lat());
this.label.style.left = (point.x + this.labelOffset.width-40) + 'px';
this.label.style.top = (point.y + this.labelOffset.height-10) + 'px';
// this.label.style.left = (point.x+ this.labelOffset.width)+ 'px';
//this.label.style.top = (point.y+ this.labelOffset.height) + 'px';
this.label.style.zIndex = z + 1;
}
google.maps.ZonesMarker.prototype.remove = function(){
this.label.parentNode.removeChild(this.label);
this.label = null;
google.maps.Marker.prototype.remove.call(this);
}
google.maps.LabelMarker = function(latlng, options){
this.latlng = latlng;
this.labelText = options.labelText || '';
this.labelClass = options.labelClass || 'writeb';
this.labelOffset = options.labelOffset || new google.maps.Size(8, -33);
options.icon = options.icon || getTextIcon();
google.maps.Marker.apply(this, arguments);
}
google.maps.LabelMarker.prototype = new google.maps.Marker(new google.maps.LatLng(0, 0));
google.maps.LabelMarker.prototype.initialize = function(map){
google.maps.Marker.prototype.initialize.call(this, map);
var label = document.createElement('div');
label.className = this.labelClass;
label.innerHTML = this.labelText;
label.style.position = 'absolute';
label.style.width = '90px';
//label.style.border="1px solid #FFF";
//label.style.background="#3399CC";
label.style.color="#910044";
map.getPane(G_MAP_MARKER_PANE).appendChild(label);
this.map = map;
this.label = label;
}
google.maps.LabelMarker.prototype.redraw = function(force){
google.maps.Marker.prototype.redraw.call(this, jltourGoogleMap.map);
if(!force)
{
return;
}
var point = this.map.fromLatLngToDivPixel(this.latlng);
var z = google.maps.Overlay.getZIndex(this.latlng.lat());
this.label.style.left = (point.x + this.labelOffset.width-40) + 'px';
this.label.style.top = (point.y + this.labelOffset.height-10) + 'px';
// this.label.style.left = (point.x+ this.labelOffset.width)+ 'px';
//this.label.style.top = (point.y+ this.labelOffset.height) + 'px';
this.label.style.zIndex = z + 1;
}
google.maps.LabelMarker.prototype.remove = function(){
this.label.parentNode.removeChild(this.label);
this.label = null;
google.maps.Marker.prototype.remove.call(this);
}
function getTextIcon(){
var icon = new google.maps.Icon();
//icon.image = "/images/googleImage/1.png";
icon.iconSize = new GSize(48, 40);
icon.iconAnchor = new GPoint(0, 40);
icon.infoWindowAnchor = new GPoint(5, 1);
return icon;
}
google.maps.MessagesMarker = function(latlng, options){
this.latlng = latlng;
this.labelText = options.labelText || '';
this.labelClass = options.labelClass || 'writeb';
this.labelOffset = options.labelOffset || new google.maps.Size(8, -33);
options.icon = options.icon || getTextIcon();
google.maps.Marker.apply(this, arguments);
}
google.maps.MessagesMarker.prototype = new google.maps.Marker(new google.maps.LatLng(0, 0));
google.maps.MessagesMarker.prototype.initialize = function(map){
google.maps.Marker.prototype.initialize.call(this, map);
var label = document.createElement('div');
label.className = this.labelClass;
label.innerHTML = this.labelText;
label.style.position = 'absolute';
label.style.width = '140px';
label.style.textAlign="left";
label.style.border="1px solid #FF9752";
label.style.background="#F8F6F3 ";
label.style.color="#910044";
map.getPane(G_MAP_MARKER_PANE).appendChild(label);
this.map = map;
this.label = label;
}
google.maps.MessagesMarker.prototype.redraw = function(force){
google.maps.Marker.prototype.redraw.call(this, jltourGoogleMap.map);
if(!force)
{
return;
}
var point = this.map.fromLatLngToDivPixel(this.latlng);
var z = google.maps.Overlay.getZIndex(this.latlng.lat());
this.label.style.left = (point.x + this.labelOffset.width-8) + 'px';
this.label.style.top = (point.y + this.labelOffset.height+10) + 'px';
// this.label.style.left = (point.x+ this.labelOffset.width)+ 'px';
//this.label.style.top = (point.y+ this.labelOffset.height) + 'px';
this.label.style.zIndex = z + 1;
}
google.maps.MessagesMarker.prototype.remove = function(){
this.label.parentNode.removeChild(this.label);
this.label = null;
google.maps.Marker.prototype.remove.call(this);
}
相关推荐
标题中的“搜新社区_googlemap.rar”暗示了这个压缩包可能包含了有关搜新社区与Google地图集成的相关资源或教程。搜新社区可能是一个在线平台,而Google Map是全球广泛使用的地图服务,通常用于地理位置定位、导航和...
"google.map.plugin.js" 文件很可能是这个插件的核心脚本,包含了实现这些功能的JavaScript代码。 在使用谷歌地图插件时,首先需要在你的项目中引入 "google.map.plugin.js" 文件。这通常通过在HTML文件中添加`...
在JavaScript环境下,通过Google Maps JavaScript API,开发者可以将这些功能集成到自己的网页应用中,实现丰富的地图交互效果。下面将详细介绍如何使用Google Maps API以及其主要功能。 首先,要使用Google Maps ...
一个使用谷歌地图的简单 JavaScript 库。 特征 - Map - Geocoder - InfoWindow - Marker - Markers 版本 切换分支菜单以获取当前版本。 用 在您的 html 文件中加载脚本 google_maps.js 或 google_maps.min.js。 ...
标题“googlemap.zip”暗示了这个压缩包可能包含与Google地图相关的文件。描述中的内容为空,所以我们只能基于标题和标签来推断可能包含的知识点。标签“map”进一步确认了这个压缩包与地图服务或者地图数据有关。 ...
在本前端项目中,"jquery.googlemap.zip" 包含了一个使用 jQuery 插件来集成 Google Maps API 的实例。这个项目旨在简化开发人员在网页上使用 Google Maps 功能的过程,如创建地图、设置标记和规划路线。以下是关于...
要在这些单片机上使用Google Map,通常需要通过嵌入式Web服务器和浏览器组件来实现,因为它们可能没有足够的资源直接运行复杂的JavaScript API。 3. **嵌入式Web服务器**:在MicroChip单片机上,你需要一个嵌入式...
Google Map API V3(3.9.12)是谷歌提供的一个用于在网页上嵌入交互式地图的服务,它是Google Maps JavaScript API的第三个主要版本。这个离线开发包允许开发者在没有网络连接的情况下进行地图应用的开发和测试,这...
本项目“如何将MySQL数据输入到Google地图”是一个利用JavaScript实现的好玩儿的项目,它涉及到Web开发中的前端技术,特别是JavaScript与后端数据库的交互。 1. **JavaScript基础**:JavaScript是Web开发中的关键...
这个名为"Googlemap_API.rar_GoogleMap_加载地图_地图"的压缩包文件,很显然是一个关于如何使用Google Map API进行地图加载和相关设置的教程。以下是对这个主题的详细讲解: 首先,**初始化地图**是使用Google Map ...
在IT行业中,Google Map是一个广泛使用的在线地图服务平台,它提供了丰富的功能,如定位、导航、路线规划、地理编码以及卫星图像等。这个名为"google-map.rar"的压缩包文件似乎包含了一些关于如何利用Google Maps ...
在本文中,我们将深入探讨如何使用Leaflet.js库来接入不同的地图服务,包括高德地图、OpenStreetMap和Google地图。Leaflet是一个轻量级且功能强大的JavaScript库,专为Web地图开发设计,广泛应用于创建交互式的地图...
《jQuery 3.5.1:JavaScript开发者的得力助手》 jQuery,作为一款广泛使用的JavaScript库,一直以来都是Web开发者的首选工具。标题中的“jquery-3.5.1.min.js”代表的是jQuery库的3.5.1版本的压缩后的最小化文件,...
var map = new google.maps.Map(document.getElementById('map'), { zoom: 8, center: myLatLng }); } ``` 这段代码会在ID为`map`的HTML元素上创建一个地图,并将其中心设置在指定的经纬度。 要实现地图标注,...
总的来说,"uniapp editor富文本 quill.min.js image-resize.min.js"涉及到的知识点主要包括uniapp框架的使用、Quill富文本编辑器的集成与定制、JavaScript图像处理以及富文本数据的管理和交互。这些技术的结合,...
JavaScript API是Google Map API的核心部分,它允许开发者在网页上动态加载和操作地图。通过这个API,可以实现地图的初始化、缩放、平移、标记点添加、信息窗口显示、自定义图层、地理编码、路径绘制等多种功能。...
首先,要使用 Google Map API,你需要在 Google Cloud Platform 上创建一个项目,并启用 Maps JavaScript API。获取 API 密钥是关键步骤,它会授权你的应用访问 API 服务。将密钥添加到你的 HTML 或 JavaScript 文件...
标题“GoogleMap(通过输入地址,查询显示在google 地图上)”涉及到的是使用Google Maps API来实现一个功能,即用户输入地址后,系统能在Google地图上显示该位置。这通常涉及网页开发,可能使用HTML、CSS和JavaScript...
heatmap.js不仅能在平面上绘制热图,还能与地图API结合,如Google Maps、Leaflet或本例中提到的百度地图。通过设置地图容器为heatmap实例的容器,可以将热图叠加在地图上,展示地理空间数据的分布。 ```javascript ...
Ext Google Map简易开发框架是一种将流行的JavaScript库ExtJs与Google Maps API相结合的开发方式,用于构建功能丰富的地理信息系统。这个框架允许开发者轻松地在网页上展示地图,管理地图图层,控制图层的可见性,...