root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutControls.java @ 2381
History | View | Annotate | Download (4.67 KB)
1 | 312 | fernando | /*
|
---|---|---|---|
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 | 1103 | fjp | /* 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 | 312 | fernando | package com.iver.cit.gvsig; |
48 | |||
49 | 596 | fernando | import com.iver.andami.PluginServices; |
50 | import com.iver.andami.plugins.Extension; |
||
51 | import com.iver.andami.ui.mdiManager.View; |
||
52 | 1219 | vcaballero | |
53 | 312 | fernando | import com.iver.cit.gvsig.gui.layout.FLayoutZooms; |
54 | import com.iver.cit.gvsig.gui.layout.Layout; |
||
55 | |||
56 | 1219 | vcaballero | import org.apache.log4j.Logger; |
57 | 312 | fernando | |
58 | 1219 | vcaballero | |
59 | 312 | fernando | /**
|
60 | 1219 | vcaballero | * Extensi?n para controlar las operaciones basicas sobre el Layout.
|
61 | 312 | fernando | *
|
62 | * @author Vicente Caballero Navarro
|
||
63 | */
|
||
64 | 596 | fernando | public class LayoutControls implements Extension { |
65 | 1219 | vcaballero | private static Logger logger = Logger.getLogger(LayoutControls.class.getName()); |
66 | private Layout layout = null; |
||
67 | |||
68 | /**
|
||
69 | * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
||
70 | */
|
||
71 | public void execute(String s) { |
||
72 | layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
||
73 | |||
74 | FLayoutZooms zooms = new FLayoutZooms(layout);
|
||
75 | logger.debug("Comand : " + s);
|
||
76 | |||
77 | if (s.compareTo("PAN") == 0) { |
||
78 | layout.setTool(Layout.PAN); |
||
79 | } else if (s.compareTo("ZOOM_IN") == 0) { |
||
80 | layout.setTool(Layout.ZOOM_MAS); |
||
81 | } else if (s.compareTo("ZOOM_OUT") == 0) { |
||
82 | layout.setTool(Layout.ZOOM_MENOS); |
||
83 | } else if (s.compareTo("RECTANGLEVIEW") == 0) { |
||
84 | layout.setTool(Layout.RECTANGLEVIEW); |
||
85 | } else if (s.compareTo("RECTANGLEPICTURE") == 0) { |
||
86 | layout.setTool(Layout.RECTANGLEPICTURE); |
||
87 | } else if (s.compareTo("RECTANGLESCALEBAR") == 0) { |
||
88 | layout.setTool(Layout.RECTANGLESCALEBAR); |
||
89 | } else if (s.compareTo("RECTANGLELEGEND") == 0) { |
||
90 | layout.setTool(Layout.RECTANGLELEGEND); |
||
91 | } else if (s.compareTo("RECTANGLETEXT") == 0) { |
||
92 | layout.setTool(Layout.RECTANGLETEXT); |
||
93 | } else if (s.compareTo("SELECT") == 0) { |
||
94 | layout.setTool(Layout.SELECT); |
||
95 | } else if (s.compareTo("POINT") == 0) { |
||
96 | layout.setTool(Layout.POINT); |
||
97 | } else if (s.compareTo("LINE") == 0) { |
||
98 | layout.setTool(Layout.LINE); |
||
99 | } else if (s.compareTo("POLYLINE") == 0) { |
||
100 | layout.setTool(Layout.POLYLINE); |
||
101 | } else if (s.compareTo("CIRCLE") == 0) { |
||
102 | layout.setTool(Layout.CIRCLE); |
||
103 | } else if (s.compareTo("RECTANGLESIMPLE") == 0) { |
||
104 | layout.setTool(Layout.RECTANGLESIMPLE); |
||
105 | } else if (s.compareTo("POLYGON") == 0) { |
||
106 | layout.setTool(Layout.POLYGON); |
||
107 | } else if (s.compareTo("CONFIG") == 0) { |
||
108 | layout.showFConfig(); |
||
109 | 2362 | vcaballero | layout.fullRect(); |
110 | 1219 | vcaballero | } 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 | 2342 | vcaballero | } else if (s.compareTo("PDF")==0){ |
123 | layout.layoutToPDF(); |
||
124 | 1550 | vcaballero | } |
125 | 2342 | vcaballero | |
126 | |||
127 | 1219 | vcaballero | } |
128 | 312 | fernando | |
129 | 1219 | vcaballero | /**
|
130 | * @see com.iver.mdiApp.plugins.Extension#isVisible()
|
||
131 | */
|
||
132 | public boolean isVisible() { |
||
133 | View f = PluginServices.getMDIManager().getActiveView();
|
||
134 | 312 | fernando | |
135 | 1219 | vcaballero | if (f == null) { |
136 | return false; |
||
137 | } |
||
138 | 312 | fernando | |
139 | 1219 | vcaballero | if (f.getClass() == Layout.class) {
|
140 | Layout layout = (Layout) f; |
||
141 | 312 | fernando | |
142 | 1219 | vcaballero | return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0; |
143 | } else {
|
||
144 | return false; |
||
145 | } |
||
146 | } |
||
147 | 596 | fernando | |
148 | /**
|
||
149 | * @see com.iver.andami.plugins.Extension#inicializar()
|
||
150 | */
|
||
151 | public void inicializar() { |
||
152 | } |
||
153 | |||
154 | /**
|
||
155 | * @see com.iver.andami.plugins.Extension#isEnabled()
|
||
156 | */
|
||
157 | public boolean isEnabled() { |
||
158 | 644 | fernando | return true; |
159 | 596 | fernando | } |
160 | 1219 | vcaballero | |
161 | /**
|
||
162 | * Devuelve el Layout sobre el que se opera.
|
||
163 | *
|
||
164 | * @return Layout.
|
||
165 | */
|
||
166 | public Layout getLayout() {
|
||
167 | 677 | vcaballero | return layout;
|
168 | } |
||
169 | 312 | fernando | } |