Skip to content

Commit

Permalink
chore(App): Remove FicheInfo model redondant with Thematic model
Browse files Browse the repository at this point in the history
  • Loading branch information
cboucheIGN committed Nov 28, 2024
1 parent 052588f commit dd1e69f
Show file tree
Hide file tree
Showing 37 changed files with 341 additions and 178 deletions.
10 changes: 5 additions & 5 deletions src/app/requete/pages/requete-new/requete-new.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { map } from 'rxjs';

import { MapContextService } from '../../../shared-map/services/map-context.service';
import { BreadcrumbTransformerService } from '../../../shared-design-dsfr/transformers/breadcrumb-transformer.service';
import { THEMATIC_FICHE_LIST } from '../../../shared-thematic/models/thematic-fiche-list';
import { THEMATIC_LIST } from '../../../shared-thematic/models/thematic-list.enum';

@Component({
selector: 'app-requete-new',
Expand Down Expand Up @@ -57,8 +57,8 @@ export class RequeteNewComponent implements OnInit {
return;
}
this.mapContextService.removeDrawingTools();
for (let i = 0; i < THEMATIC_FICHE_LIST.length; i++) {
THEMATIC_FICHE_LIST[i].active = true;
for (let i = 0; i < THEMATIC_LIST.length; i++) {
THEMATIC_LIST[i].active = true;
}
this.mapContextService.updateLayers();
}
Expand All @@ -76,8 +76,8 @@ export class RequeteNewComponent implements OnInit {
for (let i = this.mapContextService.getActiveThematicLayers().length; i >= 0; i--) {
this.mapContextService.getActiveThematicLayers().pop();
}
for (let i = 0; i < THEMATIC_FICHE_LIST.length; i++) {
THEMATIC_FICHE_LIST[i].active = false;
for (let i = 0; i < THEMATIC_LIST.length; i++) {
THEMATIC_LIST[i].active = false;
}
this.mapContextService.updateLayers();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { ThematicListComponent } from '../../../shared-thematic/components/thema
import { SharedDesignDsfrModule } from '../../../shared-design-dsfr/shared-design-dsfr.module';
import { SharedMapModule } from '../../../shared-map/shared-map.module';
import { SyntheseComponent } from '../../../shared-thematic/components/synthese/synthese.component';
import { FicheInfoViewComponent } from '../../../shared-thematic/components/fiche-info-view/fiche-info-view.component';
import { LayerInfoViewComponent } from '../../../shared-thematic/components/layer-info-view/layer-info-view.component';
import { MapViewerComponent } from '../../../shared-map/components/map-viewer/map-viewer.component';
import { ThematicViewComponent } from '../../../shared-thematic/components/thematic-view/thematic-view.component';
import { LayerInfoViewComponent } from '../../../shared-thematic/components/layer-fiche-view/layer-fiche-view.component';


describe('RequetePrinterComponent', () => {
Expand All @@ -22,7 +22,7 @@ describe('RequetePrinterComponent', () => {
RequetePrinterComponent,
ThematicListComponent,
SyntheseComponent,
FicheInfoViewComponent,
ThematicViewComponent,
LayerInfoViewComponent,
MapViewerComponent
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, OnInit, Input } from '@angular/core';

import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-requete-printer',
Expand All @@ -12,5 +11,4 @@ export class RequetePrinterComponent implements OnInit {

ngOnInit(): void { }


}
6 changes: 3 additions & 3 deletions src/app/shared-map/services/map-context.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import LayerSwitcher from 'ol-ext/control/LayerSwitcher';

import { MAP_DEFAULT_LAYER_GROUP } from '../models/map-layers-default.enum';
import { MAP_BIODIVERISTE_LAYER_GROUP, MAP_PATRIMOINE_LAYER_GROUP } from '../../shared-thematic/models/map-thematic-layers.enum';
import { THEMATIC_FICHE_LIST } from '../../shared-thematic/models/thematic-fiche-list';
import { THEMATIC_LIST } from '../../shared-thematic/models/thematic-list.enum';

@Injectable({
providedIn: 'root'
Expand Down Expand Up @@ -191,8 +191,8 @@ export class MapContextService {

[MAP_BIODIVERISTE_LAYER_GROUP, MAP_PATRIMOINE_LAYER_GROUP].forEach((newlayer) => {
const group = newlayer.get('group') || 'no-group';
for (let i = 0; i < THEMATIC_FICHE_LIST.length; i++) {
if (group === THEMATIC_FICHE_LIST[i].name && THEMATIC_FICHE_LIST[i].active) {
for (let i = 0; i < THEMATIC_LIST.length; i++) {
if (group === THEMATIC_LIST[i].name && THEMATIC_LIST[i].active) {
this.map?.addLayer(newlayer);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@if (reglementation) {
<div [innerHTML]="reglementation.description"></div>
<div [innerHTML]="reglementation.impactReglementaire"></div>
<div [innerHTML]="reglementation.impactProcedure"></div>
<p>
<a [href]="reglementation.referenceUrl">Accès référence réglementaire</a>
</p>
<p>
Point de concat {{ reglementation.contact }}.
</p>
} @else {
<p>Aucune reglementation ou recommandation.</p>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, Input, OnInit } from '@angular/core';
import { Reglementation } from '../../models/reglementation.model';
import { REGLEMENTATION_LIST } from '../../models/reglementation-list.enum';

@Component({
selector: 'app-reglementation-view',
templateUrl: './reglementation-view.component.html',
styleUrl: './reglementation-view.component.css'
})
export class ReglementationViewComponent implements OnInit {

@Input() layerReference: string = '';

@Input() reglementation?: Reglementation;

constructor() {}

ngOnInit() {
if (!this.reglementation) {
this.reglementation = REGLEMENTATION_LIST[0];
}
// todo rechercher reglementation par reference
}

}
24 changes: 24 additions & 0 deletions src/app/shared-reglementation/models/reglementation-list.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Reglementation } from './reglementation.model';

export const REGLEMENTATION_LIST = [
new Reglementation().deserialise({
thematicName: 'Biodiversité',
layerName: 'TODO',
title: 'Sites Natura 2000 au titre de la Directive Habitats',
description: '<p>Espace désigné à l\'échelle européenne pour la rareté ou la fragilité des habitats et des espèces animales et végétales qu’il abrite.</p>',
impactReglementaire: '<p>Les créations de voies forestières, de places de dépôt de bois et les premiers boisements sont susceptibles d\'être soumis à une évaluation des incidences.</p><p>Elle doit également être réalisée pour tous autres travaux (notamment les coupes), s\'ils sont soumis à une autorisation administrative.</p>',
impactProcedure: '<p>L\'évaluation des incidences a pour but de déterminer si le projet peut avoir un impact significatif sur les habitats, les espèces végétales et les espèces animales ayant justifié la désignation du site Natura 2000. </p>',
referenceUrl: 'https://www.natura2000.fr/',
contact: 'Direction départementale des territoires'
}),
new Reglementation().deserialise({
thematicName: 'Biodiversité',
layerName: 'TODO',
title: 'Sites Natura 2000 au titre de la Directive Habitats',
description: '<p>Espace désigné à l\'échelle européenne pour la rareté ou la fragilité des habitats et des espèces animales et végétales qu’il abrite.</p>',
impactReglementaire: '<p>Les créations de voies forestières, de places de dépôt de bois et les premiers boisements sont susceptibles d\'être soumis à une évaluation des incidences.</p><p>Elle doit également être réalisée pour tous autres travaux (notamment les coupes), s\'ils sont soumis à une autorisation administrative.</p>',
impactProcedure: '<p>L\'évaluation des incidences a pour but de déterminer si le projet peut avoir un impact significatif sur les habitats, les espèces végétales et les espèces animales ayant justifié la désignation du site Natura 2000. </p>',
referenceUrl: 'https://www.natura2000.fr/',
contact: 'Direction départementale des territoires'
}),
];
54 changes: 54 additions & 0 deletions src/app/shared-reglementation/models/reglementation.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Serializable } from '../../core/models/serializable.model';

export class Reglementation implements Serializable {

thematicName: string = '';

layerName: string = '';

title: string = '';

// rich html content
description: string = '';

// rich html content
impactReglementaire : string = '';

// rich html content
impactProcedure : string = '';

// must be http URI
referenceUrl: string = '';

contact: string = '';

constructor() { }

deserialise(input: any) {
Object.assign(this, {
thematicName: input.thematicName,
layerName: input.layerName,
title: input.title,
description: input.description,
impactReglementaire: input.impactReglementaire,
impactProcedure: input.impactProcedure,
referenceUrl: input.referenceUrl,
contact: input.contact
});
return this;
}

serialise() {
return {
thematicName: this.thematicName,
layerName: this.layerName,
title: this.title,
description: this.description,
impactReglementaire: this.impactReglementaire,
impactProcedure: this.impactProcedure,
referenceUrl: this.referenceUrl,
contact: this.contact
};
}

}
18 changes: 18 additions & 0 deletions src/app/shared-reglementation/shared-reglementation.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { ReglementationViewComponent } from './components/reglementation-view/reglementation-view.component';


@NgModule({
declarations: [
ReglementationViewComponent
],
imports: [
CommonModule
],
exports: [
ReglementationViewComponent
]
})
export class SharedReglementationModule { }

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h4 class="fr-h6">{{ layer.title }}</h4>
<ul>
@for (feature of layer.features; track feature) {
<li>
@if (layer.link !== "") {
@if (feature.link !== "") {
<a [href]="feature.link" target="_blank">{{ feature.name }}</a>
} @else {
{{ feature.name }}
Expand All @@ -19,6 +19,6 @@ <h4 class="fr-h6">{{ layer.title }}</h4>
}
</ul>

<app-reglementation-view [reglementation]="layer.title"></app-reglementation-view>
<app-reglementation-view [layerReference]="layer.title"></app-reglementation-view>

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LayerInfoViewComponent } from './layer-info-view.component';
import { appConfig } from '../../../app.config';
import { LayerInfoViewComponent } from './layer-fiche-view.component';

describe('FicheInfoViewComponent', () => {
describe('ThematicViewComponent', () => {
let component: LayerInfoViewComponent;
let fixture: ComponentFixture<LayerInfoViewComponent>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { LayerFiche } from '../../models/layer-fiche.model';

@Component({
selector: 'app-layer-info-view',
templateUrl: './layer-info-view.component.html',
styleUrl: './layer-info-view.component.css'
selector: 'app-layer-fiche-view',
templateUrl: './layer-fiche-view.component.html',
styleUrl: './layer-fiche-view.component.css'
})
export class LayerInfoViewComponent implements OnChanges {

@Input() layer!: any;
@Input() layer!: LayerFiche;

@Input() displaySituationMap: boolean = false;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@for (ficheTab of ficheTabs; track $index; let first = $first) {
@if (ficheTab.active) {
@for (thematic of thematics; track $index; let first = $first) {
@if (thematic.active) {
<div>
@if (first) {
<app-synthese></app-synthese>
} @else {
<app-fiche-info-view [fiche]="ficheTab"></app-fiche-info-view>
<app-thematic-view [thematic]="thematic"></app-thematic-view>
}
</div>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';

import { appConfig } from '../../../app.config';
import { ThematicListComponent } from './thematic-list.component';
import { FicheInfoViewComponent } from '../../../shared-thematic/components/fiche-info-view/fiche-info-view.component';
import { LayerInfoViewComponent } from '../../../shared-thematic/components/layer-info-view/layer-info-view.component';
import { SyntheseComponent } from '../synthese/synthese.component';
import { CommonModule } from '@angular/common';
import { SharedDesignDsfrModule } from '../../../shared-design-dsfr/shared-design-dsfr.module';
import { SharedMapModule } from '../../../shared-map/shared-map.module';
import { MapViewerComponent } from '../../../shared-map/components/map-viewer/map-viewer.component';
import { ThematicViewComponent } from '../thematic-view/thematic-view.component';
import { LayerInfoViewComponent } from '../layer-fiche-view/layer-fiche-view.component';


describe('ThematicListComponent', () => {
Expand All @@ -21,7 +20,7 @@ describe('ThematicListComponent', () => {
declarations: [
ThematicListComponent,
SyntheseComponent,
FicheInfoViewComponent,
ThematicViewComponent,
LayerInfoViewComponent,
MapViewerComponent,
],
Expand Down
Loading

0 comments on commit dd1e69f

Please sign in to comment.