Revision 22400
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/vector/VectorPanel.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.vector; |
|
20 |
|
|
21 |
import java.awt.GridBagConstraints; |
|
22 |
import java.awt.GridBagLayout; |
|
23 |
import java.awt.Insets; |
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
import java.util.Observable; |
|
27 |
import java.util.Observer; |
|
28 |
|
|
29 |
import javax.swing.BorderFactory; |
|
30 |
import javax.swing.JPanel; |
|
31 |
|
|
32 |
import org.gvsig.raster.beans.previewbase.IUserPanelInterface; |
|
33 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
34 |
import org.gvsig.rastertools.vectorizacion.data.VectorData; |
|
35 |
import org.gvsig.rastertools.vectorizacion.listener.PreprocessListener; |
|
36 |
|
|
37 |
/** |
|
38 |
* Panel con los controles de opciones de vectorizaci?n |
|
39 |
* |
|
40 |
* 09/06/2008 |
|
41 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
42 |
*/ |
|
43 |
public class VectorPanel extends JPanel implements ActionListener, IUserPanelInterface, Observer { |
|
44 |
private static final long serialVersionUID = 1L; |
|
45 |
private ContourLinesPanel contourPanel = null; |
|
46 |
private PreprocessListener listener = null; |
|
47 |
|
|
48 |
/** |
|
49 |
* Constructor |
|
50 |
*/ |
|
51 |
public VectorPanel(PreprocessListener listener) { |
|
52 |
this.listener = listener; |
|
53 |
init(); |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Constructor vacio para la ejecuci?n como bean |
|
58 |
*/ |
|
59 |
public VectorPanel() { |
|
60 |
init(); |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* Inicializaci?n de los componentes gr?ficos |
|
65 |
*/ |
|
66 |
private void init() { |
|
67 |
setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "vector_generation"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
68 |
setLayout(new GridBagLayout()); |
|
69 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
70 |
gbc.weightx = 1; |
|
71 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
72 |
gbc.insets = new Insets(0, 2, 2, 2); |
|
73 |
|
|
74 |
gbc.gridy = 0; |
|
75 |
add(getContourLinesPanel(), gbc); |
|
76 |
|
|
77 |
/*gbc.gridy = 1; |
|
78 |
add(getOutputScalePanel(), gbc); |
|
79 |
|
|
80 |
gbc.fill = GridBagConstraints.BOTH; |
|
81 |
gbc.weighty = 1; |
|
82 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
83 |
gbc.gridy = 2; |
|
84 |
add(getPosterizationPanel(), gbc); |
|
85 |
|
|
86 |
gbc.gridy = 3; |
|
87 |
add(getHighPassPanel(), gbc); |
|
88 |
|
|
89 |
gbc.gridy = 4; |
|
90 |
add(getNoisePanel(), gbc);*/ |
|
91 |
} |
|
92 |
|
|
93 |
public void actionPerformed(ActionEvent e) { |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Obtiene el panel de vectorizaci?n por lineas de contorno |
|
98 |
* @return |
|
99 |
*/ |
|
100 |
public ContourLinesPanel getContourLinesPanel() { |
|
101 |
if(contourPanel == null) { |
|
102 |
contourPanel = new ContourLinesPanel(); |
|
103 |
} |
|
104 |
return contourPanel; |
|
105 |
} |
|
106 |
|
|
107 |
/* |
|
108 |
* (non-Javadoc) |
|
109 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getPanel() |
|
110 |
*/ |
|
111 |
public JPanel getPanel() { |
|
112 |
return this; |
|
113 |
} |
|
114 |
|
|
115 |
/* |
|
116 |
* (non-Javadoc) |
|
117 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getTitle() |
|
118 |
*/ |
|
119 |
public String getTitle() { |
|
120 |
return RasterToolsUtil.getText(this, "vectorization"); |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* Actualiza los valores de los paneles cuando los datos de ClippingData varian |
|
125 |
* @param o |
|
126 |
* @param arg |
|
127 |
*/ |
|
128 |
public void update(Observable o, Object arg) { |
|
129 |
if(!(o instanceof VectorData)) |
|
130 |
return; |
|
131 |
VectorData data = (VectorData)o; |
|
132 |
|
|
133 |
if(listener == null) |
|
134 |
return; |
|
135 |
listener.setEnableValueChangedEvent(false); |
|
136 |
if(data.getAlgorithm() == VectorData.CONTOUR_LINES) { |
|
137 |
this.getContourLinesPanel().setComponentEnabled(true); |
|
138 |
this.getContourLinesPanel().getDistance().setValue(String.valueOf(data.getDistance())); |
|
139 |
} |
|
140 |
listener.setEnableValueChangedEvent(true); |
|
141 |
} |
|
142 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/vector/ContourLinesPanel.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.vector; |
|
20 |
|
|
21 |
import java.awt.GridBagConstraints; |
|
22 |
import java.awt.GridBagLayout; |
|
23 |
import java.awt.Insets; |
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import javax.swing.BorderFactory; |
|
28 |
import javax.swing.JPanel; |
|
29 |
import javax.swing.JRadioButton; |
|
30 |
|
|
31 |
import org.gvsig.gui.beans.datainput.DataInputContainer; |
|
32 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
33 |
|
|
34 |
/** |
|
35 |
* Panel con los controles de generaci?n de lineas de contorno. |
|
36 |
* |
|
37 |
* 09/06/2008 |
|
38 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
39 |
*/ |
|
40 |
public class ContourLinesPanel extends JPanel implements ActionListener { |
|
41 |
private static final long serialVersionUID = 1L; |
|
42 |
private JRadioButton active = null; |
|
43 |
private DataInputContainer distance = null; |
|
44 |
private boolean enabled = true; |
|
45 |
|
|
46 |
public ContourLinesPanel() { |
|
47 |
init(); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Inicializaci?n de los componentes gr?ficos |
|
52 |
*/ |
|
53 |
private void init() { |
|
54 |
setLayout(new GridBagLayout()); |
|
55 |
setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "contourlines"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
56 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
57 |
gbc.fill = GridBagConstraints.BOTH; |
|
58 |
gbc.weightx = 1; |
|
59 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
60 |
|
|
61 |
this.add(getActive(), gbc); |
|
62 |
|
|
63 |
gbc.gridy = 1; |
|
64 |
this.add(getDistance(), gbc); |
|
65 |
|
|
66 |
getActive().addActionListener(this); |
|
67 |
setComponentEnabled(false); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Obtiene el check de activo |
|
72 |
* @return JCheckBox |
|
73 |
*/ |
|
74 |
public JRadioButton getActive() { |
|
75 |
if(active == null) { |
|
76 |
active = new JRadioButton(); |
|
77 |
} |
|
78 |
return active; |
|
79 |
} |
|
80 |
|
|
81 |
/** |
|
82 |
* Obtiene la barra deslizadora con el radio del filtro de paso alto |
|
83 |
* @return CheckSliderTextContainer |
|
84 |
*/ |
|
85 |
public DataInputContainer getDistance() { |
|
86 |
if(distance == null) { |
|
87 |
distance = new DataInputContainer(); |
|
88 |
distance.setLabelText(RasterToolsUtil.getText(this, "distance")); |
|
89 |
} |
|
90 |
return distance; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* Gesti?n del evento del check de activaci?n y desactivaci?n |
|
95 |
*/ |
|
96 |
public void actionPerformed(ActionEvent e) { |
|
97 |
setComponentEnabled(enabled); |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Activa o desactiva el componente. El estado de activaci?n y desactivaci?n de un |
|
102 |
* componente depende de los controles que contiene. En este caso activa o desactiva |
|
103 |
* la barra de incremento. |
|
104 |
* @param enabled |
|
105 |
*/ |
|
106 |
public void setComponentEnabled(boolean enabled) { |
|
107 |
getDistance().setControlEnabled(enabled); |
|
108 |
getActive().setSelected(enabled); |
|
109 |
this.enabled = !enabled; |
|
110 |
} |
|
111 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/clip/SelectionAreaPanel.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.clip; |
|
20 |
|
|
21 |
import java.awt.Font; |
|
22 |
import java.awt.GridBagConstraints; |
|
23 |
import java.awt.GridBagLayout; |
|
24 |
import java.awt.Insets; |
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
27 |
|
|
28 |
import javax.swing.BorderFactory; |
|
29 |
import javax.swing.ButtonGroup; |
|
30 |
import javax.swing.JButton; |
|
31 |
import javax.swing.JPanel; |
|
32 |
import javax.swing.JRadioButton; |
|
33 |
import javax.swing.event.TableModelEvent; |
|
34 |
import javax.swing.event.TableModelListener; |
|
35 |
|
|
36 |
import org.gvsig.gui.beans.buttonbar.ButtonBarContainer; |
|
37 |
import org.gvsig.gui.beans.table.TableContainer; |
|
38 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
39 |
|
|
40 |
/** |
|
41 |
* Panel con los controles de selecci?n de ?rea. |
|
42 |
* |
|
43 |
* 09/06/2008 |
|
44 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
45 |
*/ |
|
46 |
public class SelectionAreaPanel extends JPanel implements ActionListener, TableModelListener { |
|
47 |
private static final long serialVersionUID = 1L; |
|
48 |
private JRadioButton areaSelect = null; |
|
49 |
private JRadioButton roiSelect = null; |
|
50 |
private JRadioButton vectorizeBBoxSelect = null; |
|
51 |
private JRadioButton vectorizeOnlyInside = null; |
|
52 |
private ButtonGroup areaSelectGroup = null; |
|
53 |
private ButtonGroup typeVectGroup = null; |
|
54 |
|
|
55 |
private JButton selectROI = null; |
|
56 |
private boolean enabled = true; |
|
57 |
|
|
58 |
private TableContainer tableContainer = null; |
|
59 |
private ButtonBarContainer buttonBarContainer = null; |
|
60 |
|
|
61 |
public SelectionAreaPanel() { |
|
62 |
init(); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Inicializaci?n de los componentes gr?ficos |
|
67 |
*/ |
|
68 |
private void init() { |
|
69 |
areaSelectGroup = new ButtonGroup(); |
|
70 |
areaSelectGroup.add(getAreaSelector()); |
|
71 |
areaSelectGroup.add(getROISelector()); |
|
72 |
|
|
73 |
typeVectGroup = new ButtonGroup(); |
|
74 |
typeVectGroup.add(getVectorizeAllBBox()); |
|
75 |
typeVectGroup.add(getVectorizeOnlyInside()); |
|
76 |
|
|
77 |
setLayout(new GridBagLayout()); |
|
78 |
setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "selection"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.PLAIN, 10), null)); |
|
79 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
80 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
81 |
gbc.weightx = 1; |
|
82 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
83 |
|
|
84 |
add(getAreaSelector(), gbc); |
|
85 |
|
|
86 |
gbc.gridy = 1; |
|
87 |
gbc.insets = new Insets(0, 20, 0, 0); |
|
88 |
add(getButtonBarContainer(), gbc); |
|
89 |
|
|
90 |
gbc.gridy = 2; |
|
91 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
92 |
add(getROISelector(), gbc); |
|
93 |
|
|
94 |
gbc.fill = GridBagConstraints.BOTH; |
|
95 |
gbc.weighty = 1; |
|
96 |
gbc.gridy = 3; |
|
97 |
gbc.insets = new Insets(0, 20, 0, 0); |
|
98 |
add(getTableContainer(), gbc); |
|
99 |
|
|
100 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
101 |
gbc.weighty = 0; |
|
102 |
gbc.gridy = 5; |
|
103 |
gbc.insets = new Insets(0, 27, 0, 8); |
|
104 |
add(getROI(), gbc); |
|
105 |
gbc.insets = new Insets(0, 20, 0, 0); |
|
106 |
|
|
107 |
gbc.gridy = 6; |
|
108 |
add(getVectorizeAllBBox(), gbc); |
|
109 |
|
|
110 |
gbc.gridy = 7; |
|
111 |
add(getVectorizeOnlyInside(), gbc); |
|
112 |
|
|
113 |
getAreaSelector().setSelected(true); |
|
114 |
getVectorizeAllBBox().setSelected(true); |
|
115 |
|
|
116 |
setAreaSelectorEnabled(true); |
|
117 |
setROISelectorEnabled(false); |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* Obtiene el bot?n de selecci?n por ?rea. |
|
122 |
* @return JRadioButton |
|
123 |
*/ |
|
124 |
public JRadioButton getAreaSelector() { |
|
125 |
if(areaSelect == null) { |
|
126 |
areaSelect = new JRadioButton(RasterToolsUtil.getText(this, "porarea")); |
|
127 |
areaSelect.addActionListener(this); |
|
128 |
} |
|
129 |
return areaSelect; |
|
130 |
} |
|
131 |
|
|
132 |
/** |
|
133 |
* Obtiene el bot?n de selecci?n por ROI. |
|
134 |
* @return JRadioButton |
|
135 |
*/ |
|
136 |
public JRadioButton getROISelector() { |
|
137 |
if(roiSelect == null) { |
|
138 |
roiSelect = new JRadioButton(RasterToolsUtil.getText(this, "porroi")); |
|
139 |
roiSelect.addActionListener(this); |
|
140 |
} |
|
141 |
return roiSelect; |
|
142 |
} |
|
143 |
|
|
144 |
/** |
|
145 |
* Obtiene el bot?n de vectorizaci?n de todo lo que hay en el interior de la bounding box. |
|
146 |
* @return JRadioButton |
|
147 |
*/ |
|
148 |
public JRadioButton getVectorizeAllBBox() { |
|
149 |
if(vectorizeBBoxSelect == null) { |
|
150 |
vectorizeBBoxSelect = new JRadioButton(RasterToolsUtil.getText(this, "vectbbox")); |
|
151 |
} |
|
152 |
return vectorizeBBoxSelect; |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* Obtiene el bot?n de no vectorizar lo que queda en el exterior de la ROI |
|
157 |
* @return JRadioButton |
|
158 |
*/ |
|
159 |
public JRadioButton getVectorizeOnlyInside() { |
|
160 |
if(vectorizeOnlyInside == null) { |
|
161 |
vectorizeOnlyInside = new JRadioButton(RasterToolsUtil.getText(this, "vectinside")); |
|
162 |
} |
|
163 |
return vectorizeOnlyInside; |
|
164 |
} |
|
165 |
|
|
166 |
/* |
|
167 |
* (non-Javadoc) |
|
168 |
* @see javax.swing.event.TableModelListener#tableChanged(javax.swing.event.TableModelEvent) |
|
169 |
*/ |
|
170 |
public void tableChanged(TableModelEvent e) { |
|
171 |
} |
|
172 |
|
|
173 |
/** |
|
174 |
* Obtiene el contenedor con la tabla. |
|
175 |
* @return |
|
176 |
*/ |
|
177 |
public TableContainer getTableContainer() { |
|
178 |
if (tableContainer == null) { |
|
179 |
String[] columnNames = {" ", "Nombre", ""}; |
|
180 |
int[] columnWidths = {22, 334, 0}; |
|
181 |
tableContainer = new TableContainer(columnNames, columnWidths); |
|
182 |
tableContainer.setModel("CheckBoxModel"); |
|
183 |
tableContainer.initialize(); |
|
184 |
tableContainer.setControlVisible(false); |
|
185 |
tableContainer.setMoveRowsButtonsVisible(false); |
|
186 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(0).setMinWidth(22); |
|
187 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(0).setMaxWidth(22); |
|
188 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(2).setMinWidth(0); |
|
189 |
tableContainer.getTable().getJTable().getColumnModel().getColumn(2).setMaxWidth(0); |
|
190 |
tableContainer.getModel().addTableModelListener(this); |
|
191 |
} |
|
192 |
return tableContainer; |
|
193 |
} |
|
194 |
|
|
195 |
/** |
|
196 |
* Inicializa la barra con los botones de selecci?n de ?rea |
|
197 |
* @return |
|
198 |
*/ |
|
199 |
public ButtonBarContainer getButtonBarContainer() { |
|
200 |
if (buttonBarContainer == null) { |
|
201 |
buttonBarContainer = new ButtonBarContainer(); |
|
202 |
buttonBarContainer.addButton("fullExtent.png", RasterToolsUtil.getText(this, "fullExtent"), 0); |
|
203 |
buttonBarContainer.addButton("selectTool.png", RasterToolsUtil.getText(this, "select_tool"), 1); |
|
204 |
buttonBarContainer.setButtonAlignment("left"); |
|
205 |
buttonBarContainer.setComponentBorder(false); |
|
206 |
} |
|
207 |
return buttonBarContainer; |
|
208 |
} |
|
209 |
|
|
210 |
/** |
|
211 |
* Gesti?n del evento del check de activaci?n y desactivaci?n |
|
212 |
*/ |
|
213 |
public void actionPerformed(ActionEvent e) { |
|
214 |
setComponentEnabled(enabled); |
|
215 |
if(e.getSource() == getAreaSelector()) { |
|
216 |
setAreaSelectorEnabled(true); |
|
217 |
setROISelectorEnabled(false); |
|
218 |
} |
|
219 |
if(e.getSource() == getROISelector()) { |
|
220 |
setAreaSelectorEnabled(false); |
|
221 |
setROISelectorEnabled(true); |
|
222 |
} |
|
223 |
} |
|
224 |
|
|
225 |
/** |
|
226 |
* Activa o desactiva el componente. El estado de activaci?n y desactivaci?n de un |
|
227 |
* componente depende de los controles que contiene. En este caso activa o desactiva |
|
228 |
* la barra de incremento. |
|
229 |
* @param enabled |
|
230 |
*/ |
|
231 |
public void setComponentEnabled(boolean enabled) { |
|
232 |
setAreaSelectorEnabled(enabled); |
|
233 |
setROISelectorEnabled(enabled); |
|
234 |
this.enabled = !enabled; |
|
235 |
} |
|
236 |
|
|
237 |
/** |
|
238 |
* Activa o desactiva el componente de selector de ?rea |
|
239 |
* @param enabled |
|
240 |
*/ |
|
241 |
public void setAreaSelectorEnabled(boolean enabled) { |
|
242 |
getButtonBarContainer().getButton(0).setEnabled(enabled); |
|
243 |
getButtonBarContainer().getButton(1).setEnabled(enabled); |
|
244 |
} |
|
245 |
|
|
246 |
/** |
|
247 |
* Activa o desactiva el componente de selector de ROI |
|
248 |
* @param enabled |
|
249 |
*/ |
|
250 |
public void setROISelectorEnabled(boolean enabled) { |
|
251 |
getTableContainer().setEnabled(enabled); |
|
252 |
getROI().setEnabled(enabled); |
|
253 |
getVectorizeAllBBox().setEnabled(enabled); |
|
254 |
getVectorizeOnlyInside().setEnabled(enabled); |
|
255 |
} |
|
256 |
|
|
257 |
/** |
|
258 |
* Obtener regi?n de inter?s desde la vista. |
|
259 |
* @return JButton |
|
260 |
*/ |
|
261 |
public JButton getROI() { |
|
262 |
if(selectROI == null) |
|
263 |
selectROI = new JButton(RasterToolsUtil.getText(this, "selectROI")); |
|
264 |
return selectROI; |
|
265 |
} |
|
266 |
|
|
267 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/clip/CoordinatesSelectionPanel.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.clip; |
|
20 |
|
|
21 |
import java.awt.BorderLayout; |
|
22 |
import java.awt.GridBagConstraints; |
|
23 |
import java.awt.GridBagLayout; |
|
24 |
import java.awt.Insets; |
|
25 |
import java.awt.event.ActionEvent; |
|
26 |
import java.awt.event.ActionListener; |
|
27 |
import java.util.Observable; |
|
28 |
import java.util.Observer; |
|
29 |
|
|
30 |
import javax.swing.JComboBox; |
|
31 |
import javax.swing.JLabel; |
|
32 |
import javax.swing.JPanel; |
|
33 |
|
|
34 |
import org.gvsig.gui.beans.coordinatespanel.CoordinatesPanel; |
|
35 |
import org.gvsig.raster.beans.previewbase.IUserPanelInterface; |
|
36 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
37 |
import org.gvsig.raster.util.RasterUtilities; |
|
38 |
import org.gvsig.rastertools.clipping.ClippingData; |
|
39 |
import org.gvsig.rastertools.vectorizacion.data.CoordinatesSelectionData; |
|
40 |
import org.gvsig.rastertools.vectorizacion.listener.PreprocessListener; |
|
41 |
|
|
42 |
import com.iver.andami.PluginServices; |
|
43 |
|
|
44 |
/** |
|
45 |
* Panel con los controles de selecci?n de ?rea y coordenadas. |
|
46 |
* |
|
47 |
* 09/06/2008 |
|
48 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
49 |
*/ |
|
50 |
public class CoordinatesSelectionPanel extends JPanel implements ActionListener, IUserPanelInterface, Observer { |
|
51 |
private static final long serialVersionUID = 1L; |
|
52 |
|
|
53 |
private CoordinatesPanel coordinatesPixel = null; |
|
54 |
private CoordinatesPanel coordinatesReales = null; |
|
55 |
private SelectionAreaPanel selectArea = null; |
|
56 |
|
|
57 |
private JComboBox outputScale = null; |
|
58 |
private JPanel outputScalePanel = null; |
|
59 |
|
|
60 |
private PreprocessListener listener = null; |
|
61 |
|
|
62 |
/** |
|
63 |
* Constructor |
|
64 |
*/ |
|
65 |
public CoordinatesSelectionPanel(PreprocessListener listener) { |
|
66 |
this.listener = listener; |
|
67 |
init(); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Constructor vacio para la ejecuci?n como bean |
|
72 |
*/ |
|
73 |
public CoordinatesSelectionPanel() { |
|
74 |
init(); |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* Inicializaci?n de los componentes gr?ficos |
|
79 |
*/ |
|
80 |
private void init() { |
|
81 |
setLayout(new GridBagLayout()); |
|
82 |
|
|
83 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
84 |
gridBagConstraints.gridy = 0; |
|
85 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
86 |
gridBagConstraints.anchor = GridBagConstraints.NORTH; |
|
87 |
gridBagConstraints.weightx = 1.0; |
|
88 |
add(getPixelCoordinates(), gridBagConstraints); |
|
89 |
|
|
90 |
gridBagConstraints.gridy = 1; |
|
91 |
add(getRealCoordinates(), gridBagConstraints); |
|
92 |
|
|
93 |
gridBagConstraints.fill = GridBagConstraints.BOTH; |
|
94 |
gridBagConstraints.weighty = 1.0; |
|
95 |
gridBagConstraints.gridy = 2; |
|
96 |
add(getSelectionAreaPanel(), gridBagConstraints); |
|
97 |
|
|
98 |
gridBagConstraints.gridy = 3; |
|
99 |
gridBagConstraints.weighty = 0; |
|
100 |
gridBagConstraints.insets = new Insets(5, 1, 5, 1); |
|
101 |
add(getOutputScalePanel(), gridBagConstraints); |
|
102 |
} |
|
103 |
|
|
104 |
/** |
|
105 |
* This method initializes jPanel |
|
106 |
* @return javax.swing.JPanel |
|
107 |
*/ |
|
108 |
public CoordinatesPanel getPixelCoordinates() { |
|
109 |
if (coordinatesPixel == null) { |
|
110 |
coordinatesPixel = new CoordinatesPanel(); |
|
111 |
coordinatesPixel.setTitlePanel(PluginServices.getText(this, "coordenadas_pixel")); |
|
112 |
} |
|
113 |
return coordinatesPixel; |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
117 |
* This method initializes jPanel1 |
|
118 |
* @return javax.swing.JPanel |
|
119 |
*/ |
|
120 |
public CoordinatesPanel getRealCoordinates() { |
|
121 |
if (coordinatesReales == null) { |
|
122 |
coordinatesReales = new CoordinatesPanel(); |
|
123 |
coordinatesReales.setTitlePanel(PluginServices.getText(this, "coordenadas_reales")); |
|
124 |
} |
|
125 |
return coordinatesReales; |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Obtiene el panel con la selecci?n de ?rea |
|
130 |
* @return |
|
131 |
*/ |
|
132 |
public SelectionAreaPanel getSelectionAreaPanel() { |
|
133 |
if(selectArea == null) |
|
134 |
selectArea = new SelectionAreaPanel(); |
|
135 |
return selectArea; |
|
136 |
} |
|
137 |
|
|
138 |
public void actionPerformed(ActionEvent e) { |
|
139 |
} |
|
140 |
|
|
141 |
/* |
|
142 |
* (non-Javadoc) |
|
143 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getPanel() |
|
144 |
*/ |
|
145 |
public JPanel getPanel() { |
|
146 |
return this; |
|
147 |
} |
|
148 |
|
|
149 |
/* |
|
150 |
* (non-Javadoc) |
|
151 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getTitle() |
|
152 |
*/ |
|
153 |
public String getTitle() { |
|
154 |
return RasterToolsUtil.getText(this, "selectarea"); |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* Obtiene el panel con la escala de salida |
|
159 |
* @return |
|
160 |
*/ |
|
161 |
public JPanel getOutputScalePanel() { |
|
162 |
if(outputScalePanel == null) { |
|
163 |
outputScalePanel = new JPanel(); |
|
164 |
outputScalePanel.setLayout(new BorderLayout()); |
|
165 |
outputScalePanel.add(new JLabel(RasterToolsUtil.getText(this, "outputscale")), BorderLayout.WEST); |
|
166 |
outputScalePanel.add(getComboOutputScale(), BorderLayout.CENTER); |
|
167 |
} |
|
168 |
return outputScalePanel; |
|
169 |
} |
|
170 |
|
|
171 |
/** |
|
172 |
* Obtiene el combo con la escala de salida |
|
173 |
* @return |
|
174 |
*/ |
|
175 |
public JComboBox getComboOutputScale() { |
|
176 |
if(outputScale == null) { |
|
177 |
outputScale = new JComboBox(); |
|
178 |
} |
|
179 |
return outputScale; |
|
180 |
} |
|
181 |
|
|
182 |
/** |
|
183 |
* Actualiza los valores de los paneles cuando los datos de ClippingData varian |
|
184 |
* @param o |
|
185 |
* @param arg |
|
186 |
*/ |
|
187 |
public void update(Observable o, Object arg) { |
|
188 |
if(!(o instanceof CoordinatesSelectionData)) |
|
189 |
return; |
|
190 |
CoordinatesSelectionData data = (CoordinatesSelectionData)o; |
|
191 |
|
|
192 |
if(listener == null) |
|
193 |
return; |
|
194 |
listener.setEnableValueChangedEvent(false); |
|
195 |
String[] scales = data.getScales(); |
|
196 |
getComboOutputScale().removeAllItems(); |
|
197 |
for (int i = 0; i < scales.length; i++) |
|
198 |
getComboOutputScale().addItem(scales[i]); |
|
199 |
|
|
200 |
getComboOutputScale().setSelectedIndex(data.getScaleSelected()); |
|
201 |
getRealCoordinates().setValues(RasterUtilities.getCoord(data.getUlxWc(), data.getUlyWc(), data.getLrxWc(), data.getLryWc(), ClippingData.DEC)); |
|
202 |
getPixelCoordinates().setValues(RasterUtilities.getCoord(data.getPxMinX(), data.getPxMinY(), data.getPxMaxX(), data.getPxMaxY(), ClippingData.DEC)); |
|
203 |
listener.setEnableValueChangedEvent(true); |
|
204 |
} |
|
205 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/grayscale/HighPassPanel.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.grayscale; |
|
20 |
|
|
21 |
import java.awt.GridBagConstraints; |
|
22 |
import java.awt.GridBagLayout; |
|
23 |
import java.awt.Insets; |
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import javax.swing.BorderFactory; |
|
28 |
import javax.swing.JCheckBox; |
|
29 |
import javax.swing.JPanel; |
|
30 |
|
|
31 |
import org.gvsig.gui.beans.checkslidertext.CheckSliderTextContainer; |
|
32 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
33 |
|
|
34 |
/** |
|
35 |
* Panel con los controles del filtro de paso alto. |
|
36 |
* |
|
37 |
* 09/06/2008 |
|
38 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
39 |
*/ |
|
40 |
public class HighPassPanel extends JPanel implements ActionListener { |
|
41 |
private static final long serialVersionUID = 1L; |
|
42 |
private JCheckBox active = null; |
|
43 |
private CheckSliderTextContainer radio = null; |
|
44 |
private boolean enabled = true; |
|
45 |
|
|
46 |
public HighPassPanel() { |
|
47 |
init(); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Inicializaci?n de los componentes gr?ficos |
|
52 |
*/ |
|
53 |
private void init() { |
|
54 |
setLayout(new GridBagLayout()); |
|
55 |
setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "highpassfilter"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
56 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
57 |
gbc.fill = GridBagConstraints.BOTH; |
|
58 |
gbc.weightx = 1; |
|
59 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
60 |
|
|
61 |
this.add(getActive(), gbc); |
|
62 |
|
|
63 |
gbc.gridy = 1; |
|
64 |
this.add(getRadio(), gbc); |
|
65 |
|
|
66 |
getActive().addActionListener(this); |
|
67 |
setComponentEnabled(false); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Obtiene el check de activo |
|
72 |
* @return JCheckBox |
|
73 |
*/ |
|
74 |
public JCheckBox getActive() { |
|
75 |
if(active == null) { |
|
76 |
active = new JCheckBox(); |
|
77 |
active.setSelected(false); |
|
78 |
} |
|
79 |
return active; |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Obtiene la barra deslizadora con el radio del filtro de paso alto |
|
84 |
* @return CheckSliderTextContainer |
|
85 |
*/ |
|
86 |
public CheckSliderTextContainer getRadio() { |
|
87 |
if(radio == null) |
|
88 |
radio = new CheckSliderTextContainer(0, 255, 127, false, RasterToolsUtil.getText(this, "radio"), true, false, false); |
|
89 |
return radio; |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* Gesti?n del evento del check de activaci?n y desactivaci?n |
|
94 |
*/ |
|
95 |
public void actionPerformed(ActionEvent e) { |
|
96 |
setComponentEnabled(enabled); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Activa o desactiva el componente. El estado de activaci?n y desactivaci?n de un |
|
101 |
* componente depende de los controles que contiene. En este caso activa o desactiva |
|
102 |
* la barra de incremento. |
|
103 |
* @param enabled |
|
104 |
*/ |
|
105 |
public void setComponentEnabled(boolean enabled) { |
|
106 |
getRadio().setControlEnabled(enabled); |
|
107 |
this.enabled = !enabled; |
|
108 |
} |
|
109 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/grayscale/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.grayscale; |
|
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.filter.grayscale.GrayScaleFilter; |
|
34 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
35 |
import org.gvsig.rastertools.vectorizacion.data.GrayConversionData; |
|
36 |
import org.gvsig.rastertools.vectorizacion.listener.PreprocessListener; |
|
37 |
|
|
38 |
import com.iver.utiles.swing.JComboBox; |
|
39 |
|
|
40 |
/** |
|
41 |
* Panel para la conversi?n a escala de grises. |
|
42 |
* |
|
43 |
* 09/06/2008 |
|
44 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
45 |
*/ |
|
46 |
public class GrayConversionPanel extends JPanel implements IUserPanelInterface, Observer { |
|
47 |
private static final long serialVersionUID = -1; |
|
48 |
|
|
49 |
private NoisePanel noisePanel = null; |
|
50 |
private HighPassPanel highPassPanel = null; |
|
51 |
private PosterizationPanel posterizationPanel = null; |
|
52 |
|
|
53 |
private JComboBox comboBands = null; |
|
54 |
private JPanel levelsPanel = null; |
|
55 |
|
|
56 |
private PreprocessListener listener = null; |
|
57 |
|
|
58 |
/** |
|
59 |
* Constructor sin par?metro para poder instanciar como Bean |
|
60 |
*/ |
|
61 |
public GrayConversionPanel(PreprocessListener list) { |
|
62 |
this.listener = list; |
|
63 |
init(); |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Inicializa los componentes gr?ficos |
|
68 |
*/ |
|
69 |
private void init() { |
|
70 |
setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "grayescaleconversion"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
71 |
setLayout(new GridBagLayout()); |
|
72 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
73 |
gbc.weightx = 1; |
|
74 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
75 |
gbc.insets = new Insets(0, 2, 2, 2); |
|
76 |
|
|
77 |
gbc.gridy = 0; |
|
78 |
add(getLevelPanel(), gbc); |
|
79 |
|
|
80 |
gbc.fill = GridBagConstraints.BOTH; |
|
81 |
gbc.weighty = 1; |
|
82 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
83 |
gbc.gridy = 1; |
|
84 |
add(getPosterizationPanel(), gbc); |
|
85 |
|
|
86 |
gbc.gridy = 2; |
|
87 |
add(getHighPassPanel(), gbc); |
|
88 |
|
|
89 |
gbc.gridy = 3; |
|
90 |
add(getNoisePanel(), gbc); |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* Obtiene el panel con los niveles |
|
95 |
* @return |
|
96 |
*/ |
|
97 |
public JPanel getLevelPanel() { |
|
98 |
if(levelsPanel == null) { |
|
99 |
levelsPanel = new JPanel(); |
|
100 |
levelsPanel.setLayout(new BorderLayout()); |
|
101 |
levelsPanel.add(new JLabel(RasterToolsUtil.getText(this, "bands")), BorderLayout.WEST); |
|
102 |
levelsPanel.add(getComboBands(), BorderLayout.CENTER); |
|
103 |
} |
|
104 |
return levelsPanel; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Obtiene el panel con el panel de posterizaci?n |
|
109 |
* @return PosterizationPanel |
|
110 |
*/ |
|
111 |
public PosterizationPanel getPosterizationPanel() { |
|
112 |
if(posterizationPanel == null) { |
|
113 |
posterizationPanel = new PosterizationPanel(); |
|
114 |
} |
|
115 |
return posterizationPanel; |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* Obtiene el panel con el fitro de paso alto |
|
120 |
* @return HighPassPanel |
|
121 |
*/ |
|
122 |
public HighPassPanel getHighPassPanel() { |
|
123 |
if(highPassPanel == null) { |
|
124 |
highPassPanel = new HighPassPanel(); |
|
125 |
} |
|
126 |
return highPassPanel; |
|
127 |
} |
|
128 |
|
|
129 |
/** |
|
130 |
* Obtiene el panel con el fitro de ruido |
|
131 |
* @return HighPassPanel |
|
132 |
*/ |
|
133 |
public NoisePanel getNoisePanel() { |
|
134 |
if(noisePanel == null) { |
|
135 |
noisePanel = new NoisePanel(); |
|
136 |
} |
|
137 |
return noisePanel; |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* Obtiene el combo con los niveles |
|
142 |
* @return |
|
143 |
*/ |
|
144 |
public JComboBox getComboBands() { |
|
145 |
if(comboBands == null) { |
|
146 |
comboBands = new JComboBox(); |
|
147 |
} |
|
148 |
return comboBands; |
|
149 |
} |
|
150 |
|
|
151 |
/* |
|
152 |
* (non-Javadoc) |
|
153 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getPanel() |
|
154 |
*/ |
|
155 |
public JPanel getPanel() { |
|
156 |
return this; |
|
157 |
} |
|
158 |
|
|
159 |
/* |
|
160 |
* (non-Javadoc) |
|
161 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getTitle() |
|
162 |
*/ |
|
163 |
public String getTitle() { |
|
164 |
return "grayscaleconversion"; |
|
165 |
} |
|
166 |
|
|
167 |
/* |
|
168 |
* (non-Javadoc) |
|
169 |
* @see java.util.Observer#update(java.util.Observable, java.lang.Object) |
|
170 |
*/ |
|
171 |
public void update(Observable o, Object arg) { |
|
172 |
if(!(o instanceof GrayConversionData)) |
|
173 |
return; |
|
174 |
GrayConversionData data = (GrayConversionData)o; |
|
175 |
|
|
176 |
if(listener == null) |
|
177 |
return; |
|
178 |
listener.setEnableValueChangedEvent(false); |
|
179 |
|
|
180 |
String[] bands = data.getBands(); |
|
181 |
getComboBands().removeAllItems(); |
|
182 |
for (int i = 0; i < bands.length; i++) |
|
183 |
getComboBands().addItem(bands[i]); |
|
184 |
|
|
185 |
switch (data.getBandType()) { |
|
186 |
case GrayScaleFilter.R: |
|
187 |
case GrayScaleFilter.GRAY: getComboBands().setSelectedIndex(0); |
|
188 |
break; |
|
189 |
case GrayScaleFilter.G: getComboBands().setSelectedIndex(1); |
|
190 |
break; |
|
191 |
case GrayScaleFilter.B: getComboBands().setSelectedIndex(2); |
|
192 |
break; |
|
193 |
case GrayScaleFilter.RGB: getComboBands().setSelectedIndex(3); |
|
194 |
break; |
|
195 |
} |
|
196 |
|
|
197 |
getPosterizationPanel().setComponentEnabled(data.isPosterizationActive()); |
|
198 |
getPosterizationPanel().getLevels().setValue(data.getPosterizationLevels() + ""); |
|
199 |
|
|
200 |
getHighPassPanel().setComponentEnabled(data.isHighPassActive()); |
|
201 |
|
|
202 |
getNoisePanel().setComponentEnabled(data.isNoiseActive()); |
|
203 |
|
|
204 |
listener.setEnableValueChangedEvent(true); |
|
205 |
} |
|
206 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/grayscale/PosterizationPanel.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.grayscale; |
|
20 |
|
|
21 |
import java.awt.GridBagConstraints; |
|
22 |
import java.awt.GridBagLayout; |
|
23 |
import java.awt.Insets; |
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import javax.swing.BorderFactory; |
|
28 |
import javax.swing.JCheckBox; |
|
29 |
import javax.swing.JPanel; |
|
30 |
|
|
31 |
import org.gvsig.gui.beans.checkslidertext.CheckSliderTextContainer; |
|
32 |
import org.gvsig.gui.beans.datainput.DataInputContainer; |
|
33 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
34 |
|
|
35 |
/** |
|
36 |
* Panel con los controles para la posterizaci?n. |
|
37 |
* |
|
38 |
* 09/06/2008 |
|
39 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
40 |
*/ |
|
41 |
public class PosterizationPanel extends JPanel implements ActionListener { |
|
42 |
private static final long serialVersionUID = 1L; |
|
43 |
private JCheckBox active = null; |
|
44 |
private DataInputContainer levels = null; |
|
45 |
private CheckSliderTextContainer threshold = null; |
|
46 |
private boolean enabled = true; |
|
47 |
|
|
48 |
public PosterizationPanel() { |
|
49 |
init(); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* Inicializaci?n de los componentes gr?ficos |
|
54 |
*/ |
|
55 |
private void init() { |
|
56 |
setLayout(new GridBagLayout()); |
|
57 |
setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "posterization"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
58 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
59 |
gbc.fill = GridBagConstraints.BOTH; |
|
60 |
gbc.weightx = 1; |
|
61 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
62 |
|
|
63 |
this.add(getActive(), gbc); |
|
64 |
|
|
65 |
gbc.gridy = 1; |
|
66 |
this.add(getLevels(), gbc); |
|
67 |
|
|
68 |
gbc.gridy = 2; |
|
69 |
this.add(getThreshold(), gbc); |
|
70 |
|
|
71 |
getActive().addActionListener(this); |
|
72 |
setComponentEnabled(false); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Obtiene el check de activo |
|
77 |
* @return JCheckBox |
|
78 |
*/ |
|
79 |
public JCheckBox getActive() { |
|
80 |
if(active == null) { |
|
81 |
active = new JCheckBox(); |
|
82 |
active.setSelected(true); |
|
83 |
} |
|
84 |
return active; |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Obtiene el control con el n?mero de niveles |
|
89 |
* @return DataInputContainer |
|
90 |
*/ |
|
91 |
public DataInputContainer getLevels() { |
|
92 |
if(levels == null) { |
|
93 |
levels = new DataInputContainer(); |
|
94 |
levels.setLabelText(RasterToolsUtil.getText(this, "levels")); |
|
95 |
} |
|
96 |
return levels; |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Obtiene la barra deslizadora con el umbral de posterizaci?n |
|
101 |
* @return CheckSliderTextContainer |
|
102 |
*/ |
|
103 |
public CheckSliderTextContainer getThreshold() { |
|
104 |
if(threshold == null) |
|
105 |
threshold = new CheckSliderTextContainer(0, 255, 127, false, RasterToolsUtil.getText(this, "threshold"), true, false, false); |
|
106 |
return threshold; |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* Gesti?n del evento del check de activaci?n y desactivaci?n |
|
111 |
*/ |
|
112 |
public void actionPerformed(ActionEvent e) { |
|
113 |
setComponentEnabled(enabled); |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
117 |
* Activa o desactiva el componente. El estado de activaci?n y desactivaci?n de un |
|
118 |
* componente depende de los controles que contiene. En este caso activa o desactiva |
|
119 |
* la barra de incremento y el campo de texto con el n?mero de niveles. |
|
120 |
* @param enabled |
|
121 |
*/ |
|
122 |
public void setComponentEnabled(boolean enabled) { |
|
123 |
getThreshold().setControlEnabled(enabled); |
|
124 |
getLevels().setControlEnabled(enabled); |
|
125 |
this.enabled = enabled; |
|
126 |
} |
|
127 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/ui/grayscale/NoisePanel.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.grayscale; |
|
20 |
|
|
21 |
import java.awt.GridBagConstraints; |
|
22 |
import java.awt.GridBagLayout; |
|
23 |
import java.awt.Insets; |
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import javax.swing.BorderFactory; |
|
28 |
import javax.swing.JCheckBox; |
|
29 |
import javax.swing.JPanel; |
|
30 |
|
|
31 |
import org.gvsig.gui.beans.checkslidertext.CheckSliderTextContainer; |
|
32 |
import org.gvsig.raster.util.RasterToolsUtil; |
|
33 |
|
|
34 |
/** |
|
35 |
* Panel con los controles del filtro de ruido. |
|
36 |
* |
|
37 |
* 09/06/2008 |
|
38 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
39 |
*/ |
|
40 |
public class NoisePanel extends JPanel implements ActionListener { |
|
41 |
private static final long serialVersionUID = 1L; |
|
42 |
private JCheckBox active = null; |
|
43 |
private CheckSliderTextContainer threshold = null; |
|
44 |
private boolean enabled = true; |
|
45 |
|
|
46 |
public NoisePanel() { |
|
47 |
init(); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* Inicializaci?n de los componentes gr?ficos |
|
52 |
*/ |
|
53 |
private void init() { |
|
54 |
setLayout(new GridBagLayout()); |
|
55 |
setBorder(BorderFactory.createTitledBorder(null, RasterToolsUtil.getText(this, "noisefilter"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
56 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
57 |
gbc.fill = GridBagConstraints.BOTH; |
|
58 |
gbc.weightx = 1; |
|
59 |
gbc.insets = new Insets(0, 0, 0, 0); |
|
60 |
|
|
61 |
this.add(getActive(), gbc); |
|
62 |
|
|
63 |
gbc.gridy = 1; |
|
64 |
this.add(getThreshold(), gbc); |
|
65 |
|
|
66 |
getActive().addActionListener(this); |
|
67 |
setComponentEnabled(false); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Obtiene el check de activo |
|
72 |
* @return JCheckBox |
|
73 |
*/ |
|
74 |
public JCheckBox getActive() { |
|
75 |
if(active == null) |
|
76 |
active = new JCheckBox(); |
|
77 |
return active; |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Obtiene la barra deslizadora con el radio del filtro de paso alto |
|
82 |
* @return CheckSliderTextContainer |
|
83 |
*/ |
|
84 |
public CheckSliderTextContainer getThreshold() { |
|
85 |
if(threshold == null) |
|
86 |
threshold = new CheckSliderTextContainer(0, 255, 127, false, RasterToolsUtil.getText(this, "threshold"), true, false, false); |
|
87 |
return threshold; |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* Gesti?n del evento del check de activaci?n y desactivaci?n |
|
92 |
*/ |
|
93 |
public void actionPerformed(ActionEvent e) { |
|
94 |
setComponentEnabled(enabled); |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* Activa o desactiva el componente. El estado de activaci?n y desactivaci?n de un |
|
99 |
* componente depende de los controles que contiene. En este caso activa o desactiva |
|
100 |
* la barra de incremento. |
|
101 |
* @param enabled |
|
102 |
*/ |
|
103 |
public void setComponentEnabled(boolean enabled) { |
|
104 |
getThreshold().setControlEnabled(enabled); |
|
105 |
this.enabled = !enabled; |
|
106 |
} |
|
107 |
} |
Also available in: Unified diff