Skip to content

Commit

Permalink
Merge pull request #48 from IGNF/bug_doublons
Browse files Browse the repository at this point in the history
fix(shared-thematic) : bug lien et doublons espaces boisés classés
  • Loading branch information
MFrangi authored Dec 17, 2024
2 parents 20fcfc4 + 1d8db32 commit 617aad5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down Expand Up @@ -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);
}
})
Expand Down
5 changes: 2 additions & 3 deletions src/app/shared-thematic/services/thematic-feature.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export class ThematicFeatureService {


private isFeatureBelongToLayer(featureProperties: any, layer: LayerFiche) {
console.log(featureProperties, layer);
if (featureProperties.layer !== layer.name) {
return false;
}
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit 617aad5

Please sign in to comment.