AW1873Bouwplanlabels
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter (extern) 2023-08-22 18:45:46 +02:00
parent fd3b331cc0
commit 652ddc0cdc

View File

@ -215,6 +215,8 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
}
getDisplayTextForFeature(feature: Feature<Geometry>, 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({