|
@@ -17,6 +17,8 @@ CityLandAction.prototype = {
|
|
|
let that = this
|
|
|
this.obj.getTileLayer()
|
|
|
this.tempVectorLayer = this.loadTempVectorLayer()
|
|
|
+ this.drawMultiPolygon = new DrawMultiPolygon({vector: this.tempVectorLayer, map: this.context.currentMap,wkt: this.context.wkt})
|
|
|
+
|
|
|
this.popup = new Popup({map: this.context.currentMap,
|
|
|
close(){
|
|
|
that.tempVectorLayer.getSource().clear()
|
|
@@ -45,6 +47,7 @@ CityLandAction.prototype = {
|
|
|
return
|
|
|
}
|
|
|
this.context.clicks[this.id] = this
|
|
|
+ this.drawMultiPolygon.show()
|
|
|
this.context.currentMap.addLayer(this.obj.layerData.layer)
|
|
|
this.context.getSldStyleSign(this.obj.wmsData.params.STYLE)
|
|
|
this.startStatus = true;
|
|
@@ -56,6 +59,8 @@ CityLandAction.prototype = {
|
|
|
}
|
|
|
this.tempVectorLayer.getSource().clear()
|
|
|
this.context.currentMap.removeLayer(this.obj.layerData.layer)
|
|
|
+ console.log("drawMultiPolygon close")
|
|
|
+ this.drawMultiPolygon.close()
|
|
|
console.log("tempVectorLayer cleared")
|
|
|
this.context.clicks[this.id] = null
|
|
|
console.log("remove click")
|
|
@@ -183,18 +188,6 @@ CityLandAction.prototype = {
|
|
|
}
|
|
|
return html
|
|
|
},
|
|
|
- // selectPoint(that){
|
|
|
- // document.body.style.cursor = "crosshair";
|
|
|
- // that.popup.showOrHide(false)
|
|
|
- // this.context.clicks["selectPoint"] = {
|
|
|
- // click(event, action){
|
|
|
- // $("#point").val(event.coordinate[0].toFixed(7)+","+event.coordinate[1].toFixed(7))
|
|
|
- // that.context.clicks["selectPoint"] = undefined
|
|
|
- // document.body.style.cursor = "default";
|
|
|
- // that.popup.showOrHide(true)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
saveTask(that, feature){
|
|
|
layui.tool.submit("/crop/save",{"status":1,"id":feature.get("id")},function(res){
|
|
|
if(res.code == 0){
|
|
@@ -202,7 +195,6 @@ CityLandAction.prototype = {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function CityLand(opt){
|
|
@@ -272,4 +264,57 @@ CityLand.prototype = {
|
|
|
maxZoom: 30
|
|
|
});
|
|
|
}
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function DrawMultiPolygon(option){
|
|
|
+ this.vector = option.vector
|
|
|
+ this.map = option.map
|
|
|
+ this.wkt = option.wkt
|
|
|
+ let that = this
|
|
|
+ let html = "<a href='javascript:void(0)' id='drawMultiPolygon' style='color: white;position: absolute;top: 0px;right: 100px;z-index: 10' >绘制多边形</a>";
|
|
|
+ $(document.body).append(html)
|
|
|
+ this.initDraw()
|
|
|
+ $("#drawMultiPolygon").on("click",function(){
|
|
|
+ that.vector.getSource().clear()
|
|
|
+ that.draw.setActive(true)
|
|
|
+ })
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+DrawMultiPolygon.prototype = {
|
|
|
+ initDraw(){
|
|
|
+ let that = this
|
|
|
+ that.draw = new ol.interaction.Draw({
|
|
|
+ source : that.vector.getSource(),
|
|
|
+ type: "MultiPolygon",
|
|
|
+ freehand: false,//自由绘制
|
|
|
+ stopClick: true
|
|
|
+ })
|
|
|
+ that.draw.setActive(false)
|
|
|
+ that.draw.on("drawend", function(e){
|
|
|
+ that.draw.setActive(false)
|
|
|
+ that.submit(e.feature)
|
|
|
+ })
|
|
|
+ that.map.addInteraction(that.draw)
|
|
|
+ },
|
|
|
+ show(){
|
|
|
+ $("#drawMultiPolygon").show()
|
|
|
+ },
|
|
|
+ close(){
|
|
|
+ this.draw.setActive(false)
|
|
|
+ $("#drawMultiPolygon").hide()
|
|
|
+ },
|
|
|
+ submit(feature){
|
|
|
+ let geometry = feature.getGeometry()
|
|
|
+ layui.tool.post("/crop/addTest",{"wkt":this.wkt.writeGeometry(geometry)})
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|