svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutControls.java @ 1103
History | View | Annotate | Download (5.6 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 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package com.iver.cit.gvsig; |
48 |
|
49 |
import org.apache.log4j.Logger; |
50 |
|
51 |
import com.iver.andami.PluginServices; |
52 |
import com.iver.andami.plugins.Extension; |
53 |
import com.iver.andami.ui.mdiManager.View; |
54 |
import com.iver.cit.gvsig.fmap.DriverException; |
55 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
56 |
import com.iver.cit.gvsig.gui.layout.FLayoutZooms; |
57 |
import com.iver.cit.gvsig.gui.layout.Layout; |
58 |
|
59 |
|
60 |
/**
|
61 |
* DOCUMENT ME!
|
62 |
*
|
63 |
* @author Vicente Caballero Navarro
|
64 |
*/
|
65 |
public class LayoutControls implements Extension { |
66 |
private static Logger logger = Logger.getLogger(LayoutControls.class.getName()); |
67 |
private Layout layout=null; |
68 |
/**
|
69 |
* DOCUMENT ME!
|
70 |
*
|
71 |
* @param status DOCUMENT ME!
|
72 |
* @param s DOCUMENT ME!
|
73 |
*/
|
74 |
public void execute(String s) { |
75 |
layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
76 |
FLayoutZooms zooms = new FLayoutZooms(layout);
|
77 |
logger.debug("Comand : " + s);
|
78 |
|
79 |
|
80 |
if (s.compareTo("PAN") == 0) { |
81 |
layout.setTool(Layout.PAN); |
82 |
} else if (s.compareTo("ZOOM_IN") == 0) { |
83 |
layout.setTool(Layout.ZOOM_MAS); |
84 |
} else if (s.compareTo("ZOOM_OUT") == 0) { |
85 |
layout.setTool(Layout.ZOOM_MENOS); |
86 |
} else if (s.compareTo("RECTANGLEVIEW") == 0) { |
87 |
layout.setTool(Layout.RECTANGLEVIEW); |
88 |
} else if (s.compareTo("RECTANGLEPICTURE") == 0) { |
89 |
layout.setTool(Layout.RECTANGLEPICTURE); |
90 |
} else if (s.compareTo("RECTANGLESCALEBAR") == 0) { |
91 |
layout.setTool(Layout.RECTANGLESCALEBAR); |
92 |
} else if (s.compareTo("RECTANGLELEGEND") == 0) { |
93 |
layout.setTool(Layout.RECTANGLELEGEND); |
94 |
} else if (s.compareTo("RECTANGLETEXT") == 0) { |
95 |
layout.setTool(Layout.RECTANGLETEXT); |
96 |
} else if (s.compareTo("SELECT") == 0) { |
97 |
layout.setTool(Layout.SELECT); |
98 |
} else if (s.compareTo("POINT") == 0) { |
99 |
layout.setTool(Layout.POINT); |
100 |
} else if (s.compareTo("LINE") == 0) { |
101 |
layout.setTool(Layout.LINE); |
102 |
} else if (s.compareTo("POLYLINE") == 0) { |
103 |
layout.setTool(Layout.POLYLINE); |
104 |
} else if (s.compareTo("CIRCLE") == 0) { |
105 |
layout.setTool(Layout.CIRCLE); |
106 |
} else if (s.compareTo("RECTANGLESIMPLE") == 0) { |
107 |
layout.setTool(Layout.RECTANGLESIMPLE); |
108 |
} else if (s.compareTo("POLYGON") == 0) { |
109 |
layout.setTool(Layout.POLYGON); |
110 |
} else if (s.compareTo("CONFIG") == 0) { |
111 |
layout.showFConfig(); |
112 |
} else if (s.compareTo("PROPERTIES") == 0) { |
113 |
layout.showFProperties(); |
114 |
} else if (s.compareTo("FULL") == 0) { |
115 |
layout.fullRect(); |
116 |
} else if (s.compareTo("REALZOOM") == 0) { |
117 |
zooms.realZoom(); |
118 |
} else if (s.compareTo("ZOOMOUT") == 0) { |
119 |
zooms.zoomOut(); |
120 |
} else if (s.compareTo("ZOOMIN") == 0) { |
121 |
zooms.zoomIn(); |
122 |
} else if (s.compareTo("ZOOMSELECT") == 0) { |
123 |
zooms.zoomSelect(); |
124 |
} else if (s.compareTo("VIEW_ZOOMIN") == 0) { |
125 |
layout.setTool(Layout.VIEW_ZOOMIN); |
126 |
} else if (s.compareTo("VIEW_ZOOMOUT") == 0) { |
127 |
layout.setTool(Layout.VIEW_ZOOMOUT); |
128 |
} else if (s.compareTo("VIEW_FULL") == 0) { |
129 |
try {
|
130 |
layout.viewFull(); |
131 |
} catch (DriverException e) {
|
132 |
//TODO Enviar a Andami
|
133 |
e.printStackTrace(); |
134 |
} |
135 |
} else if (s.compareTo("VIEW_PAN") == 0) { |
136 |
layout.setTool(Layout.VIEW_PAN); |
137 |
}else if (s.compareTo("SET_TAG") == 0) { |
138 |
layout.setTool(Layout.SET_TAG); |
139 |
} |
140 |
} |
141 |
|
142 |
/**
|
143 |
* @see com.iver.mdiApp.plugins.Extension#isVisible()
|
144 |
*/
|
145 |
public boolean isVisible() { |
146 |
View f = PluginServices.getMDIManager().getActiveView();
|
147 |
|
148 |
if (f == null) { |
149 |
return false; |
150 |
} |
151 |
|
152 |
if (f.getClass() == Layout.class) {
|
153 |
Layout layout = (Layout) f; |
154 |
|
155 |
return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0; |
156 |
} else {
|
157 |
return false; |
158 |
} |
159 |
} |
160 |
|
161 |
/**
|
162 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
163 |
*/
|
164 |
public void inicializar() { |
165 |
} |
166 |
|
167 |
/**
|
168 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
169 |
*/
|
170 |
public boolean isEnabled() { |
171 |
return true; |
172 |
} |
173 |
public Layout getLayout(){
|
174 |
return layout;
|
175 |
|
176 |
} |
177 |
} |