svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutControls.java @ 1219
History | View | Annotate | Download (5.12 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 com.iver.andami.PluginServices; |
50 |
import com.iver.andami.plugins.Extension; |
51 |
import com.iver.andami.ui.mdiManager.View; |
52 |
|
53 |
import com.iver.cit.gvsig.fmap.DriverException; |
54 |
import com.iver.cit.gvsig.gui.layout.FLayoutZooms; |
55 |
import com.iver.cit.gvsig.gui.layout.Layout; |
56 |
|
57 |
import org.apache.log4j.Logger; |
58 |
|
59 |
|
60 |
/**
|
61 |
* Extensi?n para controlar las operaciones basicas sobre el Layout.
|
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 |
/**
|
70 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
71 |
*/
|
72 |
public void execute(String s) { |
73 |
layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
74 |
|
75 |
FLayoutZooms zooms = new FLayoutZooms(layout);
|
76 |
logger.debug("Comand : " + s);
|
77 |
|
78 |
if (s.compareTo("PAN") == 0) { |
79 |
layout.setTool(Layout.PAN); |
80 |
} else if (s.compareTo("ZOOM_IN") == 0) { |
81 |
layout.setTool(Layout.ZOOM_MAS); |
82 |
} else if (s.compareTo("ZOOM_OUT") == 0) { |
83 |
layout.setTool(Layout.ZOOM_MENOS); |
84 |
} else if (s.compareTo("RECTANGLEVIEW") == 0) { |
85 |
layout.setTool(Layout.RECTANGLEVIEW); |
86 |
} else if (s.compareTo("RECTANGLEPICTURE") == 0) { |
87 |
layout.setTool(Layout.RECTANGLEPICTURE); |
88 |
} else if (s.compareTo("RECTANGLESCALEBAR") == 0) { |
89 |
layout.setTool(Layout.RECTANGLESCALEBAR); |
90 |
} else if (s.compareTo("RECTANGLELEGEND") == 0) { |
91 |
layout.setTool(Layout.RECTANGLELEGEND); |
92 |
} else if (s.compareTo("RECTANGLETEXT") == 0) { |
93 |
layout.setTool(Layout.RECTANGLETEXT); |
94 |
} else if (s.compareTo("SELECT") == 0) { |
95 |
layout.setTool(Layout.SELECT); |
96 |
} else if (s.compareTo("POINT") == 0) { |
97 |
layout.setTool(Layout.POINT); |
98 |
} else if (s.compareTo("LINE") == 0) { |
99 |
layout.setTool(Layout.LINE); |
100 |
} else if (s.compareTo("POLYLINE") == 0) { |
101 |
layout.setTool(Layout.POLYLINE); |
102 |
} else if (s.compareTo("CIRCLE") == 0) { |
103 |
layout.setTool(Layout.CIRCLE); |
104 |
} else if (s.compareTo("RECTANGLESIMPLE") == 0) { |
105 |
layout.setTool(Layout.RECTANGLESIMPLE); |
106 |
} else if (s.compareTo("POLYGON") == 0) { |
107 |
layout.setTool(Layout.POLYGON); |
108 |
} else if (s.compareTo("CONFIG") == 0) { |
109 |
layout.showFConfig(); |
110 |
} else if (s.compareTo("PROPERTIES") == 0) { |
111 |
layout.showFProperties(); |
112 |
} else if (s.compareTo("FULL") == 0) { |
113 |
layout.fullRect(); |
114 |
} else if (s.compareTo("REALZOOM") == 0) { |
115 |
zooms.realZoom(); |
116 |
} else if (s.compareTo("ZOOMOUT") == 0) { |
117 |
zooms.zoomOut(); |
118 |
} else if (s.compareTo("ZOOMIN") == 0) { |
119 |
zooms.zoomIn(); |
120 |
} else if (s.compareTo("ZOOMSELECT") == 0) { |
121 |
zooms.zoomSelect(); |
122 |
} else if (s.compareTo("VIEW_ZOOMIN") == 0) { |
123 |
layout.setTool(Layout.VIEW_ZOOMIN); |
124 |
} else if (s.compareTo("VIEW_ZOOMOUT") == 0) { |
125 |
layout.setTool(Layout.VIEW_ZOOMOUT); |
126 |
} else if (s.compareTo("VIEW_FULL") == 0) { |
127 |
try {
|
128 |
layout.viewFull(); |
129 |
} catch (DriverException e) {
|
130 |
//TODO Enviar a Andami
|
131 |
e.printStackTrace(); |
132 |
} |
133 |
} else if (s.compareTo("VIEW_PAN") == 0) { |
134 |
layout.setTool(Layout.VIEW_PAN); |
135 |
} else if (s.compareTo("SET_TAG") == 0) { |
136 |
layout.setTool(Layout.SET_TAG); |
137 |
} |
138 |
} |
139 |
|
140 |
/**
|
141 |
* @see com.iver.mdiApp.plugins.Extension#isVisible()
|
142 |
*/
|
143 |
public boolean isVisible() { |
144 |
View f = PluginServices.getMDIManager().getActiveView();
|
145 |
|
146 |
if (f == null) { |
147 |
return false; |
148 |
} |
149 |
|
150 |
if (f.getClass() == Layout.class) {
|
151 |
Layout layout = (Layout) f; |
152 |
|
153 |
return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0; |
154 |
} else {
|
155 |
return false; |
156 |
} |
157 |
} |
158 |
|
159 |
/**
|
160 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
161 |
*/
|
162 |
public void inicializar() { |
163 |
} |
164 |
|
165 |
/**
|
166 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
167 |
*/
|
168 |
public boolean isEnabled() { |
169 |
return true; |
170 |
} |
171 |
|
172 |
/**
|
173 |
* Devuelve el Layout sobre el que se opera.
|
174 |
*
|
175 |
* @return Layout.
|
176 |
*/
|
177 |
public Layout getLayout() {
|
178 |
return layout;
|
179 |
} |
180 |
} |