branch feature/6944 updated (e14b489 -> 42063c6)
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 e14b489 fix default values map options discards 5d68707 add scale mpa and creat jaxx file for map discards 4592b6c fix zoom NPE discards 1859e26 refs #6944 copie des resources de cartographie discards 628da48 refs #6944 creation de la resources sur la partie catographie dans le build discards 6395c16 refs #6944 Déplacement des resources pour en faire un zip à intégrer dans le class-path discards 734d720 fix zoom discards 644cbb7 add layers discards 05de7fb zoom (or un-zoom) on pointer discards 82b697f use style file for map discards f9fa186 add Date on map discards 3996e91 add point and fix style discards f708cab rename functions discards 5f3c48a add french translation fr i18n discards 0880f0a fix show config discards 60b908e mouse Translation discards 0d6d869 add map in trip seine UI discards 16616a3 add shape file and options map in config discards 6dbaa21 add compute trip for map adds bce9d1c refs #6964 ajout de l'id de la marée à repliquer adds 67d0697 refs #6964 migration 4.0-RC3 pour ajouter les index sur fk manquants + regeneration de ces index via hibernate adds 991ebd6 fixes #6964: La sauvegarde de marées de la base centrale vers la base locale semble ne pas fonctionner Merge branch 'feature/6964' into develop adds b0d853e passage sur topia en snapshot pour la generation des index adds 4bcfa9b refs #6978 ajout icone pour l'action de consolidation des données adds 81f61c8 fixes #6978: Menu Action / Calculer les données : ajouter une icône Merge branch 'feature/6978' into develop adds c055b4d refs #6977 amélioration du layout adds 89245f1 fixes #6977: [PS] Mise en page formulaire Calée / Mesure Merge branch 'feature/6977' into develop adds bf27bf0 refs #6983 Ajout migration de usedInTrip pour l'engin Senne pour toutes les marées de type senne adds 3dfd23a fixes #6983: [PS] Migration des caractéristiques de la senne vers le nouveau système de gestion des équipements Merge branch 'feature/6983' into develop adds a685270 refs #6975 mise en lazy de GearCaracteristicType car toujours utilise adds bb089a9 fixes #6975: [PS] Problèmes d'utilisation du nouvel écran 'Equipements' Merge branch 'feature/6975' into develop adds 5a19d3a refs #6976 Add default measurements when creating a new gearusefeature adds 66346de fixes #6976: [PS] Les équipements devraient avoir des caractéristiques par défaut Merge branch 'feature/6976' into develop adds 0308cdb refs #6986 revue de la gestion du quadrant sur l'écran d'opération de peche palangre adds b33f785 fixes #6986: [LL] Non reprise du quadrant lors de la création d'une opération de pêche fixes #6987: [LL] Lors de l'enregistrement d'une opérationde pêche, perte de l'infromation sur les quadrants adds f1861db refs #6988 bien réinitilisé le quadrant sur les écrans d'activité adds 6b54f7d fixes #6988: Quadrant mal initialisé lors de l'arrvié sur un écran Merge branch 'feature/6988' into develop adds f40c065 refs #6475 ajout des traductions françaises à partir du fichier fourni dans le ticket adds 699a97a refs #6475 revue de la décoration des calées adds 050b28e fixes #6475: Traductions à améliorer Merge branch 'feature/6475' into develop adds 3748b29 refs #6983 mise à jour aussi du topiaversion adds a39a8c0 refs #6991 ajout migration pour renommage du palangrier inconnu adds a635b4d fixes #6991: Renommage du navire Palengirer inconnu en Palengrier inconnu Merge branch 'feature/6991' into develop adds 0ea6327 add migration db for tests adds 59ef834 use last release of topia adds 0d1bcfa [jgitflow-maven-plugin]updating poms for 4.0-RC4-SNAPSHOT development adds d0f8f52 [jgitflow-maven-plugin]updating develop poms to master versions to avoid merge conflicts adds 64cdd52 add missing license headers adds 9cbec54 [jgitflow-maven-plugin]updating poms for branch'release/4.0-RC3' with non-snapshot versions adds 9973bd8 Merge branch 'release/4.0-RC3' adds 6a676be Merge branch 'master' into develop adds f3882e2 [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 2112692 add compute trip for map new 03b30ce add shape file and options map in config new 2f0a5e5 add map in trip seine UI new 3074603 mouse Translation new 691da9d fix show config new 6c426d7 add french translation fr i18n new 3d15aef rename functions new 9616e42 add point and fix style new aa7fd12 add Date on map new 080c26d use style file for map new 174d9b3 zoom (or un-zoom) on pointer new ddd5406 add layers new 873c628 fix zoom new 83842ed refs #6944 Déplacement des resources pour en faire un zip à intégrer dans le class-path new 2efc056 refs #6944 creation de la resources sur la partie catographie dans le build new 3b04b05 refs #6944 copie des resources de cartographie new 9bcb782 fix zoom NPE new cde5ed7 add scale mpa and creat jaxx file for map new 42063c6 fix default values map options 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 (e14b489) \ N -- N -- N refs/heads/feature/6944 (42063c6) 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 19 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 42063c6e73e242a255a67d9e5d15571cdc7d6aa8 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Apr 21 10:33:51 2015 +0200 fix default values map options commit cde5ed7e9ce41fc353f84974afe87ae7592bb165 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 9bcb782963554e0155656955b0a7cc490bbdda20 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Apr 20 10:33:20 2015 +0200 fix zoom NPE commit 3b04b05a7f3bc74fd7f2e5d0ea83cc871f6c4d8f Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 20 19:49:39 2015 +0200 refs #6944 copie des resources de cartographie commit 2efc05628cddf441d192a0da66967a3bfd96787b 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 83842edae16279f958c62a71a9316254b79ca89d 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 873c628a889ed62a1fa9a74049129f602d85ff41 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 17:35:08 2015 +0200 fix zoom commit ddd5406f654d3cb0a52311e267464f223f01b856 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 17:31:40 2015 +0200 add layers commit 174d9b31d128ef66b491bab4e6f5bfc62b287679 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 16:08:47 2015 +0200 zoom (or un-zoom) on pointer commit 080c26d66cf2e6bbe3fb24d0973288918f22c5de Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 15:16:05 2015 +0200 use style file for map commit aa7fd12cafa9188b215886dfe173e748321e3f24 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 17:52:10 2015 +0200 add Date on map commit 9616e429909d4b2d134a0b91d459890ea88ba267 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 16:09:54 2015 +0200 add point and fix style commit 3d15aef049094a6d9e569b057dee783d36a20cea Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 15:52:51 2015 +0200 rename functions commit 6c426d7b7bdd5a68abe79a6bbf4e2d302858b220 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 11:17:32 2015 +0200 add french translation fr i18n commit 691da9d1ef6ab1919f2ab008c633f04c0ee6d84a Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 11:06:37 2015 +0200 fix show config commit 30746033be08531d553a8385ab7586f38d5148e7 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 10:55:22 2015 +0200 mouse Translation commit 2f0a5e5665ca79829f3693f523453a3eeff231e5 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:58:08 2015 +0200 add map in trip seine UI commit 03b30ce302610ab1304802142b3f631c36380e7b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:56:52 2015 +0200 add shape file and options map in config commit 2112692748716c64ed4fd9e687735f7b51c30d51 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Apr 16 08:42:39 2015 +0200 add compute trip for map Summary of changes: observe-business/pom.xml | 2 +- .../src/main/java/fr/ird/observe/DataService.java | 28 ++ .../main/java/fr/ird/observe/DecoratorService.java | 2 + .../java/fr/ird/observe/db/ReplicationService.java | 4 +- .../db/{4.0-RC2 => 4.0-RC3}/referentiel.sql.gz | Bin 138115 -> 138124 bytes observe-entities/pom.xml | 2 +- .../src/main/java/fr/ird/observe/entities/Set.java | 3 + .../observe/entities/longline/SetLonglineImpl.java | 26 +- .../migration/AbstractDataSourceMigration.java | 5 +- .../DataSourceMigrationForVersion_4_0_RC3.java | 282 +++++++++++++++++++++ .../ird/observe/entities/seine/SetSeineImpl.java | 8 +- .../db/4.0-RC3/add-foreign-key-indexes-PG.sql | 65 +++++ .../rename-unknown-longliner-H2.sql} | 2 +- .../rename-unknown-longliner-PG.sql} | 2 +- .../update-senne-gear-usedInTrip-H2.sql} | 2 +- .../update-senne-gear-usedInTrip-PG.sql} | 2 +- .../src/main/xmi/observe-common.properties | 4 +- .../src/main/xmi/observe-longline.properties | 2 +- .../src/main/xmi/observe-seine.properties | 2 +- observe-swing/pom.xml | 2 +- .../src/main/filters/observe-ui.properties | 1 + .../ird/observe/ui/content/ContentUIHandler.java | 28 ++ .../ui/content/impl/longline/SetLonglineUI.css | 8 +- .../impl/longline/SetLonglineUIHandler.java | 42 +++ .../content/impl/longline/SetLonglineUIModel.java | 8 +- .../observe/ui/content/impl/seine/SetSeineUI.jaxx | 72 +++--- .../impl/longline/ActivityLonglineUIHandler.java | 16 ++ .../open/impl/seine/ActivitySeineUIHandler.java | 15 ++ .../impl/seine/GearUseFeaturesSeineTableModel.java | 37 ++- .../impl/seine/GearUseFeaturesSeineUIHandler.java | 20 ++ .../ui/tree/AbstractObserveTreeCellRenderer.java | 10 + .../loadors/ActivityLonglineNodeChildLoador.java | 1 + .../tree/loadors/ActivitySeineNodeChildLoador.java | 1 + .../EditableTableWithCacheTableModelSupport.java | 4 +- .../resources/i18n/observe-swing_en_GB.properties | 2 + .../resources/i18n/observe-swing_es_ES.properties | 2 + .../resources/i18n/observe-swing_fr_FR.properties | 140 +++++----- observe-validation/pom.xml | 2 +- .../i18n/observe-validation_fr_FR.properties | 12 +- pom.xml | 4 +- 40 files changed, 718 insertions(+), 152 deletions(-) copy observe-business/src/test/resources/db/{4.0-RC2 => 4.0-RC3}/referentiel.sql.gz (52%) create mode 100644 observe-entities/src/main/java/fr/ird/observe/entities/migration/versions/DataSourceMigrationForVersion_4_0_RC3.java create mode 100644 observe-entities/src/main/resources/db/4.0-RC3/add-foreign-key-indexes-PG.sql copy observe-entities/src/main/resources/db/{3.11/add-activity-ersId-H2.sql => 4.0-RC3/rename-unknown-longliner-H2.sql} (81%) copy observe-entities/src/main/resources/db/{3.11/add-activity-ersId-H2.sql => 4.0-RC3/rename-unknown-longliner-PG.sql} (81%) copy observe-entities/src/main/resources/db/{3.11/add-activity-ersId-H2.sql => 4.0-RC3/update-senne-gear-usedInTrip-H2.sql} (82%) copy observe-entities/src/main/resources/db/{3.11/add-activity-ersId-H2.sql => 4.0-RC3/update-senne-gear-usedInTrip-PG.sql} (82%) -- 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 2112692748716c64ed4fd9e687735f7b51c30d51 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 9a0df89..19b9ef2 100644 --- a/observe-business/src/main/java/fr/ird/observe/DataService.java +++ b/observe-business/src/main/java/fr/ird/observe/DataService.java @@ -86,6 +86,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; @@ -1660,6 +1661,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 03b30ce302610ab1304802142b3f631c36380e7b 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 2f0a5e5665ca79829f3693f523453a3eeff231e5 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 d73bedb..48e6e48 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 @@ -925,6 +925,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 @@ -957,6 +959,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= @@ -2074,6 +2087,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 7c004e2..0b3595c 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 @@ -925,6 +925,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 @@ -957,6 +959,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 @@ -2074,6 +2087,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 1b9f0e4..623bda4 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 @@ -925,6 +925,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 @@ -957,6 +959,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 @@ -2072,6 +2085,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 f7a2064..88fb9d1 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 30746033be08531d553a8385ab7586f38d5148e7 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 691da9d1ef6ab1919f2ab008c633f04c0ee6d84a 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 6c426d7b7bdd5a68abe79a6bbf4e2d302858b220 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 623bda4..e96f944 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 @@ -925,8 +925,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 @@ -959,17 +959,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 3d15aef049094a6d9e569b057dee783d36a20cea 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 19b9ef2..de1b1f3 100644 --- a/observe-business/src/main/java/fr/ird/observe/DataService.java +++ b/observe-business/src/main/java/fr/ird/observe/DataService.java @@ -1661,7 +1661,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!"); @@ -1674,7 +1674,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 9616e429909d4b2d134a0b91d459890ea88ba267 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 88fb9d1..3a324fd 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 aa7fd12cafa9188b215886dfe173e748321e3f24 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 080c26d66cf2e6bbe3fb24d0973288918f22c5de 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 48e6e48..8442d68 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 @@ -970,6 +970,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 0b3595c..64ff244 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 @@ -970,6 +970,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 e96f944..f993c14 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 @@ -925,7 +925,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 @@ -970,6 +970,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 174d9b31d128ef66b491bab4e6f5bfc62b287679 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 ddd5406f654d3cb0a52311e267464f223f01b856 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 873c628a889ed62a1fa9a74049129f602d85ff41 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 83842edae16279f958c62a71a9316254b79ca89d 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 8442d68..8d9da57 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 @@ -950,6 +950,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. @@ -1407,6 +1408,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 64ff244..8650cf9 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 @@ -950,6 +950,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 @@ -1407,6 +1408,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 f993c14..f91c6b9 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 @@ -950,6 +950,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 @@ -1405,6 +1406,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 2efc05628cddf441d192a0da66967a3bfd96787b 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 3b04b05a7f3bc74fd7f2e5d0ea83cc871f6c4d8f 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 9bcb782963554e0155656955b0a7cc490bbdda20 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 cde5ed7e9ce41fc353f84974afe87ae7592bb165 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 42063c6e73e242a255a67d9e5d15571cdc7d6aa8 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>.
participants (1)
-
codelutin.com scm