Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/PolygonBehavior.java
PolygonBehavior.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
|
54 | 54 |
/** |
55 |
* Behaviour que espera un listener de tipo MeasureListener. |
|
55 |
* <p>Behavior that permits user to draw a polygon by its vertexes on the image of the associated |
|
56 |
* <code>MapControl</code> using a {@link PolylineListener PolylineListener}.</p> |
|
56 | 57 |
* |
57 | 58 |
* @author Vicente Caballero Navarro |
58 | 59 |
*/ |
59 | 60 |
public class PolygonBehavior extends PolylineBehavior { |
60 | 61 |
/** |
61 |
* Crea un nuevo PolygonBehavior.
|
|
62 |
* <p>Creates a new behavior for drawing a polygon by its vertexes.</p>
|
|
62 | 63 |
* |
63 |
* @param ali listener.
|
|
64 |
* @param ali tool listener used to permit this object to work with the associated <code>MapControl</code>
|
|
64 | 65 |
*/ |
65 | 66 |
public PolygonBehavior(PolylineListener ali) { |
66 | 67 |
super(ali); |
67 | 68 |
} |
68 | 69 |
|
69 |
/** |
|
70 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
|
70 |
/* |
|
71 |
* (non-Javadoc) |
|
72 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#paintComponent(java.awt.Graphics) |
|
71 | 73 |
*/ |
72 | 74 |
public void paintComponent(Graphics g) { |
73 | 75 |
g.drawImage(getMapControl().getImage(), 0, 0, null); |
... | ... | |
78 | 80 |
} |
79 | 81 |
} |
80 | 82 |
|
81 |
/** |
|
82 |
* Reimplementaci?n del m?todo mousePressed de Behavior. |
|
83 |
* |
|
84 |
* @param E MouseEvent |
|
85 |
* |
|
86 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
|
83 |
/* |
|
84 |
* (non-Javadoc) |
|
85 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#mousePressed(java.awt.event.MouseEvent) |
|
87 | 86 |
*/ |
88 | 87 |
public void mousePressed(MouseEvent E) throws BehaviorException { |
89 | 88 |
if (E.getClickCount() == 2) { |
... | ... | |
111 | 110 |
} |
112 | 111 |
|
113 | 112 |
/** |
114 |
* A?ade el punto anterior al actual.
|
|
113 |
* <p>Adds a new vertex to the polygon.</p>
|
|
115 | 114 |
* |
116 |
* @param p Punto a a?adir.
|
|
115 |
* @param p a new vertex to the polygon
|
|
117 | 116 |
*/ |
118 | 117 |
private void addAntPoint(Point2D p) { |
119 | 118 |
arrayX.add(arrayX.size() - 1, new Double(p.getX())); |
... | ... | |
121 | 120 |
} |
122 | 121 |
|
123 | 122 |
/** |
124 |
* Cambio de punto anterior.
|
|
123 |
* <p>Changes the last vertex added to the polygon.</p>
|
|
125 | 124 |
* |
126 |
* @param p Punto a cambiar.
|
|
125 |
* @param p a new vertex to the polygon
|
|
127 | 126 |
*/ |
128 | 127 |
private void changeAntPoint(Point2D p) { |
129 | 128 |
if (arrayX.size() > 2) { |
... | ... | |
132 | 131 |
} |
133 | 132 |
} |
134 | 133 |
|
135 |
/** |
|
136 |
* Reimplementaci?n del m?todo mouseMoved de Behavior. |
|
137 |
* |
|
138 |
* @param E MouseEvent |
|
139 |
* |
|
140 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
|
134 |
/* |
|
135 |
* (non-Javadoc) |
|
136 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#mouseMoved(java.awt.event.MouseEvent) |
|
141 | 137 |
*/ |
142 | 138 |
public void mouseMoved(MouseEvent E) throws BehaviorException { |
143 | 139 |
if (isClicked) { |
... | ... | |
151 | 147 |
} |
152 | 148 |
} |
153 | 149 |
|
154 |
/** |
|
155 |
* Reimplementaci?n del m?todo mouseDragged de Behavior. |
|
156 |
* |
|
157 |
* @param e MouseEvent |
|
158 |
* |
|
159 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
|
150 |
/* |
|
151 |
* (non-Javadoc) |
|
152 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior#mouseDragged(java.awt.event.MouseEvent) |
|
160 | 153 |
*/ |
161 | 154 |
public void mouseDragged(MouseEvent e) throws BehaviorException { |
162 | 155 |
mouseMoved(e); |
Also available in: Unified diff