svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutEditableToolsExtension.java @ 5525
History | View | Annotate | Download (4.25 KB)
1 | 3369 | caballero | /* 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 | 4845 | caballero | import org.apache.log4j.Logger; |
44 | |||
45 | 3369 | caballero | import com.iver.andami.PluginServices; |
46 | import com.iver.andami.plugins.Extension; |
||
47 | import com.iver.andami.ui.mdiManager.View; |
||
48 | 4774 | caballero | import com.iver.cit.gvsig.gui.layout.FLayoutFunctions; |
49 | 3369 | caballero | import com.iver.cit.gvsig.gui.layout.Layout; |
50 | |||
51 | |||
52 | /**
|
||
53 | 4845 | caballero | * Extensi?n para editar los v?rtices de las geometr?as a?adidas en un FFrameGraphics.
|
54 | 3369 | caballero | *
|
55 | * @author Vicente Caballero Navarro
|
||
56 | */
|
||
57 | 5005 | jorpiell | public class LayoutEditableToolsExtension extends Extension { |
58 | 3369 | caballero | private static Logger logger = Logger.getLogger(LayoutEditableToolsExtension.class.getName()); |
59 | private Layout layout = null; |
||
60 | |||
61 | 4845 | caballero | |
62 | 5005 | jorpiell | public void initialize() { |
63 | 4845 | caballero | // TODO Auto-generated method stub
|
64 | } |
||
65 | 3369 | caballero | |
66 | 4845 | caballero | |
67 | 3369 | caballero | public void execute(String s) { |
68 | 4845 | caballero | layout = (Layout) PluginServices.getMDIManager().getActiveView(); |
69 | 3369 | caballero | |
70 | 4845 | caballero | 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 | 3369 | caballero | |
117 | 4845 | caballero | |
118 | 3369 | caballero | public boolean isEnabled() { |
119 | 4845 | caballero | View f = PluginServices.getMDIManager().getActiveView();
|
120 | 3369 | caballero | |
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 | 4845 | caballero | } |
131 | 3369 | caballero | |
132 | 4845 | caballero | |
133 | 3369 | caballero | public boolean isVisible() { |
134 | 4845 | caballero | View f = PluginServices.getMDIManager().getActiveView();
|
135 | 3369 | caballero | |
136 | 4845 | caballero | if (f == null) { |
137 | return false; |
||
138 | } |
||
139 | 3369 | caballero | |
140 | 4845 | caballero | if (f.getClass() == Layout.class) {
|
141 | return true; |
||
142 | } else {
|
||
143 | return false; |
||
144 | } |
||
145 | } |
||
146 | 3369 | caballero | } |