开发区围栏颜色

This commit is contained in:
majintao
2024-10-11 15:25:06 +08:00
parent 5a221fae6a
commit 61ce1e3fa4
2 changed files with 12 additions and 30 deletions
@@ -30,11 +30,13 @@
</#if>
<div style="float: left">
<img id="myImage" src="${developmentZone.imgUrl!'/path/to/default/image.jpg'}"
style="width: 800px; height: 800px; object-fit: contain;"/>
style="width: 800px; height: 800px; object-fit: contain; "
loading="lazy"/>
<#-- <img id="myImage" src="${developmentZone.imgUrl}"/>-->
<br/>
<input id="draw" type="button" value="画图"/>
<input id="line" type="button" value="串联" onclick="line"/>
<input id="draw" type="button" value="画图"/> &nbsp;&nbsp;
<input id="line" type="button" value="串联" onclick="line"/> &nbsp;&nbsp;
<input id="saveOrUpdate" type="button" value="提交"/>
<textarea type="area" id="a" style="display: none"></textarea>
<br/>
点1:<input value="" id="a1" style="width: 80px">
@@ -50,7 +52,6 @@
</div>
<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 id="allmap" style="height:900px;margin-left: -30px"></div>
@@ -438,11 +439,11 @@
}
var polygon = new BMap.Polygon(points, {
zIndex: 10,
fillOpacity: 1,
fillOpacity: 0.3,
strokeStyle: 'dashed',
strokeColor: 'blue',
strokeWeight: 8,
strokeOpacity: 1,
strokeWeight: 2,
strokeOpacity: 0.3,
fillColor: 'pink'
});
var bounds = polygon.getBounds();
@@ -477,12 +478,12 @@
}
var polygon = new BMap.Polygon(points, {
zIndex: 10,
fillOpacity: 1,
fillOpacity: 0.3,
strokeStyle: 'dashed',
strokeColor: 'blue',
strokeWeight: 8,
strokeOpacity: 1,
fillColor: 'pink'
strokeWeight: 2,
strokeOpacity: 0.3,
fillColor: 'blue'
});
map.addOverlay(polygon);
// // 计算面积
@@ -108,12 +108,6 @@
map.centerAndZoom(polygon.getBounds().getCenter(), 13);
map.addOverlay(polygon); //增加多边形
<#--var coords = [-->
<#-- <#list developmentZone.bdShape.coordinates as latlng>-->
<#-- new BMap.Point(${latlng[0]?string("#.######")}, ${latlng[1]?string("#.######")})<#if latlng_index lt developmentZone.bdShape.coordinates?size>, </#if>-->
<#-- </#list>-->
<#--];-->
// 处理coords的格式
var coords = [
<#list developmentZone.bdShape.coordinates as latlng>
@@ -123,19 +117,6 @@
}<#if latlng_index lt developmentZone.bdShape.coordinates?size>, </#if>
</#list>
];
// // 计算面积
// function calculateArea(coords) {
// if (coords.length < 3) return 0; // 多边形至少需要三个点
// let area = 0;
// const n = coords.length;
// for (let i = 0; i < n; i++) {
// const j = (i + 1) % n; // 连接最后一个点和第一个点
// area += coords[i].lng * coords[j].lat; // 经度 * 纬度
// area -= coords[j].lng * coords[i].lat; // 经度 * 纬度
// }
// area = Math.abs(area) / 2; // 取绝对值并除以2
// return area;
// }
function haversine(lat1, lon1, lat2, lon2) {
const R = 6371; // 地球半径(公里)
const lat1Rad = lat1 * (Math.PI / 180);