root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / gui / View.java @ 7771
History | View | Annotate | Download (18.7 KB)
1 | 7304 | caballero | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
4 | *
|
||
5 | * This program is free software; you can redistribute it and/or
|
||
6 | * modify it under the terms of the GNU General Public License
|
||
7 | * as published by the Free Software Foundation; either version 2
|
||
8 | * of the License, or (at your option) any later version.
|
||
9 | *
|
||
10 | * This program is distributed in the hope that it will be useful,
|
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | * GNU General Public License for more details.
|
||
14 | *
|
||
15 | * You should have received a copy of the GNU General Public License
|
||
16 | * along with this program; if not, write to the Free Software
|
||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
18 | *
|
||
19 | * For more information, contact:
|
||
20 | *
|
||
21 | * Generalitat Valenciana
|
||
22 | * Conselleria d'Infraestructures i Transport
|
||
23 | * Av. Blasco Ib??ez, 50
|
||
24 | * 46010 VALENCIA
|
||
25 | * SPAIN
|
||
26 | *
|
||
27 | * +34 963862235
|
||
28 | * gvsig@gva.es
|
||
29 | * www.gvsig.gva.es
|
||
30 | *
|
||
31 | * or
|
||
32 | *
|
||
33 | * IVER T.I. S.A
|
||
34 | * Salamanca 50
|
||
35 | * 46005 Valencia
|
||
36 | * Spain
|
||
37 | *
|
||
38 | * +34 963163400
|
||
39 | * dac@iver.es
|
||
40 | */
|
||
41 | package com.iver.cit.gvsig.project.documents.view.gui; |
||
42 | |||
43 | import java.awt.BorderLayout; |
||
44 | import java.awt.Color; |
||
45 | import java.awt.Dimension; |
||
46 | import java.beans.PropertyChangeEvent; |
||
47 | import java.beans.PropertyChangeListener; |
||
48 | import java.util.HashMap; |
||
49 | import java.util.Iterator; |
||
50 | |||
51 | import javax.swing.JSplitPane; |
||
52 | |||
53 | import com.iver.andami.PluginServices; |
||
54 | import com.iver.cit.gvsig.fmap.ColorEvent; |
||
55 | import com.iver.cit.gvsig.fmap.ExtentEvent; |
||
56 | import com.iver.cit.gvsig.fmap.MapContext; |
||
57 | import com.iver.cit.gvsig.fmap.MapControl; |
||
58 | import com.iver.cit.gvsig.fmap.ProjectionEvent; |
||
59 | import com.iver.cit.gvsig.fmap.ViewPortListener; |
||
60 | import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
||
61 | import com.iver.cit.gvsig.fmap.layers.FLayer; |
||
62 | import com.iver.cit.gvsig.fmap.layers.FLayers; |
||
63 | import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
||
64 | import com.iver.cit.gvsig.fmap.tools.ZoomOutRightButtonListener; |
||
65 | import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
||
66 | import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior; |
||
67 | import com.iver.cit.gvsig.fmap.tools.Behavior.MoveBehavior; |
||
68 | import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior; |
||
69 | import com.iver.cit.gvsig.fmap.tools.Behavior.PolygonBehavior; |
||
70 | import com.iver.cit.gvsig.fmap.tools.Behavior.PolylineBehavior; |
||
71 | import com.iver.cit.gvsig.fmap.tools.Behavior.RectangleBehavior; |
||
72 | import com.iver.cit.gvsig.project.documents.view.MapOverview; |
||
73 | import com.iver.cit.gvsig.project.documents.view.ProjectView; |
||
74 | import com.iver.cit.gvsig.project.documents.view.toc.gui.TOC; |
||
75 | 7771 | caballero | import com.iver.cit.gvsig.project.documents.view.toolListeners.AreaListener; |
76 | import com.iver.cit.gvsig.project.documents.view.toolListeners.InfoListener; |
||
77 | import com.iver.cit.gvsig.project.documents.view.toolListeners.LinkListener; |
||
78 | import com.iver.cit.gvsig.project.documents.view.toolListeners.MeasureListener; |
||
79 | import com.iver.cit.gvsig.project.documents.view.toolListeners.PanListener; |
||
80 | import com.iver.cit.gvsig.project.documents.view.toolListeners.PointSelectListener; |
||
81 | import com.iver.cit.gvsig.project.documents.view.toolListeners.PolygonSelectListener; |
||
82 | import com.iver.cit.gvsig.project.documents.view.toolListeners.RectangleSelectListener; |
||
83 | import com.iver.cit.gvsig.project.documents.view.toolListeners.SelectImageListener; |
||
84 | import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener; |
||
85 | import com.iver.cit.gvsig.project.documents.view.toolListeners.ZoomInListener; |
||
86 | import com.iver.cit.gvsig.project.documents.view.toolListeners.ZoomOutListener; |
||
87 | import com.iver.cit.gvsig.project.documents.view.toolListeners.ZoomPixelCursorListener; |
||
88 | 7304 | caballero | import com.iver.utiles.console.JConsole; |
89 | import com.iver.utiles.console.JDockPanel; |
||
90 | import com.iver.utiles.console.ResponseListener; |
||
91 | import com.iver.utiles.console.jedit.JEditTextArea; |
||
92 | |||
93 | |||
94 | /**
|
||
95 | * <p>
|
||
96 | * <b>Class View</b>. This class represents the gvSIG specific internal window where the maps are
|
||
97 | * displayed and where the events coming from the user are captured.
|
||
98 | * </p>
|
||
99 | * <p>
|
||
100 | * It is composed by three main visual areas:
|
||
101 | * </p>
|
||
102 | * <ol>
|
||
103 | * <li>
|
||
104 | * <b>Map control</b>: the map area located in the right area of the window. It takes up
|
||
105 | * the biggest part of the window.
|
||
106 | * </li>
|
||
107 | * <li>
|
||
108 | * <b>Table of contents (TOC)</b>: is a list of layers displayed in the view. The TOC is
|
||
109 | * located on the left-top corner of the View and is the place where the user can modify
|
||
110 | * the order, the legends, the visibility and other properties of the layers.
|
||
111 | * </li>
|
||
112 | * <li>
|
||
113 | * <b>Map overview</b>: is a small MapControl located in the left-bottom corner of the
|
||
114 | * View where the user can put some layers which summarizes the view. It is used to make
|
||
115 | * the navigation easier and faster.
|
||
116 | * </li>
|
||
117 | * </ol>
|
||
118 | *
|
||
119 | * @see com.iver.cit.gvsig.fmap.MapControl.java <br>
|
||
120 | * com.iver.cit.gvsig.gui.toc.TOC.java <br>
|
||
121 | * com.iver.cit.gvsig.gui.MapOverview.java <br>
|
||
122 | * @author vcn
|
||
123 | */
|
||
124 | 7392 | sbayarri | public class View extends BaseView { |
125 | 7304 | caballero | |
126 | /** DOCUMENT ME! */
|
||
127 | 7392 | sbayarri | |
128 | private JConsole console;
|
||
129 | 7304 | caballero | private JDockPanel dockConsole = null; |
130 | protected ResponseAdapter consoleResponseAdapter = new ResponseAdapter(); |
||
131 | protected boolean isShowConsole=false; |
||
132 | /**
|
||
133 | * Creates a new View object.
|
||
134 | */
|
||
135 | public View() { |
||
136 | this.setName("View"); |
||
137 | //this.setName(Utilities.getMessage(this, "Vista")+ " : "+modelo.getName());
|
||
138 | // this.setPreferredSize(new Dimension(500, 300));
|
||
139 | initComponents(); |
||
140 | hideConsole(); |
||
141 | getConsolePanel().addResponseListener(consoleResponseAdapter); |
||
142 | /* getConsolePanel().addContainerListener(new ContainerAdapter() {
|
||
143 | public void componentAdded(ContainerEvent e) {
|
||
144 | // Mostramos consola
|
||
145 | SwingUtilities.invokeLater(new Runnable() {
|
||
146 | public void run() {
|
||
147 | |||
148 | getMapControl().doLayout(); // drawMap(false);
|
||
149 | getConsolePanel().invalidate();
|
||
150 | getConsolePanel().repaint();
|
||
151 | getMapControl().repaint();
|
||
152 | getConsolePanel().getTxt().doLayout();
|
||
153 | }
|
||
154 | });
|
||
155 | }
|
||
156 | |||
157 | public void componentRemoved(ContainerEvent e) {
|
||
158 | // Ocultamos consola
|
||
159 | SwingUtilities.invokeLater(new Runnable() {
|
||
160 | public void run() {
|
||
161 | getMapControl().repaint();
|
||
162 | }
|
||
163 | });
|
||
164 | |||
165 | }
|
||
166 | |||
167 | }); */
|
||
168 | } |
||
169 | |||
170 | /**
|
||
171 | * DOCUMENT ME!
|
||
172 | *
|
||
173 | * @param model DOCUMENT ME!
|
||
174 | */
|
||
175 | public void setModel(ProjectView model) { |
||
176 | this.modelo = model;
|
||
177 | //Se registra como listener de cambios en FMap
|
||
178 | MapContext fmap = modelo.getMapContext(); |
||
179 | |||
180 | FLayers layers=fmap.getLayers(); |
||
181 | for (int i=0;i<layers.getLayersCount();i++){ |
||
182 | if (layers.getLayer(i).isEditing() && layers.getLayer(i) instanceof FLyrVect){ |
||
183 | this.showConsole();
|
||
184 | } |
||
185 | } |
||
186 | |||
187 | //Se configura el mapControl
|
||
188 | m_MapControl.setMapContext(fmap); |
||
189 | m_TOC.setMapContext(fmap); |
||
190 | m_MapControl.setBackground(new Color(255, 255, 255)); |
||
191 | if (modelo.getMapOverViewContext()!=null){ |
||
192 | m_MapLoc.setModel(modelo.getMapOverViewContext()); |
||
193 | } |
||
194 | model.addPropertyChangeListener(new PropertyChangeListener() { |
||
195 | public void propertyChange(PropertyChangeEvent evt) { |
||
196 | if (evt.getPropertyName().equals("name")){ |
||
197 | PluginServices.getMDIManager().getWindowInfo(View.this).setTitle("Vista: " + (String)evt.getNewValue()); |
||
198 | } |
||
199 | } |
||
200 | }); |
||
201 | if (m_MapControl.getViewPort() != null){ |
||
202 | m_MapControl.getViewPort().addViewPortListener(new ViewPortListener() {
|
||
203 | public void extentChanged(ExtentEvent e) { |
||
204 | if (PluginServices.getMainFrame() != null){ |
||
205 | PluginServices.getMainFrame().getStatusBar().setControlValue("scale",String.valueOf(m_MapControl.getMapContext().getScaleView())); |
||
206 | PluginServices.getMainFrame().getStatusBar().setMessage("projection", getMapControl().getViewPort().getProjection().getAbrev());
|
||
207 | } |
||
208 | } |
||
209 | |||
210 | public void backColorChanged(ColorEvent e) { |
||
211 | } |
||
212 | |||
213 | public void projectionChanged(ProjectionEvent e) { |
||
214 | m_MapLoc.setProjection(e.getNewProjection()); |
||
215 | } |
||
216 | }); |
||
217 | } |
||
218 | } |
||
219 | public JConsole getConsolePanel(){
|
||
220 | if (console==null){ |
||
221 | console=new JConsole();
|
||
222 | // Para distinguir cuando se est? escribiendo sobre la consola y cuando no.
|
||
223 | console.setJTextName("CADConsole");
|
||
224 | } |
||
225 | return console;
|
||
226 | } |
||
227 | |||
228 | private JDockPanel getDockConsole()
|
||
229 | { |
||
230 | if (dockConsole == null) |
||
231 | { |
||
232 | dockConsole = new JDockPanel(getConsolePanel());
|
||
233 | } |
||
234 | return dockConsole;
|
||
235 | } |
||
236 | |||
237 | |||
238 | public void addConsoleListener(String prefix, ResponseListener listener) { |
||
239 | consoleResponseAdapter.putSpaceListener(prefix, listener); |
||
240 | |||
241 | } |
||
242 | |||
243 | public void removeConsoleListener(ResponseListener listener) { |
||
244 | consoleResponseAdapter.deleteListener(listener); |
||
245 | |||
246 | } |
||
247 | |||
248 | public void focusConsole(String text) { |
||
249 | getConsolePanel().addResponseText(text); |
||
250 | // TODO: HACE ESTO CON EL KEYBOARDFOCUSMANAGER
|
||
251 | // KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
|
||
252 | // kfm.focusNextComponent(getConsolePanel());
|
||
253 | System.err.println("Asigno el foco a la consola"); |
||
254 | |||
255 | JEditTextArea jeta=getConsolePanel().getTxt(); |
||
256 | jeta.requestFocusInWindow(); |
||
257 | jeta.setCaretPosition(jeta.getText().length()); |
||
258 | |||
259 | |||
260 | // FocusManager fm=FocusManager.getCurrentManager();
|
||
261 | // fm.focusNextComponent(getConsolePanel());
|
||
262 | |||
263 | } |
||
264 | |||
265 | |||
266 | public void hideConsole() { |
||
267 | isShowConsole=false;
|
||
268 | /* removeAll();
|
||
269 | //JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||
270 | JSplitPane tempMainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||
271 | tempMainSplit.setPreferredSize(new Dimension(500, 300));
|
||
272 | if (!isPalette()){
|
||
273 | JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||
274 | tempSplitToc.setTopComponent((TOC) m_TOC);
|
||
275 | tempSplitToc.setBottomComponent(m_MapLoc);
|
||
276 | tempSplitToc.setResizeWeight(0.7);
|
||
277 | tempMainSplit.setLeftComponent(tempSplitToc);
|
||
278 | }else{
|
||
279 | tempMainSplit.setLeftComponent(m_TOC);
|
||
280 | }
|
||
281 | m_TOC.setVisible(true);
|
||
282 | tempMainSplit.setRightComponent(m_MapControl);
|
||
283 | //split.setBottomComponent(getConsolePanel());
|
||
284 | //split.setTopComponent(tempMainSplit);
|
||
285 | // split.setResizeWeight(0.9);
|
||
286 | this.setLayout(new BorderLayout());
|
||
287 | this.add(tempMainSplit, BorderLayout.CENTER); */
|
||
288 | getDockConsole().setVisible(false);
|
||
289 | |||
290 | } |
||
291 | |||
292 | public void showConsole() { |
||
293 | if (isShowConsole)
|
||
294 | return;
|
||
295 | isShowConsole=true;
|
||
296 | /* removeAll();
|
||
297 | JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||
298 | JSplitPane tempMainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||
299 | tempMainSplit.setPreferredSize(new Dimension(500, 300));
|
||
300 | if (!isPalette()){
|
||
301 | JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||
302 | tempSplitToc.setTopComponent((TOC) m_TOC);
|
||
303 | tempSplitToc.setBottomComponent(m_MapLoc);
|
||
304 | tempSplitToc.setResizeWeight(0.7);
|
||
305 | tempMainSplit.setLeftComponent(tempSplitToc);
|
||
306 | }else{
|
||
307 | tempMainSplit.setLeftComponent(m_TOC);
|
||
308 | }
|
||
309 | m_TOC.setVisible(true);
|
||
310 | tempMainSplit.setRightComponent(m_MapControl);
|
||
311 | split.setBottomComponent(getConsolePanel());
|
||
312 | split.setTopComponent(tempMainSplit);
|
||
313 | split.setResizeWeight(0.9);
|
||
314 | this.setLayout(new BorderLayout());
|
||
315 | this.add(split, BorderLayout.CENTER); */
|
||
316 | getMapControl().remove(getDockConsole()); |
||
317 | // getConsolePanel().setPreferredSize(new Dimension(200, 150));
|
||
318 | getMapControl().setLayout(new BorderLayout()); |
||
319 | getMapControl().add(getDockConsole(), BorderLayout.SOUTH);
|
||
320 | getDockConsole().setVisible(true);
|
||
321 | |||
322 | } |
||
323 | |||
324 | private class ResponseAdapter implements ResponseListener{ |
||
325 | |||
326 | private HashMap spaceListener = new HashMap(); |
||
327 | |||
328 | public void putSpaceListener(String namespace, ResponseListener listener){ |
||
329 | spaceListener.put(namespace, listener); |
||
330 | } |
||
331 | |||
332 | /**
|
||
333 | * @see com.iver.utiles.console.ResponseListener#acceptResponse(java.lang.String)
|
||
334 | */
|
||
335 | public void acceptResponse(String response) { |
||
336 | boolean nameSpace = false; |
||
337 | int n = -1; |
||
338 | if (response != null){ |
||
339 | if ((n = response.indexOf(':')) != -1){ |
||
340 | nameSpace = true;
|
||
341 | } |
||
342 | } |
||
343 | |||
344 | if (nameSpace){
|
||
345 | ResponseListener listener = (ResponseListener) spaceListener.get(response.substring(0, n));
|
||
346 | if (listener != null) |
||
347 | listener.acceptResponse(response.substring(n+1));
|
||
348 | }else{
|
||
349 | Iterator i = spaceListener.values().iterator();
|
||
350 | while (i.hasNext()) {
|
||
351 | ResponseListener listener = (ResponseListener) i.next(); |
||
352 | listener.acceptResponse(response); |
||
353 | } |
||
354 | } |
||
355 | } |
||
356 | |||
357 | /**
|
||
358 | * @param listener
|
||
359 | */
|
||
360 | public void deleteListener(ResponseListener listener) { |
||
361 | Iterator i = spaceListener.keySet().iterator();
|
||
362 | while (i.hasNext()) {
|
||
363 | String namespace = (String) i.next(); |
||
364 | ResponseListener l = (ResponseListener) spaceListener.get(namespace); |
||
365 | if (l == listener){
|
||
366 | spaceListener.remove(namespace); |
||
367 | } |
||
368 | } |
||
369 | } |
||
370 | |||
371 | } |
||
372 | |||
373 | |||
374 | |||
375 | |||
376 | /**
|
||
377 | * DOCUMENT ME!
|
||
378 | */
|
||
379 | protected void initComponents() { // GEN-BEGIN:initComponents |
||
380 | m_MapControl = new MapControl(); // Default is paintEnabled = false. |
||
381 | // Remember to activate it
|
||
382 | m_MapControl.addExceptionListener(mapControlExceptionListener); |
||
383 | // modelo.setMapContext(m_MapControl.getMapContext());
|
||
384 | |||
385 | // m_MapControl.setAcceptEvents(true); Lo comento porque ya se hace en el setModel
|
||
386 | m_TOC = new TOC();
|
||
387 | |||
388 | |||
389 | // Ponemos el localizador
|
||
390 | m_MapLoc = new MapOverview(m_MapControl);
|
||
391 | m_MapLoc.setPreferredSize(new Dimension(150, 200)); |
||
392 | removeAll(); |
||
393 | //JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||
394 | tempMainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); |
||
395 | tempMainSplit.setPreferredSize(new Dimension(500, 300)); |
||
396 | if (!isPalette()){
|
||
397 | JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
||
398 | tempSplitToc.setTopComponent(m_TOC); |
||
399 | tempSplitToc.setBottomComponent(m_MapLoc); |
||
400 | tempSplitToc.setResizeWeight(0.7);
|
||
401 | tempMainSplit.setLeftComponent(tempSplitToc); |
||
402 | }else{
|
||
403 | tempMainSplit.setLeftComponent(m_TOC); |
||
404 | } |
||
405 | m_TOC.setVisible(true);
|
||
406 | tempMainSplit.setRightComponent(m_MapControl); |
||
407 | //split.setBottomComponent(getConsolePanel());
|
||
408 | //split.setTopComponent(tempMainSplit);
|
||
409 | // split.setResizeWeight(0.9);
|
||
410 | this.setLayout(new BorderLayout()); |
||
411 | this.add(tempMainSplit, BorderLayout.CENTER); |
||
412 | |||
413 | // hideConsole();
|
||
414 | |||
415 | |||
416 | |||
417 | |||
418 | //Listener de eventos de movimiento que pone las coordenadas del rat?n en la barra de estado
|
||
419 | StatusBarListener sbl = new StatusBarListener(m_MapControl);
|
||
420 | |||
421 | // Zoom out (pinchas y el mapa se centra y te muestra m?s).
|
||
422 | // No es dibujando un rect?ngulo, es solo pinchando.
|
||
423 | |||
424 | ZoomOutListener zol = new ZoomOutListener(m_MapControl);
|
||
425 | m_MapControl.addMapTool("zoomOut", new Behavior[]{new PointBehavior(zol), new MouseMovementBehavior(sbl)}); |
||
426 | |||
427 | // pan
|
||
428 | |||
429 | PanListener pl = new PanListener(m_MapControl);
|
||
430 | m_MapControl.addMapTool("pan", new Behavior[]{new MoveBehavior(pl), new MouseMovementBehavior(sbl)}); |
||
431 | |||
432 | // Medir
|
||
433 | |||
434 | MeasureListener mli = new MeasureListener(m_MapControl);
|
||
435 | m_MapControl.addMapTool("medicion", new Behavior[]{new PolylineBehavior(mli), new MouseMovementBehavior(sbl)}); |
||
436 | |||
437 | // Area
|
||
438 | |||
439 | AreaListener ali = new AreaListener(m_MapControl);
|
||
440 | m_MapControl.addMapTool("area", new Behavior[]{new PolygonBehavior(ali), new MouseMovementBehavior(sbl)}); |
||
441 | |||
442 | //Seleccion por punto
|
||
443 | PointSelectListener psl = new PointSelectListener(m_MapControl);
|
||
444 | m_MapControl.addMapTool("pointSelection", new Behavior[]{new PointBehavior(psl), new MouseMovementBehavior(sbl)}); |
||
445 | |||
446 | //Info por punto
|
||
447 | InfoListener il = new InfoListener(m_MapControl);
|
||
448 | m_MapControl.addMapTool("info", new Behavior[]{new PointBehavior(il), new MouseMovementBehavior(sbl)}); |
||
449 | |||
450 | // Link por punto
|
||
451 | LinkListener ll = new LinkListener(m_MapControl);
|
||
452 | m_MapControl.addMapTool("link", new Behavior[]{new PointBehavior(ll), new MouseMovementBehavior(sbl)}); |
||
453 | |||
454 | //Selecci?n por rect?ngulo
|
||
455 | RectangleSelectListener rsl = new RectangleSelectListener(m_MapControl);
|
||
456 | m_MapControl.addMapTool("rectSelection", new Behavior[]{new RectangleBehavior(rsl), new MouseMovementBehavior(sbl)}); |
||
457 | |||
458 | //Selecci?n por pol?gono
|
||
459 | PolygonSelectListener poligSel = new PolygonSelectListener(m_MapControl);
|
||
460 | m_MapControl.addMapTool("polSelection", new Behavior[]{new PolygonBehavior(poligSel), new MouseMovementBehavior(sbl)}); |
||
461 | 7392 | sbayarri | |
462 | 7304 | caballero | // Zoom por rect?ngulo
|
463 | ZoomOutRightButtonListener zoil = new ZoomOutRightButtonListener(m_MapControl);
|
||
464 | ZoomInListener zil = new ZoomInListener(m_MapControl);
|
||
465 | m_MapControl.addMapTool("zoomIn", new Behavior[]{new RectangleBehavior(zil), |
||
466 | new PointBehavior(zoil), new MouseMovementBehavior(sbl)}); |
||
467 | |||
468 | SelectImageListener sil = new SelectImageListener(m_MapControl);
|
||
469 | m_MapControl.addMapTool("selectImage", new Behavior[]{ |
||
470 | new PointBehavior(sil), new MouseMovementBehavior(sbl)}); |
||
471 | |||
472 | ZoomPixelCursorListener zp = new ZoomPixelCursorListener(m_MapControl);
|
||
473 | m_MapControl.addMapTool("zoom_pixel_cursor", new Behavior[]{new PointBehavior(zp), new MouseMovementBehavior(sbl)}); |
||
474 | |||
475 | m_MapControl.setTool("zoomIn"); // Por defecto |
||
476 | // m_MapControl.setPaintEnabled(true);
|
||
477 | } |
||
478 | |||
479 | /**
|
||
480 | * DOCUMENT ME!
|
||
481 | */
|
||
482 | /*public void openPropertiesWindow() {
|
||
483 | }
|
||
484 | */
|
||
485 | /**
|
||
486 | * DOCUMENT ME!
|
||
487 | */
|
||
488 | /* public void openQueryWindow() {
|
||
489 | }
|
||
490 | */
|
||
491 | |||
492 | |||
493 | /**
|
||
494 | * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
||
495 | */
|
||
496 | public void windowActivated() { |
||
497 | PluginServices.getMainFrame().getStatusBar().setMessage("units",
|
||
498 | FConstant.NAMES[getMapControl().getMapContext().getViewPort().getDistanceUnits()]); |
||
499 | PluginServices.getMainFrame().getStatusBar().setControlValue("scale",String.valueOf(m_MapControl.getMapContext().getScaleView())); |
||
500 | PluginServices.getMainFrame().getStatusBar().setMessage("projection", getMapControl().getViewPort().getProjection().getAbrev());
|
||
501 | } |
||
502 | |||
503 | public void toPalette() { |
||
504 | isPalette=true;
|
||
505 | m_MapLoc.setPreferredSize(new Dimension(200,150)); |
||
506 | m_MapLoc.setSize(new Dimension(200,150)); |
||
507 | 7571 | caballero | movp=new MapOverViewPalette(m_MapLoc,this); |
508 | 7304 | caballero | PluginServices.getMDIManager().addWindow(movp); |
509 | FLayer[] layers=getModel().getMapContext().getLayers().getActives();
|
||
510 | if (layers.length>0 && layers[0] instanceof FLyrVect){ |
||
511 | if (((FLyrVect)layers[0]).isEditing()){ |
||
512 | showConsole(); |
||
513 | return;
|
||
514 | } |
||
515 | } |
||
516 | hideConsole(); |
||
517 | |||
518 | } |
||
519 | |||
520 | public void restore() { |
||
521 | isPalette=false;
|
||
522 | PluginServices.getMDIManager().closeWindow(movp); |
||
523 | FLayer[] layers=getModel().getMapContext().getLayers().getActives();
|
||
524 | if (layers.length>0 && layers[0] instanceof FLyrVect){ |
||
525 | if (((FLyrVect)layers[0]).isEditing()){ |
||
526 | showConsole(); |
||
527 | return;
|
||
528 | } |
||
529 | } |
||
530 | hideConsole(); |
||
531 | JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT); |
||
532 | tempSplitToc.setTopComponent(m_TOC); |
||
533 | tempSplitToc.setBottomComponent(m_MapLoc); |
||
534 | tempSplitToc.setResizeWeight(0.7);
|
||
535 | tempMainSplit.setLeftComponent(tempSplitToc); |
||
536 | } |
||
537 | |||
538 | } |