Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutControls.java @ 596

History | View | Annotate | Download (4.28 KB)

1
/*
2
 * Created on 05-may-2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
package com.iver.cit.gvsig;
8

    
9
import org.apache.log4j.Logger;
10

    
11
import com.iver.andami.PluginServices;
12
import com.iver.andami.plugins.Extension;
13
import com.iver.andami.ui.mdiManager.View;
14
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
15
import com.iver.cit.gvsig.gui.layout.FLayoutZooms;
16
import com.iver.cit.gvsig.gui.layout.Layout;
17

    
18

    
19
/**
20
 * DOCUMENT ME!
21
 *
22
 * @author Vicente Caballero Navarro
23
 */
24
public class LayoutControls implements Extension {
25
    private static Logger logger = Logger.getLogger(LayoutControls.class.getName());
26

    
27
    /**
28
     * DOCUMENT ME!
29
     *
30
     * @param status DOCUMENT ME!
31
     * @param s DOCUMENT ME!
32
     */
33
    public void execute(String s) {
34
        Layout layout = (Layout) PluginServices.getMDIManager().getActiveView();
35
        FLayoutZooms zooms = new FLayoutZooms(layout);
36
        logger.debug("Comand : " + s);
37

    
38
        if (s.compareTo("PAN") == 0) {
39
            layout.setTool(Layout.PAN);
40
        } else if (s.compareTo("ZOOM_IN") == 0) {
41
            layout.setTool(Layout.ZOOM_MAS);
42
        } else if (s.compareTo("ZOOM_OUT") == 0) {
43
            layout.setTool(Layout.ZOOM_MENOS);
44
        } else if (s.compareTo("RECTANGLEVIEW") == 0) {
45
            layout.setTool(Layout.RECTANGLEVIEW);
46
        } else if (s.compareTo("RECTANGLEPICTURE") == 0) {
47
            layout.setTool(Layout.RECTANGLEPICTURE);
48
        } else if (s.compareTo("RECTANGLESCALEBAR") == 0) {
49
            layout.setTool(Layout.RECTANGLESCALEBAR);
50
        } else if (s.compareTo("RECTANGLELEGEND") == 0) {
51
            layout.setTool(Layout.RECTANGLELEGEND);
52
        } else if (s.compareTo("RECTANGLETEXT") == 0) {
53
            layout.setTool(Layout.RECTANGLETEXT);
54
        } else if (s.compareTo("SELECT") == 0) {
55
            layout.setTool(Layout.SELECT);
56
        } else if (s.compareTo("POINT") == 0) {
57
            layout.setTool(Layout.POINT);
58
        } else if (s.compareTo("LINE") == 0) {
59
            layout.setTool(Layout.LINE);
60
        } else if (s.compareTo("POLYLINE") == 0) {
61
            layout.setTool(Layout.POLYLINE);
62
        } else if (s.compareTo("CIRCLE") == 0) {
63
            layout.setTool(Layout.CIRCLE);
64
        } else if (s.compareTo("RECTANGLESIMPLE") == 0) {
65
            layout.setTool(Layout.RECTANGLESIMPLE);
66
        } else if (s.compareTo("POLYGON") == 0) {
67
            layout.setTool(Layout.POLYGON);
68
        } else if (s.compareTo("CONFIG") == 0) {
69
            layout.showFConfig();
70
        } else if (s.compareTo("PROPERTIES") == 0) {
71
            layout.showFProperties();
72
        } else if (s.compareTo("FULL") == 0) {
73
            layout.fullRect();
74
        } else if (s.compareTo("REALZOOM") == 0) {
75
            zooms.realZoom();
76
        } else if (s.compareTo("ZOOMOUT") == 0) {
77
            zooms.zoomOut();
78
        } else if (s.compareTo("ZOOMIN") == 0) {
79
            zooms.zoomIn();
80
        } else if (s.compareTo("ZOOMSELECT") == 0) {
81
            zooms.zoomSelect();
82
        } else if (s.compareTo("VIEW_ZOOMIN") == 0) {
83
            layout.setTool(Layout.VIEW_ZOOMIN);
84
        } else if (s.compareTo("VIEW_ZOOMOUT") == 0) {
85
            layout.setTool(Layout.VIEW_ZOOMOUT);
86
        } else if (s.compareTo("VIEW_FULL") == 0) {
87
            try {
88
                                layout.viewFull();
89
                        } catch (DriverIOException e) {
90
                                //TODO Enviar a Andami
91
                                e.printStackTrace();
92
                        }
93
        } else if (s.compareTo("VIEW_PAN") == 0) {
94
            layout.setTool(Layout.VIEW_PAN);
95
        }else if (s.compareTo("SET_TAG") == 0) {
96
            layout.setTool(Layout.SET_TAG);
97
        }
98
    }
99

    
100
    /**
101
     * @see com.iver.mdiApp.plugins.Extension#isVisible()
102
     */
103
    public boolean isVisible() {
104
        View f = PluginServices.getMDIManager().getActiveView();
105

    
106
        if (f == null) {
107
            return false;
108
        }
109

    
110
        if (f.getClass() == Layout.class) {
111
            Layout layout = (Layout) f;
112

    
113
            return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0;
114
        } else {
115
            return false;
116
        }
117
    }
118

    
119
        /**
120
         * @see com.iver.andami.plugins.Extension#inicializar()
121
         */
122
        public void inicializar() {
123
        }
124

    
125
        /**
126
         * @see com.iver.andami.plugins.Extension#isEnabled()
127
         */
128
        public boolean isEnabled() {
129
                return false;
130
        }
131
}