This is an automated email from the git hooks/post-receive script. New commit to branch feature/7587-PSVerifÉcranMarée in repository tutti. See http://git.codelutin.com/tutti.git commit 366a663cbcb0c58550e19b8d4810775c639af559 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Mar 4 11:09:50 2016 +0100 Pour la cartographie : - Ajouter un titre aux calques - ne pas ajouer les claques vides (erreur au chargement : impossible de definir ses limites), - ne pas zoomer sur la route d'un navire si aucune donnée. --- .../ui/util/tripMap/TripMapContentBuilder.java | 31 ++++++++++++++-------- .../observe/ui/util/tripMap/TripMapUIHandler.java | 6 +++-- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java index d9b3c1c..290cfb3 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapContentBuilder.java @@ -127,7 +127,7 @@ public class TripMapContentBuilder { SimpleFeatureSource featureSource = store.getFeatureSource(); Style style = SLD.createSimpleStyle(featureSource.getSchema()); style = findStyle(styledLayerDescriptor, store.getNames().get(0).getLocalPart(), null, style); - Layer layer = new FeatureLayer(featureSource, style); + Layer layer = new FeatureLayer(featureSource, style, layerFile.getName()); mapContent.addLayer(layer); } @@ -186,7 +186,7 @@ public class TripMapContentBuilder { previousPoint = point; } - if (coordinatesByDay.size() > 1) { + if (coordinatesByDay != null && coordinatesByDay.size() > 1) { LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); lineBuilder.add(line); lineBuilder.add(DATE_FORMAT.format(previousPoint.getTime())); @@ -195,8 +195,11 @@ public class TripMapContentBuilder { } Style styleLines = findStyle(styledLayerDescriptor, TRIP_LINES_LAYER_NAME, null); - Layer layerLines = new FeatureLayer(linesFeatures, styleLines); - mapContent.addLayer(layerLines); + + if (! linesFeatures.isEmpty()) { + Layer layerLines = new FeatureLayer(linesFeatures, styleLines, TRIP_LINES_LAYER_NAME); + mapContent.addLayer(layerLines); + } // add line in legend @@ -263,9 +266,11 @@ public class TripMapContentBuilder { } } - Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_FISHING_ZONE_LAYER_NAME, null); - Layer layerLines = new FeatureLayer(polygonsFeatures, styleLines); - mapContent.addLayer(layerLines); + 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); + mapContent.addLayer(layerLines); + } } public void addLonglineLine(List<TripMapPointDto> tripMapPoints) throws FactoryException { @@ -330,8 +335,10 @@ public class TripMapContentBuilder { } Style styleLines = findStyle(styledLayerDescriptor, TRIP_LONGLINE_LINE_LAYER_NAME, null); - Layer layerLines = new FeatureLayer(linesFeatures, styleLines); - mapContent.addLayer(layerLines); + if (!linesFeatures.isEmpty()) { + Layer layerLines = new FeatureLayer(linesFeatures, styleLines, TRIP_LONGLINE_LINE_LAYER_NAME); + mapContent.addLayer(layerLines); + } // add line in legend LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); @@ -406,8 +413,10 @@ public class TripMapContentBuilder { } - Layer pointsLayer = new FeatureLayer(pointsFeatures, stylePoints); - mapContent.addLayer(pointsLayer); + if (! pointsFeatures.isEmpty()) { + Layer pointsLayer = new FeatureLayer(pointsFeatures, stylePoints, TRIP_POINTS_LAYER_NAME); + mapContent.addLayer(pointsLayer); + } } diff --git a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index 7c1ec8f..a4f3e8b 100644 --- a/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-application-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -166,8 +166,10 @@ public class TripMapUIHandler { } public void zoomIt() { - JMapPane mapPane = getObserveMapPane(); - mapPane.setDisplayArea(tripArea); + if (! tripArea.isEmpty()) { + JMapPane mapPane = getObserveMapPane(); + mapPane.setDisplayArea(tripArea); + } } public void exportPng() { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.