AW1873 labels -> undefined/null fixes
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Peter Bastiani 2023-08-21 16:59:54 +02:00
parent e374bb8a73
commit 20dff38cf7

View File

@ -210,9 +210,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
if (!this.labelToolSettings) return null; if (!this.labelToolSettings) return null;
let displayText = ''; let displayText = '';
if (this.labelToolSettings.showFieldName) displayText += feature.get('name') + '\n'; if (this.labelToolSettings.showFieldName) displayText += feature.get('name') + '\n';
if (this.labelToolSettings.showCropName) displayText += feature.get('cropTypeName') + '\n'; if (this.labelToolSettings.showCropName && feature.get('cropTypeName')) displayText += feature.get('cropTypeName') + '\n';
if (this.labelToolSettings.showArea) displayText += feature.get('area') + 'ha\n'; if (this.labelToolSettings.showArea && feature.get('area')) displayText += feature.get('area') + 'ha\n';
if (this.labelToolSettings.showCentroid) displayText += this.getCentroid(feature); if (this.labelToolSettings.showCentroid && this.getCentroid(feature)) displayText += this.getCentroid(feature);
return new style.Text({ return new style.Text({
font: '13px Calibri,sans-serif', font: '13px Calibri,sans-serif',