Procházet zdrojové kódy

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-pc-vue

wangsisi před 4 měsíci
rodič
revize
9d4a5b43c8

+ 2 - 2
src/utils/ol-map/Common.js

@@ -12,7 +12,7 @@ class Common{
 	/**
 	 *@description 底图Zoom限制
 	*/
-	static BaseLayerZoom = [1,18]
+	static BaseLayerZoom = [1,22]
 	/**
 	 * @description 利通地图像素转OpenLayers地图像素
 	 * @param {KMap.Pixel} pixel KMap.Pixel格式的像素,必填
@@ -142,4 +142,4 @@ class Common{
 
 }
 
-export default Common
+export default Common

+ 9 - 17
src/views/home/regionLayer.js

@@ -22,22 +22,15 @@ class RegionLayer {
     this.farmId = farm.id
     this.vectorStyle  = new KMap.VectorStyle();
 
-    this.regionLayer = new KMap.VectorLayer("regionLayer",999,{
+    this.regionLayer = new KMap.VectorLayer("regionLayer",99,{
       minZoom:15,
-      source:new VectorSource(),
-      style:(f)=> this.getStyle(f)})
+      style:this.vectorStyle.getPolygonStyle("#fba50410", "#eee5e5", 2)
+    })
+
+
     map.addLayer(this.regionLayer.layer)
     this.initData(this.farmId)
   }
-  getIconStyle(feature){
-    let style = new Style({
-      image: new Icon({
-        src: feature.get('icon'),
-        scale:1,
-      })
-    });
-    return style
-  }
   //得到点样式
   getStyle(feature){
     return this.getIconStyle(feature)
@@ -45,22 +38,21 @@ class RegionLayer {
 
   initData(farmId){
     let that = this
-    VE_API.sample.list({farmId}).then(({data})=>{
+    VE_API.region.list({farmId}).then(({data})=>{
       let features = []
       for(let item of data){
-        that.getIcon(item)
-        let f = newRegionFeature(item);
+        let f = newRegionFeature(item,"wkt");
         features.push(f)
       }
       const source = new VectorSource({
         features: features,
       });
-      that.regionLayer.setSource(source)
+      that.regionLayer.layer.setSource(source)
     })
   }
 
   reset(farm, region){
-    this.clearCluster()
+    this.clearLayer()
     this.initData(farm.id, region.id)
   }
 

+ 2 - 2
src/views/zhgl/map.js

@@ -74,8 +74,8 @@ export const newPolymerFeature = (data)=>{
     return feature;
 }
 
-export const newRegionFeature = (data)=>{
-    let geom = new WKT().readGeometry(data["regionWkt"])
+export const newRegionFeature = (data, geomKey)=>{
+    let geom = new WKT().readGeometry(data[geomKey || "regionWkt"])
     let feature = new Feature({
         geometry: geom
     });