From c9c9a2ddbf4287e7cf7c5385cb4987d0e8afc76b Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Wed, 23 Aug 2023 16:34:18 +0200 Subject: [PATCH] AW1873Bouwplanlabels --- .../item-vector-source.component.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 eac320b..cfed6c7 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 @@ -42,7 +42,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements @Output() onFeatureHover: EventEmitter> = new EventEmitter>(); private stylesCache: IStyles = {}; private sub: Subscription; - private displayMapFeatureSettings: { [code: string]: string[] }; + private displayMapFeatureSettings: { [code: string]: string[] } = defaultDisplayMapFeatureSettings(); constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService, private featureIconService$: FeatureIconService, private folderService: FolderService, @Inject(LOCALE_ID) private locale: string) { super(layer); @@ -85,10 +85,13 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements userSettingsRoot => { this.itemService.getChildItemList(userSettingsRoot.code, 'vnd.farmmaps.itemtype.settings.general').subscribe( items => { - this.displayMapFeatureSettings = items && items.length > 0 ? items[0].data?.displayMapFeatureSettings : null; + if (items && items.length > 0 && items[0].data?.displayMapFeatureSettings) { + this.displayMapFeatureSettings = items[0].data?.displayMapFeatureSettings; + } } ) - }); + } + ); this.strategy = loadingstrategy.bbox; this.format = new GeoJSON(); this._select = new Select({ @@ -241,4 +244,11 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements return styleText; } +} + +function defaultDisplayMapFeatureSettings() { + return { + 'vnd.farmmaps.itemtype.cropfield': ['name', 'cropTypeName', 'area'], + 'vnd.farmmaps.itemtype.croppingscheme': ['name'] + }; } \ No newline at end of file