Add custom style for vnd.farmmaps.itemntype.layer
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma
2020-02-13 11:24:23 +01:00
parent 3c0bece982
commit 709e964579
3 changed files with 309 additions and 280 deletions

View File

@@ -54,19 +54,27 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
return geometry;
}
getSelectedStyle(feature:Feature):style.Style {
let key = feature.get('itemType')+"_selected";
if(this.stylesCache[key]) {
return this.stylesCache[key];
}
return this.stylesCache["selected"];
}
ngOnInit() {
this.strategy = loadingstrategy.bbox;
this.format = new GeoJSON();
this._select = new Select({
style: (feature) => {
return this.stylesCache['selected'];
return this.getSelectedStyle(feature);
},
hitTolerance: 10,
layers: [this.layer.instance as Layer]
});
this._hoverSelect = new Select({
style: (feature) => {
return this.stylesCache['selected'];
return this.getSelectedStyle(feature);
},
hitTolerance: 10,
condition: (e: MapBrowserEvent) => {
@@ -148,7 +156,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
for (const key in styles) {
if (styles.hasOwnProperty(key)) {
let style = styles[key];
if(style.geometry == null) {
if(style.geometry_ == null) {
style.setGeometry((feature) => this.geometry(feature));
}
this.stylesCache[key]=style;