svn-gvsig-desktop / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / RemoteSensingModule.java @ 18577
History | View | Annotate | Download (2.25 KB)
1 | 16980 | gsdiego | package org.gvsig.remotesensing; |
---|---|---|---|
2 | |||
3 | 17255 | gsdiego | import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
4 | import org.gvsig.remotesensing.decisiontrees.gui.DecisionTreeDialog; |
||
5 | 16980 | gsdiego | import org.gvsig.remotesensing.scatterplot.gui.ScatterPlotTocMenuEntry; |
6 | |||
7 | 17255 | gsdiego | import com.iver.andami.PluginServices; |
8 | 16980 | gsdiego | import com.iver.andami.plugins.Extension; |
9 | 17255 | gsdiego | import com.iver.cit.gvsig.fmap.MapContext; |
10 | import com.iver.cit.gvsig.fmap.layers.FLayers; |
||
11 | import com.iver.cit.gvsig.project.documents.view.IProjectView; |
||
12 | import com.iver.cit.gvsig.project.documents.view.gui.View; |
||
13 | 16980 | gsdiego | import com.iver.utiles.extensionPoints.ExtensionPoints; |
14 | import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
||
15 | |||
16 | public class RemoteSensingModule extends Extension { |
||
17 | |||
18 | public void execute(String actionCommand) { |
||
19 | 17255 | gsdiego | if (actionCommand.equals("decision_trees")){ |
20 | com.iver.andami.ui.mdiManager.IWindow activeWindow = PluginServices.getMDIManager().getActiveWindow(); |
||
21 | 16980 | gsdiego | |
22 | 17255 | gsdiego | //si la ventana activa es de tipo Vista
|
23 | if (activeWindow instanceof View) { |
||
24 | DecisionTreeDialog decisionTreeDialog =new DecisionTreeDialog(600,500,(View)activeWindow); |
||
25 | PluginServices.getMDIManager().addWindow(decisionTreeDialog); |
||
26 | } |
||
27 | } |
||
28 | 16980 | gsdiego | } |
29 | |||
30 | public void initialize() { |
||
31 | ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
||
32 | |||
33 | 17773 | dguerrero | //A?adimos la entrada del toc de diagramas de dispersion.
|
34 | extensionPoints.add("View_TocActions", "ScatterPlot", new ScatterPlotTocMenuEntry()); |
||
35 | 16980 | gsdiego | |
36 | } |
||
37 | |||
38 | public boolean isEnabled() { |
||
39 | 17255 | gsdiego | com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
40 | if (f == null) { |
||
41 | return false; |
||
42 | } |
||
43 | if (f.getClass() == View.class) { |
||
44 | View vista = (View) f; |
||
45 | IProjectView model = vista.getModel(); |
||
46 | MapContext mapa = model.getMapContext(); |
||
47 | FLayers layers = mapa.getLayers(); |
||
48 | for (int i = 0; i < layers.getLayersCount(); i++) |
||
49 | if (layers.getLayer(i) instanceof FLyrRasterSE) |
||
50 | return true; |
||
51 | } |
||
52 | 16980 | gsdiego | return false; |
53 | } |
||
54 | |||
55 | public boolean isVisible() { |
||
56 | 17255 | gsdiego | com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
57 | if (f == null) { |
||
58 | return false; |
||
59 | } |
||
60 | if (f instanceof View) { |
||
61 | View vista = (View) f; |
||
62 | IProjectView model = vista.getModel(); |
||
63 | MapContext mapa = model.getMapContext(); |
||
64 | return mapa.getLayers().getLayersCount() > 0; |
||
65 | } else {
|
||
66 | return false; |
||
67 | } |
||
68 | 16980 | gsdiego | } |
69 | |||
70 | } |