Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/CircleBehavior.java
CircleBehavior.java | ||
---|---|---|
60 | 60 |
|
61 | 61 |
|
62 | 62 |
/** |
63 |
* Behaviour que espera un listener de tipo CircleListener. |
|
63 |
* <p>Behavior that allows user to draw a circle on the image of the associated |
|
64 |
* <code>MapControl</code> using a {@link PolylineListener PolylineListener}.</p> |
|
64 | 65 |
* |
65 | 66 |
* @author Laura |
66 | 67 |
*/ |
67 | 68 |
public class CircleBehavior extends Behavior { |
69 |
/** |
|
70 |
* First point set, that represents the center of the circle. |
|
71 |
*/ |
|
68 | 72 |
private Point2D m_FirstPoint; |
73 |
|
|
74 |
/** |
|
75 |
* Second point set, that permits calculate the radius of the circle. |
|
76 |
*/ |
|
69 | 77 |
private Point2D m_LastPoint; |
78 |
|
|
79 |
/** |
|
80 |
* Auxiliary point that represents a corner selected in image coordinates. |
|
81 |
*/ |
|
70 | 82 |
private Point2D m_PointAnt; |
83 |
|
|
84 |
/** |
|
85 |
* Auxiliary point that represents a corner selected in image coordinates. |
|
86 |
*/ |
|
71 | 87 |
private CircleListener listener; |
88 |
|
|
89 |
/** |
|
90 |
* Determines if user setting the radius of the circle (with one click of the button 1 of the mouse), or not. |
|
91 |
*/ |
|
72 | 92 |
protected boolean isClicked = false; |
73 | 93 |
|
74 | 94 |
/** |
75 |
* Crea un nuevo CircleBehavior.
|
|
76 |
* |
|
77 |
* @param zili listener.
|
|
95 |
* <p>Creates a new behavior for selecting circle areas.</p>
|
|
96 |
*
|
|
97 |
* @param zili listener used to permit this object to work with the associated <code>MapControl</code>
|
|
78 | 98 |
*/ |
79 | 99 |
public CircleBehavior(CircleListener zili) { |
80 | 100 |
listener = zili; |
81 | 101 |
} |
82 | 102 |
|
83 |
/** |
|
103 |
/* |
|
104 |
* (non-Javadoc) |
|
84 | 105 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
85 | 106 |
*/ |
86 | 107 |
public void paintComponent(Graphics g) { |
... | ... | |
100 | 121 |
} |
101 | 122 |
} |
102 | 123 |
|
103 |
/** |
|
104 |
* Reimplementaci?n del m?todo mousePressed de Behavior. |
|
105 |
* |
|
106 |
* @param e MouseEvent |
|
124 |
/* |
|
125 |
* (non-Javadoc) |
|
126 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mousePressed(java.awt.event.MouseEvent) |
|
107 | 127 |
*/ |
108 | 128 |
public void mousePressed(MouseEvent e) { |
109 | 129 |
|
... | ... | |
124 | 144 |
getMapControl().repaint(); |
125 | 145 |
} |
126 | 146 |
|
127 |
/** |
|
128 |
* Reimplementaci?n del m?todo mouseReleased de Behavior. |
|
129 |
* |
|
130 |
* @param e MouseEvent |
|
131 |
* |
|
132 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
|
147 |
/* |
|
148 |
* (non-Javadoc) |
|
149 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseReleased(java.awt.event.MouseEvent) |
|
133 | 150 |
*/ |
134 | 151 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
135 | 152 |
m_FirstPoint = null; |
... | ... | |
137 | 154 |
isClicked = false; |
138 | 155 |
} |
139 | 156 |
|
140 |
|
|
141 |
/** |
|
142 |
* Reimplementaci?n del m?todo mouseDragged de Behavior. |
|
143 |
* |
|
144 |
* @param e MouseEvent |
|
145 |
* |
|
146 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
|
157 |
/* |
|
158 |
* (non-Javadoc) |
|
159 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseDragged(java.awt.event.MouseEvent) |
|
147 | 160 |
*/ |
148 | 161 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
149 | 162 |
mouseMoved(e); |
150 | 163 |
} |
151 |
/** |
|
152 |
* Reimplementaci?n del m?todo mouseDragged de Behavior.
|
|
153 |
* |
|
154 |
* @param e MouseEvent
|
|
164 |
|
|
165 |
/*
|
|
166 |
* (non-Javadoc)
|
|
167 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseMoved(java.awt.event.MouseEvent)
|
|
155 | 168 |
*/ |
156 | 169 |
public void mouseMoved(MouseEvent e) throws BehaviorException { |
157 | 170 |
m_LastPoint = e.getPoint(); |
... | ... | |
185 | 198 |
} |
186 | 199 |
|
187 | 200 |
/** |
188 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener) |
|
201 |
* <p>Sets a tool listener to work with the <code>MapControl</code> using this behavior.</p> |
|
202 |
* |
|
203 |
* @param listener a <code>CircleListener</code> object for this behavior |
|
189 | 204 |
*/ |
190 | 205 |
public void setListener(ToolListener listener) { |
191 | 206 |
this.listener = (CircleListener)listener; |
192 | 207 |
} |
193 | 208 |
|
194 |
/** |
|
209 |
/* |
|
210 |
* (non-Javadoc) |
|
195 | 211 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener() |
196 | 212 |
*/ |
197 | 213 |
public ToolListener getListener() { |
Also available in: Unified diff