Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / view / gui / DefaultViewPanel.java @ 38564

History | View | Annotate | Download (18.6 KB)

1 31496 jjdelcerro
/* gvSIG. Geographic Information System of the Valencian Government
2 36475 cordinyana
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22 31496 jjdelcerro
23
/*
24 36475 cordinyana
 * AUTHORS (In addition to CIT):
25
 * 2004-2009 IVER TI
26
 *
27
 */
28 29596 jpiera
package org.gvsig.app.project.documents.view.gui;
29 7304 caballero
30
import java.awt.BorderLayout;
31
import java.awt.Color;
32
import java.awt.Dimension;
33
import java.beans.PropertyChangeEvent;
34
import java.beans.PropertyChangeListener;
35
import java.util.HashMap;
36
import java.util.Iterator;
37
38
import javax.swing.JSplitPane;
39
40 36641 fdiaz
import org.cresques.cts.IProjection;
41 36722 cordinyana
42 29596 jpiera
import org.gvsig.andami.PluginServices;
43 30337 jpiera
import org.gvsig.andami.messages.NotificationManager;
44 31496 jjdelcerro
import org.gvsig.andami.ui.mdiFrame.NewStatusBar;
45 29596 jpiera
import org.gvsig.andami.ui.mdiManager.WindowInfo;
46 31496 jjdelcerro
import org.gvsig.app.project.DefaultProject;
47
import org.gvsig.app.project.documents.Document;
48 29596 jpiera
import org.gvsig.app.project.documents.view.MapOverview;
49 31496 jjdelcerro
import org.gvsig.app.project.documents.view.ViewDocument;
50 29596 jpiera
import org.gvsig.app.project.documents.view.toc.gui.TOC;
51
import org.gvsig.app.project.documents.view.toolListeners.AreaListener;
52
import org.gvsig.app.project.documents.view.toolListeners.InfoListener;
53
import org.gvsig.app.project.documents.view.toolListeners.MeasureListener;
54
import org.gvsig.app.project.documents.view.toolListeners.PanListener;
55
import org.gvsig.app.project.documents.view.toolListeners.PointSelectListener;
56
import org.gvsig.app.project.documents.view.toolListeners.PolygonSelectListener;
57
import org.gvsig.app.project.documents.view.toolListeners.RectangleSelectListener;
58
import org.gvsig.app.project.documents.view.toolListeners.SelectImageListener;
59
import org.gvsig.app.project.documents.view.toolListeners.StatusBarListener;
60
import org.gvsig.app.project.documents.view.toolListeners.ZoomInListener;
61
import org.gvsig.app.project.documents.view.toolListeners.ZoomOutListener;
62 20994 jmvivo
import org.gvsig.fmap.mapcontext.MapContext;
63
import org.gvsig.fmap.mapcontext.events.ColorEvent;
64
import org.gvsig.fmap.mapcontext.events.ExtentEvent;
65
import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
66
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener;
67
import org.gvsig.fmap.mapcontext.layers.FLayer;
68
import org.gvsig.fmap.mapcontext.layers.FLayers;
69
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
70
import org.gvsig.fmap.mapcontrol.MapControl;
71 30337 jpiera
import org.gvsig.fmap.mapcontrol.MapControlCreationException;
72
import org.gvsig.fmap.mapcontrol.MapControlLocator;
73
import org.gvsig.fmap.mapcontrol.MapControlManager;
74 20994 jmvivo
import org.gvsig.fmap.mapcontrol.tools.ZoomOutRightButtonListener;
75 21743 vcaballero
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
76
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior;
77 36722 cordinyana
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior;
78 21743 vcaballero
import org.gvsig.fmap.mapcontrol.tools.Behavior.MoveBehavior;
79
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
80
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolygonBehavior;
81
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolylineBehavior;
82
import org.gvsig.fmap.mapcontrol.tools.Behavior.RectangleBehavior;
83 29596 jpiera
import org.gvsig.utils.console.JConsole;
84
import org.gvsig.utils.console.JDockPanel;
85
import org.gvsig.utils.console.ResponseListener;
86
import org.gvsig.utils.console.jedit.JEditTextArea;
87 20994 jmvivo
88 7304 caballero
/**
89
 * <p>
90 36475 cordinyana
 * <b>Class View</b>. This class represents the gvSIG specific internal window
91
 * where the maps are displayed and where the events coming from the user are
92
 * captured.
93 7304 caballero
 * </p>
94
 * <p>
95
 * It is composed by three main visual areas:
96
 * </p>
97
 * <ol>
98 36475 cordinyana
 * <li>
99
 * <b>Map control</b>: the map area located in the right area of the window. It
100
 * takes up the biggest part of the window.</li>
101
 * <li>
102
 * <b>Table of contents (TOC)</b>: is a list of layers displayed in the view.
103
 * The TOC is located on the left-top corner of the View and is the place where
104
 * the user can modify the order, the legends, the visibility and other
105
 * properties of the layers.</li>
106
 * <li>
107
 * <b>Map overview</b>: is a small MapControl located in the left-bottom corner
108
 * of the View where the user can put some layers which summarizes the view. It
109
 * is used to make the navigation easier and faster.</li>
110 7304 caballero
 * </ol>
111 31496 jjdelcerro
 *
112 36475 cordinyana
 * @author 2005- Vicente Caballero
113
 * @author 2009- Joaquin del Cerro
114
 *
115 7304 caballero
 */
