Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/RectangleBehavior.java
RectangleBehavior.java | ||
---|---|---|
57 | 57 |
|
58 | 58 |
|
59 | 59 |
/** |
60 |
* Behaviour que espera un listener de tipo RectangleListener. |
|
60 |
* <p>Behavior that permits user to select a rectangular area on the associated <code>MapControl</code> using |
|
61 |
* a {@link RectangleListener RectangleListener}.</p> |
|
61 | 62 |
* |
62 | 63 |
* @author Vicente Caballero Navarro |
63 | 64 |
*/ |
64 | 65 |
public class RectangleBehavior extends Behavior { |
66 |
/** |
|
67 |
* First point of the rectangle area, that represents a corner. |
|
68 |
*/ |
|
65 | 69 |
private Point2D m_FirstPoint; |
70 |
|
|
71 |
/** |
|
72 |
* Second point of the rectangle area, that represents the opposite corner of the first, |
|
73 |
* along the diagonal. |
|
74 |
*/ |
|
66 | 75 |
private Point2D m_LastPoint; |
76 |
|
|
77 |
/** |
|
78 |
* Auxiliary point that represents a corner selected in image coordinates. |
|
79 |
*/ |
|
67 | 80 |
private Point2D m_PointAnt; |
81 |
|
|
82 |
/** |
|
83 |
* Tool listener used to work with the <code>MapControl</code> object. |
|
84 |
* |
|
85 |
* @see #getListener() |
|
86 |
* @see #setListener(ToolListener) |
|
87 |
*/ |
|
68 | 88 |
private RectangleListener listener; |
69 | 89 |
|
70 | 90 |
/** |
71 |
* Crea un nuevo RectangleBehavior.
|
|
91 |
* <p>Creates a new behavior for selecting rectangle areas.</p>
|
|
72 | 92 |
* |
73 |
* @param zili listener.
|
|
93 |
* @param zili listener used to permit this object to work with the associated <code>MapControl</code>
|
|
74 | 94 |
*/ |
75 | 95 |
public RectangleBehavior(RectangleListener zili) { |
76 | 96 |
listener = zili; |
77 | 97 |
} |
78 | 98 |
|
79 |
/** |
|
99 |
/* |
|
100 |
* (non-Javadoc) |
|
80 | 101 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
81 | 102 |
*/ |
82 | 103 |
public void paintComponent(Graphics g) { |
... | ... | |
98 | 119 |
g.setPaintMode(); |
99 | 120 |
} |
100 | 121 |
|
101 |
/** |
|
102 |
* Reimplementaci?n del m?todo mousePressed de Behavior. |
|
103 |
* |
|
104 |
* @param e MouseEvent |
|
122 |
/* |
|
123 |
* (non-Javadoc) |
|
124 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mousePressed(java.awt.event.MouseEvent) |
|
105 | 125 |
*/ |
106 | 126 |
public void mousePressed(MouseEvent e) { |
107 | 127 |
Point pScreen = e.getPoint(); |
... | ... | |
120 | 140 |
getMapControl().repaint(); |
121 | 141 |
} |
122 | 142 |
|
123 |
/** |
|
124 |
* Reimplementaci?n del m?todo mouseReleased de Behavior. |
|
125 |
* |
|
126 |
* @param e MouseEvent |
|
127 |
* |
|
128 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
|
143 |
/* |
|
144 |
* (non-Javadoc) |
|
145 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseReleased(java.awt.event.MouseEvent) |
|
129 | 146 |
*/ |
130 | 147 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
131 | 148 |
if (m_FirstPoint == null) return; |
... | ... | |
154 | 171 |
m_LastPoint = null; |
155 | 172 |
} |
156 | 173 |
|
157 |
/** |
|
158 |
* Reimplementaci?n del m?todo mouseDragged de Behavior. |
|
159 |
* |
|
160 |
* @param e MouseEvent |
|
174 |
/* |
|
175 |
* (non-Javadoc) |
|
176 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseDragged(java.awt.event.MouseEvent) |
|
161 | 177 |
*/ |
162 | 178 |
public void mouseDragged(MouseEvent e) { |
163 | 179 |
m_LastPoint = e.getPoint(); |
... | ... | |
165 | 181 |
} |
166 | 182 |
|
167 | 183 |
/** |
168 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener) |
|
184 |
* <p>Sets a tool listener to work with the <code>MapControl</code> using this behavior.</p> |
|
185 |
* |
|
186 |
* @param listener a <code>RectangleListener</code> object for this behavior |
|
169 | 187 |
*/ |
170 | 188 |
public void setListener(ToolListener listener) { |
171 | 189 |
this.listener = (RectangleListener) listener; |
172 | 190 |
} |
173 | 191 |
|
174 |
/** |
|
192 |
/* |
|
193 |
* (non-Javadoc) |
|
175 | 194 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener() |
176 | 195 |
*/ |
177 | 196 |
public ToolListener getListener() { |
Also available in: Unified diff