开发区围栏
This commit is contained in:
+16
-3
@@ -33,9 +33,9 @@ public class DevelopmentZoneController {
|
||||
if (pager.getCurrentPage() > 100) {
|
||||
pager.setCurrentPage(1);
|
||||
}
|
||||
long countDev = developmentZoneService.countDev(model.getProvince(),model.getCityName1(), model.getName(), model.getLevel());
|
||||
long countDev = developmentZoneService.countDev(model.getProvince(), model.getCityName1(), model.getName(), model.getLevel());
|
||||
pager.setTotalRows((int) countDev);
|
||||
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(),model.getCityName1(), model.getName(), model.getLevel(), pager);
|
||||
List<DevelopmentZone> developmentZones = developmentZoneService.findDevelopmentZone(model.getProvince(), model.getCityName1(), model.getName(), model.getLevel(), pager);
|
||||
model.setDevelopmentZoneList(developmentZones);
|
||||
model.setPager(pager);
|
||||
return model;
|
||||
@@ -59,6 +59,15 @@ public class DevelopmentZoneController {
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object editFenceAction(DevelopmentZoneModel model) {
|
||||
if (model.getId() == null) {
|
||||
return model;
|
||||
}
|
||||
|
||||
model.setDevelopmentZone(developmentZoneService.findDevelopmentZone(model.getId()));
|
||||
return model;
|
||||
}
|
||||
|
||||
public Object deleteAction(LatlngPolygonModel model) {
|
||||
JsonModel ret = new JsonModel();
|
||||
if (model.getId() == null) {
|
||||
@@ -127,6 +136,7 @@ public class DevelopmentZoneController {
|
||||
entity.setUrl(StringUtils.isBlank(model.getUrl()) ? "" : model.getUrl());
|
||||
entity.setCityName1(StringUtils.isBlank(model.getCityName1()) ? "" : model.getCityName1());
|
||||
entity.setDistrict(StringUtils.isBlank(model.getDistrict()) ? "" : model.getDistrict());
|
||||
entity.setImgUrl(StringUtils.isBlank(model.getImgUrl()) ? "" : model.getImgUrl());
|
||||
//记录操作人员
|
||||
entity.setOperator(user.getRealName());
|
||||
developmentZoneService.saveDevelopmentZone(entity);
|
||||
@@ -201,9 +211,12 @@ public class DevelopmentZoneController {
|
||||
if (StringUtils.isNotBlank(model.getCityName1())) {
|
||||
udata.put("cityName1", model.getCityName1());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getDistrict())){
|
||||
if (StringUtils.isNotBlank(model.getDistrict())) {
|
||||
udata.put("district", model.getDistrict());
|
||||
}
|
||||
if (StringUtils.isNotBlank(model.getImgUrl())){
|
||||
udata.put("imgUrl", model.getImgUrl());
|
||||
}
|
||||
udata.put("createTime", new Date());
|
||||
//记录操作人员
|
||||
udata.put("operator", user.getRealName());
|
||||
|
||||
+3
-3
@@ -34,13 +34,13 @@ public class IndexStatsController {
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMM");
|
||||
yearmonth=sdf.format(date);
|
||||
}
|
||||
List<StatsIndex> statsIndexs=statsIndexService.findAllStatsNocat(yearmonth,"district",model.getSource());
|
||||
List<StatsIndex> statsIndexs=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"district",model.getSource());
|
||||
Integer earliestMonth = statsIndexService.findEarliestMonth(null, null, model.getSource());
|
||||
model.setEarliestMonth(earliestMonth.toString().substring(0, 4) + "-" + earliestMonth.toString().substring(4));
|
||||
List<StatsIndex> newStats=new ArrayList<StatsIndex>();
|
||||
List<StatsIndex> oldStats=new ArrayList<StatsIndex>();
|
||||
List<StatsIndex> shopStats=statsIndexService.findAllStatsNocat(yearmonth,"shop",model.getSource());
|
||||
List<StatsIndex> officeStats=statsIndexService.findAllStatsNocat(yearmonth,"office",model.getSource());
|
||||
List<StatsIndex> shopStats=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"shop",model.getSource());
|
||||
List<StatsIndex> officeStats=statsIndexService.findAllStatsNocat(Integer.valueOf(yearmonth),"office",model.getSource());
|
||||
if(statsIndexs!=null && statsIndexs.size()>0){
|
||||
for(StatsIndex stat:statsIndexs){
|
||||
StatsIndex newstat=new StatsIndex();
|
||||
|
||||
+10
@@ -35,6 +35,8 @@ public class DevelopmentZoneModel extends BaseModel {
|
||||
|
||||
private String cityName1;
|
||||
|
||||
private String imgUrl;
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
@@ -194,4 +196,12 @@ public class DevelopmentZoneModel extends BaseModel {
|
||||
public void setCityName1(String cityName1) {
|
||||
this.cityName1 = cityName1;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,368 +1,297 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}" />
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="menuButton">
|
||||
<a href="../developmentZone/list" class="list">开发区列表</a>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<#include "/layout/header.ftl" />
|
||||
<div class="main-content">
|
||||
<div class="menuButton">
|
||||
<a href="../developmentZone/list" class="list">开发区列表</a>
|
||||
</div>
|
||||
|
||||
<div class="list">
|
||||
<form id="form1">
|
||||
<#if developmentZone??>
|
||||
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
|
||||
</#if>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="province">所在省份:</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="province" name="province" onchange="updateCityAndDistrict()">
|
||||
<#if developmentZone.province??>
|
||||
<option value="${developmentZone.province}">${developmentZone.province}</option>
|
||||
<#else>
|
||||
<option value="">请选择省份</option>
|
||||
</#if>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
<label for="cityName1">城市:</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="cityName1" name="cityName1" onchange="updateDistrict()">
|
||||
<!-- Options for cities will be populated by JavaScript -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="district">区域:</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="district" name="district">
|
||||
<!-- Options for districts will be populated by JavaScript -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">开发区名称:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" name="name" type="text"
|
||||
placeholder="必填"
|
||||
style="width:200px "
|
||||
value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="alias">别名:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" style="width:200px "
|
||||
value="<#if developmentZone??><#list (developmentZone.alias)! as alia>${alia + ','}</#list><#else></#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="nameEn">开发区名称拼音:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="nameEn" name="nameEn" type="text" style="width:200px "
|
||||
value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="level">级别:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="level" name="level" type="text" placeholder="必填" style="width:200px "
|
||||
value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="address">地址:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="address" name="address" type="text" style="width:300px "
|
||||
value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="area">所在地区:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="area" name="area" type="text" style="width:200px "
|
||||
value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="buildDate">建立年代:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="buildDate" name="buildDate" type="text" style="width:200px "
|
||||
value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="type">类型:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="type" name="type" type="text" style="width:300px "
|
||||
value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="url">URL:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="url" name="url" type="text" style="width:500px "
|
||||
value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="imgUrl">开发区图片URL:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="imgUrl" name="imgUrl" type="text" style="width:500px "
|
||||
value="<#if developmentZone??>${developmentZone.imgUrl!}</#if>"/><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="industry">主导产业:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="industry" name="industry" type="text" style="width:300px "
|
||||
value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="block">区块:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="block" name="block" type="text"
|
||||
value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<input id="saveOrUpdate" type="button" value="提交"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
fetchProvinces();
|
||||
|
||||
<div>
|
||||
<form id="form1">
|
||||
<#if developmentZone??>
|
||||
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
|
||||
</#if>
|
||||
$('#province').change(function () {
|
||||
updateCityAndDistrict();
|
||||
});
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<#if developmentZone??>
|
||||
<@d_city defaultValue="${developmentZone.cityName1!}" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
<#else>
|
||||
<@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
</#if>
|
||||
</td>
|
||||
<td>
|
||||
<label for="province">所在省份:</label>
|
||||
<select id="province" name="province" onchange="updateCityAndDistrict()">
|
||||
<#if province??>
|
||||
<option value="${province}">${province}</option>
|
||||
<#else>
|
||||
<option value="">请选择省份</option>
|
||||
</#if>
|
||||
</select>
|
||||
|
||||
<label for="cityName1">城市:</label>
|
||||
<select id="cityName1" name="cityName1" onchange="updateDistrict()">
|
||||
<!-- Options for cities will be populated by JavaScript -->
|
||||
</select>
|
||||
<label for="district">区域:</label>
|
||||
<select id="district" name="district">
|
||||
<!-- Options for districts will be populated by JavaScript -->
|
||||
</select>
|
||||
<label for="name">开发区名称:</label> <input id="name" name="name" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.name!}</#if>"/>
|
||||
<label for="alias">别名:</label>
|
||||
<input id="alias" name="alias" type="text" placeholder="多个别名用,隔开" value="<#if developmentZone??><#list (developmentZone.alias)! as alia>${alia + ','}</#list><#else></#if>"/>
|
||||
<label for="nameEn">开发区名称拼音:</label> <input id="nameEn" name="nameEn" type="text" value="<#if developmentZone??>${developmentZone.nameEn!}</#if>"/>
|
||||
</br>
|
||||
<label for="level">级别:</label> <input id="level" name="level" type="text" placeholder="必填" value="<#if developmentZone??>${developmentZone.level!}</#if>"/>
|
||||
<label for="address">地址:</label> <input id="address" name="address" type="text" value="<#if developmentZone??>${developmentZone.address!}</#if>"/><br>
|
||||
<label for="area">所在地区:</label> <input id="area" name="area" type="text" value="<#if developmentZone??>${developmentZone.area!}</#if>"/>
|
||||
<label for="buildDate">建立年代:</label><input id="buildDate" name="buildDate" type="text" value="<#if developmentZone??>${developmentZone.buildDate!}</#if>"/>
|
||||
<label for="type">类型:</label><input id="type" name="type" type="text" value="<#if developmentZone??>${developmentZone.type!}</#if>"/>
|
||||
<label for="url">URL:</label><input id="url" name="url" type="text" value="<#if developmentZone??>${developmentZone.url!}</#if>"/><br>
|
||||
<label for="industry">主导产业:</label><input id="industry" name="industry" type="text" value="<#if developmentZone??>${developmentZone.industry!}</#if>"/>
|
||||
<label for="block">区块:</label><input id="block" name="block" type="text" value="<#if developmentZone??>${developmentZone.block!}</#if>"/><br/>
|
||||
<input id="saveOrUpdate" type="button" value="提交"/>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="text" id="seaAddress" />
|
||||
<input type="button" id="btn_sea" value="查询" />
|
||||
<input name="bdShape" id="bdShape" type="hidden"/>
|
||||
<div id="allmap" style="width:100%;height:700px;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
fetchProvinces();
|
||||
|
||||
$('#province').change(function() {
|
||||
updateCityAndDistrict();
|
||||
$('#cityName1').change(function () {
|
||||
updateDistrict();
|
||||
});
|
||||
});
|
||||
|
||||
$('#cityName1').change(function() {
|
||||
updateDistrict();
|
||||
});
|
||||
});
|
||||
|
||||
function fetchProvinces() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/provinces',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
let provinceSelect = $('#province');
|
||||
provinceSelect.empty();
|
||||
provinceSelect.append('<option value="">请选择省份</option>');
|
||||
$.each(data, function(index, province) {
|
||||
provinceSelect.append('<option value="' + province + '">' + province + '</option>');
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateCityAndDistrict() {
|
||||
let province = $('#province').val();
|
||||
let citySelect = $('#cityName1');
|
||||
let districtSelect = $('#district');
|
||||
|
||||
citySelect.empty();
|
||||
districtSelect.empty();
|
||||
citySelect.append('<option value="">请选择城市</option>');
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
|
||||
if (province) {
|
||||
function fetchProvinces() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/cities',
|
||||
data: { province: province },
|
||||
url: '../developmentZone/provinces',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
$.each(data, function(index, city) {
|
||||
citySelect.append('<option value="' + city + '">' + city + '</option>');
|
||||
success: function (data) {
|
||||
let provinceSelect = $('#province');
|
||||
provinceSelect.empty();
|
||||
provinceSelect.append('<option value="">请选择省份</option>');
|
||||
$.each(data, function (index, province) {
|
||||
provinceSelect.append('<option value="' + province + '">' + province + '</option>');
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateDistrict() {
|
||||
let cityName1 = $('#cityName1').val();
|
||||
let districtSelect = $('#district');
|
||||
function updateCityAndDistrict() {
|
||||
let province = $('#province').val();
|
||||
let citySelect = $('#cityName1');
|
||||
let districtSelect = $('#district');
|
||||
|
||||
districtSelect.empty();
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
citySelect.empty();
|
||||
districtSelect.empty();
|
||||
citySelect.append('<option value="">请选择城市</option>');
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
|
||||
if (cityName1) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/districts',
|
||||
data: { cityName1: cityName1 },
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
$.each(data, function(index, district) {
|
||||
districtSelect.append('<option value="' + district + '">' + district + '</option>');
|
||||
});
|
||||
},
|
||||
error: function() {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
|
||||
<!--加载鼠标绘制工具-->
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
|
||||
<!--加载检索信息窗口-->
|
||||
<script type="text/javascript" src="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css" />
|
||||
|
||||
<script type="application/javascript">
|
||||
var map = new BMap.Map("allmap"); // 创建Map实例
|
||||
if($("#cityDisplay").val()) {
|
||||
map.centerAndZoom($("#cityDisplay").val(), 13);
|
||||
}else {
|
||||
map.centerAndZoom('上海', 13);
|
||||
}
|
||||
map.enableScrollWheelZoom(true);
|
||||
|
||||
function changeCity(display){
|
||||
clearAll();
|
||||
map.centerAndZoom(display, 13);
|
||||
}
|
||||
|
||||
var overlays = [];
|
||||
var overlaycomplete = function(e){
|
||||
overlays.push(e.overlay);
|
||||
var points = e.overlay.getPath();
|
||||
|
||||
var bdShape = [];
|
||||
for(var i=0;i<points.length;i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng );
|
||||
location.push(points[i].lat );
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
// 在创建多边形后立即启用编辑
|
||||
e.overlay.enableEditing();
|
||||
};
|
||||
|
||||
var styleOptions = {
|
||||
strokeColor:"red", //边线颜色。
|
||||
fillColor:"red", //填充颜色。当参数为空时,圆形将没有填充效果。
|
||||
strokeWeight: 1, //边线的宽度,以像素为单位。
|
||||
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
|
||||
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
|
||||
strokeStyle: 'solid' //边线的样式,solid或dashed。
|
||||
}
|
||||
//实例化鼠标绘制工具
|
||||
var drawingManager = new BMapLib.DrawingManager(map, {
|
||||
isOpen: true, //是否开启绘制模式
|
||||
enableDrawingTool: true, //是否显示工具栏
|
||||
drawingToolOptions: {
|
||||
anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
|
||||
offset: new BMap.Size(5, 5), //偏离值
|
||||
},
|
||||
circleOptions: styleOptions, //圆的样式
|
||||
polylineOptions: styleOptions, //线的样式
|
||||
polygonOptions: styleOptions, //多边形的样式
|
||||
rectangleOptions: styleOptions //矩形的样式
|
||||
});
|
||||
//添加鼠标绘制工具监听事件,用于获取绘制结果
|
||||
drawingManager.addEventListener('overlaycomplete', overlaycomplete);
|
||||
function clearAll() {
|
||||
for(var i = 0; i < overlays.length; i++){
|
||||
map.removeOverlay(overlays[i]);
|
||||
}
|
||||
overlays.length = 0;
|
||||
}
|
||||
|
||||
// 添加点击覆盖物事件监听器
|
||||
map.addEventListener("click", function(e) {
|
||||
// 判断点击的是否是已存在的覆盖物
|
||||
if (e.overlay) {
|
||||
// 如果是多边形或折线,则可以编辑
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 开启覆盖物编辑功能
|
||||
e.overlay.enableEditing();
|
||||
}
|
||||
// 如果是标记点,则可以拖动
|
||||
else if (e.overlay instanceof BMap.Marker) {
|
||||
// 开启标记点拖动功能
|
||||
e.overlay.enableDragging();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
map.addEventListener("overlaycomplete", function(e) {
|
||||
// 判断新增的覆盖物是否是多边形或折线
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
e.overlay.addEventListener("lineupdate", function() {
|
||||
// 编辑完成后获取更新后的路径点,并更新表单中的数据
|
||||
var points = e.overlay.getPath();
|
||||
var bdShape = [];
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng);
|
||||
location.push(points[i].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#saveOrUpdate").click(function(){
|
||||
// 更新表单中的点位置数据
|
||||
updatePolygonPoints();
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../developmentZone/saveOrUpdate',
|
||||
data: $("#form1").serialize(),
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function(data) {
|
||||
alert(data.msg);
|
||||
location.href="list";
|
||||
},
|
||||
error : function() {
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 更新表单中的多边形点位置数据
|
||||
function updatePolygonPoints() {
|
||||
var polygons = map.getOverlays(BMap.Polygon);
|
||||
for (var i = 0; i < polygons.length; i++) {
|
||||
// 确保当前对象是一个多边形对象
|
||||
if (polygons[i] instanceof BMap.Polygon) {
|
||||
var points = polygons[i].getPath();
|
||||
var bdShape = [];
|
||||
for (var j = 0; j < points.length; j++) {
|
||||
var location = [];
|
||||
location.push(points[j].lng);
|
||||
location.push(points[j].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
// 将更新后的点位置数据更新到表单中
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fetchProvinces()
|
||||
var currentMarker = null;
|
||||
|
||||
function addMarker(lng, lat){
|
||||
var markerPoint = new BMap.Point(lng, lat);
|
||||
|
||||
// 移除旧的标记点
|
||||
if (currentMarker) {
|
||||
map.removeOverlay(currentMarker);
|
||||
}
|
||||
|
||||
// 创建新的标记点
|
||||
currentMarker = new BMap.Marker(markerPoint);
|
||||
map.addOverlay(currentMarker);
|
||||
map.setCenter(markerPoint);
|
||||
|
||||
currentMarker.enableDragging();
|
||||
|
||||
currentMarker.addEventListener("dragging", function(e) {
|
||||
$("#mapLng").text(e.point.lng);
|
||||
$("#mapLat").text(e.point.lat);
|
||||
});
|
||||
}
|
||||
$("#btn_sea").click(function() {
|
||||
var keyword = $.trim($("#seaAddress").val());
|
||||
|
||||
var options = {
|
||||
onSearchComplete: function(results) {
|
||||
console.log(results)
|
||||
// 判断状态是否正确
|
||||
if (local.getStatus() === BMAP_STATUS_SUCCESS) {
|
||||
if (results.getCurrentNumPois() > 0) {
|
||||
var lng = results.getPoi(0).point.lng;
|
||||
var lat = results.getPoi(0).point.lat;
|
||||
addMarker(lng, lat); // 仅添加标记点
|
||||
// var mPoint = new BMap.Point(lng, lat)
|
||||
// map.centerAndZoom(mPoint,15);
|
||||
// drawPolygons(); // 重新绘制围栏
|
||||
if (province) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/cities',
|
||||
data: {province: province},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$.each(data, function (index, city) {
|
||||
citySelect.append('<option value="' + city + '">' + city + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var local = new BMap.LocalSearch(map, options);
|
||||
local.search(keyword);
|
||||
});
|
||||
function updateDistrict() {
|
||||
let cityName1 = $('#cityName1').val();
|
||||
let districtSelect = $('#district');
|
||||
|
||||
districtSelect.empty();
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
|
||||
if (cityName1) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/districts',
|
||||
data: {cityName1: cityName1},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$.each(data, function (index, district) {
|
||||
districtSelect.append('<option value="' + district + '">' + district + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
</script>
|
||||
<script type="application/javascript">
|
||||
|
||||
</body>
|
||||
</html>
|
||||
$("#saveOrUpdate").click(function () {
|
||||
// 更新表单中的点位置数据
|
||||
// updatePolygonPoints();
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../developmentZone/saveOrUpdate',
|
||||
data: $("#form1").serialize(),
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function (data) {
|
||||
alert(data.msg);
|
||||
location.href = "list";
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
|
||||
@@ -0,0 +1,531 @@
|
||||
<#ftl attributes={"content_type":"text/html; charset=UTF-8"}>
|
||||
<#compress>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>开发区围栏列表</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../style/main.css?v=${version}"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style/my.css?v=${version}"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style/theme.css?v=${version}"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style/jquery.autocomplete.css?v=${version}"/>
|
||||
<style>
|
||||
.row-fluid .span2 {
|
||||
width: 100%;
|
||||
*width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<#include "/common_js.ftl" />
|
||||
<div class="row-fluid">
|
||||
<div class="span7">
|
||||
<div class="input-append">
|
||||
<form id="form1">
|
||||
<#if developmentZone??>
|
||||
<input id="id" name="id" type="hidden" value="${developmentZone.id!}"/>
|
||||
</#if>
|
||||
<div style="float: left">
|
||||
<img id="myImage" src="${developmentZone.imgUrl}"/>
|
||||
<br/>
|
||||
<input id="draw" type="button" value="画图"/>
|
||||
<input id="line" type="button" value="串联" onclick="line"/>
|
||||
<textarea type="area" id="a" style="display: none"></textarea>
|
||||
<br/>
|
||||
点1:<input value="" id="a1" style="width: 80px">
|
||||
点1经纬度:<input value="" id="b1"><input id="location1" type="button" value="校准"/>
|
||||
<br/>
|
||||
点2:<input value="" id="a2" style="width: 80px">
|
||||
点2经纬度:<input value="" id="b2"><input id="location2" type="button" value="校准"/>
|
||||
<br/>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<@d_city defaultValue="<#if developmentZone??>${developmentZone.cityName1!}</#if>" callback="changeCity" callbackField="display" name="cityDisplay" />
|
||||
<input type="text" id="seaAddress"/>
|
||||
<input type="button" id="btn_sea" value="查询"/>
|
||||
<input id="saveOrUpdate" type="button" value="提交"/>
|
||||
<input name="bdShape" id="bdShape" type="hidden"/>
|
||||
</div>
|
||||
<div id="allmap" style="height:900px;margin-left: -30px"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
fetchProvinces();
|
||||
|
||||
$('#province').change(function () {
|
||||
updateCityAndDistrict();
|
||||
});
|
||||
|
||||
$('#cityName1').change(function () {
|
||||
updateDistrict();
|
||||
});
|
||||
});
|
||||
|
||||
function fetchProvinces() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/provinces',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
let provinceSelect = $('#province');
|
||||
provinceSelect.empty();
|
||||
provinceSelect.append('<option value="">请选择省份</option>');
|
||||
$.each(data, function (index, province) {
|
||||
provinceSelect.append('<option value="' + province + '">' + province + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateCityAndDistrict() {
|
||||
let province = $('#province').val();
|
||||
let citySelect = $('#cityName1');
|
||||
let districtSelect = $('#district');
|
||||
|
||||
citySelect.empty();
|
||||
districtSelect.empty();
|
||||
citySelect.append('<option value="">请选择城市</option>');
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
|
||||
if (province) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/cities',
|
||||
data: {province: province},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$.each(data, function (index, city) {
|
||||
citySelect.append('<option value="' + city + '">' + city + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateDistrict() {
|
||||
let cityName1 = $('#cityName1').val();
|
||||
let districtSelect = $('#district');
|
||||
|
||||
districtSelect.empty();
|
||||
districtSelect.append('<option value="">请选择区域</option>');
|
||||
|
||||
if (cityName1) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../developmentZone/districts',
|
||||
data: {cityName1: cityName1},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$.each(data, function (index, district) {
|
||||
districtSelect.append('<option value="' + district + '">' + district + '</option>');
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
// 处理错误
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript"
|
||||
src="https://api.map.baidu.com/api?v=2.0&ak=3E63A744012f88c9a73a2f051aece58b"></script>
|
||||
<!--加载鼠标绘制工具-->
|
||||
<script type="text/javascript"
|
||||
src="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"/>
|
||||
<!--加载检索信息窗口-->
|
||||
<script type="text/javascript"
|
||||
src="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.js"></script>
|
||||
<link rel="stylesheet" href="https://api.map.baidu.com/library/SearchInfoWindow/1.4/src/SearchInfoWindow_min.css"/>
|
||||
|
||||
<script type="application/javascript">
|
||||
var map = new BMap.Map("allmap"); // 创建Map实例
|
||||
if ($("#cityDisplay").val()) {
|
||||
map.centerAndZoom($("#cityDisplay").val(), 13);
|
||||
} else {
|
||||
map.centerAndZoom('上海', 13);
|
||||
}
|
||||
map.enableScrollWheelZoom(true);
|
||||
|
||||
function changeCity(display) {
|
||||
clearAll();
|
||||
map.centerAndZoom(display, 13);
|
||||
}
|
||||
|
||||
var overlays = [];
|
||||
var overlaycomplete = function (e) {
|
||||
overlays.push(e.overlay);
|
||||
// var points = e.overlay.getPath();
|
||||
|
||||
var bdShape = [];
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng);
|
||||
location.push(points[i].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
// 在创建多边形后立即启用编辑
|
||||
e.overlay.enableEditing();
|
||||
};
|
||||
|
||||
var styleOptions = {
|
||||
strokeColor: "red", //边线颜色。
|
||||
fillColor: "red", //填充颜色。当参数为空时,圆形将没有填充效果。
|
||||
strokeWeight: 1, //边线的宽度,以像素为单位。
|
||||
strokeOpacity: 0.8, //边线透明度,取值范围0 - 1。
|
||||
fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。
|
||||
strokeStyle: 'solid' //边线的样式,solid或dashed。
|
||||
}
|
||||
//实例化鼠标绘制工具
|
||||
var drawingManager = new BMapLib.DrawingManager(map, {
|
||||
isOpen: true, //是否开启绘制模式
|
||||
enableDrawingTool: true, //是否显示工具栏
|
||||
drawingToolOptions: {
|
||||
anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
|
||||
offset: new BMap.Size(5, 5), //偏离值
|
||||
},
|
||||
circleOptions: styleOptions, //圆的样式
|
||||
polylineOptions: styleOptions, //线的样式
|
||||
polygonOptions: styleOptions, //多边形的样式
|
||||
rectangleOptions: styleOptions //矩形的样式
|
||||
});
|
||||
//添加鼠标绘制工具监听事件,用于获取绘制结果
|
||||
drawingManager.addEventListener('overlaycomplete', overlaycomplete);
|
||||
|
||||
function clearAll() {
|
||||
for (var i = 0; i < overlays.length; i++) {
|
||||
map.removeOverlay(overlays[i]);
|
||||
}
|
||||
overlays.length = 0;
|
||||
}
|
||||
|
||||
var currentInput = null; // 记录当前选择的输入框
|
||||
|
||||
// 绑定输入框的点击事件
|
||||
$("#b1, #b2").click(function () {
|
||||
currentInput = $(this); // 记录当前输入框
|
||||
});
|
||||
// 添加点击覆盖物事件监听器
|
||||
map.addEventListener("click", function (e) {
|
||||
// 判断点击的是否是已存在的覆盖物
|
||||
if (e.overlay) {
|
||||
// 如果是多边形或折线,则可以编辑
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 开启覆盖物编辑功能
|
||||
e.overlay.enableEditing();
|
||||
}
|
||||
// 如果是标记点,则可以拖动
|
||||
else if (e.overlay instanceof BMap.Marker) {
|
||||
// 开启标记点拖动功能
|
||||
e.overlay.enableDragging();
|
||||
}
|
||||
}
|
||||
var lng = e.point.lng;
|
||||
var lat = e.point.lat;
|
||||
|
||||
// 更新经纬度输入框
|
||||
// $("#mapLng").val(lng);
|
||||
if (currentInput) {
|
||||
currentInput.val(lng + ',' + lat); // 更新当前输入框的值
|
||||
}
|
||||
|
||||
// 可选:添加标记点
|
||||
addMarker(lng, lat);
|
||||
map.setCenter(e.point);
|
||||
|
||||
});
|
||||
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
map.addEventListener("overlaycomplete", function (e) {
|
||||
// 判断新增的覆盖物是否是多边形或折线
|
||||
if (e.overlay instanceof BMap.Polygon || e.overlay instanceof BMap.Polyline) {
|
||||
// 添加覆盖物编辑完成事件监听器
|
||||
e.overlay.addEventListener("lineupdate", function () {
|
||||
// 编辑完成后获取更新后的路径点,并更新表单中的数据
|
||||
var points = e.overlay.getPath();
|
||||
var bdShape = [];
|
||||
for (var i = 0; i < points.length; i++) {
|
||||
var location = [];
|
||||
location.push(points[i].lng);
|
||||
location.push(points[i].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#saveOrUpdate").click(function () {
|
||||
// 更新表单中的点位置数据
|
||||
updatePolygonPoints();
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: '../developmentZone/saveOrUpdate',
|
||||
data: $("#form1").serialize(),
|
||||
dataType: 'json',
|
||||
timeout: 100000,
|
||||
success: function (data) {
|
||||
alert(data.msg);
|
||||
location.href = "list";
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 更新表单中的多边形点位置数据
|
||||
function updatePolygonPoints() {
|
||||
var polygons = map.getOverlays(BMap.Polygon);
|
||||
for (var i = 0; i < polygons.length; i++) {
|
||||
// 确保当前对象是一个多边形对象
|
||||
if (polygons[i] instanceof BMap.Polygon) {
|
||||
var points = polygons[i].getPath();
|
||||
var bdShape = [];
|
||||
for (var j = 0; j < points.length; j++) {
|
||||
var location = [];
|
||||
location.push(points[j].lng);
|
||||
location.push(points[j].lat);
|
||||
bdShape.push(location);
|
||||
}
|
||||
// 将更新后的点位置数据更新到表单中
|
||||
$("#bdShape").val(bdShape.join(";"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fetchProvinces()
|
||||
var currentMarker = null;
|
||||
|
||||
function addMarker(lng, lat) {
|
||||
// 移除旧的标记点
|
||||
|
||||
if (currentMarker) {
|
||||
map.removeOverlay(currentMarker);
|
||||
}
|
||||
clearAll()
|
||||
var markerPoint = new BMap.Point(lng, lat);
|
||||
|
||||
// 创建新的标记点
|
||||
currentMarker = new BMap.Marker(markerPoint);
|
||||
map.addOverlay(currentMarker);
|
||||
map.setCenter(markerPoint);
|
||||
|
||||
currentMarker.enableDragging();
|
||||
|
||||
currentMarker.addEventListener("dragging", function (e) {
|
||||
$("#mapLng").text(e.point.lng);
|
||||
$("#mapLat").text(e.point.lat);
|
||||
});
|
||||
}
|
||||
|
||||
$("#btn_sea").click(function () {
|
||||
var keyword = $.trim($("#seaAddress").val());
|
||||
|
||||
var options = {
|
||||
onSearchComplete: function (results) {
|
||||
console.log(results)
|
||||
// 判断状态是否正确
|
||||
if (local.getStatus() === BMAP_STATUS_SUCCESS) {
|
||||
if (results.getCurrentNumPois() > 0) {
|
||||
var lng = results.getPoi(0).point.lng;
|
||||
var lat = results.getPoi(0).point.lat;
|
||||
addMarker(lng, lat); // 仅添加标记点
|
||||
// var mPoint = new BMap.Point(lng, lat)
|
||||
// map.centerAndZoom(mPoint,15);
|
||||
// drawPolygons(); // 重新绘制围栏
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var local = new BMap.LocalSearch(map, options);
|
||||
local.search(keyword);
|
||||
});
|
||||
|
||||
function interpolate(start, end, factor) {
|
||||
return start + (end - start) * factor;
|
||||
}
|
||||
|
||||
function re_location1(event) {
|
||||
// 获取图片在页面上的位置
|
||||
const rect = this.getBoundingClientRect();
|
||||
// 计算点击相对于图片的位置
|
||||
const x = event.clientX - rect.left;
|
||||
const y = event.clientY - rect.top;
|
||||
// 显示点击的坐标
|
||||
// document.getElementById("a1").value = val(x+','+y);
|
||||
document.getElementById("a1").value = x + ',' + y;
|
||||
}
|
||||
|
||||
function re_location2(event) {
|
||||
// 获取图片在页面上的位置
|
||||
const rect = this.getBoundingClientRect();
|
||||
// 计算点击相对于图片的位置
|
||||
const x = event.clientX - rect.left;
|
||||
const y = event.clientY - rect.top;
|
||||
// 显示点击的坐标
|
||||
document.getElementById("a2").value = x + ',' + y;
|
||||
}
|
||||
|
||||
function bound(event) {
|
||||
const rect = this.getBoundingClientRect();
|
||||
const imgWidth = rect.width;
|
||||
const imgHeight = rect.height;
|
||||
point_a1_x = parseFloat(document.getElementById("a1").value.split(',')[0])
|
||||
point_a1_y = parseFloat(document.getElementById("a1").value.split(',')[1])
|
||||
point_a2_x = parseFloat(document.getElementById("a2").value.split(',')[0])
|
||||
point_a2_y = parseFloat(document.getElementById("a2").value.split(',')[1])
|
||||
|
||||
geo_b1_x = parseFloat(document.getElementById("b1").value.split(',')[0])
|
||||
geo_b1_y = parseFloat(document.getElementById("b1").value.split(',')[1])
|
||||
geo_b2_x = parseFloat(document.getElementById("b2").value.split(',')[0])
|
||||
geo_b2_y = parseFloat(document.getElementById("b2").value.split(',')[1])
|
||||
|
||||
const knownPoints = {
|
||||
pixel1: {x: point_a1_x, y: point_a1_y}, // 已知像素1
|
||||
lat1: geo_b1_y, lon1: geo_b1_x, // 已知经纬度1
|
||||
pixel2: {x: point_a2_x, y: point_a2_y}, // 已知像素2
|
||||
lat2: geo_b2_y, lon2: geo_b2_x // 已知经纬度2
|
||||
};
|
||||
|
||||
|
||||
// 获取点击位置的像素坐标
|
||||
const x = event.clientX;
|
||||
const y = event.clientY;
|
||||
console.log(x + "," + y)
|
||||
// 将像素坐标转换为经纬度
|
||||
point = pixelToLatLon({x, y}, knownPoints);
|
||||
var point = new BMap.Point(point.lon.toFixed(6), point.lat.toFixed(6));
|
||||
var marker = new BMap.Marker(point);
|
||||
map.addOverlay(marker);
|
||||
// 显示点击的坐标
|
||||
if (document.getElementById("a").value == "") {
|
||||
document.getElementById("a").value = point.lng + ',' + point.lat;
|
||||
} else {
|
||||
document.getElementById("a").value = document.getElementById("a").value + ";" + point.lng + ',' + point.lat;
|
||||
}
|
||||
bb = document.getElementById("a").value
|
||||
$("#bdShape").val(document.getElementById("a").value)
|
||||
point_array = bb.split(";")
|
||||
if (point_array.length > 2) {
|
||||
points = []
|
||||
for (let i = 0; i < point_array.length; i++) {
|
||||
points.push(new BMap.Point(point_array[i].split(",")[0], point_array[i].split(",")[1]))
|
||||
}
|
||||
var polygon = new BMap.Polygon(points, {
|
||||
zIndex: 10,
|
||||
fillOpacity: 1,
|
||||
strokeStyle: 'dashed',
|
||||
strokeColor: 'blue',
|
||||
strokeWeight: 8,
|
||||
strokeOpacity: 1,
|
||||
fillColor: 'pink'
|
||||
});
|
||||
var bounds = polygon.getBounds();
|
||||
// 获取多边形的中心点
|
||||
var center = bounds.getCenter();
|
||||
map.centerAndZoom(center, map.getZoom());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function pixelToLatLon(px, knownPoints) {
|
||||
const {pixel1, lat1, lon1, pixel2, lat2, lon2} = knownPoints;
|
||||
|
||||
// 计算像素坐标在已知点之间的比例
|
||||
const xRatio = (px.x - pixel1.x) / (pixel2.x - pixel1.x);
|
||||
const yRatio = (px.y - pixel1.y) / (pixel2.y - pixel1.y);
|
||||
|
||||
// 通过线性插值计算经纬度
|
||||
const lat = lat1 + (lat2 - lat1) * yRatio;
|
||||
const lon = lon1 + (lon2 - lon1) * xRatio;
|
||||
|
||||
return {lat, lon};
|
||||
}
|
||||
|
||||
function line() {
|
||||
bb = document.getElementById("a").value
|
||||
point_array = bb.split(";")
|
||||
points = []
|
||||
for (let i = 0; i < point_array.length; i++) {
|
||||
points.push(new BMap.Point(point_array[i].split(",")[0], point_array[i].split(",")[1]))
|
||||
}
|
||||
var polygon = new BMap.Polygon(points, {
|
||||
zIndex: 10,
|
||||
fillOpacity: 1,
|
||||
strokeStyle: 'dashed',
|
||||
strokeColor: 'blue',
|
||||
strokeWeight: 8,
|
||||
strokeOpacity: 1,
|
||||
fillColor: 'pink'
|
||||
});
|
||||
map.addOverlay(polygon);
|
||||
// // 计算面积
|
||||
// const area = BMapLib.GeometryUtil.getArea(polygon.getPath());
|
||||
// document.getElementById("calc_area").value = area * 0.000001; // 转换为平方公里
|
||||
|
||||
|
||||
}
|
||||
|
||||
document.getElementById("location1").addEventListener("click", function (event) {
|
||||
// 移除初始事件
|
||||
document.getElementById("myImage").removeEventListener('click', bound);
|
||||
document.getElementById("myImage").removeEventListener('click', re_location2);
|
||||
document.getElementById("myImage").addEventListener('click', re_location1);
|
||||
});
|
||||
document.getElementById("location2").addEventListener("click", function (event) {
|
||||
// 移除初始事件
|
||||
document.getElementById("myImage").removeEventListener('click', bound);
|
||||
document.getElementById("myImage").removeEventListener('click', re_location1);
|
||||
document.getElementById("myImage").addEventListener('click', re_location2);
|
||||
});
|
||||
document.getElementById("draw").addEventListener("click", function (event) {
|
||||
if (currentMarker) {
|
||||
map.removeOverlay(currentMarker);
|
||||
}
|
||||
clearAll()
|
||||
// 移除初始事件
|
||||
document.getElementById("myImage").removeEventListener('click', re_location2);
|
||||
document.getElementById("myImage").removeEventListener('click', re_location1);
|
||||
document.getElementById("myImage").addEventListener('click', bound);
|
||||
document.getElementById("a").value = ""
|
||||
});
|
||||
document.getElementById("line").addEventListener("click", line)
|
||||
// var map = new BMap.Map("allmap");
|
||||
var scaleCtrl = new BMap.ScaleControl(); // 添加比例尺控件
|
||||
map.addControl(scaleCtrl);
|
||||
// var zoomCtrl = new BMap.ZoomControl(); // 添加缩放控件
|
||||
// map.addControl(zoomCtrl);
|
||||
// var point = new BMap.Point(119.798515, 25.665635);
|
||||
var marker = new BMap.Marker(point);
|
||||
// map.centerAndZoom(point, 10);
|
||||
map.addOverlay(marker);
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</#compress>
|
||||
@@ -53,7 +53,7 @@
|
||||
</tr>
|
||||
<#list developmentZoneList as it>
|
||||
<tr>
|
||||
<td>${it.name!}</td>
|
||||
<td><a href="../developmentZone/edit?id=${it.id!}" target="_blank">${it.name!}</a></td>
|
||||
<td>
|
||||
<#if it.alias??>
|
||||
<#list it.alias as item>
|
||||
@@ -84,7 +84,8 @@
|
||||
|
||||
<td>
|
||||
<a href="show?id=${it.id!}" target="_blank">查看</a>
|
||||
<a href="../developmentZone/edit?id=${it.id!}" target="_blank">新建围栏</a>
|
||||
|
||||
<a href="../developmentZone/editFence?id=${it.id!}" target="_blank">新建围栏</a>
|
||||
<#-- <a name="del${it_index}" href="javascript:;" ref="delete?id=${it.id!}">删除</a>-->
|
||||
</td>
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ public class DevelopmentZone implements MongoEntity {
|
||||
//增加别名字段
|
||||
private List<String> alias;
|
||||
|
||||
private String imgUrl;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
@@ -216,4 +218,13 @@ public class DevelopmentZone implements MongoEntity {
|
||||
public void setAlias(List<String> alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
@Column(name = "img_url")
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ public class StatsIndex implements MongoEntity{
|
||||
|
||||
private String remark;
|
||||
|
||||
// private Double newChain;
|
||||
private Double newChain;
|
||||
private Double chain;
|
||||
|
||||
// private Double newYeartoyear;
|
||||
private Double newYeartoyear;
|
||||
private Double yeartoyear;
|
||||
|
||||
// private Double newFixedbase;
|
||||
private Double newFixedbase;
|
||||
private Double fixedbase;
|
||||
|
||||
private Double belowChain;
|
||||
@@ -276,4 +276,31 @@ public class StatsIndex implements MongoEntity{
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Column(name = "new_chain")
|
||||
public Double getNewChain() {
|
||||
return newChain;
|
||||
}
|
||||
|
||||
public void setNewChain(Double newChain) {
|
||||
this.newChain = newChain;
|
||||
}
|
||||
|
||||
@Column(name = "new_yeartoyear")
|
||||
public Double getNewYeartoyear() {
|
||||
return newYeartoyear;
|
||||
}
|
||||
|
||||
public void setNewYeartoyear(Double newYeartoyear) {
|
||||
this.newYeartoyear = newYeartoyear;
|
||||
}
|
||||
|
||||
@Column(name = "new_fixedbase")
|
||||
public Double getNewFixedbase() {
|
||||
return newFixedbase;
|
||||
}
|
||||
|
||||
public void setNewFixedbase(Double newFixedbase) {
|
||||
this.newFixedbase = newFixedbase;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user