开发区围栏显示
This commit is contained in:
@@ -66,7 +66,6 @@
|
|||||||
<div id="allmap" style="width:1024px;height:600px;"></div>
|
<div id="allmap" style="width:1024px;height:600px;"></div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<input id="saveOrUpdate" type="button" value="提交"/>
|
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,48 +97,6 @@
|
|||||||
|
|
||||||
map.centerAndZoom(polygon.getBounds().getCenter(), 13);
|
map.centerAndZoom(polygon.getBounds().getCenter(), 13);
|
||||||
map.addOverlay(polygon); //增加多边形
|
map.addOverlay(polygon); //增加多边形
|
||||||
// 添加可编辑功能
|
|
||||||
polygon.enableEditing();
|
|
||||||
|
|
||||||
$("#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(";"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user