|
@@ -10,22 +10,21 @@ import { useRouter } from "vue-router";
|
|
import {unByKey} from "ol/Observable";
|
|
import {unByKey} from "ol/Observable";
|
|
import Style from "ol/style/Style";
|
|
import Style from "ol/style/Style";
|
|
import Icon from "ol/style/Icon";
|
|
import Icon from "ol/style/Icon";
|
|
-import {Cluster, Vector as VectorSource} from "ol/source";
|
|
|
|
|
|
+import {Vector as VectorSource} from "ol/source";
|
|
import {newRegionFeature} from "../zhgl/map";
|
|
import {newRegionFeature} from "../zhgl/map";
|
|
|
|
|
|
/**
|
|
/**
|
|
* @description 地图层对象
|
|
* @description 地图层对象
|
|
*/
|
|
*/
|
|
-class SamplePointLayer {
|
|
|
|
|
|
+class RegionLayer {
|
|
constructor(map, farm) {
|
|
constructor(map, farm) {
|
|
let that = this;
|
|
let that = this;
|
|
this.farmId = farm.id
|
|
this.farmId = farm.id
|
|
- let vectorStyle = new KMap.VectorStyle();
|
|
|
|
- this.vectorStyle = vectorStyle;
|
|
|
|
|
|
+ this.vectorStyle = new KMap.VectorStyle();
|
|
|
|
|
|
this.regionLayer = new KMap.VectorLayer("regionLayer",999,{
|
|
this.regionLayer = new KMap.VectorLayer("regionLayer",999,{
|
|
minZoom:15,
|
|
minZoom:15,
|
|
- source:this.clusterSource,
|
|
|
|
|
|
+ source:new VectorSource(),
|
|
style:(f)=> this.getStyle(f)})
|
|
style:(f)=> this.getStyle(f)})
|
|
map.addLayer(this.regionLayer.layer)
|
|
map.addLayer(this.regionLayer.layer)
|
|
this.initData(this.farmId)
|
|
this.initData(this.farmId)
|
|
@@ -66,11 +65,11 @@ class SamplePointLayer {
|
|
}
|
|
}
|
|
|
|
|
|
// 清除聚合图层,解除绑定
|
|
// 清除聚合图层,解除绑定
|
|
- clearCluster() {
|
|
|
|
|
|
+ clearLayer() {
|
|
if (this.regionLayer) {
|
|
if (this.regionLayer) {
|
|
this.regionLayer.layer.getSource().clear()
|
|
this.regionLayer.layer.getSource().clear()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-export default SamplePointLayer;
|
|
|
|
|
|
+export default RegionLayer;
|