/[schmitzm]/branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Zoom.java
ViewVC logotype

Annotation of /branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_Zoom.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 639 - (hide annotations)
Thu Jan 28 16:07:22 2010 UTC (15 years, 1 month ago) by alfonx
Original Path: branches/2.0-RC2/src/skrueger/geotools/XMapPaneAction_ZoomIn.java
File MIME type: text/plain
File size: 1290 byte(s)


1 alfonx 639 package skrueger.geotools;
2    
3     import java.awt.Color;
4     import java.awt.Graphics;
5     import java.awt.Point;
6     import java.awt.event.MouseEvent;
7     import java.awt.event.MouseWheelEvent;
8     import java.awt.geom.Point2D;
9    
10     import org.opengis.geometry.DirectPosition;
11    
12     public class XMapPaneAction_ZoomIn implements XMapPaneAction {
13    
14     /**
15     * Stores last position of a drag event in window coordinates
16     */
17     protected Point lastPos;
18    
19     @Override
20     public void performClick(XMapPane mapPane, MouseEvent ev,
21     DirectPosition coord) {
22    
23     mapPane.zoomTo(ev.getPoint(), 1 / 2.);
24     }
25    
26     @Override
27     public void performDragging(XMapPane mapPane, MouseEvent ev,
28     Point dragStartPos, DirectPosition startCoord,
29     DirectPosition endCoord) {
30    
31     mapPane.drawRectangle(mapPane.getGraphics(), dragStartPos, ev.getPoint());
32     }
33    
34     @Override
35     public void performWheel(XMapPane mapPane, MouseWheelEvent wheelEvt,
36     DirectPosition coord) {
37    
38     final int units = wheelEvt.getUnitsToScroll();
39     if (units > 0)
40     mapPane.zoomTo(wheelEvt.getPoint(), 1. + .11 * units);
41     else
42     mapPane.zoomTo(wheelEvt.getPoint(), 2. / -units);
43     }
44    
45     @Override
46     public void performDragged(XMapPane mapPane, MouseEvent ev,
47     Point dragStartPos, DirectPosition startCoord,
48     DirectPosition endCoord) {
49     // TODO Auto-generated method stub
50    
51     }
52    
53     }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26