diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 29e1ee497a3d34195ba4c4ff9e41a533be713b62..14b50a8c9cda009319fc37de1f64e274e7c383c9 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -19,7 +19,7 @@ sudo -u postgres psql -c "CREATE USER agrometinfo PASSWORD 'agrometinfo'" ``` 2. Create the database `` -createdb agrometinfo --encoding=UTF8 --lc-collate=fr_FR.UTF-8 --lc-ctype=fr_FR.UTF-8 --owner=agrometinfo +sudo -u postgres createdb agrometinfo --encoding=UTF8 --lc-collate=fr_FR.UTF-8 --lc-ctype=fr_FR.UTF-8 --owner=agrometinfo ``` 3. Adjust `pg_hba.conf` if needed 4. Add the password to `~/.pgpass` if wanted @@ -95,7 +95,29 @@ with `~/.m2/settings.xml` with something like: ### In Eclipse -Make sure `target/generated-sources/annotations` is in a folder for *www-shared* in Properties > Java Build Path > Sources. +- Make sure `target/generated-sources/annotations` is in a folder for *www-shared* in Properties > Java Build Path > Sources. +- Create a new server with Tomcat 10.1 and JDK 17. +- Configure `context.xml` for the embedded Tomcat. + +```xml + <Resource + name="jdbc/agrometinfo" + auth="Container" + driverClassName="org.postgresql.Driver" + initialSize="2" + maxTotal="10" + maxIdle="5" + maxWaitMillis="1000" + testOnBorrow="true" + testOnReturn="true" + testWhileIdle="true" + timeBetweenEvictionRunsMillis="5000" + type="javax.sql.DataSource" + url="jdbc:postgresql://127.0.0.1:5432/season?ApplicationName=AgroMetInfo&currentSchema=agrometinfo" + username="agrometinfo" + password="agrometinfo" + validationQuery="select 1" /> +``` If CodeServer fails to launch, use the script diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/ControlSuppliers.java b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/ControlSuppliers.java index 49a28587e279328670dc28d7b38b90af142a7828..ac247ef7dbeeb800e37c49f05d30e25bf52bcd62 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/ControlSuppliers.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/ControlSuppliers.java @@ -7,7 +7,6 @@ import com.google.gwt.dom.client.LinkElement; import fr.agrometinfo.www.client.i18n.MapConstants; import ol.Collection; import ol.Extent; -import ol.control.AttributionOptions; import ol.control.Control; import ol.control.ControlOptions; import ol.control.FullScreen; @@ -36,28 +35,11 @@ public abstract class ControlSuppliers { final Collection<Control> controls = new Collection<>(); controls.insertAt(0, ControlSuppliers.createZoom()); controls.insertAt(0, ControlSuppliers.createInraeLogo()); - controls.insertAt(0, ControlSuppliers.createAttribution()); controls.insertAt(0, ControlSuppliers.createFullScreen()); controls.insertAt(0, ControlSuppliers.createLayerSwitcher()); return controls; } - /** - * To display the attribution in the map. - * - * @return attribution as a Control - */ - public static Control createAttribution() { - final AttributionOptions attributionOptions = new AttributionOptions(); - attributionOptions.setTipLabel(CSTS.mapAttributions()); - attributionOptions.setCollapsed(false); - attributionOptions.setCollapsible(false); - final ol.control.Attribution attributionControl = new ol.control.Attribution(attributionOptions); - final double attributeHeight = 1.5; - attributionControl.getElement().getStyle().setHeight(attributeHeight, com.google.gwt.dom.client.Style.Unit.EM); - return attributionControl; - } - /** * @return internationalized control to toggle full screen */ diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java index fa5a045fef2891753bbe3059d0cf1abfa7f871f6..0645d7a55933e9d4415c0a6f77cc64eb45cf5cc9 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java @@ -156,7 +156,7 @@ public abstract class TileSuppliers { /** * Attributions attribute. */ - private static final String ATTRIBUTIONS = "layer-attributions"; + public static final String ATTRIBUTIONS = "layer-attributions"; /** * I18n constants. diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/view/MapView.java b/www-client/src/main/java/fr/agrometinfo/www/client/view/MapView.java index b06a050d8cdd2d3fbd272e6322cb1cb139639f35..2d320a6eeab0c566ba77ee6f9f5a3bc6d8aa4b7a 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/view/MapView.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/view/MapView.java @@ -16,6 +16,7 @@ import elemental2.dom.HTMLDivElement; import elemental2.dom.HTMLElement; import fr.agrometinfo.www.client.i18n.MapConstants; import fr.agrometinfo.www.client.presenter.MapPresenter; +import fr.agrometinfo.www.client.ui.map.CanvasAttributions; import fr.agrometinfo.www.client.ui.map.ControlSuppliers; import fr.agrometinfo.www.client.ui.map.TileSuppliers; import fr.agrometinfo.www.client.util.ApplicationUtils; @@ -183,7 +184,7 @@ public final class MapView extends HtmlContentBuilder<HTMLElement> implements Ma * @return attributions for map. */ public static String getAttributions() { - return "© INRAE AgroClim - AgroMetInfo - " + ApplicationUtils.getVersion(); + return "© INRAE AgroClim - AgroMetInfo - " + ApplicationUtils.getVersion() + " (etalab-2.0)"; } private static double getValue(final Feature f) { @@ -258,11 +259,11 @@ public final class MapView extends HtmlContentBuilder<HTMLElement> implements Ma return features; } - private ol.source.Vector createVectorSource(final Feature[] colorizedFeatures) { - final VectorOptions vectorSourceOptions = new VectorOptions(); - vectorSourceOptions.setFeatures(colorizedFeatures); - vectorSourceOptions.setAttributions(getAttributions()); - return new ol.source.Vector(vectorSourceOptions); + private VectorOptions createVectorOptions(final Feature[] colorizedFeatures) { + final VectorOptions options = new VectorOptions(); + options.setFeatures(colorizedFeatures); + options.setAttributions(getAttributions()); + return options; } private void createView() { @@ -299,6 +300,8 @@ public final class MapView extends HtmlContentBuilder<HTMLElement> implements Ma addOverlays(options); map = new Map(options); + map.render(); + new CanvasAttributions(map); // add some interactions removeContextMenuRightClick(); @@ -327,8 +330,10 @@ public final class MapView extends HtmlContentBuilder<HTMLElement> implements Ma return; } final Feature[] colorizedFeatures = colorizeFeatures(features); - final ol.source.Vector vectorSource = createVectorSource(colorizedFeatures); + final VectorOptions vectorSourceOptions = createVectorOptions(colorizedFeatures); + final ol.source.Vector vectorSource = new ol.source.Vector(vectorSourceOptions); vectorLayer = createVectorLayer(vectorSource); + vectorLayer.set(TileSuppliers.ATTRIBUTIONS, vectorSourceOptions.getAttributions()); map.addLayer(vectorLayer); map.addControl(ControlSuppliers.createZoomToExtent(vectorSource.getExtent())); view.fit(vectorSource.getExtent());