Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jpm-cbna committed Jan 22, 2025
1 parent 6032173 commit d089ac9
Show file tree
Hide file tree
Showing 13 changed files with 764 additions and 140 deletions.
6 changes: 5 additions & 1 deletion backend/geonature/core/gn_synthese/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,15 @@ def get_observations_for_web(permissions):
columns += ["nom_vern_or_lb_nom", nom_vern_or_lb_nom]
param_column_list.remove("nom_vern_or_lb_nom")

# Add additional field(s) to output
additional_fields = request.args.getlist("with_field")
param_column_list.update(additional_fields)
print(param_column_list)
for column in param_column_list:
columns += [column, getattr(VSyntheseForWebApp, column)]

observations = func.json_build_object(*columns).label("obs_as_json")

print(observations)
# Need to check if there are blurring permissions so that the blurring process
# does not affect the performance if there is no blurring permissions
blurring_permissions, precise_permissions = split_blurring_precise_permissions(permissions)
Expand Down
2 changes: 2 additions & 0 deletions backend/geonature/utils/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ class Synthese(Schema):
)
# Activate the blurring of sensitive observations. Otherwise, exclude them
BLUR_SENSITIVE_OBSERVATIONS = fields.Boolean(load_default=True)
# List of display criteria for the Synthese map
MAP_CRITERIA_LIST = fields.Dict()

# --------------------------------------------------------------------
# SYNTHESE - TAXON_SHEET
Expand Down
81 changes: 81 additions & 0 deletions config/default_config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,87 @@ MEDIA_CLEAN_CRONTAB = "0 1 * * *"
{ min = 1, color = "#FED976" },
{ min = 0, color = "#FFEDA0" }
]
# Liste des critères d'affichage des observations sur la carte de la Synthese
# Choix des couleurs pour la carto : https://colorbrewer2.org/
# ⚠🛑⚠ : mettre la documentation définitive de ce paramètre ici
# Ex.:
# Add display criteria
[SYNTHESE.MAP_CRITERIA_LIST.valid_status]
label = "Status de validation"
type = "nomenclatures"
field = "id_nomenclature_valid_status"
activate = true
default = false
styles = { stroke = true, color = "#000000", weight = 1, opacity = 0.5, fillOpacity = 0.5 }
[[SYNTHESE.MAP_CRITERIA_LIST.valid_status.values]]
value = ["1", "2"]
label = "Probable"
decription = "Certain à probable"
color = "#44ce1b"
icon = "fa-check-square"
styles = { stroke = false, weight = 3, opacity = 1.0, fillOpacity = 0.80 }
[[SYNTHESE.MAP_CRITERIA_LIST.valid_status.values]]
value = "3"
label = "Douteux"
color = "#f2a134"
icon = "fa-exclamation-triangle"
styles = { stroke = false, weight = 2, opacity = 0.8, fillOpacity = 0.65 }
[[SYNTHESE.MAP_CRITERIA_LIST.valid_status.values]]
value = "4"
label = "Invalide"
color = "#e51f1f"
icon = "fa-minus-circle"
styles = { stroke = false, opacity = 0.6 }
[[SYNTHESE.MAP_CRITERIA_LIST.valid_status.values]]
value = ["5", "6", "0"]
label = "Indéterminé"
description = "Non réalisable, Inconnu ou en attente de validation"
color = "#f3f6f4"
icon = "fa-question-circle"
[SYNTHESE.MAP_CRITERIA_LIST.observation_status]
label = "Statut de l'observation"
type = "nomenclatures"
field = "id_nomenclature_observation_status"
activate = true
default = false
styles = { weight = 0, opacity = 0 }
[[SYNTHESE.MAP_CRITERIA_LIST.observation_status.values]]
value = "Pr"
label = "Présent"
color = "#44ce1b"
[[SYNTHESE.MAP_CRITERIA_LIST.observation_status.values]]
value = "No"
label = "Non observé"
color = "#e51f1f"
[[SYNTHESE.MAP_CRITERIA_LIST.observation_status.values]]
value = "NSP"
label = "Non renseigné"
color = "#f3f6f4"
[SYNTHESE.MAP_CRITERIA_LIST.precision]
label = "Précision localisation"
type = "classes"
field = "precision"
activate = true
default = false
styles = { stroke = false, color = "#000000", weight = 2, opacity = 1.0, fillOpacity = 1.0 }
[[SYNTHESE.MAP_CRITERIA_LIST.precision.values]]
value = 250
label = "Supérieur à 250m"
decription = "Observations dont la précision est supérieure ou égale à 250m."
color = "#cbc9e2"
icon = "target"
[[SYNTHESE.MAP_CRITERIA_LIST.precision.values]]
value = 25
label = "Entre 25 et 250m"
decription = "Observations dont la précision est supérieure ou égale à 25m et inférieure à 250m."
color = "#9e9ac8"
icon = "adjust"
[[SYNTHESE.MAP_CRITERIA_LIST.precision.values]]
value = 0
label = "Inférieur à 25m"
decription = "Observations dont la précision est supérieure ou égale à 0m et inférieure à 25m."
color = "#6a51a3"
icon = "point_scan"

