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