svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutInsertToolsExtension.java @ 6880
History | View | Annotate | Download (4.25 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig; |
42 |
|
43 |
import org.apache.log4j.Logger; |
44 |
|
45 |
import com.iver.andami.PluginServices; |
46 |
import com.iver.andami.plugins.Extension; |
47 |
import com.iver.andami.ui.mdiManager.IWindow; |
48 |
import com.iver.cit.gvsig.gui.layout.FLayoutFunctions; |
49 |
import com.iver.cit.gvsig.gui.layout.Layout; |
50 |
|
51 |
|
52 |
/**
|
53 |
* Extensi?n para editar los v?rtices de las geometr?as a?adidas en un FFrameGraphics.
|
54 |
*
|
55 |
* @author Vicente Caballero Navarro
|
56 |
*/
|
57 |
public class LayoutInsertToolsExtension extends Extension { |
58 |
private static Logger logger = Logger.getLogger(LayoutInsertToolsExtension.class.getName()); |
59 |
private Layout layout = null; |
60 |
|
61 |
|
62 |
public void initialize() { |
63 |
// TODO Auto-generated method stub
|
64 |
} |
65 |
|
66 |
|
67 |
public void execute(String s) { |
68 |
layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
69 |
|
70 |
logger.debug("Comand : " + s);
|
71 |
boolean insertGroupPosibility=false; |
72 |
if (s.equals("SELECT")) { |
73 |
layout.setTool(Layout.SELECT); |
74 |
} else if (s.equals("RECTANGLEVIEW")) { |
75 |
layout.setTool(Layout.RECTANGLEVIEW); |
76 |
insertGroupPosibility=true;
|
77 |
} else if (s.equals("RECTANGLEPICTURE")) { |
78 |
layout.setTool(Layout.RECTANGLEPICTURE); |
79 |
insertGroupPosibility=true;
|
80 |
} else if (s.equals("RECTANGLESCALEBAR")) { |
81 |
layout.setTool(Layout.RECTANGLESCALEBAR); |
82 |
insertGroupPosibility=true;
|
83 |
} else if (s.equals("RECTANGLELEGEND")) { |
84 |
layout.setTool(Layout.RECTANGLELEGEND); |
85 |
insertGroupPosibility=true;
|
86 |
} else if (s.equals("RECTANGLETEXT")) { |
87 |
layout.setTool(Layout.RECTANGLETEXT); |
88 |
insertGroupPosibility=true;
|
89 |
} else if (s.equals("RECTANGLENORTH")) { |
90 |
layout.setTool(Layout.RECTANGLENORTH); |
91 |
insertGroupPosibility=true;
|
92 |
} else if (s.equals("RECTANGLEBOX")) { |
93 |
layout.setTool(Layout.RECTANGLEBOX); |
94 |
insertGroupPosibility=true;
|
95 |
} else if (s.equals("POINT")) { |
96 |
layout.setTool(Layout.POINT); |
97 |
} else if (s.equals("LINE")) { |
98 |
layout.setTool(Layout.LINE); |
99 |
} else if (s.equals("POLYLINE")) { |
100 |
layout.setTool(Layout.POLYLINE); |
101 |
} else if (s.equals("CIRCLE")) { |
102 |
layout.setTool(Layout.CIRCLE); |
103 |
} else if (s.equals("RECTANGLESIMPLE")) { |
104 |
layout.setTool(Layout.RECTANGLESIMPLE); |
105 |
} else if (s.equals("POLYGON")) { |
106 |
layout.setTool(Layout.POLYGON); |
107 |
} else if (s.equals("REMOVE")){ |
108 |
layout.delFFrameSelected(); |
109 |
layout.refresh(); |
110 |
} |
111 |
if (layout.isEditGroup() && insertGroupPosibility){
|
112 |
FLayoutFunctions funtions=new FLayoutFunctions(layout);
|
113 |
funtions.addFFrame(); |
114 |
} |
115 |
} |
116 |
|
117 |
|
118 |
public boolean isEnabled() { |
119 |
IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
120 |
|
121 |
if (f == null) { |
122 |
return false; |
123 |
} |
124 |
|
125 |
if (f instanceof Layout) { |
126 |
return ((Layout) f).isEditable();
|
127 |
} |
128 |
|
129 |
return false; |
130 |
} |
131 |
|
132 |
|
133 |
public boolean isVisible() { |
134 |
IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
135 |
|
136 |
if (f == null) { |
137 |
return false; |
138 |
} |
139 |
|
140 |
if (f instanceof Layout) { |
141 |
return true; |
142 |
} else {
|
143 |
return false; |
144 |
} |
145 |
} |
146 |
} |