116 31496 jjdelcerro
public class DefaultViewPanel extends AbstractViewPanel {
117 36641 fdiaz
        /**
118 31496 jjdelcerro
         *
119
         */
120 36641 fdiaz
        private static final long serialVersionUID = -4044661458841786519L;
121 36475 cordinyana
122 36641 fdiaz
        private JConsole console;
123
        private JDockPanel dockConsole = null;
124
        protected ResponseAdapter consoleResponseAdapter = new ResponseAdapter();
125
        protected boolean isShowConsole = false;
126
        private ViewPortListener viewPortListener;
127
        private static MapControlManager mapControlManager = MapControlLocator
128
                        .getMapControlManager();
129 31496 jjdelcerro
130 36641 fdiaz
        /**
131
         * Creates a new View object. Before being used, the object must be
132
         * initialized.
133
         *
134
         * @see initialize()
135
         */
136
        public DefaultViewPanel() {
137
                super();
138
                this.setName("View");
139
                // TODO Remove this when the system lo load libraries is finished
140
                if (mapControlManager == null) {
141
                        mapControlManager = MapControlLocator.getMapControlManager();
142
                }
143
        }
144 10839 caballero
145 36641 fdiaz
        public DefaultViewPanel(Document document) {
146
                this();
147
                this.initialize();
148
                this.setDocument(document);
149
        }
150 36475 cordinyana
151 36641 fdiaz
        /**
152 9044 cesar
     * Create the internal componentes and populate the window with them.
153
     * If the layout properties were set using the
154 36641 fdiaz
         * <code>setWindowData(WindowData)</code> method, the window will be
155
         * populated according to this properties.
156
         */
157
        protected void initialize() {
158
                super.initialize();
159
                initComponents();
160
                hideConsole();
161
                getConsolePanel().addResponseListener(consoleResponseAdapter);
162
        }
163 7304 caballero
164 36641 fdiaz
        public void setDocument(Document document) {
165
                setModel((ViewDocument) document);
166
        }
167 36475 cordinyana
168 36641 fdiaz
        public Document getDocument() {
169
                return this.modelo;
170
        }
171 36475 cordinyana
172 36641 fdiaz
        public void setModel(ViewDocument model) {
173
                this.modelo = model;
174
                // Se registra como listener de cambios en FMap
175
                MapContext fmap = modelo.getMapContext();
176 7304 caballero
177 36641 fdiaz
                FLayers layers = fmap.getLayers();
178
                for (int i = 0; i < layers.getLayersCount(); i++) {
179
                        if (layers.getLayer(i).isEditing()
180
                                        && layers.getLayer(i) instanceof FLyrVect) {
181
                                this.showConsole();
182
                        }
183
                }
184 36475 cordinyana
185 36641 fdiaz
                // Se configura el mapControl
186
                m_MapControl.setMapContext(fmap);
187
                m_TOC.setMapContext(fmap);
188
                m_MapControl.getMapContext().getLayers().addLegendListener(m_TOC);
189 21299 vcaballero
190 36641 fdiaz
                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()
198
                                                        .getWindowInfo(DefaultViewPanel.this)
199 36765 cordinyana
                        .setTitle(
200
                            PluginServices.getText(this, "Vista") + ": "
201
                                + (String) evt.getNewValue());
202 36641 fdiaz
                                }
203
                        }
