Revision 4578 trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/raster/FilterRasterDialogPanel.java

View differences:

FilterRasterDialogPanel.java
31 31
import java.awt.event.KeyListener;
32 32
import java.awt.event.MouseEvent;
33 33
import java.awt.event.MouseListener;
34
import java.io.IOException;
35 34
import java.util.ArrayList;
36 35
import java.util.TreeMap;
37 36

  
38
import javax.swing.JList;
39 37
import javax.swing.JPanel;
40 38
import javax.swing.event.ChangeEvent;
41 39
import javax.swing.event.ChangeListener;
42 40

  
43 41
import org.cresques.io.GeoRasterFile;
42
import org.cresques.io.raster.IRasterOperationsRegistrablePanels;
44 43
import org.cresques.io.raster.TransparencyRange;
45 44
import org.cresques.ui.DefaultTabPanel;
46 45

  
......
65 64
     * Tama?o en Y del panel interior. El tab de dentro es proporcional
66 65
     */
67 66
    protected int sizePanelY = 260;
68
    private RasterTransparencyPanel pTrans = null;
69 67
    
70 68
    /**
71
     * Variable que contiene el panel de control de bandas. 
72
     */
73
    protected BandSetupPanel pSetup = null;
74
    
75
    /**
76
     * Variable que contiene el panel de control de realce. 
77
     */
78
    protected EnhancedPanel pEnhan = null;
79
    
80
    /**
81
     * Variable que contiene el panel de Sharpening. 
82
     */
83
    protected SharpeningPanel pSharp = null;
84
    
85
    /**
86
     * Variable que contiene el panel de informaci?n de raster. 
87
     */
88
    protected InfoPanel pInfo = null;
89
   
90
    /**
91 69
     * Propiedades guardadas en una matriz Nx2 con la forma propiedad/valor.
92 70
     */
93 71
    public Object[][] props = null;
......
96 74
     * N?mero de bandas.
97 75
     */
98 76
    protected int nbands = 0;
99

  
77
    
100 78
    /**
101 79
     * Lista de georrasterfiles correspondiente a los ficheros de bandas
102 80
     */
103 81
    protected GeoRasterFile[] grf = null;
104 82
    private TreeMap shadePanel = new TreeMap();
105
	
83
    
84
    //Paneles que se registran dentro de esta misma clase
85
    private RasterTransparencyPanel pTrans = null;
86
    private BandSetupPanel pSetup = null;
87
    private EnhancedPanel pEnhan = null;
88
    private InfoPanel pInfo = null;
89
    
90
	    
106 91
    /**
107 92
     * Constructor. Inicializa los paneles y propiedades
108 93
     * @param props        Propiedades
......
143 128
        pSetup = new BandSetupPanel();
144 129
        pEnhan = new EnhancedPanel(this);
145 130
        pInfo = new InfoPanel(this);
146
        pSharp = new SharpeningPanel();
131
        
147 132
        this.addTab(pInfo.getName(), pInfo);
148 133
        this.addTab(pSetup.getName(), pSetup);
149 134
        this.addTab(pTrans.getName(), pTrans);
150 135
        this.addTab(pEnhan.getName(), pEnhan);
151
        this.addTab(pSharp.getName(), pSharp);
152

  
136
   
153 137
        pTrans.getOpacityCheck().addActionListener(this);
154 138
        pTrans.getTransparencyCheck().addActionListener(this);
155 139
        pTrans.getOpacitySlider().addChangeListener(this);
......
196 180
    }
197 181

  
198 182
    /**
199
     * Obtiene el panel que corresponde a la selecci?n de bandas
200
     * @return Panel de selecci?n de bandas
183
     * Obtiene un panel a trav?s del nombre de su clase
184
     * @param name Nombre de la clase del panel
201 185
     */
202
    public BandSetupPanel getBandSetup() {
203
        return this.pSetup;
186
    public JPanel getPanelByClassName(String name){
187
    	for(int i=0;i<super.getTab().getTabCount() ;i++){
188
    		JPanel p = (JPanel)super.getTab().getComponentAt(i);
189
    		if(p.getClass().getName().endsWith(name))
190
    			return p;
191
    	}
192
    	return null;
204 193
    }
205

  
206
    /**
207
     * Obtiene el panel que corresponde a la selecci?n de transparencia y opacidad
208
     * @return Panel de transparencia y opacidad
209
     */
210
    public RasterTransparencyPanel getTransparencyPanel() {
211
        return this.pTrans;
212
    }
213

  
214
    /**
215
     * Obtiene el panel que corresponde a la selecci?n de sharpening
216
     * @return Panel de sharpening
217
     */
218
    public SharpeningPanel getSharpeningPanel() {
219
        return this.pSharp;
220
    }
221 194
    
222 195
    /**
223
     * Obtiene el panel que corresponde al filtro de realce
224
     * @return Panel del filtro de realce
225
     */
226
    public EnhancedPanel getEnhancedPanel() {
227
        return this.pEnhan;
228
    }
229

  
230
    /**
231
     * Obtiene el panel Info
232
     * @return InfoPanel
233
     */
234
    public InfoPanel getInfoPanel() {
235
        return this.pInfo;
236
    }
237

  
238
    /**
239 196
     * Eventos sobre TextField y CheckBox. Controla eventos de checkbox de opacidad, transparencia,
240 197
     * recorte de colas y los textfield de opacidad, valores de transparencia por banda y
241 198
     * porcentaje de recorte.
......
304 261
     * @param files
305 262
     */
306 263
    public void addFiles(GeoRasterFile[] files){
307
    	if(pSharp != null)
308
    		pSharp.addFiles(files);
264
    	for(int i=0;i<this.getTab().getTabCount();i++){
265
    		if(this.getTab().getComponentAt(i) instanceof IRasterOperationsRegistrablePanels)
266
    		 	((IRasterOperationsRegistrablePanels)getTab().getComponentAt(i)).addFiles(files);
267
    	}
268
    		
309 269
        if(pSetup != null)
310 270
        	pSetup.addFiles(files);
311 271
    }
......
315 275
     * @param file Banda a eliminar
316 276
     */
317 277
    public void removeFile(String file) {
318
    	if(pSharp != null)
319
    		pSharp.removeFile(file);
278
    	for(int i=0;i<this.getTab().getTabCount();i++){
279
    		if(this.getTab().getComponentAt(i) instanceof IRasterOperationsRegistrablePanels);
280
    		 	((IRasterOperationsRegistrablePanels)getTab().getComponentAt(i)).removeFile(file);
281
    	}
320 282
        if(pSetup != null)
321 283
        	pSetup.removeFile(file);
322 284
    }
......
372 334
    public void stateChanged(ChangeEvent e) {
373 335
        //Ponemos el valor del texto de la opacidad de pendiendo de la posici?n del Slider
374 336
        if (e.getSource().equals(pTrans.getOpacitySlider())) {
375
            pTrans.getOpacityText().setText(String.valueOf(pTrans.getOpacitySlider()
376
                                                                 .getValue()));
337
            pTrans.getOpacityText().setText(
338
            		String.valueOf(pTrans.getOpacitySlider().getValue()));
377 339
        }
378 340

  
379 341
        if (e.getSource().equals(pEnhan.getTailSlider())) {
380
            pEnhan.getTailText().setText(String.valueOf((pEnhan.getTailSlider()
381
                                                               .getValue() >> 1)) +
382
                                         ".0");
342
            pEnhan.getTailText().setText(
343
            		String.valueOf((pEnhan.getTailSlider().getValue() >> 1)) + ".0");
383 344
        }
384 345
    }
385 346

  

Also available in: Unified diff