Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: cf138579 by Tony Chemit at 2023-11-21T13:15:38+01:00 fix how to make line (on ll we have no text, and for ps we have points always with text (but text can also be null)) - - - - - 998e6449 by Tony Chemit at 2023-11-21T13:17:02+01:00 adapt ps logbook lines (use the same layer to display day and night points (but night ones have no text) - - - - - f5d24778 by Tony Chemit at 2023-11-21T13:43:49+01:00 Merge branch 'feature/issue-2756' into develop La distinction jour/nuit sur la carte est peu pertinente pour les données logbook - See #2756 - - - - - 8 changed files: - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/map/TripMapContentBuilderSupport.java - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripMapContentBuilder.java - client/datasource/editor/ps/src/main/i18n/getters/java.getter - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripMapContentBuilder.java - client/datasource/editor/ps/src/main/resources/map/ps-style.xml - client/runner/src/main/i18n/translations/client-runner_en_GB.properties - client/runner/src/main/i18n/translations/client-runner_es_ES.properties - client/runner/src/main/i18n/translations/client-runner_fr_FR.properties Changes: ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/map/TripMapContentBuilderSupport.java ===================================== @@ -331,12 +331,17 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil return DATE_FORMAT.format(date); } + protected void addLine(DefaultFeatureCollection linesFeatures, String lineName, Coordinate[] coordinates) { + LineString line = getGeometryFactory().createLineString(coordinates); + lineBuilder.add(line); + lineBuilder.add(lineName); + linesFeatures.add(lineBuilder.buildFeature(null)); + } + protected void addLine(DefaultFeatureCollection linesFeatures, String lineName, Coordinate[] coordinates, Date date) { LineString line = getGeometryFactory().createLineString(coordinates); lineBuilder.add(line); - if (date != null) { - lineBuilder.add(formatDate(date)); - } + lineBuilder.add(date == null ? null : formatDate(date)); lineBuilder.add(lineName); linesFeatures.add(lineBuilder.buildFeature(null)); } ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripMapContentBuilder.java ===================================== @@ -159,7 +159,7 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport { if (!lines.isEmpty()) { lineTypes.add(lineType); for (Coordinate[] tripLine : lines) { - addLine(linesFeatures, lineType, tripLine, null); + addLine(linesFeatures, lineType, tripLine); } } } ===================================== client/datasource/editor/ps/src/main/i18n/getters/java.getter ===================================== @@ -45,8 +45,7 @@ observe.ui.action.copyFloatingObjectPartToRight.tip observe.ui.choice.cancel observe.ui.choice.dcp.default observe.ui.choice.save -observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays -observe.ui.datasource.editor.content.map.legend.logbook.tripDay +observe.ui.datasource.editor.content.map.legend.logbook.tripSegment observe.ui.datasource.editor.content.map.legend.obs.tripBetweenTwoDays observe.ui.datasource.editor.content.map.legend.obs.tripDay observe.ui.datasource.editor.content.map.logbook.points.not.valid ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripMapContentBuilder.java ===================================== @@ -109,15 +109,19 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit public void addLines(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) { if (tripMapConfig.isAddObservations()) { addLines0(tripMapPoints.stream().filter(f -> f.getType().isTrip() || f.getType().isObs()).collect(Collectors.toList()), - "observation", + "observationDay", + "observationNight", + true, t("observe.ui.datasource.editor.content.map.legend.obs.tripDay"), t("observe.ui.datasource.editor.content.map.legend.obs.tripBetweenTwoDays")); } if (tripMapConfig.isAddLogbook()) { addLines0(tripMapPoints.stream().filter(f -> f.getType().isTrip() || f.getType().isLogbook()).collect(Collectors.toList()), - "logbook", - t("observe.ui.datasource.editor.content.map.legend.logbook.tripDay"), - t("observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays")); + "logbookSegment", + "logbookSegment", + false, + t("observe.ui.datasource.editor.content.map.legend.logbook.tripSegment"), + null); } } @@ -128,14 +132,12 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit } } - protected void addTripBetweenTwoDay(DefaultFeatureCollection linesFeatures, String label, TripMapPoint previousPoint, TripMapPoint point) { + protected void addTripBetweenTwoDay(DefaultFeatureCollection linesFeatures, String label, TripMapPoint previousPoint, TripMapPoint point, boolean addTime) { Coordinate[] coordinates = create(previousPoint, point); - addLine(linesFeatures, label, coordinates, previousPoint.getTime()); + addLine(linesFeatures, label, coordinates, addTime ? previousPoint.getTime() : null); } - protected void addLines0(List<TripMapPoint> tripMapPoints, String prefix, String pointDayLabel, String pointNightLabel) { - String pointDay = prefix + "Day"; - String pointNight = prefix + "Night"; + protected void addLines0(List<TripMapPoint> tripMapPoints, String pointDay, String pointNight, boolean addDate, String pointDayLabel, String pointNightLabel) { if (tripMapPoints.size() == 2 && tripMapPoints.stream().allMatch(t -> t.getType().isTrip())) { // Got only trip points, nothing to display then return; @@ -152,7 +154,7 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit if (previousPoint != null && !DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) { // changing day addTripDay(linesFeatures, pointDay, coordinatesByDay, previousPoint); - addTripBetweenTwoDay(linesFeatures, pointNight, previousPoint, point); + addTripBetweenTwoDay(linesFeatures, pointNight, previousPoint, point, addDate); coordinatesByDay.clear(); } coordinatesByDay.add(coordinate); @@ -167,6 +169,9 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit mapContent.addLayer(layerLines); } addLineLegend(styleLines, pointDay, pointDayLabel); - addLineLegend(styleLines, pointNight, pointNightLabel); + if (pointNightLabel != null) { + addLineLegend(styleLines, pointNight, pointNightLabel); + } } -} + +} \ No newline at end of file ===================================== client/datasource/editor/ps/src/main/resources/map/ps-style.xml ===================================== @@ -84,13 +84,14 @@ <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>type</ogc:PropertyName> - <ogc:Literal>logbookDay</ogc:Literal> + <ogc:Literal>logbookSegment</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <LineSymbolizer> <Stroke> <CssParameter name="stroke">${mapPsStyleLogbookLineColor}</CssParameter> <CssParameter name="stroke-width">2</CssParameter> + <CssParameter name="stroke-dasharray">6 4</CssParameter> </Stroke> </LineSymbolizer> <TextSymbolizer> @@ -113,23 +114,6 @@ </TextSymbolizer> </Rule> </FeatureTypeStyle> - <FeatureTypeStyle> - <Rule> - <ogc:Filter> - <ogc:PropertyIsEqualTo> - <ogc:PropertyName>type</ogc:PropertyName> - <ogc:Literal>logbookNight</ogc:Literal> - </ogc:PropertyIsEqualTo> - </ogc:Filter> - <LineSymbolizer> - <Stroke> - <CssParameter name="stroke">${mapPsStyleLogbookLineColor}</CssParameter> - <CssParameter name="stroke-width">2</CssParameter> - <CssParameter name="stroke-dasharray">6 4</CssParameter> - </Stroke> - </LineSymbolizer> - </Rule> - </FeatureTypeStyle> </UserStyle> </NamedLayer> ===================================== client/runner/src/main/i18n/translations/client-runner_en_GB.properties ===================================== @@ -712,8 +712,7 @@ observe.ui.datasource.editor.content.map.legend=Legend observe.ui.datasource.editor.content.map.legend.logbook.hauling=Logbook - Hauling observe.ui.datasource.editor.content.map.legend.logbook.setting=Logbook - Setting observe.ui.datasource.editor.content.map.legend.logbook.trip=Logbook - Route -observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays=Night trip -observe.ui.datasource.editor.content.map.legend.logbook.tripDay=Logbook - Day trip +observe.ui.datasource.editor.content.map.legend.logbook.tripSegment=Logbook - Segment observe.ui.datasource.editor.content.map.legend.not.valid.count=( %d points are not displayed ) observe.ui.datasource.editor.content.map.legend.obs.hauling=Observation - Hauling observe.ui.datasource.editor.content.map.legend.obs.setting=Observation - Setting ===================================== client/runner/src/main/i18n/translations/client-runner_es_ES.properties ===================================== @@ -712,8 +712,7 @@ observe.ui.datasource.editor.content.map.legend=Legend \#TODO observe.ui.datasource.editor.content.map.legend.logbook.hauling=Logbook - Arrastre observe.ui.datasource.editor.content.map.legend.logbook.setting=Logbook - Calada observe.ui.datasource.editor.content.map.legend.logbook.trip=Logbook - Trayecto -observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays=Logbook - Trayecto del noche -observe.ui.datasource.editor.content.map.legend.logbook.tripDay=Logbook - Trayecto del día +observe.ui.datasource.editor.content.map.legend.logbook.tripSegment=Logbook - Trayecto observe.ui.datasource.editor.content.map.legend.not.valid.count=( %d points are not displayed ) observe.ui.datasource.editor.content.map.legend.obs.hauling=Observation - Arrastre observe.ui.datasource.editor.content.map.legend.obs.setting=Observation - Calada ===================================== client/runner/src/main/i18n/translations/client-runner_fr_FR.properties ===================================== @@ -712,8 +712,7 @@ observe.ui.datasource.editor.content.map.legend=Légende observe.ui.datasource.editor.content.map.legend.logbook.hauling=Livre de bord - Virage observe.ui.datasource.editor.content.map.legend.logbook.setting=Livre de bord - Filage observe.ui.datasource.editor.content.map.legend.logbook.trip=Livre de bord - Trajet -observe.ui.datasource.editor.content.map.legend.logbook.tripBetweenTwoDays=Livre de bord - Trajet de nuit -observe.ui.datasource.editor.content.map.legend.logbook.tripDay=Livre de bord - Trajet de jour +observe.ui.datasource.editor.content.map.legend.logbook.tripSegment=Livre de bord - Trajet observe.ui.datasource.editor.content.map.legend.not.valid.count=( dont %d points non affichés ) observe.ui.datasource.editor.content.map.legend.obs.hauling=Observation - Virage observe.ui.datasource.editor.content.map.legend.obs.setting=Observation - Filage View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8416c2555343dfcd9429d2c03... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8416c2555343dfcd9429d2c03... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)