Skip to content

Commit

Permalink
Feat/show map according to tab (#79)
Browse files Browse the repository at this point in the history
* feat: conditional display site or sitegroup

Ajout d'un Event Binding pour pouvoir charger les bonnes géométries en
fonction du "tab" actif
Soit pour afficher toutes les géométries de groupes de site , ou
afficher toutes les géomtries de site

Reviewed-by: andriacap

* fix: error sho details site from map

Changement de la variable baseUrl pour obtenir la bonne route pour
visualiser le site sélectionné sur la carte

Reviewed-by: andriacap
  • Loading branch information
andriacap committed Jul 28, 2023
1 parent 5365d21 commit 84be856
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class MonitoringDatatableGComponent implements OnInit {
@Output() onSetPage = new EventEmitter<any>();
@Output() onDetailsRow = new EventEmitter<any>();
@Output() addEvent = new EventEmitter<any>();
@Output() tabChanged = new EventEmitter<any>();

private filterSubject: Subject<string> = new Subject();
displayFilter: boolean = false;
Expand Down Expand Up @@ -106,6 +107,7 @@ export class MonitoringDatatableGComponent implements OnInit {
this.rows = this.dataTableObj[this.activetabType].rows
this.page = this.dataTableObj[this.activetabType].page
this.objectsStatusChange.emit(this.reInitStatut());
this.tabChanged.emit(this.activetabType)
}

reInitStatut() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class MonitoringSitesComponent extends MonitoringGeomComponent implements
}

onEachFeatureSite() {
const baseUrl = this.router.url;
const baseUrl = this.router.url+"/site";
return (feature, layer) => {
const popup = setPopup(
baseUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<div>
<pnx-monitoring-datatable-g [dataTableArray]="dataTableArray" [dataTableObj]="dataTableObj" [rows]="rows" [colsname]="colsname" (onSort)="setSort($event)" [page]="page"
(onFilter)="setFilter($event)" (onSetPage)="setPage($event)" [obj]="sitesGroups" (onDetailsRow)="seeDetails($event)"
(addEvent)="addSiteGp($event)"></pnx-monitoring-datatable-g>
(addEvent)="addSiteGp($event)"
(tabChanged)="loadGeoJson($event)"></pnx-monitoring-datatable-g>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,26 @@ export class MonitoringSitesGroupsComponent
})
}

getGeometriesSite(){
this.geojsonService.getSitesGroupsChildGeometries(this.onEachFeatureSite());
}


onEachFeatureSite() {
const baseUrl = this.router.url;
return (feature, layer) => {
const popup = setPopup(
baseUrl,
feature.properties.id_base_site,
'Site :' + feature.properties.base_site_name
);
layer.bindPopup(popup);
};
}
seeDetails($event) {
// TODO: routerLink
this._objService.changeObjectTypeParent(
this._sites_group_service.objectObs,true
this._sites_group_service.objectObs
);
this.router.navigate([$event.id_sites_group], {
relativeTo: this._Activatedroute,
Expand All @@ -183,6 +199,18 @@ export class MonitoringSitesGroupsComponent
this.geojsonService.selectSitesGroupLayer($event);
}

loadGeoJson($event) {
if($event == "site"){
this.geojsonService.removeFeatureGroup(this.geojsonService.sitesGroupFeatureGroup);
this.getGeometriesSite()
} else {
this.geojsonService.removeFeatureGroup(this.geojsonService.sitesFeatureGroup);
this.geojsonService.getSitesGroupsGeometries(
this.onEachFeatureSiteGroups()
);
}
}

setDataTableObj(data){
const objTemp = {}
for (const dataType in data){
Expand Down

0 comments on commit 84be856

Please sign in to comment.