Statistics
| Revision:

gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.algorithm / org.gvsig.raster.tools.algorithm.swing / org.gvsig.raster.tools.algorithm.swing.impl / src / main / java / org / gvsig / raster / tools / algorithm / swing / impl / maskthreshold / MaskThresholdPanelImpl.java @ 1286

History | View | Annotate | Download (4.11 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.tools.algorithm.swing.impl.maskthreshold;
23

    
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26

    
27
import javax.swing.JComboBox;
28
import javax.swing.JPanel;
29

    
30
import org.gvsig.raster.tools.algorithm.swing.impl.bean.inputlayer.InputLayerImpl;
31
import org.gvsig.raster.tools.algorithm.swing.maskthreshold.MaskThresholdData;
32
import org.gvsig.raster.tools.algorithm.swing.maskthreshold.MaskThresholdPanel;
33

    
34
/**
35
 * @author Nacho Brodin (nachobrodin@gmail.com)
36
 */
37
public class MaskThresholdPanelImpl extends JPanel implements MaskThresholdPanel {
38
        private static final long               serialVersionUID     = 1L;
39
        private InputLayerImpl                  inputLayerPanel      = null;
40
        private OperationMaskThresholdImpl      operationPanel       = null;
41
        private OutputMaskThresholdImpl         outputPanel          = null;
42
        
43
        public MaskThresholdPanelImpl() {
44
                init();
45
        }
46
        
47
        private void init() {
48
                this.setLayout(new GridBagLayout());
49
                GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
50
                gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
51
                gridBagConstraints1.weightx = 1;
52
                gridBagConstraints1.insets = new java.awt.Insets(0, 0, 0, 0);
53
                
54
                gridBagConstraints1.gridx = 0;
55
                gridBagConstraints1.gridy = 0;
56
                this.add(getLayerSelection(), gridBagConstraints1);
57
                
58
                gridBagConstraints1.gridx = 0;
59
                gridBagConstraints1.gridy = 1;
60
                this.add(getOperationMaskThresholdPanel(), gridBagConstraints1);
61
                
62
                gridBagConstraints1.gridx = 0;
63
                gridBagConstraints1.gridy = 2;
64
                this.add(getOutputMaskThresholdPanel(), gridBagConstraints1);
65
                
66
                gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
67
                gridBagConstraints1.weightx = 1;
68
                gridBagConstraints1.weighty = 1;
69
                gridBagConstraints1.gridx = 0;
70
                gridBagConstraints1.gridy = 3;
71
                this.add(new JPanel(), gridBagConstraints1);
72
        }
73

    
74
        public OperationMaskThresholdImpl getOperationMaskThresholdPanel() {
75
                if(operationPanel == null)
76
                        operationPanel = new OperationMaskThresholdImpl();
77
                return operationPanel;
78
        }
79

    
80
        public OutputMaskThresholdImpl getOutputMaskThresholdPanel() {
81
                if(outputPanel == null) 
82
                        outputPanel = new OutputMaskThresholdImpl();
83
                return outputPanel;
84
        }
85

    
86
        public InputLayerImpl getLayerSelection() {
87
                if(inputLayerPanel == null) {
88
                        inputLayerPanel = new InputLayerImpl(null, true, true);
89
                        inputLayerPanel.setEnabled(false);
90
                }
91
                return inputLayerPanel;
92
        }
93

    
94
        public MaskThresholdData getOutput() {
95
                return null;
96
        }
97

    
98
        public JComboBox getComboBox(int component) {
99
                if(component == LAYERS_INPUT_COMBO)
100
                        return getLayerSelection().getInputLayerCombo();
101
                if(component == BANDS_INPUT_COMBO)
102
                        return getLayerSelection().getBandsSelectorCombo();
103
                if(component == LAYERS_OPERAT_COMBO)
104
                        return getOperationMaskThresholdPanel().getLayerSelection().getInputLayerCombo();
105
                if(component == BANDS_OPERAT_COMBO)
106
                        return getOperationMaskThresholdPanel().getLayerSelection().getBandsSelectorCombo();
107
                if(component == LAYERS_OUTPUT_COMBO)
108
                        return getOutputMaskThresholdPanel().getLayerSelection().getInputLayerCombo();
109
                if(component == BANDS_OUTPUT_COMBO)
110
                        return getOutputMaskThresholdPanel().getLayerSelection().getInputLayerCombo();
111
                if(component == METHOD_OUTPUT_COMBO)
112
                        return getOutputMaskThresholdPanel().getMethodOutput().getCombo();
113
                return null;
114
        }
115

    
116
        
117
}