Browse Source

修改环境

shuhao 4 months ago
parent
commit
b66dd65921
2 changed files with 10 additions and 1 deletions
  1. 8 0
      src/utils/ol-map/Map.js
  2. 2 1
      src/views/authentic/authenticMap.js

+ 8 - 0
src/utils/ol-map/Map.js

@@ -363,6 +363,11 @@ class Map {
 		let features = vm.polygonLayer.source.getFeatures()
 		return features
 	}
+	getFeatureById(id) {
+		const vm = this
+		let feature = vm.polygonLayer.source.getFeatureById(id)
+		return feature
+	}
 
 	// 传入geojson,回显到polygon
 	setLayerPolygon(geometry) {
@@ -373,6 +378,9 @@ class Map {
 	setLayerWkt(wkt,data,isView, padding) {
 		const vm = this
 		let f = new Feature({geometry:new WKT().readGeometry(wkt),...data})
+		if(f.get("id")){
+			f.setId(f.get("id"))
+		}
 		const extent = f.getGeometry().getExtent()
 		vm.polygonLayer.source.addFeature(f)
 		if(isView){

+ 2 - 1
src/views/authentic/authenticMap.js

@@ -387,7 +387,8 @@ class AuthenticMap {
     if(type==='add') {
       features = [mapData.point]
     }else{
-      features = this.kmap.getLayerFeatures();
+      console.log(mapData.curPointData)
+      features = [this.kmap.getFeatureById(mapData.curPointData.id)];
     }
     let geometryArr = [];
     let area = 0;