Skip to content

Commit d8a988c

Browse files
committed
Merge branch 'main' of github.com:computate-org/computate
2 parents 510a9dd + c1a7652 commit d8a988c

File tree

3 files changed

+31
-29
lines changed

3 files changed

+31
-29
lines changed

src/main/java/org/computate/frFR/java/EcrireGenClasse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5553,15 +5553,15 @@ else if(entiteIndexe
55535553

55545554
wNgsiMethode.tl(2, "case VAR_", entiteVar, ":");
55555555
if("Point".equals(entiteNomSimple)) {
5556-
wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"Point\").put(\"coordinates\", new JsonArray().add(Double.valueOf(o.get", entiteVarCapitalise, "().getX())).add(Double.valueOf(o.get", entiteVarCapitalise, "().getY()))).toString();");
5556+
wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"Point\").put(\"coordinates\", new JsonArray().add(Double.valueOf(o.get", entiteVarCapitalise, "().getX())).add(Double.valueOf(o.get", entiteVarCapitalise, "().getY())));");
55575557
} else if("Path".equals(entiteNomSimple)) {
55585558
wNgsiMethode.tl(3, "JsonArray pointsArray", entiteVarCapitalise, " = new JsonArray();");
55595559
wNgsiMethode.tl(3, "o.get", entiteVarCapitalise, "().getPoints().stream().map(point -> new JsonArray().add(Double.valueOf(point.getX())).add(Double.valueOf(point.getY()))).collect(Collectors.toList()).forEach(pointArray -> pointsArray", entiteVarCapitalise, ".add(pointArray));");
5560-
wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"LineString\").put(\"coordinates\", pointsArray", entiteVarCapitalise, ").toString();");
5560+
wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"LineString\").put(\"coordinates\", pointsArray", entiteVarCapitalise, ");");
55615561
} else if("Polygon".equals(entiteNomSimple)) {
55625562
wNgsiMethode.tl(3, "JsonArray pointsArray", entiteVarCapitalise, " = new JsonArray();");
55635563
wNgsiMethode.tl(3, "o.get", entiteVarCapitalise, "().getPoints().stream().map(point -> new JsonArray().add(Double.valueOf(point.getX())).add(Double.valueOf(point.getY()))).collect(Collectors.toList()).forEach(pointArray -> pointsArray", entiteVarCapitalise, ".add(pointArray));");
5564-
wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"LineString\").put(\"coordinates\", pointsArray", entiteVarCapitalise, ").toString();");
5564+
wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"LineString\").put(\"coordinates\", pointsArray", entiteVarCapitalise, ");");
55655565
} else {
55665566
wNgsiMethode.tl(3, "return o.get", entiteVarCapitalise, "();");
55675567
}

src/main/java/org/computate/frFR/java/EcrirePageClasse.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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, ");");

src/main/java/org/computate/frFR/java/IndexerClasse.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6384,6 +6384,21 @@ else if("location".equals(fieldName))
63846384
wSmartDataModel.l(" * {@inheritDoc}");
63856385
wSmartDataModel.l(" * DocValues: true");
63866386
wSmartDataModel.l(" * Persist: true");
6387+
wSmartDataModel.l(" * DisplayName: NGSILD context");
6388+
wSmartDataModel.l(" * Description: The NGSILD context URL for @context data");
6389+
wSmartDataModel.l(" * HtmRow: ", row, "");
6390+
wSmartDataModel.l(" * HtmCell: ", cell, "");
6391+
wSmartDataModel.l(" * Facet: true");
6392+
wSmartDataModel.l(" */");
6393+
wSmartDataModel.l(" protected void _ngsildContext(Wrap<String> w) {");
6394+
wSmartDataModel.l(" w.o(", i18nGlobale.getString(I18n.var_requeteSite), "_.getConfig().getString(ComputateConfigKeys.CONTEXT_BROKER_CONTEXT));");
6395+
wSmartDataModel.l(" }");
6396+
cell++;
6397+
wSmartDataModel.l();
6398+
wSmartDataModel.l(" /**");
6399+
wSmartDataModel.l(" * {@inheritDoc}");
6400+
wSmartDataModel.l(" * DocValues: true");
6401+
wSmartDataModel.l(" * Persist: true");
63876402
wSmartDataModel.l(" * DisplayName: NGSILD data");
63886403
wSmartDataModel.l(" * Description: The NGSILD data with @context from the context broker");
63896404
wSmartDataModel.l(" * HtmRow: ", row, "");
@@ -6402,7 +6417,11 @@ else if("location".equals(fieldName))
64026417
wSmartDataModel.l(" * HtmCell: ", cell, "");
64036418
wSmartDataModel.l(" * Facet: true");
64046419
wSmartDataModel.l(" **/");
6405-
wSmartDataModel.l(" protected void _", fieldName, "(Wrap<", javaType, "> w) {}");
6420+
wSmartDataModel.l(" protected void _", fieldName, "(Wrap<", javaType, "> w) {");
6421+
if("location".equals(fieldName)) {
6422+
wSmartDataModel.l(" w.o(staticSetLocation(siteRequest_, siteRequest_.getConfig().getString(ComputateConfigKeys.DEFAULT_MAP_LOCATION)));");
6423+
}
6424+
wSmartDataModel.l(" }");
64066425
}
64076426
cell++;
64086427
// if(cell > 3) {
@@ -6412,21 +6431,6 @@ else if("location".equals(fieldName))
64126431
wSmartDataModel.l();
64136432
}
64146433
}
6415-
6416-
wSmartDataModel.l("");
6417-
wSmartDataModel.l(" /**");
6418-
wSmartDataModel.l(" * @Override");
6419-
wSmartDataModel.l(" * DocValues: true");
6420-
wSmartDataModel.l(" * Persist: true");
6421-
wSmartDataModel.l(" * DisplayName: NGSILD context");
6422-
wSmartDataModel.l(" * escription: The NGSILD context URL for @context data. ");
6423-
wSmartDataModel.l(" * HtmRow: 13");
6424-
wSmartDataModel.l(" * HtmCell: ", cell + 1);
6425-
wSmartDataModel.l(" * Facet: true");
6426-
wSmartDataModel.l(" */");
6427-
wSmartDataModel.l(" protected void _ngsildContext(Wrap<String> w) {");
6428-
wSmartDataModel.l(" w.o(String.format(\"https://raw.githubusercontent.com/%s/%s/main/fiware/context.jsonld\", siteRequest_.getConfig().getString(ComputateConfigKeys.GITHUB_ORG), siteRequest_.getConfig().getString(ComputateConfigKeys.SITE_STATIC_NAME)));");
6429-
wSmartDataModel.l(" }");
64306434
wSmartDataModel.l("}");
64316435

64326436
wSmartDataModel.l();

0 commit comments

Comments
 (0)