|
@@ -17,6 +17,7 @@ import { register } from "ol/proj/proj4";
|
|
|
import GeometryCollection from 'ol/geom/GeometryCollection.js';
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import { useStore } from "vuex";
|
|
|
+import Polygon from 'ol/geom/Polygon.js';
|
|
|
proj4.defs(
|
|
|
"EPSG:38572",
|
|
|
"+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs"
|
|
@@ -118,6 +119,14 @@ class AuthenticMap {
|
|
|
if(e.type === "modifyend"){
|
|
|
mapData.isEditArea = false;
|
|
|
mapData.isEditArea = true;
|
|
|
+ const features = e.mapBrowserEvent.map.getFeaturesAtPixel(e.mapBrowserEvent.pixel);
|
|
|
+ console.log('features',features);
|
|
|
+ if (features.length > 0) {
|
|
|
+ const feature = features[0];
|
|
|
+ const geometry = feature.getGeometry();
|
|
|
+ const coordinates = geometry.getCoordinates()[0];
|
|
|
+ console.log('Modified polygon coordinates:', coordinates);
|
|
|
+ }
|
|
|
}
|
|
|
}, function(e){
|
|
|
let f = null
|
|
@@ -131,6 +140,7 @@ class AuthenticMap {
|
|
|
if(!res){
|
|
|
ElMessage.warning("编辑中")
|
|
|
}
|
|
|
+ res = f.get("height")?false:res
|
|
|
return res
|
|
|
});
|
|
|
this.kmap.addLayer(this.clickPointLayer.layer);
|
|
@@ -207,7 +217,6 @@ class AuthenticMap {
|
|
|
this.kmap.endModify();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
startModify(type) {
|
|
|
this.kmap.startModify();
|
|
@@ -281,6 +290,24 @@ class AuthenticMap {
|
|
|
that.kmap.on("singleclick", (evt) => {
|
|
|
if(mapData.curPointData.id && !mapData.disabledForm && mapData.selectPointArr.length===1){
|
|
|
ElMessage.warning("编辑中")
|
|
|
+ that.kmap.map.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {
|
|
|
+ if (
|
|
|
+ layer instanceof VectorLayer &&
|
|
|
+ (
|
|
|
+ layer.get("name") === "defaultPolygonLayer")
|
|
|
+ ) {
|
|
|
+ console.log('09090909');
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const feature = mapData.selectPointArr[0];
|
|
|
+ const geometry = feature.getGeometry();
|
|
|
+ console.log('geometry',geometry);
|
|
|
+ const coordinates = geometry.getCoordinates()[0];
|
|
|
+ console.log('Modified polygon coordinates:', coordinates);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
if(!mapData.curPointData.id && mapData.isEdit){
|
|
@@ -337,16 +364,38 @@ class AuthenticMap {
|
|
|
|
|
|
|
|
|
removePoint() {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ console.log('arr',mapData.selectPointArr);
|
|
|
+ const features = this.kmap.getLayerFeatures()
|
|
|
+ features.forEach(item =>{
|
|
|
+ if(item.get("id")===mapData.selectPointArr[0].get("id")){
|
|
|
+ let coordinates = item.getGeometry().getCoordinates();
|
|
|
+
|
|
|
+ coordinates[0][0].pop();
|
|
|
+
|
|
|
+ item.getGeometry().setCoordinates(coordinates);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|