Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: ff0569e3 by Tony CHEMIT at 2018-09-16T20:43:55Z update changelog - - - - - 5048b896 by Tony CHEMIT at 2018-09-16T20:43:59Z add apache doc - - - - - 698d4026 by Tony CHEMIT at 2018-09-16T20:43:59Z Visualisation des données du livre de bord sur la carte - Closes #902 - - - - - 30 changed files: - .mvn/gitlab-cache/milestones/532584-issues.json - + .mvn/gitlab-cache/milestones/644883-artifacts.json - .mvn/gitlab-cache/milestones/644883-issues.json - .mvn/gitlab-cache/milestones/644883.json - + .mvn/gitlab-cache/milestones/647608-issues.json - + .mvn/gitlab-cache/milestones/647608.json - CHANGELOG.md - client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java - client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TripLonglineUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUIHandler.java - client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapContentBuilder.java - client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUI.jaxx - client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUI.jcss - client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUIHandler.java - client/src/main/map/style.xml - client/src/main/resources/i18n/client_en_GB.properties - client/src/main/resources/i18n/client_es_ES.properties - client/src/main/resources/i18n/client_fr_FR.properties - dto/pom.xml - + dto/src/main/java/fr/ird/observe/dto/data/TripMapPoint.java - + dto/src/main/java/fr/ird/observe/dto/data/TripMapPointType.java - dto/src/main/resources/i18n/dto_en_GB.properties - dto/src/main/resources/i18n/dto_es_ES.properties - dto/src/main/resources/i18n/dto_fr_FR.properties - persistence/src/main/java/fr/ird/observe/entities/longline/SampleLogbooks.java - persistence/src/main/java/fr/ird/observe/entities/longline/TripLonglineTopiaDao.java - pom.xml - services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/TripLonglineServiceLocal.java - services/src/main/java/fr/ird/observe/services/service/data/longline/TripLonglineService.java - src/site/markdown/administration-web.md.vm Changes: ===================================== .mvn/gitlab-cache/milestones/532584-issues.json ===================================== @@ -392,5 +392,54 @@ "state": "closed", "updatedAt": "Sep 15, 2018 1:54:06 PM", "createdAt": "Mar 27, 2018 1:11:48 PM" + }, + { + "id": 9960494, + "iid": 902, + "projectId": 2722779, + "title": "Visualisation des données du livre de bord sur la carte", + "description": "En LL, La carte trace actuellement les coups de pêche de la marée d’observation. \n\nOn y ajoutera 2 cases à cocher permettant de choisir quelles données afficher :\n * Données d’observation\n * Données du logbook\n\nLa superposition des 2 traces sera donc possible.\n\nChaque case sera grisée si l’information n’est pas disponible.\n\nLa carte LL actuelle montre les aires de pêche, pas la trace du bateau.", + "labels": [ + "Evolution", + "IRD-2018-01-V8" + ], + "milestone": { + "id": 532584, + "iid": 114, + "projectId": 2722779, + "groupId": 0, + "title": "8.0-alpha-3", + "description": "Première partie du troisième lot du contrat IRD-2018-01-V8.\r\ncontient les nouveaux écrans, mais aucune des fonctionnalités avancées.", + "dueDate": "Sep 15, 2018 2:00:00 AM", + "startDate": "May 24, 2018 2:00:00 AM", + "state": "closed" + }, + "assignee": { + "_id": 166231, + "_username": "tchemit", + "_name": "Tony CHEMIT", + "_state": "active", + "_darkScheme": false, + "_isAdmin": false, + "_canCreateGroup": false, + "_canCreateProject": false, + "_canCreateTeam": false, + "_avatarUrl": "https://secure.gravatar.com/avatar/2a915aa9a1df35c8b609ff2f750d5dac?s\u003d80\u0026d\u003didenticon" + }, + "author": { + "_id": 166231, + "_username": "tchemit", + "_name": "Tony CHEMIT", + "_state": "active", + "_darkScheme": false, + "_isAdmin": false, + "_canCreateGroup": false, + "_canCreateProject": false, + "_canCreateTeam": false, + "_avatarUrl": "https://secure.gravatar.com/avatar/2a915aa9a1df35c8b609ff2f750d5dac?s\u003d80\u0026d\u003didenticon" + }, + "state": "opened", + "updatedAt": "Sep 16, 2018 10:19:42 PM", + "createdAt": "Mar 27, 2018 12:31:34 PM" } ] \ No newline at end of file ===================================== .mvn/gitlab-cache/milestones/644883-artifacts.json ===================================== @@ -0,0 +1,12 @@ +[ + { + "name": "Application", + "filename": "observe-7.0-RC-19.zip", + "url": "https://ultreia.io/release/observe-7.0-RC-19.zip" + }, + { + "name": "Serveur", + "filename": "observe-7.0-RC-19.war", + "url": "https://ultreia.io/release/observe-7.0-RC-19.war" + } +] \ No newline at end of file ===================================== .mvn/gitlab-cache/milestones/644883-issues.json ===================================== @@ -1 +1,52 @@ -[] \ No newline at end of file +[ + { + "id": 13673624, + "iid": 1038, + "projectId": 2722779, + "title": "[PS] Ajout de racourcis clavier sur le formulaire des systèmes observés", + "description": "Idéalement, on nous demande des racourcis clavier supplémentaires sur les flêches \u003c- et -\u003e du formaulaire PS systèmes observés :\n\n\n\nEffectivement cela pourrait pas mal fluidifier l\u0027ajout d\u0027éléments.", + "labels": [ + "Bas", + "Contrat Code Lutin-2016", + "Evolution" + ], + "milestone": { + "id": 644883, + "iid": 122, + "projectId": 2722779, + "groupId": 0, + "title": "7.0-RC-19", + "description": "", + "dueDate": "Sep 16, 2018 2:00:00 AM", + "startDate": "Sep 14, 2018 2:00:00 AM", + "state": "closed" + }, + "assignee": { + "_id": 166231, + "_username": "tchemit", + "_name": "Tony CHEMIT", + "_state": "active", + "_darkScheme": false, + "_isAdmin": false, + "_canCreateGroup": false, + "_canCreateProject": false, + "_canCreateTeam": false, + "_avatarUrl": "https://secure.gravatar.com/avatar/2a915aa9a1df35c8b609ff2f750d5dac?s\u003d80\u0026d\u003didenticon" + }, + "author": { + "_id": 1111318, + "_username": "pcauquil", + "_name": "Pascal Cauquil", + "_state": "active", + "_darkScheme": false, + "_isAdmin": false, + "_canCreateGroup": false, + "_canCreateProject": false, + "_canCreateTeam": false, + "_avatarUrl": "https://secure.gravatar.com/avatar/b4ae117bd93e10d96298fa4d885208ea?s\u003d80\u0026d\u003didenticon" + }, + "state": "closed", + "updatedAt": "Sep 16, 2018 5:10:02 PM", + "createdAt": "Aug 24, 2018 12:25:25 PM" + } +] \ No newline at end of file ===================================== .mvn/gitlab-cache/milestones/644883.json ===================================== @@ -4,5 +4,8 @@ "projectId": 2722779, "groupId": 0, "title": "7.0-RC-19", - "state": "active" + "description": "", + "dueDate": "Sep 16, 2018 2:00:00 AM", + "startDate": "Sep 14, 2018 2:00:00 AM", + "state": "closed" } \ No newline at end of file ===================================== .mvn/gitlab-cache/milestones/647608-issues.json ===================================== @@ -0,0 +1 @@ +[] \ No newline at end of file ===================================== .mvn/gitlab-cache/milestones/647608.json ===================================== @@ -0,0 +1,8 @@ +{ + "id": 647608, + "iid": 123, + "projectId": 2722779, + "groupId": 0, + "title": "7.0-RC-20", + "state": "active" +} \ No newline at end of file ===================================== CHANGELOG.md ===================================== @@ -1,7 +1,7 @@ # ObServe changelog * Author [Tony Chemit](mailto:dev@tchemit.fr) - * Last generated at 2018-09-15 13:57. + * Last generated at 2018-09-16 22:22. ## Version [8.0-alpha-3](https://gitlab.com/ultreiaio/ird-observe/milestones/114) Première partie du troisième lot du contrat IRD-2018-01-V8. contient les nouveaux écrans, mais aucune des fonctionnalités avancées. @@ -14,6 +14,7 @@ Première partie du troisième lot du contrat IRD-2018-01-V8. contient ### Issues * [[Evolution 578]](https://gitlab.com/ultreiaio/ird-observe/issues/578) **[LL] Implanter le formulaire logbook** (Thanks to Tony CHEMIT) (Reported by Tony CHEMIT) + * [[Evolution 902]](https://gitlab.com/ultreiaio/ird-observe/issues/902) **Visualisation des données du livre de bord sur la carte** (Thanks to Tony CHEMIT) (Reported by Tony CHEMIT) * [[Evolution 905]](https://gitlab.com/ultreiaio/ird-observe/issues/905) **Adaptation de l'arbre de navigation** (Thanks to Tony CHEMIT) (Reported by Tony CHEMIT) * [[Evolution 907]](https://gitlab.com/ultreiaio/ird-observe/issues/907) **Ajout de la donnée observe_longline.ActivityLogbook** (Thanks to Tony CHEMIT) (Reported by Tony CHEMIT) * [[Evolution 909]](https://gitlab.com/ultreiaio/ird-observe/issues/909) **Ajout de la donnée observe_longline.SetLogbook** (Thanks to Tony CHEMIT) (Reported by Tony CHEMIT) @@ -67,6 +68,17 @@ Premier lot du contrat IRD-2018-01-V8 * [[Evolution 922]](https://gitlab.com/ultreiaio/ird-observe/issues/922) **Ajoute le référentiel observe_common.DataQuality sur les données existantes** (Thanks to Tony CHEMIT) (Reported by Tony CHEMIT) * [[Evolution 950]](https://gitlab.com/ultreiaio/ird-observe/issues/950) **Renommage de la classe seine.WeightCategory en seine.WeightCategorySeine** (Thanks to Tony CHEMIT) (Reported by Tony CHEMIT) +## Version [7.0-RC-19](https://gitlab.com/ultreiaio/ird-observe/milestones/122) + +**Closed at 2018-09-16.** + +### Download +* [Application (observe-7.0-RC-19.zip)](https://ultreia.io/release/observe-7.0-RC-19.zip) +* [Serveur (observe-7.0-RC-19.war)](https://ultreia.io/release/observe-7.0-RC-19.war) + +### Issues + * [[Evolution 1038]](https://gitlab.com/ultreiaio/ird-observe/issues/1038) **[PS] Ajout de racourcis clavier sur le formulaire des systèmes observés** (Thanks to Tony CHEMIT) (Reported by Pascal Cauquil) + ## Version [7.0-RC-18](https://gitlab.com/ultreiaio/ird-observe/milestones/121) **Closed at 2018-09-12.** ===================================== client/src/main/java/fr/ird/observe/client/ui/ObserveKeyStrokes.java ===================================== @@ -64,6 +64,8 @@ public abstract class ObserveKeyStrokes { public static final KeyStroke KEY_STROKE_NAVIGATION_CONFIGURE = KeyStroke.getKeyStroke("ctrl pressed F1"); public static final KeyStroke KEY_STROKE_SHOW_SEINE = KeyStroke.getKeyStroke("ctrl pressed F2"); public static final KeyStroke KEY_STROKE_SHOW_LONGLINE = KeyStroke.getKeyStroke("ctrl pressed F3"); + public static final KeyStroke KEY_STROKE_SHOW_LONGLINE_OBS = KeyStroke.getKeyStroke("ctrl pressed F2"); + public static final KeyStroke KEY_STROKE_SHOW_LONGLINE_LOGBOOK = KeyStroke.getKeyStroke("ctrl pressed F3"); public static final KeyStroke KEY_STROKE_SHOW_REFERENTIAL = KeyStroke.getKeyStroke("ctrl pressed F4"); public static final KeyStroke KEY_STROKE_SHOW_EMPTY_PROGRAM = KeyStroke.getKeyStroke("ctrl pressed F5"); public static final KeyStroke KEY_STROKE_CONFIGURE_LOCAL_SOURCE = KeyStroke.getKeyStroke("ctrl pressed L"); ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/longline/TripLonglineUIHandler.java ===================================== @@ -119,7 +119,8 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr tripMap.getHandler().setConfig(config); tripMap.getHandler().init(ui.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)); - + tripMap.addPropertyChangeListener(TripMapUI.PROPERTY_SHOW_OBSERVATION, e -> updateMapModel()); + tripMap.addPropertyChangeListener(TripMapUI.PROPERTY_SHOW_LOGBOOK, e -> updateMapModel()); getUi().getMainTabbedPane().addChangeListener(e -> { JTabbedPane tripLonglineTabPane = (JTabbedPane) e.getSource(); TripLonglineUI ui1 = getUi(); @@ -128,17 +129,7 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr ui1.getActions().setVisible(false); if (buildTripMap) { - SwingUtilities.invokeLater(() -> { - ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true); - try { - TripLonglineUI ui11 = getUi(); - TripMapUI tripMap11 = ui11.getTripMap(); - TripMapDto tripLonglineMap = getTripLonglineService().getTripLonglineMap(getSelectedId()); - tripMap11.getHandler().doOpenMap(tripLonglineMap); - } finally { - ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false); - } - }); + buildTripMap(); buildTripMap = false; } @@ -156,6 +147,28 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr ui.getErrorTableModel().addTableModelListener(computeTabValidStateListener); } + private void buildTripMap() { + SwingUtilities.invokeLater(() -> { + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(true); + try { + TripLonglineUI ui11 = getUi(); + TripMapUI tripMap11 = ui11.getTripMap(); + Boolean showObservation = tripMap11.isShowObservation(); + Boolean showLogbook = tripMap11.isShowLogbook(); + log.info(String.format("Ask to build map: show observation? %s, show logbook? %s", showObservation, showLogbook)); + TripMapDto tripLonglineMap = getTripLonglineService().getTripLonglineMap(getSelectedId(), showObservation, showLogbook); + tripMap11.getHandler().doOpenMap(tripLonglineMap); + } finally { + ObserveSwingApplicationContext.get().getMainUI().getModel().setBusy(false); + } + }); + } + + private void updateMapModel() { + ui.getTripMap().getHandler().doCloseMap(); + buildTripMap(); + } + @Override public void openUI() { super.openUI(); @@ -260,7 +273,6 @@ class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLonglineDto, Tr @Override protected int getOpenablePosition(String parentId, TripLonglineDto bean) { - return getTripLonglineService().getTripLonglinePositionInProgram(parentId, bean.getId()); } ===================================== client/src/main/java/fr/ird/observe/client/ui/content/data/seine/TripSeineUIHandler.java ===================================== @@ -89,6 +89,8 @@ class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeineDto, TripSein super.afterInit(ui); TripMapUI tripMap = ui.getTripMap(); + tripMap.getConfig().setVisible(false); + SwingUtilities.invokeLater(tripMap::validate); ClientConfig config = ObserveSwingApplicationContext.get().getConfig(); tripMap.getHandler().setConfig(config); ===================================== client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapContentBuilder.java ===================================== @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.util.tripMap; * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. @@ -77,10 +77,12 @@ import static org.nuiton.i18n.I18n.t; public class TripMapContentBuilder { public static final String TRIP_LINES_LAYER_NAME = "Trip lines"; - public static final String TRIP_LONGLINE_FISHING_ZONE_LAYER_NAME = "Trip longline zone"; - public static final String TRIP_LONGLINE_LINE_LAYER_NAME = "Trip longline line"; + public static final String TRIP_LONGLINE_OBS_FISHING_ZONE_LAYER_NAME = "Trip longline obs zone"; + public static final String TRIP_LONGLINE_OBS_LINE_LAYER_NAME = "Trip longline obs line"; + public static final String TRIP_LONGLINE_LOGBOOK_FISHING_ZONE_LAYER_NAME = "Trip longline logbook zone"; + public static final String TRIP_LONGLINE_LOGBOOK_LINE_LAYER_NAME = "Trip longline logbook line"; public static final String TRIP_POINTS_LAYER_NAME = "Trip points"; - + public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM"); protected static final Set<TripMapPointType> TRIP_MAP_POINT_TYPES_IN_LEGEND = ImmutableSet.of( TripMapPointType.seineActivityInHarbour, TripMapPointType.seineActivityWithFreeSchoolType, @@ -91,13 +93,18 @@ public class TripMapContentBuilder { TripMapPointType.longlineActivityObsWithHaulingStart, TripMapPointType.longlineActivityObsWithHaulingEnd, TripMapPointType.longlineActivityObsWithStation, - TripMapPointType.longlineActivityObsWithInteraction); - - public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM"); - - protected StyledLayerDescriptor styledLayerDescriptor; + TripMapPointType.longlineActivityObsWithInteraction, + TripMapPointType.longlineActivityLogbookInHarbour, + TripMapPointType.longlineActivityLogbookWithSettingStart, + TripMapPointType.longlineActivityLogbookWithSettingEnd, + TripMapPointType.longlineActivityLogbookWithHaulingStart, + TripMapPointType.longlineActivityLogbookWithHaulingEnd, + TripMapPointType.longlineActivityLogbookWithStation, + TripMapPointType.longlineActivityLogbookWithInteraction + ); protected final MapContent mapContent; protected final List<ObserveMapPaneLegendItem> legendItems; + protected StyledLayerDescriptor styledLayerDescriptor; public TripMapContentBuilder() { mapContent = new MapContent(); @@ -224,7 +231,7 @@ public class TripMapContentBuilder { } - public void addLonglineFishingZone(List<TripMapPoint> tripMapPoints) throws FactoryException { + public void addLonglineObsFishingZone(List<TripMapPoint> tripMapPoints) throws FactoryException { GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); SimpleFeatureTypeBuilder polygonFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); @@ -266,13 +273,61 @@ public class TripMapContentBuilder { } if (!polygonsFeatures.isEmpty()) { - Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_FISHING_ZONE_LAYER_NAME, null); - Layer layerLines = new FeatureLayer(polygonsFeatures, styleLines, TRIP_LONGLINE_FISHING_ZONE_LAYER_NAME); + Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_OBS_FISHING_ZONE_LAYER_NAME, null); + Layer layerLines = new FeatureLayer(polygonsFeatures, styleLines, TRIP_LONGLINE_OBS_FISHING_ZONE_LAYER_NAME); + mapContent.addLayer(layerLines); + } + } + + public void addLonglineLogbookFishingZone(List<TripMapPoint> tripMapPoints) throws FactoryException { + GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); + + SimpleFeatureTypeBuilder polygonFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); + polygonFeatureTypeBuilder.setName("longlineFishingZoneBuilder"); + polygonFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); + polygonFeatureTypeBuilder.add("zone", Polygon.class); + polygonFeatureTypeBuilder.add("label", String.class); + polygonFeatureTypeBuilder.add("type", String.class); + + SimpleFeatureType polygonFeatureType = polygonFeatureTypeBuilder.buildFeatureType(); + SimpleFeatureBuilder polygonBuilder = new SimpleFeatureBuilder(polygonFeatureType); + + DefaultFeatureCollection polygonsFeatures = new DefaultFeatureCollection(); + + for (int indexPoint = 3; indexPoint < tripMapPoints.size(); indexPoint++) { + if (tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityLogbookWithHaulingEnd) + && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.longlineActivityLogbookWithHaulingStart) + && tripMapPoints.get(indexPoint - 2).getType().equals(TripMapPointType.longlineActivityLogbookWithSettingEnd) + && tripMapPoints.get(indexPoint - 3).getType().equals(TripMapPointType.longlineActivityLogbookWithSettingStart)) { + + Coordinate[] coordinates = { + new Coordinate(tripMapPoints.get(indexPoint - 3).getLongitude(), tripMapPoints.get(indexPoint - 3).getLatitude()), + new Coordinate(tripMapPoints.get(indexPoint - 2).getLongitude(), tripMapPoints.get(indexPoint - 2).getLatitude()), + new Coordinate(tripMapPoints.get(indexPoint - 1).getLongitude(), tripMapPoints.get(indexPoint - 1).getLatitude()), + new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()), + new Coordinate(tripMapPoints.get(indexPoint - 3).getLongitude(), tripMapPoints.get(indexPoint - 3).getLatitude()) + }; + + + Polygon polygon = geometryFactory.createPolygon(coordinates); + //polygon = (Polygon) polygon.convexHull(); // permet de transformer un poliqgone croisé en polygon convex + polygonBuilder.add(polygon); + polygonBuilder.add(DATE_FORMAT.format(tripMapPoints.get(indexPoint - 3).getTime())); + polygonBuilder.add("longlineFishingZone"); + SimpleFeature feature = polygonBuilder.buildFeature(null); + polygonsFeatures.add(feature); + + } + } + + if (!polygonsFeatures.isEmpty()) { + Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_LOGBOOK_FISHING_ZONE_LAYER_NAME, null); + Layer layerLines = new FeatureLayer(polygonsFeatures, styleLines, TRIP_LONGLINE_LOGBOOK_FISHING_ZONE_LAYER_NAME); mapContent.addLayer(layerLines); } } - public void addLonglineLine(List<TripMapPoint> tripMapPoints) throws FactoryException { + public void addLonglineObsLine(List<TripMapPoint> tripMapPoints) throws FactoryException { GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); @@ -287,13 +342,14 @@ public class TripMapContentBuilder { DefaultFeatureCollection linesFeatures = new DefaultFeatureCollection(); List<Coordinate> defaultLineCoordinates = Lists.newLinkedList(); - + boolean found = false; for (int indexPoint = 0; indexPoint < tripMapPoints.size(); indexPoint++) { if (indexPoint > 1 && tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityObsWithSettingEnd) && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.longlineActivityObsWithSettingStart) || tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityObsWithHaulingEnd) && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.longlineActivityObsWithHaulingStart)) { + found = true; Coordinate[] coordinates = { new Coordinate(tripMapPoints.get(indexPoint - 1).getLongitude(), tripMapPoints.get(indexPoint - 1).getLatitude()), new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()), @@ -332,34 +388,124 @@ public class TripMapContentBuilder { } - Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_LINE_LAYER_NAME, null); + Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_OBS_LINE_LAYER_NAME, null); if (!linesFeatures.isEmpty()) { - Layer layerLines = new FeatureLayer(linesFeatures, styleLines, TRIP_LONGLINE_LINE_LAYER_NAME); + Layer layerLines = new FeatureLayer(linesFeatures, styleLines, TRIP_LONGLINE_OBS_LINE_LAYER_NAME); mapContent.addLayer(layerLines); } - // add line in legend - LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); - lineBuilder.add(line); - lineBuilder.add("setting"); + if (found) { + // add line in legend + LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); + lineBuilder.add(line); + lineBuilder.add("setting"); - ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem( - lineBuilder.buildFeature(null), - styleLines, - t("observe.content.map.legend.setting")); - legendItems.add(legendTripDay); + ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem( + lineBuilder.buildFeature(null), + styleLines, + t("observe.content.map.legend.obs.setting")); + legendItems.add(legendTripDay); - line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); - lineBuilder.add(line); - lineBuilder.add("hauling"); + line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); + lineBuilder.add(line); + lineBuilder.add("hauling"); - legendTripDay = new ObserveMapPaneLegendItem( - lineBuilder.buildFeature(null), - styleLines, - t("observe.content.map.legend.hauling")); - legendItems.add(legendTripDay); + legendTripDay = new ObserveMapPaneLegendItem( + lineBuilder.buildFeature(null), + styleLines, + t("observe.content.map.legend.obs.hauling")); + legendItems.add(legendTripDay); + } + + } + + public void addLonglineLogbookLine(List<TripMapPoint> tripMapPoints) throws FactoryException { + GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); + + SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); + lineFeatureTypeBuilder.setName("longlineSettingBuilder"); + lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); + lineFeatureTypeBuilder.add("line", LineString.class); + lineFeatureTypeBuilder.add("type", String.class); + + SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType(); + SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType); + + DefaultFeatureCollection linesFeatures = new DefaultFeatureCollection(); + + List<Coordinate> defaultLineCoordinates = Lists.newLinkedList(); + boolean found = false; + for (int indexPoint = 0; indexPoint < tripMapPoints.size(); indexPoint++) { + if (indexPoint > 1 && tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityLogbookWithSettingEnd) + && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.longlineActivityLogbookWithSettingStart) + || tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityLogbookWithHaulingEnd) + && tripMapPoints.get(indexPoint - 1).getType().equals(TripMapPointType.longlineActivityLogbookWithHaulingStart)) { + found = true; + Coordinate[] coordinates = { + new Coordinate(tripMapPoints.get(indexPoint - 1).getLongitude(), tripMapPoints.get(indexPoint - 1).getLatitude()), + new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude()), + }; + + boolean setting = tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityLogbookWithSettingEnd); + LineString lineString = geometryFactory.createLineString(coordinates); + lineBuilder.add(lineString); + lineBuilder.add(setting ? "setting" : "hauling"); + SimpleFeature feature = lineBuilder.buildFeature(null); + linesFeatures.add(feature); + + defaultLineCoordinates.clear(); + } + + if (!(tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityLogbookWithSettingEnd) + || tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityLogbookWithHaulingStart))) { + + defaultLineCoordinates.add(new Coordinate(tripMapPoints.get(indexPoint).getLongitude(), tripMapPoints.get(indexPoint).getLatitude())); + + } + + if ((tripMapPoints.get(indexPoint).getType().equals(TripMapPointType.longlineActivityLogbookWithSettingStart) + || indexPoint == tripMapPoints.size() - 1) && defaultLineCoordinates.size() > 1) { + + LineString lineString = geometryFactory.createLineString(defaultLineCoordinates.toArray(new Coordinate[0])); + lineBuilder.add(lineString); + lineBuilder.add("trip"); + SimpleFeature feature = lineBuilder.buildFeature(null); + linesFeatures.add(feature); + + defaultLineCoordinates.clear(); + + } + } + if (found) { + Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_LOGBOOK_LINE_LAYER_NAME, null); + if (!linesFeatures.isEmpty()) { + Layer layerLines = new FeatureLayer(linesFeatures, styleLines, TRIP_LONGLINE_LOGBOOK_LINE_LAYER_NAME); + mapContent.addLayer(layerLines); + } + + // add line in legend + LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); + lineBuilder.add(line); + lineBuilder.add("setting"); + + ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem( + lineBuilder.buildFeature(null), + styleLines, + t("observe.content.map.legend.logbook.setting")); + legendItems.add(legendTripDay); + + line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); + lineBuilder.add(line); + lineBuilder.add("hauling"); + + legendTripDay = new ObserveMapPaneLegendItem( + lineBuilder.buildFeature(null), + styleLines, + t("observe.content.map.legend.logbook.hauling")); + legendItems.add(legendTripDay); + } } ===================================== client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUI.jaxx ===================================== @@ -30,12 +30,20 @@ </import> <CardLayout id="contentLayout"/> - <JToolBar constraints="BorderLayout.NORTH"> - <JButton id='zoomIt'/> - <JButton id='zoomPlus'/> - <JButton id='zoomMoins'/> - <JButton id='exportPng'/> - </JToolBar> + <Boolean id="showObservation" javaBean="true"/> + <Boolean id="showLogbook" javaBean="true"/> + <JPanel constraints="BorderLayout.NORTH" layout="{new BorderLayout()}"> + <JToolBar constraints="BorderLayout.CENTER"> + <JButton id='zoomIt'/> + <JButton id='zoomPlus'/> + <JButton id='zoomMoins'/> + <JButton id='exportPng'/> + </JToolBar> + <JPanel id="config" constraints="BorderLayout.SOUTH" layout="{new GridLayout(1,0)}"> + <JCheckBox id="showObservationEditor" onItemStateChanged='setShowObservation(showObservationEditor.isSelected())'/> + <JCheckBox id="showLogbookEditor" onItemStateChanged='setShowLogbook(showLogbookEditor.isSelected())'/> + </JPanel> + </JPanel> <JPanel id="content" layout="{contentLayout}" constraints="BorderLayout.CENTER"> <JLabel id="waitLoadingLabel"/> ===================================== client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUI.jcss ===================================== @@ -42,3 +42,13 @@ #exportPng { _observeAction:{ExportPngUIAction.ACTION_NAME}; } + +#showObservationEditor { + text: "observe.content.map.showObservation"; + selected:{isShowObservation()}; +} + +#showLogbookEditor { + text: "observe.content.map.showLogbook"; + selected:{isShowLogbook()}; +} \ No newline at end of file ===================================== client/src/main/java/fr/ird/observe/client/ui/util/tripMap/TripMapUIHandler.java ===================================== @@ -10,12 +10,12 @@ package fr.ird.observe.client.ui.util.tripMap; * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. @@ -26,13 +26,14 @@ import com.google.common.collect.Lists; import fr.ird.observe.client.ObserveSwingApplicationContext; import fr.ird.observe.client.ObserveSwingTechnicalException; import fr.ird.observe.client.configuration.ClientConfig; +import fr.ird.observe.client.ui.ObserveKeyStrokes; import fr.ird.observe.client.ui.actions.tripMap.TripMapActionSupport; import fr.ird.observe.client.ui.content.ObserveActionMap; import fr.ird.observe.dto.data.TripMapDto; import fr.ird.observe.dto.data.TripMapPoint; import fr.ird.observe.spi.DtoModelClasses; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.geotools.geometry.DirectPosition2D; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.swing.JMapPane; @@ -40,9 +41,12 @@ import org.geotools.swing.event.MapPaneEvent; import org.geotools.swing.event.MapPaneListener; import org.nuiton.jaxx.runtime.spi.UIHandler; +import javax.swing.AbstractAction; import javax.swing.AbstractButton; +import javax.swing.Action; import javax.swing.InputMap; import java.awt.Point; +import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; @@ -112,8 +116,10 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> { } else if (DtoModelClasses.isLonglineId(tripMapDto.getId())) { - mapContentBuilder.addLonglineFishingZone(tripMapPoints); - mapContentBuilder.addLonglineLine(tripMapPoints); + mapContentBuilder.addLonglineObsFishingZone(tripMapPoints); + mapContentBuilder.addLonglineObsLine(tripMapPoints); + mapContentBuilder.addLonglineLogbookFishingZone(tripMapPoints); + mapContentBuilder.addLonglineLogbookLine(tripMapPoints); } @@ -205,6 +211,12 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> { mapPane.addMouseListener(mouseMapListener); mapPane.addMapPaneListener(new TripMapListener()); + ui.addPropertyChangeListener("showObservation", e -> { + + }); + ui.addPropertyChangeListener("showLogbook", e -> { + + }); rendererRunning = false; } @@ -217,6 +229,27 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> { init(actionMap, inputMap, ui.zoomPlus); init(actionMap, inputMap, ui.exportPng); + ui.getShowLogbookEditor().setText(ObserveKeyStrokes.suffixTextWithKeyStroke(ui.getShowLogbookEditor().getText(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_LOGBOOK)); + ui.getShowObservationEditor().setText(ObserveKeyStrokes.suffixTextWithKeyStroke(ui.getShowObservationEditor().getText(), ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_OBS)); + + AbstractAction observationAction = new AbstractAction() { + + @Override + public void actionPerformed(ActionEvent e) { + ui.setShowObservation(!ui.isShowObservation()); + } + }; + Action logbookAction = new AbstractAction() { + + @Override + public void actionPerformed(ActionEvent e) { + ui.setShowLogbook(!ui.isShowLogbook()); + } + }; + inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_OBS, "toggleObservation"); + actionMap.put("toggleObservation", observationAction); + inputMap.put(ObserveKeyStrokes.KEY_STROKE_SHOW_LONGLINE_LOGBOOK, "toggleLogbook"); + actionMap.put("toggleLogbook", logbookAction); } public ReferencedEnvelope getTripArea() { @@ -235,8 +268,28 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> { this.zoomCenter = zoomCenter; } + protected void init(ObserveActionMap actionMap, InputMap inputMap, AbstractButton editor) { + String actionId = (String) editor.getClientProperty(OBSERVE_ACTION); + + // on a trouve une action commune + TripMapActionSupport action = (TripMapActionSupport) actionMap.get(actionId); + Objects.requireNonNull(action, "action [" + actionId + "] not found for ui " + ui.getClass().getName()); + + if (log.isDebugEnabled()) { + log.debug("init common action " + actionId); + } + + action.setUi(ui); + action.initForMainUi(editor, inputMap, actionMap); + + } + private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener { + Point2D startPointInWorld; + AffineTransform startScreenToWorldTransform; + ReferencedEnvelope startDisplayArea; + @Override public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); @@ -250,10 +303,6 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> { } - Point2D startPointInWorld; - AffineTransform startScreenToWorldTransform; - ReferencedEnvelope startDisplayArea; - @Override public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { @@ -360,20 +409,4 @@ public class TripMapUIHandler implements UIHandler<TripMapUI> { } } - protected void init(ObserveActionMap actionMap, InputMap inputMap, AbstractButton editor) { - String actionId = (String) editor.getClientProperty(OBSERVE_ACTION); - - // on a trouve une action commune - TripMapActionSupport action = (TripMapActionSupport) actionMap.get(actionId); - Objects.requireNonNull(action, "action [" + actionId + "] not found for ui " + ui.getClass().getName()); - - if (log.isDebugEnabled()) { - log.debug("init common action " + actionId); - } - - action.setUi(ui); - action.initForMainUi(editor, inputMap, actionMap); - - } - } ===================================== client/src/main/map/style.xml ===================================== @@ -88,7 +88,7 @@ </NamedLayer> <NamedLayer> - <Name>Trip longline zone</Name> + <Name>Trip longline obs zone</Name> <UserStyle> <IsDefault>true</IsDefault> <Title>SLD Cook Book: Simple Line</Title> @@ -128,7 +128,47 @@ </NamedLayer> <NamedLayer> - <Name>Trip longline line</Name> + <Name>Trip longline logbook zone</Name> + <UserStyle> + <IsDefault>true</IsDefault> + <Title>SLD Cook Book: Simple Line</Title> + <FeatureTypeStyle> + <Rule> + <Name>Trip day</Name> + <PolygonSymbolizer> + <Fill> + <CssParameter name="fill">#220080</CssParameter> + <CssParameter name="fill-opacity">0.5</CssParameter> + </Fill> + </PolygonSymbolizer> + <TextSymbolizer> + <Label> + <ogc:PropertyName>label</ogc:PropertyName> + </Label> + <Font> + <CssParameter name="font-size">16</CssParameter> + <CssParameter name="font-style">normal</CssParameter> + <CssParameter name="font-weight">bold</CssParameter> + </Font> + <LabelPlacement> + <PointPlacement> + <AnchorPoint> + <AnchorPointX>0.5</AnchorPointX> + <AnchorPointY>0.5</AnchorPointY> + </AnchorPoint> + </PointPlacement> + </LabelPlacement> + <Fill> + <CssParameter name="fill">#220000</CssParameter> + </Fill> + </TextSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> + + <NamedLayer> + <Name>Trip longline obs line</Name> <UserStyle> <IsDefault>true</IsDefault> <Title>SLD Cook Book: Simple Line</Title> @@ -187,6 +227,66 @@ </UserStyle> </NamedLayer> + <NamedLayer> + <Name>Trip longline logbook line</Name> + <UserStyle> + <IsDefault>true</IsDefault> + <Title>SLD Cook Book: Simple Line</Title> + <FeatureTypeStyle> + <Rule> + <Name>Trip</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>type</ogc:PropertyName> + <ogc:Literal>trip</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <LineSymbolizer> + <Stroke> + <CssParameter name="stroke">#222222</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + <CssParameter name="stroke-dasharray">5 7</CssParameter> + </Stroke> + </LineSymbolizer> + </Rule> + </FeatureTypeStyle> + <FeatureTypeStyle> + <Rule> + <Name>setting</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>type</ogc:PropertyName> + <ogc:Literal>setting</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <LineSymbolizer> + <Stroke> + <CssParameter name="stroke">#00ff00</CssParameter> + <CssParameter name="stroke-width">4</CssParameter> + </Stroke> + </LineSymbolizer> + </Rule> + </FeatureTypeStyle> + <FeatureTypeStyle> + <Rule> + <Name>hauling</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>type</ogc:PropertyName> + <ogc:Literal>hauling</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <LineSymbolizer> + <Stroke> + <CssParameter name="stroke">#ff0000</CssParameter> + <CssParameter name="stroke-width">4</CssParameter> + </Stroke> + </LineSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> + <NamedLayer> <Name>Trip points</Name> @@ -527,6 +627,259 @@ </TextSymbolizer> </Rule> </FeatureTypeStyle> + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity Logbook with setting start</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>longlineActivityLogbookWithSettingStart</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>Triangle</WellKnownName> + <Fill> + <CssParameter name="fill">#00FF00</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + </Stroke> + </Mark> + <Size>16</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity Logbook with setting end</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>longlineActivityLogbookWithSettingEnd</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>X</WellKnownName> + <Fill> + <CssParameter name="fill">#00FF00</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + </Stroke> + </Mark> + <Size>14</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity Logbook with hauling start</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>longlineActivityLogbookWithHaulingStart</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>Triangle</WellKnownName> + <Fill> + <CssParameter name="fill">#FF0000</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + </Stroke> + </Mark> + <Size>16</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity Logbook with hauling end</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>longlineActivityLogbookWithHaulingEnd</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>X</WellKnownName> + <Fill> + <CssParameter name="fill">#FF0000</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + </Stroke> + </Mark> + <Size>14</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity Logbook in harbour</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>longlineActivityLogbookInHarbour</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>Circle</WellKnownName> + <Fill> + <CssParameter name="fill">#7800f6</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + </Stroke> + </Mark> + <Size>12</Size> + </Graphic> + </PointSymbolizer> + <TextSymbolizer> + <Label> + <ogc:PropertyName>label</ogc:PropertyName> + </Label> + <Font> + <CssParameter name="font-size">14</CssParameter> + <CssParameter name="font-style">normal</CssParameter> + <CssParameter name="font-weight">bold</CssParameter> + </Font> + <LabelPlacement> + <PointPlacement> + <Displacement> + <DisplacementX>5</DisplacementX> + <DisplacementY>5</DisplacementY> + </Displacement> + </PointPlacement> + </LabelPlacement> + <Fill> + <CssParameter name="fill">#000000</CssParameter> + </Fill> + </TextSymbolizer> + </Rule> + </FeatureTypeStyle> + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity Logbook with interaction</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>longlineActivityLogbookWithInteraction</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>Circle</WellKnownName> + <Fill> + <CssParameter name="fill">#FFFF00</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + </Stroke> + </Mark> + <Size>12</Size> + </Graphic> + </PointSymbolizer> + <TextSymbolizer> + <Label> + <ogc:PropertyName>label</ogc:PropertyName> + </Label> + <Font> + <CssParameter name="font-size">14</CssParameter> + <CssParameter name="font-style">normal</CssParameter> + <CssParameter name="font-weight">bold</CssParameter> + </Font> + <LabelPlacement> + <PointPlacement> + <Displacement> + <DisplacementX>5</DisplacementX> + <DisplacementY>5</DisplacementY> + </Displacement> + </PointPlacement> + </LabelPlacement> + <Fill> + <CssParameter name="fill">#000000</CssParameter> + </Fill> + </TextSymbolizer> + </Rule> + </FeatureTypeStyle> + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity Logbook with station</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>longlineActivityLogbookWithStation</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>star</WellKnownName> + <Fill> + <CssParameter name="fill">#FFFF00</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">3</CssParameter> + </Stroke> + </Mark> + <Size>16</Size> + </Graphic> + </PointSymbolizer> + <TextSymbolizer> + <Label> + <ogc:PropertyName>label</ogc:PropertyName> + </Label> + <Font> + <CssParameter name="font-size">14</CssParameter> + <CssParameter name="font-style">normal</CssParameter> + <CssParameter name="font-weight">bold</CssParameter> + </Font> + <LabelPlacement> + <PointPlacement> + <Displacement> + <DisplacementX>5</DisplacementX> + <DisplacementY>5</DisplacementY> + </Displacement> + </PointPlacement> + </LabelPlacement> + <Fill> + <CssParameter name="fill">#000000</CssParameter> + </Fill> + </TextSymbolizer> + </Rule> + </FeatureTypeStyle> </UserStyle> </NamedLayer> ===================================== client/src/main/resources/i18n/client_en_GB.properties ===================================== @@ -1497,7 +1497,7 @@ observe.constant.StorageStep.CONFIG_REFERENTIEL.description=Configurer referenti observe.constant.StorageStep.CONFIRM=Summary observe.constant.StorageStep.CONFIRM.description=Summary of operations to perform observe.constant.StorageStep.ROLES=Security -observe.constant.StorageStep.ROLES.description=Applya security on database roles +observe.constant.StorageStep.ROLES.description=Apply security on database roles observe.constant.StorageStep.SELECT_DATA=Data selection observe.constant.StorageStep.SELECT_DATA.description=Select data to export in backup observe.content.map.action.exportPng=Export @@ -1513,12 +1513,16 @@ observe.content.map.export.chooseFile.ok=Exporter observe.content.map.export.chooseFile.png=PNG image observe.content.map.export.chooseFile.title=Export map observe.content.map.export.success=Map exported (%s) -observe.content.map.legend.hauling=Hauling -observe.content.map.legend.setting=setting +observe.content.map.legend.logbook.hauling=Logbook - Hauling +observe.content.map.legend.logbook.setting=Logbook - setting +observe.content.map.legend.obs.hauling=Observation - Hauling +observe.content.map.legend.obs.setting=Observation - setting observe.content.map.legend.tripBetweenTwoDays=Trip between two days observe.content.map.legend.tripDay=Day trip observe.content.map.miles=miles observe.content.map.north=North +observe.content.map.showLogbook=Show Logbook data +observe.content.map.showObservation=Show Observation data observe.content.map.south=South observe.content.map.waitLoading=< Please wait while loading the map > observe.content.map.west=West ===================================== client/src/main/resources/i18n/client_es_ES.properties ===================================== @@ -1513,12 +1513,16 @@ observe.content.map.export.chooseFile.ok=Exportar observe.content.map.export.chooseFile.png=imagen PNG observe.content.map.export.chooseFile.title=Exportar el mapa observe.content.map.export.success=Mapa exportada (%s) -observe.content.map.legend.hauling=Arrastre -observe.content.map.legend.setting=Calada +observe.content.map.legend.logbook.hauling=Logbook - Arrastre +observe.content.map.legend.logbook.setting=Logbook - Calada +observe.content.map.legend.obs.hauling=Observation - Arrastre +observe.content.map.legend.obs.setting=Observation - Calada observe.content.map.legend.tripBetweenTwoDays=Trayecto entre dos días observe.content.map.legend.tripDay=Trayecto del día observe.content.map.miles=milles observe.content.map.north=Norte +observe.content.map.showLogbook=Show Logbook data \#TODO +observe.content.map.showObservation=Show Observation data \#TODO observe.content.map.south=Sur observe.content.map.waitLoading=< Espere mientras que el mapa se está cargando > observe.content.map.west=Oeste ===================================== client/src/main/resources/i18n/client_fr_FR.properties ===================================== @@ -1513,12 +1513,16 @@ observe.content.map.export.chooseFile.ok=Exporter observe.content.map.export.chooseFile.png=image PNG observe.content.map.export.chooseFile.title=Exporter la carte observe.content.map.export.success=Carte exportée (%s) -observe.content.map.legend.hauling=Virage -observe.content.map.legend.setting=Filage +observe.content.map.legend.logbook.hauling=Livre de bord - Virage +observe.content.map.legend.logbook.setting=Livre de bord - Filage +observe.content.map.legend.obs.hauling=Observation - Virage +observe.content.map.legend.obs.setting=Observation - Filage observe.content.map.legend.tripBetweenTwoDays=Trajet entre deux jours observe.content.map.legend.tripDay=Trajet d'une journée observe.content.map.miles=milles observe.content.map.north=Nord +observe.content.map.showLogbook=Voir les données Livre de bord +observe.content.map.showObservation=Voir les données Observation observe.content.map.south=Sud observe.content.map.waitLoading=< Veuillez patienter pendant le chargement de la carte > observe.content.map.west=Ouest ===================================== dto/pom.xml ===================================== @@ -188,6 +188,7 @@ <pattern>observe.constant.@CLASS_SIMPLE_NAME@.@NAME@</pattern> <enums> <enum>fr.ird.observe.dto.referential.GearType</enum> + <enum>fr.ird.observe.dto.data.TripMapPointType</enum> <enum>fr.ird.observe.dto.data.seine.DcpComputedValue</enum> <enum>fr.ird.observe.dto.data.seine.Ownership</enum> <enum>fr.ird.observe.dto.data.seine.NonTargetCatchComputedValueSource</enum> ===================================== dto/src/main/java/fr/ird/observe/dto/data/TripMapPoint.java ===================================== @@ -0,0 +1,79 @@ +package fr.ird.observe.dto.data; + +/*- + * #%L + * ObServe :: Dto + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import java.io.Serializable; +import java.util.Date; + +public class TripMapPoint implements Serializable { + + public static final String PROPERTY_TIME = "time"; + + public static final String PROPERTY_LATITUDE = "latitude"; + + public static final String PROPERTY_LONGITUDE = "longitude"; + + public static final String PROPERTY_TYPE = "type"; + + private static final long serialVersionUID = 1L; + + protected Date time; + + protected float latitude; + + protected float longitude; + + protected TripMapPointType type; + + public Date getTime() { + return time; + } + + public void setTime(Date time) { + this.time = time; + } + + public float getLatitude() { + return latitude; + } + + public void setLatitude(float latitude) { + this.latitude = latitude; + } + + public float getLongitude() { + return longitude; + } + + public void setLongitude(float longitude) { + this.longitude = longitude; + } + + public TripMapPointType getType() { + return type; + } + + public void setType(TripMapPointType type) { + this.type = type; + } +} ===================================== dto/src/main/java/fr/ird/observe/dto/data/TripMapPointType.java ===================================== @@ -0,0 +1,61 @@ +package fr.ird.observe.dto.data; + +/*- + * #%L + * ObServe :: Dto + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +/** + * <b>Attention : les noms des constantes sont utilisées dans la feuille de style de rendu. Si on change les noms ici, + * il faut réimpacter dans le fichier style.xml</b> + * + * @author Tony Chemit - dev@tchemit.fr + */ +public enum TripMapPointType { + + seineDepartureHarbour, + seineLandingHarbour, + seineActivity, + seineActivityInHarbour, + seineActivityWithFreeSchoolType, + seineActivityWithObjectSchoolType, + + longlineDepartureHarbour, + longlineLandingHarbour, + + longlineActivityObs, + longlineActivityObsInHarbour, + longlineActivityObsWithSettingStart, + longlineActivityObsWithSettingEnd, + longlineActivityObsWithHaulingStart, + longlineActivityObsWithHaulingEnd, + longlineActivityObsWithInteraction, + longlineActivityObsWithStation, + + longlineActivityLogbook, + longlineActivityLogbookInHarbour, + longlineActivityLogbookWithSettingStart, + longlineActivityLogbookWithSettingEnd, + longlineActivityLogbookWithHaulingStart, + longlineActivityLogbookWithHaulingEnd, + longlineActivityLogbookWithInteraction, + longlineActivityLogbookWithStation + +} ===================================== dto/src/main/resources/i18n/dto_en_GB.properties ===================================== @@ -323,6 +323,30 @@ observe.constant.Ownership.unknown=Unknown observe.constant.SchoolType.libre=Free school type observe.constant.SchoolType.objet=Object school type observe.constant.SchoolType.undefined=Undefined school type +observe.constant.TripMapPointType.longlineActivityLogbook=Logbook - Activity +observe.constant.TripMapPointType.longlineActivityLogbookInHarbour=Logbook - At Harbour +observe.constant.TripMapPointType.longlineActivityLogbookWithHaulingEnd=Logbook - Hauling end +observe.constant.TripMapPointType.longlineActivityLogbookWithHaulingStart=Logbook - Hauling start +observe.constant.TripMapPointType.longlineActivityLogbookWithInteraction=Logbook - Encounter +observe.constant.TripMapPointType.longlineActivityLogbookWithSettingEnd=Logbook - Setting end +observe.constant.TripMapPointType.longlineActivityLogbookWithSettingStart=Logbook - Setting start +observe.constant.TripMapPointType.longlineActivityLogbookWithStation=Logbook - Station +observe.constant.TripMapPointType.longlineActivityObs=Observation - Activity +observe.constant.TripMapPointType.longlineActivityObsInHarbour=Observation - At Harbour +observe.constant.TripMapPointType.longlineActivityObsWithHaulingEnd=Observation - Hauling end +observe.constant.TripMapPointType.longlineActivityObsWithHaulingStart=Observation - Hauling start +observe.constant.TripMapPointType.longlineActivityObsWithInteraction=Observation - Encounter +observe.constant.TripMapPointType.longlineActivityObsWithSettingEnd=Observation - Setting end +observe.constant.TripMapPointType.longlineActivityObsWithSettingStart=Observation - Setting start +observe.constant.TripMapPointType.longlineActivityObsWithStation=Observation - Station +observe.constant.TripMapPointType.longlineDepartureHarbour=Harbour departure +observe.constant.TripMapPointType.longlineLandingHarbour=Harbour landing +observe.constant.TripMapPointType.seineActivity=Activity +observe.constant.TripMapPointType.seineActivityInHarbour=In harbour +observe.constant.TripMapPointType.seineActivityWithFreeSchoolType=Free School type +observe.constant.TripMapPointType.seineActivityWithObjectSchoolType=Object School type +observe.constant.TripMapPointType.seineDepartureHarbour=Harbour departure +observe.constant.TripMapPointType.seineLandingHarbour=Harbour landing observe.constant.TypeTransmittingBuoyOperation.pasDeBalise=No Beacon observe.constant.TypeTransmittingBuoyOperation.pose=Posing observe.constant.TypeTransmittingBuoyOperation.recuperation=Grab ===================================== dto/src/main/resources/i18n/dto_es_ES.properties ===================================== @@ -321,6 +321,30 @@ observe.constant.Ownership.unknown=Desconocido observe.constant.SchoolType.libre=Banco libre observe.constant.SchoolType.objet=Banco a objeto observe.constant.SchoolType.undefined=Banco indeterminado +observe.constant.TripMapPointType.longlineActivityLogbook=Logbook - Actividad +observe.constant.TripMapPointType.longlineActivityLogbookInHarbour=Logbook - En el puerto +observe.constant.TripMapPointType.longlineActivityLogbookWithHaulingEnd=Logbook - Fin de arrastre +observe.constant.TripMapPointType.longlineActivityLogbookWithHaulingStart=Logbook - Inicio de arrastre +observe.constant.TripMapPointType.longlineActivityLogbookWithInteraction=Logbook - Encuentro +observe.constant.TripMapPointType.longlineActivityLogbookWithSettingEnd=Logbook - Fin de calada +observe.constant.TripMapPointType.longlineActivityLogbookWithSettingStart=Logbook - Inicio de calada +observe.constant.TripMapPointType.longlineActivityLogbookWithStation=Logbook - Station +observe.constant.TripMapPointType.longlineActivityObs=Observation - Actividad +observe.constant.TripMapPointType.longlineActivityObsInHarbour=Observation - En el puerto +observe.constant.TripMapPointType.longlineActivityObsWithHaulingEnd=Observation - Fin de arrastre +observe.constant.TripMapPointType.longlineActivityObsWithHaulingStart=Observation - Inicio de arrastre +observe.constant.TripMapPointType.longlineActivityObsWithInteraction=Observation - Encuentro +observe.constant.TripMapPointType.longlineActivityObsWithSettingEnd=Observation - Fin de calada +observe.constant.TripMapPointType.longlineActivityObsWithSettingStart=Observation - Inicio de calada +observe.constant.TripMapPointType.longlineActivityObsWithStation=Observation - Station +observe.constant.TripMapPointType.longlineDepartureHarbour=Puerto de salida +observe.constant.TripMapPointType.longlineLandingHarbour=Puerto de llegada +observe.constant.TripMapPointType.seineActivity=Actividad +observe.constant.TripMapPointType.seineActivityInHarbour=En el puerto +observe.constant.TripMapPointType.seineActivityWithFreeSchoolType=Banco libre +observe.constant.TripMapPointType.seineActivityWithObjectSchoolType=Banco a objeto +observe.constant.TripMapPointType.seineDepartureHarbour=Puerto de salida +observe.constant.TripMapPointType.seineLandingHarbour=Puerto de llegada observe.constant.TypeTransmittingBuoyOperation.pasDeBalise=DCP sin baliza observe.constant.TypeTransmittingBuoyOperation.pose=Colocación de nueva baliza observe.constant.TypeTransmittingBuoyOperation.recuperation=Recogida de baliza sin regreso al agua ===================================== dto/src/main/resources/i18n/dto_fr_FR.properties ===================================== @@ -323,6 +323,30 @@ observe.constant.Ownership.unknown=Inconnue observe.constant.SchoolType.libre=Banc libre observe.constant.SchoolType.objet=Banc objet observe.constant.SchoolType.undefined=Banc indéterminé +observe.constant.TripMapPointType.longlineActivityLogbook=Livre de bord - point d'activité +observe.constant.TripMapPointType.longlineActivityLogbookInHarbour=Livre de bord - Au port +observe.constant.TripMapPointType.longlineActivityLogbookWithHaulingEnd=Livre de bord - Fin de virage +observe.constant.TripMapPointType.longlineActivityLogbookWithHaulingStart=Livre de bord - Début de virage +observe.constant.TripMapPointType.longlineActivityLogbookWithInteraction=Livre de bord - Rencontre +observe.constant.TripMapPointType.longlineActivityLogbookWithSettingEnd=Livre de bord - Fin de filage +observe.constant.TripMapPointType.longlineActivityLogbookWithSettingStart=Livre de bord - Début de filage +observe.constant.TripMapPointType.longlineActivityLogbookWithStation=Livre de bord - Station océanographique +observe.constant.TripMapPointType.longlineActivityObs=Observation - point d'activité +observe.constant.TripMapPointType.longlineActivityObsInHarbour=Observation - Au port +observe.constant.TripMapPointType.longlineActivityObsWithHaulingEnd=Observation - Fin de virage +observe.constant.TripMapPointType.longlineActivityObsWithHaulingStart=Observation - Début de virage +observe.constant.TripMapPointType.longlineActivityObsWithInteraction=Observation - Rencontre +observe.constant.TripMapPointType.longlineActivityObsWithSettingEnd=Observation - Fin de filage +observe.constant.TripMapPointType.longlineActivityObsWithSettingStart=Observation - Début de filage +observe.constant.TripMapPointType.longlineActivityObsWithStation=Observation - Station océanographique +observe.constant.TripMapPointType.longlineDepartureHarbour=Port de départ +observe.constant.TripMapPointType.longlineLandingHarbour=Port d'arrivée +observe.constant.TripMapPointType.seineActivity=point d'activité +observe.constant.TripMapPointType.seineActivityInHarbour=Au port +observe.constant.TripMapPointType.seineActivityWithFreeSchoolType=Banc libre +observe.constant.TripMapPointType.seineActivityWithObjectSchoolType=Banc objet +observe.constant.TripMapPointType.seineDepartureHarbour=Port de départ +observe.constant.TripMapPointType.seineLandingHarbour=Port d'arrivée observe.constant.TypeTransmittingBuoyOperation.pasDeBalise=Pas de balise liée au DCP observe.constant.TypeTransmittingBuoyOperation.pose=Pose d'une nouvelle balise observe.constant.TypeTransmittingBuoyOperation.recuperation=Récupération d'une balise sans remise à l'eau ===================================== persistence/src/main/java/fr/ird/observe/entities/longline/SampleLogbooks.java ===================================== @@ -1,5 +1,27 @@ package fr.ird.observe.entities.longline; +/*- + * #%L + * ObServe :: Persistence + * %% + * Copyright (C) 2008 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import java.util.Comparator; import java.util.Date; import java.util.List; ===================================== persistence/src/main/java/fr/ird/observe/entities/longline/TripLonglineTopiaDao.java ===================================== @@ -10,12 +10,12 @@ package fr.ird.observe.entities.longline; * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. @@ -42,9 +42,11 @@ import java.util.List; public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongline> { - public static final String ACTIVITY_INTERACTION_ID = "fr.ird.observe.entities.referentiel.longline.VesselActivityLongline#1239832686138#0.4"; + public static final String ACTIVITY_OBS_INTERACTION_ID = "fr.ird.observe.entities.referentiel.longline.VesselActivityLongline#1239832686138#0.4"; + public static final String ACTIVITY_LOGBOOK_INTERACTION_ID = "fr.ird.observe.entities.referentiel.longline.VesselActivityLongline#1239832686138#0.4"; - public static final String ACTIVITY_STATION_ID = "fr.ird.observe.entities.referentiel.longline.VesselActivityLongline#1239832686138#0.3"; + public static final String ACTIVITY_OBS_STATION_ID = "fr.ird.observe.entities.referentiel.longline.VesselActivityLongline#1239832686138#0.3"; + public static final String ACTIVITY_LOGBOOK_STATION_ID = "fr.ird.observe.entities.referentiel.longline.VesselActivityLongline#1239832686138#0.3"; public int findPositionByProgramId(String programId, String tripId) { int result = 0; @@ -61,7 +63,7 @@ public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongl return -1; } - public LinkedHashSet<TripMapPoint> extractTripMapActivityPoints(String tripId) { + public LinkedHashSet<TripMapPoint> extractTripMapActivityPoints(String tripId, boolean addObservation, boolean addLogbook) { TripLongline tripLongline = forTopiaIdEquals(tripId).findUnique(); @@ -80,11 +82,17 @@ public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongl tripMapPoints.add(departurePoint); } - // Add Activities - TripMapActivityPointQuery tripMapActivityPointQuery = new TripMapActivityPointQuery(tripId); - List<List<TripMapPoint>> results = topiaSqlSupport.findMultipleResult(tripMapActivityPointQuery); - for (List<TripMapPoint> result : results) { - tripMapPoints.addAll(result); + if (addObservation) { + // Add Activities Observation + TripMapActivityObsPointQuery tripMapActivityObsPointQuery = new TripMapActivityObsPointQuery(tripId); + List<List<TripMapPoint>> results = topiaSqlSupport.findMultipleResult(tripMapActivityObsPointQuery); + results.forEach(tripMapPoints::addAll); + } + if (addLogbook) { + // Add Activities Logbook + TripMapActivityLogbookPointQuery tripMapActivityLogbookPointQuery = new TripMapActivityLogbookPointQuery(tripId); + List<List<TripMapPoint>> results = topiaSqlSupport.findMultipleResult(tripMapActivityLogbookPointQuery); + results.forEach(tripMapPoints::addAll); } // add landing harbours @@ -103,7 +111,53 @@ public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongl return tripMapPoints; } - private static class TripMapActivityPointQuery extends TopiaSqlQuery<List<TripMapPoint>> { + public boolean updateEndDate(TripLongline trip) { + + boolean wasUpdated = false; + + // la date de fin theorique (date de la dernière activité de la marée) + Date theoricalEndDate = getTheoricalEndDate(trip); + + // la date de fin actuelle + Date realEndDate = trip.getEndDate(); + + if (realEndDate == null || theoricalEndDate.after(realEndDate)) { + + // on utilise la nouvelle date theorique car l'ancienne n'existe pas + // ou est antérieure à la date de fin théoriquue + trip.setEndDate(theoricalEndDate); + wasUpdated = true; + } + + return wasUpdated; + + } + + public Date getTheoricalEndDate(TripLongline trip) { + + Date d; + + Timestamp lastActivityDate = TheoricalEndOfDateSqlQuery.find(topiaSqlSupport, trip.getTopiaId()); + + if (lastActivityDate == null) { + + // pas d'activité, donc la date de fin est la date de debut + d = trip.getStartDate(); + + } else { + + // date de la dernière activité de la marée + d = lastActivityDate; + + } + + // on conserve la date epuree (pas de notion de temps dans la date) + d = DateUtil.getEndOfDay(d); + return d; + + } + + private static class TripMapActivityObsPointQuery extends TopiaSqlQuery<List<TripMapPoint>> { private static final String SQL = "SELECT" + " a.timestamp, " + @@ -130,7 +184,7 @@ public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongl protected final String tripId; - public TripMapActivityPointQuery(String tripId) { + public TripMapActivityObsPointQuery(String tripId) { this.tripId = tripId; } @@ -157,9 +211,9 @@ public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongl String vesselActivityId = resultSet.getString(4); if (vesselActivityId == null) { activity.setType(TripMapPointType.longlineActivityObs); - } else if (ACTIVITY_INTERACTION_ID.equals(vesselActivityId)) { + } else if (ACTIVITY_OBS_INTERACTION_ID.equals(vesselActivityId)) { activity.setType(TripMapPointType.longlineActivityObsWithInteraction); - } else if (ACTIVITY_STATION_ID.equals(vesselActivityId)) { + } else if (ACTIVITY_OBS_STATION_ID.equals(vesselActivityId)) { activity.setType(TripMapPointType.longlineActivityObsWithStation); } else { activity.setType(TripMapPointType.longlineActivityObs); @@ -212,50 +266,113 @@ public class TripLonglineTopiaDao extends AbstractTripLonglineTopiaDao<TripLongl } } - public boolean updateEndDate(TripLongline trip) { + private static class TripMapActivityLogbookPointQuery extends TopiaSqlQuery<List<TripMapPoint>> { - boolean wasUpdated = false; - - // la date de fin theorique (date de la dernière activité de la marée) - Date theoricalEndDate = getTheoricalEndDate(trip); - - // la date de fin actuelle - Date realEndDate = trip.getEndDate(); + private static final String SQL = "SELECT" + + " a.timestamp, " + + " a.latitude," + + " a.longitude," + + " a.vesselActivity," + + " s.settingStartTimestamp," + + " s.settingStartLatitude," + + " s.settingStartLongitude," + + " s.settingEndTimestamp," + + " s.settingEndLatitude," + + " s.settingEndLongitude," + + " s.haulingStartTimestamp," + + " s.haulingStartLatitude," + + " s.haulingStartLongitude," + + " s.haulingEndTimestamp," + + " s.haulingEndLatitude," + + " s.haulingEndLongitude" + + " FROM observe_longLine.activityLogbook a" + + " LEFT OUTER JOIN observe_longLine.setLogbook s" + + " ON s.topiaId = a.set" + + " WHERE a.trip = ?" + + " ORDER BY a.timestamp"; - if (realEndDate == null || theoricalEndDate.after(realEndDate)) { + protected final String tripId; - // on utilise la nouvelle date theorique car l'ancienne n'existe pas - // ou est antérieure à la date de fin théoriquue - trip.setEndDate(theoricalEndDate); - wasUpdated = true; + public TripMapActivityLogbookPointQuery(String tripId) { + this.tripId = tripId; } - return wasUpdated; + @Override + public PreparedStatement prepareQuery(Connection connection) throws SQLException { + PreparedStatement preparedStatement = connection.prepareStatement(SQL); + preparedStatement.setString(1, tripId); + return preparedStatement; + } - } + @Override + public List<TripMapPoint> prepareResult(ResultSet resultSet) throws SQLException { - public Date getTheoricalEndDate(TripLongline trip) { + List<TripMapPoint> result = Lists.newLinkedList(); - Date d; + if (resultSet.getString(5) == null) { - Timestamp lastActivityDate = TheoricalEndOfDateSqlQuery.find(topiaSqlSupport, trip.getTopiaId()); + // activity + TripMapPoint activity = new TripMapPoint(); + activity.setTime(resultSet.getDate(1)); + activity.setLatitude(resultSet.getFloat(2)); + activity.setLongitude(resultSet.getFloat(3)); - if (lastActivityDate == null) { + String vesselActivityId = resultSet.getString(4); + if (vesselActivityId == null) { + activity.setType(TripMapPointType.longlineActivityLogbook); + } else if (ACTIVITY_LOGBOOK_INTERACTION_ID.equals(vesselActivityId)) { + activity.setType(TripMapPointType.longlineActivityLogbookWithInteraction); + } else if (ACTIVITY_LOGBOOK_STATION_ID.equals(vesselActivityId)) { + activity.setType(TripMapPointType.longlineActivityLogbookWithStation); + } else { + activity.setType(TripMapPointType.longlineActivityLogbook); + } - // pas d'activité, donc la date de fin est la date de debut - d = trip.getStartDate(); + result.add(activity); + } - } else { + // settingStart + if (resultSet.getString(5) != null) { + TripMapPoint settingStart = new TripMapPoint(); + settingStart.setTime(resultSet.getDate(5)); + settingStart.setLatitude(resultSet.getFloat(6)); + settingStart.setLongitude(resultSet.getFloat(7)); + settingStart.setType(TripMapPointType.longlineActivityLogbookWithSettingStart); + result.add(settingStart); + } - // date de la dernière activité de la marée - d = lastActivityDate; + // settingEnd + if (resultSet.getString(8) != null) { + TripMapPoint settingEnd = new TripMapPoint(); + settingEnd.setTime(resultSet.getDate(8)); + settingEnd.setLatitude(resultSet.getFloat(9)); + settingEnd.setLongitude(resultSet.getFloat(10)); + settingEnd.setType(TripMapPointType.longlineActivityLogbookWithSettingEnd); + result.add(settingEnd); + } - } + // haulingStart + if (resultSet.getString(11) != null) { + TripMapPoint haulingStart = new TripMapPoint(); + haulingStart.setTime(resultSet.getDate(11)); + haulingStart.setLatitude(resultSet.getFloat(12)); + haulingStart.setLongitude(resultSet.getFloat(13)); + haulingStart.setType(TripMapPointType.longlineActivityLogbookWithHaulingStart); + result.add(haulingStart); + } - // on conserve la date epuree (pas de notion de temps dans la date) - d = DateUtil.getEndOfDay(d); - return d; + // haulingEnd + if (resultSet.getString(14) != null) { + TripMapPoint haulingEnd = new TripMapPoint(); + haulingEnd.setTime(resultSet.getDate(14)); + haulingEnd.setLatitude(resultSet.getFloat(15)); + haulingEnd.setLongitude(resultSet.getFloat(16)); + haulingEnd.setType(TripMapPointType.longlineActivityLogbookWithHaulingEnd); + result.add(haulingEnd); + } + return result; + } } private static class TheoricalEndOfDateSqlQuery extends TopiaSqlQuery<Timestamp> { ===================================== pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>io.ultreia.maven</groupId> <artifactId>pom</artifactId> - <version>2018.51</version> + <version>2018.52</version> </parent> <groupId>fr.ird.observe</groupId> @@ -152,10 +152,10 @@ <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format> <buildDate>${maven.build.timestamp}</buildDate> - <observeToolkitVersion>4.2</observeToolkitVersion> + <observeToolkitVersion>4.3</observeToolkitVersion> <!--<lib.version.java4all.topia>1.1.1</lib.version.java4all.topia>--> <!--<lib.version.java4all.eugene>3.0-alpha-22</lib.version.java4all.eugene>--> - <lib.version.java4all.jaxx>3.0-alpha-35</lib.version.java4all.jaxx> + <!--<lib.version.java4all.jaxx>3.0-alpha-35</lib.version.java4all.jaxx>--> <!--<lib.version.nuiton.topia>3.4.2-SNAPSHOT</lib.version.nuiton.topia>--> <lib.version.nuiton.validation>3.1</lib.version.nuiton.validation> <lib.version.java4all.topia>1.1.3</lib.version.java4all.topia> ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/data/longline/TripLonglineServiceLocal.java ===================================== @@ -92,8 +92,8 @@ public class TripLonglineServiceLocal extends ObserveServiceLocal implements Tri } @Override - public TripMapDto getTripLonglineMap(String tripLonglineId) { - LinkedHashSet<TripMapPoint> points = TRIP_LONGLINE_SPI.getDao(getTopiaPersistenceContext()).extractTripMapActivityPoints(tripLonglineId); + public TripMapDto getTripLonglineMap(String tripLonglineId, boolean addObservation, boolean addLogbook) { + LinkedHashSet<TripMapPoint> points = TRIP_LONGLINE_SPI.getDao(getTopiaPersistenceContext()).extractTripMapActivityPoints(tripLonglineId, addObservation, addLogbook); return TripMapDtoFactory.of(tripLonglineId, points); } ===================================== services/src/main/java/fr/ird/observe/services/service/data/longline/TripLonglineService.java ===================================== @@ -55,7 +55,7 @@ public interface TripLonglineService extends ObserveService { @Get @ReadDataPermission - TripMapDto getTripLonglineMap(String tripLonglineId); + TripMapDto getTripLonglineMap(String tripLonglineId, boolean addObservation, boolean addLogbook); @Get @ReadDataPermission ===================================== src/site/markdown/administration-web.md.vm ===================================== @@ -135,3 +135,13 @@ Vous pouvez supprimer toutes les sessions utilisateurs via l'adresse suivante : ``` http://localhost:8080/observeweb/admin/resetAuthenticationTokens?adminApiKey... (ou la clef que vous avez configuré) ``` + +## Configuration Apache + +Par défaut le proxy_ajp a un timeout de 5 minutes, il faut augmenter cette valeur sinon les appels dépassant ce temps +seront rejettés. + +Dans le fichier de configuration ``httpd.conf`` ajouter la ligne : (timeout de 1200 secondes = 20 minutes) +``` +ProxyTimeout 1200 +``` \ No newline at end of file View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/8c6a87a55abf04e2287fe659408... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/8c6a87a55abf04e2287fe659408... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT