diff --git a/src/app/requete/pages/requete-new/requete-new.component.ts b/src/app/requete/pages/requete-new/requete-new.component.ts
index 8cf19cc..e99375e 100644
--- a/src/app/requete/pages/requete-new/requete-new.component.ts
+++ b/src/app/requete/pages/requete-new/requete-new.component.ts
@@ -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',
@@ -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();
}
@@ -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();
}
diff --git a/src/app/requete/pages/requete-printer/requete-printer.component.spec.ts b/src/app/requete/pages/requete-printer/requete-printer.component.spec.ts
index 2f7c819..486a01b 100644
--- a/src/app/requete/pages/requete-printer/requete-printer.component.spec.ts
+++ b/src/app/requete/pages/requete-printer/requete-printer.component.spec.ts
@@ -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', () => {
@@ -22,7 +22,7 @@ describe('RequetePrinterComponent', () => {
RequetePrinterComponent,
ThematicListComponent,
SyntheseComponent,
- FicheInfoViewComponent,
+ ThematicViewComponent,
LayerInfoViewComponent,
MapViewerComponent
],
diff --git a/src/app/requete/pages/requete-printer/requete-printer.component.ts b/src/app/requete/pages/requete-printer/requete-printer.component.ts
index d58cac3..c7d9379 100644
--- a/src/app/requete/pages/requete-printer/requete-printer.component.ts
+++ b/src/app/requete/pages/requete-printer/requete-printer.component.ts
@@ -1,5 +1,4 @@
-import { Component, OnInit, Input } from '@angular/core';
-
+import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-requete-printer',
@@ -12,5 +11,4 @@ export class RequetePrinterComponent implements OnInit {
ngOnInit(): void { }
-
}
diff --git a/src/app/shared-map/services/map-context.service.ts b/src/app/shared-map/services/map-context.service.ts
index b3276e4..279a33f 100644
--- a/src/app/shared-map/services/map-context.service.ts
+++ b/src/app/shared-map/services/map-context.service.ts
@@ -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'
@@ -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;
}
diff --git a/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.css b/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.css
similarity index 100%
rename from src/app/shared-thematic/components/reglementation-view/reglementation-view.component.css
rename to src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.css
diff --git a/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.html b/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.html
new file mode 100644
index 0000000..b8e698d
--- /dev/null
+++ b/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.html
@@ -0,0 +1,13 @@
+@if (reglementation) {
+
+
+
+
+ Accès référence réglementaire
+
+
+ Point de concat {{ reglementation.contact }}.
+
+} @else {
+Aucune reglementation ou recommandation.
+}
\ No newline at end of file
diff --git a/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.spec.ts b/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.spec.ts
similarity index 100%
rename from src/app/shared-thematic/components/reglementation-view/reglementation-view.component.spec.ts
rename to src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.spec.ts
diff --git a/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.ts b/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.ts
new file mode 100644
index 0000000..656d2f5
--- /dev/null
+++ b/src/app/shared-reglementation/components/reglementation-view/reglementation-view.component.ts
@@ -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
+ }
+
+}
diff --git a/src/app/shared-reglementation/models/reglementation-list.enum.ts b/src/app/shared-reglementation/models/reglementation-list.enum.ts
new file mode 100644
index 0000000..1dc7bcc
--- /dev/null
+++ b/src/app/shared-reglementation/models/reglementation-list.enum.ts
@@ -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: '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.
',
+ impactReglementaire: '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.
Elle doit également être réalisée pour tous autres travaux (notamment les coupes), s\'ils sont soumis à une autorisation administrative.
',
+ impactProcedure: '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.
',
+ 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: '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.
',
+ impactReglementaire: '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.
Elle doit également être réalisée pour tous autres travaux (notamment les coupes), s\'ils sont soumis à une autorisation administrative.
',
+ impactProcedure: '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.
',
+ referenceUrl: 'https://www.natura2000.fr/',
+ contact: 'Direction départementale des territoires'
+ }),
+];
\ No newline at end of file
diff --git a/src/app/shared-reglementation/models/reglementation.model.ts b/src/app/shared-reglementation/models/reglementation.model.ts
new file mode 100644
index 0000000..be90ce7
--- /dev/null
+++ b/src/app/shared-reglementation/models/reglementation.model.ts
@@ -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
+ };
+ }
+
+}
\ No newline at end of file
diff --git a/src/app/shared-reglementation/shared-reglementation.module.ts b/src/app/shared-reglementation/shared-reglementation.module.ts
new file mode 100644
index 0000000..9db55da
--- /dev/null
+++ b/src/app/shared-reglementation/shared-reglementation.module.ts
@@ -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 { }
diff --git a/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.html b/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.html
deleted file mode 100644
index 1146e84..0000000
--- a/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.html
+++ /dev/null
@@ -1,11 +0,0 @@
-@if (fiche) {
-
-{{ fiche.title }}
-
-@for (layer of fiche.layers; track layer) {
-
-
-
-}
-
-}
\ No newline at end of file
diff --git a/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.ts b/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.ts
deleted file mode 100644
index 51ef7f6..0000000
--- a/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Component, Input, OnInit } from '@angular/core';
-import { FicheInfo } from '../../models/fiche-info.model';
-@Component({
- selector: 'app-fiche-info-view',
- templateUrl: './fiche-info-view.component.html',
- styleUrl: './fiche-info-view.component.css'
-})
-export class FicheInfoViewComponent implements OnInit {
-
- @Input() fiche!: FicheInfo;
- @Input() flatview: boolean = false;
-
- constructor() { }
-
- ngOnInit(): void {
- }
-
-}
diff --git a/src/app/shared-thematic/components/layer-info-view/layer-info-view.component.css b/src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.css
similarity index 100%
rename from src/app/shared-thematic/components/layer-info-view/layer-info-view.component.css
rename to src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.css
diff --git a/src/app/shared-thematic/components/layer-info-view/layer-info-view.component.html b/src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.html
similarity index 81%
rename from src/app/shared-thematic/components/layer-info-view/layer-info-view.component.html
rename to src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.html
index 7eb1d51..a0f2d6e 100644
--- a/src/app/shared-thematic/components/layer-info-view/layer-info-view.component.html
+++ b/src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.html
@@ -9,7 +9,7 @@ {{ layer.title }}
@for (feature of layer.features; track feature) {
-
- @if (layer.link !== "") {
+ @if (feature.link !== "") {
{{ feature.name }}
} @else {
{{ feature.name }}
@@ -19,6 +19,6 @@
{{ layer.title }}
}
-
+
}
\ No newline at end of file
diff --git a/src/app/shared-thematic/components/layer-info-view/layer-info-view.component.spec.ts b/src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.spec.ts
similarity index 84%
rename from src/app/shared-thematic/components/layer-info-view/layer-info-view.component.spec.ts
rename to src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.spec.ts
index 7cf1630..67a8293 100644
--- a/src/app/shared-thematic/components/layer-info-view/layer-info-view.component.spec.ts
+++ b/src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.spec.ts
@@ -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;
diff --git a/src/app/shared-thematic/components/layer-info-view/layer-info-view.component.ts b/src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.ts
similarity index 66%
rename from src/app/shared-thematic/components/layer-info-view/layer-info-view.component.ts
rename to src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.ts
index 278383d..558c4b9 100644
--- a/src/app/shared-thematic/components/layer-info-view/layer-info-view.component.ts
+++ b/src/app/shared-thematic/components/layer-fiche-view/layer-fiche-view.component.ts
@@ -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;
diff --git a/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.html b/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.html
deleted file mode 100644
index cc9ad75..0000000
--- a/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.html
+++ /dev/null
@@ -1,8 +0,0 @@
-@if (reglementation) {
-
- Votre forêt est présente sur une zone de {{ reglementation }}.
- En cas de coupe veuillez suivre la recommandation suivante TODO à construire
-
-} @else {
-Aucune reglementation ou recommandation.
-}
\ No newline at end of file
diff --git a/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.ts b/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.ts
deleted file mode 100644
index 3843ab5..0000000
--- a/src/app/shared-thematic/components/reglementation-view/reglementation-view.component.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { Component, Input } from '@angular/core';
-
-@Component({
- selector: 'app-reglementation-view',
- templateUrl: './reglementation-view.component.html',
- styleUrl: './reglementation-view.component.css'
-})
-export class ReglementationViewComponent {
-
- @Input() reglementation!: any;
-
- constructor() {}
-
-}
diff --git a/src/app/shared-thematic/components/thematic-list/thematic-list.component.html b/src/app/shared-thematic/components/thematic-list/thematic-list.component.html
index 2f5979e..646b254 100644
--- a/src/app/shared-thematic/components/thematic-list/thematic-list.component.html
+++ b/src/app/shared-thematic/components/thematic-list/thematic-list.component.html
@@ -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) {
@if (first) {
} @else {
-
+
}
}
diff --git a/src/app/shared-thematic/components/thematic-list/thematic-list.component.spec.ts b/src/app/shared-thematic/components/thematic-list/thematic-list.component.spec.ts
index 87603dc..d9f81f5 100644
--- a/src/app/shared-thematic/components/thematic-list/thematic-list.component.spec.ts
+++ b/src/app/shared-thematic/components/thematic-list/thematic-list.component.spec.ts
@@ -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', () => {
@@ -21,7 +20,7 @@ describe('ThematicListComponent', () => {
declarations: [
ThematicListComponent,
SyntheseComponent,
- FicheInfoViewComponent,
+ ThematicViewComponent,
LayerInfoViewComponent,
MapViewerComponent,
],
diff --git a/src/app/shared-thematic/components/thematic-list/thematic-list.component.ts b/src/app/shared-thematic/components/thematic-list/thematic-list.component.ts
index ff9f34b..e607757 100644
--- a/src/app/shared-thematic/components/thematic-list/thematic-list.component.ts
+++ b/src/app/shared-thematic/components/thematic-list/thematic-list.component.ts
@@ -1,8 +1,9 @@
import { Component } from '@angular/core';
+
import { ThematicSelectService } from '../../services/thematic-select.service';
import { MapContextService } from '../../../shared-map/services/map-context.service';
-import { FicheInfoFeatureService } from '../../services/fiche-info-feature.service';
-import { THEMATIC_FICHE_LIST } from '../../models/thematic-fiche-list';
+import { ThematicFeatureService } from '../../services/fiche-info-feature.service';
+import { THEMATIC_LIST } from '../../models/thematic-list.enum';
@Component({
selector: 'app-thematic-list',
@@ -13,12 +14,12 @@ export class ThematicListComponent {
selectedTabIndex: number = 0;
- ficheTabs: any[] = [];
+ thematics: any[] = [];
responseFeatures: any[] = [];
constructor(
- private ficheInfoFeatureService: FicheInfoFeatureService,
+ private thematicFeatureService: ThematicFeatureService,
private thematicSelectService: ThematicSelectService,
private mapContextService: MapContextService
) { }
@@ -32,7 +33,7 @@ export class ThematicListComponent {
this.updateActiveTabs(activeThemeList);
});
- this.ficheInfoFeatureService.listFicheFeatures().subscribe((features: any[]) => {
+ this.thematicFeatureService.listFicheFeatures().subscribe((features: any[]) => {
this.responseFeatures = features;
this.updateActiveThematicLayersFromFeatures(features);
this.mapContextService.updateLayersVisibility('synthese');
@@ -50,17 +51,17 @@ export class ThematicListComponent {
private updateActiveTabs(activeThemeList: any[]) {
- this.ficheTabs = THEMATIC_FICHE_LIST.filter((theme) => activeThemeList.includes(theme.name));
+ this.thematics = THEMATIC_LIST.filter((theme) => activeThemeList.includes(theme.name));
this.selectTab('synthese');
}
private setSelectedTabIndex(tabId: string) {
let indexModifier = 0;
- for (let i = 0; i < THEMATIC_FICHE_LIST.length; i++) {
- if (THEMATIC_FICHE_LIST[i].name === tabId) {
+ for (let i = 0; i < THEMATIC_LIST.length; i++) {
+ if (THEMATIC_LIST[i].name === tabId) {
this.selectedTabIndex = i - indexModifier;
- } else if (!THEMATIC_FICHE_LIST[i].active) {
+ } else if (!THEMATIC_LIST[i].active) {
indexModifier++;
}
}
@@ -68,19 +69,19 @@ export class ThematicListComponent {
private initFicheList() {
- this.ficheTabs = THEMATIC_FICHE_LIST.map((fiche) => {
- if (!fiche.layers) {
- fiche.layers = [];
+ this.thematics = THEMATIC_LIST.map((thematic) => {
+ if (!thematic.layers) {
+ thematic.layers = [];
}
- return fiche;
+ return thematic;
});
}
private updateFicheList() {
- this.ficheTabs = this.ficheTabs.map((fiche) => {
- fiche.layers = fiche.layers.map((layer: any) => this.updateFicheLayerList(layer));
- return fiche;
+ this.thematics = this.thematics.map((thematic) => {
+ thematic.layers = thematic.layers.map((layer: any) => this.updateFicheLayerList(layer));
+ return thematic;
});
}
diff --git a/src/app/shared-thematic/components/thematic-select/thematic-select.component.ts b/src/app/shared-thematic/components/thematic-select/thematic-select.component.ts
index 98c81f2..add0fce 100644
--- a/src/app/shared-thematic/components/thematic-select/thematic-select.component.ts
+++ b/src/app/shared-thematic/components/thematic-select/thematic-select.component.ts
@@ -1,6 +1,7 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
+
import { ThematicSelectService } from '../../services/thematic-select.service';
-import { THEMATIC_FICHE_LIST } from '../../models/thematic-fiche-list';
+import { THEMATIC_LIST } from '../../models/thematic-list.enum';
@Component({
selector: 'app-thematic-select',
@@ -18,7 +19,7 @@ export class ThematicSelectComponent implements OnInit {
) { }
ngOnInit(): void {
- this.checkboxes = THEMATIC_FICHE_LIST.slice(1).map((theme) => {
+ this.checkboxes = THEMATIC_LIST.slice(1).map((theme) => {
return Object.assign(theme);
});
};
diff --git a/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.html b/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.html
index 09f858e..fa97028 100644
--- a/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.html
+++ b/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.html
@@ -1,13 +1,13 @@
- @for (ficheTab of ficheTabs; track $index; let first = $first) {
- @if (ficheTab.active) {
-
+ @for (thematicTab of thematicTabs; track $index; let first = $first) {
+ @if (thematicTab.active) {
+
@if (first) {
} @else {
-
+
}
diff --git a/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.spec.ts b/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.spec.ts
index 248d156..1155ae4 100644
--- a/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.spec.ts
+++ b/src/app/shared-thematic/components/thematic-tabs/thematic-tabs.component.spec.ts
@@ -2,9 +2,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedDesignDsfrModule } from '../../../shared-design-dsfr/shared-design-dsfr.module';
import { ThematicTabsComponent } from './thematic-tabs.component';
import { SyntheseComponent } from '../synthese/synthese.component';
-import { FicheInfoViewComponent } from '../fiche-info-view/fiche-info-view.component';
-import { LayerInfoViewComponent } from '../layer-info-view/layer-info-view.component';
import { appConfig } from '../../../app.config';
+import { ThematicViewComponent } from '../thematic-view/thematic-view.component';
+import { LayerInfoViewComponent } from '../layer-fiche-view/layer-fiche-view.component';
describe('ThematicTabsComponent', () => {
@@ -13,11 +13,16 @@ describe('ThematicTabsComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [ThematicTabsComponent, SyntheseComponent, FicheInfoViewComponent, LayerInfoViewComponent],
+ declarations: [
+ ThematicTabsComponent,
+ SyntheseComponent,
+ ThematicViewComponent,
+ LayerInfoViewComponent
+ ],
imports: [SharedDesignDsfrModule],
providers: appConfig.providers
})
- .compileComponents();
+ .compileComponents();
fixture = TestBed.createComponent(ThematicTabsComponent);
component = fixture.componentInstance;
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 ff8fc50..f2796e3 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
@@ -2,8 +2,10 @@ import { Component, OnInit } from '@angular/core';
import { ThematicSelectService } from '../../services/thematic-select.service';
import { MapContextService } from '../../../shared-map/services/map-context.service';
-import { FicheInfoFeatureService } from '../../services/fiche-info-feature.service';
-import { THEMATIC_FICHE_LIST } from '../../models/thematic-fiche-list';
+import { ThematicFeatureService } from '../../services/fiche-info-feature.service';
+import { THEMATIC_LIST } from '../../models/thematic-list.enum';
+import { Thematic } from '../../models/thematic.model';
+import { LayerFiche } from '../../models/layer-fiche.model';
@Component({
selector: 'app-thematic-tabs',
@@ -14,12 +16,12 @@ export class ThematicTabsComponent implements OnInit {
selectedTabIndex: number = 0;
- ficheTabs: any[] = [];
+ thematicTabs: Thematic[] = [];
responseFeatures: any[] = [];
constructor(
- private ficheInfoFeatureService: FicheInfoFeatureService,
+ private thematicFeatureService: ThematicFeatureService,
private thematicSelectService: ThematicSelectService,
private mapContextService: MapContextService
) { }
@@ -33,7 +35,7 @@ export class ThematicTabsComponent implements OnInit {
this.updateActiveTabs(activeThemeList);
});
- this.ficheInfoFeatureService.listFicheFeatures().subscribe((features: any[]) => {
+ this.thematicFeatureService.listFicheFeatures().subscribe((features: any[]) => {
this.responseFeatures = this.deleteRedundantFeatures(features);
this.updateActiveThematicLayersFromFeatures(features);
this.mapContextService.updateLayersVisibility('synthese');
@@ -51,17 +53,17 @@ export class ThematicTabsComponent implements OnInit {
private updateActiveTabs(activeThemeList: any[]) {
- this.ficheTabs = THEMATIC_FICHE_LIST.filter((theme) => activeThemeList.includes(theme.name));
+ this.thematicTabs = THEMATIC_LIST.filter((theme) => activeThemeList.includes(theme.name));
this.selectTab('synthese');
}
private setSelectedTabIndex(tabId: string) {
let indexModifier = 0;
- for (let i = 0; i < THEMATIC_FICHE_LIST.length; i++) {
- if (THEMATIC_FICHE_LIST[i].name === tabId) {
+ for (let i = 0; i < THEMATIC_LIST.length; i++) {
+ if (THEMATIC_LIST[i].name === tabId) {
this.selectedTabIndex = i - indexModifier;
- } else if (!THEMATIC_FICHE_LIST[i].active) {
+ } else if (!THEMATIC_LIST[i].active) {
indexModifier++;
}
}
@@ -69,7 +71,7 @@ export class ThematicTabsComponent implements OnInit {
private initFicheList() {
- this.ficheTabs = THEMATIC_FICHE_LIST.map((fiche) => {
+ this.thematicTabs = THEMATIC_LIST.map((fiche) => {
if (!fiche.layers) {
fiche.layers = [];
}
@@ -79,14 +81,15 @@ export class ThematicTabsComponent implements OnInit {
private updateFiche() {
- this.ficheTabs = this.ficheTabs.map((fiche) => {
- fiche.layers = fiche.layers.map((layer: any) => this.updateFicheLayer(layer));
+ this.thematicTabs = this.thematicTabs.map((fiche) => {
+ fiche.layers = fiche.layers.map((layer: LayerFiche) => this.updateFicheLayer(layer));
return fiche;
});
}
- private updateFicheLayer(layer: any) {
+ private updateFicheLayer(layer: LayerFiche) {
+ layer.flatview = false;
layer.features = [];
layer.features = this.responseFeatures.filter((feature) => {
return this.parseLayerFromTechnicalName(layer.technicalName) === feature.layer;
diff --git a/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.css b/src/app/shared-thematic/components/thematic-view/thematic-view.component.css
similarity index 100%
rename from src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.css
rename to src/app/shared-thematic/components/thematic-view/thematic-view.component.css
diff --git a/src/app/shared-thematic/components/thematic-view/thematic-view.component.html b/src/app/shared-thematic/components/thematic-view/thematic-view.component.html
new file mode 100644
index 0000000..ca3940e
--- /dev/null
+++ b/src/app/shared-thematic/components/thematic-view/thematic-view.component.html
@@ -0,0 +1,11 @@
+@if (thematic) {
+
+{{ thematic.title }}
+
+@for (layer of thematic.layers; track layer) {
+
+
+
+}
+
+}
\ No newline at end of file
diff --git a/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.spec.ts b/src/app/shared-thematic/components/thematic-view/thematic-view.component.spec.ts
similarity index 56%
rename from src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.spec.ts
rename to src/app/shared-thematic/components/thematic-view/thematic-view.component.spec.ts
index 3a117e5..c0bee50 100644
--- a/src/app/shared-thematic/components/fiche-info-view/fiche-info-view.component.spec.ts
+++ b/src/app/shared-thematic/components/thematic-view/thematic-view.component.spec.ts
@@ -1,19 +1,19 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { FicheInfoViewComponent } from './fiche-info-view.component';
import { appConfig } from '../../../app.config';
+import { ThematicViewComponent } from './thematic-view.component';
-describe('FicheInfoViewComponent', () => {
- let component: FicheInfoViewComponent;
- let fixture: ComponentFixture;
+describe('ThematicViewComponent', () => {
+ let component: ThematicViewComponent;
+ let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [FicheInfoViewComponent],
+ declarations: [ThematicViewComponent],
providers: appConfig.providers
})
.compileComponents();
- fixture = TestBed.createComponent(FicheInfoViewComponent);
+ fixture = TestBed.createComponent(ThematicViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/src/app/shared-thematic/components/thematic-view/thematic-view.component.ts b/src/app/shared-thematic/components/thematic-view/thematic-view.component.ts
new file mode 100644
index 0000000..1295909
--- /dev/null
+++ b/src/app/shared-thematic/components/thematic-view/thematic-view.component.ts
@@ -0,0 +1,18 @@
+import { Component, Input, OnInit } from '@angular/core';
+
+import { Thematic } from '../../models/thematic.model';
+
+@Component({
+ selector: 'app-thematic-view',
+ templateUrl: './thematic-view.component.html',
+ styleUrl: './thematic-view.component.css'
+})
+export class ThematicViewComponent implements OnInit {
+
+ @Input() thematic!: Thematic;
+
+ constructor() { }
+
+ ngOnInit(): void { }
+
+}
diff --git a/src/app/shared-thematic/models/layer-fiche.model.ts b/src/app/shared-thematic/models/layer-fiche.model.ts
new file mode 100644
index 0000000..0ad83b0
--- /dev/null
+++ b/src/app/shared-thematic/models/layer-fiche.model.ts
@@ -0,0 +1,39 @@
+import { Serializable } from '../../core/models/serializable.model';
+
+export class LayerFiche implements Serializable {
+
+ title: string = '';
+
+ group: string = '';
+
+ technicalName: string = '';
+
+ features: any[] = [];
+
+ // uniquement a l'execution du front (permet de suivre l'affichage d'une carte de situation)
+ flatview: boolean = false;
+
+ constructor() { }
+
+ deserialise(input: any) {
+ Object.assign(this, {
+ title: input.title,
+ group: input.group,
+ technicalName: input.technicalName,
+ flatview: input.flatview || false,
+ features: input.features || []
+ });
+ return this;
+ }
+
+ serialise() {
+ return {
+ title: this.title,
+ group: this.group,
+ technicalName: this.technicalName,
+ flatview: this.flatview,
+ features: this.features
+ };
+ }
+
+}
\ No newline at end of file
diff --git a/src/app/shared-thematic/models/map-thematic-layers.enum.ts b/src/app/shared-thematic/models/map-thematic-layers.enum.ts
index 5e6c9bb..2178794 100644
--- a/src/app/shared-thematic/models/map-thematic-layers.enum.ts
+++ b/src/app/shared-thematic/models/map-thematic-layers.enum.ts
@@ -1,7 +1,8 @@
import TileLayer from 'ol/layer/Tile';
import { TileWMS } from 'ol/source';
import LayerGroup from 'ol/layer/Group';
-import { THEMATIC_FICHE_LIST } from './thematic-fiche-list';
+
+import { THEMATIC_LIST } from './thematic-list.enum';
export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
properties: {
@@ -10,7 +11,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
},
layers: [
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.CONSERVATOIRES:cen'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.CONSERVATOIRES:cen'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -32,7 +33,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.CDL.PARCELS:cdl'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.CDL.PARCELS:cdl'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -54,7 +55,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.CDL.PARCELS:cdl'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.CDL.PARCELS:cdl'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -76,7 +77,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RNCF:rncfs'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RNCF:rncfs'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -98,7 +99,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RB:rb'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RB:rb'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -120,7 +121,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APLG:aplg'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APLG:aplg'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -143,7 +144,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.RN.PERIMETER:pprnn'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.MNHN.RN.PERIMETER:pprnn'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -165,7 +166,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDSITES.MNHN.RESERVES-REGIONALES:rnr'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDSITES.MNHN.RESERVES-REGIONALES:rnr'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -187,7 +188,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RNN:rnn'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RNN:rnn'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -209,7 +210,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RNC:rnc'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.RNC:rnc'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -231,7 +232,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APB:apb'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APB:apb'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -253,7 +254,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APHN:aphn'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APHN:aphn'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -275,7 +276,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APG:apg'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.APG:apg'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -297,7 +298,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.PN:pn'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.PN:pn'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -319,7 +320,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.SIC:sic'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.SIC:sic'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -341,7 +342,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.ZPS:zps'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.ZPS:zps'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -363,7 +364,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.ZNIEFF2:znieff2'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.ZNIEFF2:znieff2'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -385,7 +386,7 @@ export const MAP_BIODIVERISTE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.ZNIEFF1:znieff1'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'biodiversite')?.layers?.find((l) => l.technicalName === 'PROTECTEDAREAS.ZNIEFF1:znieff1'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -416,7 +417,7 @@ export const MAP_PATRIMOINE_LAYER_GROUP = new LayerGroup({
},
layers: [
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'patrimoine')?.layers?.find((l) => l.technicalName === 'wfs_sup:assiette_sup_s'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'patrimoine')?.layers?.find((l) => l.technicalName === 'wfs_sup:assiette_sup_s'),
extent: [
-20037508.342789244,
-44927335.42709704,
@@ -440,7 +441,7 @@ export const MAP_PATRIMOINE_LAYER_GROUP = new LayerGroup({
})
}),
new TileLayer({
- properties: THEMATIC_FICHE_LIST.find((g) => g.name === 'patrimoine')?.layers?.find((l) => l.technicalName === 'wfs_du:prescription_surf'),
+ properties: THEMATIC_LIST.find((g) => g.name === 'patrimoine')?.layers?.find((l) => l.technicalName === 'wfs_du:prescription_surf'),
extent: [
-20037508.342789244,
-44927335.42709704,
diff --git a/src/app/shared-thematic/models/thematic-fiche-list.ts b/src/app/shared-thematic/models/thematic-list.enum.ts
similarity index 94%
rename from src/app/shared-thematic/models/thematic-fiche-list.ts
rename to src/app/shared-thematic/models/thematic-list.enum.ts
index acc83d1..b64bbc4 100644
--- a/src/app/shared-thematic/models/thematic-fiche-list.ts
+++ b/src/app/shared-thematic/models/thematic-list.enum.ts
@@ -1,13 +1,13 @@
-import { FicheInfo } from "./fiche-info.model";
+import { Thematic } from "./thematic.model";
-export const THEMATIC_FICHE_LIST = [
- new FicheInfo().deserialise({
+export const THEMATIC_LIST = [
+ new Thematic().deserialise({
name: 'synthese',
label: 'Synthèse',
title: 'Synthèse',
active: true
}),
- new FicheInfo().deserialise({
+ new Thematic().deserialise({
name: 'biodiversite',
label: 'Biodiversité',
title: 'Votre forêt se trouve t-elle sur des zones de biodiversité ?',
@@ -88,7 +88,7 @@ export const THEMATIC_FICHE_LIST = [
}
]
}),
- new FicheInfo().deserialise({
+ new Thematic().deserialise({
name: 'patrimoine',
label: 'Patrimoine',
title: 'Votre forêt se trouve t-elle sur des zones patrimonial ?',
diff --git a/src/app/shared-thematic/models/fiche-info.model.ts b/src/app/shared-thematic/models/thematic.model.ts
similarity index 52%
rename from src/app/shared-thematic/models/fiche-info.model.ts
rename to src/app/shared-thematic/models/thematic.model.ts
index 7a8a01a..85368e7 100644
--- a/src/app/shared-thematic/models/fiche-info.model.ts
+++ b/src/app/shared-thematic/models/thematic.model.ts
@@ -1,6 +1,7 @@
import { Serializable } from '../../core/models/serializable.model';
+import { LayerFiche } from './layer-fiche.model';
-export class FicheInfo implements Serializable {
+export class Thematic implements Serializable {
name: string = '';
@@ -8,34 +9,36 @@ export class FicheInfo implements Serializable {
label: string = '';
- active: boolean = true;
-
- layers: any[] = [];
+ layers: LayerFiche[] = [];
- features: any[] = [];
+ // uniquement a l'execution du front (permet de suivre la sélection par l'utilisateur)
+ active: boolean = true;
constructor() { }
deserialise(input: any) {
+ let layers = [];
+ if (input.layers) {
+ layers = input.layers.map((layer: any) => new LayerFiche().deserialise(layer));
+ }
Object.assign(this, {
name: input.name,
title: input.title,
label: input.label,
active: input.active,
- layers: input.layers,
- features: input.features
+ layers: layers
});
return this;
}
serialise() {
+ const layers = this.layers.map((layer: any) => layer.serialise());
return {
name: this.name,
title: this.title,
label: this.label,
active: this.active,
- layers: this.layers,
- features: this.features
+ layers: layers
};
}
diff --git a/src/app/shared-thematic/services/fiche-info-feature.service.spec.ts b/src/app/shared-thematic/services/fiche-info-feature.service.spec.ts
index 7b9c5b7..dcd2766 100644
--- a/src/app/shared-thematic/services/fiche-info-feature.service.spec.ts
+++ b/src/app/shared-thematic/services/fiche-info-feature.service.spec.ts
@@ -1,15 +1,15 @@
import { TestBed } from '@angular/core/testing';
import { appConfig } from '../../app.config';
-import { FicheInfoFeatureService } from './fiche-info-feature.service';
+import { ThematicFeatureService } from './fiche-info-feature.service';
describe('ThematicSelectService', () => {
- let service: FicheInfoFeatureService;
+ let service: ThematicFeatureService;
beforeEach(() => {
TestBed.configureTestingModule({
providers : appConfig.providers
});
- service = TestBed.inject(FicheInfoFeatureService);
+ service = TestBed.inject(ThematicFeatureService);
});
it('should be created', () => {
diff --git a/src/app/shared-thematic/services/fiche-info-feature.service.ts b/src/app/shared-thematic/services/fiche-info-feature.service.ts
index 8b561ff..993aac9 100644
--- a/src/app/shared-thematic/services/fiche-info-feature.service.ts
+++ b/src/app/shared-thematic/services/fiche-info-feature.service.ts
@@ -1,16 +1,16 @@
import { Injectable } from '@angular/core';
import { map, Observable, zip } from 'rxjs';
import { environment } from '../../../environments/environment';
-import { THEMATIC_FICHE_LIST } from '../models/thematic-fiche-list';
import { GeoplateformeWfsService, LON_LAT_ORDER } from './geoplateforme-wfs.service';
import { MapContextService } from '../../shared-map/services/map-context.service';
-import { FicheInfo } from '../models/fiche-info.model';
import { WfsRequest } from '../models/wfs-request';
+import { THEMATIC_LIST } from '../models/thematic-list.enum';
+import { Thematic } from '../models/thematic.model';
@Injectable({
providedIn: 'root'
})
-export class FicheInfoFeatureService {
+export class ThematicFeatureService {
constructor(
private geoplateformeWfsService: GeoplateformeWfsService,
@@ -19,11 +19,11 @@ export class FicheInfoFeatureService {
/**
- * Get all features from all FicheInfos
+ * Get all features from all Thematics
* @returns
*/
listFicheFeatures(): Observable {
- return zip(THEMATIC_FICHE_LIST.filter(fiche => fiche.layers).reduce((request: Observable[], fiche) => {
+ return zip(THEMATIC_LIST.filter(fiche => fiche.layers).reduce((request: Observable[], fiche) => {
request = [...request, ...this.getFicheFeatures(fiche)];
return request;
}, [])).pipe(
@@ -38,12 +38,12 @@ export class FicheInfoFeatureService {
}
/**
- * Get all features from one FicheInfo
- * @param ficheinfo
+ * Get all features from one Thematic
+ * @param thematic
* @returns
*/
- getFicheFeatures(ficheInfo: FicheInfo): Observable[] {
- const requests = ficheInfo.layers.map((layer) => this.buildRequest(layer));
+ getFicheFeatures(thematic: Thematic): Observable[] {
+ const requests = thematic.layers.map((layer) => this.buildRequest(layer));
return requests.map((request) => {
return this.geoplateformeWfsService.getFeatures(request).pipe(
map((response) => {
diff --git a/src/app/shared-thematic/shared-thematic.module.ts b/src/app/shared-thematic/shared-thematic.module.ts
index de48c1c..3cb9cfa 100644
--- a/src/app/shared-thematic/shared-thematic.module.ts
+++ b/src/app/shared-thematic/shared-thematic.module.ts
@@ -6,10 +6,10 @@ import { SyntheseComponent } from './components/synthese/synthese.component';
import { ThematicSelectComponent } from './components/thematic-select/thematic-select.component';
import { ThematicTabsComponent } from './components/thematic-tabs/thematic-tabs.component';
import { ThematicListComponent } from './components/thematic-list/thematic-list.component';
-import { FicheInfoViewComponent } from './components/fiche-info-view/fiche-info-view.component';
-import { LayerInfoViewComponent } from './components/layer-info-view/layer-info-view.component';
-import { ReglementationViewComponent } from './components/reglementation-view/reglementation-view.component';
import { SharedMapModule } from '../shared-map/shared-map.module';
+import { SharedReglementationModule } from '../shared-reglementation/shared-reglementation.module';
+import { ThematicViewComponent } from './components/thematic-view/thematic-view.component';
+import { LayerInfoViewComponent } from './components/layer-fiche-view/layer-fiche-view.component';
@NgModule({
@@ -18,14 +18,14 @@ import { SharedMapModule } from '../shared-map/shared-map.module';
ThematicSelectComponent,
ThematicTabsComponent,
ThematicListComponent,
- FicheInfoViewComponent,
+ ThematicViewComponent,
LayerInfoViewComponent,
- ReglementationViewComponent
],
imports: [
CommonModule,
SharedDesignDsfrModule,
SharedMapModule,
+ SharedReglementationModule
],
exports: [
ThematicSelectComponent,