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