开发区围栏优化-坐标经度问题

This commit is contained in:
mjt
2024-04-09 17:07:10 +08:00
parent 755061a51c
commit 71a882c4c1
3 changed files with 7 additions and 3 deletions
@@ -94,6 +94,8 @@ public class DevelopmentZoneController {
location.add(Double.parseDouble(splitStr2[1])); location.add(Double.parseDouble(splitStr2[1]));
bdLocationList.add(location); bdLocationList.add(location);
} }
//加上第一个,形成首尾闭合
bdLocationList.add(bdLocationList.get(0));
model.setBdShape(bdLocationList); model.setBdShape(bdLocationList);
// 百度经纬度 // 百度经纬度
Map<String, Object> bdShape = new HashMap<String, Object>(); Map<String, Object> bdShape = new HashMap<String, Object>();
@@ -145,6 +147,8 @@ public class DevelopmentZoneController {
location.add(Double.parseDouble(splitStr2[1])); location.add(Double.parseDouble(splitStr2[1]));
bdLocationList.add(location); bdLocationList.add(location);
} }
//加上第一个,形成首尾闭合
bdLocationList.add(bdLocationList.get(0));
model.setBdShape(bdLocationList); model.setBdShape(bdLocationList);
// 百度经纬度 // 百度经纬度
Map<String, Object> bdShape = new HashMap<String, Object>(); Map<String, Object> bdShape = new HashMap<String, Object>();
@@ -25,8 +25,8 @@
<table> <table>
<tr> <tr>
<td> <td>
<#if latlngPolygon??> <#if developmentZone??>
<@d_city defaultValue="${latlngPolygon.city!}" callback="changeCity" callbackField="display" name="cityDisplay" /> <@d_city defaultValue="${developmentZone.cityName!}" callback="changeCity" callbackField="display" name="cityDisplay" />
<#else> <#else>
<@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" /> <@d_city defaultValue="上海" callback="changeCity" callbackField="display" name="cityDisplay" />
</#if> </#if>
@@ -71,7 +71,7 @@
<#if developmentZone.bdShape??> <#if developmentZone.bdShape??>
var polygon = new BMap.Polygon([ var polygon = new BMap.Polygon([
<#list developmentZone.bdShape.coordinates as latlng> <#list developmentZone.bdShape.coordinates as latlng>
new BMap.Point(${latlng[0]}, ${latlng[1]})<#if latlng_index lt developmentZone.bdShape.coordinates?size>, </#if> new BMap.Point(${latlng[0]?string("#.######")}, ${latlng[1]?string("#.######")})<#if latlng_index lt developmentZone.bdShape.coordinates?size>, </#if>
</#list> </#list>
], {strokeColor: "blue", strokeWeight: 2, strokeOpacity: 0.5}); ], {strokeColor: "blue", strokeWeight: 2, strokeOpacity: 0.5});
</#if> </#if>