1 |
/******************************************************************************* |
2 |
* Copyright (c) 2009 Martin O. J. Schmitz. |
3 |
* |
4 |
* This file is part of the SCHMITZM library - a collection of utility |
5 |
* classes based on Java 1.6, focusing (not only) on Java Swing |
6 |
* and the Geotools library. |
7 |
* |
8 |
* The SCHMITZM project is hosted at: |
9 |
* http://wald.intevation.org/projects/schmitzm/ |
10 |
* |
11 |
* This program is free software; you can redistribute it and/or |
12 |
* modify it under the terms of the GNU Lesser General Public License |
13 |
* as published by the Free Software Foundation; either version 3 |
14 |
* of the License, or (at your option) any later version. |
15 |
* |
16 |
* This program is distributed in the hope that it will be useful, |
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 |
* GNU General Public License for more details. |
20 |
* |
21 |
* You should have received a copy of the GNU Lesser General Public License (license.txt) |
22 |
* along with this program; if not, write to the Free Software |
23 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
* or try this link: http://www.gnu.org/licenses/lgpl.html |
25 |
* |
26 |
* Contributors: |
27 |
* Martin O. J. Schmitz - initial API and implementation |
28 |
* Stefan A. Krüger - additional utility classes |
29 |
******************************************************************************/ |
30 |
package skrueger.geotools; |
31 |
|
32 |
import java.awt.Cursor; |
33 |
import java.awt.Point; |
34 |
import java.awt.event.MouseEvent; |
35 |
import java.awt.event.MouseWheelEvent; |
36 |
|
37 |
import org.opengis.geometry.DirectPosition; |
38 |
|
39 |
import schmitzm.swing.event.MouseInputType; |
40 |
|
41 |
/** |
42 |
* Defines an action (e.g. Zoom in, zoom out, drag) when a click, drag or window |
43 |
* selection is performed on a {@link XMapPane}. |
44 |
* |
45 |
* @author <a href="mailto:[email protected]">Martin Schmitz</a> |
46 |
* (University of Bonn/Germany) |
47 |
*/ |
48 |
public interface XMapPaneAction { |
49 |
|
50 |
/** |
51 |
* This action can be assigned to any {@link MouseInputType} to perform |
52 |
* zoom-in |
53 |
**/ |
54 |
public static XMapPaneAction_Zoom ZOOM_IN = new XMapPaneAction_Zoom.In(); |
55 |
|
56 |
/** |
57 |
* This action can be assigned to any {@link MouseInputType} to perform |
58 |
* zoom-out |
59 |
**/ |
60 |
public static XMapPaneAction_Zoom ZOOM_OUT = new XMapPaneAction_Zoom.Out(); |
61 |
|
62 |
/** |
63 |
* This action can be assigned to any {@link MouseInputType} to perform |
64 |
* panning on a Map |
65 |
**/ |
66 |
public static XMapPaneAction_Pan PAN = new XMapPaneAction_Pan(); |
67 |
|
68 |
/** |
69 |
* Defines the action in case of a single click on the map. Called by ### |
70 |
* XMapPaneMouseAdapter ### on {@link MouseInputType#LClick} and |
71 |
* {@link MouseInputType#RClick}. |
72 |
* |
73 |
* @param mapPane |
74 |
* map pane the action should be performed on |
75 |
* @param ev |
76 |
* mouse event of the action |
77 |
* @param coord |
78 |
* geo coordinate the click is performed on |
79 |
*/ |
80 |
public void performClick(XMapPane mapPane, MouseEvent ev, |
81 |
DirectPosition coord); |
82 |
|
83 |
/** |
84 |
* Defines the action in case of a mouse drag on the map. This method is |
85 |
* called on every mouse motion. |
86 |
* |
87 |
* @param mapPane |
88 |
* map pane the action should be performed on |
89 |
* @param ev |
90 |
* mouse event of the action |
91 |
* @param dragStartPos |
92 |
* window position the drag was started (the current position can |
93 |
* be determined from the mouse event) |
94 |
* @param startCoord |
95 |
* geo coordinate the drag was started |
96 |
* @param endCoord |
97 |
* geo coordinate the drag is currently moved over |
98 |
*/ |
99 |
public void performDragging(XMapPane mapPane, MouseEvent ev, |
100 |
Point dragStartPos, Point dragLastPos, DirectPosition startCoord, |
101 |
DirectPosition endCoord); |
102 |
|
103 |
/** |
104 |
* Defines the action in case of a window selection on the map (the moment a |
105 |
* drag ends). |
106 |
* |
107 |
* @param mapPane |
108 |
* map pane the action should be performed on |
109 |
* @param ev |
110 |
* mouse event of the action |
111 |
* @param dragStartPos |
112 |
* window position the window starts (the end position can be |
113 |
* determined from the mouse event) |
114 |
* @param startCoord |
115 |
* geo coordinate the window starts |
116 |
* @param endCoord |
117 |
* geo coordinate the window ends |
118 |
*/ |
119 |
public void performDragged(XMapPane mapPane, MouseEvent ev, |
120 |
Point dragStartPos, Point dragLastPos, DirectPosition startCoord, |
121 |
DirectPosition endCoord); |
122 |
|
123 |
/** |
124 |
* Defines the action in case of a mouse wheel action on the map (the moment |
125 |
* a drag ends). |
126 |
* |
127 |
* @param mapPane |
128 |
* map pane the action should be performed on |
129 |
* @param ev |
130 |
* mouse event of the action |
131 |
* @param coord |
132 |
* geo coordinate the wheel is turned on |
133 |
*/ |
134 |
public void performWheel(XMapPane mapPane, MouseWheelEvent ev, |
135 |
DirectPosition coord); |
136 |
|
137 |
} |