204
                });
205
                if (m_MapControl.getViewPort() != null) {
206
                        viewPortListener = new ViewPortListener() {
207
                                public void extentChanged(ExtentEvent e) {
208
                                        if (PluginServices.getMainFrame() != null) {
209
                                                PluginServices
210
                                                                .getMainFrame()
211
                                                                .getStatusBar()
212
                                                                .setControlValue(
213
                                                                                "scale",
214
                                                                                String.valueOf(m_MapControl
215
                                                                                                .getMapContext().getScaleView()));
216
                                                PluginServices
217
                                                                .getMainFrame()
218
                                                                .getStatusBar()
219
                                                                .setMessage(
220
                                                                                "projection",
221
                                                                                getMapControl().getViewPort()
222
                                                                                                .getProjection().getAbrev());
223
                                        }
224
                                }
225 7304 caballero
226 36641 fdiaz
                                public void backColorChanged(ColorEvent e) {
227
                                        // Do nothing
228
                                }
229 7304 caballero
230 36641 fdiaz
                                public void projectionChanged(ProjectionEvent e) {
231
                                        m_MapLoc.setProjection(e.getNewProjection());
232
                                }
233
                        };
234
                        m_MapControl.getViewPort().addViewPortListener(viewPortListener);
235
                }
236
        }
237 36475 cordinyana
238 36641 fdiaz
        public JConsole getConsolePanel() {
239
                if (console == null) {
240
                        console = new JConsole();
241
                        // Para distinguir cuando se est? escribiendo sobre la consola y
242
                        // cuando no.
243
                        console.setJTextName("CADConsole");
244
                }
245
                return console;
246
        }
247 36475 cordinyana
248 36641 fdiaz
        private JDockPanel getDockConsole() {
249
                if (dockConsole == null) {
250
                        dockConsole = new JDockPanel(getConsolePanel());
251
                }
252
                return dockConsole;
253
        }
254 10839 caballero
255 36641 fdiaz
        public void addConsoleListener(String prefix, ResponseListener listener) {
256
                consoleResponseAdapter.putSpaceListener(prefix, listener);
257 7304 caballero
258 36641 fdiaz
        }
259 7304 caballero
260 36641 fdiaz
        public void removeConsoleListener(ResponseListener listener) {
261
                consoleResponseAdapter.deleteListener(listener);
262 7304 caballero
263 36641 fdiaz
        }
264 7304 caballero
265 36641 fdiaz
        public void focusConsole(String text) {
266
                getConsolePanel().addResponseText(text);
267 7304 caballero
268 36641 fdiaz
                JEditTextArea jeta = getConsolePanel().getTxt();
269
                jeta.requestFocusInWindow();
270
                jeta.setCaretPosition(jeta.getText().length());
271 7304 caballero
272 36641 fdiaz
        }
273 7304 caballero
274 36641 fdiaz
        public void hideConsole() {
275
                isShowConsole = false;
276
                getDockConsole().setVisible(false);
277 7304 caballero
278 36641 fdiaz
        }
279 7304 caballero
280 36641 fdiaz
        public void showConsole() {
281
                if (isShowConsole) {
282
                        return;
283
                }
284
                isShowConsole = true;
285
                getMapControl().remove(getDockConsole());
286
                getMapControl().setLayout(new BorderLayout());
287
                getMapControl().add(getDockConsole(), BorderLayout.SOUTH);
288
                getDockConsole().setVisible(true);
289 7304 caballero
290 36641 fdiaz
        }