[SYNTHESE.DEFAULT_FILTERS]
# Tous les statuts de validation sauf invalide '4'
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/GN2CommonModule/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class MapComponent implements OnInit {
L.control.zoom({ position: 'topright' }).addTo(this.map);

// SCALE
L.control.scale().addTo(this.map);
L.control.scale({imperial: false}).addTo(this.map);

// GEOLOCATION
if (this.geolocation && this.config.MAPCONFIG.GEOLOCATION) {
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/app/syntheseModule/services/store.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Injectable } from '@angular/core';
import { EventDisplayCriteria } from '../synthese-results/synthese-carte/synthese-carte.component';

@Injectable({
providedIn: 'root',
})
export class SyntheseStoreService {
public idSyntheseList: Array<number>;
public gridData: Array<any>;
public pointData: Array<any>;
public data: {
[key: string]: Array<any>
} = {};
public criteria: EventDisplayCriteria = { type: 'point', name: 'default' };
constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
top: calc(0.05rem + 2px);
}
::ng-deep .legend {
line-height: 10px;
line-height: 24px;
font-size: 14px;
color: #555;
background-color: white;
Expand All @@ -31,9 +31,49 @@
::ng-deep .legend i {
width: 18px;
height: 18px;
float: left;
margin-right: 8px;
display: inline-block;
margin-right: 5px;
border-radius: 10px;
vertical-align: middle;
}

::ng-deep .legend:hover {
opacity: 1;
}

// Synthese map criteria list
::ng-deep .synthese-map-criteria.leaflet-bar {
padding-left: 0;
border: 2px solid rgba(0, 0, 0, 0.2);
}
::ng-deep .synthese-map-criteria .criteria-control-toggle {
width: 44px;
height: 44px;
background-image: url(../../../../assets/images/map_criteria.png);
background-position: 50% 50%;
background-repeat: no-repeat;
}
::ng-deep .synthese-map-criteria .criteria-control-list-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
::ng-deep .synthese-map-criteria .criteria-control-list {
display: none;
}
::ng-deep .synthese-map-criteria.criteria-control-list-expanded {
padding: 6px 10px 6px 6px;
}
::ng-deep .synthese-map-criteria.criteria-control-list-expanded .criteria-control-toggle {
display: none;
}
::ng-deep .synthese-map-criteria.criteria-control-list-expanded .criteria-control-list {
display: block;
position: relative;
}
::ng-deep .synthese-map-criteria .criteria-control-selector {
margin-top: 2px;
position: relative;
top: 1px;
}

Loading

0 comments on commit d089ac9

Please sign in to comment.