Revision 20098 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/tools/Behavior/MoveBehavior.java
MoveBehavior.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
|
54 | 54 |
/** |
55 |
* Behaviour que espera un listener de tipo MoveListener. |
|
55 |
* <p>Behavior that permits user to move the image of the associated |
|
56 |
* <code>MapControl</code> using a {@link PanListener PanListener}.</p> |
|
56 | 57 |
* |
57 | 58 |
* @author Vicente Caballero Navarro |
58 | 59 |
* @author Pablo Piqueras Bartolom? |
59 | 60 |
*/ |
60 | 61 |
public class MoveBehavior extends Behavior { |
62 |
/** |
|
63 |
* First point of the path in image coordinates. |
|
64 |
*/ |
|
61 | 65 |
private Point2D m_FirstPoint; |
66 |
|
|
67 |
/** |
|
68 |
* Last point of the path in image coordinates. |
|
69 |
*/ |
|
62 | 70 |
private Point2D m_LastPoint; |
71 |
|
|
72 |
/** |
|
73 |
* Tool listener used to work with the <code>MapControl</code> object. |
|
74 |
* |
|
75 |
* @see #getListener() |
|
76 |
* @see #setListener(ToolListener) |
|
77 |
*/ |
|
63 | 78 |
private PanListener listener; |
64 | 79 |
private boolean isButton1; |
65 | 80 |
|
66 | 81 |
/** |
67 |
* Crea un nuevo MoveBehavior.
|
|
68 |
* |
|
69 |
* @param pli listener.
|
|
82 |
* <p>Creates a new behavior for moving the mouse.</p>
|
|
83 |
*
|
|
84 |
* @param pli listener used to permit this object to work with the associated <code>MapControl</code>
|
|
70 | 85 |
*/ |
71 | 86 |
public MoveBehavior(PanListener pli) { |
72 | 87 |
listener = pli; |
73 | 88 |
} |
74 | 89 |
|
75 |
/** |
|
90 |
/* |
|
91 |
* (non-Javadoc) |
|
76 | 92 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
77 | 93 |
*/ |
78 | 94 |
public void paintComponent(Graphics g) { |
... | ... | |
95 | 111 |
} |
96 | 112 |
} |
97 | 113 |
|
98 |
/** |
|
99 |
* @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent) |
|
114 |
/* |
|
115 |
* (non-Javadoc) |
|
116 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mousePressed(java.awt.event.MouseEvent) |
|
100 | 117 |
*/ |
101 | 118 |
public void mousePressed(MouseEvent e) { |
102 | 119 |
if (e.getButton() == MouseEvent.BUTTON1) { |
... | ... | |
111 | 128 |
} |
112 | 129 |
} |
113 | 130 |
|
114 |
/** |
|
115 |
* Reimplementaci?n del m?todo mouseReleased de Behavior. |
|
116 |
* |
|
117 |
* @param e MouseEvent |
|
118 |
* |
|
119 |
* @throws BehaviorException Excepci?n lanzada cuando el Behavior. |
|
131 |
/* |
|
132 |
* (non-Javadoc) |
|
133 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseReleased(java.awt.event.MouseEvent) |
|
120 | 134 |
*/ |
121 | 135 |
public void mouseReleased(MouseEvent e) throws BehaviorException { |
122 | 136 |
if (e.getButton() == MouseEvent.BUTTON1 && m_FirstPoint!=null) { |
... | ... | |
130 | 144 |
m_FirstPoint = null; |
131 | 145 |
} |
132 | 146 |
|
133 |
/** |
|
134 |
* Reimplementaci?n del m?todo mouseDragged de Behavior. |
|
135 |
* |
|
136 |
* @param e MouseEvent |
|
147 |
/* |
|
148 |
* (non-Javadoc) |
|
149 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseDragged(java.awt.event.MouseEvent) |
|
137 | 150 |
*/ |
138 | 151 |
public void mouseDragged(MouseEvent e) { |
139 | 152 |
if (isButton1){ |
... | ... | |
143 | 156 |
} |
144 | 157 |
|
145 | 158 |
/** |
146 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener) |
|
159 |
* <p>Sets a tool listener to work with the <code>MapControl</code> using this behavior.</p> |
|
160 |
* |
|
161 |
* @param listener a <code>PanListener</code> object for this behavior |
|
147 | 162 |
*/ |
148 | 163 |
public void setListener(ToolListener listener) { |
149 | 164 |
this.listener = (PanListener) listener; |
150 | 165 |
} |
151 | 166 |
|
152 |
/** |
|
167 |
/* |
|
168 |
* (non-Javadoc) |
|
153 | 169 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener() |
154 | 170 |
*/ |
155 | 171 |
public ToolListener getListener() { |
Also available in: Unified diff