root / branches / gvSIG_CAD_Layout_version / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutControls.java @ 1822
History | View | Annotate | Download (5.41 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.fmap.edition.EditionException; |
55 |
import com.iver.cit.gvsig.gui.layout.FLayoutZooms; |
56 |
import com.iver.cit.gvsig.gui.layout.Layout; |
57 |
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame; |
58 |
|
59 |
import org.apache.log4j.Logger; |
60 |
|
61 |
|
62 |
/**
|
63 |
* Extensi?n para controlar las operaciones basicas sobre el Layout.
|
64 |
*
|
65 |
* @author Vicente Caballero Navarro
|
66 |
*/
|
67 |
public class LayoutControls implements Extension { |
68 |
private static Logger logger = Logger.getLogger(LayoutControls.class.getName()); |
69 |
private Layout layout = null; |
70 |
|
71 |
/**
|
72 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
73 |
*/
|
74 |
public void execute(String s) { |
75 |
layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
76 |
|
77 |
FLayoutZooms zooms = new FLayoutZooms(layout);
|
78 |
logger.debug("Comand : " + s);
|
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("CADSELECT") == 0) { |
99 |
layout.setCadTool("selection");
|
100 |
IFFrame[] frames=layout.getFFrames1();
|
101 |
for (int i=0;i<frames.length;i++){ |
102 |
frames[i].setSelected(false);
|
103 |
} |
104 |
} else if (s.compareTo("POINT") == 0) { |
105 |
layout.setCadTool("point");
|
106 |
} else if (s.compareTo("LINE") == 0) { |
107 |
layout.setCadTool("line");
|
108 |
} else if (s.compareTo("POLYLINE") == 0) { |
109 |
layout.setCadTool("polyline");
|
110 |
} else if (s.compareTo("CIRCLE") == 0) { |
111 |
layout.setCadTool("circle");
|
112 |
} else if (s.compareTo("RECTANGLESIMPLE") == 0) { |
113 |
layout.setCadTool("rectangle");
|
114 |
} else if (s.compareTo("POLYGON") == 0) { |
115 |
layout.setCadTool("polygon");
|
116 |
} else if (s.compareTo("CONFIG") == 0) { |
117 |
layout.showFConfig(); |
118 |
} else if (s.compareTo("PROPERTIES") == 0) { |
119 |
layout.showFProperties(); |
120 |
} else if (s.compareTo("FULL") == 0) { |
121 |
layout.fullRect(); |
122 |
} else if (s.compareTo("REALZOOM") == 0) { |
123 |
zooms.realZoom(); |
124 |
} else if (s.compareTo("ZOOMOUT") == 0) { |
125 |
zooms.zoomOut(); |
126 |
} else if (s.compareTo("ZOOMIN") == 0) { |
127 |
zooms.zoomIn(); |
128 |
} else if (s.compareTo("ZOOMSELECT") == 0) { |
129 |
zooms.zoomSelect(); |
130 |
} else if (s.compareTo("VIEW_ZOOMIN") == 0) { |
131 |
layout.setTool(Layout.VIEW_ZOOMIN); |
132 |
} else if (s.compareTo("VIEW_ZOOMOUT") == 0) { |
133 |
layout.setTool(Layout.VIEW_ZOOMOUT); |
134 |
} else if (s.compareTo("VIEW_FULL") == 0) { |
135 |
try {
|
136 |
layout.viewFull(); |
137 |
} catch (DriverException e) {
|
138 |
//TODO Enviar a Andami
|
139 |
e.printStackTrace(); |
140 |
} |
141 |
} else if (s.compareTo("VIEW_PAN") == 0) { |
142 |
layout.setTool(Layout.VIEW_PAN); |
143 |
} else if (s.compareTo("SET_TAG") == 0) { |
144 |
layout.setTool(Layout.SET_TAG); |
145 |
} |
146 |
} |
147 |
|
148 |
/**
|
149 |
* @see com.iver.mdiApp.plugins.Extension#isVisible()
|
150 |
*/
|
151 |
public boolean isVisible() { |
152 |
View f = PluginServices.getMDIManager().getActiveView();
|
153 |
|
154 |
if (f == null) { |
155 |
return false; |
156 |
} |
157 |
|
158 |
if (f.getClass() == Layout.class) {
|
159 |
Layout layout = (Layout) f; |
160 |
|
161 |
return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0; |
162 |
} else {
|
163 |
return false; |
164 |
} |
165 |
} |
166 |
|
167 |
/**
|
168 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
169 |
*/
|
170 |
public void inicializar() { |
171 |
} |
172 |
|
173 |
/**
|
174 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
175 |
*/
|
176 |
public boolean isEnabled() { |
177 |
return true; |
178 |
} |
179 |
|
180 |
/**
|
181 |
* Devuelve el Layout sobre el que se opera.
|
182 |
*
|
183 |
* @return Layout.
|
184 |
*/
|
185 |
public Layout getLayout() {
|
186 |
return layout;
|
187 |
} |
188 |
} |