Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe

Commits:

16 changed files:

Changes:

  • client/configuration/src/main/config/Client.ini
    ... ... @@ -504,36 +504,72 @@ key = map.background.color
    504 504
     type = color
    
    505 505
     defaultValue = java.awt.Color[r=87,g=200,b=255]
    
    506 506
     
    
    507
    +[option mapDateFormat]
    
    508
    +description = observe.config.map.dateFormat
    
    509
    +key = map.date.format
    
    510
    +type = string
    
    511
    +defaultValue = "MM-dd"
    
    512
    +
    
    507 513
     [option mapLayer1]
    
    508 514
     description = observe.config.map.layer1.description
    
    509 515
     key = map.layer1.path
    
    510 516
     type = file
    
    511 517
     defaultValue = ${resources.directory}/map/shapeFiles/continents/GSHHS_l_L1.shp
    
    512 518
     
    
    519
    +[option mapLayer1Color]
    
    520
    +description = observe.config.map.layer1.color
    
    521
    +key = map.layer1.color
    
    522
    +type = color
    
    523
    +defaultValue = java.awt.Color[r=251,g=233,b=215]
    
    524
    +
    
    513 525
     [option mapLayer2]
    
    514 526
     description = observe.config.map.layer2.description
    
    515 527
     key = map.layer2.path
    
    516 528
     type = file
    
    517 529
     defaultValue = ${resources.directory}/map/shapeFiles/continents/GSHHS_l_L6.shp
    
    518 530
     
    
    531
    +[option mapLayer2Color]
    
    532
    +description = observe.config.map.layer2.color
    
    533
    +key = map.layer2.color
    
    534
    +type = color
    
    535
    +defaultValue = java.awt.Color[r=245,g=245,b=255]
    
    536
    +
    
    519 537
     [option mapLayer3]
    
    520 538
     description = observe.config.map.layer3.description
    
    521 539
     key = map.layer3.path
    
    522 540
     type = file
    
    523 541
     defaultValue = ${resources.directory}/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp
    
    524 542
     
    
    543
    +[option mapLayer3Color]
    
    544
    +description = observe.config.map.layer3.color
    
    545
    +key = map.layer3.color
    
    546
    +type = color
    
    547
    +defaultValue = java.awt.Color[r=127,g=183,b=255]
    
    548
    +
    
    525 549
     [option mapLayer4]
    
    526 550
     description = observe.config.map.layer4.description
    
    527 551
     key = map.layer4.path
    
    528 552
     type = file
    
    529 553
     defaultValue = ${resources.directory}/map/shapeFiles/borders/WDBII_border_l_L1.shp
    
    530 554
     
    
    555
    +[option mapLayer4Color]
    
    556
    +description = observe.config.map.layer4.color
    
    557
    +key = map.layer4.color
    
    558
    +type = color
    
    559
    +defaultValue = java.awt.Color[r=251,g=233,b=215]
    
    560
    +
    
    531 561
     [option mapLayer5]
    
    532 562
     description = observe.config.map.layer5.description
    
    533 563
     key = map.layer5.path
    
    534 564
     type = file
    
    535 565
     defaultValue = ${resources.directory}/map/shapeFiles/zee/eez_v11_lowres.shp
    
    536 566
     
    
    567
    +[option mapLayer5Color]
    
    568
    +description = observe.config.map.layer5.color
    
    569
    +key = map.layer5.color
    
    570
    +type = color
    
    571
    +defaultValue = java.awt.Color[r=130,g=244,b=249]
    
    572
    +
    
    537 573
     [option mapLayer6]
    
    538 574
     description = observe.config.map.layer6.description
    
    539 575
     key = map.layer6.path
    
    ... ... @@ -564,10 +600,29 @@ description = observe.config.map.ps.style.description
    564 600
     key = map.ps.style.path
    
    565 601
     type = file
    
    566 602
     defaultValue = ${resources.directory}/map/ps-style.xml
    
    603
    +final = true
    
    604
    +
    
    605
    +[option mapPsStyleObservationsTextSize]
    
    606
    +description = observe.config.map.ps.style.observations.text.size
    
    607
    +key = map.ps.style.observations.text.size
    
    608
    +type = Integer
    
    609
    +defaultValue = 14
    
    610
    +
    
    611
    +[option mapPsStyleObservationsTextColor]
    
    612
    +description = observe.config.map.ps.style.observations.text.color
    
    613
    +key = map.ps.style.observations.text.color
    
    614
    +type = color
    
    615
    +defaultValue = java.awt.Color[r=0,g=0,b=0]
    
    567 616
     
    
    568
    -[option mapPsStyleObservationsColor]
    
    569
    -description = observe.config.map.ps.style.observations.color
    
    570
    -key = map.ps.style.observations.color
    
    617
    +[option mapPsStyleObservationsLineColor]
    
    618
    +description = observe.config.map.ps.style.observations.line.color
    
    619
    +key = map.ps.style.observations.line.color
    
    620
    +type = color
    
    621
    +defaultValue = java.awt.Color[r=255,g=0,b=0]
    
    622
    +
    
    623
    +[option mapPsStyleObservationsPointColor]
    
    624
    +description = observe.config.map.ps.style.observations.point.color
    
    625
    +key = map.ps.style.observations.point.color
    
    571 626
     type = color
    
    572 627
     defaultValue = java.awt.Color[r=0,g=255,b=0]
    
    573 628
     
    
    ... ... @@ -576,6 +631,7 @@ description = observe.config.map.ll.style.description
    576 631
     key = map.ll.style.path
    
    577 632
     type = file
    
    578 633
     defaultValue = ${resources.directory}/map/ll-style.xml
    
    634
    +final = true
    
    579 635
     
    
    580 636
     [option mapLlStyleObservationsLineTripColor]
    
    581 637
     description = observe.config.map.ll.style.observations.line.trip.color
    

  • client/configuration/src/main/i18n/getters/config.getter
    ... ... @@ -42,11 +42,17 @@ observe.config.longlineActivityPairing.maxDistance
    42 42
     observe.config.longlineActivityPairing.maxTime
    
    43 43
     observe.config.longlineLandingPart.defaultWeightMeasureMethod
    
    44 44
     observe.config.map.background.description
    
    45
    +observe.config.map.dateFormat
    
    46
    +observe.config.map.layer1.color
    
    45 47
     observe.config.map.layer1.description
    
    46 48
     observe.config.map.layer10.description
    
    49
    +observe.config.map.layer2.color
    
    47 50
     observe.config.map.layer2.description
    
    51
    +observe.config.map.layer3.color
    
    48 52
     observe.config.map.layer3.description
    
    53
    +observe.config.map.layer4.color
    
    49 54
     observe.config.map.layer4.description
    
    55
    +observe.config.map.layer5.color
    
    50 56
     observe.config.map.layer5.description
    
    51 57
     observe.config.map.layer6.description
    
    52 58
     observe.config.map.layer7.description
    
    ... ... @@ -62,7 +68,10 @@ observe.config.map.ll.style.observations.line.setting.color
    62 68
     observe.config.map.ll.style.observations.line.trip.color
    
    63 69
     observe.config.map.ll.style.observations.point.color
    
    64 70
     observe.config.map.ps.style.description
    
    65
    -observe.config.map.ps.style.observations.color
    
    71
    +observe.config.map.ps.style.observations.line.color
    
    72
    +observe.config.map.ps.style.observations.point.color
    
    73
    +observe.config.map.ps.style.observations.text.color
    
    74
    +observe.config.map.ps.style.observations.text.size
    
    66 75
     observe.config.navigationIconsPath.description
    
    67 76
     observe.config.observation.activitysDetaillees
    
    68 77
     observe.config.observation.fauneAssociee
    

  • client/configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
    ... ... @@ -87,6 +87,7 @@ import java.util.Arrays;
    87 87
     import java.util.Calendar;
    
    88 88
     import java.util.Comparator;
    
    89 89
     import java.util.Date;
    
    90
    +import java.util.LinkedHashMap;
    
    90 91
     import java.util.LinkedList;
    
    91 92
     import java.util.List;
    
    92 93
     import java.util.Locale;
    
    ... ... @@ -417,7 +418,7 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig
    417 418
         }
    
    418 419
     
    
    419 420
         public void detectLocalDataBase() {
    
    420
    -        boolean hasLocalStorage = new File(getLocalDBDirectory(), ClientConfig.DB_NAME).exists();
    
    421
    +        boolean hasLocalStorage = new File(getLocalDBDirectory(), DB_NAME).exists();
    
    421 422
             setLocalStorageExist(hasLocalStorage);
    
    422 423
             if (!hasLocalStorage) {
    
    423 424
                 log.info(t("observe.init.no.local.db.detected", getLocalDBDirectory()));
    
    ... ... @@ -618,6 +619,24 @@ public class ClientConfig extends GeneratedClientConfig implements TripMapConfig
    618 619
             return layers;
    
    619 620
         }
    
    620 621
     
    
    622
    +    @Override
    
    623
    +    public Map<String, String> getVariables(TripMapContentBuilder builder) {
    
    624
    +        Map<String, String> replaceMapping = new LinkedHashMap<>();
    
    625
    +        for (String variableName : builder.getVariableNames()) {
    
    626
    +            Object variable = get(variableName);
    
    627
    +            if (variable == null) {
    
    628
    +                continue;
    
    629
    +            }
    
    630
    +            if (variable instanceof Color) {
    
    631
    +                variable = getColorToHex((Color) variable);
    
    632
    +            } else {
    
    633
    +                variable = String.valueOf(variable);
    
    634
    +            }
    
    635
    +            replaceMapping.put(variableName, variable.toString());
    
    636
    +        }
    
    637
    +        return replaceMapping;
    
    638
    +    }
    
    639
    +
    
    621 640
         public File newBackupDataFile() {
    
    622 641
             return new File(getBackupDirectory(), String.format(BACKUP_DB_PATTERN, getBuildVersion().toString().replaceAll("\\.", "_"), new Date()));
    
    623 642
         }
    

  • client/core/src/main/java/fr/ird/observe/client/main/body/ClientConfigUI.java
    ... ... @@ -301,9 +301,27 @@ public class ClientConfigUI extends JXTitledPanel {
    301 301
                                "ui");
    
    302 302
     
    
    303 303
             helper.addOption(ClientConfigOption.MAP_BACKGROUND_COLOR);
    
    304
    -        ClientConfig.MAP_LAYERS.forEach(helper::addOption);
    
    304
    +        helper.addOption(ClientConfigOption.MAP_LAYER1);
    
    305
    +        helper.addOption(ClientConfigOption.MAP_LAYER1_COLOR);
    
    306
    +        helper.addOption(ClientConfigOption.MAP_LAYER2);
    
    307
    +        helper.addOption(ClientConfigOption.MAP_LAYER2_COLOR);
    
    308
    +        helper.addOption(ClientConfigOption.MAP_LAYER3);
    
    309
    +        helper.addOption(ClientConfigOption.MAP_LAYER3_COLOR);
    
    310
    +        helper.addOption(ClientConfigOption.MAP_LAYER4);
    
    311
    +        helper.addOption(ClientConfigOption.MAP_LAYER4_COLOR);
    
    312
    +        helper.addOption(ClientConfigOption.MAP_LAYER5);
    
    313
    +        helper.addOption(ClientConfigOption.MAP_LAYER5_COLOR);
    
    314
    +        helper.addOption(ClientConfigOption.MAP_LAYER6);
    
    315
    +        helper.addOption(ClientConfigOption.MAP_LAYER7);
    
    316
    +        helper.addOption(ClientConfigOption.MAP_LAYER8);
    
    317
    +        helper.addOption(ClientConfigOption.MAP_LAYER9);
    
    318
    +        helper.addOption(ClientConfigOption.MAP_LAYER10);
    
    319
    +        helper.addOption(ClientConfigOption.MAP_DATE_FORMAT);
    
    305 320
             helper.addOption(ClientConfigOption.MAP_PS_STYLE_FILE);
    
    306
    -        helper.addOption(ClientConfigOption.MAP_PS_STYLE_OBSERVATIONS_COLOR);
    
    321
    +        helper.addOption(ClientConfigOption.MAP_PS_STYLE_OBSERVATIONS_TEXT_COLOR);
    
    322
    +        helper.addOption(ClientConfigOption.MAP_PS_STYLE_OBSERVATIONS_TEXT_SIZE);
    
    323
    +        helper.addOption(ClientConfigOption.MAP_PS_STYLE_OBSERVATIONS_LINE_COLOR);
    
    324
    +        helper.addOption(ClientConfigOption.MAP_PS_STYLE_OBSERVATIONS_POINT_COLOR);
    
    307 325
             helper.addOption(ClientConfigOption.MAP_LL_STYLE_FILE);
    
    308 326
             helper.addOption(ClientConfigOption.MAP_LL_STYLE_OBSERVATIONS_LINE_TRIP_COLOR);
    
    309 327
             helper.addOption(ClientConfigOption.MAP_LL_STYLE_OBSERVATIONS_LINE_SETTING_COLOR);
    
    ... ... @@ -312,8 +330,6 @@ public class ClientConfigUI extends JXTitledPanel {
    312 330
             helper.addOption(ClientConfigOption.MAP_LL_STYLE_LOGBOOK_LINE_TRIP_COLOR);
    
    313 331
             helper.addOption(ClientConfigOption.MAP_LL_STYLE_LOGBOOK_LINE_SETTING_COLOR);
    
    314 332
             helper.addOption(ClientConfigOption.MAP_LL_STYLE_LOGBOOK_LINE_HAULING_COLOR);
    
    315
    -        helper.addOption(ClientConfigOption.MAP_LL_STYLE_LOGBOOK_POINT_COLOR);
    
    316
    -
    
    317 333
         }
    
    318 334
     
    
    319 335
         private void addDataOptions(ObserveConfigUIBuilder helper, ObserveSwingDataSource dataSource) {
    

  • client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/map/TripMapContentBuilderSupport.java
    ... ... @@ -22,7 +22,7 @@ package fr.ird.observe.client.datasource.editor.api.content.data.map;
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.client.configuration.ClientConfig;
    
    25
    +import com.google.common.collect.ImmutableSet;
    
    26 26
     import fr.ird.observe.dto.I18nEnumHelper;
    
    27 27
     import fr.ird.observe.dto.data.TripMapConfig;
    
    28 28
     import fr.ird.observe.dto.data.TripMapConfigDto;
    
    ... ... @@ -55,7 +55,10 @@ import org.geotools.styling.StyledLayerDescriptor;
    55 55
     import org.geotools.styling.UserLayer;
    
    56 56
     import org.locationtech.jts.geom.Coordinate;
    
    57 57
     import org.locationtech.jts.geom.GeometryFactory;
    
    58
    +import org.locationtech.jts.geom.LineString;
    
    58 59
     import org.locationtech.jts.geom.Point;
    
    60
    +import org.locationtech.jts.geom.Polygon;
    
    61
    +import org.opengis.feature.simple.SimpleFeature;
    
    59 62
     import org.opengis.feature.simple.SimpleFeatureType;
    
    60 63
     import org.opengis.referencing.FactoryException;
    
    61 64
     
    
    ... ... @@ -67,8 +70,9 @@ import java.nio.file.Files;
    67 70
     import java.nio.file.Path;
    
    68 71
     import java.text.SimpleDateFormat;
    
    69 72
     import java.util.ArrayList;
    
    73
    +import java.util.Arrays;
    
    74
    +import java.util.Date;
    
    70 75
     import java.util.HashSet;
    
    71
    -import java.util.LinkedHashMap;
    
    72 76
     import java.util.LinkedList;
    
    73 77
     import java.util.List;
    
    74 78
     import java.util.Map;
    
    ... ... @@ -89,33 +93,41 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
    89 93
         protected static final String LOGBOOK_ZONE_LAYER_NAME = "Logbook zone";
    
    90 94
         protected static final String LOGBOOK_LINES_LAYER_NAME = "Logbook lines";
    
    91 95
         protected static final String LOGBOOK_POINTS_LAYER_NAME = "Logbook points";
    
    92
    -
    
    93
    -    protected static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM-dd");
    
    96
    +    protected static final Set<String> DEFAULT_VARIABLE_NAMES = ImmutableSet.of(
    
    97
    +            "mapLayer1Color",
    
    98
    +            "mapLayer2Color",
    
    99
    +            "mapLayer3Color",
    
    100
    +            "mapLayer4Color",
    
    101
    +            "mapLayer5Color"
    
    102
    +    );
    
    94 103
         private static final Logger log = LogManager.getLogger(TripMapContentBuilderSupport.class);
    
    104
    +    protected static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM-dd");
    
    105
    +
    
    95 106
         protected final List<ObserveMapPaneLegendItem> legendItems;
    
    96 107
         protected final List<TripMapPoint> notValidPoints = new LinkedList<>();
    
    97 108
         protected final Set<TripMapPointType> acceptedTripPointTypes;
    
    109
    +    protected final SimpleFeatureBuilder lineBuilder;
    
    110
    +    private final boolean withLabelLine;
    
    111
    +    private final SimpleFeatureBuilder pointBuilder;
    
    98 112
         protected MapContent mapContent;
    
    99 113
         protected StyledLayerDescriptor styledLayerDescriptor;
    
    100
    -
    
    114
    +    private GeometryFactory geometryFactory;
    
    101 115
     
    
    102 116
         public static TripMapContentBuilderSupport of(TripMapConfig config, TripMapConfigDto tripMapConfig, TripMapDto tripMapDto, List<TripMapPoint> tripMapPoints) throws Exception {
    
    103 117
             TripMapContentBuilderSupport builder = (TripMapContentBuilderSupport) config.getTripMapContentBuilders().stream().filter(t -> t.accept(tripMapDto)).findFirst().orElseThrow(IllegalStateException::new);
    
    104 118
             builder.reset();
    
    119
    +        String mapDateFormat = config.getMapDateFormat();
    
    120
    +
    
    121
    +        try {
    
    122
    +            DATE_FORMAT = new SimpleDateFormat(mapDateFormat);
    
    123
    +        } catch (Exception e) {
    
    124
    +            // bad date format
    
    125
    +            log.error(String.format("Bad date format: %s, will use default one: MM-dd", mapDateFormat), e);
    
    126
    +        }
    
    105 127
             File styleFile = builder.getStyleFile(config.getMapDirectory().toPath());
    
    106 128
             String content = Files.readString(styleFile.toPath());
    
    107 129
     
    
    108
    -        Map<String, String> replaceMapping = new LinkedHashMap<>();
    
    109
    -        replaceMapping.put("mapPsStyleObservationsColor", ClientConfig.getColorToHex(config.getMapPsStyleObservationsColor()));
    
    110
    -        replaceMapping.put("mapLlStyleObservationsLineTripColor", ClientConfig.getColorToHex(config.getMapLlStyleObservationsLineTripColor()));
    
    111
    -        replaceMapping.put("mapLlStyleObservationsLineSettingColor", ClientConfig.getColorToHex(config.getMapLlStyleObservationsLineSettingColor()));
    
    112
    -        replaceMapping.put("mapLlStyleObservationsLineHaulingColor", ClientConfig.getColorToHex(config.getMapLlStyleObservationsLineHaulingColor()));
    
    113
    -        replaceMapping.put("mapLlStyleObservationsPointColor", ClientConfig.getColorToHex(config.getMapLlStyleObservationsPointColor()));
    
    114
    -        replaceMapping.put("mapLlStyleLogbookLineTripColor", ClientConfig.getColorToHex(config.getMapLlStyleLogbookLineTripColor()));
    
    115
    -        replaceMapping.put("mapLlStyleLogbookLineSettingColor", ClientConfig.getColorToHex(config.getMapLlStyleLogbookLineSettingColor()));
    
    116
    -        replaceMapping.put("mapLlStyleLogbookLineHaulingColor", ClientConfig.getColorToHex(config.getMapLlStyleLogbookLineHaulingColor()));
    
    117
    -        replaceMapping.put("mapLlStyleLogbookPointColor", ClientConfig.getColorToHex(config.getMapLlStyleLogbookPointColor()));
    
    118
    -
    
    130
    +        Map<String, String> replaceMapping = config.getVariables(builder);
    
    119 131
             for (Map.Entry<String, String> entry : replaceMapping.entrySet()) {
    
    120 132
                 content = content.replaceAll("\\$\\{" + entry.getKey() + "}", entry.getValue());
    
    121 133
             }
    
    ... ... @@ -127,16 +139,74 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
    127 139
             for (File layerFile : config.getMapLayerFiles()) {
    
    128 140
                 builder.addLayer(layerFile);
    
    129 141
             }
    
    130
    -
    
    131 142
             builder.addLines(tripMapConfig, tripMapPoints);
    
    132 143
             builder.addPoints(tripMapConfig, tripMapPoints);
    
    133
    -
    
    134 144
             return builder;
    
    135 145
         }
    
    136 146
     
    
    137
    -    protected TripMapContentBuilderSupport(Set<TripMapPointType> acceptedTripPointTypes) {
    
    147
    +    protected static SimpleFeatureBuilder createLineBuilder(boolean withLabel) {
    
    148
    +        SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    149
    +        lineFeatureTypeBuilder.setName("lineBuilder");
    
    150
    +        try {
    
    151
    +            lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    152
    +        } catch (FactoryException e) {
    
    153
    +            throw new IllegalStateException("Can't decode CRS...", e);
    
    154
    +        }
    
    155
    +        lineFeatureTypeBuilder.add("line", LineString.class);
    
    156
    +        if (withLabel) {
    
    157
    +            lineFeatureTypeBuilder.add("label", String.class);
    
    158
    +        }
    
    159
    +        lineFeatureTypeBuilder.add("type", String.class);
    
    160
    +        return new SimpleFeatureBuilder(lineFeatureTypeBuilder.buildFeatureType());
    
    161
    +
    
    162
    +    }
    
    163
    +
    
    164
    +    protected static SimpleFeatureBuilder createPolygoneBuilder(@SuppressWarnings("SameParameterValue") String name) {
    
    165
    +        SimpleFeatureTypeBuilder polygonFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    166
    +        polygonFeatureTypeBuilder.setName(name);
    
    167
    +        try {
    
    168
    +            polygonFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    169
    +        } catch (FactoryException e) {
    
    170
    +            throw new IllegalStateException("Can't decode CRS...", e);
    
    171
    +        }
    
    172
    +        polygonFeatureTypeBuilder.add("zone", Polygon.class);
    
    173
    +        polygonFeatureTypeBuilder.add("label", String.class);
    
    174
    +        polygonFeatureTypeBuilder.add("type", String.class);
    
    175
    +        SimpleFeatureType polygonFeatureType = polygonFeatureTypeBuilder.buildFeatureType();
    
    176
    +        return new SimpleFeatureBuilder(polygonFeatureType);
    
    177
    +    }
    
    178
    +
    
    179
    +    protected static SimpleFeatureBuilder createPointBuilder() {
    
    180
    +
    
    181
    +        SimpleFeatureTypeBuilder pointFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    182
    +        pointFeatureTypeBuilder.setName("point Builder");
    
    183
    +        try {
    
    184
    +            pointFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    185
    +        } catch (FactoryException e) {
    
    186
    +            throw new IllegalStateException("Can't decode CRS...", e);
    
    187
    +        }
    
    188
    +        pointFeatureTypeBuilder.add("point", Point.class);
    
    189
    +        pointFeatureTypeBuilder.add("label", String.class);
    
    190
    +        pointFeatureTypeBuilder.add("pointType", String.class);
    
    191
    +
    
    192
    +        SimpleFeatureType pointFeatureType = pointFeatureTypeBuilder.buildFeatureType();
    
    193
    +        return new SimpleFeatureBuilder(pointFeatureType);
    
    194
    +    }
    
    195
    +
    
    196
    +    protected static Coordinate[] create(TripMapPoint... points) {
    
    197
    +        return Arrays.stream(points).map(TripMapContentBuilderSupport::create).toArray(Coordinate[]::new);
    
    198
    +    }
    
    199
    +
    
    200
    +    protected static Coordinate create(TripMapPoint point) {
    
    201
    +        return new Coordinate(point.getLongitude(), point.getLatitude());
    
    202
    +    }
    
    203
    +
    
    204
    +    protected TripMapContentBuilderSupport(Set<TripMapPointType> acceptedTripPointTypes, SimpleFeatureBuilder lineBuilder) {
    
    205
    +        this.lineBuilder = lineBuilder;
    
    138 206
             this.legendItems = new ArrayList<>();
    
    139 207
             this.acceptedTripPointTypes = acceptedTripPointTypes;
    
    208
    +        this.withLabelLine = lineBuilder.getFeatureType().getAttributeCount() == 3;
    
    209
    +        this.pointBuilder = createPointBuilder();
    
    140 210
         }
    
    141 211
     
    
    142 212
         @Override
    
    ... ... @@ -174,28 +244,22 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
    174 244
             FileDataStore store = FileDataStoreFinder.getDataStore(layerFile);
    
    175 245
             SimpleFeatureSource featureSource = store.getFeatureSource();
    
    176 246
             Style style = SLD.createSimpleStyle(featureSource.getSchema());
    
    177
    -        style = findStyle(styledLayerDescriptor, store.getNames().get(0).getLocalPart(), null, style);
    
    247
    +        style = findStyle(styledLayerDescriptor, store.getNames().get(0).getLocalPart(), style);
    
    178 248
             Layer layer = new FeatureLayer(featureSource, style, layerFile.getName());
    
    179 249
             mapContent.addLayer(layer);
    
    180 250
         }
    
    181 251
     
    
    182
    -    public void addPoints(List<TripMapPoint> tripMapPoints, String layerName, String notValidPointsLabel) throws FactoryException {
    
    183
    -
    
    184
    -        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    
    185
    -
    
    186
    -        SimpleFeatureTypeBuilder pointFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    187
    -        pointFeatureTypeBuilder.setName("point Builder");
    
    188
    -        pointFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    189
    -        pointFeatureTypeBuilder.add("point", Point.class);
    
    190
    -        pointFeatureTypeBuilder.add("label", String.class);
    
    191
    -        pointFeatureTypeBuilder.add("pointType", String.class);
    
    192
    -
    
    193
    -        SimpleFeatureType pointFeatureType = pointFeatureTypeBuilder.buildFeatureType();
    
    194
    -        SimpleFeatureBuilder pointBuilder = new SimpleFeatureBuilder(pointFeatureType);
    
    252
    +    protected void addPoint(DefaultFeatureCollection pointsFeatures, TripMapPoint tripMapPoint) {
    
    253
    +        Point point = geometryFactory.createPoint(create(tripMapPoint));
    
    254
    +        pointBuilder.add(point);
    
    255
    +        pointBuilder.add(formatDate(tripMapPoint.getTime()));
    
    256
    +        pointBuilder.add(tripMapPoint.getType().name());
    
    257
    +        pointsFeatures.add(pointBuilder.buildFeature(null));
    
    258
    +    }
    
    195 259
     
    
    260
    +    public void addPoints(List<TripMapPoint> tripMapPoints, String layerName, String notValidPointsLabel) {
    
    196 261
             DefaultFeatureCollection pointsFeatures = new DefaultFeatureCollection();
    
    197
    -
    
    198
    -        Style stylePoints = findStyle(styledLayerDescriptor, layerName, null);
    
    262
    +        Style stylePoints = findStyle(styledLayerDescriptor, layerName);
    
    199 263
     
    
    200 264
             Set<TripMapPointType> pointTypeInLegend = new HashSet<>();
    
    201 265
             for (TripMapPoint tripMapPoint : tripMapPoints) {
    
    ... ... @@ -203,27 +267,11 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
    203 267
                     notValidPoints.add(tripMapPoint);
    
    204 268
                     continue;
    
    205 269
                 }
    
    206
    -            Coordinate coordinate = new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude());
    
    270
    +            addPoint(pointsFeatures, tripMapPoint);
    
    207 271
     
    
    272
    +            // register point type in legend
    
    208 273
                 TripMapPointType type = tripMapPoint.getType();
    
    209
    -
    
    210
    -            Point point = geometryFactory.createPoint(coordinate);
    
    211
    -            pointBuilder.add(point);
    
    212
    -            pointBuilder.add(DATE_FORMAT.format(tripMapPoint.getTime()));
    
    213
    -            pointBuilder.add(type.name());
    
    214
    -            pointsFeatures.add(pointBuilder.buildFeature(null));
    
    215
    -
    
    216
    -            // add point in legend
    
    217
    -            if (acceptedTripPointTypes.contains(type) && !pointTypeInLegend.contains(type)) {
    
    218
    -                point = geometryFactory.createPoint(ObserveMapPaneLegendItem.pointCoordinates());
    
    219
    -                pointBuilder.add(point);
    
    220
    -                pointBuilder.add("");
    
    221
    -                pointBuilder.add(type.name());
    
    222
    -                ObserveMapPaneLegendItem legendPoint = new ObserveMapPaneLegendItem(
    
    223
    -                        pointBuilder.buildFeature(null),
    
    224
    -                        stylePoints,
    
    225
    -                        I18nEnumHelper.getLabel(type));
    
    226
    -                legendItems.add(legendPoint);
    
    274
    +            if (acceptedTripPointTypes.contains(type)) {
    
    227 275
                     pointTypeInLegend.add(type);
    
    228 276
                 }
    
    229 277
             }
    
    ... ... @@ -231,21 +279,23 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
    231 279
                 Layer pointsLayer = new FeatureLayer(pointsFeatures, stylePoints, layerName);
    
    232 280
                 mapContent.addLayer(pointsLayer);
    
    233 281
             }
    
    282
    +
    
    283
    +        for (TripMapPointType type : pointTypeInLegend) {
    
    284
    +            addPointLegend(stylePoints, type.name(), I18nEnumHelper.getLabel(type));
    
    285
    +        }
    
    234 286
             if (!notValidPoints.isEmpty()) {
    
    235
    -            Point point = geometryFactory.createPoint(ObserveMapPaneLegendItem.pointCoordinates());
    
    236
    -            pointBuilder.add(point);
    
    237
    -            pointBuilder.add("");
    
    238
    -            pointBuilder.add("notValidPoint");
    
    239
    -            ObserveMapPaneLegendItem legendPoint = new ObserveMapPaneLegendItem(
    
    240
    -                    pointBuilder.buildFeature(null),
    
    241
    -                    stylePoints,
    
    242
    -                    t(notValidPointsLabel, notValidPoints.size()));
    
    243
    -            legendItems.add(legendPoint);
    
    287
    +            addPointLegend(stylePoints, "notValidPoint", t(notValidPointsLabel, notValidPoints.size()));
    
    244 288
             }
    
    245 289
         }
    
    246 290
     
    
    291
    +    protected GeometryFactory getGeometryFactory() {
    
    292
    +        if (geometryFactory == null) {
    
    293
    +            geometryFactory = JTSFactoryFinder.getGeometryFactory();
    
    294
    +        }
    
    295
    +        return geometryFactory;
    
    296
    +    }
    
    247 297
     
    
    248
    -    protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName, Style defaultStyle) {
    
    298
    +    protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, Style defaultStyle) {
    
    249 299
             Optional<StyledLayer> styledLayerOptional = styledLayerDescriptor.layers().stream().filter(input -> input.getName().equals(layerName)).findFirst();
    
    250 300
             Style style = defaultStyle;
    
    251 301
             if (styledLayerOptional.isPresent()) {
    
    ... ... @@ -260,8 +310,11 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
    260 310
                     style = styles[0];
    
    261 311
                 } else {
    
    262 312
                     for (Style styleTmp : styles) {
    
    263
    -                    if (StringUtils.isBlank(styleName) && styleTmp.isDefault() || styleTmp.getName().equals(styleName)) {
    
    313
    +                    StringUtils.isBlank(null);
    
    314
    +                    if (styleTmp.isDefault()) {
    
    264 315
                             style = styleTmp;
    
    316
    +                    } else {
    
    317
    +                        styleTmp.getName();
    
    265 318
                         }
    
    266 319
                     }
    
    267 320
                 }
    
    ... ... @@ -269,12 +322,47 @@ public abstract class TripMapContentBuilderSupport implements TripMapContentBuil
    269 322
             return style;
    
    270 323
         }
    
    271 324
     
    
    272
    -    protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) {
    
    273
    -        Style style = findStyle(styledLayerDescriptor, layerName, styleName, null);
    
    325
    +    protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName) {
    
    326
    +        Style style = findStyle(styledLayerDescriptor, layerName, null);
    
    274 327
             if (style == null) {
    
    275
    -            throw new RuntimeException(String.format("No style found for layer name '%s' and style name '%s'", layerName, styleName));
    
    328
    +            throw new RuntimeException(String.format("No style found for layer name '%s' and style name '%s'", layerName, null));
    
    276 329
             }
    
    277 330
             return style;
    
    278 331
         }
    
    279 332
     
    
    333
    +    protected String formatDate(Date date) {
    
    334
    +        return DATE_FORMAT.format(date);
    
    335
    +    }
    
    336
    +
    
    337
    +    protected void addLine(DefaultFeatureCollection linesFeatures, String lineName, Coordinate[] coordinates, Date date) {
    
    338
    +        LineString line = getGeometryFactory().createLineString(coordinates);
    
    339
    +        lineBuilder.add(line);
    
    340
    +        if (date != null) {
    
    341
    +            lineBuilder.add(formatDate(date));
    
    342
    +        }
    
    343
    +        lineBuilder.add(lineName);
    
    344
    +        linesFeatures.add(lineBuilder.buildFeature(null));
    
    345
    +    }
    
    346
    +
    
    347
    +    protected void addLineLegend(Style styleLines, String legendName, String legendLabel) {
    
    348
    +        LineString line = getGeometryFactory().createLineString(ObserveMapPaneLegendItem.lineCoordinates());
    
    349
    +        lineBuilder.add(line);
    
    350
    +        if (withLabelLine) {
    
    351
    +            lineBuilder.add("");
    
    352
    +        }
    
    353
    +        lineBuilder.add(legendName);
    
    354
    +        SimpleFeature simpleFeature = lineBuilder.buildFeature(null);
    
    355
    +        ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem(simpleFeature, styleLines, legendLabel);
    
    356
    +        legendItems.add(legendTripDay);
    
    357
    +    }
    
    358
    +
    
    359
    +    protected void addPointLegend(Style stylePoints, String legendName, String legendLabel) {
    
    360
    +        Point point = getGeometryFactory().createPoint(ObserveMapPaneLegendItem.pointCoordinates());
    
    361
    +        pointBuilder.add(point);
    
    362
    +        pointBuilder.add("");
    
    363
    +        pointBuilder.add(legendName);
    
    364
    +        SimpleFeature simpleFeature = pointBuilder.buildFeature(null);
    
    365
    +        ObserveMapPaneLegendItem legendPoint = new ObserveMapPaneLegendItem(simpleFeature, stylePoints, legendLabel);
    
    366
    +        legendItems.add(legendPoint);
    
    367
    +    }
    
    280 368
     }

  • client/datasource/editor/ll/pom.xml
    ... ... @@ -18,7 +18,8 @@
    18 18
       <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    19 19
       #L%
    
    20 20
       -->
    
    21
    -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
    21
    +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
    
    22
    +         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
    22 23
       <modelVersion>4.0.0</modelVersion>
    
    23 24
     
    
    24 25
       <parent>
    
    ... ... @@ -231,10 +232,6 @@
    231 232
           <groupId>org.geotools</groupId>
    
    232 233
           <artifactId>gt-render</artifactId>
    
    233 234
         </dependency>
    
    234
    -    <dependency>
    
    235
    -      <groupId>org.geotools</groupId>
    
    236
    -      <artifactId>gt-referencing</artifactId>
    
    237
    -    </dependency>
    
    238 235
         <dependency>
    
    239 236
           <groupId>org.geotools</groupId>
    
    240 237
           <artifactId>gt-opengis</artifactId>
    

  • client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/common/TripMapContentBuilder.java
    ... ... @@ -24,7 +24,6 @@ package fr.ird.observe.client.datasource.editor.ll.data.common;
    24 24
     
    
    25 25
     import com.google.auto.service.AutoService;
    
    26 26
     import com.google.common.collect.ImmutableSet;
    
    27
    -import fr.ird.observe.client.datasource.editor.api.content.data.map.ObserveMapPaneLegendItem;
    
    28 27
     import fr.ird.observe.client.datasource.editor.api.content.data.map.TripMapContentBuilderSupport;
    
    29 28
     import fr.ird.observe.dto.data.TripAware;
    
    30 29
     import fr.ird.observe.dto.data.TripMapConfigDto;
    
    ... ... @@ -33,21 +32,16 @@ import fr.ird.observe.dto.data.TripMapPoint;
    33 32
     import fr.ird.observe.dto.data.TripMapPointType;
    
    34 33
     import org.geotools.feature.DefaultFeatureCollection;
    
    35 34
     import org.geotools.feature.simple.SimpleFeatureBuilder;
    
    36
    -import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
    
    37
    -import org.geotools.geometry.jts.JTSFactoryFinder;
    
    38 35
     import org.geotools.map.FeatureLayer;
    
    39 36
     import org.geotools.map.Layer;
    
    40
    -import org.geotools.referencing.CRS;
    
    41 37
     import org.geotools.styling.Style;
    
    42 38
     import org.locationtech.jts.geom.Coordinate;
    
    43
    -import org.locationtech.jts.geom.GeometryFactory;
    
    44
    -import org.locationtech.jts.geom.LineString;
    
    45 39
     import org.locationtech.jts.geom.Polygon;
    
    46 40
     import org.opengis.feature.simple.SimpleFeature;
    
    47
    -import org.opengis.feature.simple.SimpleFeatureType;
    
    48 41
     
    
    49 42
     import java.util.LinkedList;
    
    50 43
     import java.util.List;
    
    44
    +import java.util.Set;
    
    51 45
     import java.util.stream.Collectors;
    
    52 46
     
    
    53 47
     import static io.ultreia.java4all.i18n.I18n.n;
    
    ... ... @@ -62,6 +56,8 @@ import static io.ultreia.java4all.i18n.I18n.t;
    62 56
     @AutoService(fr.ird.observe.dto.data.TripMapContentBuilder.class)
    
    63 57
     public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    
    64 58
     
    
    59
    +    private final SimpleFeatureBuilder polygonBuilder;
    
    60
    +
    
    65 61
         public TripMapContentBuilder() {
    
    66 62
             super(ImmutableSet.of(
    
    67 63
                     TripMapPointType.llActivityObs,
    
    ... ... @@ -76,7 +72,22 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    76 72
                     TripMapPointType.llActivityLogbookWithSettingEnd,
    
    77 73
                     TripMapPointType.llActivityLogbookWithHaulingStart,
    
    78 74
                     TripMapPointType.llActivityLogbookWithHaulingEnd
    
    79
    -        ));
    
    75
    +        ), createLineBuilder(false));
    
    76
    +        polygonBuilder = createPolygoneBuilder("longlineFishingZoneBuilder");
    
    77
    +    }
    
    78
    +
    
    79
    +    @Override
    
    80
    +    public Set<String> getVariableNames() {
    
    81
    +        return ImmutableSet.<String>builder().addAll(DEFAULT_VARIABLE_NAMES)
    
    82
    +                .add("mapLlStyleObservationsLineTripColor")
    
    83
    +                .add("mapLlStyleObservationsLineSettingColor")
    
    84
    +                .add("mapLlStyleObservationsLineHaulingColor")
    
    85
    +                .add("mapLlStyleObservationsPointColor")
    
    86
    +                .add("mapLlStyleLogbookLineTripColor")
    
    87
    +                .add("mapLlStyleLogbookLineSettingColor")
    
    88
    +                .add("mapLlStyleLogbookLineHaulingColor")
    
    89
    +                .add("mapLlStyleLogbookPointColor")
    
    90
    +                .build();
    
    80 91
         }
    
    81 92
     
    
    82 93
         @Override
    
    ... ... @@ -90,7 +101,7 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    90 101
         }
    
    91 102
     
    
    92 103
         @Override
    
    93
    -    public void addLines(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) throws Exception {
    
    104
    +    public void addLines(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) {
    
    94 105
             if (tripMapConfig.isAddObservations()) {
    
    95 106
                 addObservationFishingZone(tripMapPoints);
    
    96 107
                 addObservationLine(tripMapPoints);
    
    ... ... @@ -102,7 +113,7 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    102 113
         }
    
    103 114
     
    
    104 115
         @Override
    
    105
    -    public void addPoints(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) throws Exception {
    
    116
    +    public void addPoints(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) {
    
    106 117
             if (tripMapConfig.isAddObservations()) {
    
    107 118
                 addPoints(tripMapPoints.stream().filter(f -> f.getType().isTrip() || f.getType().isObs()).collect(Collectors.toList()), OBSERVATION_POINTS_LAYER_NAME, n("observe.ui.datasource.editor.content.map.observation.points.not.valid"));
    
    108 119
             }
    
    ... ... @@ -111,21 +122,8 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    111 122
             }
    
    112 123
         }
    
    113 124
     
    
    114
    -    private void addObservationFishingZone(List<TripMapPoint> tripMapPoints) throws Exception {
    
    115
    -        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    
    116
    -
    
    117
    -        SimpleFeatureTypeBuilder polygonFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    118
    -        polygonFeatureTypeBuilder.setName("longlineFishingZoneBuilder");
    
    119
    -        polygonFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    120
    -        polygonFeatureTypeBuilder.add("zone", Polygon.class);
    
    121
    -        polygonFeatureTypeBuilder.add("label", String.class);
    
    122
    -        polygonFeatureTypeBuilder.add("type", String.class);
    
    123
    -
    
    124
    -        SimpleFeatureType polygonFeatureType = polygonFeatureTypeBuilder.buildFeatureType();
    
    125
    -        SimpleFeatureBuilder polygonBuilder = new SimpleFeatureBuilder(polygonFeatureType);
    
    126
    -
    
    125
    +    private void addObservationFishingZone(List<TripMapPoint> tripMapPoints) {
    
    127 126
             DefaultFeatureCollection polygonsFeatures = new DefaultFeatureCollection();
    
    128
    -
    
    129 127
             for (int indexPoint = 3; indexPoint < tripMapPoints.size(); indexPoint++) {
    
    130 128
                 TripMapPoint tripMapPoint = tripMapPoints.get(indexPoint);
    
    131 129
                 TripMapPoint tripMapPoint1 = tripMapPoints.get(indexPoint - 1);
    
    ... ... @@ -138,48 +136,18 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    138 136
                         && tripMapPoint1.getType().equals(TripMapPointType.llActivityObsWithHaulingStart)
    
    139 137
                         && tripMapPoint2.getType().equals(TripMapPointType.llActivityObsWithSettingEnd)
    
    140 138
                         && tripMapPoint3.getType().equals(TripMapPointType.llActivityObsWithSettingStart)) {
    
    141
    -
    
    142
    -                Coordinate[] coordinates = {
    
    143
    -                        new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude()),
    
    144
    -                        new Coordinate(tripMapPoint2.getLongitude(), tripMapPoint2.getLatitude()),
    
    145
    -                        new Coordinate(tripMapPoint1.getLongitude(), tripMapPoint1.getLatitude()),
    
    146
    -                        new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
    
    147
    -                        new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude())
    
    148
    -                };
    
    149
    -
    
    150
    -                Polygon polygon = geometryFactory.createPolygon(coordinates);
    
    151
    -                //polygon = (Polygon) polygon.convexHull(); // permet de transformer un poliqgone croisé en polygon convex
    
    152
    -                polygonBuilder.add(polygon);
    
    153
    -                polygonBuilder.add(DATE_FORMAT.format(tripMapPoint3.getTime()));
    
    154
    -                polygonBuilder.add("longlineFishingZone");
    
    155
    -                SimpleFeature feature = polygonBuilder.buildFeature(null);
    
    156
    -                polygonsFeatures.add(feature);
    
    157
    -
    
    139
    +                createZone(polygonsFeatures, tripMapPoint, tripMapPoint1, tripMapPoint2, tripMapPoint3);
    
    158 140
                 }
    
    159 141
             }
    
    160
    -
    
    161 142
             if (!polygonsFeatures.isEmpty()) {
    
    162
    -            Style styleLines = findStyle(styledLayerDescriptor, OBSERVATION_ZONE_LAYER_NAME, null);
    
    143
    +            Style styleLines = findStyle(styledLayerDescriptor, OBSERVATION_ZONE_LAYER_NAME);
    
    163 144
                 Layer layerLines = new FeatureLayer(polygonsFeatures, styleLines, OBSERVATION_ZONE_LAYER_NAME);
    
    164 145
                 mapContent.addLayer(layerLines);
    
    165 146
             }
    
    166 147
         }
    
    167 148
     
    
    168
    -    private void addLogbookFishingZone(List<TripMapPoint> tripMapPoints) throws Exception {
    
    169
    -        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    
    170
    -
    
    171
    -        SimpleFeatureTypeBuilder polygonFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    172
    -        polygonFeatureTypeBuilder.setName("longlineFishingZoneBuilder");
    
    173
    -        polygonFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    174
    -        polygonFeatureTypeBuilder.add("zone", Polygon.class);
    
    175
    -        polygonFeatureTypeBuilder.add("label", String.class);
    
    176
    -        polygonFeatureTypeBuilder.add("type", String.class);
    
    177
    -
    
    178
    -        SimpleFeatureType polygonFeatureType = polygonFeatureTypeBuilder.buildFeatureType();
    
    179
    -        SimpleFeatureBuilder polygonBuilder = new SimpleFeatureBuilder(polygonFeatureType);
    
    180
    -
    
    149
    +    private void addLogbookFishingZone(List<TripMapPoint> tripMapPoints) {
    
    181 150
             DefaultFeatureCollection polygonsFeatures = new DefaultFeatureCollection();
    
    182
    -
    
    183 151
             for (int indexPoint = 3; indexPoint < tripMapPoints.size(); indexPoint++) {
    
    184 152
                 TripMapPoint tripMapPoint = tripMapPoints.get(indexPoint);
    
    185 153
                 TripMapPoint tripMapPoint1 = tripMapPoints.get(indexPoint - 1);
    
    ... ... @@ -192,149 +160,58 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    192 160
                         && tripMapPoint1.getType().equals(TripMapPointType.llActivityLogbookWithHaulingStart)
    
    193 161
                         && tripMapPoint2.getType().equals(TripMapPointType.llActivityLogbookWithSettingEnd)
    
    194 162
                         && tripMapPoint3.getType().equals(TripMapPointType.llActivityLogbookWithSettingStart)) {
    
    195
    -
    
    196
    -                Coordinate[] coordinates = {
    
    197
    -                        new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude()),
    
    198
    -                        new Coordinate(tripMapPoint2.getLongitude(), tripMapPoint2.getLatitude()),
    
    199
    -                        new Coordinate(tripMapPoint1.getLongitude(), tripMapPoint1.getLatitude()),
    
    200
    -                        new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
    
    201
    -                        new Coordinate(tripMapPoint3.getLongitude(), tripMapPoint3.getLatitude())
    
    202
    -                };
    
    203
    -
    
    204
    -
    
    205
    -                Polygon polygon = geometryFactory.createPolygon(coordinates);
    
    206
    -                //polygon = (Polygon) polygon.convexHull(); // permet de transformer un poliqgone croisé en polygon convex
    
    207
    -                polygonBuilder.add(polygon);
    
    208
    -                polygonBuilder.add(DATE_FORMAT.format(tripMapPoint3.getTime()));
    
    209
    -                polygonBuilder.add("longlineFishingZone");
    
    210
    -                SimpleFeature feature = polygonBuilder.buildFeature(null);
    
    211
    -                polygonsFeatures.add(feature);
    
    212
    -
    
    163
    +                createZone(polygonsFeatures, tripMapPoint, tripMapPoint1, tripMapPoint2, tripMapPoint3);
    
    213 164
                 }
    
    214 165
             }
    
    215
    -
    
    216 166
             if (!polygonsFeatures.isEmpty()) {
    
    217
    -            Style styleLines = findStyle(styledLayerDescriptor, LOGBOOK_ZONE_LAYER_NAME, null);
    
    167
    +            Style styleLines = findStyle(styledLayerDescriptor, LOGBOOK_ZONE_LAYER_NAME);
    
    218 168
                 Layer layerLines = new FeatureLayer(polygonsFeatures, styleLines, LOGBOOK_ZONE_LAYER_NAME);
    
    219 169
                 mapContent.addLayer(layerLines);
    
    220 170
             }
    
    221 171
         }
    
    222 172
     
    
    223
    -    private void addObservationLine(List<TripMapPoint> tripMapPoints) throws Exception {
    
    224
    -        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    
    225
    -
    
    226
    -        SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    227
    -        lineFeatureTypeBuilder.setName("longlineSettingBuilder");
    
    228
    -        lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    229
    -        lineFeatureTypeBuilder.add("line", LineString.class);
    
    230
    -        lineFeatureTypeBuilder.add("type", String.class);
    
    231
    -
    
    232
    -        SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType();
    
    233
    -        SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType);
    
    234
    -
    
    173
    +    private void addObservationLine(List<TripMapPoint> tripMapPoints) {
    
    235 174
             DefaultFeatureCollection linesFeatures = new DefaultFeatureCollection();
    
    236
    -
    
    237 175
             List<Coordinate> defaultLineCoordinates = new LinkedList<>();
    
    238 176
             boolean found = false;
    
    239 177
             for (int indexPoint = 0; indexPoint < tripMapPoints.size(); indexPoint++) {
    
    240 178
                 TripMapPoint tripMapPoint = tripMapPoints.get(indexPoint);
    
    241 179
                 TripMapPointType pointType = tripMapPoint.getType();
    
    242 180
                 if (tripMapPoint.isValid() && indexPoint > 1) {
    
    243
    -
    
    244 181
                     TripMapPoint previousTripMapPoint = tripMapPoints.get(indexPoint - 1);
    
    245 182
                     TripMapPointType previousTripMapPointType = previousTripMapPoint.getType();
    
    246 183
                     if (previousTripMapPoint.isValid()) {
    
    247
    -                    if (
    
    248
    -                            pointType.equals(TripMapPointType.llActivityObsWithSettingEnd) && previousTripMapPointType.equals(TripMapPointType.llActivityObsWithSettingStart)
    
    249
    -                                    ||
    
    250
    -                                    pointType.equals(TripMapPointType.llActivityObsWithHaulingEnd) && previousTripMapPointType.equals(TripMapPointType.llActivityObsWithHaulingStart)) {
    
    251
    -
    
    184
    +                    if (pointType.equals(TripMapPointType.llActivityObsWithSettingEnd) && previousTripMapPointType.equals(TripMapPointType.llActivityObsWithSettingStart)
    
    185
    +                            || pointType.equals(TripMapPointType.llActivityObsWithHaulingEnd) && previousTripMapPointType.equals(TripMapPointType.llActivityObsWithHaulingStart)) {
    
    252 186
                             found = true;
    
    253
    -                        Coordinate[] coordinates = {
    
    254
    -                                new Coordinate(previousTripMapPoint.getLongitude(), previousTripMapPoint.getLatitude()),
    
    255
    -                                new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
    
    256
    -                        };
    
    257
    -
    
    187
    +                        Coordinate[] coordinates = create(previousTripMapPoint, tripMapPoint);
    
    258 188
                             boolean setting = pointType.equals(TripMapPointType.llActivityObsWithSettingEnd);
    
    259
    -                        LineString lineString = geometryFactory.createLineString(coordinates);
    
    260
    -                        lineBuilder.add(lineString);
    
    261
    -                        lineBuilder.add(setting ? "setting" : "hauling");
    
    262
    -                        SimpleFeature feature = lineBuilder.buildFeature(null);
    
    263
    -                        linesFeatures.add(feature);
    
    264
    -
    
    189
    +                        addLine(linesFeatures, setting ? "setting" : "hauling", coordinates, null);
    
    265 190
                             defaultLineCoordinates.clear();
    
    266 191
                         }
    
    267 192
                     }
    
    268 193
                 }
    
    269
    -
    
    270
    -            if (tripMapPoint.isValid() && !(pointType.equals(TripMapPointType.llActivityObsWithSettingEnd)
    
    271
    -                    || pointType.equals(TripMapPointType.llActivityObsWithHaulingStart))) {
    
    272
    -
    
    273
    -                defaultLineCoordinates.add(new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()));
    
    274
    -
    
    194
    +            if (tripMapPoint.isValid() && !(pointType.equals(TripMapPointType.llActivityObsWithSettingEnd) || pointType.equals(TripMapPointType.llActivityObsWithHaulingStart))) {
    
    195
    +                defaultLineCoordinates.add(create(tripMapPoint));
    
    275 196
                 }
    
    276
    -
    
    277
    -            if ((pointType.equals(TripMapPointType.llActivityObsWithSettingStart)
    
    278
    -                    || indexPoint == tripMapPoints.size() - 1) && defaultLineCoordinates.size() > 1) {
    
    279
    -
    
    280
    -                LineString lineString = geometryFactory.createLineString(defaultLineCoordinates.toArray(new Coordinate[0]));
    
    281
    -                lineBuilder.add(lineString);
    
    282
    -                lineBuilder.add("trip");
    
    283
    -                SimpleFeature feature = lineBuilder.buildFeature(null);
    
    284
    -                linesFeatures.add(feature);
    
    285
    -
    
    197
    +            if ((pointType.equals(TripMapPointType.llActivityObsWithSettingStart) || indexPoint == tripMapPoints.size() - 1) && defaultLineCoordinates.size() > 1) {
    
    198
    +                addLine(linesFeatures, "trip", defaultLineCoordinates.toArray(new Coordinate[0]), null);
    
    286 199
                     defaultLineCoordinates.clear();
    
    287
    -
    
    288 200
                 }
    
    289
    -
    
    290
    -
    
    291 201
             }
    
    292
    -
    
    293
    -        Style styleLines = findStyle(styledLayerDescriptor, OBSERVATION_LINES_LAYER_NAME, null);
    
    202
    +        Style styleLines = findStyle(styledLayerDescriptor, OBSERVATION_LINES_LAYER_NAME);
    
    294 203
             if (!linesFeatures.isEmpty()) {
    
    295 204
                 Layer layerLines = new FeatureLayer(linesFeatures, styleLines, OBSERVATION_LINES_LAYER_NAME);
    
    296 205
                 mapContent.addLayer(layerLines);
    
    297 206
             }
    
    298
    -
    
    299 207
             if (found) {
    
    300
    -            // add line in legend
    
    301
    -            LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates());
    
    302
    -            lineBuilder.add(line);
    
    303
    -            lineBuilder.add("setting");
    
    304
    -
    
    305
    -            ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem(
    
    306
    -                    lineBuilder.buildFeature(null),
    
    307
    -                    styleLines,
    
    308
    -                    t("observe.ui.datasource.editor.content.map.legend.obs.setting"));
    
    309
    -            legendItems.add(legendTripDay);
    
    310
    -
    
    311
    -            line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates());
    
    312
    -            lineBuilder.add(line);
    
    313
    -            lineBuilder.add("hauling");
    
    314
    -
    
    315
    -            legendTripDay = new ObserveMapPaneLegendItem(
    
    316
    -                    lineBuilder.buildFeature(null),
    
    317
    -                    styleLines,
    
    318
    -                    t("observe.ui.datasource.editor.content.map.legend.obs.hauling"));
    
    319
    -            legendItems.add(legendTripDay);
    
    208
    +            addLineLegend(styleLines, "setting", t("observe.ui.datasource.editor.content.map.legend.obs.setting"));
    
    209
    +            addLineLegend(styleLines, "hauling", t("observe.ui.datasource.editor.content.map.legend.obs.hauling"));
    
    320 210
             }
    
    321
    -
    
    322 211
         }
    
    323 212
     
    
    324
    -    private void addLogbookLine(List<TripMapPoint> tripMapPoints) throws Exception {
    
    325
    -        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    
    326
    -
    
    327
    -        SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    328
    -        lineFeatureTypeBuilder.setName("longlineSettingBuilder");
    
    329
    -        lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    330
    -        lineFeatureTypeBuilder.add("line", LineString.class);
    
    331
    -        lineFeatureTypeBuilder.add("type", String.class);
    
    332
    -
    
    333
    -        SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType();
    
    334
    -        SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType);
    
    335
    -
    
    213
    +    private void addLogbookLine(List<TripMapPoint> tripMapPoints) {
    
    336 214
             DefaultFeatureCollection linesFeatures = new DefaultFeatureCollection();
    
    337
    -
    
    338 215
             List<Coordinate> defaultLineCoordinates = new LinkedList<>();
    
    339 216
             boolean found = false;
    
    340 217
             for (int indexPoint = 0; indexPoint < tripMapPoints.size(); indexPoint++) {
    
    ... ... @@ -349,72 +226,43 @@ public class TripMapContentBuilder extends TripMapContentBuilderSupport {
    349 226
                                 || tripMapPointType.equals(TripMapPointType.llActivityLogbookWithHaulingEnd)
    
    350 227
                                 && previousTripMapPointType.equals(TripMapPointType.llActivityLogbookWithHaulingStart)) {
    
    351 228
                             found = true;
    
    352
    -                        Coordinate[] coordinates = {
    
    353
    -                                new Coordinate(previousTripMapPoint.getLongitude(), previousTripMapPoint.getLatitude()),
    
    354
    -                                new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()),
    
    355
    -                        };
    
    356
    -
    
    229
    +                        Coordinate[] coordinates = create(previousTripMapPoint, tripMapPoint);
    
    357 230
                             boolean setting = tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingEnd);
    
    358
    -                        LineString lineString = geometryFactory.createLineString(coordinates);
    
    359
    -                        lineBuilder.add(lineString);
    
    360
    -                        lineBuilder.add(setting ? "setting" : "hauling");
    
    361
    -                        SimpleFeature feature = lineBuilder.buildFeature(null);
    
    362
    -                        linesFeatures.add(feature);
    
    363
    -
    
    231
    +                        addLine(linesFeatures, setting ? "setting" : "hauling", coordinates, null);
    
    364 232
                             defaultLineCoordinates.clear();
    
    365 233
                         }
    
    366 234
                     }
    
    367 235
                 }
    
    368
    -            if (tripMapPoint.isValid() &&
    
    369
    -                    !(tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingEnd) || tripMapPointType.equals(TripMapPointType.llActivityLogbookWithHaulingStart))) {
    
    370
    -                defaultLineCoordinates.add(new Coordinate(tripMapPoint.getLongitude(), tripMapPoint.getLatitude()));
    
    371
    -
    
    236
    +            if (tripMapPoint.isValid() && !(tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingEnd) || tripMapPointType.equals(TripMapPointType.llActivityLogbookWithHaulingStart))) {
    
    237
    +                defaultLineCoordinates.add(create(tripMapPoint));
    
    372 238
                 }
    
    373
    -
    
    374
    -            if ((tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingStart)
    
    375
    -                    || indexPoint == tripMapPoints.size() - 1) && defaultLineCoordinates.size() > 1) {
    
    376
    -
    
    377
    -                LineString lineString = geometryFactory.createLineString(defaultLineCoordinates.toArray(new Coordinate[0]));
    
    378
    -                lineBuilder.add(lineString);
    
    379
    -                lineBuilder.add("trip");
    
    380
    -                SimpleFeature feature = lineBuilder.buildFeature(null);
    
    381
    -                linesFeatures.add(feature);
    
    382
    -
    
    239
    +            if ((tripMapPointType.equals(TripMapPointType.llActivityLogbookWithSettingStart) || indexPoint == tripMapPoints.size() - 1) && defaultLineCoordinates.size() > 1) {
    
    240
    +                addLine(linesFeatures, "trip", defaultLineCoordinates.toArray(new Coordinate[0]), null);
    
    383 241
                     defaultLineCoordinates.clear();
    
    384
    -
    
    385 242
                 }
    
    386
    -
    
    387
    -
    
    243
    +        }
    
    244
    +        Style styleLines = findStyle(styledLayerDescriptor, LOGBOOK_LINES_LAYER_NAME);
    
    245
    +        if (!linesFeatures.isEmpty()) {
    
    246
    +            Layer layerLines = new FeatureLayer(linesFeatures, styleLines, LOGBOOK_LINES_LAYER_NAME);
    
    247
    +            mapContent.addLayer(layerLines);
    
    388 248
             }
    
    389 249
             if (found) {
    
    390
    -            Style styleLines = findStyle(styledLayerDescriptor, LOGBOOK_LINES_LAYER_NAME, null);
    
    391
    -            if (!linesFeatures.isEmpty()) {
    
    392
    -                Layer layerLines = new FeatureLayer(linesFeatures, styleLines, LOGBOOK_LINES_LAYER_NAME);
    
    393
    -                mapContent.addLayer(layerLines);
    
    394
    -            }
    
    395
    -
    
    396
    -            // add line in legend
    
    397
    -            LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates());
    
    398
    -            lineBuilder.add(line);
    
    399
    -            lineBuilder.add("setting");
    
    400
    -
    
    401
    -            ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem(
    
    402
    -                    lineBuilder.buildFeature(null),
    
    403
    -                    styleLines,
    
    404
    -                    t("observe.ui.datasource.editor.content.map.legend.logbook.setting"));
    
    405
    -            legendItems.add(legendTripDay);
    
    406
    -
    
    407
    -            line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates());
    
    408
    -            lineBuilder.add(line);
    
    409
    -            lineBuilder.add("hauling");
    
    410
    -
    
    411
    -            legendTripDay = new ObserveMapPaneLegendItem(
    
    412
    -                    lineBuilder.buildFeature(null),
    
    413
    -                    styleLines,
    
    414
    -                    t("observe.ui.datasource.editor.content.map.legend.logbook.hauling"));
    
    415
    -            legendItems.add(legendTripDay);
    
    250
    +            addLineLegend(styleLines, "setting", t("observe.ui.datasource.editor.content.map.legend.logbook.setting"));
    
    251
    +            addLineLegend(styleLines, "hauling", t("observe.ui.datasource.editor.content.map.legend.logbook.hauling"));
    
    416 252
             }
    
    417 253
         }
    
    418 254
     
    
    419
    -
    
    255
    +    protected void createZone(DefaultFeatureCollection polygonsFeatures,
    
    256
    +                              TripMapPoint tripMapPoint,
    
    257
    +                              TripMapPoint tripMapPoint1,
    
    258
    +                              TripMapPoint tripMapPoint2,
    
    259
    +                              TripMapPoint tripMapPoint3) {
    
    260
    +        Coordinate[] coordinates = create(tripMapPoint3, tripMapPoint2, tripMapPoint1, tripMapPoint, tripMapPoint3);
    
    261
    +        Polygon polygon = getGeometryFactory().createPolygon(coordinates);
    
    262
    +        polygonBuilder.add(polygon);
    
    263
    +        polygonBuilder.add(formatDate(tripMapPoint3.getTime()));
    
    264
    +        polygonBuilder.add("longlineFishingZone");
    
    265
    +        SimpleFeature feature = polygonBuilder.buildFeature(null);
    
    266
    +        polygonsFeatures.add(feature);
    
    267
    +    }
    
    420 268
     }

  • client/datasource/editor/ll/src/main/resources/map/ll-style.xml
    ... ... @@ -654,13 +654,13 @@
    654 654
       </NamedLayer>
    
    655 655
     
    
    656 656
       <NamedLayer>
    
    657
    -    <Name>World_EEZ_v8_2014</Name>
    
    657
    +    <Name>GSHHS_l_L1</Name>
    
    658 658
         <UserStyle>
    
    659 659
           <FeatureTypeStyle>
    
    660 660
             <Rule>
    
    661 661
               <PolygonSymbolizer>
    
    662 662
                 <Fill>
    
    663
    -              <CssParameter name="fill">#82F4F9</CssParameter>
    
    663
    +              <CssParameter name="fill">${mapLayer1Color}</CssParameter>
    
    664 664
                 </Fill>
    
    665 665
                 <Stroke>
    
    666 666
                   <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -673,13 +673,13 @@
    673 673
       </NamedLayer>
    
    674 674
     
    
    675 675
       <NamedLayer>
    
    676
    -    <Name>GSHHS_l_L1</Name>
    
    676
    +    <Name>GSHHS_l_L6</Name>
    
    677 677
         <UserStyle>
    
    678 678
           <FeatureTypeStyle>
    
    679 679
             <Rule>
    
    680 680
               <PolygonSymbolizer>
    
    681 681
                 <Fill>
    
    682
    -              <CssParameter name="fill">#FBE9D7</CssParameter>
    
    682
    +              <CssParameter name="fill">${mapLayer2Color}</CssParameter>
    
    683 683
                 </Fill>
    
    684 684
                 <Stroke>
    
    685 685
                   <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -692,13 +692,32 @@
    692 692
       </NamedLayer>
    
    693 693
     
    
    694 694
       <NamedLayer>
    
    695
    -    <Name>GSHHS_l_L6</Name>
    
    695
    +    <Name>GSHHS_l_L2</Name>
    
    696
    +    <UserStyle>
    
    697
    +      <FeatureTypeStyle>
    
    698
    +        <Rule>
    
    699
    +          <PolygonSymbolizer>
    
    700
    +            <Fill>
    
    701
    +              <CssParameter name="fill">${mapLayer3Color}</CssParameter>
    
    702
    +            </Fill>
    
    703
    +            <Stroke>
    
    704
    +              <!--              <CssParameter name="stroke">#7FB7FF</CssParameter>-->
    
    705
    +              <CssParameter name="stroke">${mapLayer3Color}</CssParameter>
    
    706
    +              <CssParameter name="stroke-width">1</CssParameter>
    
    707
    +            </Stroke>
    
    708
    +          </PolygonSymbolizer>
    
    709
    +        </Rule>
    
    710
    +      </FeatureTypeStyle>
    
    711
    +    </UserStyle>
    
    712
    +  </NamedLayer>
    
    713
    +  <NamedLayer>
    
    714
    +    <Name>WDBII_border_l_L1</Name>
    
    696 715
         <UserStyle>
    
    697 716
           <FeatureTypeStyle>
    
    698 717
             <Rule>
    
    699 718
               <PolygonSymbolizer>
    
    700 719
                 <Fill>
    
    701
    -              <CssParameter name="fill">#F5F5FF</CssParameter>
    
    720
    +              <CssParameter name="fill">${mapLayer4Color}</CssParameter>
    
    702 721
                 </Fill>
    
    703 722
                 <Stroke>
    
    704 723
                   <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -711,16 +730,16 @@
    711 730
       </NamedLayer>
    
    712 731
     
    
    713 732
       <NamedLayer>
    
    714
    -    <Name>GSHHS_l_L2</Name>
    
    733
    +    <Name>eez_v11_lowres</Name>
    
    715 734
         <UserStyle>
    
    716 735
           <FeatureTypeStyle>
    
    717 736
             <Rule>
    
    718 737
               <PolygonSymbolizer>
    
    719 738
                 <Fill>
    
    720
    -              <CssParameter name="fill">#7FB7FF</CssParameter>
    
    739
    +              <CssParameter name="fill">${mapLayer5Color}</CssParameter>
    
    721 740
                 </Fill>
    
    722 741
                 <Stroke>
    
    723
    -              <CssParameter name="stroke">#7FB7FF</CssParameter>
    
    742
    +              <CssParameter name="stroke">#000000</CssParameter>
    
    724 743
                   <CssParameter name="stroke-width">1</CssParameter>
    
    725 744
                 </Stroke>
    
    726 745
               </PolygonSymbolizer>
    

  • client/datasource/editor/ps/pom.xml
    ... ... @@ -18,7 +18,8 @@
    18 18
       <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    19 19
       #L%
    
    20 20
       -->
    
    21
    -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
    21
    +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
    
    22
    +         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
    22 23
       <modelVersion>4.0.0</modelVersion>
    
    23 24
     
    
    24 25
       <parent>
    
    ... ... @@ -231,14 +232,6 @@
    231 232
           <groupId>org.geotools</groupId>
    
    232 233
           <artifactId>gt-render</artifactId>
    
    233 234
         </dependency>
    
    234
    -    <dependency>
    
    235
    -      <groupId>org.geotools</groupId>
    
    236
    -      <artifactId>gt-referencing</artifactId>
    
    237
    -    </dependency>
    
    238
    -    <dependency>
    
    239
    -      <groupId>org.geotools</groupId>
    
    240
    -      <artifactId>gt-opengis</artifactId>
    
    241
    -    </dependency>
    
    242 235
         <dependency>
    
    243 236
           <groupId>org.geotools</groupId>
    
    244 237
           <artifactId>gt-shapefile</artifactId>
    

  • client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/common/TripMapContentBuilder.java
    ... ... @@ -24,7 +24,6 @@ package fr.ird.observe.client.datasource.editor.ps.data.common;
    24 24
     
    
    25 25
     import com.google.auto.service.AutoService;
    
    26 26
     import com.google.common.collect.ImmutableSet;
    
    27
    -import fr.ird.observe.client.datasource.editor.api.content.data.map.ObserveMapPaneLegendItem;
    
    28 27
     import fr.ird.observe.dto.data.TripAware;
    
    29 28
     import fr.ird.observe.dto.data.TripMapConfigDto;
    
    30 29
     import fr.ird.observe.dto.data.TripMapDto;
    
    ... ... @@ -32,23 +31,14 @@ import fr.ird.observe.dto.data.TripMapPoint;
    32 31
     import fr.ird.observe.dto.data.TripMapPointType;
    
    33 32
     import org.apache.commons.lang3.time.DateUtils;
    
    34 33
     import org.geotools.feature.DefaultFeatureCollection;
    
    35
    -import org.geotools.feature.simple.SimpleFeatureBuilder;
    
    36
    -import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
    
    37
    -import org.geotools.geometry.jts.JTSFactoryFinder;
    
    38 34
     import org.geotools.map.FeatureLayer;
    
    39 35
     import org.geotools.map.Layer;
    
    40
    -import org.geotools.referencing.CRS;
    
    41 36
     import org.geotools.styling.Style;
    
    42 37
     import org.locationtech.jts.geom.Coordinate;
    
    43
    -import org.locationtech.jts.geom.GeometryFactory;
    
    44
    -import org.locationtech.jts.geom.LineString;
    
    45
    -import org.opengis.feature.simple.SimpleFeature;
    
    46
    -import org.opengis.feature.simple.SimpleFeatureType;
    
    47
    -import org.opengis.referencing.FactoryException;
    
    48 38
     
    
    49
    -import java.text.DateFormat;
    
    50 39
     import java.util.LinkedList;
    
    51 40
     import java.util.List;
    
    41
    +import java.util.Set;
    
    52 42
     
    
    53 43
     import static io.ultreia.java4all.i18n.I18n.n;
    
    54 44
     import static io.ultreia.java4all.i18n.I18n.t;
    
    ... ... @@ -68,17 +58,17 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit
    68 58
                     TripMapPointType.psActivityObsInHarbour,
    
    69 59
                     TripMapPointType.psActivityObsWithFreeSchoolType,
    
    70 60
                     TripMapPointType.psActivityObsWithObjectSchoolType
    
    71
    -        ));
    
    61
    +        ), createLineBuilder(true));
    
    72 62
         }
    
    73 63
     
    
    74 64
         @Override
    
    75
    -    public boolean accept(TripMapDto tripMapDto) {
    
    76
    -        return TripAware.isSeineId(tripMapDto.getTripId());
    
    77
    -    }
    
    78
    -
    
    79
    -    @Override
    
    80
    -    public void addPoints(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) throws FactoryException {
    
    81
    -        addPoints(tripMapPoints, OBSERVATION_POINTS_LAYER_NAME, n("observe.ui.datasource.editor.content.map.observation.points.not.valid"));
    
    65
    +    public Set<String> getVariableNames() {
    
    66
    +        return ImmutableSet.<String>builder().addAll(DEFAULT_VARIABLE_NAMES)
    
    67
    +                .add("mapPsStyleObservationsTextColor")
    
    68
    +                .add("mapPsStyleObservationsTextSize")
    
    69
    +                .add("mapPsStyleObservationsLineColor")
    
    70
    +                .add("mapPsStyleObservationsPointColor")
    
    71
    +                .build();
    
    82 72
         }
    
    83 73
     
    
    84 74
         @Override
    
    ... ... @@ -87,97 +77,53 @@ public class TripMapContentBuilder extends fr.ird.observe.client.datasource.edit
    87 77
         }
    
    88 78
     
    
    89 79
         @Override
    
    90
    -    public void addLines(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) throws FactoryException {
    
    91
    -
    
    92
    -        GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    
    93
    -
    
    94
    -        SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    
    95
    -        lineFeatureTypeBuilder.setName("lineBuilder");
    
    96
    -        lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true));
    
    97
    -        lineFeatureTypeBuilder.add("line", LineString.class);
    
    98
    -        lineFeatureTypeBuilder.add("label", String.class);
    
    99
    -        lineFeatureTypeBuilder.add("type", String.class);
    
    80
    +    public boolean accept(TripMapDto tripMapDto) {
    
    81
    +        return TripAware.isSeineId(tripMapDto.getTripId());
    
    82
    +    }
    
    100 83
     
    
    101
    -        SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType();
    
    102
    -        SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType);
    
    84
    +    @Override
    
    85
    +    public void addPoints(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) {
    
    86
    +        addPoints(tripMapPoints, OBSERVATION_POINTS_LAYER_NAME, n("observe.ui.datasource.editor.content.map.observation.points.not.valid"));
    
    87
    +    }
    
    103 88
     
    
    89
    +    @Override
    
    90
    +    public void addLines(TripMapConfigDto tripMapConfig, List<TripMapPoint> tripMapPoints) {
    
    104 91
             DefaultFeatureCollection linesFeatures = new DefaultFeatureCollection();
    
    105
    -
    
    106
    -        List<Coordinate> coordinatesByDay = null;
    
    107
    -
    
    92
    +        List<Coordinate> coordinatesByDay = new LinkedList<>();
    
    108 93
             TripMapPoint previousPoint = null;
    
    109
    -
    
    110 94
             for (TripMapPoint point : tripMapPoints) {
    
    111
    -            if (previousPoint == null) {
    
    112
    -                coordinatesByDay = new LinkedList<>();
    
    113
    -            } else if (!DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) {
    
    114
    -
    
    115
    -                if (coordinatesByDay.size() > 1) {
    
    116
    -                    LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0]));
    
    117
    -                    lineBuilder.add(line);
    
    118
    -                    lineBuilder.add(DATE_FORMAT.format(previousPoint.getTime()));
    
    119
    -                    lineBuilder.add("tripDay");
    
    120
    -                    SimpleFeature feature = lineBuilder.buildFeature(null);
    
    121
    -
    
    122
    -                    linesFeatures.add(feature);
    
    123
    -                }
    
    124
    -
    
    125
    -                Coordinate[] coordinates = {
    
    126
    -                        new Coordinate(previousPoint.getLongitude(), previousPoint.getLatitude()),
    
    127
    -                        new Coordinate(point.getLongitude(), point.getLatitude()),
    
    128
    -                };
    
    129
    -                LineString lineBetweenTwoDays = geometryFactory.createLineString(coordinates);
    
    130
    -                lineBuilder.add(lineBetweenTwoDays);
    
    131
    -                lineBuilder.add(DateFormat.getDateInstance().format(previousPoint.getTime()));
    
    132
    -                lineBuilder.add("tripBetweenTwoDays");
    
    133
    -                linesFeatures.add(lineBuilder.buildFeature(null));
    
    134
    -
    
    135
    -                coordinatesByDay = new LinkedList<>();
    
    95
    +            Coordinate coordinate = create(point);
    
    96
    +            if (previousPoint != null && !DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) {
    
    97
    +                // changing day
    
    98
    +                addTripDay(linesFeatures, coordinatesByDay, previousPoint);
    
    99
    +                addTripBetweenTwoDayS(linesFeatures, previousPoint, point);
    
    100
    +                coordinatesByDay.clear();
    
    136 101
                 }
    
    137
    -
    
    138
    -            Coordinate coordinate = new Coordinate(point.getLongitude(), point.getLatitude());
    
    139 102
                 coordinatesByDay.add(coordinate);
    
    140
    -
    
    141 103
                 previousPoint = point;
    
    142 104
             }
    
    143
    -
    
    144
    -        if (coordinatesByDay != null && coordinatesByDay.size() > 1) {
    
    145
    -            LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0]));
    
    146
    -            lineBuilder.add(line);
    
    147
    -            lineBuilder.add(DATE_FORMAT.format(previousPoint.getTime()));
    
    148
    -            lineBuilder.add("tripDay");
    
    149
    -            linesFeatures.add(lineBuilder.buildFeature(null));
    
    105
    +        if (previousPoint != null) {
    
    106
    +            addTripDay(linesFeatures, coordinatesByDay, previousPoint);
    
    150 107
             }
    
    151
    -
    
    152
    -        Style styleLines = findStyle(styledLayerDescriptor, OBSERVATION_LINES_LAYER_NAME, null);
    
    153
    -
    
    108
    +        Style styleLines = findStyle(styledLayerDescriptor, OBSERVATION_LINES_LAYER_NAME);
    
    154 109
             if (!linesFeatures.isEmpty()) {
    
    155 110
                 Layer layerLines = new FeatureLayer(linesFeatures, styleLines, OBSERVATION_LINES_LAYER_NAME);
    
    156 111
                 mapContent.addLayer(layerLines);
    
    157 112
             }
    
    113
    +        addLineLegend(styleLines, "tripDay", t("observe.ui.datasource.editor.content.map.legend.tripDay"));
    
    114
    +        addLineLegend(styleLines, "tripBetweenTwoDays", t("observe.ui.datasource.editor.content.map.legend.tripBetweenTwoDays"));
    
    115
    +    }
    
    158 116
     
    
    117
    +    protected void addTripDay(DefaultFeatureCollection linesFeatures, List<Coordinate> coordinatesByDay, TripMapPoint previousPoint) {
    
    118
    +        if (coordinatesByDay.size() > 1) {
    
    119
    +            Coordinate[] coordinates = coordinatesByDay.toArray(new Coordinate[0]);
    
    120
    +            addLine(linesFeatures, "tripDay", coordinates, previousPoint.getTime());
    
    121
    +        }
    
    122
    +    }
    
    159 123
     
    
    160
    -        // add line in legend
    
    161
    -        LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates());
    
    162
    -        lineBuilder.add(line);
    
    163
    -        lineBuilder.add("");
    
    164
    -        lineBuilder.add("tripDay");
    
    165
    -
    
    166
    -        ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem(
    
    167
    -                lineBuilder.buildFeature(null),
    
    168
    -                styleLines,
    
    169
    -                t("observe.ui.datasource.editor.content.map.legend.tripDay"));
    
    170
    -        legendItems.add(legendTripDay);
    
    171
    -
    
    172
    -        lineBuilder.add(line);
    
    173
    -        lineBuilder.add("");
    
    174
    -        lineBuilder.add("tripBetweenTwoDays");
    
    175
    -        ObserveMapPaneLegendItem legendTripBetweenTwoDays = new ObserveMapPaneLegendItem(
    
    176
    -                lineBuilder.buildFeature(null),
    
    177
    -                styleLines,
    
    178
    -                t("observe.ui.datasource.editor.content.map.legend.tripBetweenTwoDays"));
    
    179
    -        legendItems.add(legendTripBetweenTwoDays);
    
    180
    -
    
    124
    +    protected void addTripBetweenTwoDayS(DefaultFeatureCollection linesFeatures, TripMapPoint previousPoint, TripMapPoint point) {
    
    125
    +        Coordinate[] coordinates = create(previousPoint, point);
    
    126
    +        addLine(linesFeatures, "tripBetweenTwoDays", coordinates, previousPoint.getTime());
    
    181 127
         }
    
    182 128
     
    
    183 129
     }

  • client/datasource/editor/ps/src/main/resources/map/ps-style.xml
    ... ... @@ -39,7 +39,7 @@
    39 39
               </ogc:Filter>
    
    40 40
               <LineSymbolizer>
    
    41 41
                 <Stroke>
    
    42
    -              <CssParameter name="stroke">${mapPsStyleObservationsColor}</CssParameter>
    
    42
    +              <CssParameter name="stroke">${mapPsStyleObservationsLineColor}</CssParameter>
    
    43 43
                   <CssParameter name="stroke-width">2</CssParameter>
    
    44 44
                 </Stroke>
    
    45 45
               </LineSymbolizer>
    
    ... ... @@ -53,10 +53,10 @@
    53 53
                   </LinePlacement>
    
    54 54
                 </LabelPlacement>
    
    55 55
                 <Fill>
    
    56
    -              <CssParameter name="fill">#000000</CssParameter>
    
    56
    +              <CssParameter name="fill">${mapPsStyleObservationsTextColor}</CssParameter>
    
    57 57
                 </Fill>
    
    58 58
                 <Font>
    
    59
    -              <CssParameter name="font-size">14</CssParameter>
    
    59
    +              <CssParameter name="font-size">${mapPsStyleObservationsTextSize}</CssParameter>
    
    60 60
                   <CssParameter name="font-style">normal</CssParameter>
    
    61 61
                   <CssParameter name="font-family">Sans-Serif</CssParameter>
    
    62 62
                 </Font>
    
    ... ... @@ -74,7 +74,7 @@
    74 74
               </ogc:Filter>
    
    75 75
               <LineSymbolizer>
    
    76 76
                 <Stroke>
    
    77
    -              <CssParameter name="stroke">${mapPsStyleObservationsColor}</CssParameter>
    
    77
    +              <CssParameter name="stroke">${mapPsStyleObservationsLineColor}</CssParameter>
    
    78 78
                   <CssParameter name="stroke-width">2</CssParameter>
    
    79 79
                   <CssParameter name="stroke-dasharray">6 4</CssParameter>
    
    80 80
                 </Stroke>
    
    ... ... @@ -102,7 +102,7 @@
    102 102
                   <Mark>
    
    103 103
                     <WellKnownName>Star</WellKnownName>
    
    104 104
                     <Fill>
    
    105
    -                  <CssParameter name="fill">#00FF00</CssParameter>
    
    105
    +                  <CssParameter name="fill">${mapPsStyleObservationsPointColor}</CssParameter>
    
    106 106
                     </Fill>
    
    107 107
                     <Stroke>
    
    108 108
                       <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -129,7 +129,7 @@
    129 129
                   <Mark>
    
    130 130
                     <WellKnownName>ttf://Serif#U+00B7</WellKnownName>
    
    131 131
                     <Fill>
    
    132
    -                  <CssParameter name="fill">${mapPsStyleObservationsColor}</CssParameter>
    
    132
    +                  <CssParameter name="fill">${mapPsStyleObservationsPointColor}</CssParameter>
    
    133 133
                     </Fill>
    
    134 134
                     <Stroke>
    
    135 135
                       <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -156,7 +156,7 @@
    156 156
                   <Mark>
    
    157 157
                     <WellKnownName>ttf://Serif#U+25C6</WellKnownName>
    
    158 158
                     <Fill>
    
    159
    -                  <CssParameter name="fill">${mapPsStyleObservationsColor}</CssParameter>
    
    159
    +                  <CssParameter name="fill">${mapPsStyleObservationsPointColor}</CssParameter>
    
    160 160
                     </Fill>
    
    161 161
                     <Stroke>
    
    162 162
                       <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -183,7 +183,7 @@
    183 183
                   <Mark>
    
    184 184
                     <WellKnownName>ttf://Serif#U+002B</WellKnownName>
    
    185 185
                     <Fill>
    
    186
    -                  <CssParameter name="fill">${mapPsStyleObservationsColor}</CssParameter>
    
    186
    +                  <CssParameter name="fill">${mapPsStyleObservationsPointColor}</CssParameter>
    
    187 187
                     </Fill>
    
    188 188
                     <Stroke>
    
    189 189
                       <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -210,7 +210,7 @@
    210 210
                   <Mark>
    
    211 211
                     <WellKnownName>ttf://Serif#U+0021</WellKnownName>
    
    212 212
                     <Fill>
    
    213
    -                  <CssParameter name="fill">${mapPsStyleObservationsColor}</CssParameter>
    
    213
    +                  <CssParameter name="fill">${mapPsStyleObservationsPointColor}</CssParameter>
    
    214 214
                     </Fill>
    
    215 215
                     <Stroke>
    
    216 216
                       <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -227,13 +227,13 @@
    227 227
       </NamedLayer>
    
    228 228
     
    
    229 229
       <NamedLayer>
    
    230
    -    <Name>World_EEZ_v8_2014</Name>
    
    230
    +    <Name>GSHHS_l_L1</Name>
    
    231 231
         <UserStyle>
    
    232 232
           <FeatureTypeStyle>
    
    233 233
             <Rule>
    
    234 234
               <PolygonSymbolizer>
    
    235 235
                 <Fill>
    
    236
    -              <CssParameter name="fill">#82F4F9</CssParameter>
    
    236
    +              <CssParameter name="fill">${mapLayer1Color}</CssParameter>
    
    237 237
                 </Fill>
    
    238 238
                 <Stroke>
    
    239 239
                   <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -246,13 +246,13 @@
    246 246
       </NamedLayer>
    
    247 247
     
    
    248 248
       <NamedLayer>
    
    249
    -    <Name>GSHHS_l_L1</Name>
    
    249
    +    <Name>GSHHS_l_L6</Name>
    
    250 250
         <UserStyle>
    
    251 251
           <FeatureTypeStyle>
    
    252 252
             <Rule>
    
    253 253
               <PolygonSymbolizer>
    
    254 254
                 <Fill>
    
    255
    -              <CssParameter name="fill">#FBE9D7</CssParameter>
    
    255
    +              <CssParameter name="fill">${mapLayer2Color}</CssParameter>
    
    256 256
                 </Fill>
    
    257 257
                 <Stroke>
    
    258 258
                   <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -265,13 +265,32 @@
    265 265
       </NamedLayer>
    
    266 266
     
    
    267 267
       <NamedLayer>
    
    268
    -    <Name>GSHHS_l_L6</Name>
    
    268
    +    <Name>GSHHS_l_L2</Name>
    
    269
    +    <UserStyle>
    
    270
    +      <FeatureTypeStyle>
    
    271
    +        <Rule>
    
    272
    +          <PolygonSymbolizer>
    
    273
    +            <Fill>
    
    274
    +              <CssParameter name="fill">${mapLayer3Color}</CssParameter>
    
    275
    +            </Fill>
    
    276
    +            <Stroke>
    
    277
    +              <!--              <CssParameter name="stroke">#7FB7FF</CssParameter>-->
    
    278
    +              <CssParameter name="stroke">${mapLayer3Color}</CssParameter>
    
    279
    +              <CssParameter name="stroke-width">1</CssParameter>
    
    280
    +            </Stroke>
    
    281
    +          </PolygonSymbolizer>
    
    282
    +        </Rule>
    
    283
    +      </FeatureTypeStyle>
    
    284
    +    </UserStyle>
    
    285
    +  </NamedLayer>
    
    286
    +  <NamedLayer>
    
    287
    +    <Name>WDBII_border_l_L1</Name>
    
    269 288
         <UserStyle>
    
    270 289
           <FeatureTypeStyle>
    
    271 290
             <Rule>
    
    272 291
               <PolygonSymbolizer>
    
    273 292
                 <Fill>
    
    274
    -              <CssParameter name="fill">#F5F5FF</CssParameter>
    
    293
    +              <CssParameter name="fill">${mapLayer4Color}</CssParameter>
    
    275 294
                 </Fill>
    
    276 295
                 <Stroke>
    
    277 296
                   <CssParameter name="stroke">#000000</CssParameter>
    
    ... ... @@ -284,16 +303,16 @@
    284 303
       </NamedLayer>
    
    285 304
     
    
    286 305
       <NamedLayer>
    
    287
    -    <Name>GSHHS_l_L2</Name>
    
    306
    +    <Name>eez_v11_lowres</Name>
    
    288 307
         <UserStyle>
    
    289 308
           <FeatureTypeStyle>
    
    290 309
             <Rule>
    
    291 310
               <PolygonSymbolizer>
    
    292 311
                 <Fill>
    
    293
    -              <CssParameter name="fill">#7FB7FF</CssParameter>
    
    312
    +              <CssParameter name="fill">${mapLayer5Color}</CssParameter>
    
    294 313
                 </Fill>
    
    295 314
                 <Stroke>
    
    296
    -              <CssParameter name="stroke">#7FB7FF</CssParameter>
    
    315
    +              <CssParameter name="stroke">#000000</CssParameter>
    
    297 316
                   <CssParameter name="stroke-width">1</CssParameter>
    
    298 317
                 </Stroke>
    
    299 318
               </PolygonSymbolizer>
    

  • client/i18n/src/main/i18n/translations/observe_en_GB.properties
    ... ... @@ -89,11 +89,17 @@ observe.config.longlineActivityPairing.maxDistance=Longline activity pairing max
    89 89
     observe.config.longlineActivityPairing.maxTime=Longline activity pairing max time (mn)
    
    90 90
     observe.config.longlineLandingPart.defaultWeightMeasureMethod=Default weight measure method to use for a new longline landing part
    
    91 91
     observe.config.map.background.description=Color of background
    
    92
    +observe.config.map.dateFormat=Date format
    
    93
    +observe.config.map.layer1.color=Fill color for layer 1
    
    92 94
     observe.config.map.layer1.description=File (shapefile) for layer 1 of map
    
    93 95
     observe.config.map.layer10.description=File (shapefile) for layer 10 of map
    
    96
    +observe.config.map.layer2.color=Fill color for layer 2
    
    94 97
     observe.config.map.layer2.description=File (shapefile) for layer 2 of map
    
    98
    +observe.config.map.layer3.color=Fill color for layer 3
    
    95 99
     observe.config.map.layer3.description=File (shapefile) for layer 3 of map
    
    100
    +observe.config.map.layer4.color=Fill color for layer 4
    
    96 101
     observe.config.map.layer4.description=File (shapefile) for layer 4 of map
    
    102
    +observe.config.map.layer5.color=Fill color for layer 5
    
    97 103
     observe.config.map.layer5.description=File (shapefile) for layer 5 of map
    
    98 104
     observe.config.map.layer6.description=File (shapefile) for layer 6 of map
    
    99 105
     observe.config.map.layer7.description=File (shapefile) for layer 7 of map
    
    ... ... @@ -109,7 +115,10 @@ observe.config.map.ll.style.observations.line.setting.color=[LL] Observations Li
    109 115
     observe.config.map.ll.style.observations.line.trip.color=[LL] Observations Line trip color
    
    110 116
     observe.config.map.ll.style.observations.point.color=[LL] Observations point color
    
    111 117
     observe.config.map.ps.style.description=[Seine] File of styles used in map
    
    112
    -observe.config.map.ps.style.observations.color=[Seine] Color for observations data
    
    118
    +observe.config.map.ps.style.observations.line.color=[Seine] Color for observations lines
    
    119
    +observe.config.map.ps.style.observations.point.color=[Seine] Color for observations points
    
    120
    +observe.config.map.ps.style.observations.text.color=[Seine] Color for observations text
    
    121
    +observe.config.map.ps.style.observations.text.size=[Seine] Size for observations text
    
    113 122
     observe.config.navigationIconsPath.description=Default navigation icons path.
    
    114 123
     observe.config.observation.activitysDetaillees=Observation of detailled activities
    
    115 124
     observe.config.observation.fauneAssociee=Observation of non target
    

  • client/i18n/src/main/i18n/translations/observe_es_ES.properties
    ... ... @@ -89,11 +89,17 @@ observe.config.longlineActivityPairing.maxDistance=Longline activity pairing max
    89 89
     observe.config.longlineActivityPairing.maxTime=Longline activity pairing max time (mn) \#TODO
    
    90 90
     observe.config.longlineLandingPart.defaultWeightMeasureMethod=Default weight measure method to use for a new longline landing part \#TODO
    
    91 91
     observe.config.map.background.description=Color del fondo del mapa
    
    92
    +observe.config.map.dateFormat=Date format
    
    93
    +observe.config.map.layer1.color=Fill color for layer 1
    
    92 94
     observe.config.map.layer1.description=Archivo (shapeFiles) del primer calco del mapa
    
    93 95
     observe.config.map.layer10.description=Archivo (shapeFiles) del décimo calco del mapa
    
    96
    +observe.config.map.layer2.color=Fill color for layer 2
    
    94 97
     observe.config.map.layer2.description=Archivo (shapeFiles) del segundo calco del mapa
    
    98
    +observe.config.map.layer3.color=Fill color for layer 3
    
    95 99
     observe.config.map.layer3.description=Archivo (shapeFiles) del tercero calco del mapa
    
    100
    +observe.config.map.layer4.color=Fill color for layer 4
    
    96 101
     observe.config.map.layer4.description=Archivo (shapeFiles) del cuarto calco del mapa
    
    102
    +observe.config.map.layer5.color=Fill color for layer 5
    
    97 103
     observe.config.map.layer5.description=Archivo (shapeFiles) del quinto calco del mapa
    
    98 104
     observe.config.map.layer6.description=Archivo (shapeFiles) del sexto calco del mapa
    
    99 105
     observe.config.map.layer7.description=Archivo (shapeFiles) del séptimo calco del mapa
    
    ... ... @@ -109,7 +115,10 @@ observe.config.map.ll.style.observations.line.setting.color=[LL] Observations Li
    109 115
     observe.config.map.ll.style.observations.line.trip.color=[LL] Observations Line trip color
    
    110 116
     observe.config.map.ll.style.observations.point.color=[LL] Observations point color
    
    111 117
     observe.config.map.ps.style.description=[Seina] Archivo de los estilos a aplicar sobre los calcos del mapa \#TODO
    
    112
    -observe.config.map.ps.style.observations.color=[Seine] Color for observations data
    
    118
    +observe.config.map.ps.style.observations.line.color=[Seine] Color for observations lines
    
    119
    +observe.config.map.ps.style.observations.point.color=[Seine] Color for observations points
    
    120
    +observe.config.map.ps.style.observations.text.color=[Seine] Color for observations text
    
    121
    +observe.config.map.ps.style.observations.text.size=[Seine] Size for observations text
    
    113 122
     observe.config.navigationIconsPath.description=Default navigation icons path. \#TODO
    
    114 123
     observe.config.observation.activitysDetaillees=Observación de actividades detalladas
    
    115 124
     observe.config.observation.fauneAssociee=Observación de Fauna asociada
    

  • client/i18n/src/main/i18n/translations/observe_fr_FR.properties
    ... ... @@ -89,11 +89,17 @@ observe.config.longlineActivityPairing.maxDistance=Appairement activités Palang
    89 89
     observe.config.longlineActivityPairing.maxTime=Appairement activités Palangre - Temps maximum (en mn)
    
    90 90
     observe.config.longlineLandingPart.defaultWeightMeasureMethod=Méthode de mesure à utiliser lors de la création d'un nouveau d"pbarquement (modèle Palangre)
    
    91 91
     observe.config.map.background.description=Couleur du fond de carte
    
    92
    +observe.config.map.dateFormat=Format de la date
    
    93
    +observe.config.map.layer1.color=Couleur de remplissage pour le premier calque de la carte
    
    92 94
     observe.config.map.layer1.description=Fichier (Shape Files) du premier calque de la carte
    
    93 95
     observe.config.map.layer10.description=Fichier (Shape Files) du dixième calque de la carte
    
    96
    +observe.config.map.layer2.color=Couleur de remplissage pour le second calque de la carte
    
    94 97
     observe.config.map.layer2.description=Fichier (Shape Files) du deuxième calque de la carte
    
    98
    +observe.config.map.layer3.color=Couleur de remplissage pour le troisième calque de la carte
    
    95 99
     observe.config.map.layer3.description=Fichier (Shape Files) du troisième calque de la carte
    
    100
    +observe.config.map.layer4.color=Couleur de remplissage pour le quatrième calque de la carte
    
    96 101
     observe.config.map.layer4.description=Fichier (Shape Files) du quatrième calque de la carte
    
    102
    +observe.config.map.layer5.color=Couleur de remplissage pour le cinquième calque de la carte
    
    97 103
     observe.config.map.layer5.description=Fichier (Shape Files) du cinquième calque de la carte
    
    98 104
     observe.config.map.layer6.description=Fichier (Shape Files) du sixième calque de la carte
    
    99 105
     observe.config.map.layer7.description=Fichier (Shape Files) du septième calque de la carte
    
    ... ... @@ -109,7 +115,10 @@ observe.config.map.ll.style.observations.line.setting.color=[Palangre] Observati
    109 115
     observe.config.map.ll.style.observations.line.trip.color=[Palangre] Observations Ligne Couleur marée
    
    110 116
     observe.config.map.ll.style.observations.point.color=[Palangre] Observations Couleur points
    
    111 117
     observe.config.map.ps.style.description=[Senne] Fichier des style à appliquer sur les calques de la carte
    
    112
    -observe.config.map.ps.style.observations.color=[Senne] Couleur pour les données d'observation
    
    118
    +observe.config.map.ps.style.observations.line.color=[Senne] Observations Couleur pour les traces
    
    119
    +observe.config.map.ps.style.observations.point.color=[Senne] Observations Couleur pour les points
    
    120
    +observe.config.map.ps.style.observations.text.color=[Senne] Observations Couleur pour les textes
    
    121
    +observe.config.map.ps.style.observations.text.size=[Senne] Observations Taille pour les textes
    
    113 122
     observe.config.navigationIconsPath.description=Chemin vers les icônes de navigation.
    
    114 123
     observe.config.observation.activitysDetaillees=Observation des activités détaillées
    
    115 124
     observe.config.observation.fauneAssociee=Observation des Faunes associées
    

  • models/dto/src/main/java/fr/ird/observe/dto/data/TripMapConfig.java
    ... ... @@ -25,6 +25,7 @@ package fr.ird.observe.dto.data;
    25 25
     import java.awt.Color;
    
    26 26
     import java.io.File;
    
    27 27
     import java.util.List;
    
    28
    +import java.util.Map;
    
    28 29
     import java.util.Set;
    
    29 30
     
    
    30 31
     /**
    
    ... ... @@ -37,73 +38,18 @@ import java.util.Set;
    37 38
      */
    
    38 39
     public interface TripMapConfig {
    
    39 40
     
    
    41
    +    String getMapDateFormat();
    
    42
    +
    
    40 43
         Set<TripMapContentBuilder> getTripMapContentBuilders();
    
    41 44
     
    
    42 45
         File getMapDirectory();
    
    43 46
     
    
    44 47
         Color getMapBackgroundColor();
    
    45 48
     
    
    46
    -    void setMapBackgroundColor(Color mapBackgroundColor);
    
    47
    -
    
    48
    -    File getMapLayer1();
    
    49
    -
    
    50
    -    void setMapLayer1(File mapLayer1);
    
    51
    -
    
    52
    -    File getMapLayer2();
    
    53
    -
    
    54
    -    void setMapLayer2(File mapLayer2);
    
    55
    -
    
    56
    -    File getMapLayer3();
    
    57
    -
    
    58
    -    void setMapLayer3(File mapLayer3);
    
    59
    -
    
    60
    -    File getMapLayer4();
    
    61
    -
    
    62
    -    void setMapLayer4(File mapLayer4);
    
    63
    -
    
    64
    -    File getMapLayer5();
    
    65
    -
    
    66
    -    void setMapLayer5(File mapLayer5);
    
    67
    -
    
    68
    -    File getMapLayer6();
    
    69
    -
    
    70
    -    void setMapLayer6(File mapLayer6);
    
    71
    -
    
    72
    -    File getMapLayer7();
    
    73
    -
    
    74
    -    void setMapLayer7(File mapLayer7);
    
    75
    -
    
    76
    -    File getMapLayer8();
    
    77
    -
    
    78
    -    void setMapLayer8(File mapLayer8);
    
    79
    -
    
    80
    -    File getMapLayer9();
    
    81
    -
    
    82
    -    void setMapLayer9(File mapLayer9);
    
    83
    -
    
    84
    -    File getMapLayer10();
    
    85
    -
    
    86
    -    void setMapLayer10(File mapLayer10);
    
    87
    -
    
    88 49
         List<File> getMapLayerFiles();
    
    89 50
     
    
    90
    -    Color getMapPsStyleObservationsColor();
    
    51
    +    Map<String, String> getVariables(TripMapContentBuilder builder);
    
    91 52
     
    
    92 53
         File getTemporaryDirectory();
    
    93 54
     
    
    94
    -    Color getMapLlStyleObservationsLineTripColor();
    
    95
    -
    
    96
    -    Color getMapLlStyleObservationsLineSettingColor();
    
    97
    -
    
    98
    -    Color getMapLlStyleObservationsLineHaulingColor();
    
    99
    -
    
    100
    -    Color getMapLlStyleObservationsPointColor();
    
    101
    -
    
    102
    -    Color getMapLlStyleLogbookLineTripColor();
    
    103
    -
    
    104
    -    Color getMapLlStyleLogbookLineSettingColor();
    
    105
    -
    
    106
    -    Color getMapLlStyleLogbookLineHaulingColor();
    
    107
    -
    
    108
    -    Color getMapLlStyleLogbookPointColor();
    
    109 55
     }

  • models/dto/src/main/java/fr/ird/observe/dto/data/TripMapContentBuilder.java
    ... ... @@ -27,6 +27,7 @@ import java.io.FileNotFoundException;
    27 27
     import java.io.IOException;
    
    28 28
     import java.nio.file.Path;
    
    29 29
     import java.util.List;
    
    30
    +import java.util.Set;
    
    30 31
     
    
    31 32
     /**
    
    32 33
      * Created on 02/09/2020.
    
    ... ... @@ -36,6 +37,8 @@ import java.util.List;
    36 37
      */
    
    37 38
     public interface TripMapContentBuilder {
    
    38 39
     
    
    40
    +    Set<String> getVariableNames();
    
    41
    +
    
    39 42
         String getStyleFileName();
    
    40 43
     
    
    41 44
         boolean accept(TripMapDto tripMapDto);