svn-gvsig-desktop / tags / Root_gvSIG_CAD_Layout_version / applications / appgvSIG / src / com / iver / cit / gvsig / GeometryExtension.java @ 1648
History | View | Annotate | Download (5.07 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 java.io.IOException; |
44 |
|
45 |
import com.iver.andami.PluginServices; |
46 |
import com.iver.andami.messages.NotificationManager; |
47 |
import com.iver.andami.plugins.Extension; |
48 |
|
49 |
import com.iver.cit.gvsig.fmap.FMap; |
50 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
51 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
52 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
53 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.EditableVectorialLayer; |
54 |
import com.iver.cit.gvsig.gui.View; |
55 |
import com.iver.cit.gvsig.gui.cad.CadMapControl; |
56 |
|
57 |
|
58 |
/**
|
59 |
* Extensi?n dedicada a controlar las diferentes operaciones sobre el editado
|
60 |
* de una capa.
|
61 |
*
|
62 |
* @author Vicente Caballero Navarro
|
63 |
*/
|
64 |
public class GeometryExtension implements Extension { |
65 |
/**
|
66 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
67 |
*/
|
68 |
public void inicializar() { |
69 |
} |
70 |
|
71 |
/**
|
72 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
73 |
*/
|
74 |
public void execute(String s) { |
75 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
76 |
CadMapControl cadmap=(CadMapControl)vista.getMapControl(); |
77 |
if (s.compareTo("SPLINE") == 0) { |
78 |
//Spline.png
|
79 |
vista.getMapControl().setCadTool("spline");
|
80 |
} else if (s.compareTo("COPY") == 0) { |
81 |
//Copy.png
|
82 |
vista.getMapControl().setCadTool("copy");
|
83 |
} else if (s.compareTo("EQUIDISTANCE") == 0) { |
84 |
//Equidistance.png
|
85 |
} else if (s.compareTo("MATRIZ") == 0) { |
86 |
//Matriz.png
|
87 |
} else if (s.compareTo("SYMMETRY") == 0) { |
88 |
//Symmetry.png
|
89 |
vista.getMapControl().setCadTool("symmetry");
|
90 |
} else if (s.compareTo("ROTATION") == 0) { |
91 |
//Rotation.png
|
92 |
vista.getMapControl().setCadTool("rotate");
|
93 |
} else if (s.compareTo("STRETCHING") == 0) { |
94 |
//Stretching.png
|
95 |
vista.getMapControl().setCadTool("stretching");
|
96 |
} else if (s.compareTo("SCALE") == 0) { |
97 |
//Scale.png
|
98 |
vista.getMapControl().setCadTool("scale");
|
99 |
} else if (s.compareTo("EXTEND") == 0) { |
100 |
//Extend.png
|
101 |
} else if (s.compareTo("TRIM") == 0) { |
102 |
//Trim.png
|
103 |
} else if (s.compareTo("UNIT") == 0) { |
104 |
//Unit.png
|
105 |
} else if (s.compareTo("EXPLOIT") == 0) { |
106 |
//Exploit.png
|
107 |
vista.getMapControl().setCadTool("exploit");
|
108 |
} else if (s.compareTo("CHAFLAN") == 0) { |
109 |
//Chaflan.png
|
110 |
} else if (s.compareTo("JOIN") == 0) { |
111 |
//Join.png
|
112 |
} else if (s.compareTo("SELECT") == 0) { |
113 |
vista.getMapControl().setCadTool("selection");
|
114 |
} else if (s.compareTo("POINT") == 0) { |
115 |
vista.getMapControl().setCadTool("point");
|
116 |
} else if (s.compareTo("LINE") == 0) { |
117 |
vista.getMapControl().setCadTool("line");
|
118 |
} else if (s.compareTo("POLYLINE") == 0) { |
119 |
vista.getMapControl().setCadTool("polyline");
|
120 |
} else if (s.compareTo("CIRCLE") == 0) { |
121 |
vista.getMapControl().setCadTool("circle");
|
122 |
} else if (s.compareTo("ARC") == 0) { |
123 |
vista.getMapControl().setCadTool("arc");
|
124 |
} else if (s.compareTo("ELLIPSE") == 0) { |
125 |
vista.getMapControl().setCadTool("ellipse");
|
126 |
} else if (s.compareTo("RECTANGLE") == 0) { |
127 |
vista.getMapControl().setCadTool("rectangle");
|
128 |
} else if (s.compareTo("POLYGON") == 0) { |
129 |
vista.getMapControl().setCadTool("polygon");
|
130 |
} |
131 |
} |
132 |
|
133 |
/**
|
134 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
135 |
*/
|
136 |
public boolean isEnabled() { |
137 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
138 |
.getActiveView(); |
139 |
|
140 |
if (f == null) { |
141 |
return false; |
142 |
} |
143 |
|
144 |
if (f.getClass() == View.class) { |
145 |
FLayer[] l = ((View) f).getModel().getMapContext().getLayers() |
146 |
.getActives(); |
147 |
|
148 |
for (int i = 0; i < l.length; i++) { |
149 |
if (l[i] instanceof EditableVectorialLayer) { |
150 |
if (((EditableVectorialLayer) l[i]).isEditing())
|
151 |
return true; |
152 |
} |
153 |
} |
154 |
} |
155 |
|
156 |
return false; |
157 |
} |
158 |
|
159 |
/**
|
160 |
* @see com.iver.andami.plugins.Extension#isVisible()
|
161 |
*/
|
162 |
public boolean isVisible() { |
163 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
164 |
.getActiveView(); |
165 |
|
166 |
if (f == null) { |
167 |
return false; |
168 |
} |
169 |
|
170 |
if (f.getClass() == View.class) { |
171 |
return true; |
172 |
} else {
|
173 |
return false; |
174 |
} |
175 |
} |
176 |
} |