branch feature/6944 updated (02de3bc -> e535841)
This is an automated email from the git hooks/post-receive script. New change to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git discards 02de3bc add legend discards 71a68a3 accepter la carte par son type plutot que par son nome dans le bloqueur + passage a jaxx en snapshot (refs #6944) discards 2c6ffc7 add export map into png, fix zoomIt in launch discards 3b2484e permettre d'interagir avec la carte même sur une marée clôturée (refs #6944) discards 64de940 change trip map point type values, add style for longline, discards 6970a68 add map in trip long line ui discards ad5649f fix code, hide actions buttons, tab name discards f971ce3 move scale in map and add compass discards 42063c6 fix default values map options discards cde5ed7 add scale mpa and creat jaxx file for map discards 9bcb782 fix zoom NPE discards 3b04b05 refs #6944 copie des resources de cartographie discards 2efc056 refs #6944 creation de la resources sur la partie catographie dans le build discards 83842ed refs #6944 Déplacement des resources pour en faire un zip à intégrer dans le class-path discards 873c628 fix zoom discards ddd5406 add layers discards 174d9b3 zoom (or un-zoom) on pointer discards 080c26d use style file for map discards aa7fd12 add Date on map discards 9616e42 add point and fix style discards 3d15aef rename functions discards 6c426d7 add french translation fr i18n discards 691da9d fix show config discards 3074603 mouse Translation discards 2f0a5e5 add map in trip seine UI discards 03b30ce add shape file and options map in config discards 2112692 add compute trip for map adds c2d0267 refs #7006 use new topia tag value to generate deterministice foreign key names adds 9afba5d fixes #7006: Nommer les clef étrangères Merge branch 'feature/7006' into develop adds e7fe3f1 voir des zero à la place d'une chaine vide sur les composants d'une coordonnée nulle (refs #7007) adds 98f86a2 utilisation jaxx en snapshot (refs #7007) adds 345cf56 amélioration de la façon d'initialiser l'éditeur des coordonnées sur l'écran Activityseine (refs #7007) adds 7aae4d0 amélioration de la façon d'initialiser l'éditeur des coordonnées sur l'écran ActivityLongline (refs #7007) adds 3765f2f fixes #7007: Améliorer l'affichage des coordonnées Merge branch 'feature/7007' into develop adds 4cbda29 faire refonctionner jmx sur hibernate adds eb0c996 permettre l'utilisation de la scrollbar sur des ecran vérouillé (refs #7009) adds 1ffebb9 fixes #7009 Pouvoir utiliser la scrollbar même lorsque l'écran est vérouillé Merge branch 'feature/7009' into develop adds f03b2ea utilisation du dernier pom + mise à jour d'un plugin de report adds 59b905b ajout de place pour le tableau des mises en oeuvre de caractéristiques d'un équipement (refs #7010) adds 15967ef fixes #7010: [ObServePS] Avoir plus de place pour saisir les mises en oeuvre d'un équipement Merge branch 'feature/7010' into develop adds 7724404 ajout de la suppression d'une mise en oeuvre de caractéristique (refs #7012) adds a7b954b fixes #7012: [ObServePS] Pouvoir supprimer une mise en oeuvre de caractéristique d'un équipement Merge branch 'feature/7012' into develop adds 60d9ba6 Écoute de la sélection sur le tableau des mises en oeuvre (refs #7011) adds 571a41e fixes #7011: [ObServePS] Impossible de rajouter des mises en oeuvre de caractéristique à un équipement Merge branch 'feature/7011' into develop adds ad69dc5 ajout de la persistence pour les équipements sur modèle LL + ajout d'un ordre sur les équipements d'une marée seine (refs #7013) adds f68723b ajout de la validation pour les équipements du modèle LL + correction de clefs i18n (refs #7013) adds 5a47fbe ajout de l'écran d'édition des équipements du modèle LL (refs #7013) adds 5a6de36 ajout de la méthode de récupération des caractértistiques pour le modèle LL (refs #7013) adds af793a4 fixes #7013: [ObServeLL] Ajout de l'écran des équipements Merge branch 'feature/7013' into develop adds 85cb8ed on rejoue deux migrations de la 4.0-RC3 (refs #7014) adds 1f6ca1d fixes #7014: 2 migrations of 4.0-RC3 ne sont pas jouées Merge branch 'feature/7014' into develop adds b41c02a adapatation du test pour verifier la replication des equipements sur le modele LL (refs #7015) adds 84c3c44 ajout d'un test de replication aussi pour le modèle seine (refs #7015) adds 8c9934f fixes #7015: [ObServePS] Les équipements ne sont pas synchonisés Merge branch 'feature/7015' into develop new 1a28b5c add compute trip for map new a11c925 add shape file and options map in config new b85bc13 add map in trip seine UI new c157486 mouse Translation new 8c55d82 fix show config new ba84a62 add french translation fr i18n new efa5f58 rename functions new 3e38a6a add point and fix style new 65acd45 add Date on map new b5edba2 use style file for map new 90709cf zoom (or un-zoom) on pointer new e8e55ac add layers new 18e3c8a fix zoom new 649064b refs #6944 Déplacement des resources pour en faire un zip à intégrer dans le class-path new 281f2d7 refs #6944 creation de la resources sur la partie catographie dans le build new b194eb2 refs #6944 copie des resources de cartographie new 63a95fe fix zoom NPE new 5afa017 add scale mpa and creat jaxx file for map new a21882b fix default values map options new 2817f7b move scale in map and add compass new 8d1d0ae fix code, hide actions buttons, tab name new 7d6df90 add map in trip long line ui new 5be93dc change trip map point type values, add style for longline, new 7b2fb51 permettre d'interagir avec la carte même sur une marée clôturée (refs #6944) new 9b8b1cd add export map into png, fix zoomIt in launch new ff63a7b accepter la carte par son type plutot que par son nome dans le bloqueur + passage a jaxx en snapshot (refs #6944) new e535841 add legend This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (02de3bc) \ N -- N -- N refs/heads/feature/6944 (e535841) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 27 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit e5358416f2ac8f792857e27a33c9eb3b6768719b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 23 14:06:55 2015 +0200 add legend commit ff63a7ba7e6583a18743ffa697f654daa0d39888 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 22 18:46:37 2015 +0200 accepter la carte par son type plutot que par son nome dans le bloqueur + passage a jaxx en snapshot (refs #6944) commit 9b8b1cd8cec286955f3c0b182e57fbd36027da5f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Apr 22 17:35:56 2015 +0200 add export map into png, fix zoomIt in launch commit 7b2fb51491cd3ccebf047f34aaccdf953a3c9c21 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 22 16:34:04 2015 +0200 permettre d'interagir avec la carte même sur une marée clôturée (refs #6944) commit 5be93dc37617f15322391b6448ac5c06bdba0126 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Apr 22 15:36:38 2015 +0200 change trip map point type values, add style for longline, commit 7d6df90a093a4c980f3a486de52c8b3b47c0342b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Apr 22 14:13:33 2015 +0200 add map in trip long line ui commit 8d1d0aeb49a23cdddbf759037e47a565b714d043 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 18:05:42 2015 +0200 fix code, hide actions buttons, tab name commit 2817f7b6febc30f148fecdf89feda8a24d71aa84 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 16:18:29 2015 +0200 move scale in map and add compass commit a21882bda10d8894562813f8cbabaeae1db49754 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 10:33:51 2015 +0200 fix default values map options commit 5afa017db875fa7c3d48ab1f0ec660337ec8c687 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 10:20:21 2015 +0200 add scale mpa and creat jaxx file for map commit 63a95fedd95bd195742422c5f12d87383d559f90 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Apr 20 10:33:20 2015 +0200 fix zoom NPE commit b194eb2bdb990babb92f0b9df769e16f87e55ad1 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 20 19:49:39 2015 +0200 refs #6944 copie des resources de cartographie commit 281f2d7e1150e7046b04982cc1bd8c2d93dadb0a Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 20 19:42:46 2015 +0200 refs #6944 creation de la resources sur la partie catographie dans le build commit 649064bae7ba1fe8ca93e02edf28ed2d389e8f14 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 20 19:41:54 2015 +0200 refs #6944 Déplacement des resources pour en faire un zip à intégrer dans le class-path commit 18e3c8a0464ccd5ffb51c3f55e9f805f9921b1eb Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 17:35:08 2015 +0200 fix zoom commit e8e55ac9974a06c47dacf239814cd722b089d996 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 17:31:40 2015 +0200 add layers commit 90709cf685b386b9c5db247a5c97d503fbd7ba8f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 16:08:47 2015 +0200 zoom (or un-zoom) on pointer commit b5edba2b095f51d4c70ccff8de859684baea52af Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 15:16:05 2015 +0200 use style file for map commit 65acd4579cf6d13af1676d214ffd27dca446964e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 17:52:10 2015 +0200 add Date on map commit 3e38a6adfcf98747c574ea746204a4d35c20f45e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 16:09:54 2015 +0200 add point and fix style commit efa5f583b8eb6b9e3f3cca005ff9f9f327502562 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 15:52:51 2015 +0200 rename functions commit ba84a627cf9172196c39b85fbad32251b4f90b0f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 11:17:32 2015 +0200 add french translation fr i18n commit 8c55d82eeae3db0e20435988b52a016767fed67d Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 11:06:37 2015 +0200 fix show config commit c15748606be10dc4562257c695e5347667a3d301 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 10:55:22 2015 +0200 mouse Translation commit b85bc13d381aa0eba604aae90826d57656c85c46 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:58:08 2015 +0200 add map in trip seine UI commit a11c9254c17f14c549cea31fcb718f6f906c4cdc Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:56:52 2015 +0200 add shape file and options map in config commit 1a28b5cd9d5d9f55e8b669843460d5552a980d05 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:42:39 2015 +0200 add compute trip for map Summary of changes: .../src/main/java/fr/ird/observe/DataService.java | 51 +++ .../fr/ird/observe/db/impl/AbstractDataSource.java | 31 +- .../replication/H2LonglineReplicateDataTest.java | 200 ------------ .../its/replication/H2ReplicateDataTest.java | 348 +++++++++++++++++++++ .../src/test/resources/db/3.16/ANO-6611.sql.gz | Bin 172354 -> 0 bytes .../test/resources/db/4.0-RC4/referentiel.sql.gz | Bin 0 -> 138256 bytes .../src/test/resources/db/replication/data.sql.gz | Bin 0 -> 176610 bytes .../java/fr/ird/observe/entities/Entities.java | 56 ++-- .../entities/longline/ActivityLonglineImpl.java | 6 +- .../migration/AbstractDataSourceMigration.java | 4 +- ... => DataSourceMigrationForVersion_4_0_RC4.java} | 48 +-- .../observe/entities/seine/ActivitySeineImpl.java | 15 +- .../main/resources/db/4.0-RC4/add-gear-data-H2.sql | 18 ++ .../main/resources/db/4.0-RC4/add-gear-data-PG.sql | 19 ++ .../rename-unknown-longliner-H2.sql | 0 .../rename-unknown-longliner-PG.sql | 0 .../update-senne-gear-usedInTrip-H2.sql | 0 .../update-senne-gear-usedInTrip-PG.sql | 0 .../src/main/xmi/observe-common.properties | 3 +- .../src/main/xmi/observe-longline.properties | 11 +- .../src/main/xmi/observe-longline.zargo | Bin 93860 -> 96409 bytes .../src/main/xmi/observe-seine.properties | 5 +- observe-entities/src/main/xmi/observe-seine.zargo | Bin 85905 -> 85905 bytes .../main/java/fr/ird/observe/ui/ObserveCommon.css | 4 + .../main/java/fr/ird/observe/ui/content/Common.css | 1 + .../ird/observe/ui/content/ContentUIManager.java | 2 + .../open/impl/longline/ActivityLonglineUI.css | 3 - .../impl/longline/ActivityLonglineUIHandler.java | 29 +- .../ui/content/open/impl/seine/ActivitySeineUI.css | 3 - .../open/impl/seine/ActivitySeineUIHandler.java | 32 +- .../GearUseFeaturesLonglineTableModel.java} | 45 +-- .../GearUseFeaturesLonglineUI.css} | 26 +- .../impl/longline/GearUseFeaturesLonglineUI.jaxx | 154 +++++++++ .../GearUseFeaturesLonglineUIHandler.java} | 218 +++++++++---- .../longline/GearUseFeaturesLonglineUIModel.java | 125 ++++++++ ...UseFeaturesMeasurementLonglinesTableModel.java} | 24 +- .../table/impl/seine/GearUseFeaturesSeineUI.css | 6 + .../table/impl/seine/GearUseFeaturesSeineUI.jaxx | 88 +++--- .../impl/seine/GearUseFeaturesSeineUIHandler.java | 93 ++++++ .../loadors/ProgramLonglineNodeChildLoador.java | 24 +- .../resources/i18n/observe-swing_en_GB.properties | 51 ++- .../resources/i18n/observe-swing_es_ES.properties | 27 ++ .../resources/i18n/observe-swing_fr_FR.properties | 27 ++ ...FeaturesLongline-n1-update-error-validation.xml | 34 ++ ...UseFeaturesSeine-n1-update-error-validation.xml | 6 +- .../i18n/observe-validation_en_GB.properties | 6 +- .../i18n/observe-validation_es_ES.properties | 6 +- .../i18n/observe-validation_fr_FR.properties | 6 +- .../validation/BeanValidatorDetectorTest.java | 4 +- pom.xml | 6 +- 50 files changed, 1365 insertions(+), 500 deletions(-) delete mode 100644 observe-business/src/test/java/fr/ird/observe/its/replication/H2LonglineReplicateDataTest.java create mode 100644 observe-business/src/test/java/fr/ird/observe/its/replication/H2ReplicateDataTest.java delete mode 100644 observe-business/src/test/resources/db/3.16/ANO-6611.sql.gz create mode 100644 observe-business/src/test/resources/db/4.0-RC4/referentiel.sql.gz create mode 100644 observe-business/src/test/resources/db/replication/data.sql.gz copy observe-entities/src/main/java/fr/ird/observe/entities/migration/versions/{DataSourceMigrationForVersion_3_12.java => DataSourceMigrationForVersion_4_0_RC4.java} (51%) create mode 100644 observe-entities/src/main/resources/db/4.0-RC4/add-gear-data-H2.sql create mode 100644 observe-entities/src/main/resources/db/4.0-RC4/add-gear-data-PG.sql copy observe-entities/src/main/resources/db/{4.0-RC3 => 4.0-RC4}/rename-unknown-longliner-H2.sql (100%) copy observe-entities/src/main/resources/db/{4.0-RC3 => 4.0-RC4}/rename-unknown-longliner-PG.sql (100%) copy observe-entities/src/main/resources/db/{4.0-RC3 => 4.0-RC4}/update-senne-gear-usedInTrip-H2.sql (100%) copy observe-entities/src/main/resources/db/{4.0-RC3 => 4.0-RC4}/update-senne-gear-usedInTrip-PG.sql (100%) copy observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/{seine/GearUseFeaturesSeineTableModel.java => longline/GearUseFeaturesLonglineTableModel.java} (63%) copy observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/{seine/GearUseFeaturesSeineUI.css => longline/GearUseFeaturesLonglineUI.css} (73%) create mode 100644 observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUI.jaxx copy observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/{seine/GearUseFeaturesSeineUIHandler.java => longline/GearUseFeaturesLonglineUIHandler.java} (59%) create mode 100644 observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/longline/GearUseFeaturesLonglineUIModel.java copy observe-swing/src/main/java/fr/ird/observe/ui/content/table/impl/{seine/GearUseFeaturesMeasurementSeinesTableModel.java => longline/GearUseFeaturesMeasurementLonglinesTableModel.java} (74%) create mode 100644 observe-validation/src/main/resources/fr/ird/observe/entities/longline/GearUseFeaturesLongline-n1-update-error-validation.xml -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 1a28b5cd9d5d9f55e8b669843460d5552a980d05 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:42:39 2015 +0200 add compute trip for map --- .../src/main/java/fr/ird/observe/DataService.java | 25 ++++++ .../observe/entities/seine/TripSeineDAOImpl.java | 90 ++++++++++++++++++++++ .../java/fr/ird/observe/tripMap/TripMapPoint.java | 51 ++++++++++++ 3 files changed, 166 insertions(+) diff --git a/observe-business/src/main/java/fr/ird/observe/DataService.java b/observe-business/src/main/java/fr/ird/observe/DataService.java index af7bcbf..2f36d50 100644 --- a/observe-business/src/main/java/fr/ird/observe/DataService.java +++ b/observe-business/src/main/java/fr/ird/observe/DataService.java @@ -89,6 +89,7 @@ import fr.ird.observe.entities.seine.TargetLength; import fr.ird.observe.entities.seine.TargetSample; import fr.ird.observe.entities.seine.TripSeine; import fr.ird.observe.entities.seine.TripSeineDAO; +import fr.ird.observe.tripMap.TripMapPoint; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -1711,6 +1712,30 @@ public class DataService { } } + public List<TripMapPoint> loadTrip(DataSource source, String id) throws DataSourceException { + if (!source.canReadData()) { + if (log.isDebugEnabled()) { + log.debug("Can not read data!"); + } + return null; + } + + String txName = "loadTrip"; + TopiaContext tx = beginTransaction(source, txName); + + try { + TripSeineDAO dao = (TripSeineDAO) source.getDAO(tx, TripSeine.class); + List<TripMapPoint> tripMapPoints = dao.extractTripMap(id); + return tripMapPoints; + + } catch (Exception e) { + throw new DataSourceException(e, txName); + } finally { + closeTransaction(source, tx, txName); + } + } + + // ------------------------------------------------------------------------ // -- Méthodes de chargement de données // ------------------------------------------------------------------------ diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java index bb185d6..21215d9 100644 --- a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java +++ b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java @@ -21,11 +21,15 @@ */ package fr.ird.observe.entities.seine; +import com.google.common.collect.Lists; import fr.ird.observe.entities.constants.ReferenceLocale; +import fr.ird.observe.entities.constants.seine.SchoolType; +import fr.ird.observe.entities.referentiel.Harbour; import fr.ird.observe.entities.referentiel.Person; import fr.ird.observe.entities.referentiel.PersonImpl; import fr.ird.observe.entities.referentiel.Vessel; import fr.ird.observe.entities.referentiel.VesselImpl; +import fr.ird.observe.tripMap.TripMapPoint; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaContextImplementor; import org.nuiton.topia.framework.TopiaSQLQuery; @@ -34,6 +38,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Time; +import java.util.Calendar; import java.util.List; /** @@ -72,6 +78,90 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< } + public List<TripMapPoint> extractTripMap(String tripId) throws TopiaException { + + TripSeine tripSeine = findByTopiaId(tripId); + + List<TripMapPoint> tripMapPoints = Lists.newLinkedList(); + + // add departure harbours + Harbour departureHarbour = tripSeine.getDepartureHarbour(); + if (departureHarbour != null) { + TripMapPoint departurePoint = new TripMapPoint(); + departurePoint.setTime(tripSeine.getStartDate()); + departurePoint.setLatitude(departureHarbour.getLatitude()); + departurePoint.setLongitude(departureHarbour.getLongitude()); + tripMapPoints.add(departurePoint); + } + + // Add Activities + TripMapPointQuery tripMapPointQuery = new TripMapPointQuery(tripId); + tripMapPoints.addAll(tripMapPointQuery.findMultipleResult(context)); + + // add landing harbours + Harbour landingHarbour = tripSeine.getLandingHarbour(); + if (landingHarbour != null) { + TripMapPoint landingPoint = new TripMapPoint(); + landingPoint.setTime(tripSeine.getEndDate()); + landingPoint.setLatitude(landingHarbour.getLatitude()); + landingPoint.setLongitude(landingHarbour.getLongitude()); + tripMapPoints.add(landingPoint); + } + + return tripMapPoints; + } + + private static class TripMapPointQuery extends TopiaSQLQuery<TripMapPoint> { + + private static String SQL = "SELECT" + + " r.date, " + + " a.time, " + + " a.latitude," + + " a.longitude," + + " s.schoolType" + + " FROM observe_seine.route r" + + " INNER JOIN observe_seine.activity a" + + " ON a.route = r.topiaId" + + " LEFT OUTER JOIN observe_seine.set s" + + " ON s.topiaId = a.set" + + " WHERE r.trip = ?" + + " ORDER BY r.date, a.time"; + + protected String tripId; + + public TripMapPointQuery(String tripId) { + this.tripId = tripId; + } + + @Override + protected PreparedStatement prepareQuery(Connection connection) throws SQLException { + PreparedStatement preparedStatement = connection.prepareStatement(SQL); + preparedStatement.setString(1, tripId); + return preparedStatement; + } + + @Override + protected TripMapPoint prepareResult(ResultSet resultSet) throws SQLException { + + TripMapPoint point = new TripMapPoint(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(resultSet.getDate(1)); + Time time = resultSet.getTime(2); + calendar.set(Calendar.HOUR_OF_DAY, time.getHours()); + calendar.set(Calendar.MINUTE, time.getMinutes()); + calendar.set(Calendar.SECOND, time.getSeconds()); + point.setTime(calendar.getTime()); + point.setLatitude(resultSet.getFloat(3)); + point.setLongitude(resultSet.getFloat(4)); + if (resultSet.getString(5) != null) { + point.setSchoolType(SchoolType.values()[resultSet.getInt(5)]); + } + + return point; + } + } + + private static class StubSqlQuery<E extends TripSeine> extends TopiaSQLQuery<E> { private final String sql; diff --git a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPoint.java b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPoint.java new file mode 100644 index 0000000..247240a --- /dev/null +++ b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPoint.java @@ -0,0 +1,51 @@ +package fr.ird.observe.tripMap; + +import fr.ird.observe.entities.constants.seine.SchoolType; + +import java.util.Date; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TripMapPoint { + + protected Date time; + + protected float latitude; + + protected float longitude; + + protected SchoolType schoolType; + + public Date getTime() { + return time; + } + + public void setTime(Date time) { + this.time = time; + } + + public float getLatitude() { + return latitude; + } + + public void setLatitude(float latitude) { + this.latitude = latitude; + } + + public float getLongitude() { + return longitude; + } + + public void setLongitude(float longitude) { + this.longitude = longitude; + } + + public SchoolType getSchoolType() { + return schoolType; + } + + public void setSchoolType(SchoolType schoolType) { + this.schoolType = schoolType; + } +} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit a11c9254c17f14c549cea31fcb718f6f906c4cdc Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:56:52 2015 +0200 add shape file and options map in config --- .../main/java/fr/ird/observe/ObserveConfig.java | 71 +++------- .../java/fr/ird/observe/ObserveConfigOption.java | 106 +++++++++++++++ .../fr/ird/observe/ObserveResourceManager.java | 9 +- .../main/java/fr/ird/observe/ObserveRunner.java | 9 +- .../ird/observe/ui/actions/ShowConfigAction.java | 29 +++- .../resources/shapeFiles/zee/World_EEZ_v8_2014.dbf | Bin 0 -> 177553 bytes .../resources/shapeFiles/zee/World_EEZ_v8_2014.prj | 1 + .../resources/shapeFiles/zee/World_EEZ_v8_2014.sbn | Bin 0 -> 2852 bytes .../resources/shapeFiles/zee/World_EEZ_v8_2014.sbx | Bin 0 -> 372 bytes .../resources/shapeFiles/zee/World_EEZ_v8_2014.shp | Bin 0 -> 5091908 bytes .../shapeFiles/zee/World_EEZ_v8_2014.shp.xml | 147 +++++++++++++++++++++ .../resources/shapeFiles/zee/World_EEZ_v8_2014.shx | Bin 0 -> 2092 bytes 12 files changed, 313 insertions(+), 59 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java index a7102b8..b8909dc 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java @@ -22,6 +22,7 @@ package fr.ird.observe; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; import com.google.common.collect.Sets; import fr.ird.observe.db.DataSourceFactory; import fr.ird.observe.db.constants.CommonDataSourceConfigParam; @@ -39,6 +40,7 @@ import org.nuiton.util.version.Version; import org.nuiton.util.version.Versions; import javax.swing.JOptionPane; +import java.awt.Color; import java.beans.PropertyChangeListener; import java.io.File; import java.io.IOException; @@ -50,57 +52,7 @@ import java.util.Locale; import java.util.Properties; import java.util.Set; -import static fr.ird.observe.ObserveConfigOption.AUTO_POPUP_NUMBER_EDITOR; -import static fr.ird.observe.ObserveConfigOption.BACKUP_DIRECTORY; -import static fr.ird.observe.ObserveConfigOption.BAIT_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.BIRDS_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.CHANGE_SYNCHRO_SRC; -import static fr.ird.observe.ObserveConfigOption.CONFIG_FILE; -import static fr.ird.observe.ObserveConfigOption.DB_DIRECTORY; -import static fr.ird.observe.ObserveConfigOption.DB_LOCALE; -import static fr.ird.observe.ObserveConfigOption.DEFAULT_CREATION_MODE; -import static fr.ird.observe.ObserveConfigOption.DEFAULT_DB_MODE; -import static fr.ird.observe.ObserveConfigOption.DEFAULT_GPS_MAX_DELAY; -import static fr.ird.observe.ObserveConfigOption.DEFAULT_GPS_MAX_SPEED; -import static fr.ird.observe.ObserveConfigOption.DETAILLED_ACTIVITIES_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.DEV_MODE; -import static fr.ird.observe.ObserveConfigOption.FULL_SCREEN; -import static fr.ird.observe.ObserveConfigOption.H2_CAN_MIGRATE; -import static fr.ird.observe.ObserveConfigOption.H2_LOGIN; -import static fr.ird.observe.ObserveConfigOption.H2_PASSWORD; -import static fr.ird.observe.ObserveConfigOption.H2_SERVER_PORT; -import static fr.ird.observe.ObserveConfigOption.I18N_DIRECTORY; -import static fr.ird.observe.ObserveConfigOption.INITIAL_DB_DUMP; -import static fr.ird.observe.ObserveConfigOption.LOAD_LOCAL_STORAGE; -import static fr.ird.observe.ObserveConfigOption.LOCALE; -import static fr.ird.observe.ObserveConfigOption.MAMMALS_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.NON_TARGET_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.OBJECTS_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.OBSTUNA_CAN_MIGRATE; -import static fr.ird.observe.ObserveConfigOption.OBSTUNA_LOGIN; -import static fr.ird.observe.ObserveConfigOption.OBSTUNA_PASSWORD; -import static fr.ird.observe.ObserveConfigOption.OBSTUNA_URL; -import static fr.ird.observe.ObserveConfigOption.OBSTUNA_USE_SSL_CERT; -import static fr.ird.observe.ObserveConfigOption.REPORT_DIRECTORY; -import static fr.ird.observe.ObserveConfigOption.RESOURCES_DIRECTORY; -import static fr.ird.observe.ObserveConfigOption.SAMPLES_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.SHOW_DATE_TIME_EDITOR_SLIDER; -import static fr.ird.observe.ObserveConfigOption.SHOW_MIGRATION_PROGRESSION; -import static fr.ird.observe.ObserveConfigOption.SHOW_MIGRATION_SQL; -import static fr.ird.observe.ObserveConfigOption.SHOW_NUMBER_EDITOR_BUTTON; -import static fr.ird.observe.ObserveConfigOption.SHOW_SQL; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_LONGLINE_CATCH_ID; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_LONGLINE_DEPREDATOR_ID; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_LONGLINE_ENCOUNTER_ID; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_SEINE_NON_TARGET_CATCH_ID; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_SEINE_OBJECT_OBSERVED_SPECIES_ID; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_SEINE_OBJECT_SCHOOL_ESTIMATE_ID; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_SEINE_SCHOOL_ESTIMATE_ID; -import static fr.ird.observe.ObserveConfigOption.SPECIES_LIST_SEINE_TARGET_CATCH_ID; -import static fr.ird.observe.ObserveConfigOption.STORE_REMOTE_STORAGE; -import static fr.ird.observe.ObserveConfigOption.TARGET_DISCARDS_OBSERVATION; -import static fr.ird.observe.ObserveConfigOption.TMP_DIRECTORY; -import static fr.ird.observe.ObserveConfigOption.values; +import static fr.ird.observe.ObserveConfigOption.*; import static fr.ird.observe.ObserveResourceManager.Resource; import static org.nuiton.i18n.I18n.t; @@ -866,6 +818,23 @@ public class ObserveConfig extends ApplicationConfig implements IObserveConfig { setOption(SPECIES_LIST_LONGLINE_DEPREDATOR_ID, speciesListLonglineDepredatorId); } + public Color getMapBackgroundColor() { + Color result = getOptionAsColor(MAP_BACKGROUND_COLOR.key); + return result; + } + + public List<File> getMapLayerFiles() { + List<File> layers = Lists.newLinkedList(); + + for (ObserveConfigOption layerOption : ObserveConfigOption.MAP_LAYERS) { + File layerFile = getOptionAsFile(layerOption.key); + if (layerFile != null && layerFile.exists()) { + layers.add(layerFile); + } + } + return layers; + } + public String[] getUnsavables() { if (unsavables == null) { List<String> tmp = new ArrayList<String>(); diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java index 2fa3e54..d797d8c 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java @@ -21,12 +21,15 @@ */ package fr.ird.observe; +import com.google.common.collect.ImmutableList; import fr.ird.observe.db.constants.CreationMode; import fr.ird.observe.db.constants.DbMode; import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ConfigOptionDef; +import java.awt.Color; import java.io.File; +import java.util.List; import java.util.Locale; import static org.nuiton.i18n.I18n.n; @@ -612,8 +615,111 @@ public enum ObserveConfigOption implements ConfigOptionDef { String.class, false, false + ), + + /** le chemin vers le fond de carte */ + MAP_BACKGROUND_COLOR( + "map.background.color", + n("observe.config.map.background.description"), + new Color(87, 200, 255).toString(), + Color.class, + false, + false + ), + /** shape file 1 */ + MAP_LAYER_1( + "map.layer1.path", + n("observe.config.map.layer1.description"), + "${user.home}/.observe/shapeFiles/zee/World_EEZ_v8_2014.shp", + File.class, + false, + false + ), + /** shape file 2 */ + MAP_LAYER_2( + "map.layer2.path", + n("observe.config.map.layer2.description"), + null, + File.class, + false, + false + ), + /** shape file 3 */ + MAP_LAYER_3( + "map.layer3.path", + n("observe.config.map.layer3.description"), + null, + File.class, + false, + false + ), + /** shape file 4 */ + MAP_LAYER_4( + "map.layer4.path", + n("observe.config.map.layer4.description"), + null, + File.class, + false, + false + ), + /** shape file 5 */ + MAP_LAYER_5( + "map.layer5.path", + n("observe.config.map.layer5.description"), + null, + File.class, + false, + false + ), + /** shape file 6 */ + MAP_LAYER_6( + "map.layer6.path", + n("observe.config.map.layer6.description"), + null, + File.class, + false, + false + ), + /** shape file 7 */ + MAP_LAYER_7( + "map.layer7.path", + n("observe.config.map.layer7.description"), + null, + File.class, + false, + false + ), + /** shape file 8 */ + MAP_LAYER_8( + "map.layer8.path", + n("observe.config.map.layer8.description"), + null, + File.class, + false, + false + ), + /** shape file 9 */ + MAP_LAYER_9( + "map.layer9.path", + n("observe.config.map.layer9.description"), + null, + File.class, + false, + false + ), + /** shape file 10 */ + MAP_LAYER_10( + "map.layer10.path", + n("observe.config.map.layer10.description"), + null, + File.class, + false, + false ); + protected static List<ObserveConfigOption> MAP_LAYERS = ImmutableList.of(MAP_LAYER_1, MAP_LAYER_2, MAP_LAYER_3, + MAP_LAYER_4, MAP_LAYER_5, MAP_LAYER_6, MAP_LAYER_7, MAP_LAYER_8, MAP_LAYER_9, MAP_LAYER_10); + /** * Clef qui represente l'option (c'est celle enregistrée dans le fichier de * configuration). diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java b/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java index a38fb58..b6f8403 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java @@ -58,6 +58,12 @@ public class ObserveResourceManager { public static final String OBSERVE_REPORTS_PROPERTIES = "/observe-reports.properties"; + public static final String OBSERVE_MAP_BACKGROUND = + "/shapefiles/backgroundes/background.shp"; + + public static final String OBSERVE_MAP_LAYERS = + "/shapeFiles"; + /** Logger */ static private Log log = LogFactory.getLog(ObserveResourceManager.class); @@ -65,7 +71,8 @@ public class ObserveResourceManager { ui(OBSERVE_UI_PROPERTIES), application(OBSERVE_APPLICATION_PROPERTIES), - report(OBSERVE_REPORTS_PROPERTIES); + report(OBSERVE_REPORTS_PROPERTIES), + mapLayers(OBSERVE_MAP_LAYERS); private final String location; diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java b/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java index 0001918..432f4a2 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java @@ -213,7 +213,7 @@ public abstract class ObserveRunner extends ApplicationRunner { if (log.isInfoEnabled()) { log.info(t("observe.runner.i18n.loaded", - config.getLocale().getDisplayLanguage())); + config.getLocale().getDisplayLanguage())); } // 4 - preparation de la configuration des ui @@ -458,6 +458,13 @@ public abstract class ObserveRunner extends ApplicationRunner { // 8 - validation report directory resourceManager.createDirectory(config, VALIDATION_REPORT_DIRECTORY); + + // 9 - resources shapeFiles + +// String message = t("observe.runner.copy.default.report.file", eezShapeFile); +// +// resourceManager.copyDirectory(Resource.mapLayers, config, RESOURCES_DIRECTORY, massage); + } protected void detectLocalDataBase(ObserveConfig config) throws IOException { diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java b/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java index a19ff09..a2fe180 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java @@ -220,7 +220,7 @@ public class ShowConfigAction extends AbstractAction { protected void addH2Options(ObserveConfigUIBuilder helper) { helper.addCategory(n("observe.config.category.h2"), - n("observe.config.category.h2.description")); + n("observe.config.category.h2.description")); helper.addOption(ObserveConfigOption.H2_LOGIN); helper.addOption(ObserveConfigOption.H2_PASSWORD); @@ -261,7 +261,7 @@ public class ShowConfigAction extends AbstractAction { protected void addGpsOptions(ObserveConfigUIBuilder helper) { helper.addCategory(n("observe.config.category.gps"), - n("observe.config.category.gps.description")); + n("observe.config.category.gps.description")); helper.addOption(ObserveConfigOption.DEFAULT_GPS_MAX_DELAY); helper.addOption(ObserveConfigOption.DEFAULT_GPS_MAX_SPEED); @@ -282,11 +282,10 @@ public class ShowConfigAction extends AbstractAction { helper.addCategory( n("observe.config.category.observation"), - n("observe.config.category.observation.description")); - - helper.addOption(ObserveConfigOption.DETAILLED_ACTIVITIES_OBSERVATION, - ObserveUICallback.ui); + n("observe.config.category.observation.description"), + ObserveUICallback.ui.name()); + helper.addOption(ObserveConfigOption.DETAILLED_ACTIVITIES_OBSERVATION); helper.addOption(ObserveConfigOption.NON_TARGET_OBSERVATION); helper.addOption(ObserveConfigOption.BAIT_OBSERVATION); helper.addOption(ObserveConfigOption.MAMMALS_OBSERVATION); @@ -325,6 +324,24 @@ public class ShowConfigAction extends AbstractAction { } + protected void addMapOptions(ObserveConfigUIBuilder helper) { + + helper.addCategory( + n("observe.config.category.map"), + n("observe.config.category.map.description"), + ObserveUICallback.ui.name()); + + helper.addOption(ObserveConfigOption.DETAILLED_ACTIVITIES_OBSERVATION); + helper.addOption(ObserveConfigOption.NON_TARGET_OBSERVATION); + helper.addOption(ObserveConfigOption.BAIT_OBSERVATION); + helper.addOption(ObserveConfigOption.MAMMALS_OBSERVATION); + helper.addOption(ObserveConfigOption.SAMPLES_OBSERVATION); + helper.addOption(ObserveConfigOption.OBJECTS_OBSERVATION); + helper.addOption(ObserveConfigOption.BIRDS_OBSERVATION); + helper.addOption(ObserveConfigOption.TARGET_DISCARDS_OBSERVATION); + + } + protected void addOthersOptions(ObserveConfigUIBuilder helper) { helper.addCategory(n("observe.config.category.other"), diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.dbf b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.dbf new file mode 100644 index 0000000..e5397a1 Binary files /dev/null and b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.dbf differ diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.prj b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.prj new file mode 100644 index 0000000..f45cbad --- /dev/null +++ b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] \ No newline at end of file diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbn b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbn new file mode 100644 index 0000000..9b84b5b Binary files /dev/null and b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbn differ diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbx b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbx new file mode 100644 index 0000000..e891817 Binary files /dev/null and b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbx differ diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp new file mode 100644 index 0000000..429acd0 Binary files /dev/null and b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp differ diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp.xml b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp.xml new file mode 100644 index 0000000..187f15b --- /dev/null +++ b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp.xml @@ -0,0 +1,147 @@ +<metadata xml:lang="nl"><Esri><CreaDate>20131014</CreaDate><CreaTime>13354700</CreaTime><SyncOnce>FALSE</SyncOnce><SyncDate>20140227</SyncDate><SyncTime>14430500</SyncTime><ModDate>20140227</ModDate><ModTime>14430500</ModTime><DataProperties><lineage><Process ToolSource="c:\program files (x86)\arcgis\desktop10.1\ArcToolbox\Toolboxes\Data Management Tools.tbx\CalculateField" Date="20120906" Time="120028" Name="" export="">CalculateField World_Maritime_Boundaries_v7 LastChange [Remarks] VB [...] +The data set of the Exclusive Economic Zones can be used in many applications. In biogeography for example, it is possible to create for instance species distribution lists per country.</idPurp><idAbs><DIV STYLE="text-align:Left;"><DIV><DIV><P STYLE="margin:0 0 0 0;"><SPAN>Two global GIS-covers in ESRI shape format were produced: one contains polylines representing the maritime boundaries;the second holds polygons representing the EEZs. When all the boundary [...] +HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy +MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCACFAMgDASIA +AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA +AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 +ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm +p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA +AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx +BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK +U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3 +uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3+iii +gAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooqoNQQ7j5 +Uu1ZDGWAHUHHTOamU4x+J2At0VSOpRKxVkYFeoLoCPr81NbVoOEU4kYhVUsrcn2BJ9T+Bqfaw3uO +zL9FYl9qiwR/JcCeVjhYlkCDOM9QCR+uawY9a1K4gkkGmxFQCA5V32H1LEdODwcfXPFZrEcyvCLY +WOz+1W//AD3i/wC+xR9rtv8An4i/77FedXGteIbm6aJZUVedpj/dowJ4O48jgHqe2fejSr3VJZFF +xqUwJQsj5aRGGcdFxtPU/MeeOO9Uqk7XaX9fILHopu7YdbiIf8DFH2u2/wCfiL/vsVy2nQyzQPLe +XEt8r5KrFdHa645wBwT143dq2rWHTNUtxcW080sRJB23Mo57gjd+hojUc/hsFi/9rtv+fiL/AL7F +H2u2/wCfiL/vsVl6rZ6RZ2pursTRImFBimkU5J44U8mqGhGdYJbu7muPJklP2VJZt+U7H1zxnn9K +mtVlSjd2BK50qTwyNtSVGPorA1JWNLJJI7C4hIhP3V8wc47/AOT6Vm36XO4yw3cFtbEEgyWqqQ3U +A7yMjH41nHFuyut/MfKdXRXLwXELxokbxXU4bJ8pY2HI6sFOcdOnt1q1cxRrbtdTF7dFH+rijRsj +oDgpkdc+3fHNJ4y32Q5Teork9NYFROEEsTkfLPMjSAHHRUQ889CasHU7JpF+zWk0+W2lVgCjOOxb +Aznjr1zTWJk3ZQuHKdJRXPT6ZqjzCW2MEaNgmKXYwX2wEz9fm69PeWIXkUywzWCyfMQbi3XywOM9 +Cc9vXHvWrqVEr8grI3KKyzfPDIsJMoBHDyQMfwyMc/Xr71U/tS+8yVfsd5tUZWQKCG/JKft12f3B +Y36KzftSgLuvtrN0UsmT+lNh1ZQjGVTwcD54y344b+VTHEwk7beoWZqUUUV0CCudbT2ubuaQXDx7 +JmYpHIQr/MSNxH4cdsd+/RVRbS4GkZ2ZiWYscqp6nPXGf/1VhXpynG0Rp2MXS759MtJbSO2lu5lO +5fJfdCM4G0MfujqenY1pNqbG3LXFpHIpyQsUm4Pj0LBVJ9s1fFlbgAGPeB08wl8fnmpZI1ljKOMq +ffFUo1LasNCnpl1p+o2SS2IjMS5XaFAKHHKkdjzSy6PpkzbpLC2Zt27JiHJxjn149azzYLBrkMsc +zRPkByuAJVIc/OOh5HBwDya3aqEuZaiMW+0e0UKLezihRwVleG3UnaOQMAfrg9OlZEehL58NjDeb +ot5kBMQLJgcAt19PTt04FdjVSc2VlN9tlCRyyYi3gZZ/RQByTx+lTKneSlfQdznorWezu7m51ACK +S5P7v59sQkBPUgnluMEjI5HHe3ax3NrHcpZxmIXMpkfeCXhdsbsYBDeoyR+IqjJb6lqTzF7mUQMm +0qCzEnGcYQBVzkAjJI55710Om201vGBM5YhAuTgE4zyQOBxx1rFRvV5oN6j6EJ00T/O6B+uFmYls +f72Tgd8VQNh/ZZVmkJBRtzSSFxtHUkbcZ5HYe+a2pLxY5SnluQpwWG0AHGccn05qnrBjm00sNxDq +6ZC5wNpJyp4/h74pVKdNxdnqvME2Ytvqu+ylubVEDRfKFl+UNJg5Prjg8fyxk0jrdvcRJcaar3Go +zuUd5IwJUUEAKo5C5yMH8+avx6fY6PNJNe27SZYvFEXDhCcF2A4AHyr71atfFdu0sSXFs1tBLHvj +k3BgMdQ2OnbHXqOh4q6cIxd76/ihNmgbKTULGNLvzYGUDaVlDOeP4vl25/A0+DRdPg5+zrIxABaY +mQnjH8Wew7VRm1m+ufMfSrQTW68CV0bDHuQOCcHjA7g9Kl1HWZrKKyl8gok7AOJFyydONoPXr61v +dbiNI2dsYjGIIwhO7CqB83rx39+tFtZW1mpFvCkefvEDluSeT1PJJ59anoqgCiikZlRGd2CqoyWJ +wAKAFqgNWtnErQt5qRbgzqy7QR179qZLrthHGWSbzWDbSkf3gfxxjoaxJpL2fWJZY7aMo0YhkVge +FYnAIHJPUnjvWNapyq0XqNI1bvUrxQhgs4y29VxIw+UnvweTg9B2yc9qSa4mlZFilhgy25/LAkVs +/wB5iAB/M1PBYM8vnzDyyQAFU849P9kewP1PapjpsPzhWdQ/3gMHPOepGepPfvWa9vJJ7D0LlFFF +dRIVQF5KJmRmh3byBG2UOM8Edc/lV+qt7a/a4whCsvOUfOD78en+fWs6qk17j1GhVvY9wWRXiY44 +Ycc8DkZA/GrNZSWlnc7Y45mLBPmyPvKRgkZ6ZyenHNatFNya963yBlPULbzot6j50578jOfUcjGR +3yKpWOo3Ed99ivBvRkVoLlRxIOBhj0zkj65HrWzWTcQMpWzLKYzjHy4Jyf1x1JGD34qKnNGSlH5g +ie5vZ452iht9wXGZDkjPXoBnpWHNrcVzqcVs80YaMbwVYLt4IJwc4bnGG4/MGruo2d2IJGK+dlNu +Vk2k+npkgnIzu/HNc42nw6hefYZ7Vw0SYjjEZ3Egc85AxjjrjjjrWc3Ntp7dv63Gjs7RMyAxy/u1 +zhdzZxyApU9Mf0q9XCGz1PTJbS8eGVNzN5vzB1j5+TBJzk9CSQMcc8Cu3hnjnUtG2QDg8EEfnW1N +9HoxMSS3jlJJXDHjcOD/APX/ABrCe2kmuhbRxhyJHZpCSNi5I5PJPDdOhI7c1uXUbSRYXnByV/vD +/PP4Vj2DtZaxPDPF5ayqoSTcMFvQj3yfbORUVIKU0mvn+gIv2+iaba8xWUO7aE3MuTj05qq3huzW +SUwARLM2ZFC5B9QO3cjkHGeK12dFZVZlBboCetOrZxUlZiOYuNLh0a5tL2SR3tklAkPQqW4Vmx1G +Tz+HpWtqs8luLd/sBvIC+JQi73T0YL396u3EEdzbyQSjKSKVYe1YYm1fT7VLV4xIFYot1uGWXkg7 +e2Bwep44BpO0F5AX4dcsZVJZ3hZcB1mjZdhJwAxIwDnjrWiCCAQcg1lfYkWweSZd0o3MrMMlevOO +vIJJHfOPaqzXaoI7CFyqjd8yDgLkY5z0AJ4HPy+lR7WztIdjcSSOUExurgHBKnOD6Uya5gtkLzTJ +GvqzY7ZrnJLz+w5WMaAxmQqUJ27ssQCcA45P6Y7VDM9o11c6iG2RvEHJlbupyRgHoccE++MjFS8Q +lG/ULEFnYrquHheWGJZSSceUxxyAR1J2lefXJ54rcsEtrZbYrhQzEfO5JJ5Gck9ev4se9ZWkXgae +6tLq33OjmPC4JcNuYY9CMkHsMjnitTZLIkssMYb7RGAGLjOcHluPp0z3rklLlak312/r7yjTgukn +UsAyAKGy2Oh79fai4klFvvtlWRsjHcEZ5/Sqk8g2GIRpbhjuMhGVLZyPT9f1qa0zDM0JLMrDepbH +UcHp9R+tdUMRFyUL38ybdS5RRRXSIKworyRJ7pyXVopJFIKswcZypJ6AY4//AFYrdrmZLbzb4yLl +mW5kUjbnIOc5wM4HHU9cVzYltJco0W1DRzP5ZyisXQbDyQeFGRwcAjqePyrSa+hUj7xGMlsYx19e +ex/Ks9lLTW3mzss4G0puxhsE7sDr39RzVkW8IjMZVVaRcMQeW49TyetcaxMqbatuXy3NCiqsV5uU +eZG4+bZv4wTnAPXPP9amknjjO1nG7rtHJ/LrXpRqRkrpmdivfQSTNEUUMq5yCMnOQcjkY6HntVLS +oGS9lErAlBx6ltzbieB229z973FbAIYAggg8gjvWZfZW5We2dfPXCYbOCegGe/XkewPaonCKl7Qf +kaZAYEEAg8EGssafeQ3cslvJAkTOCqKpQgYwfUHkDt3PStGCTzYI5CMF1DY9Mimz3MduPmyzHoiD +LH8P69K0lZq7EUR589yqSOVlVgPlyAgGCT1wc5Uc469OoqzdiCZhDMhJ4wwA+XJwPz/H3qras9up +dUDeZghhk+Z64/HJz75rRlhWQFgqCUAhHKglTWVNXi/1/rsNmTe6FDJAPKUvIp4yFyflIx2/z71a +0Z86ckP70mA+UWk6tjv+RFWbaOWNW8w9TkDeWx+JqvpmQsqSHMwI3HH4fzDfz71UdJJpWuBeY7VJ +wTgZwKw7eaW9lNxLjcrfKhUlYwMHk9Dzj3yM9sDUvbo2tvvABY8AH6Z/GuWtrJECOZf3ivtZVYqu +w4GOOR97rxwDWdeTWkXqCOkkuDLp05yjNzHuU/Lk8A/qKbaW6STTSSRgOrhRtckYwD7dyajsJGcK +PLkIkGJQ6kjIGOD0Pp1NaSIsahUUKo6BRgUU17S05dED0MHXtOhlmin3pHJvDbi+wjoDz6Hj6EDs +TWdA8QtxFclCdptw0pKgEFv3mdu3ODng4HY811M9nHPJvdmx8uVGMNg5GeKpXUMcUiwRCTzZODIG +O/GOADkdlJyfTuTSqQknzIaOUtru4jjWeK9sjOvyiHzQSRztA254wSMkjrnsK1kuI4Yg08gR+pii +lKsrE8nHccjkk9e3bTh0OEztPKipuP8Aq0UDI5+83UnnPXHb6sOiiBpJgfN7bNuCy5JOT3bn9Mdz +WfsZct7BcprfNdItvvbzigHlbgCR3+bOGOM9BxzxmrcMhQlzG5nUbyxxnHIwc84x/Q96Yy24AKyg +KVBj4VSzZIwOmD2PfntVaJJVj2zMfO8tQizEM/U5wRznGPz54xXLB6qyKOnooor2DMKzNO2G7uji +JJFkddqkbmG7OT+Y+nPrWnVG3tnNwZZQyBJGKLnOcluevTB6fnWc0+aNkMusqupV1DKeoIyKrixh +yMjKKcrGQNoP5e5qzRVuKe6EQrawKRtTAHRcnA+g6USWyyS+ZvZTjB245/SpqKThFqzQCIqoioow +qjAHtWRdRFJnkkMgYFpI0DDYSDgYHXPI/GtisPxBHNLbyJEryEiM+WuMsgfMgX3xj9KyxEU4ajW5 +fmuBY2ywRbZJ0jBSPkbgMA9M4+pqCziku5XurlRtY4VOGBA6Y46DJ+pOemKzo70Xk73It2UtKI3E +0ZGxRnarZIx/ex6vj67LX3lrGJAiu+cb32AgHt/PFT7WMm77ILFyoJrho5BGiKzFd3zNtz9OD/ki +mJdswO6B+DjK/wD18GpiIrmMEjcucg9CD0+oPWtOdVIv2ctQtbcdG6yIHXOD61Rmjlt74zwqzK4+ +Zecd+OB64PTu3rU7zrAfKSMYRQSMgAD2/L6e9To4kjV16MARmndT92+qAoiCa7uRJcxhEX7q5z/n +PfOOmMdTVqO1hjYFExj7oycL9B0H4UXETyKAuCB1UnAP+fSoGtJWC7mWTAxhyTt5J4POeoH4VLTi +9I3+4C7VZLrfME2YUsyA7ucjOePwNQ3pngtl2szBVwzD14wTzkD8frS2MxkkkDKjMB/rVIJPsxAA +z/Sm53mo7BYvVn38UguIZ4o9xXHqcEH2BP3S46d60KKuUeZWEZ73N6wLJCFQDJyjMfwBwT9Mfjni +mRauiQk3iiOTeUAjy6n05xwfY4rTqrc2EV1IHcsCMHgA8jODyDzyahxmtYu/qMorZveQuHjhUFmD +S5yRkksACOmSR19aotcJHKbZGUGbdJtRQAwU4BGOQDgEHkHB6VozyokAjWItbRyESMx+9jOTjv8A +N+fPBqGG32vKkSNOXj5m3AnPQgngY6cD/CuRtRkow1fX9Sjbooor0CApsciSglDnDFT7EdadWcLf +DSFrPcWdjuwnOScd/TFZVajgrpXGlcvs6ou52Cj1JxUf2u37TIx9FbJ/IVjXVtdq4mtCyMrZEYg2 +8dwTtOfwx9an06AINlxHcyuzZzLuKjj/AGiR+lTCpOf2bev/AAwNI0ftcX/TT/v03+FBu4wDgSE+ +mwj9TgVDLpGmTEGXTrSQjpvgU/0p402yUYS1iQYwQihQR6EDqPrVtVOjX3f8ENCBdWil3eS0DbTg +gzrkflmotR1W3s7bfetBFH1yxL/iABz9fersOn2dvEsUNrCka9FCDAqhd6G1xeLNHdiJF5EYhXGf +qMH881DhU/m/ALox1la/v4fsoSKGRmC3MyiVpWA5AB6YH5/StyKzVyYgsarGBklcmTjqRwPX1pkW +n3sU8TE2siRjA37i44xweg/LpQ9jqMsitLLbEBvuqvb0yQfz9q5nRlz/AA3Xmyr6FjyLW2+SOYxs +AAVQAk/hg+tKbuG0i6EKT9+Uhdx/n+lRpp9yJF33S+SDny0QqR7bgR/KrUNjbW8hkihUSHOXPLcn +JGT78/WuiMJ35kkvxZNyr9vWVgfs6SMp4wGYr/45xUv22Xn/AEZuPZ//AIirtFaKEv5vyAom9nxk +WrEdScNwPpt5+gpC1/Jjamz6lVH/ALNV+ijkfVsLmbPdXVlbtLMuVUgEhQ3JOBjlfUdqcst1OA0Z +fkcHYI1/Hdk/kPStCih03/MwuZ5TU+zx9f8AnqOn/funCPUO8i9P+eg/+Iq9RR7Nd397C5RMeoZ4 +kXHr5g/+IpANQRRuw+cA7GUke4yoFX6KPZru/vC5ltuDmSWGVXByGECsxP1UEfyqxDehgxYh1U4Z +0/hI6hhnIIpNRtZ7uERRSIqE/OCOT3GDyOvYg5qJIZktPs/kuSFK78oAffjH8hWE1VpyXJdjVnua +VFFFdZIUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUA +FFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAH//2Q==</Data></Thumbnail></Binary><mdContact xmlns=""><rpIndName>Nathalie De Hauwere</rpIndName><rpOrgName>Flanders Marine Institute, VLIZ</rpOrgName><rpPosName>Scientific Assistant, GIS</rpPosName><role><RoleCd value="007"/></role><rpCntInfo xmlns=""><cntAddress addressType=""><eMailAdd>info@marineregions.org</eMailAdd></cntAddress></rpCntInfo><displayName>Nathalie De Hauwere</displayName></mdContact><mdMaint xmlns="" [...] + + +- Singapore - Malaysia + +- New boundary between Colombia and Nicaragua + +- Malta (Continental Shelf) + +- Guyana - Suriname + + +- Norway: create seperate polygon for the Fisheries Protection Zone around + +- Boundary Morocco - Mauritania + +- Maritime Dispute Chile-Peru + +- Split Guadeloupe and Martinique + +- Split US Virgin Islands and Puerto Rico + +- ISO Codes + +- Error in the western boundary of the Wallis & Futuna EEZ + +- Boundary Kenya - Somalia + +- Boundary UK - France, Celtic Sea + +- Boundary China/North Korea is disputed + +- Change terminology: 'disputed' in 'median line - disputed' + +- Boundary Tuvalu-Kiribati: agreed boundary: + +- Boundary New Caledonia (with Australia/Norfolk Island): continental shelf instead of EEZ + +- Congo (Kinshasa) has claimed 200 NM / territorial sea / baselines / and continental shelf + +- Include metadata in downloadfiles + +- Update boundary Palmyra Atoll, based on http://www.nauticalcharts.noaa.gov/csdl/mbound.htm + +- Vanuatu EEZ boundary + +- Trinidad & Tobago + Barbados + Venezuela</statement></dataLineage></dqInfo><eainfo><detailed Name="World_EEZ_v8_2014" xmlns=""><enttyp><enttypl Sync="TRUE">World_EEZ_v8_2014</enttypl><enttypt Sync="TRUE">Feature Class</enttypt><enttypc Sync="TRUE">249</enttypc></enttyp><attr xmlns=""><attrlabl Sync="TRUE">FID</attrlabl><attalias Sync="TRUE">FID</attalias><attrtype Sync="TRUE">OID</attrtype><attwidth Sync="TRUE">4</attwidth><atprecis Sync="TRUE">0</atprecis><attscale Sync="TRUE">0</ [...] diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shx b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shx new file mode 100644 index 0000000..c8f1c74 Binary files /dev/null and b/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shx differ -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit b85bc13d381aa0eba604aae90826d57656c85c46 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:58:08 2015 +0200 add map in trip seine UI --- observe-swing/pom.xml | 22 ++ observe-swing/src/license/THIRD-PARTY.properties | 23 +- .../ui/content/open/impl/seine/TripSeineUI.css | 8 + .../ui/content/open/impl/seine/TripSeineUI.jaxx | 323 +++++++++++---------- .../open/impl/seine/TripSeineUIHandler.java | 156 +++++++++- .../resources/i18n/observe-swing_en_GB.properties | 15 + .../resources/i18n/observe-swing_es_ES.properties | 15 + .../resources/i18n/observe-swing_fr_FR.properties | 15 + pom.xml | 68 +++++ 9 files changed, 480 insertions(+), 165 deletions(-) diff --git a/observe-swing/pom.xml b/observe-swing/pom.xml index 16a4b23..639159b 100644 --- a/observe-swing/pom.xml +++ b/observe-swing/pom.xml @@ -237,6 +237,28 @@ <scope>runtime</scope> </dependency> + <!-- Map --> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-swing</artifactId> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-shapefile</artifactId> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-api</artifactId> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-main</artifactId> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-render</artifactId> + </dependency> + <!-- Logging --> <dependency> <groupId>org.slf4j</groupId> diff --git a/observe-swing/src/license/THIRD-PARTY.properties b/observe-swing/src/license/THIRD-PARTY.properties index 02aa035..843f100 100644 --- a/observe-swing/src/license/THIRD-PARTY.properties +++ b/observe-swing/src/license/THIRD-PARTY.properties @@ -1,33 +1,42 @@ # Generated by org.codehaus.mojo.license.AddThirdPartyMojo #------------------------------------------------------------------------------- # Already used licenses in project : +# - AL 2.0 # - Apache License 2.0 +# - Apache License, version 2.0 # - Apache Software License, version 1.1 # - BSD License -# - Common Public License Version 1.0 +# - Common Development and Distribution License +# - Eclipse Distribution License (EDL), Version 1.0 +# - Eclipse Public License (EPL), Version 1.0 +# - Eclipse Public License 1.0 # - GNU General Public License - Version 2 with the class path exception -# - GNU LESSER GENERAL PUBLIC LICENSE +# - GNU General Public License, Version 2 with the Classpath Exception # - GNU Lesser General Public License -# - GNU Lesser General Public License, 2.1 -# - GNU Lesser General Public License, version 2.1 # - GNU Library or Lesser General Public License # - General Public License (GPL) # - Indiana University Extreme! Lab Software License, vesion 1.1.1 +# - JDL (Java Distribution License) # - LGPL 2.1 # - Lesser General Public License (LGPL) # - Lesser General Public License (LGPL) v 3.0 # - MIT License # - MPL 1.1 # - New BSD License +# - OGC copyright # - Public Domain +# - Similar to Apache License but with the acknowledgment clause removed +# - Simplified BSD # - The Apache Software License, Version 2.0 # - The H2 License, Version 1.0 -# - lgpl -# - license.txt #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Tue Jun 25 08:54:11 CEST 2013 +#Tue Apr 14 11:12:38 CEST 2015 commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0 dom4j--dom4j--1.6.1=BSD License +java3d--vecmath--1.3.2=GNU General Public License - Version 2 with the class path exception +javax.media--jai_codec--1.1.3=JDL (Java Distribution License) +javax.media--jai_imageio--1.1=JDL (Java Distribution License) +jgridshift--jgridshift--1.0=GNU Library or Lesser General Public License diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css index b747f9a..b1772ef 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css @@ -30,6 +30,14 @@ NumberEditor { numberPattern:{fr.ird.observe.ui.UIHelper.INT_6_DIGITS_PATTERN}; } +#generalTab { + title:"observe.tripSeine.tab.general"; +} + +#mapTab { + title:"observe.tripSeine.tab.map"; +} + #model { editable:true; modified:{validator.isChanged()}; diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx index b8d2d76..d63894c 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx @@ -45,6 +45,8 @@ static fr.ird.observe.ui.UIHelper.getStringValue static org.apache.commons.lang3.StringUtils.isEmpty static org.nuiton.i18n.I18n.n + + org.geotools.swing.JMapPane </import> <!-- handler --> @@ -76,163 +78,170 @@ protected boolean canEditOcean(java.util.List<Route> routes) { <!-- formulaire --> <JPanel id="body" layout='{new BorderLayout()}'> - <Table insets="0" fill="both" constraints='BorderLayout.CENTER'> - - <!-- captain --> - <row> - <cell anchor='west'> - <JLabel id='captainLabel'/> - </cell> - <cell anchor='east'> - <BeanComboBox id='captain' constructorParams='this' genericType='Person'/> - </cell> - </row> - - <!-- observer --> - <row> - <cell anchor='west'> - <JLabel id='observerLabel'/> - </cell> - <cell anchor='east'> - <BeanComboBox id='observer' constructorParams='this' genericType='Person'/> - </cell> - </row> - - <!-- dataEntryOperator --> - <row> - <cell anchor='west'> - <JLabel id='dataEntryOperatorLabel'/> - </cell> - <cell anchor='east'> - <BeanComboBox id='dataEntryOperator' constructorParams='this' genericType='Person'/> - </cell> - </row> - - <!-- vessel --> - <row> - <cell anchor='west'> - <JLabel id='vesselLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='vessel' constructorParams='this' genericType='Vessel'/> - </cell> - </row> - - <!-- ocean (editable uniquement si pas de route saisie) --> - <row> - <cell anchor='west'> - <JLabel id='oceanLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='ocean' genericType='Ocean' constructorParams='this'/> - </cell> - </row> - - <!-- departureHarbour --> - <row> - <cell anchor='west'> - <JLabel id='departureHarbourLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='departureHarbour' genericType='Harbour' constructorParams='this'/> - </cell> - </row> - - <!-- landingHarbour --> - <row> - <cell anchor='west'> - <JLabel id='landingHarbourLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='landingHarbour' genericType='Harbour' constructorParams='this'/> - </cell> - </row> - - <!-- id ers --> - <row> - - <cell anchor='west'> - <JLabel id='ersIdLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <JPanel layout='{new BorderLayout()}'> - <JToolBar id='ersIdToolbar' constraints='BorderLayout.WEST'> - <JButton id='resetErsId' constraints='BorderLayout.WEST' styleClass='resetButton'/> - </JToolBar> - <JTextField id='ersId' constraints='BorderLayout.CENTER'/> - </JPanel> - </cell> - </row> - - <!-- startDate --> - <row> - <cell anchor='west'> - <JLabel id='startDateLabel'/> - </cell> - <cell anchor='west' weightx="0.5"> - <JXDatePicker id='startDate'/> - </cell> - </row> - - <!-- endDate --> - <row> - <cell anchor='west'> - <JLabel id='endDateLabel'/> - </cell> - <cell anchor='west' weightx="0.5"> - <JXDatePicker id='endDate'/> - </cell> - </row> - - <!-- formsUrl --> - <row> - <cell anchor="west"> - <JLabel id='formsUrlLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <JPanel layout='{new BorderLayout()}'> - <JToolBar id='formsUrlToolbar' constraints='BorderLayout.WEST'> - <JButton id='resetFormsUrl' constraints='BorderLayout.WEST' styleClass='resetButton'/> - </JToolBar> - <JTextField id='formsUrl' constraints='BorderLayout.CENTER'/> - <JToolBar id='formsUrlToolbar2' constraints='BorderLayout.EAST'> - <JButton id='openLinkFormulairesUrl' - onActionPerformed='getHandler().openLink(getModel().getBean().getFormsUrl())'/> - </JToolBar> - - </JPanel> - </cell> - </row> - - <!-- reportsUrl --> - <row> - <cell anchor="west"> - <JLabel id='reportsUrlLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <JPanel layout='{new BorderLayout()}'> - <JToolBar id='reportsUrlToolbar' constraints='BorderLayout.WEST'> - <JButton id='resetReportsUrl' constraints='BorderLayout.WEST' styleClass='resetButton'/> - </JToolBar> - <JTextField id='reportsUrl' constraints='BorderLayout.CENTER'/> - - <JToolBar id='reportsUrlToolbar2' constraints='BorderLayout.EAST'> - <JButton id='openLinkRapportsUrl' constraints='BorderLayout.EAST' - onActionPerformed='getHandler().openLink(getModel().getBean().getReportsUrl())'/> - </JToolBar> - </JPanel> - </cell> - </row> - - <!-- comment --> - <row> - <cell fill='both' weighty="1" columns="2"> - <JScrollPane id='comment' onFocusGained='comment2.requestFocus()'> - <JTextArea id='comment2' onKeyReleased='getModel().getBean().setComment(comment2.getText())'/> - </JScrollPane> - </cell> - </row> - </Table> + <JTabbedPane id='tripSeineTabPane' constraints='BorderLayout.CENTER'> + <tab id='generalTab'> + <Table insets="0" fill="both"> + + <!-- captain --> + <row> + <cell anchor='west'> + <JLabel id='captainLabel'/> + </cell> + <cell anchor='east'> + <BeanComboBox id='captain' constructorParams='this' genericType='Person'/> + </cell> + </row> + + <!-- observer --> + <row> + <cell anchor='west'> + <JLabel id='observerLabel'/> + </cell> + <cell anchor='east'> + <BeanComboBox id='observer' constructorParams='this' genericType='Person'/> + </cell> + </row> + + <!-- dataEntryOperator --> + <row> + <cell anchor='west'> + <JLabel id='dataEntryOperatorLabel'/> + </cell> + <cell anchor='east'> + <BeanComboBox id='dataEntryOperator' constructorParams='this' genericType='Person'/> + </cell> + </row> + + <!-- vessel --> + <row> + <cell anchor='west'> + <JLabel id='vesselLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='vessel' constructorParams='this' genericType='Vessel'/> + </cell> + </row> + + <!-- ocean (editable uniquement si pas de route saisie) --> + <row> + <cell anchor='west'> + <JLabel id='oceanLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='ocean' genericType='Ocean' constructorParams='this'/> + </cell> + </row> + + <!-- departureHarbour --> + <row> + <cell anchor='west'> + <JLabel id='departureHarbourLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='departureHarbour' genericType='Harbour' constructorParams='this'/> + </cell> + </row> + + <!-- landingHarbour --> + <row> + <cell anchor='west'> + <JLabel id='landingHarbourLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='landingHarbour' genericType='Harbour' constructorParams='this'/> + </cell> + </row> + + <!-- id ers --> + <row> + + <cell anchor='west'> + <JLabel id='ersIdLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel layout='{new BorderLayout()}'> + <JToolBar id='ersIdToolbar' constraints='BorderLayout.WEST'> + <JButton id='resetErsId' constraints='BorderLayout.WEST' styleClass='resetButton'/> + </JToolBar> + <JTextField id='ersId' constraints='BorderLayout.CENTER'/> + </JPanel> + </cell> + </row> + + <!-- startDate --> + <row> + <cell anchor='west'> + <JLabel id='startDateLabel'/> + </cell> + <cell anchor='west' weightx="0.5"> + <JXDatePicker id='startDate'/> + </cell> + </row> + + <!-- endDate --> + <row> + <cell anchor='west'> + <JLabel id='endDateLabel'/> + </cell> + <cell anchor='west' weightx="0.5"> + <JXDatePicker id='endDate'/> + </cell> + </row> + + <!-- formsUrl --> + <row> + <cell anchor="west"> + <JLabel id='formsUrlLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel layout='{new BorderLayout()}'> + <JToolBar id='formsUrlToolbar' constraints='BorderLayout.WEST'> + <JButton id='resetFormsUrl' constraints='BorderLayout.WEST' styleClass='resetButton'/> + </JToolBar> + <JTextField id='formsUrl' constraints='BorderLayout.CENTER'/> + <JToolBar id='formsUrlToolbar2' constraints='BorderLayout.EAST'> + <JButton id='openLinkFormulairesUrl' + onActionPerformed='getHandler().openLink(getModel().getBean().getFormsUrl())'/> + </JToolBar> + + </JPanel> + </cell> + </row> + + <!-- reportsUrl --> + <row> + <cell anchor="west"> + <JLabel id='reportsUrlLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel layout='{new BorderLayout()}'> + <JToolBar id='reportsUrlToolbar' constraints='BorderLayout.WEST'> + <JButton id='resetReportsUrl' constraints='BorderLayout.WEST' styleClass='resetButton'/> + </JToolBar> + <JTextField id='reportsUrl' constraints='BorderLayout.CENTER'/> + + <JToolBar id='reportsUrlToolbar2' constraints='BorderLayout.EAST'> + <JButton id='openLinkRapportsUrl' constraints='BorderLayout.EAST' + onActionPerformed='getHandler().openLink(getModel().getBean().getReportsUrl())'/> + </JToolBar> + </JPanel> + </cell> + </row> + + <!-- comment --> + <row> + <cell fill='both' weighty="1" columns="2"> + <JScrollPane id='comment' onFocusGained='comment2.requestFocus()'> + <JTextArea id='comment2' onKeyReleased='getModel().getBean().setComment(comment2.getText())'/> + </JScrollPane> + </cell> + </row> + </Table> + </tab> + <tab id="mapTab"> + <JMapPane id='tripMap'/> + </tab> + </JTabbedPane> </JPanel> <!-- surcharge des actions (pour appliquer la css specifique) --> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 34bdd7d..19004de 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -21,7 +21,13 @@ */ package fr.ird.observe.ui.content.open.impl.seine; +import com.google.common.base.Function; +import com.google.common.collect.Lists; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.LineString; import fr.ird.observe.DataService; +import fr.ird.observe.ObserveConfig; import fr.ird.observe.ObserveDAOHelper; import fr.ird.observe.db.DataContext; import fr.ird.observe.db.DataSource; @@ -30,19 +36,45 @@ import fr.ird.observe.db.util.TopiaExecutor2; import fr.ird.observe.entities.referentiel.Program; import fr.ird.observe.entities.seine.Routes; import fr.ird.observe.entities.seine.TripSeine; +import fr.ird.observe.tripMap.TripMapPoint; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.content.open.ContentOpenableUIModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.geotools.data.FileDataStore; +import org.geotools.data.FileDataStoreFinder; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.feature.DefaultFeatureCollection; +import org.geotools.feature.simple.SimpleFeatureBuilder; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.geometry.DirectPosition2D; +import org.geotools.geometry.jts.JTSFactoryFinder; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.map.FeatureLayer; +import org.geotools.map.Layer; +import org.geotools.map.MapContent; +import org.geotools.styling.SLD; +import org.geotools.styling.Style; +import org.geotools.swing.JMapPane; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.util.TopiaEntityBinder; import org.nuiton.util.DateUtil; - +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; + +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.Color; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.io.File; import java.util.Date; +import java.util.List; import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; @@ -135,6 +167,24 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } + + ObserveConfig config = ui.getContextValue(ObserveConfig.class); + + final JMapPane tripMap = getUi().getTripMap(); + + tripMap.setBackground(config.getMapBackgroundColor()); + + getUi().getTripSeineTabPane().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); + if (tripSeineTabPane.getSelectedComponent() == tripMap) { + doOpenMap(); + } + } + }); + + tripMap.addMouseWheelListener(new MouseMapListener()); finalizeOpenUI(mode, create); } @@ -293,4 +343,108 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } + public void doOpenMap() { + JMapPane tripMap = getUi().getTripMap(); + tripMap.setMapContent(getMapContent()); + tripMap.setDisplayArea(tripArea); + } + + protected MapContent mapContent; + protected ReferencedEnvelope tripArea; + + public MapContent getMapContent() { +// if (mapContent == null) { + try { + + mapContent = new MapContent(); + mapContent.setTitle("Un titre"); + + + // add map layers + ObserveConfig config = ui.getContextValue(ObserveConfig.class); + + for (File layerFile : config.getMapLayerFiles()) { + FileDataStore store = FileDataStoreFinder.getDataStore(layerFile); + SimpleFeatureSource featureSource = store.getFeatureSource(); + Style style = SLD.createSimpleStyle(featureSource.getSchema()); + Layer layer = new FeatureLayer(featureSource, style); + mapContent.addLayer(layer); + } + + // add trip + DataService dataService = getDataService(); + DataSource source = getDataSource(); + String tripId = getSelectedId(); + + List<TripMapPoint> tripMapPoints = dataService.loadTrip(source, tripId); + + GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); + + SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); + typeBuilder.setName("a-type-name"); + //typeBuilder.setCRS(CRS.decode("EPSG:4326")); + typeBuilder.add("geom-attr-name", LineString.class); + + SimpleFeatureType type = typeBuilder.buildFeatureType(); + SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); + + + List <Coordinate> coordinates = Lists.transform(tripMapPoints, new Function<TripMapPoint, Coordinate>() { + + @Override + public Coordinate apply(TripMapPoint input) { + return new Coordinate(input.getLongitude(), input.getLatitude()); + } + }); + + LineString line = geometryFactory.createLineString(coordinates.toArray(new Coordinate[0])); + + builder.add(line); + + SimpleFeature tripFeature = builder.buildFeature("trip"); + + DefaultFeatureCollection features = new DefaultFeatureCollection(); + features.add(tripFeature); + + Style style = SLD.createLineStyle(Color.green, 1); + Layer layer = new FeatureLayer(features, style); + mapContent.addLayer(layer); + + // set zoom + + tripArea = new ReferencedEnvelope(); + for (TripMapPoint point : tripMapPoints) { + tripArea.expandToInclude(new DirectPosition2D(point.getLongitude(), point.getLatitude())); + } + tripArea.expandBy(1.1); + + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Error on generate Map", e); + } + } +// } + return mapContent; + } + + private class MouseMapListener implements MouseWheelListener { + + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + int notches = e.getWheelRotation(); + double scale = notches; + + if (log.isDebugEnabled()) { + log.debug(String.format("Map mouse zoom (rotation : %s, scale : %s)", notches, scale)); + } + + JMapPane tripMap = getUi().getTripMap(); + ReferencedEnvelope displayArea = tripMap.getDisplayArea(); + displayArea.expandBy(scale); + tripMap.setDisplayArea(displayArea); + } + + + } + } diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index f82a763..3431a6a 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -927,6 +927,8 @@ observe.config.category.gps=GPS observe.config.category.gps.description=GPS Configuration observe.config.category.h2=Local data source observe.config.category.h2.description=Configuration of local data source +observe.config.category.map= +observe.config.category.map.description= observe.config.category.observation= observe.config.category.observation.description= observe.config.category.obstuna=Remote data source @@ -959,6 +961,17 @@ observe.config.h2.can.migrate.description=Flag to know if you can migrate h2 dat observe.config.h2.login.description=H2 Login observe.config.h2.password.description=H2 Password observe.config.h2.serverPort.description= +observe.config.map.background.description= +observe.config.map.layer1.description= +observe.config.map.layer10.description= +observe.config.map.layer2.description= +observe.config.map.layer3.description= +observe.config.map.layer4.description= +observe.config.map.layer5.description= +observe.config.map.layer6.description= +observe.config.map.layer7.description= +observe.config.map.layer8.description= +observe.config.map.layer9.description= observe.config.observation.activitysDetaillees= observe.config.observation.fauneAssociee= observe.config.observation.floatingObject= @@ -2099,6 +2112,8 @@ observe.tripSeine.message.creating=Creating a trip observe.tripSeine.message.no.active.found=No opened trip found, you can create a new one or open an existing one. observe.tripSeine.message.not.open=Current trip is not opened, no edit possible. observe.tripSeine.message.updating=Updating a trip +observe.tripSeine.tab.general=Caracteristics +observe.tripSeine.tab.map=Map observe.tripSeine.title=Trip observe.validation.report.contextName= observe.validation.report.entities.with.messages= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 815c31a..43af648 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -927,6 +927,8 @@ observe.config.category.gps=GPS observe.config.category.gps.description=Configuración GPS observe.config.category.h2=Base local observe.config.category.h2.description=Configuración de la base locale +observe.config.category.map= +observe.config.category.map.description= observe.config.category.observation=Calificacion de las observaciones observe.config.category.observation.description=Gestion de los indicadores de calificación de los programas observe.config.category.obstuna=Base remota @@ -959,6 +961,17 @@ observe.config.h2.can.migrate.description=Autorizar la actualización de las bas observe.config.h2.login.description=Login h2 observe.config.h2.password.description=Contraseña h2 observe.config.h2.serverPort.description=Puerto del servidor h2 +observe.config.map.background.description= +observe.config.map.layer1.description= +observe.config.map.layer10.description= +observe.config.map.layer2.description= +observe.config.map.layer3.description= +observe.config.map.layer4.description= +observe.config.map.layer5.description= +observe.config.map.layer6.description= +observe.config.map.layer7.description= +observe.config.map.layer8.description= +observe.config.map.layer9.description= observe.config.observation.activitysDetaillees=Observación de actividades detalladas observe.config.observation.fauneAssociee=Observación de Fauna asociada observe.config.observation.floatingObject=Observación de objetos flotantes @@ -2101,6 +2114,8 @@ observe.tripSeine.message.creating= observe.tripSeine.message.no.active.found= observe.tripSeine.message.not.open= observe.tripSeine.message.updating= +observe.tripSeine.tab.general= +observe.tripSeine.tab.map=Mapa observe.tripSeine.title= observe.validation.report.contextName= observe.validation.report.entities.with.messages= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index bcbde51..5ecd1b4 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -927,6 +927,8 @@ observe.config.category.gps=GPS observe.config.category.gps.description=Configuration GPS observe.config.category.h2=Base locale observe.config.category.h2.description=Configuration base locale +observe.config.category.map= +observe.config.category.map.description= observe.config.category.observation=Qualification des observations observe.config.category.observation.description=Gestion des indicateurs de qualification des programmes observe.config.category.obstuna=Base distante @@ -959,6 +961,17 @@ observe.config.h2.can.migrate.description=Autoriser la mise à jour des bases lo observe.config.h2.login.description=Le login h2 observe.config.h2.password.description=Le mot de passe h2 observe.config.h2.serverPort.description=Port du serveur h2 +observe.config.map.background.description= +observe.config.map.layer1.description= +observe.config.map.layer10.description= +observe.config.map.layer2.description= +observe.config.map.layer3.description= +observe.config.map.layer4.description= +observe.config.map.layer5.description= +observe.config.map.layer6.description= +observe.config.map.layer7.description= +observe.config.map.layer8.description= +observe.config.map.layer9.description= observe.config.observation.activitysDetaillees=Observation des activités détaillées observe.config.observation.fauneAssociee=Observation des Faunes associées observe.config.observation.floatingObject=Observation des objets flottants @@ -2099,6 +2112,8 @@ observe.tripSeine.message.creating=La marée est en cours de création. observe.tripSeine.message.no.active.found=Aucune marée ouverte, vous pouvez soit en créer une nouvelle, soit en réouvrir une. observe.tripSeine.message.not.open=La marée courante n'est pas ouverte, aucune modification possible. observe.tripSeine.message.updating=La maréee est en cours de modification. +observe.tripSeine.tab.general=Caractéristiques +observe.tripSeine.tab.map=Carte observe.tripSeine.title=Marée observe.validation.report.contextName=Context de validation utilisé \: %1$s observe.validation.report.entities.with.messages=Nombre d'entités avec des messages \: %1$s diff --git a/pom.xml b/pom.xml index 8285c2c..19b1a56 100644 --- a/pom.xml +++ b/pom.xml @@ -122,6 +122,8 @@ <sl4jVersion>1.7.9</sl4jVersion> <swingXVersion>1.6.4</swingXVersion> + <geoToolsVersion>12.0.1</geoToolsVersion> + <!-- license header configuration --> <license.licenseName>gpl_v3</license.licenseName> <license.organizationName>IRD, Codelutin, Tony Chemit</license.organizationName> @@ -444,6 +446,72 @@ <version>${hibernateVersion}</version> </dependency> + <!-- Map --> + <dependency> + <groupId>com.bbn</groupId> + <artifactId>openmap</artifactId> + <version>5.0.4</version> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-shapefile</artifactId> + <version>${geoToolsVersion}</version> + <exclusions> + <exclusion> + <groupId>java3d</groupId> + <artifactId>vecmath</artifactId> + </exclusion> + <exclusion> + <groupId>jgridshift</groupId> + <artifactId>jgridshift</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-swing</artifactId> + <version>${geoToolsVersion}</version> + </dependency> + + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-api</artifactId> + <version>${geoToolsVersion}</version> + <exclusions> + <exclusion> + <groupId>jgridshift</groupId> + <artifactId>jgridshift</artifactId> + </exclusion> + <exclusion> + <groupId>java3d</groupId> + <artifactId>vecmath</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-main</artifactId> + <version>${geoToolsVersion}</version> + </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-render</artifactId> + <version>${geoToolsVersion}</version> + </dependency> + + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-opengis</artifactId> + <version>${geoToolsVersion}</version> + <exclusions> + <exclusion> + <groupId>java3d</groupId> + <artifactId>vecmath</artifactId> + </exclusion> + </exclusions> + </dependency> + <!-- logging --> <dependency> <groupId>org.slf4j</groupId> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit c15748606be10dc4562257c695e5347667a3d301 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 10:55:22 2015 +0200 mouse Translation --- .../open/impl/seine/TripSeineUIHandler.java | 78 +++++++++++++++++++++- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 19004de..13bf37f 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -70,8 +70,13 @@ import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Color; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; import java.io.File; import java.util.Date; import java.util.List; @@ -184,7 +189,10 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } }); - tripMap.addMouseWheelListener(new MouseMapListener()); + MouseMapListener mouseMapListener = new MouseMapListener(); + tripMap.addMouseWheelListener(mouseMapListener); + tripMap.addMouseMotionListener(mouseMapListener); + tripMap.addMouseListener(mouseMapListener); finalizeOpenUI(mode, create); } @@ -347,6 +355,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { JMapPane tripMap = getUi().getTripMap(); tripMap.setMapContent(getMapContent()); tripMap.setDisplayArea(tripArea); + tripMap.invalidate(); } protected MapContent mapContent; @@ -427,7 +436,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { return mapContent; } - private class MouseMapListener implements MouseWheelListener { + private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener { @Override public void mouseWheelMoved(MouseWheelEvent e) { @@ -441,10 +450,73 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { JMapPane tripMap = getUi().getTripMap(); ReferencedEnvelope displayArea = tripMap.getDisplayArea(); displayArea.expandBy(scale); - tripMap.setDisplayArea(displayArea); + if (! displayArea.isEmpty()) { + tripMap.setDisplayArea(displayArea); + } + } + + @Override + public void mouseClicked(MouseEvent e) { + + } + + protected Point2D startPointInWorld; + protected AffineTransform startScreenToWorldTransform; + protected ReferencedEnvelope startDisplayArea; + + @Override + public void mousePressed(MouseEvent e) { + startMove(e.getPoint()); } + @Override + public void mouseReleased(MouseEvent e) { + endMove(e.getPoint()); + } + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + + @Override + public void mouseDragged(MouseEvent e) { + endMove(e.getPoint()); + } + + @Override + public void mouseMoved(MouseEvent e) { + + } + + protected void startMove(Point2D startPointInScreen) { + JMapPane tripMap = getUi().getTripMap(); + startDisplayArea = tripMap.getDisplayArea(); + startScreenToWorldTransform = tripMap.getScreenToWorldTransform(); + startPointInWorld = new Point2D.Double(); + startScreenToWorldTransform.transform(startPointInScreen, startPointInWorld); + } + + protected void endMove(Point2D endPointInScreen) { + Point2D endPointInWorld = new Point2D.Double(); + startScreenToWorldTransform.transform(endPointInScreen, endPointInWorld); + double transX = startPointInWorld.getX() - endPointInWorld.getX(); + double transY = startPointInWorld.getY() - endPointInWorld.getY(); + + ReferencedEnvelope endDisplayArea = new ReferencedEnvelope(startDisplayArea); + endDisplayArea.translate(transX, transY); + + JMapPane tripMap = getUi().getTripMap(); + tripMap.setDisplayArea(endDisplayArea); + if (log.isDebugEnabled()) { + log.debug(String.format("Translate (x : %s, y : %s)", transX, transY)); + } + } } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 8c55d82eeae3db0e20435988b52a016767fed67d Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 11:06:37 2015 +0200 fix show config --- .../main/java/fr/ird/observe/ObserveConfigOption.java | 2 +- .../fr/ird/observe/ui/actions/ShowConfigAction.java | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java index d797d8c..ad47893 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java @@ -717,7 +717,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { false ); - protected static List<ObserveConfigOption> MAP_LAYERS = ImmutableList.of(MAP_LAYER_1, MAP_LAYER_2, MAP_LAYER_3, + public static List<ObserveConfigOption> MAP_LAYERS = ImmutableList.of(MAP_LAYER_1, MAP_LAYER_2, MAP_LAYER_3, MAP_LAYER_4, MAP_LAYER_5, MAP_LAYER_6, MAP_LAYER_7, MAP_LAYER_8, MAP_LAYER_9, MAP_LAYER_10); /** diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java b/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java index a2fe180..7bf7367 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java @@ -193,6 +193,8 @@ public class ShowConfigAction extends AbstractAction { } + // catégories map + addMapOptions(helper); // others addOthersOptions(helper); @@ -232,7 +234,7 @@ public class ShowConfigAction extends AbstractAction { protected void addObstunaOptions(ObserveConfigUIBuilder helper) { helper.addCategory(n("observe.config.category.obstuna"), - n("observe.config.category.obstuna.description")); + n("observe.config.category.obstuna.description")); helper.addOption(ObserveConfigOption.OBSTUNA_URL); helper.addOption(ObserveConfigOption.OBSTUNA_LOGIN); @@ -271,7 +273,7 @@ public class ShowConfigAction extends AbstractAction { protected void addSynchroOptions(ObserveConfigUIBuilder helper) { helper.addCategory(n("observe.config.category.synchro"), - n("observe.config.category.synchro.description")); + n("observe.config.category.synchro.description")); helper.addOption(ObserveConfigOption.CHANGE_SYNCHRO_SRC); helper.addOption(ObserveConfigOption.H2_CAN_MIGRATE); @@ -331,14 +333,10 @@ public class ShowConfigAction extends AbstractAction { n("observe.config.category.map.description"), ObserveUICallback.ui.name()); - helper.addOption(ObserveConfigOption.DETAILLED_ACTIVITIES_OBSERVATION); - helper.addOption(ObserveConfigOption.NON_TARGET_OBSERVATION); - helper.addOption(ObserveConfigOption.BAIT_OBSERVATION); - helper.addOption(ObserveConfigOption.MAMMALS_OBSERVATION); - helper.addOption(ObserveConfigOption.SAMPLES_OBSERVATION); - helper.addOption(ObserveConfigOption.OBJECTS_OBSERVATION); - helper.addOption(ObserveConfigOption.BIRDS_OBSERVATION); - helper.addOption(ObserveConfigOption.TARGET_DISCARDS_OBSERVATION); + helper.addOption(ObserveConfigOption.MAP_BACKGROUND_COLOR); + for (ObserveConfigOption layerOption : ObserveConfigOption.MAP_LAYERS) { + helper.addOption(layerOption); + } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit ba84a627cf9172196c39b85fbad32251b4f90b0f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 11:17:32 2015 +0200 add french translation fr i18n --- .../resources/i18n/observe-swing_fr_FR.properties | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index 5ecd1b4..4735179 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -927,8 +927,8 @@ observe.config.category.gps=GPS observe.config.category.gps.description=Configuration GPS observe.config.category.h2=Base locale observe.config.category.h2.description=Configuration base locale -observe.config.category.map= -observe.config.category.map.description= +observe.config.category.map=Fonds de carte +observe.config.category.map.description=Configuration des fonds à utiliser pour les cartes observe.config.category.observation=Qualification des observations observe.config.category.observation.description=Gestion des indicateurs de qualification des programmes observe.config.category.obstuna=Base distante @@ -961,17 +961,17 @@ observe.config.h2.can.migrate.description=Autoriser la mise à jour des bases lo observe.config.h2.login.description=Le login h2 observe.config.h2.password.description=Le mot de passe h2 observe.config.h2.serverPort.description=Port du serveur h2 -observe.config.map.background.description= -observe.config.map.layer1.description= -observe.config.map.layer10.description= -observe.config.map.layer2.description= -observe.config.map.layer3.description= -observe.config.map.layer4.description= -observe.config.map.layer5.description= -observe.config.map.layer6.description= -observe.config.map.layer7.description= -observe.config.map.layer8.description= -observe.config.map.layer9.description= +observe.config.map.background.description=Couleur du fond de carte +observe.config.map.layer1.description=Fichier (shapeFiles) du premier calque de la carte +observe.config.map.layer10.description=Fichier (shapeFiles) du dixième calque de la carte +observe.config.map.layer2.description=Fichier (shapeFiles) du deuxième calque de la carte +observe.config.map.layer3.description=Fichier (shapeFiles) du troisième calque de la carte +observe.config.map.layer4.description=Fichier (shapeFiles) du quatrième calque de la carte +observe.config.map.layer5.description=Fichier (shapeFiles) du cinquième calque de la carte +observe.config.map.layer6.description=Fichier (shapeFiles) du sixième calque de la carte +observe.config.map.layer7.description=Fichier (shapeFiles) du septième calque de la carte +observe.config.map.layer8.description=Fichier (shapeFiles) du huitième calque de la carte +observe.config.map.layer9.description=Fichier (shapeFiles) du neuvième calque de la carte observe.config.observation.activitysDetaillees=Observation des activités détaillées observe.config.observation.fauneAssociee=Observation des Faunes associées observe.config.observation.floatingObject=Observation des objets flottants -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit efa5f583b8eb6b9e3f3cca005ff9f9f327502562 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 15:52:51 2015 +0200 rename functions --- observe-business/src/main/java/fr/ird/observe/DataService.java | 4 ++-- .../java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/observe-business/src/main/java/fr/ird/observe/DataService.java b/observe-business/src/main/java/fr/ird/observe/DataService.java index 2f36d50..12d8774 100644 --- a/observe-business/src/main/java/fr/ird/observe/DataService.java +++ b/observe-business/src/main/java/fr/ird/observe/DataService.java @@ -1712,7 +1712,7 @@ public class DataService { } } - public List<TripMapPoint> loadTrip(DataSource source, String id) throws DataSourceException { + public List<TripMapPoint> loadTripMapActivityPoints(DataSource source, String id) throws DataSourceException { if (!source.canReadData()) { if (log.isDebugEnabled()) { log.debug("Can not read data!"); @@ -1725,7 +1725,7 @@ public class DataService { try { TripSeineDAO dao = (TripSeineDAO) source.getDAO(tx, TripSeine.class); - List<TripMapPoint> tripMapPoints = dao.extractTripMap(id); + List<TripMapPoint> tripMapPoints = dao.extractTripMapActivityPoints(id); return tripMapPoints; } catch (Exception e) { diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java index 21215d9..756d3c1 100644 --- a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java +++ b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java @@ -78,7 +78,7 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< } - public List<TripMapPoint> extractTripMap(String tripId) throws TopiaException { + public List<TripMapPoint> extractTripMapActivityPoints(String tripId) throws TopiaException { TripSeine tripSeine = findByTopiaId(tripId); @@ -95,8 +95,8 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< } // Add Activities - TripMapPointQuery tripMapPointQuery = new TripMapPointQuery(tripId); - tripMapPoints.addAll(tripMapPointQuery.findMultipleResult(context)); + TripMapActivityPointQuery tripMapActivityPointQuery = new TripMapActivityPointQuery(tripId); + tripMapPoints.addAll(tripMapActivityPointQuery.findMultipleResult(context)); // add landing harbours Harbour landingHarbour = tripSeine.getLandingHarbour(); @@ -111,7 +111,7 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< return tripMapPoints; } - private static class TripMapPointQuery extends TopiaSQLQuery<TripMapPoint> { + private static class TripMapActivityPointQuery extends TopiaSQLQuery<TripMapPoint> { private static String SQL = "SELECT" + " r.date, " + @@ -129,7 +129,7 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< protected String tripId; - public TripMapPointQuery(String tripId) { + public TripMapActivityPointQuery(String tripId) { this.tripId = tripId; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 3e38a6adfcf98747c574ea746204a4d35c20f45e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 16:09:54 2015 +0200 add point and fix style --- observe-swing/pom.xml | 4 + .../open/impl/seine/TripSeineUIHandler.java | 156 +++++++++++++++++---- pom.xml | 5 + 3 files changed, 141 insertions(+), 24 deletions(-) diff --git a/observe-swing/pom.xml b/observe-swing/pom.xml index 639159b..d7d6a04 100644 --- a/observe-swing/pom.xml +++ b/observe-swing/pom.xml @@ -258,6 +258,10 @@ <groupId>org.geotools</groupId> <artifactId>gt-render</artifactId> </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-epsg-hsql</artifactId> + </dependency> <!-- Logging --> <dependency> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 13bf37f..3908feb 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -22,10 +22,13 @@ package fr.ird.observe.ui.content.open.impl.seine; import com.google.common.base.Function; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.MultiPoint; import fr.ird.observe.DataService; import fr.ird.observe.ObserveConfig; import fr.ird.observe.ObserveDAOHelper; @@ -33,6 +36,7 @@ import fr.ird.observe.db.DataContext; import fr.ird.observe.db.DataSource; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.db.util.TopiaExecutor2; +import fr.ird.observe.entities.constants.seine.SchoolType; import fr.ird.observe.entities.referentiel.Program; import fr.ird.observe.entities.seine.Routes; import fr.ird.observe.entities.seine.TripSeine; @@ -40,12 +44,15 @@ import fr.ird.observe.tripMap.TripMapPoint; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.content.open.ContentOpenableUIModel; +import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.data.FileDataStore; import org.geotools.data.FileDataStoreFinder; import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.factory.CommonFactoryFinder; import org.geotools.feature.DefaultFeatureCollection; +import org.geotools.feature.FeatureCollection; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.geometry.DirectPosition2D; @@ -54,8 +61,10 @@ import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.map.FeatureLayer; import org.geotools.map.Layer; import org.geotools.map.MapContent; +import org.geotools.referencing.CRS; import org.geotools.styling.SLD; import org.geotools.styling.Style; +import org.geotools.styling.StyleFactory; import org.geotools.swing.JMapPane; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; @@ -63,8 +72,9 @@ import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.util.TopiaEntityBinder; import org.nuiton.util.DateUtil; -import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.filter.FilterFactory; +import org.opengis.referencing.FactoryException; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; @@ -368,7 +378,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { mapContent = new MapContent(); mapContent.setTitle("Un titre"); - // add map layers ObserveConfig config = ui.getContextValue(ObserveConfig.class); @@ -380,44 +389,80 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { mapContent.addLayer(layer); } - // add trip + // add lines DataService dataService = getDataService(); DataSource source = getDataSource(); String tripId = getSelectedId(); - List<TripMapPoint> tripMapPoints = dataService.loadTrip(source, tripId); + List<TripMapPoint> tripMapPoints = dataService.loadTripMapActivityPoints(source, tripId); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); - SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); - typeBuilder.setName("a-type-name"); - //typeBuilder.setCRS(CRS.decode("EPSG:4326")); - typeBuilder.add("geom-attr-name", LineString.class); + SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); + lineFeatureTypeBuilder.setName("a-type-name"); + lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); + lineFeatureTypeBuilder.add("geom-attr-name", LineString.class); - SimpleFeatureType type = typeBuilder.buildFeatureType(); - SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); + SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType(); + SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType); + DefaultFeatureCollection featuresDays = new DefaultFeatureCollection(); + DefaultFeatureCollection featuresBetweenTowDays = new DefaultFeatureCollection(); - List <Coordinate> coordinates = Lists.transform(tripMapPoints, new Function<TripMapPoint, Coordinate>() { + List<Coordinate> coordinatesByDay = null; - @Override - public Coordinate apply(TripMapPoint input) { - return new Coordinate(input.getLongitude(), input.getLatitude()); + TripMapPoint previousPoint = null; + + for (TripMapPoint point : tripMapPoints) { + if (previousPoint == null) { + coordinatesByDay = Lists.newLinkedList(); + } else if (!DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) { + + if (coordinatesByDay.size() > 1) { + LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); + lineBuilder.add(line); + featuresDays.add(lineBuilder.buildFeature(null)); + } + + + Coordinate[] coordinates = { + new Coordinate(previousPoint.getLongitude(), previousPoint.getLatitude()), + new Coordinate(point.getLongitude(), point.getLatitude()), + }; + LineString lineBetweenTwoDays = geometryFactory.createLineString(coordinates); + lineBuilder.add(lineBetweenTwoDays); + featuresBetweenTowDays.add(lineBuilder.buildFeature(null)); + + coordinatesByDay = Lists.newLinkedList(); } - }); - LineString line = geometryFactory.createLineString(coordinates.toArray(new Coordinate[0])); + Coordinate coordinate = new Coordinate(point.getLongitude(), point.getLatitude()); + coordinatesByDay.add(coordinate); + + previousPoint = point; + } + + if (coordinatesByDay.size() > 1) { + LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); + lineBuilder.add(line); + featuresDays.add(lineBuilder.buildFeature(null)); + } + + Layer layerDays = new FeatureLayer(featuresDays, getStyleLineDay()); + Layer layerBetweenTowDays = new FeatureLayer(featuresBetweenTowDays, getStyleLineBetweenTwoDays()); + mapContent.addLayer(layerDays); + mapContent.addLayer(layerBetweenTowDays); - builder.add(line); + // add Point + FeatureCollection featurePointsLibres = generateFeaturePoints(tripMapPoints, SchoolType.libre); + FeatureCollection featurePointsObjets = generateFeaturePoints(tripMapPoints, SchoolType.objet); - SimpleFeature tripFeature = builder.buildFeature("trip"); + Layer layerPointsLibres = new FeatureLayer(featurePointsLibres, getStylePointLibre()); + Layer layerPointsObjets = new FeatureLayer(featurePointsObjets, getStylePointObjet()); + mapContent.addLayer(layerPointsLibres); + mapContent.addLayer(layerPointsObjets); - DefaultFeatureCollection features = new DefaultFeatureCollection(); - features.add(tripFeature); - Style style = SLD.createLineStyle(Color.green, 1); - Layer layer = new FeatureLayer(features, style); - mapContent.addLayer(layer); // set zoom @@ -436,6 +481,69 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { return mapContent; } + private Style getStylePointObjet() { + return SLD.createPointStyle("Triangle", Color.BLACK, Color.ORANGE, 1, 16); + } + + protected Style getStylePointLibre() { + return SLD.createPointStyle("X", Color.BLACK, Color.GREEN, 1, 16); + } + + protected FeatureCollection generateFeaturePoints(List<TripMapPoint> tripMapPoints, final SchoolType schoolType) throws FactoryException { + SimpleFeatureTypeBuilder pointFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); + pointFeatureTypeBuilder.setName("a-type-name"); + pointFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); + pointFeatureTypeBuilder.add("geom-attr-name", MultiPoint.class); + + SimpleFeatureType pointFeatureType = pointFeatureTypeBuilder.buildFeatureType(); + SimpleFeatureBuilder pointBuilder = new SimpleFeatureBuilder(pointFeatureType); + + DefaultFeatureCollection featuresPoint = new DefaultFeatureCollection(); + + Iterable<Coordinate> coordinates = Iterables.transform( + Iterables.filter(tripMapPoints, new Predicate<TripMapPoint>() { + @Override + public boolean apply(TripMapPoint input) { + return input.getSchoolType() == schoolType; + } + }), + new Function<TripMapPoint, Coordinate>() { + @Override + public Coordinate apply(TripMapPoint input) { + return new Coordinate(input.getLongitude(), input.getLatitude()); + } + }); + + GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); + + MultiPoint points = geometryFactory.createMultiPoint(Lists.newArrayList(coordinates).toArray(new Coordinate[0])); + pointBuilder.add(points); + featuresPoint.add(pointBuilder.buildFeature(null)); + + return featuresPoint; + } + + protected Style getStyleLineDay() { + return SLD.createLineStyle(Color.BLACK, 1); + } + + protected Style getStyleLineBetweenTwoDays() { + StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); + FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); + float[] dashArray = {5f, 5f}; + org.geotools.styling.Stroke stroke = sf.createStroke(ff.literal(Color.BLACK), + ff.literal(1), + null, + null, + null, + dashArray, + null, + null, + null); + + return SLD.wrapSymbolizers(sf.createLineSymbolizer(stroke, null)); + } + private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener { @Override @@ -486,7 +594,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { @Override public void mouseDragged(MouseEvent e) { - endMove(e.getPoint()); +// endMove(e.getPoint()); } @Override diff --git a/pom.xml b/pom.xml index 19b1a56..2b048c0 100644 --- a/pom.xml +++ b/pom.xml @@ -511,6 +511,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.geotools</groupId> + <artifactId>gt-epsg-hsql</artifactId> + <version>${geoToolsVersion}</version> + </dependency> <!-- logging --> <dependency> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 65acd4579cf6d13af1676d214ffd27dca446964e Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 17:52:10 2015 +0200 add Date on map --- .../open/impl/seine/TripSeineUIHandler.java | 48 +++++++++++++++++++--- observe-swing/src/main/resources/log4j.properties | 2 + 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 3908feb..d7ba4e0 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -62,9 +62,15 @@ import org.geotools.map.FeatureLayer; import org.geotools.map.Layer; import org.geotools.map.MapContent; import org.geotools.referencing.CRS; +import org.geotools.styling.Fill; +import org.geotools.styling.Font; +import org.geotools.styling.LinePlacementImpl; +import org.geotools.styling.LineSymbolizer; import org.geotools.styling.SLD; +import org.geotools.styling.Stroke; import org.geotools.styling.Style; import org.geotools.styling.StyleFactory; +import org.geotools.styling.TextSymbolizer; import org.geotools.swing.JMapPane; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; @@ -72,6 +78,7 @@ import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.util.TopiaEntityBinder; import org.nuiton.util.DateUtil; +import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; import org.opengis.filter.FilterFactory; import org.opengis.referencing.FactoryException; @@ -88,6 +95,8 @@ import java.awt.event.MouseWheelListener; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -389,6 +398,9 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { mapContent.addLayer(layer); } + + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + // add lines DataService dataService = getDataService(); DataSource source = getDataSource(); @@ -399,9 +411,10 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); - lineFeatureTypeBuilder.setName("a-type-name"); + lineFeatureTypeBuilder.setName("lineBuilder"); lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); - lineFeatureTypeBuilder.add("geom-attr-name", LineString.class); + lineFeatureTypeBuilder.add("line", LineString.class); + lineFeatureTypeBuilder.add("label", String.class); SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType(); SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType); @@ -421,7 +434,10 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { if (coordinatesByDay.size() > 1) { LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); lineBuilder.add(line); - featuresDays.add(lineBuilder.buildFeature(null)); + lineBuilder.add(dateFormat.format(previousPoint.getTime())); + SimpleFeature feature = lineBuilder.buildFeature(null); + + featuresDays.add(feature); } @@ -431,6 +447,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { }; LineString lineBetweenTwoDays = geometryFactory.createLineString(coordinates); lineBuilder.add(lineBetweenTwoDays); + lineBuilder.add(DateFormat.getDateInstance().format(previousPoint.getTime())); featuresBetweenTowDays.add(lineBuilder.buildFeature(null)); coordinatesByDay = Lists.newLinkedList(); @@ -445,6 +462,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { if (coordinatesByDay.size() > 1) { LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); lineBuilder.add(line); + lineBuilder.add(dateFormat.format(previousPoint.getTime())); featuresDays.add(lineBuilder.buildFeature(null)); } @@ -491,9 +509,9 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { protected FeatureCollection generateFeaturePoints(List<TripMapPoint> tripMapPoints, final SchoolType schoolType) throws FactoryException { SimpleFeatureTypeBuilder pointFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); - pointFeatureTypeBuilder.setName("a-type-name"); + pointFeatureTypeBuilder.setName("point Builder"); pointFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); - pointFeatureTypeBuilder.add("geom-attr-name", MultiPoint.class); + pointFeatureTypeBuilder.add("point", MultiPoint.class); SimpleFeatureType pointFeatureType = pointFeatureTypeBuilder.buildFeatureType(); SimpleFeatureBuilder pointBuilder = new SimpleFeatureBuilder(pointFeatureType); @@ -524,7 +542,25 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } protected Style getStyleLineDay() { - return SLD.createLineStyle(Color.BLACK, 1); + StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); + FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); + + Stroke stroke = sf.createStroke(ff.literal(Color.BLACK), ff.literal(1)); + LineSymbolizer lineSym = sf.createLineSymbolizer(stroke, null); + + + Font font = sf.getDefaultFont(); + font.setSize(ff.literal(14)); + Fill labelFill = sf.createFill(ff.literal(Color.BLACK)); + + LinePlacementImpl labelPlacement = new LinePlacementImpl(ff, true, true, false, null, null); + labelPlacement.setPerpendicularOffset(ff.literal(10)); + + TextSymbolizer textSym = sf.createTextSymbolizer( + labelFill, new Font[]{font}, null, ff.property("label"), labelPlacement, null); + + return SLD.wrapSymbolizers( lineSym, textSym ); + } protected Style getStyleLineBetweenTwoDays() { diff --git a/observe-swing/src/main/resources/log4j.properties b/observe-swing/src/main/resources/log4j.properties index 40d46fe..d605aa0 100644 --- a/observe-swing/src/main/resources/log4j.properties +++ b/observe-swing/src/main/resources/log4j.properties @@ -50,3 +50,5 @@ log4j.logger.org.nuiton.topia.migration=INFO #log4j.logger.org.nuiton.topia.replication=INFO log4j.logger.jaxx.runtime.validator.swing.SwingValidator=ERROR + +log4j.logger.fr.ird.observe.ui.content.open.impl.seine.TripSeineUIHandler=DEBUG -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit b5edba2b095f51d4c70ccff8de859684baea52af Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 15:16:05 2015 +0200 use style file for map --- .../main/java/fr/ird/observe/ObserveConfig.java | 5 + .../java/fr/ird/observe/ObserveConfigOption.java | 12 +- .../ird/observe/ui/actions/ShowConfigAction.java | 1 + .../ui/content/open/impl/seine/TripMapHandler.java | 399 +++++++++++++++++++++ .../open/impl/seine/TripSeineUIHandler.java | 365 +------------------ .../resources/i18n/observe-swing_en_GB.properties | 1 + .../resources/i18n/observe-swing_es_ES.properties | 1 + .../resources/i18n/observe-swing_fr_FR.properties | 3 +- .../{ => map}/shapeFiles/zee/World_EEZ_v8_2014.dbf | Bin .../{ => map}/shapeFiles/zee/World_EEZ_v8_2014.prj | 0 .../{ => map}/shapeFiles/zee/World_EEZ_v8_2014.sbn | Bin .../{ => map}/shapeFiles/zee/World_EEZ_v8_2014.sbx | Bin .../{ => map}/shapeFiles/zee/World_EEZ_v8_2014.shp | Bin .../shapeFiles/zee/World_EEZ_v8_2014.shp.xml | 0 .../{ => map}/shapeFiles/zee/World_EEZ_v8_2014.shx | Bin observe-swing/src/main/resources/map/style.xml | 126 +++++++ 16 files changed, 556 insertions(+), 357 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java index b8909dc..ec8ab64 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfig.java @@ -835,6 +835,11 @@ public class ObserveConfig extends ApplicationConfig implements IObserveConfig { return layers; } + public File getMapStyleFile() { + File result = getOptionAsFile(ObserveConfigOption.MAP_STYLE_FILE.key); + return result; + } + public String[] getUnsavables() { if (unsavables == null) { List<String> tmp = new ArrayList<String>(); diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java index ad47893..27731d2 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java @@ -630,7 +630,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_1( "map.layer1.path", n("observe.config.map.layer1.description"), - "${user.home}/.observe/shapeFiles/zee/World_EEZ_v8_2014.shp", + "${user.home}/.observe/map/shapeFiles/zee/World_EEZ_v8_2014.shp", File.class, false, false @@ -715,7 +715,15 @@ public enum ObserveConfigOption implements ConfigOptionDef { File.class, false, false - ); + ), + /** style Maps */ + MAP_STYLE_FILE( + "map.style.path", + n("observe.config.map.style.description"), + "${user.home}/.observe/map/style.xml", + File.class, + false, + false); public static List<ObserveConfigOption> MAP_LAYERS = ImmutableList.of(MAP_LAYER_1, MAP_LAYER_2, MAP_LAYER_3, MAP_LAYER_4, MAP_LAYER_5, MAP_LAYER_6, MAP_LAYER_7, MAP_LAYER_8, MAP_LAYER_9, MAP_LAYER_10); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java b/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java index 7bf7367..95fcad1 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/actions/ShowConfigAction.java @@ -337,6 +337,7 @@ public class ShowConfigAction extends AbstractAction { for (ObserveConfigOption layerOption : ObserveConfigOption.MAP_LAYERS) { helper.addOption(layerOption); } + helper.addOption(ObserveConfigOption.MAP_STYLE_FILE); } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java new file mode 100644 index 0000000..a00e296 --- /dev/null +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java @@ -0,0 +1,399 @@ +package fr.ird.observe.ui.content.open.impl.seine; + +import com.google.common.base.Function; +import com.google.common.base.Optional; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.MultiPoint; +import fr.ird.observe.DataService; +import fr.ird.observe.ObserveConfig; +import fr.ird.observe.db.DataSource; +import fr.ird.observe.db.DataSourceException; +import fr.ird.observe.entities.constants.seine.SchoolType; +import fr.ird.observe.tripMap.TripMapPoint; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.geotools.data.FileDataStore; +import org.geotools.data.FileDataStoreFinder; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.factory.CommonFactoryFinder; +import org.geotools.feature.DefaultFeatureCollection; +import org.geotools.feature.simple.SimpleFeatureBuilder; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.geometry.DirectPosition2D; +import org.geotools.geometry.jts.JTSFactoryFinder; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.map.FeatureLayer; +import org.geotools.map.Layer; +import org.geotools.map.MapContent; +import org.geotools.referencing.CRS; +import org.geotools.styling.NamedLayer; +import org.geotools.styling.SLD; +import org.geotools.styling.SLDParser; +import org.geotools.styling.Style; +import org.geotools.styling.StyleFactory; +import org.geotools.styling.StyledLayer; +import org.geotools.styling.StyledLayerDescriptor; +import org.geotools.styling.UserLayer; +import org.geotools.swing.JMapPane; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; + +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.io.File; +import java.io.FileNotFoundException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.List; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TripMapHandler { + + public static final String TRIP_LINES_LAYER_NAME = "Trip lines"; + public static final String TRIP_POINTS_LAYER_NAME = "Trip points"; + + + private static final Log log = LogFactory.getLog(TripMapHandler.class); + + protected JMapPane tripMapUI; + protected ObserveConfig config; + protected MapContent mapContent; + protected ReferencedEnvelope tripArea; + protected List<TripMapPoint> tripMapPoints; + + public TripMapHandler(JMapPane tripMapUI, ObserveConfig config) { + this.tripMapUI = tripMapUI; + this.config = config; + + tripMapUI.setBackground(config.getMapBackgroundColor()); + + MouseMapListener mouseMapListener = new MouseMapListener(); + tripMapUI.addMouseWheelListener(mouseMapListener); + tripMapUI.addMouseMotionListener(mouseMapListener); + tripMapUI.addMouseListener(mouseMapListener); + + } + + public void doOpenMap(DataService dataService, DataSource source, String tripId) { + + getTipMapPoints(dataService, source, tripId); + + tripMapUI.setMapContent(getMapContent()); + tripMapUI.setDisplayArea(tripArea); + } + + protected List<TripMapPoint> getTipMapPoints(DataService dataService, DataSource source, String tripId) { + + if (tripMapPoints == null) { + try { + tripMapPoints = dataService.loadTripMapActivityPoints(source, tripId); + } catch (DataSourceException e) { + if (log.isErrorEnabled()) { + log.error("error in loadTripMapActivityPoints", e); + } + } + } + return tripMapPoints; + + } + + public MapContent getMapContent() { + if (/*mapContent == null &&*/ tripMapPoints != null) { + try { + + mapContent = new MapContent(); + mapContent.setTitle("Un titre"); + + for (File layerFile : config.getMapLayerFiles()) { + FileDataStore store = FileDataStoreFinder.getDataStore(layerFile); + SimpleFeatureSource featureSource = store.getFeatureSource(); + Style style = SLD.createSimpleStyle(featureSource.getSchema()); + Layer layer = new FeatureLayer(featureSource, style); + mapContent.addLayer(layer); + } + + StyledLayerDescriptor styledLayerDescriptor = importStyledLayerDescriptor(); + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + + GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); + + SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); + lineFeatureTypeBuilder.setName("lineBuilder"); + lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); + lineFeatureTypeBuilder.add("line", LineString.class); + lineFeatureTypeBuilder.add("label", String.class); + lineFeatureTypeBuilder.add("type", String.class); + + SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType(); + SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType); + + DefaultFeatureCollection linesFeatures = new DefaultFeatureCollection(); + + List<Coordinate> coordinatesByDay = null; + + TripMapPoint previousPoint = null; + + for (TripMapPoint point : tripMapPoints) { + if (previousPoint == null) { + coordinatesByDay = Lists.newLinkedList(); + } else if (!DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) { + + if (coordinatesByDay.size() > 1) { + LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); + lineBuilder.add(line); + lineBuilder.add(dateFormat.format(previousPoint.getTime())); + lineBuilder.add("tripDay"); + SimpleFeature feature = lineBuilder.buildFeature(null); + + linesFeatures.add(feature); + } + + + Coordinate[] coordinates = { + new Coordinate(previousPoint.getLongitude(), previousPoint.getLatitude()), + new Coordinate(point.getLongitude(), point.getLatitude()), + }; + LineString lineBetweenTwoDays = geometryFactory.createLineString(coordinates); + lineBuilder.add(lineBetweenTwoDays); + lineBuilder.add(DateFormat.getDateInstance().format(previousPoint.getTime())); + lineBuilder.add("tripBetweenTwoDays"); + linesFeatures.add(lineBuilder.buildFeature(null)); + + coordinatesByDay = Lists.newLinkedList(); + } + + Coordinate coordinate = new Coordinate(point.getLongitude(), point.getLatitude()); + coordinatesByDay.add(coordinate); + + previousPoint = point; + } + + if (coordinatesByDay.size() > 1) { + LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); + lineBuilder.add(line); + lineBuilder.add(dateFormat.format(previousPoint.getTime())); + lineBuilder.add("tripDay"); + linesFeatures.add(lineBuilder.buildFeature(null)); + } + + Style styleLines = findStyle(styledLayerDescriptor, TRIP_LINES_LAYER_NAME, null); + Layer layerLines = new FeatureLayer(linesFeatures, styleLines); + mapContent.addLayer(layerLines); + + + // add Point + SimpleFeatureTypeBuilder pointFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); + pointFeatureTypeBuilder.setName("point Builder"); + pointFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); + pointFeatureTypeBuilder.add("points", MultiPoint.class); + pointFeatureTypeBuilder.add("schoolType", String.class); + + SimpleFeatureType pointFeatureType = pointFeatureTypeBuilder.buildFeatureType(); + SimpleFeatureBuilder pointBuilder = new SimpleFeatureBuilder(pointFeatureType); + + DefaultFeatureCollection pointsFeatures = new DefaultFeatureCollection(); + + for (final SchoolType schoolType : SchoolType.values()) { + + Iterable<Coordinate> coordinates = Iterables.transform( + Iterables.filter(tripMapPoints, new Predicate<TripMapPoint>() { + @Override + public boolean apply(TripMapPoint input) { + return input.getSchoolType() == schoolType; + } + }), + new Function<TripMapPoint, Coordinate>() { + @Override + public Coordinate apply(TripMapPoint input) { + return new Coordinate(input.getLongitude(), input.getLatitude()); + } + }); + + MultiPoint points = geometryFactory.createMultiPoint(Lists.newArrayList(coordinates).toArray(new Coordinate[0])); + pointBuilder.add(points); + pointBuilder.add(schoolType.name()); + pointsFeatures.add(pointBuilder.buildFeature(null)); + } + + Style stylePoints = findStyle(styledLayerDescriptor, TRIP_POINTS_LAYER_NAME, null); + Layer pointsLayer = new FeatureLayer(pointsFeatures, stylePoints); + mapContent.addLayer(pointsLayer); + // set zoom + + tripArea = new ReferencedEnvelope(); + for (TripMapPoint point : tripMapPoints) { + tripArea.expandToInclude(new DirectPosition2D(point.getLongitude(), point.getLatitude())); + } + tripArea.expandBy(1.1); + + + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("error in getMapContent", e); + } + } + } + + return mapContent; + } + + protected StyledLayerDescriptor importStyledLayerDescriptor() throws FileNotFoundException { + File styleFile = config.getMapStyleFile(); + StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null); + + SLDParser stylereader = new SLDParser(styleFactory, styleFile); + + StyledLayerDescriptor styledLayerDescriptor = stylereader.parseSLD(); + + return styledLayerDescriptor; + } + + protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) throws Exception { + + Optional<StyledLayer> styledLayerOptional = Iterables.tryFind(styledLayerDescriptor.layers(), new Predicate<StyledLayer>() { + @Override + public boolean apply(StyledLayer input) { + return input.getName().equals(layerName); + } + }); + + Style style = null; + + if (styledLayerOptional.isPresent()) { + + StyledLayer styledLayer = styledLayerOptional.get(); + + Style[] styles = new Style[0]; + + if (styledLayer instanceof UserLayer) { + + styles = ((UserLayer) styledLayer).getUserStyles(); + + } else if (styledLayer instanceof NamedLayer) { + + styles = ((NamedLayer) styledLayer).getStyles(); + + } + + if (styles.length == 1) { + + style = styles[0]; + + } else { + + for (Style styleTmp : styles) { + + if (StringUtils.isBlank(styleName) && styleTmp.isDefault() + || styleTmp.getName().equals(styleName)) { + + style = styleTmp; + } + } + } + } + + if (style == null) { + throw new Exception(String.format("No style found for layer name '%s' and style name '%s'", layerName, styleName)); + } + + return style; + } + + + private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener { + + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + int notches = e.getWheelRotation(); + double scale = notches; + + if (log.isDebugEnabled()) { + log.debug(String.format("Map mouse zoom (rotation : %s, scale : %s)", notches, scale)); + } + + ReferencedEnvelope displayArea = tripMapUI.getDisplayArea(); + displayArea.expandBy(scale); + if (! displayArea.isEmpty()) { + tripMapUI.setDisplayArea(displayArea); + } + } + + @Override + public void mouseClicked(MouseEvent e) { + + } + + protected Point2D startPointInWorld; + protected AffineTransform startScreenToWorldTransform; + protected ReferencedEnvelope startDisplayArea; + + @Override + public void mousePressed(MouseEvent e) { + startMove(e.getPoint()); + } + + @Override + public void mouseReleased(MouseEvent e) { + endMove(e.getPoint()); + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + + @Override + public void mouseDragged(MouseEvent e) { +// endMove(e.getPoint()); + } + + @Override + public void mouseMoved(MouseEvent e) { + + } + + protected void startMove(Point2D startPointInScreen) { + startDisplayArea = tripMapUI.getDisplayArea(); + startScreenToWorldTransform = tripMapUI.getScreenToWorldTransform(); + startPointInWorld = new Point2D.Double(); + startScreenToWorldTransform.transform(startPointInScreen, startPointInWorld); + } + + protected void endMove(Point2D endPointInScreen) { + Point2D endPointInWorld = new Point2D.Double(); + startScreenToWorldTransform.transform(endPointInScreen, endPointInWorld); + double transX = startPointInWorld.getX() - endPointInWorld.getX(); + double transY = startPointInWorld.getY() - endPointInWorld.getY(); + + ReferencedEnvelope endDisplayArea = new ReferencedEnvelope(startDisplayArea); + endDisplayArea.translate(transX, transY); + + tripMapUI.setDisplayArea(endDisplayArea); + if (log.isDebugEnabled()) { + log.debug(String.format("Translate (x : %s, y : %s)", transX, transY)); + } + } + } + + + +} diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index d7ba4e0..180233f 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -21,14 +21,6 @@ */ package fr.ird.observe.ui.content.open.impl.seine; -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.MultiPoint; import fr.ird.observe.DataService; import fr.ird.observe.ObserveConfig; import fr.ird.observe.ObserveDAOHelper; @@ -36,41 +28,14 @@ import fr.ird.observe.db.DataContext; import fr.ird.observe.db.DataSource; import fr.ird.observe.db.constants.DataContextType; import fr.ird.observe.db.util.TopiaExecutor2; -import fr.ird.observe.entities.constants.seine.SchoolType; import fr.ird.observe.entities.referentiel.Program; import fr.ird.observe.entities.seine.Routes; import fr.ird.observe.entities.seine.TripSeine; -import fr.ird.observe.tripMap.TripMapPoint; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.content.open.ContentOpenableUIModel; -import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.geotools.data.FileDataStore; -import org.geotools.data.FileDataStoreFinder; -import org.geotools.data.simple.SimpleFeatureSource; -import org.geotools.factory.CommonFactoryFinder; -import org.geotools.feature.DefaultFeatureCollection; -import org.geotools.feature.FeatureCollection; -import org.geotools.feature.simple.SimpleFeatureBuilder; -import org.geotools.feature.simple.SimpleFeatureTypeBuilder; -import org.geotools.geometry.DirectPosition2D; -import org.geotools.geometry.jts.JTSFactoryFinder; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.geotools.map.FeatureLayer; -import org.geotools.map.Layer; -import org.geotools.map.MapContent; -import org.geotools.referencing.CRS; -import org.geotools.styling.Fill; -import org.geotools.styling.Font; -import org.geotools.styling.LinePlacementImpl; -import org.geotools.styling.LineSymbolizer; -import org.geotools.styling.SLD; -import org.geotools.styling.Stroke; -import org.geotools.styling.Style; -import org.geotools.styling.StyleFactory; -import org.geotools.styling.TextSymbolizer; import org.geotools.swing.JMapPane; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; @@ -78,27 +43,11 @@ import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.util.TopiaEntityBinder; import org.nuiton.util.DateUtil; -import org.opengis.feature.simple.SimpleFeature; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.filter.FilterFactory; -import org.opengis.referencing.FactoryException; import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.Color; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.event.MouseWheelEvent; -import java.awt.event.MouseWheelListener; -import java.awt.geom.AffineTransform; -import java.awt.geom.Point2D; -import java.io.File; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Date; -import java.util.List; import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; @@ -112,6 +61,8 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { /** Logger */ static private final Log log = LogFactory.getLog(TripSeineUIHandler.class); + protected TripMapHandler tripMapHandler; + public TripSeineUIHandler(TripSeineUI ui) { super(ui, DataContextType.Program, @@ -153,7 +104,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { ContentMode mode = computeContentMode(); String programId = getSelectedParentId(); - String tripId = getSelectedId(); + final String tripId = getSelectedId(); if (log.isInfoEnabled()) { log.info(prefix + "programId = " + programId); @@ -191,27 +142,26 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } - + JMapPane tripMap = getUi().getTripMap(); ObserveConfig config = ui.getContextValue(ObserveConfig.class); - final JMapPane tripMap = getUi().getTripMap(); + tripMapHandler = new TripMapHandler(tripMap, config); + + - tripMap.setBackground(config.getMapBackgroundColor()); getUi().getTripSeineTabPane().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); - if (tripSeineTabPane.getSelectedComponent() == tripMap) { - doOpenMap(); + TripSeineUI ui = getUi(); + if (tripSeineTabPane.getSelectedComponent() == ui.getTripMap()) { + tripMapHandler.doOpenMap(ui.getDataService(), ui.getDataSource(), tripId); } } }); - MouseMapListener mouseMapListener = new MouseMapListener(); - tripMap.addMouseWheelListener(mouseMapListener); - tripMap.addMouseMotionListener(mouseMapListener); - tripMap.addMouseListener(mouseMapListener); + finalizeOpenUI(mode, create); } @@ -370,297 +320,4 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } - public void doOpenMap() { - JMapPane tripMap = getUi().getTripMap(); - tripMap.setMapContent(getMapContent()); - tripMap.setDisplayArea(tripArea); - tripMap.invalidate(); - } - - protected MapContent mapContent; - protected ReferencedEnvelope tripArea; - - public MapContent getMapContent() { -// if (mapContent == null) { - try { - - mapContent = new MapContent(); - mapContent.setTitle("Un titre"); - - // add map layers - ObserveConfig config = ui.getContextValue(ObserveConfig.class); - - for (File layerFile : config.getMapLayerFiles()) { - FileDataStore store = FileDataStoreFinder.getDataStore(layerFile); - SimpleFeatureSource featureSource = store.getFeatureSource(); - Style style = SLD.createSimpleStyle(featureSource.getSchema()); - Layer layer = new FeatureLayer(featureSource, style); - mapContent.addLayer(layer); - } - - - SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); - - // add lines - DataService dataService = getDataService(); - DataSource source = getDataSource(); - String tripId = getSelectedId(); - - List<TripMapPoint> tripMapPoints = dataService.loadTripMapActivityPoints(source, tripId); - - GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); - - SimpleFeatureTypeBuilder lineFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); - lineFeatureTypeBuilder.setName("lineBuilder"); - lineFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); - lineFeatureTypeBuilder.add("line", LineString.class); - lineFeatureTypeBuilder.add("label", String.class); - - SimpleFeatureType lineFeatureType = lineFeatureTypeBuilder.buildFeatureType(); - SimpleFeatureBuilder lineBuilder = new SimpleFeatureBuilder(lineFeatureType); - - DefaultFeatureCollection featuresDays = new DefaultFeatureCollection(); - DefaultFeatureCollection featuresBetweenTowDays = new DefaultFeatureCollection(); - - List<Coordinate> coordinatesByDay = null; - - TripMapPoint previousPoint = null; - - for (TripMapPoint point : tripMapPoints) { - if (previousPoint == null) { - coordinatesByDay = Lists.newLinkedList(); - } else if (!DateUtils.isSameDay(previousPoint.getTime(), point.getTime())) { - - if (coordinatesByDay.size() > 1) { - LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); - lineBuilder.add(line); - lineBuilder.add(dateFormat.format(previousPoint.getTime())); - SimpleFeature feature = lineBuilder.buildFeature(null); - - featuresDays.add(feature); - } - - - Coordinate[] coordinates = { - new Coordinate(previousPoint.getLongitude(), previousPoint.getLatitude()), - new Coordinate(point.getLongitude(), point.getLatitude()), - }; - LineString lineBetweenTwoDays = geometryFactory.createLineString(coordinates); - lineBuilder.add(lineBetweenTwoDays); - lineBuilder.add(DateFormat.getDateInstance().format(previousPoint.getTime())); - featuresBetweenTowDays.add(lineBuilder.buildFeature(null)); - - coordinatesByDay = Lists.newLinkedList(); - } - - Coordinate coordinate = new Coordinate(point.getLongitude(), point.getLatitude()); - coordinatesByDay.add(coordinate); - - previousPoint = point; - } - - if (coordinatesByDay.size() > 1) { - LineString line = geometryFactory.createLineString(coordinatesByDay.toArray(new Coordinate[0])); - lineBuilder.add(line); - lineBuilder.add(dateFormat.format(previousPoint.getTime())); - featuresDays.add(lineBuilder.buildFeature(null)); - } - - Layer layerDays = new FeatureLayer(featuresDays, getStyleLineDay()); - Layer layerBetweenTowDays = new FeatureLayer(featuresBetweenTowDays, getStyleLineBetweenTwoDays()); - mapContent.addLayer(layerDays); - mapContent.addLayer(layerBetweenTowDays); - - // add Point - FeatureCollection featurePointsLibres = generateFeaturePoints(tripMapPoints, SchoolType.libre); - FeatureCollection featurePointsObjets = generateFeaturePoints(tripMapPoints, SchoolType.objet); - - Layer layerPointsLibres = new FeatureLayer(featurePointsLibres, getStylePointLibre()); - Layer layerPointsObjets = new FeatureLayer(featurePointsObjets, getStylePointObjet()); - mapContent.addLayer(layerPointsLibres); - mapContent.addLayer(layerPointsObjets); - - - - // set zoom - - tripArea = new ReferencedEnvelope(); - for (TripMapPoint point : tripMapPoints) { - tripArea.expandToInclude(new DirectPosition2D(point.getLongitude(), point.getLatitude())); - } - tripArea.expandBy(1.1); - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Error on generate Map", e); - } - } -// } - return mapContent; - } - - private Style getStylePointObjet() { - return SLD.createPointStyle("Triangle", Color.BLACK, Color.ORANGE, 1, 16); - } - - protected Style getStylePointLibre() { - return SLD.createPointStyle("X", Color.BLACK, Color.GREEN, 1, 16); - } - - protected FeatureCollection generateFeaturePoints(List<TripMapPoint> tripMapPoints, final SchoolType schoolType) throws FactoryException { - SimpleFeatureTypeBuilder pointFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); - pointFeatureTypeBuilder.setName("point Builder"); - pointFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); - pointFeatureTypeBuilder.add("point", MultiPoint.class); - - SimpleFeatureType pointFeatureType = pointFeatureTypeBuilder.buildFeatureType(); - SimpleFeatureBuilder pointBuilder = new SimpleFeatureBuilder(pointFeatureType); - - DefaultFeatureCollection featuresPoint = new DefaultFeatureCollection(); - - Iterable<Coordinate> coordinates = Iterables.transform( - Iterables.filter(tripMapPoints, new Predicate<TripMapPoint>() { - @Override - public boolean apply(TripMapPoint input) { - return input.getSchoolType() == schoolType; - } - }), - new Function<TripMapPoint, Coordinate>() { - @Override - public Coordinate apply(TripMapPoint input) { - return new Coordinate(input.getLongitude(), input.getLatitude()); - } - }); - - GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); - - MultiPoint points = geometryFactory.createMultiPoint(Lists.newArrayList(coordinates).toArray(new Coordinate[0])); - pointBuilder.add(points); - featuresPoint.add(pointBuilder.buildFeature(null)); - - return featuresPoint; - } - - protected Style getStyleLineDay() { - StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); - FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); - - Stroke stroke = sf.createStroke(ff.literal(Color.BLACK), ff.literal(1)); - LineSymbolizer lineSym = sf.createLineSymbolizer(stroke, null); - - - Font font = sf.getDefaultFont(); - font.setSize(ff.literal(14)); - Fill labelFill = sf.createFill(ff.literal(Color.BLACK)); - - LinePlacementImpl labelPlacement = new LinePlacementImpl(ff, true, true, false, null, null); - labelPlacement.setPerpendicularOffset(ff.literal(10)); - - TextSymbolizer textSym = sf.createTextSymbolizer( - labelFill, new Font[]{font}, null, ff.property("label"), labelPlacement, null); - - return SLD.wrapSymbolizers( lineSym, textSym ); - - } - - protected Style getStyleLineBetweenTwoDays() { - StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); - FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); - float[] dashArray = {5f, 5f}; - org.geotools.styling.Stroke stroke = sf.createStroke(ff.literal(Color.BLACK), - ff.literal(1), - null, - null, - null, - dashArray, - null, - null, - null); - - return SLD.wrapSymbolizers(sf.createLineSymbolizer(stroke, null)); - } - - private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener { - - @Override - public void mouseWheelMoved(MouseWheelEvent e) { - int notches = e.getWheelRotation(); - double scale = notches; - - if (log.isDebugEnabled()) { - log.debug(String.format("Map mouse zoom (rotation : %s, scale : %s)", notches, scale)); - } - - JMapPane tripMap = getUi().getTripMap(); - ReferencedEnvelope displayArea = tripMap.getDisplayArea(); - displayArea.expandBy(scale); - if (! displayArea.isEmpty()) { - tripMap.setDisplayArea(displayArea); - } - } - - @Override - public void mouseClicked(MouseEvent e) { - - } - - protected Point2D startPointInWorld; - protected AffineTransform startScreenToWorldTransform; - protected ReferencedEnvelope startDisplayArea; - - @Override - public void mousePressed(MouseEvent e) { - startMove(e.getPoint()); - } - - @Override - public void mouseReleased(MouseEvent e) { - endMove(e.getPoint()); - } - - @Override - public void mouseEntered(MouseEvent e) { - - } - - @Override - public void mouseExited(MouseEvent e) { - - } - - @Override - public void mouseDragged(MouseEvent e) { -// endMove(e.getPoint()); - } - - @Override - public void mouseMoved(MouseEvent e) { - - } - - protected void startMove(Point2D startPointInScreen) { - JMapPane tripMap = getUi().getTripMap(); - startDisplayArea = tripMap.getDisplayArea(); - startScreenToWorldTransform = tripMap.getScreenToWorldTransform(); - startPointInWorld = new Point2D.Double(); - startScreenToWorldTransform.transform(startPointInScreen, startPointInWorld); - } - - protected void endMove(Point2D endPointInScreen) { - Point2D endPointInWorld = new Point2D.Double(); - startScreenToWorldTransform.transform(endPointInScreen, endPointInWorld); - double transX = startPointInWorld.getX() - endPointInWorld.getX(); - double transY = startPointInWorld.getY() - endPointInWorld.getY(); - - ReferencedEnvelope endDisplayArea = new ReferencedEnvelope(startDisplayArea); - endDisplayArea.translate(transX, transY); - - JMapPane tripMap = getUi().getTripMap(); - tripMap.setDisplayArea(endDisplayArea); - if (log.isDebugEnabled()) { - log.debug(String.format("Translate (x : %s, y : %s)", transX, transY)); - } - } - } - } diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index 3431a6a..5ac4c48 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -972,6 +972,7 @@ observe.config.map.layer6.description= observe.config.map.layer7.description= observe.config.map.layer8.description= observe.config.map.layer9.description= +observe.config.map.style.description= observe.config.observation.activitysDetaillees= observe.config.observation.fauneAssociee= observe.config.observation.floatingObject= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 43af648..80a6e96 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -972,6 +972,7 @@ observe.config.map.layer6.description= observe.config.map.layer7.description= observe.config.map.layer8.description= observe.config.map.layer9.description= +observe.config.map.style.description= observe.config.observation.activitysDetaillees=Observación de actividades detalladas observe.config.observation.fauneAssociee=Observación de Fauna asociada observe.config.observation.floatingObject=Observación de objetos flotantes diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index 4735179..13f279b 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -927,7 +927,7 @@ observe.config.category.gps=GPS observe.config.category.gps.description=Configuration GPS observe.config.category.h2=Base locale observe.config.category.h2.description=Configuration base locale -observe.config.category.map=Fonds de carte +observe.config.category.map=Carte observe.config.category.map.description=Configuration des fonds à utiliser pour les cartes observe.config.category.observation=Qualification des observations observe.config.category.observation.description=Gestion des indicateurs de qualification des programmes @@ -972,6 +972,7 @@ observe.config.map.layer6.description=Fichier (shapeFiles) du sixième calque de observe.config.map.layer7.description=Fichier (shapeFiles) du septième calque de la carte observe.config.map.layer8.description=Fichier (shapeFiles) du huitième calque de la carte observe.config.map.layer9.description=Fichier (shapeFiles) du neuvième calque de la carte +observe.config.map.style.description=Fichier des style à appliquer sur les calques de la carte observe.config.observation.activitysDetaillees=Observation des activités détaillées observe.config.observation.fauneAssociee=Observation des Faunes associées observe.config.observation.floatingObject=Observation des objets flottants diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.dbf b/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.dbf similarity index 100% rename from observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.dbf rename to observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.dbf diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.prj b/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.prj similarity index 100% rename from observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.prj rename to observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.prj diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbn b/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbn similarity index 100% rename from observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbn rename to observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbn diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbx b/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbx similarity index 100% rename from observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.sbx rename to observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbx diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp b/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp similarity index 100% rename from observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp rename to observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp.xml b/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp.xml similarity index 100% rename from observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shp.xml rename to observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp.xml diff --git a/observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shx b/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shx similarity index 100% rename from observe-swing/src/main/resources/shapeFiles/zee/World_EEZ_v8_2014.shx rename to observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shx diff --git a/observe-swing/src/main/resources/map/style.xml b/observe-swing/src/main/resources/map/style.xml new file mode 100644 index 0000000..b04fa28 --- /dev/null +++ b/observe-swing/src/main/resources/map/style.xml @@ -0,0 +1,126 @@ +<StyledLayerDescriptor version="1.0.0" + xmlns="http://www.opengis.net/sld" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ogc="http://www.opengis.net/ogc" + xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd + http://www.opengis.net/ogc http://schemas.opengis.net/filter/1.0.0/filter.xsd"> + + <NamedLayer> + <Name>Trip lines</Name> + <UserStyle> + <IsDefault>true</IsDefault> + <Title>SLD Cook Book: Simple Line</Title> + <FeatureTypeStyle> + <Rule> + <Name>Trip day</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>type</ogc:PropertyName> + <ogc:Literal>tripDay</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <LineSymbolizer> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">2</CssParameter> + </Stroke> + </LineSymbolizer> + <TextSymbolizer> + <Label> + <ogc:PropertyName>label</ogc:PropertyName> + </Label> + <LabelPlacement> + <LinePlacement> + <PerpendicularOffset>10</PerpendicularOffset> + </LinePlacement> + </LabelPlacement> + <Fill> + <CssParameter name="fill">#000000</CssParameter> + </Fill> + <Font> + <CssParameter name="font-size">14</CssParameter> + <CssParameter name="font-style">normal</CssParameter> + <CssParameter name="font-weight">bold</CssParameter> + </Font> + </TextSymbolizer> + </Rule> + </FeatureTypeStyle> + <FeatureTypeStyle> + <Rule> + <Name>Trip between two days</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>type</ogc:PropertyName> + <ogc:Literal>tripBetweenTwoDays</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <LineSymbolizer> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">2</CssParameter> + <CssParameter name="stroke-dasharray">6 4</CssParameter> + </Stroke> + </LineSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> + <NamedLayer> + <Name>Trip points</Name> + <UserStyle> + <IsDefault>true</IsDefault> + <FeatureTypeStyle> + <Rule> + <Name>Point libre</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>schoolType</ogc:PropertyName> + <ogc:Literal>libre</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>Triangle</WellKnownName> + <Fill> + <CssParameter name="fill">#FFC800</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </Mark> + <Size>16</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + <FeatureTypeStyle> + <Rule> + <Name>Point objet</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>schoolType</ogc:PropertyName> + <ogc:Literal>objet</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>X</WellKnownName> + <Fill> + <CssParameter name="fill">#00FF00</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </Mark> + <Size>16</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> +</StyledLayerDescriptor> \ No newline at end of file -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 90709cf685b386b9c5db247a5c97d503fbd7ba8f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 16:08:47 2015 +0200 zoom (or un-zoom) on pointer --- .../ui/content/open/impl/seine/TripMapHandler.java | 34 ++++++++++++++++++---- observe-swing/src/main/resources/log4j.properties | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java index a00e296..1903519 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java @@ -65,6 +65,8 @@ public class TripMapHandler { public static final String TRIP_LINES_LAYER_NAME = "Trip lines"; public static final String TRIP_POINTS_LAYER_NAME = "Trip points"; + public static final double ZOOM_STEP_RATIO = 0.1; + private static final Log log = LogFactory.getLog(TripMapHandler.class); @@ -321,14 +323,36 @@ public class TripMapHandler { int notches = e.getWheelRotation(); double scale = notches; + ReferencedEnvelope displayArea = tripMapUI.getDisplayArea(); + double deltaWidth = displayArea.getWidth() * notches * ZOOM_STEP_RATIO; + double deltaHeight = displayArea.getHeight() * notches * ZOOM_STEP_RATIO; + + double ratioLeft = e.getX() * 1d / tripMapUI.getWidth(); + + // l'axe de Y est inversé entre le référentiel du composant swing et le référentiel géographique + double ratioTop = 1 - (e.getY() * 1d / tripMapUI.getHeight()); + + double deltaLeft = deltaWidth * ratioLeft; + double deltaRight = deltaLeft - deltaWidth; + + double deltaTop = deltaHeight * ratioTop; + double deltaBottom = deltaTop - deltaHeight; + if (log.isDebugEnabled()) { - log.debug(String.format("Map mouse zoom (rotation : %s, scale : %s)", notches, scale)); + log.debug(String.format("Map mouse zoom (rotation : %s, deltaLeft : %s, deltaRight : %s, deltaTop : %s, deltaBottom : %s)", + notches, deltaLeft, deltaRight, deltaRight, deltaBottom)); } - ReferencedEnvelope displayArea = tripMapUI.getDisplayArea(); - displayArea.expandBy(scale); - if (! displayArea.isEmpty()) { - tripMapUI.setDisplayArea(displayArea); + ReferencedEnvelope newDisplayArea = new ReferencedEnvelope( + displayArea.getMinX() + deltaLeft, + displayArea.getMaxX() + deltaRight, + displayArea.getMinY() + deltaTop, + displayArea.getMaxY() + deltaBottom, + displayArea.getCoordinateReferenceSystem() + ); + + if (! newDisplayArea.isEmpty()) { + tripMapUI.setDisplayArea(newDisplayArea); } } diff --git a/observe-swing/src/main/resources/log4j.properties b/observe-swing/src/main/resources/log4j.properties index d605aa0..8a5bc1e 100644 --- a/observe-swing/src/main/resources/log4j.properties +++ b/observe-swing/src/main/resources/log4j.properties @@ -51,4 +51,4 @@ log4j.logger.org.nuiton.topia.migration=INFO log4j.logger.jaxx.runtime.validator.swing.SwingValidator=ERROR -log4j.logger.fr.ird.observe.ui.content.open.impl.seine.TripSeineUIHandler=DEBUG +log4j.logger.fr.ird.observe.ui.content.open.impl.seine.TripMapHandler=DEBUG -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit e8e55ac9974a06c47dacf239814cd722b089d996 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 17:31:40 2015 +0200 add layers --- .../java/fr/ird/observe/ObserveConfigOption.java | 10 +-- .../ui/content/open/impl/seine/TripMapHandler.java | 20 ++++-- .../map/shapeFiles/borders/WDBII_border_l_L1.dbf | Bin 0 -> 40956 bytes .../map/shapeFiles/borders/WDBII_border_l_L1.prj | 1 + .../map/shapeFiles/borders/WDBII_border_l_L1.shp | Bin 0 -> 139420 bytes .../map/shapeFiles/borders/WDBII_border_l_L1.shx | Bin 0 -> 3692 bytes .../map/shapeFiles/continents/GSHHS_l_L1.dbf | Bin 0 -> 1227230 bytes .../map/shapeFiles/continents/GSHHS_l_L1.prj | 1 + .../map/shapeFiles/continents/GSHHS_l_L1.shp | Bin 0 -> 1221404 bytes .../map/shapeFiles/continents/GSHHS_l_L1.shx | Bin 0 -> 45756 bytes .../map/shapeFiles/continents/GSHHS_l_L6.dbf | Bin 0 -> 20435 bytes .../map/shapeFiles/continents/GSHHS_l_L6.prj | 1 + .../map/shapeFiles/continents/GSHHS_l_L6.shp | Bin 0 -> 48740 bytes .../map/shapeFiles/continents/GSHHS_l_L6.shx | Bin 0 -> 852 bytes .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf | Bin 0 -> 939130 bytes .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj | 1 + .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp | Bin 0 -> 721340 bytes .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx | Bin 0 -> 35036 bytes observe-swing/src/main/resources/map/style.xml | 77 +++++++++++++++++++++ 19 files changed, 101 insertions(+), 10 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java index 27731d2..c89cd3a 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java @@ -630,7 +630,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_1( "map.layer1.path", n("observe.config.map.layer1.description"), - "${user.home}/.observe/map/shapeFiles/zee/World_EEZ_v8_2014.shp", + "${user.home}/.observe/map/shapeFiles/continents/GSHHS_l_L1.shp", File.class, false, false @@ -639,7 +639,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_2( "map.layer2.path", n("observe.config.map.layer2.description"), - null, + "${user.home}/.observe/map/shapeFiles/continents/GSHHS_l_L6.shp", File.class, false, false @@ -648,7 +648,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_3( "map.layer3.path", n("observe.config.map.layer3.description"), - null, + "${user.home}/.observe/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp", File.class, false, false @@ -657,7 +657,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_4( "map.layer4.path", n("observe.config.map.layer4.description"), - null, + "${user.home}/.observe/map/shapeFiles/borders/WDBII_border_l_L1.shp", File.class, false, false @@ -666,7 +666,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_5( "map.layer5.path", n("observe.config.map.layer5.description"), - null, + "${user.home}/.observe/map/shapeFiles/zee/World_EEZ_v8_2014.shp", File.class, false, false diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java index 1903519..a8ec791 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java @@ -118,17 +118,19 @@ public class TripMapHandler { try { mapContent = new MapContent(); - mapContent.setTitle("Un titre"); + + StyledLayerDescriptor styledLayerDescriptor = importStyledLayerDescriptor(); + for (File layerFile : config.getMapLayerFiles()) { FileDataStore store = FileDataStoreFinder.getDataStore(layerFile); SimpleFeatureSource featureSource = store.getFeatureSource(); Style style = SLD.createSimpleStyle(featureSource.getSchema()); + style = findStyle(styledLayerDescriptor, store.getNames().get(0).getLocalPart(), null, style); Layer layer = new FeatureLayer(featureSource, style); mapContent.addLayer(layer); } - StyledLayerDescriptor styledLayerDescriptor = importStyledLayerDescriptor(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); @@ -264,7 +266,7 @@ public class TripMapHandler { return styledLayerDescriptor; } - protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) throws Exception { + protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName, Style defaultStyle) { Optional<StyledLayer> styledLayerOptional = Iterables.tryFind(styledLayerDescriptor.layers(), new Predicate<StyledLayer>() { @Override @@ -273,7 +275,7 @@ public class TripMapHandler { } }); - Style style = null; + Style style = defaultStyle; if (styledLayerOptional.isPresent()) { @@ -308,11 +310,19 @@ public class TripMapHandler { } } + return style; + + } + + protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) throws Exception { + + Style style = findStyle(styledLayerDescriptor, layerName, styleName, null); + if (style == null) { throw new Exception(String.format("No style found for layer name '%s' and style name '%s'", layerName, styleName)); } - return style; + } diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.dbf b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.dbf new file mode 100644 index 0000000..4fa0d6e Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.dbf differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.prj b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.prj new file mode 100644 index 0000000..a30c00a --- /dev/null +++ b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shp b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shp new file mode 100644 index 0000000..33bbcc9 Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shp differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shx b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shx new file mode 100644 index 0000000..cda0c4d Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shx differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.dbf b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.dbf new file mode 100644 index 0000000..6d95d62 Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.dbf differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.prj b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.prj new file mode 100644 index 0000000..a30c00a --- /dev/null +++ b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shp b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shp new file mode 100644 index 0000000..6f54bb2 Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shp differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shx b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shx new file mode 100644 index 0000000..4dd1077 Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shx differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.dbf b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.dbf new file mode 100644 index 0000000..5c3e8dd Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.dbf differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.prj b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.prj new file mode 100644 index 0000000..a30c00a --- /dev/null +++ b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shp b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shp new file mode 100644 index 0000000..d119232 Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shp differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shx b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shx new file mode 100644 index 0000000..415ee7e Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shx differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf new file mode 100644 index 0000000..367eeac Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj new file mode 100644 index 0000000..a30c00a --- /dev/null +++ b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj @@ -0,0 +1 @@ +GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] \ No newline at end of file diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp new file mode 100644 index 0000000..4831eb7 Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp differ diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx new file mode 100644 index 0000000..0a76b84 Binary files /dev/null and b/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx differ diff --git a/observe-swing/src/main/resources/map/style.xml b/observe-swing/src/main/resources/map/style.xml index b04fa28..a42c641 100644 --- a/observe-swing/src/main/resources/map/style.xml +++ b/observe-swing/src/main/resources/map/style.xml @@ -123,4 +123,81 @@ </FeatureTypeStyle> </UserStyle> </NamedLayer> + + <NamedLayer> + <Name>World_EEZ_v8_2014</Name> + <UserStyle> + <FeatureTypeStyle> + <Rule> + <PolygonSymbolizer> + <Fill> + <CssParameter name="fill">#82F4F9</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </PolygonSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> + + <NamedLayer> + <Name>GSHHS_l_L1</Name> + <UserStyle> + <FeatureTypeStyle> + <Rule> + <PolygonSymbolizer> + <Fill> + <CssParameter name="fill">#FBE9D7</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </PolygonSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> + + <NamedLayer> + <Name>GSHHS_l_L6</Name> + <UserStyle> + <FeatureTypeStyle> + <Rule> + <PolygonSymbolizer> + <Fill> + <CssParameter name="fill">#F5F5FF</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </PolygonSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> + + <NamedLayer> + <Name>GSHHS_l_L2</Name> + <UserStyle> + <FeatureTypeStyle> + <Rule> + <PolygonSymbolizer> + <Fill> + <CssParameter name="fill">#7FB7FF</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#7FB7FF</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </PolygonSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> + </StyledLayerDescriptor> \ No newline at end of file -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 18e3c8a0464ccd5ffb51c3f55e9f805f9921b1eb Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 17:35:08 2015 +0200 fix zoom --- .../fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java index a8ec791..ca8a3f8 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java @@ -331,11 +331,10 @@ public class TripMapHandler { @Override public void mouseWheelMoved(MouseWheelEvent e) { int notches = e.getWheelRotation(); - double scale = notches; ReferencedEnvelope displayArea = tripMapUI.getDisplayArea(); - double deltaWidth = displayArea.getWidth() * notches * ZOOM_STEP_RATIO; - double deltaHeight = displayArea.getHeight() * notches * ZOOM_STEP_RATIO; + double deltaWidth = displayArea.getWidth() * notches * ZOOM_STEP_RATIO * -1; + double deltaHeight = displayArea.getHeight() * notches * ZOOM_STEP_RATIO * -1; double ratioLeft = e.getX() * 1d / tripMapUI.getWidth(); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 649064bae7ba1fe8ca93e02edf28ed2d389e8f14 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 20 19:41:54 2015 +0200 refs #6944 Déplacement des resources pour en faire un zip à intégrer dans le class-path --- .../map/shapeFiles/borders/WDBII_border_l_L1.dbf | Bin .../map/shapeFiles/borders/WDBII_border_l_L1.prj | 0 .../map/shapeFiles/borders/WDBII_border_l_L1.shp | Bin .../map/shapeFiles/borders/WDBII_border_l_L1.shx | Bin .../map/shapeFiles/continents/GSHHS_l_L1.dbf | Bin .../map/shapeFiles/continents/GSHHS_l_L1.prj | 0 .../map/shapeFiles/continents/GSHHS_l_L1.shp | Bin .../map/shapeFiles/continents/GSHHS_l_L1.shx | Bin .../map/shapeFiles/continents/GSHHS_l_L6.dbf | Bin .../map/shapeFiles/continents/GSHHS_l_L6.prj | 0 .../map/shapeFiles/continents/GSHHS_l_L6.shp | Bin .../map/shapeFiles/continents/GSHHS_l_L6.shx | Bin .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf | Bin .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj | 0 .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp | Bin .../map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx | Bin .../map/shapeFiles/zee/World_EEZ_v8_2014.dbf | Bin .../map/shapeFiles/zee/World_EEZ_v8_2014.prj | 0 .../map/shapeFiles/zee/World_EEZ_v8_2014.sbn | Bin .../map/shapeFiles/zee/World_EEZ_v8_2014.sbx | Bin .../map/shapeFiles/zee/World_EEZ_v8_2014.shp | Bin .../map/shapeFiles/zee/World_EEZ_v8_2014.shp.xml | 0 .../map/shapeFiles/zee/World_EEZ_v8_2014.shx | Bin observe-swing/src/main/{resources => }/map/style.xml | 0 .../src/main/resources/i18n/observe-swing_en_GB.properties | 2 ++ .../src/main/resources/i18n/observe-swing_es_ES.properties | 2 ++ .../src/main/resources/i18n/observe-swing_fr_FR.properties | 2 ++ 27 files changed, 6 insertions(+) diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.dbf b/observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.dbf similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.dbf rename to observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.dbf diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.prj b/observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.prj similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.prj rename to observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.prj diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shp b/observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.shp similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shp rename to observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.shp diff --git a/observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shx b/observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.shx similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/borders/WDBII_border_l_L1.shx rename to observe-swing/src/main/map/shapeFiles/borders/WDBII_border_l_L1.shx diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.dbf b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.dbf similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.dbf rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.dbf diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.prj b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.prj similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.prj rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.prj diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shp b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.shp similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shp rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.shp diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shx b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.shx similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L1.shx rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L1.shx diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.dbf b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.dbf similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.dbf rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.dbf diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.prj b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.prj similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.prj rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.prj diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shp b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.shp similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shp rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.shp diff --git a/observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shx b/observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.shx similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/continents/GSHHS_l_L6.shx rename to observe-swing/src/main/map/shapeFiles/continents/GSHHS_l_L6.shx diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf b/observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf rename to observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.dbf diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj b/observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj rename to observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.prj diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp b/observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp rename to observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp diff --git a/observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx b/observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx rename to observe-swing/src/main/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shx diff --git a/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.dbf b/observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.dbf similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.dbf rename to observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.dbf diff --git a/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.prj b/observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.prj similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.prj rename to observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.prj diff --git a/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbn b/observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.sbn similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbn rename to observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.sbn diff --git a/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbx b/observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.sbx similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.sbx rename to observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.sbx diff --git a/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp b/observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.shp similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp rename to observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.shp diff --git a/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp.xml b/observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.shp.xml similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shp.xml rename to observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.shp.xml diff --git a/observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shx b/observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.shx similarity index 100% rename from observe-swing/src/main/resources/map/shapeFiles/zee/World_EEZ_v8_2014.shx rename to observe-swing/src/main/map/shapeFiles/zee/World_EEZ_v8_2014.shx diff --git a/observe-swing/src/main/resources/map/style.xml b/observe-swing/src/main/map/style.xml similarity index 100% rename from observe-swing/src/main/resources/map/style.xml rename to observe-swing/src/main/map/style.xml diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index 5ac4c48..9fa197f 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -952,6 +952,7 @@ observe.config.defaultGpsMaxSpeed=Maximum speed observe.config.defaultI18nDirectory.description=Default i18n directory where to store i18n resources observe.config.defaultInitialDbDump.description=Default location of initial database observe.config.defaultLocalDbDirectory.description=Default directory where to store local data source +observe.config.defaultMapDirectory.description= observe.config.defaultReportDirectory.description=Default directory where to store report definition files observe.config.defaultResourcesDirectory.description=Default user resources directory observe.config.defaultTmpDirectory.description=Default temporary directory used by application and clean at each launch. @@ -1431,6 +1432,7 @@ observe.routes.title=Routes observe.runner.config.loaded= observe.runner.config.migrate.file= observe.runner.context.loaded= +observe.runner.copy.default.map.file= observe.runner.copy.default.report.file= observe.runner.copy.default.ui.file= observe.runner.create.directory= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 80a6e96..4a9dc4b 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -952,6 +952,7 @@ observe.config.defaultGpsMaxSpeed=Velocidad máxima por defecto entre 2 puntos p observe.config.defaultI18nDirectory.description=Directorio por defecto de recursos de traducción de la aplicación observe.config.defaultInitialDbDump.description=Base empotrada creada durante la primera importación de una base remota observe.config.defaultLocalDbDirectory.description=Directorio de almacenamiento de la base local +observe.config.defaultMapDirectory.description= observe.config.defaultReportDirectory.description=Directorio por defecto de los informes de la aplicación observe.config.defaultResourcesDirectory.description=Directorio de almacenamiento de los recursos de usuario como las traducciones o la consultas de informes observe.config.defaultTmpDirectory.description=Directorio temporal por defecto @@ -1433,6 +1434,7 @@ observe.routes.title= observe.runner.config.loaded=Configuración de Observe v. %1$s cargada. observe.runner.config.migrate.file=El fichero de configuración %1$s ha sido reemplazado por \n%2$s\nvers\n%3$s observe.runner.context.loaded=Finlazada la inicialización del contexto en %1$s. +observe.runner.copy.default.map.file= observe.runner.copy.default.report.file=Creación del archivo de informes %1$s. observe.runner.copy.default.ui.file=Creación del archivo de - Création du fichier de cosmétique %1$s. observe.runner.create.directory=Creación del directorio %1$s diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index 13f279b..793d2bf 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -952,6 +952,7 @@ observe.config.defaultGpsMaxSpeed=La vitesse maximum par défaut en tre dexu poi observe.config.defaultI18nDirectory.description=Répertoire par défault des resources de traduction de l'application observe.config.defaultInitialDbDump.description=La base embarquée créee lors de le premier import d'une base distante. observe.config.defaultLocalDbDirectory.description=Le répertoire où est stockée la base locale. +observe.config.defaultMapDirectory.description= observe.config.defaultReportDirectory.description=Répertoire par défaut des rapports de l'application observe.config.defaultResourcesDirectory.description=Le répertoire où sont stockées les resources de l'utilisateur comme les traductions ou les requètes de rapports. observe.config.defaultTmpDirectory.description=Le répertoire temporaire par défaut @@ -1431,6 +1432,7 @@ observe.routes.title=Routes observe.runner.config.loaded=Configuration d'ObServe v. %1$s chargée. observe.runner.config.migrate.file=Le fichier de configuration %1$s a été déplacée de \n%2$s\nvers\n%3$s observe.runner.context.loaded=Initialisation du contexte terminée en %1$s. +observe.runner.copy.default.map.file= observe.runner.copy.default.report.file=Création du fichier de reports %1$s. observe.runner.copy.default.ui.file=Création du fichier de cosmétique %1$s. observe.runner.create.directory=Création du répertoire %1$s -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 281f2d7e1150e7046b04982cc1bd8c2d93dadb0a Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 20 19:42:46 2015 +0200 refs #6944 creation de la resources sur la partie catographie dans le build --- observe-swing/pom.xml | 22 ++++++++++++++++++++++ observe-swing/src/main/assembly/map.xml | 20 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/observe-swing/pom.xml b/observe-swing/pom.xml index d7d6a04..94f8976 100644 --- a/observe-swing/pom.xml +++ b/observe-swing/pom.xml @@ -405,6 +405,28 @@ </executions> </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>src/main/assembly/map.xml</descriptor> + </descriptors> + <attach>false</attach> + <finalName>map</finalName> + <appendAssemblyId>false</appendAssemblyId> + <outputDirectory>${project.build.outputDirectory}</outputDirectory> + </configuration> + <executions> + <execution> + <id>create-assemblies</id> + <phase>process-resources</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> </build> diff --git a/observe-swing/src/main/assembly/map.xml b/observe-swing/src/main/assembly/map.xml new file mode 100644 index 0000000..f03fb54 --- /dev/null +++ b/observe-swing/src/main/assembly/map.xml @@ -0,0 +1,20 @@ +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> + <id>maps</id> + <formats> + <format>zip</format> + </formats> + + <fileSets> + + <fileSet> + <directory>src/main/map</directory> + <outputDirectory/> + <fileMode>0755</fileMode> + <includes> + <include>**/*</include> + </includes> + </fileSet> + + </fileSets> +</assembly> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit b194eb2bdb990babb92f0b9df769e16f87e55ad1 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 20 19:49:39 2015 +0200 refs #6944 copie des resources de cartographie --- .../main/java/fr/ird/observe/IObserveConfig.java | 2 ++ .../java/fr/ird/observe/ObserveConfigOption.java | 11 ++++++++++ .../fr/ird/observe/ObserveResourceManager.java | 25 +++++++++++++++++----- .../main/java/fr/ird/observe/ObserveRunner.java | 9 +++++--- 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/observe-business/src/main/java/fr/ird/observe/IObserveConfig.java b/observe-business/src/main/java/fr/ird/observe/IObserveConfig.java index c002ee5..5d9dc7a 100644 --- a/observe-business/src/main/java/fr/ird/observe/IObserveConfig.java +++ b/observe-business/src/main/java/fr/ird/observe/IObserveConfig.java @@ -155,6 +155,8 @@ public interface IObserveConfig { String PROPERTY_REPORT_DIRECTORY = "reportDirectory"; + String PROPERTY_MAP_DIRECTORY = "mapDirectory"; + String PROPERTY_TMP_DIRECTORY = "tmpDirectory"; String PROPERTY_DISPLAY_MAIN_UI = "displayMainUI"; diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java index c89cd3a..764b913 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java @@ -142,6 +142,17 @@ public enum ObserveConfigOption implements ConfigOptionDef { false ), + /** le repertoire ou sont stockees les cartes de l'utilisateur */ + MAP_DIRECTORY( + "map.directory", + IObserveConfig.PROPERTY_MAP_DIRECTORY, + n("observe.config.defaultMapDirectory.description"), + "${resources.directory}/map", + File.class, + false, + false + ), + /** le repertoire ou sont stockees les reports de validation de l'utilisateur */ VALIDATION_REPORT_DIRECTORY( "validation.report.directory", diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java b/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java index b6f8403..95c955f 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveResourceManager.java @@ -25,6 +25,7 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.SortedProperties; +import org.nuiton.util.ZipUtil; import java.io.BufferedInputStream; import java.io.File; @@ -61,8 +62,8 @@ public class ObserveResourceManager { public static final String OBSERVE_MAP_BACKGROUND = "/shapefiles/backgroundes/background.shp"; - public static final String OBSERVE_MAP_LAYERS = - "/shapeFiles"; + public static final String OBSERVE_MAP_ARCHIVE = + "/map.zip"; /** Logger */ static private Log log = LogFactory.getLog(ObserveResourceManager.class); @@ -72,7 +73,7 @@ public class ObserveResourceManager { ui(OBSERVE_UI_PROPERTIES), application(OBSERVE_APPLICATION_PROPERTIES), report(OBSERVE_REPORTS_PROPERTIES), - mapLayers(OBSERVE_MAP_LAYERS); + mapLayers(OBSERVE_MAP_ARCHIVE); private final String location; @@ -103,7 +104,6 @@ public class ObserveResourceManager { protected Map<String, Properties> resources; - public Map<String, Properties> getResources() { if (resources == null) { resources = new TreeMap<String, Properties>(); @@ -111,6 +111,7 @@ public class ObserveResourceManager { return resources; } + public Properties getResource(Resource resource) throws IOException { URL url = resource.getUrl(); @@ -118,7 +119,6 @@ public class ObserveResourceManager { return result; } - public Properties getResource(File file) throws IOException { URL url = file.toURI().toURL(); @@ -128,6 +128,7 @@ public class ObserveResourceManager { return result; } + public Properties getResource(URL url) throws IOException { String path = url.toString(); @@ -309,4 +310,18 @@ public class ObserveResourceManager { } } + public File unzipToDirectory(Resource resource, ObserveConfig config, ObserveConfigOption option, String message) throws IOException { + + File dir = config.getOptionAsFile(option.key); + createDirectory(dir); + InputStream inputStream = openInternalStream(resource.getUrl()); + try { + ZipUtil.uncompress(inputStream, dir); + return dir; + } finally { + inputStream.close(); + + } + } + } diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java b/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java index 432f4a2..68a2118 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveRunner.java @@ -60,6 +60,7 @@ import static fr.ird.observe.ObserveConfigOption.DATA_DIRECTORY; import static fr.ird.observe.ObserveConfigOption.DB_DIRECTORY; import static fr.ird.observe.ObserveConfigOption.INITIAL_DB_DUMP; import static fr.ird.observe.ObserveConfigOption.REPORT_DIRECTORY; +import static fr.ird.observe.ObserveConfigOption.MAP_DIRECTORY; import static fr.ird.observe.ObserveConfigOption.RESOURCES_DIRECTORY; import static fr.ird.observe.ObserveConfigOption.TMP_DIRECTORY; import static fr.ird.observe.ObserveConfigOption.VALIDATION_REPORT_DIRECTORY; @@ -461,9 +462,11 @@ public abstract class ObserveRunner extends ApplicationRunner { // 9 - resources shapeFiles -// String message = t("observe.runner.copy.default.report.file", eezShapeFile); -// -// resourceManager.copyDirectory(Resource.mapLayers, config, RESOURCES_DIRECTORY, massage); + File mapdirectory = resourceManager.createDirectory(config, MAP_DIRECTORY); + + String message = t("observe.runner.copy.default.map.file", mapdirectory); + + resourceManager.unzipToDirectory(Resource.mapLayers, config, RESOURCES_DIRECTORY, message); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 63a95fedd95bd195742422c5f12d87383d559f90 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Apr 20 10:33:20 2015 +0200 fix zoom NPE --- .../ui/content/open/impl/seine/TripMapHandler.java | 75 +++++++++++++++++----- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java index ca8a3f8..b879b57 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java @@ -42,9 +42,12 @@ import org.geotools.styling.StyledLayer; import org.geotools.styling.StyledLayerDescriptor; import org.geotools.styling.UserLayer; import org.geotools.swing.JMapPane; +import org.geotools.swing.event.MapPaneEvent; +import org.geotools.swing.event.MapPaneListener; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; +import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; @@ -77,6 +80,8 @@ public class TripMapHandler { protected ReferencedEnvelope tripArea; protected List<TripMapPoint> tripMapPoints; + protected boolean rendererRunning; + public TripMapHandler(JMapPane tripMapUI, ObserveConfig config) { this.tripMapUI = tripMapUI; this.config = config; @@ -87,6 +92,8 @@ public class TripMapHandler { tripMapUI.addMouseWheelListener(mouseMapListener); tripMapUI.addMouseMotionListener(mouseMapListener); tripMapUI.addMouseListener(mouseMapListener); + tripMapUI.addMapPaneListener(new TripMapListener()); + rendererRunning = false; } @@ -325,21 +332,20 @@ public class TripMapHandler { } + protected double zoomRatio = 1; + protected Point zoomCenter; - private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener { - - @Override - public void mouseWheelMoved(MouseWheelEvent e) { - int notches = e.getWheelRotation(); - + protected void zoomApply() { + if (zoomRatio != 1 && ! rendererRunning) { ReferencedEnvelope displayArea = tripMapUI.getDisplayArea(); - double deltaWidth = displayArea.getWidth() * notches * ZOOM_STEP_RATIO * -1; - double deltaHeight = displayArea.getHeight() * notches * ZOOM_STEP_RATIO * -1; - double ratioLeft = e.getX() * 1d / tripMapUI.getWidth(); + double deltaWidth = displayArea.getWidth() * (zoomRatio -1); + double deltaHeight = displayArea.getHeight() * (zoomRatio - 1); + + double ratioLeft = zoomCenter.getX() * 1d / tripMapUI.getWidth(); // l'axe de Y est inversé entre le référentiel du composant swing et le référentiel géographique - double ratioTop = 1 - (e.getY() * 1d / tripMapUI.getHeight()); + double ratioTop = 1 - (zoomCenter.getY() * 1d / tripMapUI.getHeight()); double deltaLeft = deltaWidth * ratioLeft; double deltaRight = deltaLeft - deltaWidth; @@ -348,8 +354,8 @@ public class TripMapHandler { double deltaBottom = deltaTop - deltaHeight; if (log.isDebugEnabled()) { - log.debug(String.format("Map mouse zoom (rotation : %s, deltaLeft : %s, deltaRight : %s, deltaTop : %s, deltaBottom : %s)", - notches, deltaLeft, deltaRight, deltaRight, deltaBottom)); + log.debug(String.format("Map mouse zoom (zoom ratio : %s, deltaLeft : %s, deltaRight : %s, deltaTop : %s, deltaBottom : %s)", + zoomRatio, deltaLeft, deltaRight, deltaRight, deltaBottom)); } ReferencedEnvelope newDisplayArea = new ReferencedEnvelope( @@ -360,9 +366,27 @@ public class TripMapHandler { displayArea.getCoordinateReferenceSystem() ); - if (! newDisplayArea.isEmpty()) { - tripMapUI.setDisplayArea(newDisplayArea); - } + tripMapUI.setDisplayArea(newDisplayArea); + + zoomRatio = 1; + + + } + + + } + + + + + private class MouseMapListener implements MouseWheelListener, MouseListener, MouseMotionListener { + + @Override + public void mouseWheelMoved(MouseWheelEvent e) { + int notches = e.getWheelRotation(); + zoomRatio = zoomRatio * (1 + (ZOOM_STEP_RATIO * notches * -1)); + zoomCenter = e.getPoint(); + zoomApply(); } @Override @@ -427,6 +451,27 @@ public class TripMapHandler { } } + protected class TripMapListener implements MapPaneListener { + @Override + public void onNewMapContent(MapPaneEvent ev) { + } + + @Override + public void onDisplayAreaChanged(MapPaneEvent ev) { + } + + @Override + public void onRenderingStarted(MapPaneEvent ev) { + rendererRunning = true; + } + + @Override + public void onRenderingStopped(MapPaneEvent ev) { + rendererRunning = false; + zoomApply(); + } + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 5afa017db875fa7c3d48ab1f0ec660337ec8c687 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 10:20:21 2015 +0200 add scale mpa and creat jaxx file for map --- .../ui/content/open/impl/seine/TripSeineUI.jaxx | 5 +- .../open/impl/seine/TripSeineUIHandler.java | 17 ++- .../ird/observe/ui/util/tripMap/TripMapScale.java | 133 +++++++++++++++++++++ .../fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx | 45 +++++++ .../tripMap/TripMapUIHandler.java} | 89 +++++++++----- observe-swing/src/main/resources/log4j.properties | 2 +- 6 files changed, 250 insertions(+), 41 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx index d63894c..b380f98 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.jaxx @@ -32,6 +32,7 @@ fr.ird.observe.entities.referentiel.Vessels fr.ird.observe.entities.referentiel.Person fr.ird.observe.entities.referentiel.Ocean + fr.ird.observe.ui.util.tripMap.TripMapUI org.jdesktop.swingx.JXDatePicker @@ -45,8 +46,6 @@ static fr.ird.observe.ui.UIHelper.getStringValue static org.apache.commons.lang3.StringUtils.isEmpty static org.nuiton.i18n.I18n.n - - org.geotools.swing.JMapPane </import> <!-- handler --> @@ -239,7 +238,7 @@ protected boolean canEditOcean(java.util.List<Route> routes) { </Table> </tab> <tab id="mapTab"> - <JMapPane id='tripMap'/> + <TripMapUI id="tripMap"/> </tab> </JTabbedPane> </JPanel> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 180233f..ad8d6c7 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -34,9 +34,9 @@ import fr.ird.observe.entities.seine.TripSeine; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.content.open.ContentOpenableUIModel; +import fr.ird.observe.ui.util.tripMap.TripMapUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.geotools.swing.JMapPane; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.persistence.TopiaDAO; @@ -61,8 +61,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { /** Logger */ static private final Log log = LogFactory.getLog(TripSeineUIHandler.class); - protected TripMapHandler tripMapHandler; - public TripSeineUIHandler(TripSeineUI ui) { super(ui, DataContextType.Program, @@ -142,21 +140,20 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } - JMapPane tripMap = getUi().getTripMap(); + TripSeineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); ObserveConfig config = ui.getContextValue(ObserveConfig.class); - tripMapHandler = new TripMapHandler(tripMap, config); - - - + tripMap.getHandler().setConfig(config); getUi().getTripSeineTabPane().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); TripSeineUI ui = getUi(); - if (tripSeineTabPane.getSelectedComponent() == ui.getTripMap()) { - tripMapHandler.doOpenMap(ui.getDataService(), ui.getDataSource(), tripId); + TripMapUI tripMap = ui.getTripMap(); + if (tripSeineTabPane.getSelectedComponent() == tripMap) { + tripMap.getHandler().doOpenMap(ui.getDataSource(), ui.getDataService(), tripId); } } }); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapScale.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapScale.java new file mode 100644 index 0000000..14db68f --- /dev/null +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapScale.java @@ -0,0 +1,133 @@ +package fr.ird.observe.ui.util.tripMap; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.renderer.lite.RendererUtilities; +import org.geotools.swing.JMapPane; +import org.geotools.swing.event.MapPaneEvent; +import org.geotools.swing.event.MapPaneListener; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import javax.swing.JPanel; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.geom.Rectangle2D; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class TripMapScale extends JPanel implements MapPaneListener{ + + private static final Log log = LogFactory.getLog(TripMapScale.class); + + protected static final int MARGIN_HORIZONTAL_MIN = 10; + + protected static final int SCALE_HEIGHT = 15; + + protected int scaleWidth; + + protected String labelScaleUp; + + public TripMapScale() { + labelScaleUp = "0 m"; + scaleWidth = 100; + Dimension size = new Dimension(200, 50); + setMinimumSize(size); + setPreferredSize(size); + setBackground(Color.WHITE); + } + + @Override + public void onNewMapContent(MapPaneEvent ev) { + } + + @Override + public void onDisplayAreaChanged(MapPaneEvent ev) { + JMapPane jMapPane = (JMapPane) ev.getSource(); + ReferencedEnvelope displayArea = jMapPane.getDisplayArea(); + CoordinateReferenceSystem crs = jMapPane.getMapContent().getCoordinateReferenceSystem(); + int width = jMapPane.getWidth(); + int height = jMapPane.getHeight(); + double dpi = 2.54 / 100; // pour avoir l'echélle en metre/pixel + + try { + double meterPerPixel = RendererUtilities.calculateScale(displayArea, width, height, dpi); + + double maxWidthMeter = (getWidth() - 2 * MARGIN_HORIZONTAL_MIN) * meterPerPixel; + + int nbDigit = (int) Math.floor(Math.log10(maxWidthMeter)); + + int firstDigit = (int) Math.floor(maxWidthMeter / Math.pow(10, nbDigit)); // le premier chiffre significatif + + int useFirstDigit; + + if (firstDigit >= 5) { + useFirstDigit = 5; + } else if (firstDigit >= 2) { + useFirstDigit = 2; + } else { + useFirstDigit = 1; + } + + long scalUpInMeter = useFirstDigit * (long) Math.pow(10, nbDigit); + + scaleWidth = (int) Math.round(scalUpInMeter / meterPerPixel); + + if (nbDigit >= 3) { + labelScaleUp = String.format("%,d km", scalUpInMeter / 1000); + } else { + labelScaleUp = String.format("%,d m", scalUpInMeter); + } + + repaint(); + + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("error", e); + } + } + + } + + @Override + public void onRenderingStarted(MapPaneEvent ev) { + } + + @Override + public void onRenderingStopped(MapPaneEvent ev) { + } + + + + @Override + public void paint(Graphics graphics) { + + super.paint(graphics); + + graphics.setColor(Color.BLACK); + + FontMetrics fm = graphics.getFontMetrics(); + + Rectangle2D textArea = fm.getStringBounds(labelScaleUp, graphics); + + int interLine = (getHeight() - (int)textArea.getHeight() - SCALE_HEIGHT) / 3; + + int labelScaleMargin = (getWidth() - (int) textArea.getWidth()) / 2; + + graphics.drawString(labelScaleUp, labelScaleMargin, interLine + (int)textArea.getHeight()); + + int scaleMargin = (getWidth() - scaleWidth) / 2; + + int scaleTop = getHeight() - interLine - SCALE_HEIGHT; + + graphics.drawLine(scaleMargin, scaleTop, scaleMargin, scaleTop + SCALE_HEIGHT); + + graphics.drawLine(scaleMargin, scaleTop + SCALE_HEIGHT, scaleMargin + scaleWidth, scaleTop + SCALE_HEIGHT); + + graphics.drawLine(scaleMargin + scaleWidth, scaleTop + SCALE_HEIGHT, scaleMargin + scaleWidth, scaleTop); + + } +} diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx new file mode 100644 index 0000000..7c55000 --- /dev/null +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx @@ -0,0 +1,45 @@ +<JPanel id="tripMap" + layout="{new BorderLayout()}"> + + <import> + fr.ird.observe.DataService + fr.ird.observe.db.DataSource + fr.ird.observe.ObserveConfig + fr.ird.observe.ObserveContext + + org.geotools.swing.JMapPane + fr.ird.observe.ui.util.tripMap.TripMapScale + </import> + + <TripMapUIHandler id='handler' initializer='TripMapUIHandler.newHandler(this)'/> + + <script><![CDATA[ + +void $afterCompleteSetup() { + getHandler().initUI(); +} + +]]> + </script> + + <Table constraints='BorderLayout.WEST' + id='legendTable'> + <row> + <cell columns="2"> + <JPanel/> + </cell> + </row> + + <row> + <cell columns="2"> + <TripMapScale id="mapScale"/> + </cell> + </row> + + </Table> + + <JMapPane id='map' + constraints="BorderLayout.CENTER"/> + + +</JPanel> \ No newline at end of file diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java similarity index 89% rename from observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java rename to observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index b879b57..03d236b 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripMapHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -1,4 +1,4 @@ -package fr.ird.observe.ui.content.open.impl.seine; +package fr.ird.observe.ui.util.tripMap; import com.google.common.base.Function; import com.google.common.base.Optional; @@ -64,52 +64,69 @@ import java.util.List; /** * @author Sylvain Bavencoff - bavencoff@codelutin.com */ -public class TripMapHandler { +public class TripMapUIHandler { public static final String TRIP_LINES_LAYER_NAME = "Trip lines"; public static final String TRIP_POINTS_LAYER_NAME = "Trip points"; public static final double ZOOM_STEP_RATIO = 0.1; + public static TripMapUIHandler newHandler(TripMapUI view) { + return new TripMapUIHandler(view); + } + private static final Log log = LogFactory.getLog(TripMapUIHandler.class); - private static final Log log = LogFactory.getLog(TripMapHandler.class); + protected TripMapUI view; - protected JMapPane tripMapUI; - protected ObserveConfig config; + private ObserveConfig config; protected MapContent mapContent; protected ReferencedEnvelope tripArea; protected List<TripMapPoint> tripMapPoints; protected boolean rendererRunning; - public TripMapHandler(JMapPane tripMapUI, ObserveConfig config) { - this.tripMapUI = tripMapUI; - this.config = config; + public TripMapUIHandler(TripMapUI view) { + this.view = view; + } + + public void initUI() { - tripMapUI.setBackground(config.getMapBackgroundColor()); + JMapPane mapPane = view.getMap(); MouseMapListener mouseMapListener = new MouseMapListener(); - tripMapUI.addMouseWheelListener(mouseMapListener); - tripMapUI.addMouseMotionListener(mouseMapListener); - tripMapUI.addMouseListener(mouseMapListener); - tripMapUI.addMapPaneListener(new TripMapListener()); + mapPane.addMouseWheelListener(mouseMapListener); + mapPane.addMouseMotionListener(mouseMapListener); + mapPane.addMouseListener(mouseMapListener); + mapPane.addMapPaneListener(new TripMapListener()); + mapPane.addMapPaneListener(view.getMapScale()); rendererRunning = false; } - public void doOpenMap(DataService dataService, DataSource source, String tripId) { + public void setConfig(ObserveConfig config) { + this.config = config; + + JMapPane mapPane = view.getMap(); + mapPane.setBackground(config.getMapBackgroundColor()); + } + + - getTipMapPoints(dataService, source, tripId); + public void doOpenMap(DataSource dataSource, DataService dataService, String tripId) { - tripMapUI.setMapContent(getMapContent()); - tripMapUI.setDisplayArea(tripArea); + getTipMapPoints(dataSource, dataService, tripId); + + JMapPane mapPane = view.getMap(); + mapPane.setMapContent(getMapContent()); + mapPane.setDisplayArea(tripArea); } - protected List<TripMapPoint> getTipMapPoints(DataService dataService, DataSource source, String tripId) { + protected List<TripMapPoint> getTipMapPoints(DataSource dataSource, DataService dataService, String tripId) { if (tripMapPoints == null) { + try { - tripMapPoints = dataService.loadTripMapActivityPoints(source, tripId); + tripMapPoints = dataService.loadTripMapActivityPoints(dataSource, tripId); } catch (DataSourceException e) { if (log.isErrorEnabled()) { log.error("error in loadTripMapActivityPoints", e); @@ -128,7 +145,6 @@ public class TripMapHandler { StyledLayerDescriptor styledLayerDescriptor = importStyledLayerDescriptor(); - for (File layerFile : config.getMapLayerFiles()) { FileDataStore store = FileDataStoreFinder.getDataStore(layerFile); SimpleFeatureSource featureSource = store.getFeatureSource(); @@ -203,6 +219,7 @@ public class TripMapHandler { Style styleLines = findStyle(styledLayerDescriptor, TRIP_LINES_LAYER_NAME, null); Layer layerLines = new FeatureLayer(linesFeatures, styleLines); + mapContent.addLayer(layerLines); @@ -263,7 +280,9 @@ public class TripMapHandler { } protected StyledLayerDescriptor importStyledLayerDescriptor() throws FileNotFoundException { + File styleFile = config.getMapStyleFile(); + StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null); SLDParser stylereader = new SLDParser(styleFactory, styleFile); @@ -337,15 +356,18 @@ public class TripMapHandler { protected void zoomApply() { if (zoomRatio != 1 && ! rendererRunning) { - ReferencedEnvelope displayArea = tripMapUI.getDisplayArea(); + + JMapPane mapPane = view.getMap(); + + ReferencedEnvelope displayArea = mapPane.getDisplayArea(); double deltaWidth = displayArea.getWidth() * (zoomRatio -1); double deltaHeight = displayArea.getHeight() * (zoomRatio - 1); - double ratioLeft = zoomCenter.getX() * 1d / tripMapUI.getWidth(); + double ratioLeft = zoomCenter.getX() * 1d / mapPane.getWidth(); // l'axe de Y est inversé entre le référentiel du composant swing et le référentiel géographique - double ratioTop = 1 - (zoomCenter.getY() * 1d / tripMapUI.getHeight()); + double ratioTop = 1 - (zoomCenter.getY() * 1d / mapPane.getHeight()); double deltaLeft = deltaWidth * ratioLeft; double deltaRight = deltaLeft - deltaWidth; @@ -366,7 +388,7 @@ public class TripMapHandler { displayArea.getCoordinateReferenceSystem() ); - tripMapUI.setDisplayArea(newDisplayArea); + mapPane.setDisplayArea(newDisplayArea); zoomRatio = 1; @@ -429,22 +451,35 @@ public class TripMapHandler { } protected void startMove(Point2D startPointInScreen) { - startDisplayArea = tripMapUI.getDisplayArea(); - startScreenToWorldTransform = tripMapUI.getScreenToWorldTransform(); + JMapPane mapPane = view.getMap(); + + startDisplayArea = mapPane.getDisplayArea(); + + startScreenToWorldTransform = mapPane.getScreenToWorldTransform(); + startPointInWorld = new Point2D.Double(); + startScreenToWorldTransform.transform(startPointInScreen, startPointInWorld); + } protected void endMove(Point2D endPointInScreen) { + Point2D endPointInWorld = new Point2D.Double(); + startScreenToWorldTransform.transform(endPointInScreen, endPointInWorld); + double transX = startPointInWorld.getX() - endPointInWorld.getX(); double transY = startPointInWorld.getY() - endPointInWorld.getY(); ReferencedEnvelope endDisplayArea = new ReferencedEnvelope(startDisplayArea); + endDisplayArea.translate(transX, transY); - tripMapUI.setDisplayArea(endDisplayArea); + JMapPane mapPane = view.getMap(); + + mapPane.setDisplayArea(endDisplayArea); + if (log.isDebugEnabled()) { log.debug(String.format("Translate (x : %s, y : %s)", transX, transY)); } diff --git a/observe-swing/src/main/resources/log4j.properties b/observe-swing/src/main/resources/log4j.properties index 8a5bc1e..5542ef3 100644 --- a/observe-swing/src/main/resources/log4j.properties +++ b/observe-swing/src/main/resources/log4j.properties @@ -51,4 +51,4 @@ log4j.logger.org.nuiton.topia.migration=INFO log4j.logger.jaxx.runtime.validator.swing.SwingValidator=ERROR -log4j.logger.fr.ird.observe.ui.content.open.impl.seine.TripMapHandler=DEBUG +log4j.logger.fr.ird.observe.ui.util.tripMap.TripMapHandler=DEBUG -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit a21882bda10d8894562813f8cbabaeae1db49754 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 10:33:51 2015 +0200 fix default values map options --- .../src/main/java/fr/ird/observe/ObserveConfigOption.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java index 764b913..6770ed8 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java +++ b/observe-swing/src/main/java/fr/ird/observe/ObserveConfigOption.java @@ -641,7 +641,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_1( "map.layer1.path", n("observe.config.map.layer1.description"), - "${user.home}/.observe/map/shapeFiles/continents/GSHHS_l_L1.shp", + "${resources.directory}/map/shapeFiles/continents/GSHHS_l_L1.shp", File.class, false, false @@ -650,7 +650,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_2( "map.layer2.path", n("observe.config.map.layer2.description"), - "${user.home}/.observe/map/shapeFiles/continents/GSHHS_l_L6.shp", + "${resources.directory}/map/shapeFiles/continents/GSHHS_l_L6.shp", File.class, false, false @@ -659,7 +659,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_3( "map.layer3.path", n("observe.config.map.layer3.description"), - "${user.home}/.observe/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp", + "${resources.directory}/map/shapeFiles/lakesAndSeas/GSHHS_l_L2.shp", File.class, false, false @@ -668,7 +668,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_4( "map.layer4.path", n("observe.config.map.layer4.description"), - "${user.home}/.observe/map/shapeFiles/borders/WDBII_border_l_L1.shp", + "${resources.directory}/map/shapeFiles/borders/WDBII_border_l_L1.shp", File.class, false, false @@ -677,7 +677,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_LAYER_5( "map.layer5.path", n("observe.config.map.layer5.description"), - "${user.home}/.observe/map/shapeFiles/zee/World_EEZ_v8_2014.shp", + "${resources.directory}/map/shapeFiles/zee/World_EEZ_v8_2014.shp", File.class, false, false @@ -731,7 +731,7 @@ public enum ObserveConfigOption implements ConfigOptionDef { MAP_STYLE_FILE( "map.style.path", n("observe.config.map.style.description"), - "${user.home}/.observe/map/style.xml", + "${resources.directory}/map/style.xml", File.class, false, false); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 2817f7b6febc30f148fecdf89feda8a24d71aa84 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 16:18:29 2015 +0200 move scale in map and add compass --- .../observe/ui/util/tripMap/ObserveMapPane.java | 221 +++++++++++++++++++++ .../ird/observe/ui/util/tripMap/TripMapScale.java | 133 ------------- .../fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx | 19 +- .../observe/ui/util/tripMap/TripMapUIHandler.java | 1 - .../resources/i18n/observe-swing_en_GB.properties | 5 + .../resources/i18n/observe-swing_es_ES.properties | 5 + .../resources/i18n/observe-swing_fr_FR.properties | 5 + 7 files changed, 238 insertions(+), 151 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java new file mode 100644 index 0000000..62578c4 --- /dev/null +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java @@ -0,0 +1,221 @@ +package fr.ird.observe.ui.util.tripMap; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.renderer.lite.RendererUtilities; +import org.geotools.swing.JMapPane; +import org.geotools.swing.event.MapPaneAdapter; +import org.geotools.swing.event.MapPaneEvent; + +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +import static org.nuiton.i18n.I18n.t; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class ObserveMapPane extends JMapPane { + + private static final Log log = LogFactory.getLog(ObserveMapPane.class); + + protected static final int MARGIN = 10; + + protected static final int SCALE_HEIGHT = 15; + protected static final int SCALE_WIDTH_MAX = 200; + + protected static final int METERS_BY_MILES = 1852; + + protected int scaleWidth; + + protected String labelScaleUp; + + protected double rotation; + + public ObserveMapPane() { + labelScaleUp = "0 m"; + scaleWidth = 100; + rotation = 0; + addMapPaneListener(new MapPaneAdapter() { + @Override + public void onDisplayAreaChanged(MapPaneEvent ev) { + updateScale(); + } + }); + + + } + + + protected void updateScale() { + ReferencedEnvelope displayArea = getDisplayArea(); + double dpi = 2.54 / 100; // pour avoir l'echélle en metre/pixel + + try { + double meterPerPixel = RendererUtilities.calculateScale(displayArea, getWidth(), getHeight(), dpi); + + double maxWidthMeter = SCALE_WIDTH_MAX * meterPerPixel; + + double maxWidthMiles = maxWidthMeter / METERS_BY_MILES; + + int nbDigit = (int) Math.floor(Math.log10(maxWidthMiles)); + + int firstDigit = (int) Math.floor(maxWidthMiles / Math.pow(10, nbDigit)); // le premier chiffre significatif + + int useFirstDigit; + + if (firstDigit >= 5) { + useFirstDigit = 5; + } else if (firstDigit >= 2) { + useFirstDigit = 2; + } else { + useFirstDigit = 1; + } + + long scaleInMiles = useFirstDigit * (long) Math.pow(10, nbDigit); + + scaleWidth = (int) Math.round(scaleInMiles * METERS_BY_MILES / meterPerPixel); + + labelScaleUp = String.format("%,d " + t("observe.map.miles"), scaleInMiles); + + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("error", e); + } + } + } + + protected void paintScale(Graphics graphics) { + graphics.setColor(Color.BLACK); + + FontMetrics fm = graphics.getFontMetrics(); + + Rectangle2D textArea = fm.getStringBounds(labelScaleUp, graphics); + + int labelLeft = getWidth() - MARGIN * 2 - scaleWidth - (int) textArea.getWidth(); + + graphics.drawString(labelScaleUp, labelLeft, getHeight() - MARGIN); + + int scalesEndX = getWidth() - MARGIN; + + int scaleStartX = scalesEndX - scaleWidth; + + int scalesEndY = getHeight() - MARGIN; + + int scaleStartY = scalesEndY - SCALE_HEIGHT; + + graphics.drawLine(scaleStartX, scaleStartY, scaleStartX, scalesEndY); + graphics.drawLine(scaleStartX, scalesEndY, scalesEndX, scalesEndY); + graphics.drawLine(scalesEndX, scalesEndY, scalesEndX, scaleStartY); + + } + + protected static int AXIS_LENGHT = 30; + protected static int CIRCLE_RADIUS = 20; + protected static int CENTER_MARGIN = 60; + protected static int INTER_AXIS_TEXT = 3; + + + protected void paintCompass(Graphics graphics) { + + Point center = new Point(getWidth() - CENTER_MARGIN, CENTER_MARGIN); + + graphics.drawOval( + center.x - CIRCLE_RADIUS, + center.y - CIRCLE_RADIUS, + CIRCLE_RADIUS * 2, + CIRCLE_RADIUS * 2); + + FontMetrics fm = graphics.getFontMetrics(); + + for (CardinalPoint cardinalPoint : CardinalPoint.values()) { + + Point2D direction = cardinalPoint.getDirection(rotation, AXIS_LENGHT, center); + + graphics.drawLine(center.x, center.y, (int)direction.getX(), (int) direction.getY()); + + Rectangle2D textArea = fm.getStringBounds(cardinalPoint.getLabel(), graphics); + + // on cherche la ditance entre le centre du text et sa bordure dans le direction donné + double l = cardinalPoint.distanceCenterBorder(rotation, textArea); + + Point2D textCenter = cardinalPoint.getDirection(rotation, AXIS_LENGHT + INTER_AXIS_TEXT + l, center); + + graphics.drawString( + cardinalPoint.getLabel(), + (int) (textCenter.getX() - textArea.getWidth() / 2), + (int) (textCenter.getY() + textArea.getHeight() / 2)); + } + + } + + + + @Override + public void paint(Graphics graphics) { + + super.paint(graphics); + + paintScale(graphics); + + paintCompass(graphics); + + } + + protected enum CardinalPoint { + NORTH(-1, 0, 0, -1, t("observe.map.north")), + SOUTH( 1, 0, 0, 1, t("observe.map.south")), + WEST ( 0, -1, 1, 0, t("observe.map.west")), + EST ( 0, 1, -1, 0, t("observe.map.east")); + + protected int matrix00; + protected int matrix01; + protected int matrix10; + protected int matrix11; + protected String label; + + CardinalPoint(int matrix00, int matrix01, int matrix10, int matrix11, String label) { + this.matrix00 = matrix00; + this.matrix01 = matrix01; + this.matrix10 = matrix10; + this.matrix11 = matrix11; + this.label = label; + } + + public Point2D.Double getDirection(double angle, double length, Point center) { + + double x = Math.sin(angle) * length; + double y = Math.cos(angle) * length; + + double deltaX = matrix00 * x + matrix01 * y; + double deltaY = matrix10 * x + matrix11 * y; + Point2D.Double result = new Point2D.Double(center.getX() + deltaX, center.getY() + deltaY); + + return result; + } + + // on cherche la ditance entre le centre du text et sa bordure dans le direction donné + public double distanceCenterBorder(double angle, Rectangle2D textArea) { + + double x = Math.sin(angle); + double y = Math.cos(angle); + + double deltaW = Math.abs(textArea.getWidth() / 2 / (matrix00 * x + matrix01 * y)); + double deltaH = Math.abs(textArea.getHeight() / 2 / (matrix10 * x + matrix11 * y)); + + double delta = Math.min(deltaH, deltaW); + + return delta; + } + + public String getLabel() { + return label; + } + } + +} diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapScale.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapScale.java deleted file mode 100644 index 14db68f..0000000 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapScale.java +++ /dev/null @@ -1,133 +0,0 @@ -package fr.ird.observe.ui.util.tripMap; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.geotools.renderer.lite.RendererUtilities; -import org.geotools.swing.JMapPane; -import org.geotools.swing.event.MapPaneEvent; -import org.geotools.swing.event.MapPaneListener; -import org.opengis.referencing.crs.CoordinateReferenceSystem; - -import javax.swing.JPanel; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.geom.Rectangle2D; - -/** - * @author Sylvain Bavencoff - bavencoff@codelutin.com - */ -public class TripMapScale extends JPanel implements MapPaneListener{ - - private static final Log log = LogFactory.getLog(TripMapScale.class); - - protected static final int MARGIN_HORIZONTAL_MIN = 10; - - protected static final int SCALE_HEIGHT = 15; - - protected int scaleWidth; - - protected String labelScaleUp; - - public TripMapScale() { - labelScaleUp = "0 m"; - scaleWidth = 100; - Dimension size = new Dimension(200, 50); - setMinimumSize(size); - setPreferredSize(size); - setBackground(Color.WHITE); - } - - @Override - public void onNewMapContent(MapPaneEvent ev) { - } - - @Override - public void onDisplayAreaChanged(MapPaneEvent ev) { - JMapPane jMapPane = (JMapPane) ev.getSource(); - ReferencedEnvelope displayArea = jMapPane.getDisplayArea(); - CoordinateReferenceSystem crs = jMapPane.getMapContent().getCoordinateReferenceSystem(); - int width = jMapPane.getWidth(); - int height = jMapPane.getHeight(); - double dpi = 2.54 / 100; // pour avoir l'echélle en metre/pixel - - try { - double meterPerPixel = RendererUtilities.calculateScale(displayArea, width, height, dpi); - - double maxWidthMeter = (getWidth() - 2 * MARGIN_HORIZONTAL_MIN) * meterPerPixel; - - int nbDigit = (int) Math.floor(Math.log10(maxWidthMeter)); - - int firstDigit = (int) Math.floor(maxWidthMeter / Math.pow(10, nbDigit)); // le premier chiffre significatif - - int useFirstDigit; - - if (firstDigit >= 5) { - useFirstDigit = 5; - } else if (firstDigit >= 2) { - useFirstDigit = 2; - } else { - useFirstDigit = 1; - } - - long scalUpInMeter = useFirstDigit * (long) Math.pow(10, nbDigit); - - scaleWidth = (int) Math.round(scalUpInMeter / meterPerPixel); - - if (nbDigit >= 3) { - labelScaleUp = String.format("%,d km", scalUpInMeter / 1000); - } else { - labelScaleUp = String.format("%,d m", scalUpInMeter); - } - - repaint(); - - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("error", e); - } - } - - } - - @Override - public void onRenderingStarted(MapPaneEvent ev) { - } - - @Override - public void onRenderingStopped(MapPaneEvent ev) { - } - - - - @Override - public void paint(Graphics graphics) { - - super.paint(graphics); - - graphics.setColor(Color.BLACK); - - FontMetrics fm = graphics.getFontMetrics(); - - Rectangle2D textArea = fm.getStringBounds(labelScaleUp, graphics); - - int interLine = (getHeight() - (int)textArea.getHeight() - SCALE_HEIGHT) / 3; - - int labelScaleMargin = (getWidth() - (int) textArea.getWidth()) / 2; - - graphics.drawString(labelScaleUp, labelScaleMargin, interLine + (int)textArea.getHeight()); - - int scaleMargin = (getWidth() - scaleWidth) / 2; - - int scaleTop = getHeight() - interLine - SCALE_HEIGHT; - - graphics.drawLine(scaleMargin, scaleTop, scaleMargin, scaleTop + SCALE_HEIGHT); - - graphics.drawLine(scaleMargin, scaleTop + SCALE_HEIGHT, scaleMargin + scaleWidth, scaleTop + SCALE_HEIGHT); - - graphics.drawLine(scaleMargin + scaleWidth, scaleTop + SCALE_HEIGHT, scaleMargin + scaleWidth, scaleTop); - - } -} diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx index 7c55000..73ddb67 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx @@ -7,8 +7,7 @@ fr.ird.observe.ObserveConfig fr.ird.observe.ObserveContext - org.geotools.swing.JMapPane - fr.ird.observe.ui.util.tripMap.TripMapScale + fr.ird.observe.ui.util.tripMap.ObserveMapPane </import> <TripMapUIHandler id='handler' initializer='TripMapUIHandler.newHandler(this)'/> @@ -22,23 +21,9 @@ void $afterCompleteSetup() { ]]> </script> - <Table constraints='BorderLayout.WEST' - id='legendTable'> - <row> - <cell columns="2"> - <JPanel/> - </cell> - </row> - <row> - <cell columns="2"> - <TripMapScale id="mapScale"/> - </cell> - </row> - </Table> - - <JMapPane id='map' + <ObserveMapPane id='map' constraints="BorderLayout.CENTER"/> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index 03d236b..7fa37d0 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -98,7 +98,6 @@ public class TripMapUIHandler { mapPane.addMouseMotionListener(mouseMapListener); mapPane.addMouseListener(mouseMapListener); mapPane.addMapPaneListener(new TripMapListener()); - mapPane.addMapPaneListener(view.getMapScale()); rendererRunning = false; } diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index 9fa197f..dfd012c 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -1264,6 +1264,11 @@ observe.longlineGlobalComposition.tab.hooksComposition=Hooks observe.longlineGlobalComposition.tab.mitigationType=Mitigation observe.longlineGlobalComposition.title=Global composition observe.measurement.delete.message= +observe.map.east= +observe.map.miles= +observe.map.north= +observe.map.south= +observe.map.west= observe.menu.actions=Actions observe.menu.application.locale=Application observe.menu.configuration=Configuration diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 4a9dc4b..6d65e9d 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -1266,6 +1266,11 @@ observe.longlineGlobalComposition.tab.hooksComposition= observe.longlineGlobalComposition.tab.mitigationType= observe.longlineGlobalComposition.title= observe.measurement.delete.message= +observe.map.east= +observe.map.miles= +observe.map.north= +observe.map.south= +observe.map.west= observe.menu.actions=Acciones observe.menu.application.locale=Aplicación observe.menu.configuration=Configuración diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index 793d2bf..181aef6 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -1264,6 +1264,11 @@ observe.longlineGlobalComposition.tab.hooksComposition=Hameçons observe.longlineGlobalComposition.tab.mitigationType=Atténuations observe.longlineGlobalComposition.title=Composition globale de la palangre observe.measurement.delete.message=Supprimer la caractéristique sélectionnée +observe.map.east=Est +observe.map.miles=milles +observe.map.north=Nord +observe.map.south=Sud +observe.map.west=Ouest observe.menu.actions=Actions observe.menu.application.locale=Application observe.menu.configuration=Configuration -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 8d1d0aeb49a23cdddbf759037e47a565b714d043 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 18:05:42 2015 +0200 fix code, hide actions buttons, tab name --- .../ui/content/open/impl/seine/TripSeineUI.css | 4 +- .../open/impl/seine/TripSeineUIHandler.java | 59 ++++++++++++++-------- .../observe/ui/util/tripMap/ObserveMapPane.java | 11 ++-- .../fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx | 6 +-- .../observe/ui/util/tripMap/TripMapUIHandler.java | 49 ++++++++---------- 5 files changed, 69 insertions(+), 60 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css index b1772ef..7d1fa16 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUI.css @@ -31,11 +31,11 @@ NumberEditor { } #generalTab { - title:"observe.tripSeine.tab.general"; + title: {t("observe.tripSeine.tab.general")}; } #mapTab { - title:"observe.tripSeine.tab.map"; + title: {t("observe.tripSeine.tab.map")}; } #model { diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index ad8d6c7..fb467d8 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -45,6 +45,7 @@ import org.nuiton.topia.persistence.util.TopiaEntityBinder; import org.nuiton.util.DateUtil; import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.util.Date; @@ -96,6 +97,44 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } @Override + public void initUI() throws Exception { + super.initUI(); + + TripSeineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + ObserveConfig config = ui.getContextValue(ObserveConfig.class); + + tripMap.getHandler().setConfig(config); + + getUi().getTripSeineTabPane().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); + TripSeineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + if (tripSeineTabPane.getSelectedComponent() == tripMap) { + ui.getActions().setVisible(false); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + TripSeineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + + tripMap.getHandler().doOpenMap(ui.getDataSource(), ui.getDataService(), getSelectedId()); + } + }); + + } else { + ui.getActions().setVisible(true); + } + } + }); + + } + + @Override public void openUI() throws Exception { super.openUI(); @@ -139,26 +178,6 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } } - - TripSeineUI ui = getUi(); - TripMapUI tripMap = ui.getTripMap(); - ObserveConfig config = ui.getContextValue(ObserveConfig.class); - - tripMap.getHandler().setConfig(config); - - getUi().getTripSeineTabPane().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); - TripSeineUI ui = getUi(); - TripMapUI tripMap = ui.getTripMap(); - if (tripSeineTabPane.getSelectedComponent() == tripMap) { - tripMap.getHandler().doOpenMap(ui.getDataSource(), ui.getDataService(), tripId); - } - } - }); - - finalizeOpenUI(mode, create); } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java index 62578c4..a0f8718 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java @@ -15,6 +15,7 @@ import java.awt.Point; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; +import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; /** @@ -168,10 +169,10 @@ public class ObserveMapPane extends JMapPane { } protected enum CardinalPoint { - NORTH(-1, 0, 0, -1, t("observe.map.north")), - SOUTH( 1, 0, 0, 1, t("observe.map.south")), - WEST ( 0, -1, 1, 0, t("observe.map.west")), - EST ( 0, 1, -1, 0, t("observe.map.east")); + NORTH(-1, 0, 0, -1, n("observe.map.north")), + SOUTH( 1, 0, 0, 1, n("observe.map.south")), + WEST ( 0, -1, 1, 0, n("observe.map.west")), + EST ( 0, 1, -1, 0, n("observe.map.east")); protected int matrix00; protected int matrix01; @@ -214,7 +215,7 @@ public class ObserveMapPane extends JMapPane { } public String getLabel() { - return label; + return t(label); } } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx index 73ddb67..8038dfb 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx @@ -2,12 +2,8 @@ layout="{new BorderLayout()}"> <import> - fr.ird.observe.DataService - fr.ird.observe.db.DataSource - fr.ird.observe.ObserveConfig - fr.ird.observe.ObserveContext - fr.ird.observe.ui.util.tripMap.ObserveMapPane + static org.nuiton.i18n.I18n.n </import> <TripMapUIHandler id='handler' initializer='TripMapUIHandler.newHandler(this)'/> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index 7fa37d0..8eb175a 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -11,6 +11,7 @@ import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.MultiPoint; import fr.ird.observe.DataService; import fr.ird.observe.ObserveConfig; +import fr.ird.observe.ObserveTechnicalException; import fr.ird.observe.db.DataSource; import fr.ird.observe.db.DataSourceException; import fr.ird.observe.entities.constants.seine.SchoolType; @@ -79,9 +80,7 @@ public class TripMapUIHandler { protected TripMapUI view; private ObserveConfig config; - protected MapContent mapContent; protected ReferencedEnvelope tripArea; - protected List<TripMapPoint> tripMapPoints; protected boolean rendererRunning; @@ -113,35 +112,33 @@ public class TripMapUIHandler { public void doOpenMap(DataSource dataSource, DataService dataService, String tripId) { - getTipMapPoints(dataSource, dataService, tripId); + List<TripMapPoint> tripMapPoints; + try { + tripMapPoints = dataService.loadTripMapActivityPoints(dataSource, tripId); + } catch (DataSourceException e) { + throw new ObserveTechnicalException("Unable to load trip map activity points", e); + } + + JMapPane mapPane = view.getMap(); + MapContent mapContent = buildMapContent(tripMapPoints); + mapPane.setMapContent(mapContent); + zoomIt(); + } + + public void zoomIt() { JMapPane mapPane = view.getMap(); - mapPane.setMapContent(getMapContent()); mapPane.setDisplayArea(tripArea); } - protected List<TripMapPoint> getTipMapPoints(DataSource dataSource, DataService dataService, String tripId) { - if (tripMapPoints == null) { + protected MapContent buildMapContent(List<TripMapPoint> tripMapPoints) { - try { - tripMapPoints = dataService.loadTripMapActivityPoints(dataSource, tripId); - } catch (DataSourceException e) { - if (log.isErrorEnabled()) { - log.error("error in loadTripMapActivityPoints", e); - } - } - } - return tripMapPoints; - - } + MapContent mapContent = new MapContent(); - public MapContent getMapContent() { - if (/*mapContent == null &&*/ tripMapPoints != null) { + if (tripMapPoints != null) { try { - mapContent = new MapContent(); - StyledLayerDescriptor styledLayerDescriptor = importStyledLayerDescriptor(); for (File layerFile : config.getMapLayerFiles()) { @@ -269,9 +266,7 @@ public class TripMapUIHandler { } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("error in getMapContent", e); - } + throw new ObserveTechnicalException("Unable to build content map", e); } } @@ -339,12 +334,12 @@ public class TripMapUIHandler { } - protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) throws Exception { + protected Style findStyle(StyledLayerDescriptor styledLayerDescriptor, final String layerName, String styleName) { Style style = findStyle(styledLayerDescriptor, layerName, styleName, null); if (style == null) { - throw new Exception(String.format("No style found for layer name '%s' and style name '%s'", layerName, styleName)); + throw new ObserveTechnicalException(String.format("No style found for layer name '%s' and style name '%s'", layerName, styleName)); } return style; @@ -506,6 +501,4 @@ public class TripMapUIHandler { } } - - } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 7d6df90a093a4c980f3a486de52c8b3b47c0342b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Apr 22 14:13:33 2015 +0200 add map in trip long line ui --- .../src/main/java/fr/ird/observe/DataService.java | 24 +- .../entities/longline/TripLonglineDAOImpl.java | 141 ++++++++++ .../observe/entities/seine/TripSeineDAOImpl.java | 18 +- .../java/fr/ird/observe/tripMap/TripMapPoint.java | 12 +- .../fr/ird/observe/tripMap/TripMapPointType.java | 16 ++ .../content/open/impl/longline/TripLonglineUI.css | 8 + .../content/open/impl/longline/TripLonglineUI.jaxx | 286 +++++++++++---------- .../open/impl/longline/TripLonglineUIHandler.java | 44 ++++ .../open/impl/seine/TripSeineUIHandler.java | 2 +- .../observe/ui/util/tripMap/TripMapUIHandler.java | 20 +- observe-swing/src/main/map/style.xml | 8 +- .../resources/i18n/observe-swing_en_GB.properties | 2 + .../resources/i18n/observe-swing_es_ES.properties | 2 + .../resources/i18n/observe-swing_fr_FR.properties | 2 + 14 files changed, 419 insertions(+), 166 deletions(-) diff --git a/observe-business/src/main/java/fr/ird/observe/DataService.java b/observe-business/src/main/java/fr/ird/observe/DataService.java index 12d8774..6c13752 100644 --- a/observe-business/src/main/java/fr/ird/observe/DataService.java +++ b/observe-business/src/main/java/fr/ird/observe/DataService.java @@ -1723,16 +1723,30 @@ public class DataService { String txName = "loadTrip"; TopiaContext tx = beginTransaction(source, txName); + List<TripMapPoint> tripMapPoints; + try { - TripSeineDAO dao = (TripSeineDAO) source.getDAO(tx, TripSeine.class); - List<TripMapPoint> tripMapPoints = dao.extractTripMapActivityPoints(id); - return tripMapPoints; + if (Entities.isSeineId(id)) { + TripSeineDAO dao = (TripSeineDAO) source.getDAO(tx, TripSeine.class); - } catch (Exception e) { + tripMapPoints = dao.extractTripMapActivityPoints(id); + + } else if (Entities.isLonglineId(id)) { + + TripLonglineDAO dao = (TripLonglineDAO) source.getDAO(tx, TripLongline.class); + + tripMapPoints = dao.extractTripMapActivityPoints(id); + + } else { + throw new ObserveTechnicalException(String.format("id '%s' is not seine id or longe line id", id)); + } + + } catch (TopiaException e) { throw new DataSourceException(e, txName); - } finally { + } finally{ closeTransaction(source, tx, txName); } + return tripMapPoints; } diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java b/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java index b5bc612..5fb8b58 100644 --- a/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java +++ b/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java @@ -22,11 +22,15 @@ package fr.ird.observe.entities.longline; * #L% */ +import com.google.common.collect.Lists; import fr.ird.observe.entities.constants.ReferenceLocale; +import fr.ird.observe.entities.referentiel.Harbour; import fr.ird.observe.entities.referentiel.Person; import fr.ird.observe.entities.referentiel.PersonImpl; import fr.ird.observe.entities.referentiel.Vessel; import fr.ird.observe.entities.referentiel.VesselImpl; +import fr.ird.observe.tripMap.TripMapPoint; +import fr.ird.observe.tripMap.TripMapPointType; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaContextImplementor; import org.nuiton.topia.framework.TopiaSQLQuery; @@ -67,6 +71,143 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO } + public List<TripMapPoint> extractTripMapActivityPoints(String tripId) throws TopiaException { + + TripLongline tripLongline = findByTopiaId(tripId); + + List<TripMapPoint> tripMapPoints = Lists.newLinkedList(); + + // add departure harbours + Harbour departureHarbour = tripLongline.getDepartureHarbour(); + if (departureHarbour != null + && departureHarbour.getLatitude() != null + && departureHarbour.getLongitude() != null) { + TripMapPoint departurePoint = new TripMapPoint(); + departurePoint.setTime(tripLongline.getStartDate()); + departurePoint.setLatitude(departureHarbour.getLatitude()); + departurePoint.setLongitude(departureHarbour.getLongitude()); + tripMapPoints.add(departurePoint); + } + + // Add Activities + TripMapActivityPointQuery tripMapActivityPointQuery = new TripMapActivityPointQuery(tripId); + List<List<TripMapPoint>> results = tripMapActivityPointQuery.findMultipleResult(context); + for (List<TripMapPoint> result : results) { + tripMapPoints.addAll(result); + } + + // add landing harbours + Harbour landingHarbour = tripLongline.getLandingHarbour(); + if (landingHarbour != null + && landingHarbour.getLatitude() != null + && landingHarbour.getLongitude() != null) { + TripMapPoint landingPoint = new TripMapPoint(); + landingPoint.setTime(tripLongline.getEndDate()); + landingPoint.setLatitude(landingHarbour.getLatitude()); + landingPoint.setLongitude(landingHarbour.getLongitude()); + tripMapPoints.add(landingPoint); + } + + return tripMapPoints; + } + + private static class TripMapActivityPointQuery extends TopiaSQLQuery<List<TripMapPoint>> { + + private static String SQL = "SELECT" + + " a.timestamp, " + + " a.latitude," + + " a.longitude," + + " s.settingStartTimestamp," + + " s.settingStartLatitude," + + " s.settingStartLongitude," + + " s.settingEndTimestamp," + + " s.settingEndLatitude," + + " s.settingEndLongitude," + + " s.haulingStartTimestamp," + + " s.haulingStartLatitude," + + " s.haulingStartLongitude," + + " s.haulingEndTimestamp," + + " s.haulingEndLatitude," + + " s.haulingEndLongitude" + + " FROM observe_longLine.activity a" + + " LEFT OUTER JOIN observe_longLine.set s" + + " ON s.topiaId = a.set" + + " WHERE a.trip = ?" + + " ORDER BY a.timestamp"; + + protected String tripId; + + public TripMapActivityPointQuery(String tripId) { + this.tripId = tripId; + } + + @Override + protected PreparedStatement prepareQuery(Connection connection) throws SQLException { + PreparedStatement preparedStatement = connection.prepareStatement(SQL); + preparedStatement.setString(1, tripId); + return preparedStatement; + } + + @Override + protected List<TripMapPoint> prepareResult(ResultSet resultSet) throws SQLException { + + List<TripMapPoint> result = Lists.newLinkedList(); + + // activity + TripMapPoint activity = new TripMapPoint(); + activity.setTime(resultSet.getDate(1)); + activity.setLatitude(resultSet.getFloat(2)); + activity.setLongitude(resultSet.getFloat(3)); + activity.setType(TripMapPointType.activity); + result.add(activity); + + // settingStart + if (resultSet.getString(4) != null) { + TripMapPoint settingStart = new TripMapPoint(); + settingStart.setTime(resultSet.getDate(4)); + settingStart.setLatitude(resultSet.getFloat(5)); + settingStart.setLongitude(resultSet.getFloat(6)); + settingStart.setType(TripMapPointType.settingStart); + result.add(settingStart); + } + + // settingEnd + if (resultSet.getString(7) != null) { + TripMapPoint settingEnd = new TripMapPoint(); + settingEnd.setTime(resultSet.getDate(7)); + settingEnd.setLatitude(resultSet.getFloat(8)); + settingEnd.setLongitude(resultSet.getFloat(9)); + settingEnd.setType(TripMapPointType.settingEnd); + result.add(settingEnd); + } + + // haulingStart + if (resultSet.getString(10) != null) { + TripMapPoint haulingStart = new TripMapPoint(); + haulingStart.setTime(resultSet.getDate(10)); + haulingStart.setLatitude(resultSet.getFloat(11)); + haulingStart.setLongitude(resultSet.getFloat(12)); + haulingStart.setType(TripMapPointType.haulingStart); + result.add(haulingStart); + } + + // haulingEnd + if (resultSet.getString(13) != null) { + TripMapPoint haulingEnd = new TripMapPoint(); + haulingEnd.setTime(resultSet.getDate(13)); + haulingEnd.setLatitude(resultSet.getFloat(14)); + haulingEnd.setLongitude(resultSet.getFloat(15)); + haulingEnd.setType(TripMapPointType.haulingEnd); + result.add(haulingEnd); + } + + return result; + } + } + + + + private static class StubSqlQuery<E extends TripLongline> extends TopiaSQLQuery<E> { private final String sql; diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java index 756d3c1..aeda497 100644 --- a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java +++ b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java @@ -30,6 +30,7 @@ import fr.ird.observe.entities.referentiel.PersonImpl; import fr.ird.observe.entities.referentiel.Vessel; import fr.ird.observe.entities.referentiel.VesselImpl; import fr.ird.observe.tripMap.TripMapPoint; +import fr.ird.observe.tripMap.TripMapPointType; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaContextImplementor; import org.nuiton.topia.framework.TopiaSQLQuery; @@ -153,8 +154,21 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< point.setTime(calendar.getTime()); point.setLatitude(resultSet.getFloat(3)); point.setLongitude(resultSet.getFloat(4)); - if (resultSet.getString(5) != null) { - point.setSchoolType(SchoolType.values()[resultSet.getInt(5)]); + if (resultSet.getString(5) == null) { + point.setType(TripMapPointType.activity); + } else { + SchoolType schoolType = SchoolType.values()[resultSet.getInt(5)]; + switch (schoolType) { + case libre: + point.setType(TripMapPointType.schoolLibre); + break; + case objet: + point.setType(TripMapPointType.schoolObjet); + break; + default: + point.setType(TripMapPointType.activity); + } + } return point; diff --git a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPoint.java b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPoint.java index 247240a..9d42b39 100644 --- a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPoint.java +++ b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPoint.java @@ -1,7 +1,5 @@ package fr.ird.observe.tripMap; -import fr.ird.observe.entities.constants.seine.SchoolType; - import java.util.Date; /** @@ -15,7 +13,7 @@ public class TripMapPoint { protected float longitude; - protected SchoolType schoolType; + protected TripMapPointType type; public Date getTime() { return time; @@ -41,11 +39,11 @@ public class TripMapPoint { this.longitude = longitude; } - public SchoolType getSchoolType() { - return schoolType; + public TripMapPointType getType() { + return type; } - public void setSchoolType(SchoolType schoolType) { - this.schoolType = schoolType; + public void setType(TripMapPointType type) { + this.type = type; } } diff --git a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java new file mode 100644 index 0000000..500e7a2 --- /dev/null +++ b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java @@ -0,0 +1,16 @@ +package fr.ird.observe.tripMap; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public enum TripMapPointType { + + activity, + schoolLibre, + schoolObjet, + settingStart, + settingEnd, + haulingStart, + haulingEnd; + +} diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.css b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.css index 703ca5c..7282179 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.css +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.css @@ -26,6 +26,14 @@ NumberEditor { numberPattern:{fr.ird.observe.ui.UIHelper.INT_6_DIGITS_PATTERN}; } +#generalTab { + title: {t("observe.tripLongline.tab.general")}; +} + +#mapTab { + title: {t("observe.tripLongline.tab.map")}; +} + #model { editable:true; modified:{validator.isChanged()}; diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.jaxx index 0dabc54..f011083 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUI.jaxx @@ -37,6 +37,7 @@ fr.ird.observe.entities.referentiel.Ocean fr.ird.observe.entities.referentiel.longline.TripType fr.ird.observe.ui.actions.shared.DeleteDataUIAction + fr.ird.observe.ui.util.tripMap.TripMapUI org.jdesktop.swingx.JXDatePicker @@ -81,145 +82,152 @@ protected boolean canEditOcean(java.util.List<ActivityLongline> activities) { <!-- formulaire --> <JPanel id="body" layout='{new BorderLayout()}'> - <Table fill="both" constraints='BorderLayout.CENTER'> - - <!-- tripType --> - <row> - <cell anchor='west'> - <JLabel id='tripTypeLabel'/> - </cell> - <cell anchor='east'> - <BeanComboBox id='tripType' constructorParams='this' genericType='TripType'/> - </cell> - </row> - - <!-- captain --> - <row> - <cell anchor='west'> - <JLabel id='captainLabel'/> - </cell> - <cell anchor='east'> - <BeanComboBox id='captain' constructorParams='this' genericType='Person'/> - </cell> - </row> - - <!-- observer --> - <row> - <cell anchor='west'> - <JLabel id='observerLabel'/> - </cell> - <cell anchor='east'> - <BeanComboBox id='observer' constructorParams='this' genericType='Person'/> - </cell> - </row> - - <!-- dataEntryOperator --> - <row> - <cell anchor='west'> - <JLabel id='dataEntryOperatorLabel'/> - </cell> - <cell anchor='east'> - <BeanComboBox id='dataEntryOperator' constructorParams='this' genericType='Person'/> - </cell> - </row> - - <!-- vessel --> - <row> - <cell anchor='west'> - <JLabel id='vesselLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='vessel' constructorParams='this' genericType='Vessel'/> - </cell> - </row> - - <!-- ocean (editable uniquement si pas de route saisie) --> - <row> - <cell anchor='west'> - <JLabel id='oceanLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='ocean' genericType='Ocean' constructorParams='this'/> - </cell> - </row> - - <!-- departureHarbour --> - <row> - <cell anchor='west'> - <JLabel id='departureHarbourLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='departureHarbour' genericType='Harbour' constructorParams='this'/> - </cell> - </row> - - <!-- landingHarbour --> - <row> - <cell anchor='west'> - <JLabel id='landingHarbourLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <BeanComboBox id='landingHarbour' genericType='Harbour' constructorParams='this'/> - </cell> - </row> - - <!-- homeId --> - <row> - - <cell anchor='west'> - <JLabel id='homeIdLabel'/> - </cell> - <cell anchor='east' weightx="1" fill="both"> - <JPanel layout='{new BorderLayout()}'> - <JToolBar id='homeIdToolbar' constraints='BorderLayout.WEST'> - <JButton id='resetHomeId' styleClass='resetButton'/> - </JToolBar> - <JTextField id='homeId' constraints='BorderLayout.CENTER'/> - </JPanel> - </cell> - </row> - - <!-- totalFishingOperationsNumber --> - <row> - <cell anchor='west'> - <JLabel id='totalFishingOperationsNumberLabel'/> - </cell> - <cell anchor='west' weightx="0.5"> - <NumberEditor id='totalFishingOperationsNumber' constructorParams='this'/> - </cell> - </row> - - <!-- startDate --> - <row> - <cell anchor='west'> - <JLabel id='startDateLabel'/> - </cell> - <cell anchor='west' weightx="0.5"> - <JXDatePicker id='startDate'/> - </cell> - </row> - - <!-- endDate --> - <row> - <cell anchor='west'> - <JLabel id='endDateLabel'/> - </cell> - <cell anchor='west' weightx="0.5"> - <JXDatePicker id='endDate'/> - </cell> - </row> - - <!-- comment --> - <row> - <cell columns='2' fill='both' weighty="1"> - <JScrollPane id='comment' - onFocusGained='comment2.requestFocus()'> - <JTextArea id='comment2' - onKeyReleased='getModel().getBean().setComment(comment2.getText())'/> - </JScrollPane> - </cell> - </row> - </Table> + <JTabbedPane id='tripLonglineTabPane' constraints='BorderLayout.CENTER'> + <tab id='generalTab'> + <Table fill="both"> + + <!-- tripType --> + <row> + <cell anchor='west'> + <JLabel id='tripTypeLabel'/> + </cell> + <cell anchor='east'> + <BeanComboBox id='tripType' constructorParams='this' genericType='TripType'/> + </cell> + </row> + + <!-- captain --> + <row> + <cell anchor='west'> + <JLabel id='captainLabel'/> + </cell> + <cell anchor='east'> + <BeanComboBox id='captain' constructorParams='this' genericType='Person'/> + </cell> + </row> + + <!-- observer --> + <row> + <cell anchor='west'> + <JLabel id='observerLabel'/> + </cell> + <cell anchor='east'> + <BeanComboBox id='observer' constructorParams='this' genericType='Person'/> + </cell> + </row> + + <!-- dataEntryOperator --> + <row> + <cell anchor='west'> + <JLabel id='dataEntryOperatorLabel'/> + </cell> + <cell anchor='east'> + <BeanComboBox id='dataEntryOperator' constructorParams='this' genericType='Person'/> + </cell> + </row> + + <!-- vessel --> + <row> + <cell anchor='west'> + <JLabel id='vesselLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='vessel' constructorParams='this' genericType='Vessel'/> + </cell> + </row> + + <!-- ocean (editable uniquement si pas de route saisie) --> + <row> + <cell anchor='west'> + <JLabel id='oceanLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='ocean' genericType='Ocean' constructorParams='this'/> + </cell> + </row> + + <!-- departureHarbour --> + <row> + <cell anchor='west'> + <JLabel id='departureHarbourLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='departureHarbour' genericType='Harbour' constructorParams='this'/> + </cell> + </row> + + <!-- landingHarbour --> + <row> + <cell anchor='west'> + <JLabel id='landingHarbourLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <BeanComboBox id='landingHarbour' genericType='Harbour' constructorParams='this'/> + </cell> + </row> + + <!-- homeId --> + <row> + + <cell anchor='west'> + <JLabel id='homeIdLabel'/> + </cell> + <cell anchor='east' weightx="1" fill="both"> + <JPanel layout='{new BorderLayout()}'> + <JToolBar id='homeIdToolbar' constraints='BorderLayout.WEST'> + <JButton id='resetHomeId' styleClass='resetButton'/> + </JToolBar> + <JTextField id='homeId' constraints='BorderLayout.CENTER'/> + </JPanel> + </cell> + </row> + + <!-- totalFishingOperationsNumber --> + <row> + <cell anchor='west'> + <JLabel id='totalFishingOperationsNumberLabel'/> + </cell> + <cell anchor='west' weightx="0.5"> + <NumberEditor id='totalFishingOperationsNumber' constructorParams='this'/> + </cell> + </row> + + <!-- startDate --> + <row> + <cell anchor='west'> + <JLabel id='startDateLabel'/> + </cell> + <cell anchor='west' weightx="0.5"> + <JXDatePicker id='startDate'/> + </cell> + </row> + + <!-- endDate --> + <row> + <cell anchor='west'> + <JLabel id='endDateLabel'/> + </cell> + <cell anchor='west' weightx="0.5"> + <JXDatePicker id='endDate'/> + </cell> + </row> + + <!-- comment --> + <row> + <cell columns='2' fill='both' weighty="1"> + <JScrollPane id='comment' + onFocusGained='comment2.requestFocus()'> + <JTextArea id='comment2' + onKeyReleased='getModel().getBean().setComment(comment2.getText())'/> + </JScrollPane> + </cell> + </row> + </Table> + </tab> + <tab id="mapTab"> + <TripMapUI id="tripMap"/> + </tab> + </JTabbedPane> </JPanel> <!-- surcharge des actions (pour appliquer la css specifique) --> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java index f8cfa5d..38cb49c 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java @@ -23,6 +23,7 @@ package fr.ird.observe.ui.content.open.impl.longline; */ import fr.ird.observe.DataService; +import fr.ird.observe.ObserveConfig; import fr.ird.observe.ObserveDAOHelper; import fr.ird.observe.db.DataContext; import fr.ird.observe.db.DataSource; @@ -34,6 +35,7 @@ import fr.ird.observe.entities.referentiel.Program; import fr.ird.observe.ui.content.ContentMode; import fr.ird.observe.ui.content.open.ContentOpenableUIHandler; import fr.ird.observe.ui.content.open.ContentOpenableUIModel; +import fr.ird.observe.ui.util.tripMap.TripMapUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaContext; @@ -43,6 +45,10 @@ import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.util.TopiaEntityBinder; import org.nuiton.util.DateUtil; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.util.Date; import static org.nuiton.i18n.I18n.n; @@ -93,6 +99,44 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline } @Override + public void initUI() throws Exception { + super.initUI(); + + TripLonglineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + ObserveConfig config = ui.getContextValue(ObserveConfig.class); + + tripMap.getHandler().setConfig(config); + + getUi().getTripLonglineTabPane().addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + JTabbedPane tripLonglineTabPane = (JTabbedPane) e.getSource(); + TripLonglineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + if (tripLonglineTabPane.getSelectedComponent().equals(tripMap)) { + ui.getActions().setVisible(false); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + TripLonglineUI ui = getUi(); + TripMapUI tripMap = ui.getTripMap(); + + tripMap.getHandler().doOpenMap(ui.getDataSource(), ui.getDataService(), getSelectedId()); + } + }); + + } else { + ui.getActions().setVisible(true); + } + } + }); + + } + + @Override public void openUI() throws Exception { super.openUI(); diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index fb467d8..587b34f 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -112,7 +112,7 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { JTabbedPane tripSeineTabPane = (JTabbedPane) e.getSource(); TripSeineUI ui = getUi(); TripMapUI tripMap = ui.getTripMap(); - if (tripSeineTabPane.getSelectedComponent() == tripMap) { + if (tripSeineTabPane.getSelectedComponent().equals(tripMap)) { ui.getActions().setVisible(false); SwingUtilities.invokeLater(new Runnable() { diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index 8eb175a..d4f9c3a 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -14,8 +14,8 @@ import fr.ird.observe.ObserveConfig; import fr.ird.observe.ObserveTechnicalException; import fr.ird.observe.db.DataSource; import fr.ird.observe.db.DataSourceException; -import fr.ird.observe.entities.constants.seine.SchoolType; import fr.ird.observe.tripMap.TripMapPoint; +import fr.ird.observe.tripMap.TripMapPointType; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; @@ -60,6 +60,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.List; /** @@ -224,20 +225,20 @@ public class TripMapUIHandler { pointFeatureTypeBuilder.setName("point Builder"); pointFeatureTypeBuilder.setCRS(CRS.decode("EPSG:4326", true)); pointFeatureTypeBuilder.add("points", MultiPoint.class); - pointFeatureTypeBuilder.add("schoolType", String.class); + pointFeatureTypeBuilder.add("pointType", String.class); SimpleFeatureType pointFeatureType = pointFeatureTypeBuilder.buildFeatureType(); SimpleFeatureBuilder pointBuilder = new SimpleFeatureBuilder(pointFeatureType); DefaultFeatureCollection pointsFeatures = new DefaultFeatureCollection(); - for (final SchoolType schoolType : SchoolType.values()) { + for (final TripMapPointType type : TripMapPointType.values()) { Iterable<Coordinate> coordinates = Iterables.transform( Iterables.filter(tripMapPoints, new Predicate<TripMapPoint>() { @Override public boolean apply(TripMapPoint input) { - return input.getSchoolType() == schoolType; + return type.equals(input.getType()); } }), new Function<TripMapPoint, Coordinate>() { @@ -247,10 +248,13 @@ public class TripMapUIHandler { } }); - MultiPoint points = geometryFactory.createMultiPoint(Lists.newArrayList(coordinates).toArray(new Coordinate[0])); - pointBuilder.add(points); - pointBuilder.add(schoolType.name()); - pointsFeatures.add(pointBuilder.buildFeature(null)); + ArrayList<Coordinate> coordinatesArray = Lists.newArrayList(coordinates); + if (! coordinatesArray.isEmpty()) { + MultiPoint points = geometryFactory.createMultiPoint(coordinatesArray.toArray(new Coordinate[0])); + pointBuilder.add(points); + pointBuilder.add(type.name()); + pointsFeatures.add(pointBuilder.buildFeature(null)); + } } Style stylePoints = findStyle(styledLayerDescriptor, TRIP_POINTS_LAYER_NAME, null); diff --git a/observe-swing/src/main/map/style.xml b/observe-swing/src/main/map/style.xml index a42c641..50354f7 100644 --- a/observe-swing/src/main/map/style.xml +++ b/observe-swing/src/main/map/style.xml @@ -74,8 +74,8 @@ <Name>Point libre</Name> <ogc:Filter> <ogc:PropertyIsEqualTo> - <ogc:PropertyName>schoolType</ogc:PropertyName> - <ogc:Literal>libre</ogc:Literal> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>schoolLibre</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <PointSymbolizer> @@ -100,8 +100,8 @@ <Name>Point objet</Name> <ogc:Filter> <ogc:PropertyIsEqualTo> - <ogc:PropertyName>schoolType</ogc:PropertyName> - <ogc:Literal>objet</ogc:Literal> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>schoolObjet</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <PointSymbolizer> diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index dfd012c..0c22776 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -2110,6 +2110,8 @@ observe.tripLongline.message.updating=Updating a trip observe.tripLongline.observer=Observer observe.tripLongline.ocean=Ocean observe.tripLongline.startDate=Start date +observe.tripLongline.tab.general= +observe.tripLongline.tab.map= observe.tripLongline.title=Trip observe.tripLongline.totalFishingOperationsNumber=Total fishing operation count observe.tripLongline.tripType=Trip type diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 6d65e9d..2d8cec3 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -2112,6 +2112,8 @@ observe.tripLongline.message.updating= observe.tripLongline.observer= observe.tripLongline.ocean= observe.tripLongline.startDate= +observe.tripLongline.tab.general= +observe.tripLongline.tab.map= observe.tripLongline.title= observe.tripLongline.totalFishingOperationsNumber= observe.tripLongline.tripType= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index 181aef6..c945b19 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -2110,6 +2110,8 @@ observe.tripLongline.message.updating=La maréee est en cours de modification. observe.tripLongline.observer=Observateur observe.tripLongline.ocean=Océan observe.tripLongline.startDate=Date début +observe.tripLongline.tab.general=Caractéristiques +observe.tripLongline.tab.map=Carte observe.tripLongline.title=Marée observe.tripLongline.totalFishingOperationsNumber=Nombre total d'opérations de pêche observe.tripLongline.tripType=Type de marée -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 5be93dc37617f15322391b6448ac5c06bdba0126 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Apr 22 15:36:38 2015 +0200 change trip map point type values, add style for longline, --- .../entities/longline/TripLonglineDAOImpl.java | 12 +- .../observe/entities/seine/TripSeineDAOImpl.java | 10 +- .../fr/ird/observe/tripMap/TripMapPointType.java | 20 ++-- .../open/impl/longline/TripLonglineUIHandler.java | 2 + .../open/impl/seine/TripSeineUIHandler.java | 3 + observe-swing/src/main/map/style.xml | 122 ++++++++++++++++++++- 6 files changed, 149 insertions(+), 20 deletions(-) diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java b/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java index 5fb8b58..f422c34 100644 --- a/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java +++ b/observe-entities/src/main/java/fr/ird/observe/entities/longline/TripLonglineDAOImpl.java @@ -86,6 +86,7 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO departurePoint.setTime(tripLongline.getStartDate()); departurePoint.setLatitude(departureHarbour.getLatitude()); departurePoint.setLongitude(departureHarbour.getLongitude()); + departurePoint.setType(TripMapPointType.LONGLINE_DEPARTURE_HARBOUR); tripMapPoints.add(departurePoint); } @@ -105,6 +106,7 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO landingPoint.setTime(tripLongline.getEndDate()); landingPoint.setLatitude(landingHarbour.getLatitude()); landingPoint.setLongitude(landingHarbour.getLongitude()); + landingPoint.setType(TripMapPointType.LONGLINE_LANDINGE_HARBOUR); tripMapPoints.add(landingPoint); } @@ -158,7 +160,7 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO activity.setTime(resultSet.getDate(1)); activity.setLatitude(resultSet.getFloat(2)); activity.setLongitude(resultSet.getFloat(3)); - activity.setType(TripMapPointType.activity); + activity.setType(TripMapPointType.LONGLINE_ACTIVITY); result.add(activity); // settingStart @@ -167,7 +169,7 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO settingStart.setTime(resultSet.getDate(4)); settingStart.setLatitude(resultSet.getFloat(5)); settingStart.setLongitude(resultSet.getFloat(6)); - settingStart.setType(TripMapPointType.settingStart); + settingStart.setType(TripMapPointType.LONGLINE_ACTIVITY_WITH_SETTING_START); result.add(settingStart); } @@ -177,7 +179,7 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO settingEnd.setTime(resultSet.getDate(7)); settingEnd.setLatitude(resultSet.getFloat(8)); settingEnd.setLongitude(resultSet.getFloat(9)); - settingEnd.setType(TripMapPointType.settingEnd); + settingEnd.setType(TripMapPointType.LONGLINE_ACTIVITY_WITH_SETTING_END); result.add(settingEnd); } @@ -187,7 +189,7 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO haulingStart.setTime(resultSet.getDate(10)); haulingStart.setLatitude(resultSet.getFloat(11)); haulingStart.setLongitude(resultSet.getFloat(12)); - haulingStart.setType(TripMapPointType.haulingStart); + haulingStart.setType(TripMapPointType.LONGLINE_ACTIVITY_WITH_HAULING_START); result.add(haulingStart); } @@ -197,7 +199,7 @@ public class TripLonglineDAOImpl<E extends TripLongline> extends TripLonglineDAO haulingEnd.setTime(resultSet.getDate(13)); haulingEnd.setLatitude(resultSet.getFloat(14)); haulingEnd.setLongitude(resultSet.getFloat(15)); - haulingEnd.setType(TripMapPointType.haulingEnd); + haulingEnd.setType(TripMapPointType.LONGLINE_ACTIVITY_WITH_HAULING_END); result.add(haulingEnd); } diff --git a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java index aeda497..2814ff2 100644 --- a/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java +++ b/observe-entities/src/main/java/fr/ird/observe/entities/seine/TripSeineDAOImpl.java @@ -92,6 +92,7 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< departurePoint.setTime(tripSeine.getStartDate()); departurePoint.setLatitude(departureHarbour.getLatitude()); departurePoint.setLongitude(departureHarbour.getLongitude()); + departurePoint.setType(TripMapPointType.SEINE_DEPARTURE_HARBOUR); tripMapPoints.add(departurePoint); } @@ -106,6 +107,7 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< landingPoint.setTime(tripSeine.getEndDate()); landingPoint.setLatitude(landingHarbour.getLatitude()); landingPoint.setLongitude(landingHarbour.getLongitude()); + landingPoint.setType(TripMapPointType.SEINE_LANDINGE_HARBOUR); tripMapPoints.add(landingPoint); } @@ -155,18 +157,18 @@ public class TripSeineDAOImpl<E extends TripSeine> extends TripSeineDAOAbstract< point.setLatitude(resultSet.getFloat(3)); point.setLongitude(resultSet.getFloat(4)); if (resultSet.getString(5) == null) { - point.setType(TripMapPointType.activity); + point.setType(TripMapPointType.SEINE_ACTIVITY); } else { SchoolType schoolType = SchoolType.values()[resultSet.getInt(5)]; switch (schoolType) { case libre: - point.setType(TripMapPointType.schoolLibre); + point.setType(TripMapPointType.SEINE_ACTIVITY_WITH_FREE_SCHOOL_TYPE); break; case objet: - point.setType(TripMapPointType.schoolObjet); + point.setType(TripMapPointType.SEINE_ACTIVITY_WITH_OBJECT_SCHOOL_TYPE); break; default: - point.setType(TripMapPointType.activity); + point.setType(TripMapPointType.SEINE_ACTIVITY); } } diff --git a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java index 500e7a2..cbe7b85 100644 --- a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java +++ b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java @@ -5,12 +5,18 @@ package fr.ird.observe.tripMap; */ public enum TripMapPointType { - activity, - schoolLibre, - schoolObjet, - settingStart, - settingEnd, - haulingStart, - haulingEnd; + SEINE_DEPARTURE_HARBOUR, + SEINE_LANDINGE_HARBOUR, + SEINE_ACTIVITY, + SEINE_ACTIVITY_WITH_FREE_SCHOOL_TYPE, + SEINE_ACTIVITY_WITH_OBJECT_SCHOOL_TYPE, + + LONGLINE_DEPARTURE_HARBOUR, + LONGLINE_LANDINGE_HARBOUR, + LONGLINE_ACTIVITY, + LONGLINE_ACTIVITY_WITH_SETTING_START, + LONGLINE_ACTIVITY_WITH_SETTING_END, + LONGLINE_ACTIVITY_WITH_HAULING_START, + LONGLINE_ACTIVITY_WITH_HAULING_END; } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java index 38cb49c..1f75db7 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/longline/TripLonglineUIHandler.java @@ -181,6 +181,8 @@ public class TripLonglineUIHandler extends ContentOpenableUIHandler<TripLongline } } + getUi().getTripLonglineTabPane().setSelectedIndex(0); + finalizeOpenUI(mode, create); } diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java index 587b34f..d487cf2 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/open/impl/seine/TripSeineUIHandler.java @@ -178,6 +178,9 @@ public class TripSeineUIHandler extends ContentOpenableUIHandler<TripSeine> { } } + + getUi().getTripSeineTabPane().setSelectedIndex(0); + finalizeOpenUI(mode, create); } diff --git a/observe-swing/src/main/map/style.xml b/observe-swing/src/main/map/style.xml index 50354f7..e895b04 100644 --- a/observe-swing/src/main/map/style.xml +++ b/observe-swing/src/main/map/style.xml @@ -65,17 +65,18 @@ </FeatureTypeStyle> </UserStyle> </NamedLayer> + <NamedLayer> <Name>Trip points</Name> <UserStyle> <IsDefault>true</IsDefault> <FeatureTypeStyle> <Rule> - <Name>Point libre</Name> + <Name>Point seine activity with free school type</Name> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>pointType</ogc:PropertyName> - <ogc:Literal>schoolLibre</ogc:Literal> + <ogc:Literal>SEINE_ACTIVITY_WITH_FREE_SCHOOL_TYPE</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <PointSymbolizer> @@ -95,13 +96,41 @@ </PointSymbolizer> </Rule> </FeatureTypeStyle> + + <FeatureTypeStyle> + <Rule> + <Name>Point seine activity with object school type</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>SEINE_ACTIVITY_WITH_OBJECT_SCHOOL_TYPE</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>X</WellKnownName> + <Fill> + <CssParameter name="fill">#00FF00</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </Mark> + <Size>16</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + <FeatureTypeStyle> <Rule> - <Name>Point objet</Name> + <Name>Point longline activity with setting start</Name> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>pointType</ogc:PropertyName> - <ogc:Literal>schoolObjet</ogc:Literal> + <ogc:Literal>LONGLINE_ACTIVITY_WITH_SETTING_START</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <PointSymbolizer> @@ -121,6 +150,91 @@ </PointSymbolizer> </Rule> </FeatureTypeStyle> + + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity with setting end</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>LONGLINE_ACTIVITY_WITH_SETTING_END</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>Circle</WellKnownName> + <Fill> + <CssParameter name="fill">#00FF00</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </Mark> + <Size>14</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity with hauling start</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>LONGLINE_ACTIVITY_WITH_HAULING_START</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>X</WellKnownName> + <Fill> + <CssParameter name="fill">#FF0000</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </Mark> + <Size>16</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + + + <FeatureTypeStyle> + <Rule> + <Name>Point longline activity with hauling end</Name> + <ogc:Filter> + <ogc:PropertyIsEqualTo> + <ogc:PropertyName>pointType</ogc:PropertyName> + <ogc:Literal>LONGLINE_ACTIVITY_WITH_HAULING_END</ogc:Literal> + </ogc:PropertyIsEqualTo> + </ogc:Filter> + <PointSymbolizer> + <Graphic> + <Mark> + <WellKnownName>Circle</WellKnownName> + <Fill> + <CssParameter name="fill">#FF0000</CssParameter> + </Fill> + <Stroke> + <CssParameter name="stroke">#000000</CssParameter> + <CssParameter name="stroke-width">1</CssParameter> + </Stroke> + </Mark> + <Size>14</Size> + </Graphic> + </PointSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> </NamedLayer> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 7b2fb51491cd3ccebf047f34aaccdf953a3c9c21 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 22 16:34:04 2015 +0200 permettre d'interagir avec la carte même sur une marée clôturée (refs #6944) --- .../ird/observe/ui/content/ContentUIInitializer.java | 3 +++ .../fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx | 2 +- .../ird/observe/ui/util/tripMap/TripMapUIHandler.java | 19 +++++++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java index deafe1e..da583f1 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java @@ -209,6 +209,9 @@ public class ContentUIInitializer<E extends TopiaEntity, UI extends ObserveConte Set<String> doNotBlockComponentIds = new HashSet<String>(); + // Never block map + doNotBlockComponentIds.add("observeMapPane"); + DecoratorService decoratorService = ObserveContext.get().getDecoratorService(); for (String name : ui.get$objectMap().keySet()) { diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx index 8038dfb..a7fa300 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx @@ -19,7 +19,7 @@ void $afterCompleteSetup() { - <ObserveMapPane id='map' + <ObserveMapPane id='observeMapPane' constraints="BorderLayout.CENTER"/> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index d4f9c3a..a0c5317 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -91,7 +91,7 @@ public class TripMapUIHandler { public void initUI() { - JMapPane mapPane = view.getMap(); + JMapPane mapPane = getMapPane(); MouseMapListener mouseMapListener = new MouseMapListener(); mapPane.addMouseWheelListener(mouseMapListener); @@ -105,7 +105,7 @@ public class TripMapUIHandler { public void setConfig(ObserveConfig config) { this.config = config; - JMapPane mapPane = view.getMap(); + JMapPane mapPane = getMapPane(); mapPane.setBackground(config.getMapBackgroundColor()); } @@ -121,14 +121,14 @@ public class TripMapUIHandler { throw new ObserveTechnicalException("Unable to load trip map activity points", e); } - JMapPane mapPane = view.getMap(); + JMapPane mapPane = getMapPane(); MapContent mapContent = buildMapContent(tripMapPoints); mapPane.setMapContent(mapContent); zoomIt(); } public void zoomIt() { - JMapPane mapPane = view.getMap(); + JMapPane mapPane = getMapPane(); mapPane.setDisplayArea(tripArea); } @@ -355,7 +355,7 @@ public class TripMapUIHandler { protected void zoomApply() { if (zoomRatio != 1 && ! rendererRunning) { - JMapPane mapPane = view.getMap(); + JMapPane mapPane = getMapPane(); ReferencedEnvelope displayArea = mapPane.getDisplayArea(); @@ -449,7 +449,7 @@ public class TripMapUIHandler { } protected void startMove(Point2D startPointInScreen) { - JMapPane mapPane = view.getMap(); + JMapPane mapPane = getMapPane(); startDisplayArea = mapPane.getDisplayArea(); @@ -474,7 +474,7 @@ public class TripMapUIHandler { endDisplayArea.translate(transX, transY); - JMapPane mapPane = view.getMap(); + JMapPane mapPane = getMapPane(); mapPane.setDisplayArea(endDisplayArea); @@ -488,7 +488,6 @@ public class TripMapUIHandler { @Override public void onNewMapContent(MapPaneEvent ev) { } - @Override public void onDisplayAreaChanged(MapPaneEvent ev) { } @@ -505,4 +504,8 @@ public class TripMapUIHandler { } } + protected JMapPane getMapPane() { + return view.getObserveMapPane(); + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit 9b8b1cd8cec286955f3c0b182e57fbd36027da5f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Apr 22 17:35:56 2015 +0200 add export map into png, fix zoomIt in launch --- .../fr/ird/observe/ui/util/tripMap/TripMapUI.css | 10 +++ .../fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx | 5 +- .../observe/ui/util/tripMap/TripMapUIHandler.java | 90 ++++++++++++++++++---- .../resources/i18n/observe-swing_en_GB.properties | 18 +++++ .../resources/i18n/observe-swing_es_ES.properties | 18 +++++ .../resources/i18n/observe-swing_fr_FR.properties | 12 +++ 6 files changed, 136 insertions(+), 17 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.css b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.css new file mode 100644 index 0000000..532970b --- /dev/null +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.css @@ -0,0 +1,10 @@ + +#zoomIt { + text: "observe.map.action.zoomIt"; + toolTipText: "observe.map.action.zoomIt.tip"; +} + +#exportPng { + text: "observe.map.action.exportPng"; + toolTipText: "observe.map.action.exportPng.tip"; +} \ No newline at end of file diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx index a7fa300..d0fc5d1 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUI.jaxx @@ -17,7 +17,10 @@ void $afterCompleteSetup() { ]]> </script> - + <JPopupMenu id='mapPopupMenu'> + <JMenuItem id='zoomIt' onActionPerformed='getHandler().zoomIt()'/> + <JMenuItem id='exportPng' onActionPerformed='getHandler().exportPng()'/> + </JPopupMenu> <ObserveMapPane id='observeMapPane' constraints="BorderLayout.CENTER"/> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index a0c5317..db9c6c1 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -16,6 +16,7 @@ import fr.ird.observe.db.DataSource; import fr.ird.observe.db.DataSourceException; import fr.ird.observe.tripMap.TripMapPoint; import fr.ird.observe.tripMap.TripMapPointType; +import fr.ird.observe.ui.UIHelper; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; @@ -48,6 +49,8 @@ import org.geotools.swing.event.MapPaneListener; import org.opengis.feature.simple.SimpleFeature; import org.opengis.feature.simple.SimpleFeatureType; +import javax.imageio.ImageIO; +import javax.swing.JOptionPane; import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -56,13 +59,17 @@ import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; +import java.awt.image.BufferedImage; import java.io.File; import java.io.FileNotFoundException; +import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import static org.nuiton.i18n.I18n.t; + /** * @author Sylvain Bavencoff - bavencoff@codelutin.com */ @@ -91,13 +98,16 @@ public class TripMapUIHandler { public void initUI() { - JMapPane mapPane = getMapPane(); + ObserveMapPane mapPane = getObserveMapPane(); MouseMapListener mouseMapListener = new MouseMapListener(); mapPane.addMouseWheelListener(mouseMapListener); mapPane.addMouseMotionListener(mouseMapListener); mapPane.addMouseListener(mouseMapListener); mapPane.addMapPaneListener(new TripMapListener()); + + mapPane.setComponentPopupMenu(view.getMapPopupMenu()); + rendererRunning = false; } @@ -105,11 +115,13 @@ public class TripMapUIHandler { public void setConfig(ObserveConfig config) { this.config = config; - JMapPane mapPane = getMapPane(); + JMapPane mapPane = getObserveMapPane(); mapPane.setBackground(config.getMapBackgroundColor()); } - + protected ObserveMapPane getObserveMapPane() { + return view.getObserveMapPane(); + } public void doOpenMap(DataSource dataSource, DataService dataService, String tripId) { @@ -121,17 +133,53 @@ public class TripMapUIHandler { throw new ObserveTechnicalException("Unable to load trip map activity points", e); } - JMapPane mapPane = getMapPane(); + JMapPane mapPane = getObserveMapPane(); MapContent mapContent = buildMapContent(tripMapPoints); mapPane.setMapContent(mapContent); - zoomIt(); } public void zoomIt() { - JMapPane mapPane = getMapPane(); + JMapPane mapPane = getObserveMapPane(); mapPane.setDisplayArea(tripArea); } + public void exportPng() { + + File file = UIHelper.chooseFile( + view, + t("observe.map.export.chooseFile.title"), + t("observe.map.export.chooseFile.ok"), + null, + "^.+\\.png$", + t("observe.map.export.chooseFile.png")); + + boolean write = true; + if (file.exists()) { + write = UIHelper.askUser( + view, + t("observe.map.export.overwrite.title"), + t("observe.map.export.overwrite"), + JOptionPane.OK_CANCEL_OPTION, + new Object[] { + t("observe.map.export.overwrite.ok"), + t("observe.map.export.overwrite.cancel")}, + 1) == 0; + } + + if (write) { + BufferedImage im = new BufferedImage(view.getWidth(), view.getHeight(), BufferedImage.TYPE_INT_ARGB); + view.paint(im.getGraphics()); + try { + ImageIO.write(im, "PNG", file); + } catch (IOException e) { + throw new ObserveTechnicalException("unable to export map ", e); + } + + UIHelper.displayInfo(t("observe.map.export.success")); + } + } + + protected MapContent buildMapContent(List<TripMapPoint> tripMapPoints) { @@ -355,7 +403,7 @@ public class TripMapUIHandler { protected void zoomApply() { if (zoomRatio != 1 && ! rendererRunning) { - JMapPane mapPane = getMapPane(); + JMapPane mapPane = getObserveMapPane(); ReferencedEnvelope displayArea = mapPane.getDisplayArea(); @@ -420,12 +468,16 @@ public class TripMapUIHandler { @Override public void mousePressed(MouseEvent e) { - startMove(e.getPoint()); + if (e.getButton() == MouseEvent.BUTTON1) { + startMove(e.getPoint()); + } } @Override public void mouseReleased(MouseEvent e) { - endMove(e.getPoint()); + if (e.getButton() == MouseEvent.BUTTON1) { + endMove(e.getPoint()); + } } @Override @@ -449,7 +501,7 @@ public class TripMapUIHandler { } protected void startMove(Point2D startPointInScreen) { - JMapPane mapPane = getMapPane(); + JMapPane mapPane = getObserveMapPane(); startDisplayArea = mapPane.getDisplayArea(); @@ -474,7 +526,7 @@ public class TripMapUIHandler { endDisplayArea.translate(transX, transY); - JMapPane mapPane = getMapPane(); + JMapPane mapPane = getObserveMapPane(); mapPane.setDisplayArea(endDisplayArea); @@ -485,9 +537,14 @@ public class TripMapUIHandler { } protected class TripMapListener implements MapPaneListener { + + protected boolean firstRendering; + @Override public void onNewMapContent(MapPaneEvent ev) { + firstRendering = true; } + @Override public void onDisplayAreaChanged(MapPaneEvent ev) { } @@ -500,12 +557,13 @@ public class TripMapUIHandler { @Override public void onRenderingStopped(MapPaneEvent ev) { rendererRunning = false; - zoomApply(); + if (firstRendering) { + zoomIt(); + firstRendering = false; + } else { + zoomApply(); + } } } - protected JMapPane getMapPane() { - return view.getObserveMapPane(); - } - } diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index 0c22776..2511271 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -1264,7 +1264,25 @@ observe.longlineGlobalComposition.tab.hooksComposition=Hooks observe.longlineGlobalComposition.tab.mitigationType=Mitigation observe.longlineGlobalComposition.title=Global composition observe.measurement.delete.message= +observe.map.action.exportPng= +observe.map.action.exportPng.tip= +observe.map.action.zoomIt= +observe.map.action.zoomIt.tip= observe.map.east= +observe.map.export.choose.export.ok= +observe.map.export.choose.export.title= +observe.map.export.chooseFile.ok= +observe.map.export.chooseFile.overwrite= +observe.map.export.chooseFile.overwrite.cancel= +observe.map.export.chooseFile.overwrite.ok= +observe.map.export.chooseFile.overwrite.title= +observe.map.export.chooseFile.png= +observe.map.export.chooseFile.title= +observe.map.export.overwrite= +observe.map.export.overwrite.cancel= +observe.map.export.overwrite.ok= +observe.map.export.overwrite.title= +observe.map.export.success= observe.map.miles= observe.map.north= observe.map.south= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 2d8cec3..256a25a 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -1266,7 +1266,25 @@ observe.longlineGlobalComposition.tab.hooksComposition= observe.longlineGlobalComposition.tab.mitigationType= observe.longlineGlobalComposition.title= observe.measurement.delete.message= +observe.map.action.exportPng= +observe.map.action.exportPng.tip= +observe.map.action.zoomIt= +observe.map.action.zoomIt.tip= observe.map.east= +observe.map.export.choose.export.ok= +observe.map.export.choose.export.title= +observe.map.export.chooseFile.ok= +observe.map.export.chooseFile.overwrite= +observe.map.export.chooseFile.overwrite.cancel= +observe.map.export.chooseFile.overwrite.ok= +observe.map.export.chooseFile.overwrite.title= +observe.map.export.chooseFile.png= +observe.map.export.chooseFile.title= +observe.map.export.overwrite= +observe.map.export.overwrite.cancel= +observe.map.export.overwrite.ok= +observe.map.export.overwrite.title= +observe.map.export.success= observe.map.miles= observe.map.north= observe.map.south= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index c945b19..e88068e 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -1264,7 +1264,19 @@ observe.longlineGlobalComposition.tab.hooksComposition=Hameçons observe.longlineGlobalComposition.tab.mitigationType=Atténuations observe.longlineGlobalComposition.title=Composition globale de la palangre observe.measurement.delete.message=Supprimer la caractéristique sélectionnée +observe.map.action.exportPng=Exporter +observe.map.action.exportPng.tip=Exporter la carte +observe.map.action.zoomIt=Centrer +observe.map.action.zoomIt.tip=Centrer la carte sur la marée observe.map.east=Est +observe.map.export.chooseFile.ok=Exporter +observe.map.export.chooseFile.png=image PNG +observe.map.export.chooseFile.title=Exporter la carte +observe.map.export.overwrite=Le fichier existe déjà. Voulez-vous le remplacer ? +observe.map.export.overwrite.cancel=Annuler +observe.map.export.overwrite.ok=Remplacer +observe.map.export.overwrite.title=Attention +observe.map.export.success=Carte Exportée observe.map.miles=milles observe.map.north=Nord observe.map.south=Sud -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit ff63a7ba7e6583a18743ffa697f654daa0d39888 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Apr 22 18:46:37 2015 +0200 accepter la carte par son type plutot que par son nome dans le bloqueur + passage a jaxx en snapshot (refs #6944) --- .../main/java/fr/ird/observe/ui/content/ContentUIInitializer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java b/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java index da583f1..aad26b8 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/content/ContentUIInitializer.java @@ -35,6 +35,7 @@ import fr.ird.observe.entities.referentiel.ReferenceEntity; import fr.ird.observe.ui.UIHelper; import fr.ird.observe.ui.actions.shared.AbstractUIAction; import fr.ird.observe.ui.util.BooleanEditor; +import fr.ird.observe.ui.util.tripMap.ObserveMapPane; import fr.ird.observe.util.DBHelper; import fr.ird.observe.validation.ObserveValidator; import jaxx.runtime.JAXXValidator; @@ -74,6 +75,7 @@ import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; +import javax.swing.JScrollBar; import javax.swing.JSpinner; import javax.swing.JTable; import javax.swing.JTextArea; @@ -209,9 +211,6 @@ public class ContentUIInitializer<E extends TopiaEntity, UI extends ObserveConte Set<String> doNotBlockComponentIds = new HashSet<String>(); - // Never block map - doNotBlockComponentIds.add("observeMapPane"); - DecoratorService decoratorService = ObserveContext.get().getDecoratorService(); for (String name : ui.get$objectMap().keySet()) { @@ -312,7 +311,7 @@ public class ContentUIInitializer<E extends TopiaEntity, UI extends ObserveConte } protected void initBlockLayerUI(String... doNotBlockComponentIds) { - + ui.getBlockLayerUI().setAcceptedComponentTypes(ObserveMapPane.class, JScrollBar.class); ui.getBlockLayerUI().setAcceptedComponentNames(doNotBlockComponentIds); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6944 in repository observe. See http://git.codelutin.com/observe.git commit e5358416f2ac8f792857e27a33c9eb3b6768719b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 23 14:06:55 2015 +0200 add legend --- .../fr/ird/observe/tripMap/TripMapPointType.java | 36 +++++--- .../i18n/observe-entities_en_GB.properties | 12 +++ .../i18n/observe-entities_es_ES.properties | 12 +++ .../i18n/observe-entities_fr_FR.properties | 12 +++ .../observe/ui/util/tripMap/ObserveMapPane.java | 88 +++++++++++++++++++- .../ui/util/tripMap/ObserveMapPaneLegendItem.java | 69 ++++++++++++++++ .../util/tripMap/ObserverMapPanLegendDrawer.java | 95 ++++++++++++++++++++++ .../observe/ui/util/tripMap/TripMapUIHandler.java | 65 +++++++++++++-- .../resources/i18n/observe-swing_en_GB.properties | 2 + .../resources/i18n/observe-swing_es_ES.properties | 2 + .../resources/i18n/observe-swing_fr_FR.properties | 2 + 11 files changed, 375 insertions(+), 20 deletions(-) diff --git a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java index cbe7b85..82f9243 100644 --- a/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java +++ b/observe-entities/src/main/java/fr/ird/observe/tripMap/TripMapPointType.java @@ -1,22 +1,34 @@ package fr.ird.observe.tripMap; +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + /** * @author Sylvain Bavencoff - bavencoff@codelutin.com */ public enum TripMapPointType { - SEINE_DEPARTURE_HARBOUR, - SEINE_LANDINGE_HARBOUR, - SEINE_ACTIVITY, - SEINE_ACTIVITY_WITH_FREE_SCHOOL_TYPE, - SEINE_ACTIVITY_WITH_OBJECT_SCHOOL_TYPE, + SEINE_DEPARTURE_HARBOUR(n("observe.map.seine.harbour.departure")), + SEINE_LANDINGE_HARBOUR(n("observe.map.seine.harbour.landing")), + SEINE_ACTIVITY(n("observe.map.seine.activity")), + SEINE_ACTIVITY_WITH_FREE_SCHOOL_TYPE(n("observe.map.seine.activity.schollType.free")), + SEINE_ACTIVITY_WITH_OBJECT_SCHOOL_TYPE(n("observe.map.seine.activity.schollType.object")), + + LONGLINE_DEPARTURE_HARBOUR(n("observe.map.longLine.seine.harbour.departure")), + LONGLINE_LANDINGE_HARBOUR(n("observe.map.longLine.seine.harbour.landing")), + LONGLINE_ACTIVITY(n("observe.map.longLine.activity")), + LONGLINE_ACTIVITY_WITH_SETTING_START(n("observe.map.longLine.activity.setting.start")), + LONGLINE_ACTIVITY_WITH_SETTING_END(n("observe.map.longLine.activity.setting.end")), + LONGLINE_ACTIVITY_WITH_HAULING_START(n("observe.map.longLine.activity.hauling.start")), + LONGLINE_ACTIVITY_WITH_HAULING_END(n("observe.map.longLine.activity.hauling.end")); + + String label; - LONGLINE_DEPARTURE_HARBOUR, - LONGLINE_LANDINGE_HARBOUR, - LONGLINE_ACTIVITY, - LONGLINE_ACTIVITY_WITH_SETTING_START, - LONGLINE_ACTIVITY_WITH_SETTING_END, - LONGLINE_ACTIVITY_WITH_HAULING_START, - LONGLINE_ACTIVITY_WITH_HAULING_END; + TripMapPointType(String label) { + this.label = label; + } + public String getLabel() { + return t(label); + } } diff --git a/observe-entities/src/main/resources/i18n/observe-entities_en_GB.properties b/observe-entities/src/main/resources/i18n/observe-entities_en_GB.properties index b81be2a..9f50422 100644 --- a/observe-entities/src/main/resources/i18n/observe-entities_en_GB.properties +++ b/observe-entities/src/main/resources/i18n/observe-entities_en_GB.properties @@ -20,6 +20,18 @@ observe.common.reference.status.enabled= observe.common.schoolType.libre= observe.common.schoolType.objet= observe.common.schoolType.undefined= +observe.map.longLine.activity= +observe.map.longLine.activity.hauling.end= +observe.map.longLine.activity.hauling.start= +observe.map.longLine.activity.setting.end= +observe.map.longLine.activity.setting.start= +observe.map.longLine.seine.harbour.departure= +observe.map.longLine.seine.harbour.landing= +observe.map.seine.activity= +observe.map.seine.activity.schollType.free= +observe.map.seine.activity.schollType.object= +observe.map.seine.harbour.departure= +observe.map.seine.harbour.landing= observe.storage.migrate.askUser.message=Database use version %1$s,\n\nYou need to migrate to version %2$s.\nWould you like to execute migration ?\n\nNote\: Following migrations will be applied\: %3$s. observe.storage.migrate.askUser.title=Database update to version %1$s is required observe.storage.migrate.not.possible.before.version.3.0.message=<html><body>The application version requires a database in minimum version <strong>3.0</strong>. You database is actually in version %s<br/>Do first a migration using ObServe 3.0 or 3.1, you will then be able to migrate your database using this version of ObServe</body></html> diff --git a/observe-entities/src/main/resources/i18n/observe-entities_es_ES.properties b/observe-entities/src/main/resources/i18n/observe-entities_es_ES.properties index 71f83d7..a0f0749 100644 --- a/observe-entities/src/main/resources/i18n/observe-entities_es_ES.properties +++ b/observe-entities/src/main/resources/i18n/observe-entities_es_ES.properties @@ -20,6 +20,18 @@ observe.common.reference.status.enabled=Activado observe.common.schoolType.libre=Banco libre observe.common.schoolType.objet=Banco a objeto observe.common.schoolType.undefined=Banco indeterminado +observe.map.longLine.activity= +observe.map.longLine.activity.hauling.end= +observe.map.longLine.activity.hauling.start= +observe.map.longLine.activity.setting.end= +observe.map.longLine.activity.setting.start= +observe.map.longLine.seine.harbour.departure= +observe.map.longLine.seine.harbour.landing= +observe.map.seine.activity= +observe.map.seine.activity.schollType.free= +observe.map.seine.activity.schollType.object= +observe.map.seine.harbour.departure= +observe.map.seine.harbour.landing= observe.storage.migrate.askUser.message=La base de datos tiene la versión %1$s,\n\n Es necesario una migración a la versión %2$s.\n¿Quiere migrar la base de datos ?\n\nNota \: Se aplicarán las siguientes actualizaciones \: %3$s. observe.storage.migrate.askUser.title=Se requiera la actualización de la base de datos a la versión %1$s. observe.storage.migrate.not.possible.before.version.3.0.message=<html><body>La version %s d'ObServe nécessite une base de version au moins <strong>3.0</strong>. Votre base est en version %s<br/>Veuillez dans un premier temps utiliser ObServe 3.0 ou 3.1 pour effectuer la migration puis réouvrir la base avec cette nouvelle version d'ObServe</body></html> diff --git a/observe-entities/src/main/resources/i18n/observe-entities_fr_FR.properties b/observe-entities/src/main/resources/i18n/observe-entities_fr_FR.properties index d4a8587..60be1c5 100644 --- a/observe-entities/src/main/resources/i18n/observe-entities_fr_FR.properties +++ b/observe-entities/src/main/resources/i18n/observe-entities_fr_FR.properties @@ -20,6 +20,18 @@ observe.common.reference.status.enabled=Activé observe.common.schoolType.libre=Banc libre observe.common.schoolType.objet=Banc objet observe.common.schoolType.undefined=Banc indéterminé +observe.map.longLine.activity=point d'activité +observe.map.longLine.activity.hauling.end=Fin de filage +observe.map.longLine.activity.hauling.start=Début de filage +observe.map.longLine.activity.setting.end=Fin de virage +observe.map.longLine.activity.setting.start=Début de virage +observe.map.longLine.seine.harbour.departure=Port de départ +observe.map.longLine.seine.harbour.landing=Port d'arrivée +observe.map.seine.activity=point d'activité +observe.map.seine.activity.schollType.free=Banc libre +observe.map.seine.activity.schollType.object=Banc objet +observe.map.seine.harbour.departure=Port de départ +observe.map.seine.harbour.landing=Port d'arrivée observe.storage.migrate.askUser.message=La base de données est en version %1$s,\n\nUne migration en version %2$s est nécéssaire.\nVoulez vous migrer la base de données ?\n\nNote \: Les mises à jour suivantes seront appliquées \: %3$s. observe.storage.migrate.askUser.title=Mise à jour de la base en version %1$s requise observe.storage.migrate.not.possible.before.version.3.0.message=<html><body>La version %s d'ObServe nécessite une base de version au moins <strong>3.0</strong>. Votre base est en version %s<br/>Veuillez dans un premier temps utiliser ObServe 3.0 ou 3.1 pour effectuer la migration puis réouvrir la base avec cette nouvelle version d'ObServe</body></html> diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java index a0f8718..d624681 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPane.java @@ -1,9 +1,13 @@ package fr.ird.observe.ui.util.tripMap; +import com.google.common.collect.Lists; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.renderer.lite.RendererUtilities; +import org.geotools.styling.FeatureTypeStyle; +import org.geotools.styling.Rule; +import org.geotools.styling.Style; import org.geotools.swing.JMapPane; import org.geotools.swing.event.MapPaneAdapter; import org.geotools.swing.event.MapPaneEvent; @@ -14,6 +18,8 @@ import java.awt.Graphics; import java.awt.Point; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.util.List; import static org.nuiton.i18n.I18n.n; import static org.nuiton.i18n.I18n.t; @@ -48,7 +54,7 @@ public class ObserveMapPane extends JMapPane { updateScale(); } }); - + legendItems = Lists.newArrayList(); } @@ -156,6 +162,84 @@ public class ObserveMapPane extends JMapPane { } + protected List<ObserveMapPaneLegendItem> legendItems; + + public List<ObserveMapPaneLegendItem> getLegendItems() { + return legendItems; + } + + public void setLegendItems(List<ObserveMapPaneLegendItem> legendItems) { + this.legendItems = legendItems; + } + + protected void paintLegend(Graphics graphics) { + + if (legendItems != null) { + + int x = 0; + int y = getHeight() - ObserveMapPaneLegendItem.LEGEND_ITEM_HEIGHT * legendItems.size(); + + ObserverMapPanLegendDrawer drawer = new ObserverMapPanLegendDrawer(); + + FontMetrics fm = graphics.getFontMetrics(); + + int maxLabelWidth = 0; + + for (ObserveMapPaneLegendItem item : legendItems) { + Rectangle2D labelArea = fm.getStringBounds(item.getLabel(), graphics); + + maxLabelWidth = Math.max((int)labelArea.getWidth(), maxLabelWidth); + + } + + for (ObserveMapPaneLegendItem item : legendItems) { + + graphics.setColor(ObserveMapPaneLegendItem.LEGEND_BACKGROUND); + graphics.fillRect( + x, + y, + ObserveMapPaneLegendItem.LEGEND_SYMBOL_WIDTH + maxLabelWidth + ObserveMapPaneLegendItem.LEGEND_MARGIN, + ObserveMapPaneLegendItem.LEGEND_ITEM_HEIGHT); + + BufferedImage symbole = new BufferedImage( + ObserveMapPaneLegendItem.LEGEND_SYMBOL_WIDTH, + ObserveMapPaneLegendItem.LEGEND_ITEM_HEIGHT, + BufferedImage.TYPE_INT_ARGB); + + Style style = item.getStyle(); + + for (FeatureTypeStyle featureTypeStyle : style.featureTypeStyles()) { + + for (Rule rule : featureTypeStyle.rules()) { + + if (rule.getFilter().evaluate(item.getSimpleFeature())) { + + drawer.drawDirect(symbole, item.getSimpleFeature(), rule); + + } + } + } + + graphics.drawImage(symbole, x, y, null); + + graphics.setColor(Color.BLACK); + + Rectangle2D labelArea = fm.getStringBounds(item.getLabel(), graphics); + + int labelMarginBottom = (int) ((ObserveMapPaneLegendItem.LEGEND_ITEM_HEIGHT - labelArea.getHeight()) / 2); + + graphics.drawString(item.getLabel(), + x + ObserveMapPaneLegendItem.LEGEND_SYMBOL_WIDTH, + y + ObserveMapPaneLegendItem.LEGEND_ITEM_HEIGHT - labelMarginBottom); + + y += ObserveMapPaneLegendItem.LEGEND_ITEM_HEIGHT; + + } + } + + } + + @Override public void paint(Graphics graphics) { @@ -166,6 +250,8 @@ public class ObserveMapPane extends JMapPane { paintCompass(graphics); + paintLegend(graphics); + } protected enum CardinalPoint { diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPaneLegendItem.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPaneLegendItem.java new file mode 100644 index 0000000..4a6cd5a --- /dev/null +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserveMapPaneLegendItem.java @@ -0,0 +1,69 @@ +package fr.ird.observe.ui.util.tripMap; + +import com.vividsolutions.jts.geom.Coordinate; +import org.geotools.styling.Style; +import org.opengis.feature.simple.SimpleFeature; + +import java.awt.Color; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class ObserveMapPaneLegendItem { + + protected static final int LEGEND_ITEM_HEIGHT = 20; + protected static final int LEGEND_SYMBOL_WIDTH = 50; + protected static final int LEGEND_MARGIN = 5; + protected static final Color LEGEND_BACKGROUND = new Color(1f, 1f, 1f, 0.8f); + + + public static Coordinate[] lineCoordinates() { + Coordinate[] coordinates = new Coordinate[2]; + coordinates[0] = new Coordinate(LEGEND_MARGIN, LEGEND_ITEM_HEIGHT / 2); + coordinates[1] = new Coordinate(LEGEND_SYMBOL_WIDTH - LEGEND_MARGIN, LEGEND_ITEM_HEIGHT / 2); + return coordinates; + } + + public static Coordinate[] pointCoordinates() { + Coordinate[] coordinates = new Coordinate[1]; + coordinates[0] = new Coordinate(LEGEND_SYMBOL_WIDTH / 2, LEGEND_ITEM_HEIGHT / 2); + return coordinates; + } + + + protected SimpleFeature simpleFeature; + + protected Style style; + + protected String label; + + public ObserveMapPaneLegendItem(SimpleFeature simpleFeature, Style style, String label) { + this.simpleFeature = simpleFeature; + this.style = style; + this.label = label; + } + + public SimpleFeature getSimpleFeature() { + return simpleFeature; + } + + public void setSimpleFeature(SimpleFeature simpleFeature) { + this.simpleFeature = simpleFeature; + } + + public Style getStyle() { + return style; + } + + public void setStyle(Style style) { + this.style = style; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } +} diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserverMapPanLegendDrawer.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserverMapPanLegendDrawer.java new file mode 100644 index 0000000..930f825 --- /dev/null +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/ObserverMapPanLegendDrawer.java @@ -0,0 +1,95 @@ +package fr.ird.observe.ui.util.tripMap; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; +import com.vividsolutions.jts.geom.Point; +import org.geotools.geometry.jts.LiteShape; +import org.geotools.legend.Drawer; +import org.geotools.styling.LineSymbolizer; +import org.geotools.styling.PointSymbolizer; +import org.geotools.styling.Rule; +import org.geotools.styling.SLD; +import org.geotools.styling.Symbolizer; +import org.geotools.styling.TextSymbolizer; +import org.opengis.feature.simple.SimpleFeature; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Stroke; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class ObserverMapPanLegendDrawer { + + protected Drawer drawer; + + + public ObserverMapPanLegendDrawer() { + drawer = Drawer.create(); + + } + + public void drawDirect(BufferedImage bi, SimpleFeature feature, Rule rule){ + AffineTransform affineTransform = new AffineTransform(); + + LiteShape shape = new LiteShape(null, affineTransform, false); + for(Symbolizer symbolizer : rule.getSymbolizers()) { + if (symbolizer instanceof LineSymbolizer) { + LineSymbolizer lineSymbolizer = (LineSymbolizer) symbolizer; + + Geometry geometry = findGeometry(feature, lineSymbolizer); + if (geometry != null) { + + Graphics graphics = bi.getGraphics(); + Graphics2D g = (Graphics2D) graphics; + + shape.setGeometry(geometry); + + + Color c = SLD.color(lineSymbolizer); + int w = SLD.width( lineSymbolizer ); + float[] lineDash = SLD.lineDash(lineSymbolizer); + if( c != null && w > 0 ){ + g.setColor( c ); + + Stroke str = new BasicStroke( + w, + BasicStroke.CAP_SQUARE, + BasicStroke.JOIN_MITER, + 10.0f, lineDash, 0.0f + ); + g.setStroke(str); + + g.draw( shape ); + } + } + } else { + drawer.drawFeature(bi, feature, affineTransform, false, symbolizer, null, shape); + } + + } + + + } + + protected Geometry findGeometry(SimpleFeature feature, LineSymbolizer lineSymbolizer) { + String geomName = lineSymbolizer.getGeometryPropertyName(); + + Geometry geom; + if (geomName == null) { + geom = (Geometry) feature.getDefaultGeometry(); + } else { + geom = (Geometry) feature.getAttribute(geomName); + } + return geom; + } + + +} diff --git a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java index db9c6c1..68eb5c0 100644 --- a/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java +++ b/observe-swing/src/main/java/fr/ird/observe/ui/util/tripMap/TripMapUIHandler.java @@ -3,6 +3,7 @@ package fr.ird.observe.ui.util.tripMap; import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.vividsolutions.jts.geom.Coordinate; @@ -17,6 +18,7 @@ import fr.ird.observe.db.DataSourceException; import fr.ird.observe.tripMap.TripMapPoint; import fr.ird.observe.tripMap.TripMapPointType; import fr.ird.observe.ui.UIHelper; +import javafx.util.Pair; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; @@ -67,6 +69,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; +import java.util.Set; import static org.nuiton.i18n.I18n.t; @@ -79,6 +82,14 @@ public class TripMapUIHandler { public static final String TRIP_POINTS_LAYER_NAME = "Trip points"; public static final double ZOOM_STEP_RATIO = 0.1; + protected static final Set<TripMapPointType> TRIP_MAP_POINT_TYPES_IN_LEGEND = ImmutableSet.of( + TripMapPointType.SEINE_ACTIVITY_WITH_FREE_SCHOOL_TYPE, + TripMapPointType.SEINE_ACTIVITY_WITH_OBJECT_SCHOOL_TYPE, + TripMapPointType.LONGLINE_ACTIVITY_WITH_SETTING_START, + TripMapPointType.LONGLINE_ACTIVITY_WITH_SETTING_END, + TripMapPointType.LONGLINE_ACTIVITY_WITH_HAULING_START, + TripMapPointType.LONGLINE_ACTIVITY_WITH_HAULING_END); + public static TripMapUIHandler newHandler(TripMapUI view) { return new TripMapUIHandler(view); } @@ -133,9 +144,10 @@ public class TripMapUIHandler { throw new ObserveTechnicalException("Unable to load trip map activity points", e); } - JMapPane mapPane = getObserveMapPane(); - MapContent mapContent = buildMapContent(tripMapPoints); - mapPane.setMapContent(mapContent); + ObserveMapPane mapPane = getObserveMapPane(); + Pair<MapContent, List<ObserveMapPaneLegendItem>> buildMapContent = buildMapContent(tripMapPoints); + mapPane.setMapContent(buildMapContent.getKey()); + mapPane.setLegendItems(buildMapContent.getValue()); } public void zoomIt() { @@ -181,9 +193,10 @@ public class TripMapUIHandler { - protected MapContent buildMapContent(List<TripMapPoint> tripMapPoints) { + protected Pair<MapContent, List<ObserveMapPaneLegendItem>> buildMapContent(List<TripMapPoint> tripMapPoints) { MapContent mapContent = new MapContent(); + List<ObserveMapPaneLegendItem> legendItems = Lists.newArrayList(); if (tripMapPoints != null) { try { @@ -264,10 +277,31 @@ public class TripMapUIHandler { Style styleLines = findStyle(styledLayerDescriptor, TRIP_LINES_LAYER_NAME, null); Layer layerLines = new FeatureLayer(linesFeatures, styleLines); - mapContent.addLayer(layerLines); + // add line in legend + LineString line = geometryFactory.createLineString(ObserveMapPaneLegendItem.lineCoordinates()); + lineBuilder.add(line); + lineBuilder.add(""); + lineBuilder.add("tripDay"); + + ObserveMapPaneLegendItem legendTripDay = new ObserveMapPaneLegendItem( + lineBuilder.buildFeature(null), + styleLines, + t("observe.map.legend.tripDay")); + legendItems.add(legendTripDay); + + lineBuilder.add(line); + lineBuilder.add(""); + lineBuilder.add("tripBetweenTwoDays"); + ObserveMapPaneLegendItem legendTripBetweenTwoDays = new ObserveMapPaneLegendItem( + lineBuilder.buildFeature(null), + styleLines, + t("observe.map.legend.tripBetweenTwoDays")); + legendItems.add(legendTripBetweenTwoDays); + + // add Point SimpleFeatureTypeBuilder pointFeatureTypeBuilder = new SimpleFeatureTypeBuilder(); pointFeatureTypeBuilder.setName("point Builder"); @@ -280,6 +314,9 @@ public class TripMapUIHandler { DefaultFeatureCollection pointsFeatures = new DefaultFeatureCollection(); + Style stylePoints = findStyle(styledLayerDescriptor, TRIP_POINTS_LAYER_NAME, null); + + for (final TripMapPointType type : TripMapPointType.values()) { Iterable<Coordinate> coordinates = Iterables.transform( @@ -302,10 +339,24 @@ public class TripMapUIHandler { pointBuilder.add(points); pointBuilder.add(type.name()); pointsFeatures.add(pointBuilder.buildFeature(null)); + + + // add point in legend + if (TRIP_MAP_POINT_TYPES_IN_LEGEND.contains(type)) { + points = geometryFactory.createMultiPoint(ObserveMapPaneLegendItem.pointCoordinates()); + pointBuilder.add(points); + pointBuilder.add(type.name()); + + ObserveMapPaneLegendItem legendPoint = new ObserveMapPaneLegendItem( + pointBuilder.buildFeature(null), + stylePoints, + type.getLabel()); + legendItems.add(legendPoint); + } + } } - Style stylePoints = findStyle(styledLayerDescriptor, TRIP_POINTS_LAYER_NAME, null); Layer pointsLayer = new FeatureLayer(pointsFeatures, stylePoints); mapContent.addLayer(pointsLayer); // set zoom @@ -322,7 +373,7 @@ public class TripMapUIHandler { } } - return mapContent; + return new Pair<MapContent, List<ObserveMapPaneLegendItem>>(mapContent, legendItems); } protected StyledLayerDescriptor importStyledLayerDescriptor() throws FileNotFoundException { diff --git a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties index 2511271..6ea0f1b 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_en_GB.properties @@ -1283,6 +1283,8 @@ observe.map.export.overwrite.cancel= observe.map.export.overwrite.ok= observe.map.export.overwrite.title= observe.map.export.success= +observe.map.legend.tripBetweenTwoDays= +observe.map.legend.tripDay= observe.map.miles= observe.map.north= observe.map.south= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties index 256a25a..4311e7f 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_es_ES.properties @@ -1285,6 +1285,8 @@ observe.map.export.overwrite.cancel= observe.map.export.overwrite.ok= observe.map.export.overwrite.title= observe.map.export.success= +observe.map.legend.tripBetweenTwoDays= +observe.map.legend.tripDay= observe.map.miles= observe.map.north= observe.map.south= diff --git a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties index e88068e..e9fd951 100644 --- a/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties +++ b/observe-swing/src/main/resources/i18n/observe-swing_fr_FR.properties @@ -1277,6 +1277,8 @@ observe.map.export.overwrite.cancel=Annuler observe.map.export.overwrite.ok=Remplacer observe.map.export.overwrite.title=Attention observe.map.export.success=Carte Exportée +observe.map.legend.tripBetweenTwoDays=Trajet entre deux jours +observe.map.legend.tripDay=Trajet d'une journée observe.map.miles=milles observe.map.north=Nord observe.map.south=Sud -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.
participants (1)
-
codelutin.com scm