Antonio Caccese a écrit :
I would create a function that allows the user to perform Zoom In in a Point and Zoom Out from a Point on the StyledMapPane. On the StyledMapPane i have defined standard mouse listener that captures the point.

I'm not sure to understand exactly what you would like to do. The default mouse listeners already zoom in or out from a point using mouse wheel. I mean, when you move the mouse wheel, the point under the mouse cursor doesn't move and everything else is zoomed around that point.

If you have yours own events handling, then you should be able to zoom on a point with an AffineTransform. It should be something like that (if I'm not making any mistake; I write that from memory without testing it):

   AffineTransform change = new AffineTransform();
   change.translate(centerX, centerY);
   change.scale(zoom, zoom);
   change.translate(-centerX, -centerY);
   mapPane.transform(change);

The above assumes that the coordinates are expressed in "real world" coordinate system. If you want to use pixel coordinates instead, then invoke mapPane.transformPixels(change) instead of mapPane.transform(change).

Does it help?

        Martin.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to