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

This commit is contained in:
Peter Bastiani 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 { 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) return null;
if (propertiesToShow.length <= 0) return null; if (propertiesToShow.length <= 0) return null;
if (zoom && zoom.current > zoom.min) return null; if (zoom && zoom.current > zoom.min) return null;
@ -226,8 +228,10 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
case "area": value = formatNumber(value, this.locale, '0.1-2') + 'ha'; break; case "area": value = formatNumber(value, this.locale, '0.1-2') + 'ha'; break;
case "centroid": value = feature.getGeometry() ? getCenter(feature.getGeometry().getExtent()) : null; break; case "centroid": value = feature.getGeometry() ? getCenter(feature.getGeometry().getExtent()) : null; break;
} }
if (value) {
displayText += value + (i < propertiesToShow.length ? '\n' : ''); displayText += value + (i < propertiesToShow.length ? '\n' : '');
} }
}
const styleText = new style.Text({ const styleText = new style.Text({
font: '13px Calibri,sans-serif', font: '13px Calibri,sans-serif',