Fix icon
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2021-08-12 21:02:55 +02:00
parent 6ff3c0ec96
commit b52bfd4f57

View File

@ -112,17 +112,18 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
this.host.instance.setSource(this.instance);
this.host.instance.setStyle((feature) => {
var key = feature.get('itemType') + (this.selectedItem?"_I":"");
var itemType = feature.get('itemType');
var key = itemType + (this.selectedItem?"_I":"");
if (!this.stylesCache[key]) {
if (this.itemTypeService.itemTypes[key]) {
let itemType = this.itemTypeService.itemTypes[key];
if (this.itemTypeService.itemTypes[itemType]) {
let itemTypeEntry = this.itemTypeService.itemTypes[itemType];
let fillColor = color.asArray(itemType.iconColor);
fillColor[3] = 0;
this.stylesCache[key] = new style.Style({
image: itemType.icon ? new style.Icon({
image: itemTypeEntry.icon ? new style.Icon({
anchor: [0.5, 1],
scale: 0.05,
src: this.featureIconService$.getIconImageDataUrl(itemType.icon)
src: this.featureIconService$.getIconImageDataUrl(itemTypeEntry.icon)
}):null,
stroke: new style.Stroke({
color: 'red',