|
@@ -4,6 +4,7 @@ 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 Icon from 'ol/style/Icon.js';
|
|
|
import { Feature } from "ol";
|
|
|
import store from '@/store'
|
|
|
import Photo from "ol-ext/style/Photo";
|
|
@@ -34,9 +35,9 @@ class gardenPointLayer {
|
|
|
style: (feature) => {
|
|
|
const organId = feature.get('organId') === this.organId
|
|
|
let style1 = new Style({
|
|
|
- image: new Photo({
|
|
|
+ image: new Icon({
|
|
|
src: require("@/assets/images/map/garden.png"),
|
|
|
- radius: 64,
|
|
|
+ scale: 1,
|
|
|
shadow: 0,
|
|
|
// crop: true,
|
|
|
onload: function () {
|
|
@@ -45,31 +46,47 @@ class gardenPointLayer {
|
|
|
displacement: [-1, -1],
|
|
|
}),
|
|
|
});
|
|
|
- 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];
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.gardenPointLayer2 = new KMap.VectorLayer("gardenUserLayer2", 9999, {
|
|
|
+ minZoom: 0,
|
|
|
+ maxZoom: 22,
|
|
|
+ source: new VectorSource({}),
|
|
|
+ style: (feature) => {
|
|
|
+ const organId = feature.get('organId') === this.organId
|
|
|
+ let style1 = new Style({
|
|
|
+ image: new Icon({
|
|
|
+ src: require("@/assets/images/map/garden2.png"),
|
|
|
+ scale: 1,
|
|
|
+ shadow: 0,
|
|
|
+ // crop: true,
|
|
|
+ onload: function () {
|
|
|
+ that.gardenPointLayer2.layer.changed();
|
|
|
+ },
|
|
|
+ displacement: [-1, -1],
|
|
|
}),
|
|
|
});
|
|
|
return [style1];
|
|
|
},
|
|
|
});
|
|
|
this.kmap.addLayer(this.gardenPointLayer.layer);
|
|
|
- // this.initLayer()
|
|
|
+ this.kmap.addLayer(this.gardenPointLayer2.layer);
|
|
|
+ this.initLayer()
|
|
|
}
|
|
|
|
|
|
initLayer(){
|
|
|
const gardenList = [
|
|
|
+ {wkt: "POINT(113.61702297075017 23.584863449735067)"}
|
|
|
+ ]
|
|
|
+ const gardenList2 = [
|
|
|
{wkt: "POINT(113.5081595 23.5320866)"}
|
|
|
]
|
|
|
this.gardenPointLayer.refresh()
|
|
|
+ this.gardenPointLayer2.refresh()
|
|
|
if (this.gardenPointLayer.source) {
|
|
|
this.gardenPointLayer.source.clear()
|
|
|
+ this.gardenPointLayer2.source.clear()
|
|
|
// this.gardenReportPointLayer.source.clear()
|
|
|
}
|
|
|
for(let garden of gardenList){
|
|
@@ -79,6 +96,13 @@ class gardenPointLayer {
|
|
|
// this.gardenReportPointLayer.source.addFeature(newPoint(garden, "wkt", "myGardenReport"))
|
|
|
// this.initGardenWaring(extractCoordinates(garden.wkt), garden)
|
|
|
}
|
|
|
+ for(let garden of gardenList2){
|
|
|
+ // this.clearOverLay(garden.organId)
|
|
|
+ garden.wktVal = garden.wkt
|
|
|
+ this.gardenPointLayer2.source.addFeature(newPoint(garden, "wktVal", "myGarden"))
|
|
|
+ // this.gardenReportPointLayer.source.addFeature(newPoint(garden, "wkt", "myGardenReport"))
|
|
|
+ // this.initGardenWaring(extractCoordinates(garden.wkt), garden)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|