You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
180 lines
5.6 KiB
180 lines
5.6 KiB
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
|
|
<%
|
|
String path = request.getContextPath();
|
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
|
|
%>
|
|
<%@ include file="/common/ctx.jsp" %>
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
|
|
<style type="text/css">
|
|
body, html, #allmap {
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
margin: 0;
|
|
font-family: "微软雅黑";
|
|
}
|
|
</style>
|
|
<script src="${ctx}/js/jquery-1.11.0.min.js"></script>
|
|
<script type="text/javascript"
|
|
src="http://api.map.baidu.com/api?v=2.0&ak=YCimUSFO0aRYOMOOhMQRBlaQQz6YpyVy"></script>
|
|
<link href="${ctx}/hbcyjc/resourceNew/css/cjy_style.css" rel="stylesheet"/>
|
|
|
|
<title>浏览器定位</title>
|
|
|
|
|
|
<style type="text/css">
|
|
body, html {
|
|
width: 100%;
|
|
height: 98%;
|
|
margin: 0;
|
|
font-family: "微软雅黑";
|
|
}
|
|
|
|
#allmap {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.tangram-suggestion-main {
|
|
display: block;
|
|
}
|
|
|
|
.tangram-suggestion {
|
|
z-index: 99999999;
|
|
}
|
|
|
|
.anchorBL {
|
|
display: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="exampleModalLabel">
|
|
<b>地图坐标</b>
|
|
</h5>
|
|
</div>
|
|
<div style="padding-left:25px;padding-top: 20px ">
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td>
|
|
<div class="form_hpzs">
|
|
<label class="form_label">搜索:</label>
|
|
<div class="form_input" style="width: 110px;">
|
|
<input type="text" id="suggestId" name="suggestId"/>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td> (输入地区关键字,拾取更迅速) </td>
|
|
<td>
|
|
<button type="button" class="bttn" onclick="sousuo();">搜索</button>
|
|
</td>
|
|
<td>
|
|
<button type="button" class="bttn" onclick="windowclose();">确定</button>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div id="allmap" style="width:95%;height:99%;margin-left: 2.5%;margin-top: 2%"></div>
|
|
</body>
|
|
</html>
|
|
<script type="text/javascript">
|
|
var lng = "";
|
|
var lat = "";
|
|
|
|
// 百度地图API功能
|
|
var map = new BMap.Map("allmap");
|
|
map.clearOverlays(); //清除
|
|
var lon = "${param.lon}";
|
|
var lati = "${param.lat}";
|
|
var num ="${param.num}";
|
|
var latid ="${param.latid}";
|
|
var lonid ="${param.lonid}";
|
|
|
|
var point = new BMap.Point(lon, lati);
|
|
var local = new BMap.LocalSearch(map, {
|
|
renderOptions: {map: map}
|
|
}); //搜索使用
|
|
|
|
$(function () {
|
|
setTimeout(function () {//添加延时加载。解决问题
|
|
var marker = new BMap.Marker(point); // 创建标注
|
|
map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
|
|
var geolocation = new BMap.Geolocation();
|
|
|
|
if (lon != null && lon != "" && lon != "undefined" && lati != null && lati != "") {
|
|
//map.panTo(point);//移动地图
|
|
map.addOverlay(marker); //选中标注
|
|
} else {
|
|
geolocation.getCurrentPosition(function (r) {
|
|
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
|
|
var mk = new BMap.Marker(r.point);
|
|
map.panTo(r.point);//移动地图
|
|
map.addOverlay(mk);
|
|
lng = r.point.lng;
|
|
lat = r.point.lat;
|
|
}
|
|
else {
|
|
alert('failed' + this.getStatus());
|
|
}
|
|
}, {enableHighAccuracy: true})
|
|
}
|
|
map.centerAndZoom(point, 12);
|
|
// map.panBy(340, 150);
|
|
}, 300);
|
|
});
|
|
|
|
// 百度地图API功能
|
|
function showInfo(e) {
|
|
map.clearOverlays(); //清除
|
|
|
|
lng = e.point.lng;
|
|
lat = e.point.lat;
|
|
|
|
var pointdj = new BMap.Point(lng, lat);
|
|
map.panTo(pointdj);//移动地图
|
|
var markerdj = new BMap.Marker(pointdj); // 创建标注
|
|
map.addOverlay(markerdj); //选中标注
|
|
|
|
}
|
|
|
|
map.addEventListener("click", showInfo); //点击执行
|
|
|
|
//点击关闭窗口执行
|
|
function windowclose() {
|
|
if (num == 1) {
|
|
if (lng != null && lng != "" && lat != null && lat != "") {
|
|
parent.$("#"+lonid+"").val(lng);
|
|
parent.$("#"+latid+"").val(lat);
|
|
} else {
|
|
parent.$("#"+lonid+"").val(lng);
|
|
parent.$("#"+latid+"").val(lat);
|
|
}
|
|
} else {
|
|
if (lng != null && lng != "" && lat != null && lat != "") {
|
|
parent.$("#jingdu").val(lng);
|
|
parent.$("#weidu").val(lat);
|
|
} else {
|
|
parent.$("#jingdu").val(lon);
|
|
parent.$("#weidu").val(lati);
|
|
}
|
|
}
|
|
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
|
parent.layer.close(index);
|
|
// hideWin();
|
|
}
|
|
|
|
|
|
//搜索输入的位置
|
|
function sousuo() {
|
|
var suggestId = $("#suggestId").val();
|
|
local.search(suggestId);
|
|
}
|
|
|
|
|
|
</script> |