Revision 21598

View differences:

trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/GrayConversionPanel.java
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.vectorizacion.ui;
20

  
21
import java.awt.BorderLayout;
22
import java.awt.GridBagConstraints;
23
import java.awt.GridBagLayout;
24
import java.awt.Insets;
25
import java.util.Observable;
26
import java.util.Observer;
27

  
28
import javax.swing.BorderFactory;
29
import javax.swing.JLabel;
30
import javax.swing.JPanel;
31

  
32
import org.gvsig.raster.beans.previewbase.IUserPanelInterface;
33
import org.gvsig.raster.util.RasterToolsUtil;
34

  
35
import com.iver.utiles.swing.JComboBox;
36

  
37
/**
38
 * Panel para la conversi?n a escala de grises. 
39
 * 
40
 * 09/06/2008
41
 * @author Nacho Brodin nachobrodin@gmail.com
42
 */
43
public class GrayConversionPanel extends JPanel implements IUserPanelInterface, Observer {
44
	private static final long      serialVersionUID   = -1;
45
	
46
	private NoisePanel             noisePanel         = null;
47
	private HighPassPanel          highPassPanel      = null;
48
	private PosterizationPanel     posterizationPanel = null;
49
	
50
	private JComboBox              comboLevels        = null;
51
	private JPanel                 levelsPanel        = null;
52
	private JComboBox              outputScale        = null;
53
	private JPanel                 outputScalePanel   = null;
54
			
55
	/**
56
	 * Constructor sin par?metro para poder instanciar como Bean
57
	 */
58
	public GrayConversionPanel() {
59
		init();
60
	}
61
	
62
	/**
63
	 * Inicializa los componentes gr?ficos
64
	 */
65
	private void init() {
66
		setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "grayescaleconversion"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
67
		setLayout(new GridBagLayout());
68
		GridBagConstraints gbc = new GridBagConstraints();
69
		gbc.weightx = 1;
70
		gbc.fill = GridBagConstraints.HORIZONTAL;
71
		gbc.insets = new Insets(0, 2, 2, 2);
72
		
73
		gbc.gridy = 0;
74
		add(getLevelPanel(), gbc);
75
		
76
		gbc.gridy = 1;
77
		add(getOutputScalePanel(), gbc);
78
		
79
		gbc.fill = GridBagConstraints.BOTH;
80
		gbc.weighty = 1;
81
		gbc.insets = new Insets(0, 0, 0, 0);
82
		gbc.gridy = 2;
83
		posterizationPanel = new PosterizationPanel();
84
		add(posterizationPanel, gbc);
85
		
86
		gbc.gridy = 3;
87
		highPassPanel = new HighPassPanel();
88
		add(highPassPanel, gbc);
89
		
90
		gbc.gridy = 4;
91
		noisePanel = new NoisePanel();
92
		add(noisePanel, gbc);
93
	}
94
		
95
	/**
96
	 * Obtiene el panel con los niveles
97
	 * @return
98
	 */
99
	public JPanel getLevelPanel() {
100
		if(levelsPanel == null) {
101
			levelsPanel = new JPanel();
102
			levelsPanel.setLayout(new BorderLayout());
103
			levelsPanel.add(new JLabel(RasterToolsUtil.getText(this, "levels")), BorderLayout.WEST);
104
			levelsPanel.add(getComboLevels(), BorderLayout.CENTER);
105
		}
106
		return levelsPanel;
107
	} 
108
	
109
	/**
110
	 * Obtiene el combo con los niveles
111
	 * @return
112
	 */
113
	public JComboBox getComboLevels() {
114
		if(comboLevels == null) {
115
			comboLevels = new JComboBox();
116
		}
117
		return comboLevels;
118
	} 
119
	
120
	/**
121
	 * Obtiene el panel con la escala de salida
122
	 * @return
123
	 */
124
	public JPanel getOutputScalePanel() {
125
		if(outputScalePanel == null) {
126
			outputScalePanel = new JPanel();
127
			outputScalePanel.setLayout(new BorderLayout());
128
			outputScalePanel.add(new JLabel(RasterToolsUtil.getText(this, "outputscale")), BorderLayout.WEST);
129
			outputScalePanel.add(getComboOutputScale(), BorderLayout.CENTER);
130
		}
131
		return outputScalePanel;
132
	} 
133
	
134
	/**
135
	 * Obtiene el combo con la escala de salida
136
	 * @return
137
	 */
138
	public JComboBox getComboOutputScale() {
139
		if(outputScale == null) {
140
			outputScale = new JComboBox();
141
		}
142
		return outputScale;
143
	}
144
	
145
	/*
146
	 * (non-Javadoc)
147
	 * @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getPanel()
148
	 */
149
	public JPanel getPanel() {
150
		return this;
151
	}
152

  
153
	/*
154
	 * (non-Javadoc)
155
	 * @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getTitle()
156
	 */
157
	public String getTitle() {
158
		return "grayscaleconversion";
159
	}
160

  
161
	public void update(Observable o, Object arg) {
162
	}
163
}

Also available in: Unified diff