291 7304 caballero
292 36641 fdiaz
        static class ResponseAdapter implements ResponseListener {
293 7304 caballero
294 36475 cordinyana
        private HashMap<String, ResponseListener> spaceListener =
295
            new HashMap<String, ResponseListener>();
296 7304 caballero
297 36641 fdiaz
                public void putSpaceListener(String namespace, ResponseListener listener) {
298
                        spaceListener.put(namespace, listener);
299
                }
300 7304 caballero
301 36641 fdiaz
                public void acceptResponse(String response) {
302
                        boolean nameSpace = false;
303
                        int n = -1;
304
                        if (response != null) {
305
                                if ((n = response.indexOf(':')) != -1) {
306
                                        nameSpace = true;
307
                                }
308
                        }
309 7304 caballero
310 36641 fdiaz
                        if (nameSpace) {
311 36475 cordinyana
                ResponseListener listener =
312
                    spaceListener.get(response.substring(0, n));
313 36641 fdiaz
                                if (listener != null) {
314
                                        listener.acceptResponse(response.substring(n + 1));
315
                                }
316
                        } else {
317 36475 cordinyana
                Iterator<ResponseListener> i =
318
                    spaceListener.values().iterator();
319 36641 fdiaz
                                while (i.hasNext()) {
320
                                        ResponseListener listener = i.next();
321
                                        listener.acceptResponse(response);
322
                                }
323
                        }
324
                }
325 7304 caballero
326 36641 fdiaz
                /**
327
                 * @param listener
328
                 */
329
                public void deleteListener(ResponseListener listener) {
330
                        Iterator<String> i = spaceListener.keySet().iterator();
331
                        while (i.hasNext()) {
332
                                String namespace = i.next();
333
                                ResponseListener l = spaceListener.get(namespace);
334
                                if (l == listener) {
335
                                        spaceListener.remove(namespace);
336
                                }
337
                        }
338
                }
339 7304 caballero
340 36641 fdiaz
        }
