Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/PolylineBehavior.java

View differences:

PolylineBehavior.java
56 56

  
57 57

  
58 58
/**
59
 * Behaviour que espera un listener de tipo MeasureListener.
59
 * <p>Behavior that allows user to draw a polyline by its vertexes on the image of the associated
60
 *  <code>MapControl</code> using a {@link PolylineListener PolylineListener}.</p>
60 61
 *
61 62
 * @author Vicente Caballero Navarro
62 63
 */
63 64
public class PolylineBehavior extends Behavior {
65
	/**
66
	 * The abscissa coordinate of all vertexes of the polyline. 
67
	 */
64 68
	protected ArrayList arrayX = new ArrayList();
69

  
70
	/**
71
	 * The ordinate coordinate of all vertexes of the polyline. 
72
	 */
65 73
	protected ArrayList arrayY = new ArrayList();
74

  
75
	/**
76
	 * Determines if user is setting the vertexes (with one click of the button 1 of the mouse), or not.
77
	 */
66 78
	protected boolean isClicked = false;
79

  
80
	/**
81
	 * Tool listener used to work with the <code>MapControl</code> object.
82
	 * 
83
	 * @see #getListener()
84
	 * @see #setListener(ToolListener)
85
	 */
67 86
	protected PolylineListener listener;
68 87

  
69 88
	/**
70
	 * Crea un nuevo PolylineBehavior.
89
	 * <p>Creates a new behavior for drawing a polyline by its vertexes.</p>
71 90
	 *
72
	 * @param mli listener.
91
	 * @param mli listener used to permit this object to work with the associated <code>MapControl</code>
73 92
	 */
74 93
	public PolylineBehavior(PolylineListener mli) {
75 94
		listener = mli;
76 95
	}
77 96

  
78
	/**
97
	/*
98
	 * (non-Javadoc)
79 99
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics)
80 100
	 */
81 101
	public void paintComponent(Graphics g) {
......
87 107
		}
88 108
	}
89 109

  
90
	/**
91
	 * Reimplementaci?n del m?todo mousePressed de Behavior.
92
	 *
93
	 * @param E MouseEvent
94
	 *
95
	 * @throws BehaviorException Excepci?n lanzada cuando el Behavior.
110
	/*
111
	 * (non-Javadoc)
112
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mousePressed(java.awt.event.MouseEvent)
96 113
	 */
97 114
	public void mousePressed(MouseEvent E) throws BehaviorException {
98 115
		if (E.getClickCount() == 2) {
......
119 136
		}
120 137
	}
121 138

  
122
	/**
123
	 * Reimplementaci?n del m?todo mouseDragged de Behavior.
124
	 *
125
	 * @param e MouseEvent
126
	 *
127
	 * @throws BehaviorException Excepci?n lanzada cuando el Behavior.
139
	/*
140
	 * (non-Javadoc)
141
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseDragged(java.awt.event.MouseEvent)
128 142
	 */
129 143
	public void mouseDragged(MouseEvent e) throws BehaviorException {
130 144
		mouseMoved(e);
131 145
	}
132 146

  
133 147
	/**
134
	 * Cambio del ?ltimo punto.
148
	 * <p>Changes the last point added of the polyline.</p>
135 149
	 *
136
	 * @param p punto.
150
	 * @param p a point which will replace the last added to the polyline
137 151
	 */
138 152
	protected void changeLastPoint(Point2D p) {
139 153
		arrayX.set(arrayX.size() - 1, new Double(p.getX()));
140 154
		arrayY.set(arrayY.size() - 1, new Double(p.getY()));
141 155
	}
142 156

  
143
	/**
144
	 * Reimplementaci?n del m?todo mouseMoved de Behavior.
145
	 *
146
	 * @param e MouseEvent
147
	 *
148
	 * @throws BehaviorException Excepci?n lanzada cuando el Behavior.
157
	/*
158
	 * (non-Javadoc)
159
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseMoved(java.awt.event.MouseEvent)
149 160
	 */
150 161
	public void mouseMoved(MouseEvent E) throws BehaviorException {
151 162
		//System.err.println("moved antes de click");
......
162 173
	}
163 174

  
164 175
	/**
165
	 * Dibujo de la polil?nea.
176
	 * <p>Draws the polyline in the <code>Graphics2D</code> of the associated <code>MapControl</code>.</p>
166 177
	 *
167
	 * @param g2 Graphics2D sobre el que dibujamos.
178
	 * @param g2 the 2D context that allows draw the polyline
168 179
	 */
169 180
	protected void drawPolyLine(Graphics2D g2) {
170 181
		GeneralPathX polyline = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
......
184 195
	}
185 196

  
186 197
	/**
187
	 * A?ade un punto a la polil?nea.
198
	 * <p>Adds a new point to the polyline.</p>
188 199
	 *
189
	 * @param p Punto.
200
	 * @param p a new point to the polyline
190 201
	 */
191 202
	protected void addPoint(Point2D p) {
192 203
		arrayX.add(new Double(p.getX()));
......
194 205
	}
195 206

  
196 207
	/**
197
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener)
208
	 * <p>Sets a tool listener to work with the <code>MapControl</code> using this behavior.</p>
209
	 * 
210
	 * @param listener a <code>PolylineListener</code> object for this behavior
198 211
	 */
199 212
	public void setListener(ToolListener listener) {
200 213
		this.listener = (PolylineListener) listener;
201 214
	}
202 215

  
203
	/**
216
	/*
217
	 * (non-Javadoc)
204 218
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener()
205 219
	 */
206 220
	public ToolListener getListener() {

Also available in: Unified diff