root / trunk / extensions / extRasterTools / src / org / gvsig / rasterTools / pansharpening / toc / PanSharpeningTocMenuEntry.java @ 4577
History | View | Annotate | Download (4.19 KB)
1 |
/*
|
---|---|
2 |
* Created on 23-mar-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 |
*/
|
23 |
package org.gvsig.rasterTools.pansharpening.toc; |
24 |
|
25 |
import org.cresques.io.raster.RasterFilter; |
26 |
import org.cresques.io.raster.RasterFilterStackManager; |
27 |
import org.cresques.ui.raster.FilterRasterDialogPanel; |
28 |
import org.gvsig.rasterTools.pansharpening.filter.PanSharpeningStackManager; |
29 |
import org.gvsig.rasterTools.pansharpening.ui.PanSharpeningPanel; |
30 |
|
31 |
import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
32 |
import com.iver.cit.gvsig.gui.Panels.IRasterPropertiesRegistrable; |
33 |
import com.iver.cit.gvsig.gui.Panels.PropertiesRasterDialog; |
34 |
import com.iver.cit.gvsig.gui.toc.FLyrRasterAdjustPropertiesTocMenuEntry; |
35 |
import com.iver.cit.gvsig.gui.toc.FPopupMenu; |
36 |
|
37 |
/**
|
38 |
* Entrada del menu contextual del TOC que contiene la parte del listener que
|
39 |
* corresponde al PanSharpening. La funci?n actionPerformed de este objeto ser?
|
40 |
* llamada por la clase FLyrRasterAdjustPropertiesTocMenuEntry. Para esto debe
|
41 |
* registrarse en ella a trav?s del m?todo "register".
|
42 |
*
|
43 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
44 |
*/
|
45 |
public class PanSharpeningTocMenuEntry implements IRasterPropertiesRegistrable{ |
46 |
|
47 |
private PanSharpeningPanel panel = null; |
48 |
|
49 |
/**
|
50 |
* Contructor.
|
51 |
* Se registra a si mismo en las propiedades de raster del TOC
|
52 |
* @param menu
|
53 |
*/
|
54 |
public PanSharpeningTocMenuEntry(FLyrRasterAdjustPropertiesTocMenuEntry menu){
|
55 |
menu.register(this);
|
56 |
} |
57 |
|
58 |
/**
|
59 |
* Asigna el gestor de pila de filtros generico al gestor de pila de pansharpening
|
60 |
* @param stackManager RasterFilterStackManager
|
61 |
*/
|
62 |
public void setStackManager(RasterFilterStackManager stackManager){ |
63 |
panel = new PanSharpeningPanel();
|
64 |
PanSharpeningStackManager manager = new PanSharpeningStackManager(stackManager);
|
65 |
panel.setPanSharpeningStackManager(manager); |
66 |
} |
67 |
|
68 |
/**
|
69 |
* A?ade el panel al cuadro de dialogo de propiedades de raster
|
70 |
* @param menu FLyrRasterAdjustPropertiesTocMenuEntry
|
71 |
*/
|
72 |
public void addTabPanel(FLyrRasterAdjustPropertiesTocMenuEntry menu){ |
73 |
if(panel == null) |
74 |
panel = new PanSharpeningPanel();
|
75 |
menu.getPropertiesDialog().addTab(panel.getName(), panel); |
76 |
} |
77 |
|
78 |
public void actionPerformed(RasterFilterStackManager stackManager, PropertiesRasterDialog propsDialog, FLyrRaster fLayer) { |
79 |
//Modificaci?n del estado de los controles del pansharpening
|
80 |
if(stackManager.isActive(stackManager.getTypeFilter("sharpening"))){ |
81 |
PanSharpeningPanel pSharp = (PanSharpeningPanel)((FilterRasterDialogPanel)propsDialog.getContentPane()).getPanelByClassName("PanSharpeningPanel");
|
82 |
pSharp.getCbActiveSharpening().setSelected(true);
|
83 |
pSharp.setTableEnabled(true);
|
84 |
|
85 |
RasterFilter sharp = stackManager.getFilter("sharpening");
|
86 |
String pancrName = (String)sharp.getParam("pancrName"); |
87 |
for(int i=0;i<pSharp.getNBands();i++){ |
88 |
if(pSharp.getBandName(i).endsWith(pancrName))
|
89 |
pSharp.selectRow(i); |
90 |
} |
91 |
if(((String)sharp.getParam("method")).equals("hsl")){ |
92 |
pSharp.getRbHSL().setSelected(true);
|
93 |
Double coef = ((Double)sharp.getParam("coef")); |
94 |
pSharp.getJTextField().setText(coef.toString()); |
95 |
pSharp.getJSlider().setValue((int)((coef.doubleValue() * 100)/0.5)); |
96 |
} |
97 |
|
98 |
if(((String)sharp.getParam("method")).equals("brovey")){ |
99 |
pSharp.getRbBrovey().setSelected(true);
|
100 |
Integer coefBrovey = ((Integer)sharp.getParam("coefBrovey")); |
101 |
pSharp.getJTextField1().setText(coefBrovey.toString()); |
102 |
pSharp.getJSlider1().setValue((int)((coefBrovey.intValue() * 100)/50)); |
103 |
} |
104 |
} |
105 |
} |
106 |
} |