341 7304 caballero
342 36641 fdiaz
        protected void initComponents() { // GEN-BEGIN:initComponents
343
                m_MapControl = new MapControl(); // Default is paintEnabled = false.
344
                                                                                        // Remember to activate it
345
                try {
346
                        m_MapControl.setMapControlDrawer(mapControlManager
347
                                        .createDefaultMapControlDrawer());
348
                } catch (MapControlCreationException e) {
349
                        NotificationManager.addError(e);
350
                }
351 36475 cordinyana
352 36641 fdiaz
                m_MapControl.addExceptionListener(mapControlExceptionListener);
353
                m_TOC = new TOC();
354 7304 caballero
355 36641 fdiaz
                // Ponemos el localizador
356
                m_MapLoc = new MapOverview(m_MapControl);
357
                try {
358
                        m_MapLoc.setMapControlDrawer(mapControlManager
359
                                        .createDefaultMapControlDrawer());
360
                } catch (MapControlCreationException e) {
361
                        NotificationManager.addError(e);
362
                }
363
                removeAll();
364
                tempMainSplit = new ViewSplitPane(JSplitPane.HORIZONTAL_SPLIT);
365 9044 cesar
366 36641 fdiaz
                if (windowLayout == null) {
367
                        m_MapLoc.setPreferredSize(new Dimension(150, 200));
368
                        tempMainSplit.setPreferredSize(new Dimension(500, 300));
369
                }
370 10839 caballero
371 36641 fdiaz
                if (!isPalette()) {
372
                        tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
373
                        tempSplitToc.setTopComponent(m_TOC);
374
                        tempSplitToc.setBottomComponent(m_MapLoc);
375
                        tempSplitToc.setResizeWeight(0.7);
376
                        tempMainSplit.setLeftComponent(tempSplitToc);
377
                } else {
378
                        tempMainSplit.setLeftComponent(m_TOC);
379
                }
380
                m_TOC.setVisible(true);
381
                tempMainSplit.setRightComponent(m_MapControl);
382
                this.setLayout(new BorderLayout());
383
                this.add(tempMainSplit, BorderLayout.CENTER);
384 7304 caballero
385 36641 fdiaz
                if (windowLayout != null) {
386
                        try {
387
                                tempMainSplit.setDividerLocation(Integer.valueOf(
388
                                                windowLayout.get("MainDivider.Location")).intValue());
389
                                if (windowLayout.get("TOCDivider.Location") != null) {
390 36475 cordinyana
                    tempSplitToc.setDividerLocation(Integer.valueOf(
391
                        windowLayout.get("TOCDivider.Location")).intValue());
392 36641 fdiaz
                                }
393
                        } catch (NumberFormatException ex) {
394
                                PluginServices.getLogger().error(
395
                                                "Error restoring View properties");
396
                        }
397
                }
398 10839 caballero
399 36641 fdiaz
                // Listener de eventos de movimiento que pone las coordenadas del rat?n
400
                // en la barra de estado
401
                StatusBarListener sbl = new StatusBarListener(m_MapControl);
402 7304 caballero
403 36641 fdiaz
                // Zoom out (pinchas y el mapa se centra y te muestra m?s).
404
                // No es dibujando un rect?ngulo, es solo pinchando.
405 7304 caballero
406 36641 fdiaz
                ZoomOutListener zol = new ZoomOutListener(m_MapControl);
407 36722 cordinyana
408 36641 fdiaz
                m_MapControl.addBehavior("zoomOut", new Behavior[] {
409 36722 cordinyana
            new PointBehavior(zol), new MouseMovementBehavior(sbl) });
410 7304 caballero
411 36641 fdiaz
                // pan
412 7304 caballero
413 36641 fdiaz
                PanListener pl = new PanListener(m_MapControl);
414
                m_MapControl.addBehavior("pan", new Behavior[] { new MoveBehavior(pl),
415 36722 cordinyana
            new MouseMovementBehavior(sbl) });
416 7304 caballero
417 36641 fdiaz
                // Medir
418 7304 caballero
419 36641 fdiaz
                MeasureListener mli = new MeasureListener(m_MapControl);
420
                m_MapControl.addBehavior("medicion", new Behavior[] {
421 36722 cordinyana
            new PolylineBehavior(mli), new MouseMovementBehavior(sbl) });
422 7304 caballero
423 36641 fdiaz
                // Area
424 7304 caballero
425 36641 fdiaz
                AreaListener ali = new AreaListener(m_MapControl);
426
                m_MapControl.addBehavior("area", new Behavior[] {
427 36722 cordinyana
            new PolygonBehavior(ali), new MouseMovementBehavior(sbl) });
428 7304 caballero
429 36641 fdiaz
                // Seleccion por punto
430
                PointSelectListener psl = new PointSelectListener(m_MapControl);
431
                m_MapControl.addBehavior("pointSelection", new Behavior[] {
432 36722 cordinyana
            new PointBehavior(psl), new MouseMovementBehavior(sbl) });
433 7304 caballero
434 36641 fdiaz
                // Info por punto
435
                InfoListener il = new InfoListener(m_MapControl);
436
                m_MapControl.addBehavior("info", new Behavior[] {
437 36722 cordinyana
            new PointBehavior(il), new MouseMovementBehavior(sbl) });
438 7304 caballero
439 36641 fdiaz
                // Selecci?n por rect?ngulo
440
                RectangleSelectListener rsl = new RectangleSelectListener(m_MapControl);
441
                m_MapControl.addBehavior("rectSelection", new Behavior[] {
442 36722 cordinyana
            new RectangleBehavior(rsl), new MouseMovementBehavior(sbl) });
443 7304 caballero
444 36641 fdiaz
                // Selecci?n por pol?gono
445 36475 cordinyana
        PolygonSelectListener poligSel =
446
            new PolygonSelectListener(m_MapControl);
447
        m_MapControl.addBehavior("polSelection", new Behavior[] {
448
            new PolygonBehavior(poligSel), new MouseMovementBehavior(sbl) });
449 7392 sbayarri
450 36641 fdiaz
                // Zoom por rect?ngulo
451
                ZoomOutRightButtonListener zoil =
452 36475 cordinyana
            new ZoomOutRightButtonListener(m_MapControl);
453 36641 fdiaz
                ZoomInListener zil = new ZoomInListener(m_MapControl);
454
                m_MapControl.addBehavior("zoomIn", new Behavior[] {
455
                                new RectangleBehavior(zil), new PointBehavior(zoil),
456 36722 cordinyana
            new MouseMovementBehavior(sbl) });
457 7304 caballero
458 36641 fdiaz
                SelectImageListener sil = new SelectImageListener(m_MapControl);
459
                m_MapControl.addBehavior("selectImage", new Behavior[] {
460 36722 cordinyana
            new PointBehavior(sil), new MouseMovementBehavior(sbl) });
461 7304 caballero
462 36641 fdiaz
                m_MapControl.setTool("zoomIn"); // Por defecto
463 36722 cordinyana
        m_MapControl.addCombinedBehavior(new MouseWheelBehavior());
464 36641 fdiaz
        }
465 7304 caballero
466 36641 fdiaz
        public void windowActivated() {
467
                NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar();
468
                MapContext mapContext = this.getMapControl().getMapContext();
469 36475 cordinyana
470 36641 fdiaz
                statusbar.setMessage("units",
471
                                PluginServices.getText(this, mapContext.getDistanceName()));
472
                statusbar.setControlValue("scale",
473
                                String.valueOf(mapContext.getScaleView()));
474
                IProjection proj = getMapControl().getViewPort().getProjection();
475
                if (proj != null) {
476
                        statusbar.setMessage("projection", proj.getAbrev());
477
                } else {
478
                        statusbar.setMessage("projection", "");
479
                }
480
        }
