branch feature/6944 updated (82b697f -> 05de7fb)
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 from 82b697f use style file for map new 05de7fb zoom (or un-zoom) on pointer The 1 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 05de7fbfce9a4bbe3ce8d7d08b2892df977b1671 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Apr 17 16:08:47 2015 +0200 zoom (or un-zoom) on pointer Summary of changes: .../ui/content/open/impl/seine/TripMapHandler.java | 34 ++++++++++++++++++---- observe-swing/src/main/resources/log4j.properties | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) -- 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 05de7fbfce9a4bbe3ce8d7d08b2892df977b1671 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>.
participants (1)
-
codelutin.com scm