root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / scatterplot / gui / ScatterPlotTocMenuEntry.java @ 18830
History | View | Annotate | Download (4.66 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.scatterplot.gui; |
41 |
|
42 |
import javax.swing.Icon; |
43 |
|
44 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
45 |
import org.gvsig.fmap.raster.layers.ILayerState; |
46 |
import org.gvsig.raster.grid.GridException; |
47 |
import org.gvsig.raster.gui.IGenericToolBarMenuItem; |
48 |
|
49 |
import com.iver.andami.PluginServices; |
50 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
51 |
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction; |
52 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem; |
53 |
/**
|
54 |
* Punto de entrada del menu del gestor de ROIs.
|
55 |
*
|
56 |
* @author Diego Guerrero Sevilla (diego.guerrero@uclm.es
|
57 |
*/
|
58 |
public class ScatterPlotTocMenuEntry extends AbstractTocContextMenuAction implements IGenericToolBarMenuItem { |
59 |
static private ScatterPlotTocMenuEntry singleton = null; |
60 |
|
61 |
private ScatterPlotTocMenuEntry() {}
|
62 |
|
63 |
static public ScatterPlotTocMenuEntry getSingleton() { |
64 |
if (singleton == null) |
65 |
singleton = new ScatterPlotTocMenuEntry();
|
66 |
return singleton;
|
67 |
} |
68 |
|
69 |
/*
|
70 |
* (non-Javadoc)
|
71 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroup()
|
72 |
*/
|
73 |
public String getGroup() { |
74 |
return "RasterProcess"; |
75 |
} |
76 |
|
77 |
/*
|
78 |
* (non-Javadoc)
|
79 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroupOrder()
|
80 |
*/
|
81 |
public int getGroupOrder() { |
82 |
return 56; |
83 |
} |
84 |
|
85 |
/*
|
86 |
* (non-Javadoc)
|
87 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getOrder()
|
88 |
*/
|
89 |
public int getOrder() { |
90 |
return 0; |
91 |
} |
92 |
|
93 |
/*
|
94 |
* (non-Javadoc)
|
95 |
* @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getText()
|
96 |
*/
|
97 |
public String getText() { |
98 |
return PluginServices.getText(this, "diagrama_dispersion"); |
99 |
} |
100 |
|
101 |
/*
|
102 |
* (non-Javadoc)
|
103 |
* @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#isEnabled(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
104 |
*/
|
105 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
106 |
if ((selectedItems == null) || (selectedItems.length != 1)) |
107 |
return false; |
108 |
|
109 |
if (!(selectedItems[0] instanceof ILayerState)) |
110 |
return false; |
111 |
|
112 |
if (!((ILayerState) selectedItems[0]).isOpen()) |
113 |
return false; |
114 |
|
115 |
return true; |
116 |
} |
117 |
|
118 |
/*
|
119 |
* (non-Javadoc)
|
120 |
* @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#isVisible(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
121 |
*/
|
122 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
123 |
if ((selectedItems == null) || (selectedItems.length != 1)) |
124 |
return false; |
125 |
|
126 |
if (!(selectedItems[0] instanceof FLyrRasterSE)) |
127 |
return false; |
128 |
|
129 |
return true; |
130 |
} |
131 |
|
132 |
/*
|
133 |
* (non-Javadoc)
|
134 |
* @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#execute(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
|
135 |
*/
|
136 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
137 |
FLayer fLayer = null;
|
138 |
|
139 |
if (selectedItems.length != 1) |
140 |
return;
|
141 |
|
142 |
fLayer = selectedItems[0];
|
143 |
|
144 |
if (!(fLayer instanceof FLyrRasterSE)) |
145 |
return;
|
146 |
ScatterPlotDialog scatterPlotDialog = new ScatterPlotDialog(505,400); |
147 |
try {
|
148 |
scatterPlotDialog.setLayer(selectedItems[0]);
|
149 |
} catch (GridException e) {
|
150 |
} |
151 |
PluginServices.getMDIManager().addWindow(scatterPlotDialog); |
152 |
|
153 |
} |
154 |
|
155 |
/*
|
156 |
* (non-Javadoc)
|
157 |
* @see org.gvsig.raster.gui.IGenericToolBarMenuItem#getIcon()
|
158 |
*/
|
159 |
public Icon getIcon() { |
160 |
return PluginServices.getIconTheme().get("blank-icon"); |
161 |
} |
162 |
} |