Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutInsertToolsExtension.java @ 9392

History | View | Annotate | Download (4.56 KB)

1
/* 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;
42

    
43
import org.apache.log4j.Logger;
44

    
45
import com.iver.andami.PluginServices;
46
import com.iver.andami.plugins.Extension;
47
import com.iver.andami.ui.mdiManager.IWindow;
48
import com.iver.cit.gvsig.project.documents.layout.FLayoutFunctions;
49
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
50

    
51

    
52
/**
53
 * Extensi?n para editar los v?rtices de las geometr?as a?adidas en un FFrameGraphics.
54
 *
55
 * @author Vicente Caballero Navarro
56
 */
57
public class LayoutInsertToolsExtension extends Extension {
58
    private static Logger logger = Logger.getLogger(LayoutInsertToolsExtension.class.getName());
59
    private Layout layout = null;
60

    
61

    
62
    public void initialize() {
63
                // TODO Auto-generated method stub
64
        }
65

    
66

    
67
    public void execute(String s) {
68
             layout = (Layout) PluginServices.getMDIManager().getActiveWindow();
69

    
70
         logger.debug("Comand : " + s);
71
         boolean insertGroupPosibility=false;
72
        if (s.equals("SELECT")) {
73
             layout.getLayoutControl().setTool("layoutselect");
74
        } else if (s.equals("RECTANGLEVIEW")) {
75
                     layout.getLayoutControl().setTool("layoutaddview");
76
                     insertGroupPosibility=true;
77
             } else if (s.equals("RECTANGLEOVERVIEW")) {
78
                     layout.getLayoutControl().setTool("layoutaddoverview");
79
                     insertGroupPosibility=true;
80
             } else if (s.equals("RECTANGLEPICTURE")) {
81
                     layout.getLayoutControl().setTool("layoutaddpicture");
82
                     insertGroupPosibility=true;
83
             } else if (s.equals("RECTANGLESCALEBAR")) {
84
                     layout.getLayoutControl().setTool("layoutaddscale");
85
                     insertGroupPosibility=true;
86
             } else if (s.equals("RECTANGLELEGEND")) {
87
                     layout.getLayoutControl().setTool("layoutaddlegend");
88
                     insertGroupPosibility=true;
89
             } else if (s.equals("RECTANGLETEXT")) {
90
                     layout.getLayoutControl().setTool("layoutaddtext");
91
                     insertGroupPosibility=true;
92
             } else if (s.equals("RECTANGLENORTH")) {
93
                     layout.getLayoutControl().setTool("layoutaddnorth");
94
                     insertGroupPosibility=true;
95
             } else if (s.equals("RECTANGLEBOX")) {
96
                     layout.getLayoutControl().setTool("layoutaddbox");
97
                     insertGroupPosibility=true;
98
             } else if (s.equals("POINT")) {
99
                     layout.getLayoutControl().setTool("layoutaddpoint");
100
             } else if (s.equals("LINE")) {
101
                     layout.getLayoutControl().setTool("layoutaddline");
102
             } else if (s.equals("POLYLINE")) {
103
                     layout.getLayoutControl().setTool("layoutaddpolyline");
104
             } else if (s.equals("CIRCLE")) {
105
                     layout.getLayoutControl().setTool("layoutaddcircle");
106
             } else if (s.equals("RECTANGLESIMPLE")) {
107
                     layout.getLayoutControl().setTool("layoutaddrectangle");
108
             } else if (s.equals("POLYGON")) {
109
                     layout.getLayoutControl().setTool("layoutaddpolygon");
110
             } else if (s.equals("REMOVE")){
111
                     layout.getLayoutContext().delFFrameSelected();
112
                     layout.getLayoutControl().refresh();
113
             }
114
   }
115

    
116

    
117
    public boolean isEnabled() {
118
            IWindow f = PluginServices.getMDIManager().getActiveWindow();
119

    
120
        if (f == null) {
121
            return false;
122
        }
123

    
124
        if (f instanceof Layout) {
125
            return ((Layout) f).getLayoutContext().isEditable();
126
        }
127

    
128
        return false;
129
        }
130

    
131

    
132
    public boolean isVisible() {
133
                IWindow f = PluginServices.getMDIManager().getActiveWindow();
134

    
135
                if (f == null) {
136
                        return false;
137
                }
138

    
139
                if (f instanceof Layout) {
140
                        return true;
141
                } else {
142
                        return false;
143
                }
144
        }
145
}