diff --git a/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.ts b/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.ts index ca4a099..fd2147e 100644 --- a/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.ts +++ b/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.ts @@ -26,10 +26,9 @@ export class ThematicTabsComponent implements OnInit { ngOnInit() { this.thematicFeatureService.listAllFeatures().subscribe((features: any[]) => { - this.thematics = this.thematicFeatureService.joinThematicsFeatures(features); - this.responseFeatures = this.deleteRedundantFeatures(features); - this.updateActiveThematicLayersFromFeatures(features); + this.thematics = this.thematicFeatureService.joinThematicsFeatures(this.responseFeatures); + this.updateActiveThematicLayersFromFeatures(this.responseFeatures); this.mapContextService.updateLayersVisibility('synthese'); }); @@ -66,7 +65,7 @@ export class ThematicTabsComponent implements OnInit { private deleteRedundantFeatures(features: any[]): any[] { let res: any[] = []; features.forEach((feature) => { - if (!res.filter((elem) => feature.layer == elem.layer && feature.name == elem.name && feature.link == elem.link).length) { + if (!res.filter((elem) => feature.layer == elem.layer && feature.name == elem.name && feature.link == elem.link && feature.zone == elem.zone).length) { res.push(feature); } }) diff --git a/src/app/shared-thematic/services/thematic-feature.service.ts b/src/app/shared-thematic/services/thematic-feature.service.ts index 0c01572..971c5b5 100644 --- a/src/app/shared-thematic/services/thematic-feature.service.ts +++ b/src/app/shared-thematic/services/thematic-feature.service.ts @@ -81,7 +81,6 @@ export class ThematicFeatureService { private isFeatureBelongToLayer(featureProperties: any, layer: LayerFiche) { - console.log(featureProperties, layer); if (featureProperties.layer !== layer.name) { return false; } @@ -148,11 +147,11 @@ export class ThematicFeatureService { const properties = feature.properties; let link; let zone = properties['zone'] || ''; - if (properties['partition'] && properties['gpu_doc_id'] && properties['fichier'] || properties['nomfic']) { + if (properties['partition'] && properties['gpu_doc_id'] && (properties['fichier'] || properties['nomfic'])) { let fichier = properties['fichier'] ? properties['fichier'] : properties['nomfic']; link = `${environment.geoportailUrbanismeDocumentsUrl}/${properties['partition']}/${properties['gpu_doc_id']}/${fichier}`; } else { - link = properties.url; + link = properties.url || properties.urlfic; } const name = properties.sitename || properties.nom || properties.nom_site || this.forceUtfEncoded(properties['nomsuplitt'] || properties['idurba']); const newFeature = Object.assign(feature.properties, {