|  | @@ -0,0 +1,88 @@
 | 
	
		
			
				|  |  | +import eventBus from "@/api/eventBus";
 | 
	
		
			
				|  |  | +import * as KMap from "@/utils/ol-map/KMap";
 | 
	
		
			
				|  |  | +import { Vector as VectorSource } from "ol/source.js";
 | 
	
		
			
				|  |  | +import Style from "ol/style/Style";
 | 
	
		
			
				|  |  | +import { WKT } from 'ol/format'
 | 
	
		
			
				|  |  | +import { Fill, Text } from "ol/style";
 | 
	
		
			
				|  |  | +import { Feature } from "ol";
 | 
	
		
			
				|  |  | +import store from '@/store'
 | 
	
		
			
				|  |  | +import Photo from "ol-ext/style/Photo";
 | 
	
		
			
				|  |  | +import Stroke from 'ol/style/Stroke.js';
 | 
	
		
			
				|  |  | +import { newPoint } from "@/utils/map.js";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +class gardenPointLayer {
 | 
	
		
			
				|  |  | +    constructor(kmap) {
 | 
	
		
			
				|  |  | +        let that = this;
 | 
	
		
			
				|  |  | +        this.kmap = kmap
 | 
	
		
			
				|  |  | +        let vectorStyle = new KMap.VectorStyle()
 | 
	
		
			
				|  |  | +        // this.regionLayer = new KMap.VectorLayer("regionLayer", 3, {
 | 
	
		
			
				|  |  | +        //     source: new VectorSource({}),
 | 
	
		
			
				|  |  | +        //     style: function (f) {
 | 
	
		
			
				|  |  | +        //         let style2 = vectorStyle.getPolygonStyle("#032833" + "30", "#c7cb20", 2)
 | 
	
		
			
				|  |  | +        //         return [style2]
 | 
	
		
			
				|  |  | +        //     }
 | 
	
		
			
				|  |  | +        // });
 | 
	
		
			
				|  |  | +        // this.kmap.addLayer(this.regionLayer.layer)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        this.gardenPointLayer = new KMap.VectorLayer("gardenUserLayer", 1000, {
 | 
	
		
			
				|  |  | +            minZoom: 0,
 | 
	
		
			
				|  |  | +            maxZoom: 22,
 | 
	
		
			
				|  |  | +            source: new VectorSource({}),
 | 
	
		
			
				|  |  | +            style: (feature) => {
 | 
	
		
			
				|  |  | +              const organId = feature.get('organId') === this.organId
 | 
	
		
			
				|  |  | +              let style1 = new Style({
 | 
	
		
			
				|  |  | +                image: new Photo({
 | 
	
		
			
				|  |  | +                  src: "https://birdseye-img.sysuimars.com/ai_result/2023/11/20/tree_4414/img_27572.jpg"+ '?imageView2/1/w/300/interlace/1',
 | 
	
		
			
				|  |  | +                  radius: 26,
 | 
	
		
			
				|  |  | +                  shadow: 0,
 | 
	
		
			
				|  |  | +                  crop: true,
 | 
	
		
			
				|  |  | +                  onload: function () {
 | 
	
		
			
				|  |  | +                    that.gardenPointLayer.layer.changed();
 | 
	
		
			
				|  |  | +                  },
 | 
	
		
			
				|  |  | +                  displacement: [-1, -1],
 | 
	
		
			
				|  |  | +                  stroke: new Stroke({
 | 
	
		
			
				|  |  | +                    width: 2,
 | 
	
		
			
				|  |  | +                    color: "#fdfcfc00",
 | 
	
		
			
				|  |  | +                  }),
 | 
	
		
			
				|  |  | +                }),
 | 
	
		
			
				|  |  | +              });
 | 
	
		
			
				|  |  | +              let style5 = new Style({
 | 
	
		
			
				|  |  | +                text: new Text({
 | 
	
		
			
				|  |  | +                  text: organId?'':feature.get('name'),
 | 
	
		
			
				|  |  | +                  // text: feature.get('name'),
 | 
	
		
			
				|  |  | +                  offsetX: 0,
 | 
	
		
			
				|  |  | +                  offsetY: 54,
 | 
	
		
			
				|  |  | +                  font:"bold 14px sans-serif",
 | 
	
		
			
				|  |  | +                  fill: new Fill({ color: "#2199f8" }), // 字体颜色
 | 
	
		
			
				|  |  | +                  stroke:new Stroke({ color: "#fff" }), // 字体颜色
 | 
	
		
			
				|  |  | +                }),
 | 
	
		
			
				|  |  | +              });
 | 
	
		
			
				|  |  | +              return [style1, style5];
 | 
	
		
			
				|  |  | +            },
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +          this.kmap.addLayer(this.gardenPointLayer.layer);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    initLayer(gardenList){
 | 
	
		
			
				|  |  | +        this.gardenPointLayer.refresh()
 | 
	
		
			
				|  |  | +        if (this.gardenPointLayer.source) {
 | 
	
		
			
				|  |  | +          this.gardenPointLayer.source.clear()
 | 
	
		
			
				|  |  | +          // this.gardenReportPointLayer.source.clear()
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        for(let garden of gardenList){
 | 
	
		
			
				|  |  | +          // this.clearOverLay(garden.organId)
 | 
	
		
			
				|  |  | +          if (garden.example) {
 | 
	
		
			
				|  |  | +            garden.wktVal = garden.wkt
 | 
	
		
			
				|  |  | +            this.gardenPointLayer.source.addFeature(newPoint(garden, "wktVal", "myGarden"))
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          // this.gardenReportPointLayer.source.addFeature(newPoint(garden, "wkt", "myGardenReport"))
 | 
	
		
			
				|  |  | +          // this.initGardenWaring(extractCoordinates(garden.wkt), garden)
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +export default gardenPointLayer;
 |