svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / colortable / ColorTableTocMenuEntry.java @ 13300
History | View | Annotate | Download (3.68 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 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 |
package org.gvsig.rastertools.colortable; |
20 |
|
21 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
22 |
import org.gvsig.fmap.raster.layers.IRasterLayerActions; |
23 |
import org.gvsig.rastertools.colortable.ui.ColorTableDialog; |
24 |
|
25 |
import com.iver.andami.PluginServices; |
26 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
27 |
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction; |
28 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem; |
29 |
/**
|
30 |
* <code>ColorTableTocMenuEntry</code> es el punto de entrada del menu de la
|
31 |
* tabla de color
|
32 |
* @version 26/06/2007
|
33 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
34 |
*/
|
35 |
public class ColorTableTocMenuEntry extends AbstractTocContextMenuAction { |
36 |
/*
|
37 |
* (non-Javadoc)
|
38 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroup()
|
39 |
*/
|
40 |
public String getGroup() { |
41 |
return "RasterTools"; |
42 |
} |
43 |
|
44 |
/*
|
45 |
* (non-Javadoc)
|
46 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getGroupOrder()
|
47 |
*/
|
48 |
public int getGroupOrder() { |
49 |
return 55; |
50 |
} |
51 |
|
52 |
/*
|
53 |
* (non-Javadoc)
|
54 |
* @see com.iver.cit.gvsig.project.documents.contextMenu.AbstractContextMenuAction#getOrder()
|
55 |
*/
|
56 |
public int getOrder() { |
57 |
return 3; |
58 |
} |
59 |
|
60 |
/*
|
61 |
* (non-Javadoc)
|
62 |
* @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getText()
|
63 |
*/
|
64 |
public String getText() { |
65 |
return PluginServices.getText(this, "tablas_color"); |
66 |
} |
67 |
|
68 |
/*
|
69 |
* (non-Javadoc)
|
70 |
* @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[])
|
71 |
*/
|
72 |
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) { |
73 |
return selectedItems.length == 1; |
74 |
} |
75 |
|
76 |
/*
|
77 |
* (non-Javadoc)
|
78 |
* @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[])
|
79 |
*/
|
80 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) { |
81 |
if (isTocItemBranch(item))
|
82 |
if (getNodeLayer(item) instanceof FLyrRasterSE && |
83 |
((FLyrRasterSE)getNodeLayer(item)).isActionEnabled(IRasterLayerActions.COLOR_TABLE)) |
84 |
if (((FLyrRasterSE) getNodeLayer(item)).getBandCount() == 1) |
85 |
return true; |
86 |
return false; |
87 |
} |
88 |
|
89 |
/*
|
90 |
* (non-Javadoc)
|
91 |
* @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[])
|
92 |
*/
|
93 |
public void execute(ITocItem item, FLayer[] selectedItems) { |
94 |
FLayer fLayer = null;
|
95 |
|
96 |
if (selectedItems.length != 1) |
97 |
return;
|
98 |
|
99 |
fLayer = selectedItems[0];
|
100 |
|
101 |
if (!(fLayer instanceof FLyrRasterSE)) |
102 |
return;
|
103 |
|
104 |
ColorTableDialog colorTableDialog = new ColorTableDialog(660, 450); |
105 |
colorTableDialog.setLayer(fLayer); |
106 |
PluginServices.getMDIManager().addWindow(colorTableDialog); |
107 |
} |
108 |
} |