@@ -1919,12 +1919,10 @@ public void pageCodeClasseJava(String langueNom, JsonObject langueConfig) throws
19191919 if (classePageSuperNomSimple != null )
19201920 tl (1 , "@Override" );
19211921 tl (1 , "protected void _DEFAULT_MAP_LOCATION(" , classePartsCouverture .nomSimple (langueNom ), "<JsonObject> " , langueConfig .getString (I18n .var_cVar ), ") {" );
1922- tl (2 , "String pointStr = Optional.ofNullable(" , langueConfig .getString (I18n .var_requeteSite ), "_.get" , langueConfig .getString (I18n .var_Requete ), "Vars().get(VAR_DEFAULT_MAP_LOCATION)).orElse(" , langueConfig .getString (I18n .var_requeteSite ), "_.getConfig().getString(" , classePartsConfigCles .nomSimple (langueNom ), ".DEFAULT_MAP_LOCATION));" );
1923- tl (2 , "if(pointStr != null) {" );
1924- tl (3 , "String[] parts = pointStr.replace(\" [\" , \" \" ).replace(\" ]\" , \" \" ).replace(\" \\ \" \" , \" \" ).split(\" ,\" );" );
1925- tl (3 , "JsonObject point = new JsonObject().put(\" lat\" , Double.parseDouble(parts[0])).put(\" lon\" , Double.parseDouble(parts[1]));" );
1926- tl (3 , langueConfig .getString (I18n .var_cVar ), ".o(point);" );
1927- tl (2 , "}" );
1922+ if (classeVarEmplacement != null ) {
1923+ tl (2 , "Point point = " , classeNomSimple , ".staticSet" , StringUtils .capitalize (classeVarEmplacement ), "(" , langueConfig .getString (I18n .var_requeteSite ), "_, Optional.ofNullable(" , langueConfig .getString (I18n .var_requeteSite ), "_.get" , langueConfig .getString (I18n .var_Requete ), "Vars().get(VAR_DEFAULT_MAP_LOCATION)).orElse(" , langueConfig .getString (I18n .var_requeteSite ), "_.getConfig().getString(" , classePartsConfigCles .nomSimple (langueNom ), ".DEFAULT_MAP_LOCATION)));" );
1924+ tl (2 , "w.o(new JsonObject().put(\" type\" , \" Point\" ).put(\" coordinates\" , new JsonArray().add(Double.valueOf(point.getX())).add(Double.valueOf(point.getY()))));" );
1925+ }
19281926 tl (1 , "}" );
19291927 l ();
19301928 if (classePageSuperNomSimple != null )
@@ -2884,7 +2882,7 @@ public void ecrirePageHeadJinja(String langueNom, JsonObject i18nPage, Boolean e
28842882
28852883 // tl(3, "document.querySelector('#site-calendar-box').accordion({ collapsible: true, active: false });");
28862884 l ("{% if DEFAULT_MAP_LOCATION is defined %}" );
2887- tl (3 , "window.DEFAULT_MAP_LOCATION = { lat: {{ DEFAULT_MAP_LOCATION.lat }}, lon: {{ DEFAULT_MAP_LOCATION.lon }} };" );
2885+ tl (3 , "window.DEFAULT_MAP_LOCATION = { type: 'Point', coordinates: [ {{ DEFAULT_MAP_LOCATION.coordinates[0] }}, {{ DEFAULT_MAP_LOCATION.coordinates[1] }} ] };" );
28882886 l ("{% endif %}" );
28892887 l ("{% if DEFAULT_MAP_ZOOM is defined %}" );
28902888 tl (3 , "window.DEFAULT_MAP_ZOOM = {{ DEFAULT_MAP_ZOOM }};" );
@@ -3818,7 +3816,7 @@ else if(entiteAttribuer) {
38183816 auteurPageJs .tl (5 , "}" );
38193817 auteurPageJs .tl (5 , "]" );
38203818 auteurPageJs .tl (3 , "});" );
3821- auteurPageJs .tl (3 , "window.mapCrowdFlowObserved .zoomControl.setPosition('topright');" );
3819+ auteurPageJs .tl (3 , "window.map" , classeNomSimple , " .zoomControl.setPosition('topright');" );
38223820 auteurPageJs .tl (3 , "var data = [];" );
38233821 auteurPageJs .tl (3 , "var layout = {};" );
38243822 auteurPageJs .tl (3 , "layout['showlegend'] = true;" );
@@ -3833,11 +3831,11 @@ else if(entiteAttribuer) {
38333831 auteurPageJs .tl (3 , "}).addTo(window.map" , classeNomSimple , ");" );
38343832 auteurPageJs .l ();
38353833 auteurPageJs .tl (3 , "if(window['DEFAULT_MAP_LOCATION'] && window['DEFAULT_MAP_ZOOM'])" );
3836- auteurPageJs .tl (4 , "window.map" , classeNomSimple , ".setView([window['DEFAULT_MAP_LOCATION']['lat'] , window['DEFAULT_MAP_LOCATION']['lon' ]], window['DEFAULT_MAP_ZOOM']);" );
3834+ auteurPageJs .tl (4 , "window.map" , classeNomSimple , ".setView([window['DEFAULT_MAP_LOCATION']['coordinates'][1] , window['DEFAULT_MAP_LOCATION']['coordinates'][0 ]], window['DEFAULT_MAP_ZOOM']);" );
38373835 auteurPageJs .tl (3 , "else if(window['DEFAULT_MAP_ZOOM'])" );
38383836 auteurPageJs .tl (4 , "window.map" , classeNomSimple , ".setView(null, window['DEFAULT_MAP_ZOOM']);" );
38393837 auteurPageJs .tl (3 , "else if(window['DEFAULT_MAP_LOCATION'])" );
3840- auteurPageJs .tl (4 , "window.map" , classeNomSimple , ".setView([window['DEFAULT_MAP_LOCATION']['lat'] , window['DEFAULT_MAP_LOCATION']['lon' ]]);" );
3838+ auteurPageJs .tl (4 , "window.map" , classeNomSimple , ".setView([window['DEFAULT_MAP_LOCATION']['coordinates'][1] , window['DEFAULT_MAP_LOCATION']['coordinates'][0 ]]);" );
38413839 auteurPageJs .l ();
38423840 auteurPageJs .tl (3 , "layout['margin'] = { r: 0, t: 0, b: 0, l: 0 };" );
38433841 auteurPageJs .tl (3 , "window.geoJSON" , classeNomSimple , " = L.geoJSON().addTo(window.map" , classeNomSimple , ");" );
0 commit comments