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