root / branches / gvSIG_CAD_Layout_version / applications / appgvSIG / src / com / iver / cit / gvsig / GraphicControls.java @ 1822
History | View | Annotate | Download (3.55 KB)
1 |
/*
|
---|---|
2 |
* Created on 15-jul-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 java.io.IOException; |
50 |
|
51 |
import com.iver.andami.PluginServices; |
52 |
import com.iver.andami.plugins.Extension; |
53 |
import com.iver.andami.ui.mdiManager.View; |
54 |
|
55 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
56 |
import com.iver.cit.gvsig.gui.layout.FLayoutGraphics; |
57 |
import com.iver.cit.gvsig.gui.layout.Layout; |
58 |
|
59 |
import org.apache.log4j.Logger; |
60 |
|
61 |
|
62 |
/**
|
63 |
* Extensi?n que actua sobre el Layout para controlar las diferentes
|
64 |
* operaciones sobre los gr?ficos.
|
65 |
*
|
66 |
* @author Vicente Caballero Navarro
|
67 |
*/
|
68 |
public class GraphicControls implements Extension { |
69 |
private static Logger logger = Logger.getLogger(GraphicControls.class.getName()); |
70 |
|
71 |
/**
|
72 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
73 |
*/
|
74 |
public void execute(String s) { |
75 |
Layout layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
76 |
FLayoutGraphics lg = new FLayoutGraphics(layout);
|
77 |
logger.debug("Comand : " + s);
|
78 |
try {
|
79 |
if (s.compareTo("SIMPLIFICAR") == 0) { |
80 |
lg.simplify(); |
81 |
} else if (s.compareTo("AGRUPAR") == 0) { |
82 |
lg.grouping(); |
83 |
} else if (s.compareTo("DESAGRUPAR") == 0) { |
84 |
lg.ungrouping(); |
85 |
} else if (s.compareTo("PROPIEDADES") == 0) { |
86 |
lg.openFFrameDialog(); |
87 |
} else if (s.compareTo("ALINEAR") == 0) { |
88 |
lg.aligning(); |
89 |
} else if (s.compareTo("DETRAS") == 0) { |
90 |
lg.behind(); |
91 |
} else if (s.compareTo("DELANTE") == 0) { |
92 |
lg.before(); |
93 |
} else if (s.compareTo("BORDEAR") == 0) { |
94 |
lg.border(); |
95 |
} else if (s.compareTo("POSICIONAR") == 0) { |
96 |
lg.position(); |
97 |
} |
98 |
} catch (DriverIOException e) {
|
99 |
e.printStackTrace(); |
100 |
} catch (IOException e) { |
101 |
e.printStackTrace(); |
102 |
} |
103 |
} |
104 |
|
105 |
/**
|
106 |
* @see com.iver.mdiApp.plugins.Extension#isVisible()
|
107 |
*/
|
108 |
public boolean isVisible() { |
109 |
View f = PluginServices.getMDIManager().getActiveView();
|
110 |
|
111 |
if (f == null) { |
112 |
return false; |
113 |
} |
114 |
|
115 |
if (f.getClass() == Layout.class) {
|
116 |
Layout layout = (Layout) f; |
117 |
|
118 |
return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0; |
119 |
} else {
|
120 |
return false; |
121 |
} |
122 |
} |
123 |
|
124 |
/**
|
125 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
126 |
*/
|
127 |
public void inicializar() { |
128 |
} |
129 |
|
130 |
/**
|
131 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
132 |
*/
|
133 |
public boolean isEnabled() { |
134 |
return true; |
135 |
} |
136 |
} |