Skip to content

Commit

Permalink
Ajoute un paramètre pour gérer l'emprise par défaut de la carte grand…
Browse files Browse the repository at this point in the history
… public

Issue #222010

Change-Id: I0e9a5bdef18bf0a98cb1c27159583c3f8b08f5db
  • Loading branch information
hboAtol committed Sep 18, 2024
1 parent 4196c57 commit 63c5f22
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 5 deletions.
2 changes: 2 additions & 0 deletions remocra/src/main/java/fr/sdis83/remocra/GlobalConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class GlobalConstants {
// Clé du paramètre DUREE_VALIDITE_TOKEN stocké dans la table remocra.parametre
public static final String DUREE_VALIDITE_TOKEN = "DUREE_VALIDITE_TOKEN";

public static final String CLE_CENTRAGE_GRAND_PUBLIC = "CENTRAGE_GRAND_PUBLIC";

/**
* Enumération des types de visite, avec
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,4 +570,8 @@ public int getSridInt() {
public String getSridString() {
return this.getValeurString(GlobalConstants.CLE_SRID);
}

public String getCentrageGrandPublic() {
return this.getValeurString(GlobalConstants.CLE_CENTRAGE_GRAND_PUBLIC);
}
}
18 changes: 13 additions & 5 deletions remocra/src/main/java/fr/sdis83/remocra/web/RemocraController.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,19 @@ public String show(HttpServletRequest request, Model model) {
model.addAttribute("organisme", nomOrganisme);

// Emprise par défaut
model.addAttribute(
"initBounds",
bounds == null
? "EPSG:900913;523593.64368054,5303506.7698006,849521.13224316,5486955.6376594" /* Var */
: bounds);
String centrageDefaut;
if (bounds == null) {
// Centrage sur la BBOX saisie au niveau paramètre, sinon fallback sur le Var
if (parametreProvider.get().getCentrageGrandPublic() != null) {
centrageDefaut = parametreProvider.get().getCentrageGrandPublic();
} else {
centrageDefaut =
"EPSG:900913;523593.64368054,5303506.7698006,849521.13224316,5486955.6376594";
}
} else {
centrageDefaut = bounds;
}
model.addAttribute("initBounds", centrageDefaut);

model.addAttribute(
"url_site",
Expand Down
38 changes: 38 additions & 0 deletions server/sdis-remocra/home/postgres/remocra_db/patches/202/202.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
begin;
set statement_timeout = 0;
set client_encoding = 'UTF8';
set standard_conforming_strings = off;
set check_function_bodies = false;
set client_min_messages = warning;
set escape_string_warning = off;
set search_path = remocra, pdi, public, pg_catalog;
--------------------------------------------------
-- Versionnement du patch et vérification
--
create or replace function versionnement_dffd4df4df() returns void language plpgsql AS $body$
declare
numero_patch int;
description_patch varchar;
begin
-- Métadonnées du patch
numero_patch := 202;
description_patch := 'Ajoute un paramètre pour centrer la carte grand public';

-- Vérification
if (select numero_patch-1 != (select max(numero) from remocra.suivi_patches)) then
raise exception 'Le numéro de patch requis n''est pas le bon. Dernier appliqué : %, en cours : %', (select max(numero) from remocra.suivi_patches), numero_patch; end if;
-- Suivi
insert into remocra.suivi_patches(numero, description) values(numero_patch, description_patch);
end $body$;
select versionnement_dffd4df4df();
drop function versionnement_dffd4df4df();
--------------------------------------------------
-- Contenu réel du patch début
INSERT INTO remocra.parametre (cle_parametre, valeur_parametre, type_parametre, description_parametre, categorie_parametre)
VALUES('CENTRAGE_GRAND_PUBLIC', null, 'STRING', 'Boîte englobante par défaut pour la carte grand public', 'GENERAL')
ON CONFLICT (cle_parametre) DO NOTHING;


-- Contenu réel du patch fin
--------------------------------------------------
COMMIT;

0 comments on commit 63c5f22

Please sign in to comment.