Revision 1062 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/View.java
View.java | ||
---|---|---|
18 | 18 |
import com.iver.andami.ui.mdiManager.SingletonView; |
19 | 19 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
20 | 20 |
import com.iver.andami.ui.mdiManager.ViewListener; |
21 |
import com.iver.cit.gvsig.fmap.ColorEvent; |
|
22 |
import com.iver.cit.gvsig.fmap.ExtentEvent; |
|
21 | 23 |
import com.iver.cit.gvsig.fmap.FMap; |
22 | 24 |
import com.iver.cit.gvsig.fmap.NewMapControl; |
25 |
import com.iver.cit.gvsig.fmap.ViewPortListener; |
|
23 | 26 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
24 | 27 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
28 |
import com.iver.cit.gvsig.fmap.tools.CompoundBehavior; |
|
29 |
import com.iver.cit.gvsig.fmap.tools.ZoomOutIzqListener; |
|
25 | 30 |
import com.iver.cit.gvsig.fmap.tools.Behavior.AreaMapTool; |
31 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MapTool; |
|
26 | 32 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MeasureMapTool; |
33 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementMapTool; |
|
27 | 34 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MoveMapTool; |
28 | 35 |
import com.iver.cit.gvsig.fmap.tools.Behavior.PointMapTool; |
29 | 36 |
import com.iver.cit.gvsig.fmap.tools.Behavior.RectangleMapTool; |
... | ... | |
69 | 76 |
//this.setName(Utilities.getMessage(this, "Vista")+ " : "+modelo.getName()); |
70 | 77 |
this.setPreferredSize(new Dimension(500, 300)); |
71 | 78 |
initComponents(); |
72 |
//TODO Poner la herramienta por defecto |
|
73 |
// m_MapControl.setTool(MapControl.ZOOM_MAS); |
|
74 | 79 |
} |
75 | 80 |
|
76 | 81 |
/** |
... | ... | |
107 | 112 |
} |
108 | 113 |
} |
109 | 114 |
}); |
115 |
|
|
116 |
if (m_MapControl.getViewPort() != null){ |
|
117 |
m_MapControl.getViewPort().addExtentListener(new ViewPortListener() { |
|
118 |
/** |
|
119 |
* @see com.iver.cit.gvsig.fmap.ViewPortListener#extentChanged(com.iver.cit.gvsig.fmap.ExtentEvent) |
|
120 |
*/ |
|
121 |
public void extentChanged(ExtentEvent e) { |
|
122 |
if (PluginServices.getMainFrame() != null) |
|
123 |
PluginServices.getMainFrame().getStatusBar().setMessage("4","1:"+m_MapControl.getMapContext().getScaleView()); |
|
124 |
} |
|
125 |
|
|
126 |
/** |
|
127 |
* @see com.iver.cit.gvsig.fmap.ViewPortListener#backColorChanged(com.iver.cit.gvsig.fmap.ColorEvent) |
|
128 |
*/ |
|
129 |
public void backColorChanged(ColorEvent e) { |
|
130 |
} |
|
131 |
}); |
|
132 |
} |
|
110 | 133 |
} |
111 | 134 |
/** |
112 | 135 |
* DOCUMENT ME! |
... | ... | |
153 | 176 |
tempMainSplit.setRightComponent(m_MapControl); |
154 | 177 |
this.setLayout(new BorderLayout()); |
155 | 178 |
this.add(tempMainSplit, BorderLayout.CENTER); |
179 |
|
|
180 |
//Listener de eventos de movimiento que pone las coordenadas del rat?n en la barra de estado |
|
181 |
StatusBarListener sbl = new StatusBarListener(m_MapControl); |
|
156 | 182 |
|
157 | 183 |
// Zoom out (pinchas y el mapa se centra y te muestra m?s). |
158 | 184 |
// No es dibujando un rect?ngulo, es solo pinchando. |
159 |
m_MapControl.addMapTool("point", new PointMapTool()); |
|
160 | 185 |
|
161 | 186 |
ZoomOutListener zol = new ZoomOutListener(m_MapControl); |
162 |
m_MapControl.addTool("zoomOut", "point", zol);
|
|
187 |
m_MapControl.addMapTool("zoomOut", new MapTool[]{new PointMapTool(zol), new MouseMovementMapTool(sbl)});
|
|
163 | 188 |
|
164 | 189 |
// pan |
165 |
m_MapControl.addMapTool("pan", new MoveMapTool()); |
|
166 | 190 |
|
167 | 191 |
PanListener pl = new PanListener(m_MapControl); |
168 |
m_MapControl.addTool("pan", "pan", pl);
|
|
192 |
m_MapControl.addMapTool("pan", new MapTool[]{new MoveMapTool(pl), new MouseMovementMapTool(sbl)});
|
|
169 | 193 |
|
170 | 194 |
// Medir |
171 |
m_MapControl.addMapTool("medicion", new MeasureMapTool()); |
|
172 | 195 |
|
173 | 196 |
MeasureListener mli = new MeasureListener(m_MapControl); |
174 |
m_MapControl.addTool("medicion", "medicion", mli);
|
|
197 |
m_MapControl.addMapTool("medicion", new MapTool[]{new MeasureMapTool(mli), new MouseMovementMapTool(sbl)});
|
|
175 | 198 |
|
176 | 199 |
// Area |
177 |
m_MapControl.addMapTool("area", new AreaMapTool()); |
|
178 | 200 |
|
179 | 201 |
AreaListener ali = new AreaListener(m_MapControl); |
180 |
m_MapControl.addTool("area", "area", ali);
|
|
202 |
m_MapControl.addMapTool("area", new MapTool[]{new AreaMapTool(ali), new MouseMovementMapTool(sbl)});
|
|
181 | 203 |
|
182 | 204 |
//Seleccion por punto |
183 | 205 |
PointSelectListener psl = new PointSelectListener(m_MapControl); |
184 |
m_MapControl.addTool("pointSelection", "point", psl);
|
|
206 |
m_MapControl.addMapTool("pointSelection", new MapTool[]{new PointMapTool(psl), new MouseMovementMapTool(sbl)});
|
|
185 | 207 |
|
186 | 208 |
//Info por punto |
187 |
m_MapControl.addMapTool("info", new PointMapTool()); |
|
188 | 209 |
InfoListener il = new InfoListener(m_MapControl); |
189 |
//il.setModel(modelo); |
|
190 |
m_MapControl.addTool("info", "info", il); |
|
210 |
m_MapControl.addMapTool("info", new MapTool[]{new PointMapTool(il), new MouseMovementMapTool(sbl)}); |
|
191 | 211 |
|
192 | 212 |
// Link por punto |
193 |
m_MapControl.addMapTool("link", new PointMapTool()); |
|
194 | 213 |
LinkListener ll = new LinkListener(m_MapControl); |
195 |
m_MapControl.addTool("link", "link", ll);
|
|
214 |
m_MapControl.addMapTool("link", new MapTool[]{new PointMapTool(ll), new MouseMovementMapTool(sbl)});
|
|
196 | 215 |
|
197 | 216 |
//Selecci?n por rect?ngulo |
198 |
m_MapControl.addMapTool("rectangle", |
|
199 |
new RectangleMapTool()); |
|
200 | 217 |
RectangleSelectListener rsl = new RectangleSelectListener(m_MapControl); |
201 |
m_MapControl.addTool("rectSelection", "rectangle", rsl); |
|
218 |
m_MapControl.addMapTool("rectSelection", new MapTool[]{new RectangleMapTool(rsl), new MouseMovementMapTool(sbl)}); |
|
219 |
|
|
220 |
// Zoom por rect?ngulo |
|
221 |
ZoomOutIzqListener zoil = new ZoomOutIzqListener(m_MapControl); |
|
222 |
ZoomInListener zil = new ZoomInListener(m_MapControl); |
|
223 |
m_MapControl.addMapTool("zoomIn", new MapTool[]{new RectangleMapTool(zil), |
|
224 |
new PointMapTool(zoil), new MouseMovementMapTool(sbl)}); |
|
202 | 225 |
|
203 |
|
|
204 |
// Zoom por rect?ngulo |
|
205 |
ZoomInListener zil = new ZoomInListener(m_MapControl); |
|
206 |
m_MapControl.addTool("zoomIn", "rectangle", zil); |
|
207 | 226 |
m_MapControl.setTool("zoomIn"); // Por defecto |
208 |
|
|
209 |
m_MapControl.setDefaultMapTool(new StatusBarListener(m_MapControl)); |
|
210 | 227 |
} |
211 | 228 |
|
212 | 229 |
/** |
Also available in: Unified diff