From 652ddc0cdc6b570ccdee47326cb089192c9e3963 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Tue, 22 Aug 2023 18:45:46 +0200 Subject: [PATCH] AW1873Bouwplanlabels --- .../aol/item-vector-source/item-vector-source.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts index fdec33c..85accfa 100644 --- a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts @@ -215,6 +215,8 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements } getDisplayTextForFeature(feature: Feature, propertiesToShow: string[], overrule: style.Text = null, zoom: { min: number, current: number } = null): style.Text { + if (!feature) return null; + if (feature.get('itemType') !== 'vnd.farmmaps.itemtype.cropfield') return null; if (!propertiesToShow) return null; if (propertiesToShow.length <= 0) return null; if (zoom && zoom.current > zoom.min) return null; @@ -226,7 +228,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements case "area": value = formatNumber(value, this.locale, '0.1-2') + 'ha'; break; case "centroid": value = feature.getGeometry() ? getCenter(feature.getGeometry().getExtent()) : null; break; } - displayText += value + (i < propertiesToShow.length ? '\n': ''); + if (value) { + displayText += value + (i < propertiesToShow.length ? '\n' : ''); + } } const styleText = new style.Text({