svn-gvsig-desktop / tags / v1_1_Build_1008 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / manager / GeoprocessManagerExtension.java @ 12520
History | View | Annotate | Download (6.32 KB)
1 |
/*
|
---|---|
2 |
* Created on 23-jun-2006
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
/* CVS MESSAGES:
|
45 |
*
|
46 |
* $Id: GeoprocessManagerExtension.java 12520 2007-07-09 07:55:36Z $
|
47 |
* $Log$
|
48 |
* Revision 1.7.2.1 2006-11-15 00:08:17 jjdelcerro
|
49 |
* *** empty log message ***
|
50 |
*
|
51 |
* Revision 1.9 2006/09/20 13:40:47 caballero
|
52 |
* IProjectView
|
53 |
*
|
54 |
* Revision 1.8 2006/09/15 10:42:54 caballero
|
55 |
* extensibilidad de documentos
|
56 |
*
|
57 |
* Revision 1.7 2006/09/07 19:02:27 azabala
|
58 |
* cached Geoprocess Manager, to remember folder status
|
59 |
*
|
60 |
* Revision 1.6 2006/09/07 18:54:11 azabala
|
61 |
* added comments
|
62 |
*
|
63 |
* Revision 1.5 2006/08/29 07:56:30 cesar
|
64 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
65 |
*
|
66 |
* Revision 1.4 2006/08/29 07:13:56 cesar
|
67 |
* Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
|
68 |
*
|
69 |
* Revision 1.3 2006/08/18 08:40:05 jmvivo
|
70 |
* Actualizado para que el isEnabled tenga en cuenta que las capas esten 'avialable'
|
71 |
*
|
72 |
* Revision 1.2 2006/06/27 16:12:38 azabala
|
73 |
* registration of all core geoprocesses (wizard's)
|
74 |
*
|
75 |
* Revision 1.1 2006/06/23 19:03:52 azabala
|
76 |
* first version in cvs
|
77 |
*
|
78 |
*
|
79 |
*/
|
80 |
package com.iver.cit.gvsig.geoprocess.manager; |
81 |
|
82 |
import com.iver.andami.PluginServices; |
83 |
import com.iver.andami.plugins.Extension; |
84 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
85 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
86 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
87 |
import com.iver.cit.gvsig.geoprocess.impl.buffer.BufferGeoprocessPlugin; |
88 |
import com.iver.cit.gvsig.geoprocess.impl.clip.ClipGeoprocessPlugin; |
89 |
import com.iver.cit.gvsig.geoprocess.impl.convexhull.ConvexHullGeoprocessPlugin; |
90 |
import com.iver.cit.gvsig.geoprocess.impl.difference.DifferenceGeoprocessPlugin; |
91 |
import com.iver.cit.gvsig.geoprocess.impl.dissolve.DissolveGeoprocessPlugin; |
92 |
import com.iver.cit.gvsig.geoprocess.impl.intersection.IntersectionGeoprocessPlugin; |
93 |
import com.iver.cit.gvsig.geoprocess.impl.merge.MergeGeoprocessPlugin; |
94 |
import com.iver.cit.gvsig.geoprocess.impl.spatialjoin.SpatialJoinGeoprocessPlugin; |
95 |
import com.iver.cit.gvsig.geoprocess.impl.union.UnionGeoprocessPlugin; |
96 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
97 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
98 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
99 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
100 |
/**
|
101 |
* This andami extension shows a GUI component (GeoprocessManager)
|
102 |
* that allows user to launch geoprocesses, and developers to register
|
103 |
* new geoprocesses in a dynamic linkage manner.
|
104 |
* <br>
|
105 |
* In its initialize() method it registers the basis geoprocesses
|
106 |
* (buffer, clip, etc.)
|
107 |
*
|
108 |
* @author azabala
|
109 |
*
|
110 |
*/
|
111 |
public class GeoprocessManagerExtension extends Extension { |
112 |
|
113 |
/**
|
114 |
* Cached instance of geoprocess manager
|
115 |
*/
|
116 |
private GeoprocessManager gpManagerDialog = null; |
117 |
/**
|
118 |
* Register basis geoprocesses during extension initialization
|
119 |
*/
|
120 |
public void initialize() { |
121 |
ExtensionPoints extensionPoints = |
122 |
ExtensionPointsSingleton.getInstance(); |
123 |
extensionPoints.add("GeoprocessManager",
|
124 |
"BUFFER",
|
125 |
BufferGeoprocessPlugin.class); |
126 |
extensionPoints.add("GeoprocessManager",
|
127 |
"CLIP",
|
128 |
ClipGeoprocessPlugin.class); |
129 |
extensionPoints.add("GeoprocessManager",
|
130 |
"CONVEX HULL",
|
131 |
ConvexHullGeoprocessPlugin.class); |
132 |
extensionPoints.add("GeoprocessManager",
|
133 |
"DIFFERENCE",
|
134 |
DifferenceGeoprocessPlugin.class); |
135 |
extensionPoints.add("GeoprocessManager",
|
136 |
"DISSOLVE",
|
137 |
DissolveGeoprocessPlugin.class); |
138 |
extensionPoints.add("GeoprocessManager",
|
139 |
"INTERSECTION",
|
140 |
IntersectionGeoprocessPlugin.class); |
141 |
extensionPoints.add("GeoprocessManager",
|
142 |
"MERGE",
|
143 |
MergeGeoprocessPlugin.class); |
144 |
extensionPoints.add("GeoprocessManager",
|
145 |
"SPATIAL JOIN",
|
146 |
SpatialJoinGeoprocessPlugin.class); |
147 |
extensionPoints.add("GeoprocessManager",
|
148 |
"UNION",
|
149 |
UnionGeoprocessPlugin.class); |
150 |
|
151 |
} |
152 |
|
153 |
public void execute(String actionCommand) { |
154 |
if(actionCommand.equalsIgnoreCase("GEOPROCESSING_MANAGER")){ |
155 |
if(gpManagerDialog == null) |
156 |
gpManagerDialog = new GeoprocessManager();
|
157 |
PluginServices.getMDIManager(). |
158 |
addWindow(gpManagerDialog); |
159 |
} |
160 |
|
161 |
} |
162 |
|
163 |
public boolean isEnabled() { |
164 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
165 |
.getActiveWindow(); |
166 |
if (f == null) { |
167 |
return false; |
168 |
} |
169 |
if (f instanceof View) { |
170 |
View vista = (View) f; |
171 |
IProjectView model = vista.getModel(); |
172 |
FLayers layers = model.getMapContext().getLayers(); |
173 |
int numLayers = layers.getLayersCount();
|
174 |
for(int i = 0; i < numLayers; i++){ |
175 |
FLayer layer = layers.getLayer(i); |
176 |
if(layer instanceof FLyrVect && layer.isAvailable()) |
177 |
return true; |
178 |
} |
179 |
} |
180 |
return false; |
181 |
} |
182 |
|
183 |
public boolean isVisible() { |
184 |
//Meter en un geoprocessutil para todas las extensiones
|
185 |
//de geoprocessing
|
186 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
187 |
.getActiveWindow(); |
188 |
if (f == null) { |
189 |
return false; |
190 |
} |
191 |
if (f instanceof View) { |
192 |
View vista = (View) f; |
193 |
IProjectView model = vista.getModel(); |
194 |
FLayers layers = model.getMapContext().getLayers(); |
195 |
int numLayers = layers.getLayersCount();
|
196 |
for(int i = 0; i < numLayers; i++){ |
197 |
FLayer layer = layers.getLayer(i); |
198 |
if(layer instanceof FLyrVect) |
199 |
return true; |
200 |
} |
201 |
return false; |
202 |
} |
203 |
return false; |
204 |
} |
205 |
|
206 |
} |
207 |
|