root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / RemoteSensingModule.java @ 18830
History | View | Annotate | Download (5.65 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 Instituto de Desarrollo Regional 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 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
package org.gvsig.remotesensing; |
41 |
|
42 |
import javax.swing.Icon; |
43 |
|
44 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
45 |
import org.gvsig.raster.gui.IGenericToolBarMenuItem; |
46 |
import org.gvsig.remotesensing.decisiontrees.gui.DecisionTreeDialog; |
47 |
import org.gvsig.remotesensing.scatterplot.gui.ScatterPlotTocMenuEntry; |
48 |
|
49 |
import com.iver.andami.PluginServices; |
50 |
import com.iver.andami.plugins.Extension; |
51 |
import com.iver.cit.gvsig.fmap.MapContext; |
52 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
53 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
54 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
55 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
56 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem; |
57 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
58 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
59 |
|
60 |
public class RemoteSensingModule extends Extension implements IGenericToolBarMenuItem { |
61 |
|
62 |
/*
|
63 |
* (non-Javadoc)
|
64 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
65 |
*/
|
66 |
public void execute(String actionCommand) { |
67 |
if (actionCommand.equals("decision_trees")){ |
68 |
com.iver.andami.ui.mdiManager.IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow(); |
69 |
|
70 |
//si la ventana activa es de tipo Vista
|
71 |
if (activeWindow instanceof View) { |
72 |
DecisionTreeDialog decisionTreeDialog =new DecisionTreeDialog(600,500,(View)activeWindow); |
73 |
PluginServices.getMDIManager().addWindow(decisionTreeDialog); |
74 |
} |
75 |
} |
76 |
} |
77 |
|
78 |
/*
|
79 |
* (non-Javadoc)
|
80 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
81 |
*/
|
82 |
public void initialize() { |
83 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
84 |
|
85 |
//A?adimos la entrada del toc de diagramas de dispersion.
|
86 |
extensionPoints.add("View_TocActions", "ScatterPlot", ScatterPlotTocMenuEntry.getSingleton()); |
87 |
|
88 |
extensionPoints.add("GenericToolBarMenu", "ScatterPlot", ScatterPlotTocMenuEntry.getSingleton()); |
89 |
extensionPoints.add("GenericToolBarMenu", "DecisionTree", this); |
90 |
} |
91 |
|
92 |
/*
|
93 |
* (non-Javadoc)
|
94 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
95 |
*/
|
96 |
public boolean isEnabled() { |
97 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
98 |
if (f == null) { |
99 |
return false; |
100 |
} |
101 |
if (f.getClass() == View.class) { |
102 |
View vista = (View) f; |
103 |
IProjectView model = vista.getModel(); |
104 |
MapContext mapa = model.getMapContext(); |
105 |
FLayers layers = mapa.getLayers(); |
106 |
for (int i = 0; i < layers.getLayersCount(); i++) |
107 |
if (layers.getLayer(i) instanceof FLyrRasterSE) |
108 |
return true; |
109 |
} |
110 |
return false; |
111 |
} |
112 |
|
113 |
/*
|
114 |
* (non-Javadoc)
|
115 |
* @see com.iver.andami.plugins.IExtension#isVisible()
|
116 |
*/
|
117 |
public boolean isVisible() { |
118 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
119 |
if (f == null) { |
120 |
return false; |
121 |
} |
122 |
if (f instanceof View) { |
123 |
View vista = (View) f; |
124 |
IProjectView model = vista.getModel(); |
125 |
MapContext mapa = model.getMapContext(); |
126 |
return mapa.getLayers().getLayersCount() > 0; |
127 |
} else {
|
128 |
return false; |
129 |
} |
130 |
} |
131 |
|
132 |
/*
|
133 |
* (non-Javadoc)
|
134 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getGroup()
|
135 |
*/
|
136 |
public String getGroup() { |
137 |
return "RasterProcess"; |
138 |
} |
139 |
|
140 |
/*
|
141 |
* (non-Javadoc)
|
142 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getIcon()
|
143 |
*/
|
144 |
public Icon getIcon() { |
145 |
return PluginServices.getIconTheme().get("blank-icon"); |
146 |
} |
147 |
|
148 |
/*
|
149 |
* (non-Javadoc)
|
150 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getOrder()
|
151 |
*/
|
152 |
public int getOrder() { |
153 |
return 0; |
154 |
} |
155 |
|
156 |
/*
|
157 |
* (non-Javadoc)
|
158 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getText()
|
159 |
*/
|
160 |
public String getText() { |
161 |
return PluginServices.getText(this, "decision_trees"); |
162 |
} |
163 |
|
164 |
/*
|
165 |
* (non-Javadoc)
|
166 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#isEnabled(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
167 |
*/
|
168 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
169 |
return isEnabled();
|
170 |
} |
171 |
|
172 |
/*
|
173 |
* (non-Javadoc)
|
174 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#isVisible(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
175 |
*/
|
176 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
177 |
return isVisible();
|
178 |
} |
179 |
|
180 |
/*
|
181 |
* (non-Javadoc)
|
182 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#execute(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
183 |
*/
|
184 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
185 |
execute("decision_trees");
|
186 |
} |
187 |
} |