Skip to content

Commit

Permalink
Fixing points on map
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Feb 7, 2025
1 parent 61ba078 commit e1c091a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/computate/frFR/java/EcrireApiClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -4518,11 +4518,11 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
tl(3, "entityArray.add(entityBody);");
tl(3, "LOG.info(entityArray.encodePrettily());");
tl(3, "webClient.post(");
tl(5, "config.getInteger(ComputateConfigKeys.CONTEXT_BROKER_PORT)");
tl(5, "Integer.parseInt(config.getString(ComputateConfigKeys.CONTEXT_BROKER_PORT))");
tl(5, ", config.getString(ComputateConfigKeys.CONTEXT_BROKER_HOST_NAME)");
tl(5, ", \"/ngsi-ld/v1/entityOperations/upsert/\"");
tl(5, ")");
tl(5, ".ssl(config.getBoolean(ComputateConfigKeys.CONTEXT_BROKER_SSL))");
tl(5, ".ssl(Boolean.parseBoolean(config.getString(ComputateConfigKeys.CONTEXT_BROKER_SSL)))");
tl(5, ".putHeader(\"Content-Type\", \"application/ld+json\")");
tl(5, ".putHeader(\"Fiware-Service\", o.getNgsildTenant())");
tl(5, ".putHeader(\"Fiware-ServicePath\", o.getNgsildPath())");
Expand Down Expand Up @@ -4553,11 +4553,11 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
tl(3, "String link = String.format(\"<%s>; rel=\\\"http://www.w3.org/ns/json-ld#context\\\"; type=\\\"application/ld+json\\\"\", ngsildContext);");
l();
tl(3, "webClient.get(");
tl(5, "config.getInteger(ComputateConfigKeys.CONTEXT_BROKER_PORT)");
tl(5, "Integer.parseInt(config.getString(ComputateConfigKeys.CONTEXT_BROKER_PORT))");
tl(5, ", config.getString(ComputateConfigKeys.CONTEXT_BROKER_HOST_NAME)");
tl(5, ", ngsildUri");
tl(5, ")");
tl(5, ".ssl(config.getBoolean(ComputateConfigKeys.CONTEXT_BROKER_SSL))");
tl(5, ".ssl(Boolean.parseBoolean(config.getString(ComputateConfigKeys.CONTEXT_BROKER_SSL)))");
tl(5, ".putHeader(\"Content-Type\", \"application/ld+json\")");
tl(5, ".putHeader(\"Fiware-Service\", o.getNgsildTenant())");
tl(5, ".putHeader(\"Fiware-ServicePath\", o.getNgsildPath())");
Expand Down Expand Up @@ -4585,11 +4585,11 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
tl(2, "Promise<Void> promise = Promise.promise();");
tl(2, "try {");
tl(3, "webClient.delete(");
tl(5, "config.getInteger(ComputateConfigKeys.CONTEXT_BROKER_PORT)");
tl(5, "Integer.parseInt(config.getString(ComputateConfigKeys.CONTEXT_BROKER_PORT))");
tl(5, ", config.getString(ComputateConfigKeys.CONTEXT_BROKER_HOST_NAME)");
tl(5, ", String.format(\"/ngsi-ld/v1/entities/%s\", urlEncode(o.getId()))");
tl(5, ")");
tl(5, ".ssl(config.getBoolean(ComputateConfigKeys.CONTEXT_BROKER_SSL))");
tl(5, ".ssl(Boolean.parseBoolean(config.getString(ComputateConfigKeys.CONTEXT_BROKER_SSL)))");
tl(5, ".putHeader(\"Content-Type\", \"application/ld+json\")");
tl(5, ".putHeader(\"Fiware-Service\", o.getNgsildTenant())");
tl(5, ".putHeader(\"Fiware-ServicePath\", o.getNgsildPath())");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/computate/frFR/java/EcrireGenClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -4936,7 +4936,7 @@ else if(entiteNomSimple.toString().equals("LocalDate")) {
tl(3, "doc.put(\"", entiteVar, (entiteDocValues ? "_docvalues" : (entiteStocke ? "_indexedstored" : "_indexed")), entiteSuffixeType, "\", DateTimeFormatter.ofPattern(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\").format(", entiteVar, ".atStartOfDay(ZoneId.of(", langueConfig.getString(I18n.var_requeteSite), "_.get", langueConfig.getString(I18n.var_Config), "().getString(", classePartsConfigCles.nomSimple(langueNom), ".", langueConfig.getString(I18n.var_SITE_ZONE), "))).toInstant().atZone(ZoneId.of(\"Z\"))));");
}
else if(entiteNomSimple.toString().equals("Point")) {
tl(3, "doc.put(\"", entiteVar, (entiteDocValues ? "_docvalues" : (entiteStocke ? "_indexedstored" : "_indexed")), entiteSuffixeType, "\", String.format(\"%s,%s\", ", entiteVar, ".getX(), ", entiteVar, ".getY()));");
tl(3, "doc.put(\"", entiteVar, (entiteDocValues ? "_docvalues" : (entiteStocke ? "_indexedstored" : "_indexed")), entiteSuffixeType, "\", String.format(\"%s,%s\", ", entiteVar, ".getY(), ", entiteVar, ".getX()));");
}
else if(entiteNomSimple.toString().equals("Path")) {
tl(3, "JsonArray pointsArray = new JsonArray();");
Expand Down
27 changes: 21 additions & 6 deletions src/main/java/org/computate/frFR/java/EcrirePageClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3761,6 +3761,17 @@ else if(entiteAttribuer) {
auteurPageJs.l();
auteurPageJs.tl(2, "// ", i18nPage.getString(I18n.var_Graphique), " ", i18nPage.getString(I18n.var_Emplacement));
auteurPageJs.tl(2, "window.mapLayers = {};");
if(classeVarEmplacement != null) {
auteurPageJs.tl(2, "window.bounds = null;");
auteurPageJs.tl(2, "if(", i18nPage.getString(I18n.var_liste), classeNomSimple, ".filter(o => o.", classeVarEmplacement, ")) {");
auteurPageJs.tl(3, "window.bounds = L.latLngBounds(", i18nPage.getString(I18n.var_liste), classeNomSimple, ".filter(o => o.", classeVarEmplacement, ").map((c) => {");
auteurPageJs.tl(4, "return [c.", classeVarEmplacement, ".coordinates[1], c.", classeVarEmplacement, ".coordinates[0]];");
auteurPageJs.tl(3, "}));");
auteurPageJs.tl(2, "}");
}
// const bounds = L.latLngBounds(data.geometry.coordinates.map((c) => {
// return [c[1], c[0]];
// }));
auteurPageJs.tl(2, "function onEachFeature(feature, layer) {");
auteurPageJs.tl(3, "let popupContent = ", i18nPage.getString(I18n.var_htmInfobulle), classeNomSimple, "(feature, layer);");
auteurPageJs.tl(3, "layer.bindPopup(popupContent);");
Expand Down Expand Up @@ -3850,12 +3861,16 @@ else if(entiteAttribuer) {
auteurPageJs.tl(4, "attribution: '&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>'");
auteurPageJs.tl(3, "}).addTo(window.map", classeNomSimple, ");");
auteurPageJs.l();
auteurPageJs.tl(3, "if(window['DEFAULT_MAP_LOCATION'] && window['DEFAULT_MAP_ZOOM'])");
auteurPageJs.tl(4, "window.map", classeNomSimple, ".setView([window['DEFAULT_MAP_LOCATION']['coordinates'][1], window['DEFAULT_MAP_LOCATION']['coordinates'][0]], window['DEFAULT_MAP_ZOOM']);");
auteurPageJs.tl(3, "else if(window['DEFAULT_MAP_ZOOM'])");
auteurPageJs.tl(4, "window.map", classeNomSimple, ".setView(null, window['DEFAULT_MAP_ZOOM']);");
auteurPageJs.tl(3, "else if(window['DEFAULT_MAP_LOCATION'])");
auteurPageJs.tl(4, "window.map", classeNomSimple, ".setView([window['DEFAULT_MAP_LOCATION']['coordinates'][1], window['DEFAULT_MAP_LOCATION']['coordinates'][0]]);");
auteurPageJs.tl(3, "if(window.bounds) {");
auteurPageJs.tl(4, "window.map", classeNomSimple, ".fitBounds(window.bounds);");
auteurPageJs.tl(3, "} else {");
auteurPageJs.tl(4, "if(window['DEFAULT_MAP_LOCATION'] && window['DEFAULT_MAP_ZOOM'])");
auteurPageJs.tl(5, "window.map", classeNomSimple, ".setView([window['DEFAULT_MAP_LOCATION']['coordinates'][1], window['DEFAULT_MAP_LOCATION']['coordinates'][0]], window['DEFAULT_MAP_ZOOM']);");
auteurPageJs.tl(4, "else if(window['DEFAULT_MAP_ZOOM'])");
auteurPageJs.tl(5, "window.map", classeNomSimple, ".setView(null, window['DEFAULT_MAP_ZOOM']);");
auteurPageJs.tl(4, "else if(window['DEFAULT_MAP_LOCATION'])");
auteurPageJs.tl(5, "window.map", classeNomSimple, ".setView([window['DEFAULT_MAP_LOCATION']['coordinates'][1], window['DEFAULT_MAP_LOCATION']['coordinates'][0]]);");
auteurPageJs.tl(3, "}");
auteurPageJs.l();
auteurPageJs.tl(3, "layout['margin'] = { r: 0, t: 0, b: 0, l: 0 };");
auteurPageJs.tl(3, "window.geoJSON", classeNomSimple, " = L.geoJSON().addTo(window.map", classeNomSimple, ");");
Expand Down

0 comments on commit e1c091a

Please sign in to comment.