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.Point; |
33 |
import java.awt.event.MouseEvent; |
34 |
import java.awt.event.MouseWheelEvent; |
35 |
|
36 |
import org.opengis.geometry.DirectPosition; |
37 |
|
38 |
import schmitzm.swing.event.MouseInputType; |
39 |
|
40 |
/** |
41 |
* Defines an action (e.g. Zoom in, zoom out, drag) when a click, drag or window |
42 |
* selection is performed on a {@link XMapPane}. |
43 |
* |
44 |
* @author <a href="mailto:[email protected]">Martin Schmitz</a> |
45 |
* (University of Bonn/Germany) |
46 |
*/ |
47 |
public interface XMapPaneAction { |
48 |
|
49 |
/** |
50 |
* This action can be assigned to any {@link MouseInputType} to perform |
51 |
* zoom-in |
52 |
**/ |
53 |
public static XMapPaneAction_Zoom ZOOM_IN = new XMapPaneAction_Zoom.In(); |
54 |
|
55 |
/** |
56 |
* This action can be assigned to any {@link MouseInputType} to perform |
57 |
* zoom-out |
58 |
**/ |
59 |
public static XMapPaneAction_Zoom ZOOM_OUT = new XMapPaneAction_Zoom.Out(); |
60 |
|
61 |
/** |
62 |
* This action can be assigned to any {@link MouseInputType} to perform |
63 |
* panning on a Map |
64 |
**/ |
65 |
public static XMapPaneAction_Pan PAN = new XMapPaneAction_Pan(); |
66 |
|
67 |
/** |
68 |
* This action can be assigned to fire events for any number of feature from all layers. |
69 |
**/ |
70 |
public static XMapPaneAction_Select.All SELECT_ALL = new XMapPaneAction_Select.All(); |
71 |
|
72 |
/** |
73 |
* This action can be assigned to fire selection events for one feature from the top layer. |
74 |
**/ |
75 |
public static XMapPaneAction_Select.OneFromTop SELECT_ONE_FROM_TOP = new XMapPaneAction_Select.OneFromTop(); |
76 |
|
77 |
/** |
78 |
* This action can be assigned to fire events for any number of feature from the top layer. |
79 |
**/ |
80 |
public static XMapPaneAction_Select.Top SELECT_TOP = new XMapPaneAction_Select.Top(); |
81 |
|
82 |
/** |
83 |
* Defines the action in case of a single click on the map. Called by ### |
84 |
* XMapPaneMouseAdapter ### on {@link MouseInputType#LClick} and |
85 |
* {@link MouseInputType#RClick}. |
86 |
* |
87 |
* @param mapPane |
88 |
* map pane the action should be performed on |
89 |
* @param ev |
90 |
* mouse event of the action |
91 |
* @param coord |
92 |
* geo coordinate the click is performed on |
93 |
*/ |
94 |
public void performClick(XMapPane mapPane, MouseEvent ev, |
95 |
DirectPosition coord); |
96 |
|
97 |
/** |
98 |
* Defines the action in case of a mouse drag on the map. This method is |
99 |
* called on every mouse motion. |
100 |
* |
101 |
* @param mapPane |
102 |
* map pane the action should be performed on |
103 |
* @param ev |
104 |
* mouse event of the action |
105 |
* @param dragStartPos |
106 |
* window position the drag was started (the current position can |
107 |
* be determined from the mouse event) |
108 |
* @param startCoord |
109 |
* geo coordinate the drag was started |
110 |
* @param endCoord |
111 |
* geo coordinate the drag is currently moved over |
112 |
*/ |
113 |
public void performDragging(XMapPane mapPane, MouseEvent ev, |
114 |
Point dragStartPos, Point dragLastPos, DirectPosition startCoord, |
115 |
DirectPosition endCoord); |
116 |
|
117 |
/** |
118 |
* Defines the action in case of a window selection on the map (the moment a |
119 |
* drag ends). |
120 |
* |
121 |
* @param mapPane |
122 |
* map pane the action should be performed on |
123 |
* @param ev |
124 |
* mouse event of the action |
125 |
* @param dragStartPos |
126 |
* window position the window starts (the end position can be |
127 |
* determined from the mouse event) |
128 |
* @param startCoord |
129 |
* geo coordinate the window starts |
130 |
* @param endCoord |
131 |
* geo coordinate the window ends |
132 |
*/ |
133 |
public void performDragged(XMapPane mapPane, MouseEvent ev, |
134 |
Point dragStartPos, Point dragLastPos, DirectPosition startCoord, |
135 |
DirectPosition endCoord); |
136 |
|
137 |
/** |
138 |
* Defines the action in case of a mouse wheel action on the map (the moment |
139 |
* a drag ends). |
140 |
* |
141 |
* @param mapPane |
142 |
* map pane the action should be performed on |
143 |
* @param ev |
144 |
* mouse event of the action |
145 |
* @param coord |
146 |
* geo coordinate the wheel is turned on |
147 |
*/ |
148 |
public void performWheel(XMapPane mapPane, MouseWheelEvent ev, |
149 |
DirectPosition coord); |
150 |
|
151 |
/** |
152 |
* Defines what happens if this action has been triggered by a keyboard-key. |
153 |
* |
154 |
* @param mapPane |
155 |
* map pane the action should be performed on |
156 |
* |
157 |
* @param param |
158 |
* An optinal paramter that can be defined. |
159 |
*/ |
160 |
public void performKeyboard(XMapPane mapPane, Object param); |
161 |
|
162 |
} |