481 31496 jjdelcerro
482 36641 fdiaz
        public void windowClosed() {
483
                super.windowClosed();
484
                if (viewPortListener != null) {
485
                        getMapControl().getViewPort().removeViewPortListener(
486
                                        viewPortListener);
487
                }
488
                if (getMapOverview() != null) {
489
                        getMapOverview().getViewPort().removeViewPortListener(
490
                                        getMapOverview());
491
                }
492 10839 caballero
493 36641 fdiaz
        }
494 7304 caballero
495 36641 fdiaz
        public void toPalette() {
496
                isPalette = true;
497
                m_MapLoc.setPreferredSize(new Dimension(200, 150));
498
                m_MapLoc.setSize(new Dimension(200, 150));
499
                movp = new MapOverViewPalette(m_MapLoc, this);
500
                PluginServices.getMDIManager().addWindow(movp);
501 36475 cordinyana
        FLayer[] layers =
502
            getViewDocument().getMapContext().getLayers().getActives();
503 36641 fdiaz
                if (layers.length > 0 && layers[0] instanceof FLyrVect) {
504
                        if (((FLyrVect) layers[0]).isEditing()) {
505
                                showConsole();
506
                                return;
507
                        }
508
                }
509
                hideConsole();
510 7304 caballero
511 36641 fdiaz
        }
512 7304 caballero
513 36641 fdiaz
        public void restore() {
514
                isPalette = false;
515
                PluginServices.getMDIManager().closeWindow(movp);
516 36475 cordinyana
        FLayer[] layers =
517
            getViewDocument().getMapContext().getLayers().getActives();
518 36641 fdiaz
                if (layers.length > 0 && layers[0] instanceof FLyrVect) {
519
                        if (((FLyrVect) layers[0]).isEditing()) {
520
                                showConsole();
521
                                return;
522
                        }
523
                }
524
                hideConsole();
525
                JSplitPane tempSplitToc = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
526
                tempSplitToc.setTopComponent(m_TOC);
527
                tempSplitToc.setBottomComponent(m_MapLoc);
528
                tempSplitToc.setResizeWeight(0.7);
529
                tempMainSplit.setLeftComponent(tempSplitToc);
530
        }
531 7853 jaume
532 36641 fdiaz
        /**
533
         * Sets the default map overview background color that will be used in
534
         * subsequent projects.
535
         *
536
         * @param color
537
         * @deprecated use instead
538
         *             Project.getPreferences().setDefaultMapoverViewBackColor
539
         */
540
        public static void setDefaultMapOverViewBackColor(Color color) {
541
                DefaultProject.getPreferences().setDefaultOverviewBackColor(color);
542
        }
543 7853 jaume
544 36641 fdiaz
        /**
545
         * Returns the current default map overview background color defined which
546
         * is the color defined when the user does not define any other one
547
         *
548
         * @return java.awt.Color
549
         * @deprecated use instead
550
         *             Project.getPreferences().setDefaultMapoverViewBackColor
551
         */
552
        public static Color getDefaultMapOverViewBackColor() {
553
                return DefaultProject.getPreferences().getDefaultOverviewBackColor();
554
        }
555 7853 jaume
556 36641 fdiaz
        /**
557
         * Returns the current default view background color defined which is the
558
         * color defined when the user does not define any other one
559
         *
560
         * @return java.awt.Color
561
         * @deprecated use instead Project.getPreferences().getDefaultViewBackColor
562
         */
563
        public static Color getDefaultBackColor() {
564
                return DefaultProject.getPreferences().getDefaultViewBackColor();
565
        }
566 7853 jaume
567 36641 fdiaz
        /**
568
         * @deprecated use instead Project.getPreferences().setDefaultViewBackColor
569
         */
570
        public static void setDefaultBackColor(Color color) {
571
                DefaultProject.getPreferences().setDefaultViewBackColor(color);
572
        }
573 10839 caballero
574 36641 fdiaz
        public Object getWindowProfile() {
575
                return WindowInfo.EDITOR_PROFILE;
576
        }
577 36475 cordinyana
578 7304 caballero
}