root / trunk / extensions / extRasterTools-SE / src / org / gvsig / raster / gui / preferences / RasterPreferences.java @ 17330
History | View | Annotate | Download (13 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 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.raster.gui.preferences; |
20 |
|
21 |
import java.awt.BorderLayout; |
22 |
import java.awt.GridBagConstraints; |
23 |
import java.awt.GridBagLayout; |
24 |
import java.awt.Insets; |
25 |
|
26 |
import javax.swing.BorderFactory; |
27 |
import javax.swing.ButtonGroup; |
28 |
import javax.swing.DefaultComboBoxModel; |
29 |
import javax.swing.ImageIcon; |
30 |
import javax.swing.JButton; |
31 |
import javax.swing.JCheckBox; |
32 |
import javax.swing.JComboBox; |
33 |
import javax.swing.JLabel; |
34 |
import javax.swing.JPanel; |
35 |
import javax.swing.JRadioButton; |
36 |
import javax.swing.JScrollPane; |
37 |
import javax.swing.JTextField; |
38 |
|
39 |
import org.gvsig.raster.gui.preferences.panels.PreferenceCache; |
40 |
import org.gvsig.raster.gui.preferences.panels.PreferenceNoData; |
41 |
import org.gvsig.raster.gui.preferences.panels.PreferenceOverviews; |
42 |
|
43 |
import com.iver.andami.PluginServices; |
44 |
import com.iver.andami.preferences.AbstractPreferencePage; |
45 |
import com.iver.andami.preferences.StoreException; |
46 |
/**
|
47 |
*
|
48 |
* @version 11/12/2007
|
49 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
50 |
*/
|
51 |
public class RasterPreferences extends AbstractPreferencePage { |
52 |
private static final long serialVersionUID = -1689657253810393874L; |
53 |
|
54 |
protected static String id = RasterPreferences.class.getName(); |
55 |
private ImageIcon icon; |
56 |
|
57 |
private PreferenceNoData noData = null; |
58 |
private PreferenceOverviews overviews = null; |
59 |
private PreferenceCache cache = null; |
60 |
|
61 |
public RasterPreferences() {
|
62 |
super();
|
63 |
icon = PluginServices.getIconTheme().get("pref-raster-icon");
|
64 |
initialize(); |
65 |
} |
66 |
|
67 |
private void initialize() { |
68 |
ButtonGroup buttonGroup1;
|
69 |
JScrollPane jScrollPane1;
|
70 |
GridBagConstraints gridBagConstraints;
|
71 |
JButton jButton1;
|
72 |
JCheckBox jCheckBox4;
|
73 |
JCheckBox jCheckBox5;
|
74 |
JCheckBox jCheckBox6;
|
75 |
JComboBox jComboBox2;
|
76 |
JComboBox jComboBox3;
|
77 |
JLabel jLabel6;
|
78 |
JLabel jLabel8;
|
79 |
JLabel jLabel9;
|
80 |
JPanel jPanel2;
|
81 |
JPanel jPanel4;
|
82 |
JPanel jPanel5;
|
83 |
JPanel jPanel6;
|
84 |
JPanel jPanel7;
|
85 |
JRadioButton jRadioButton1;
|
86 |
JRadioButton jRadioButton2;
|
87 |
JTextField jTextField4;
|
88 |
|
89 |
buttonGroup1 = new ButtonGroup(); |
90 |
jScrollPane1 = new javax.swing.JScrollPane();
|
91 |
|
92 |
jScrollPane1.getVerticalScrollBar().setUnitIncrement(20);
|
93 |
|
94 |
jPanel5 = new JPanel(); |
95 |
jPanel6 = new JPanel(); |
96 |
jPanel2 = new JPanel(); |
97 |
jLabel6 = new JLabel(); |
98 |
jTextField4 = new JTextField(); |
99 |
jButton1 = new JButton(); |
100 |
jPanel4 = new JPanel(); |
101 |
jCheckBox4 = new JCheckBox(); |
102 |
jCheckBox5 = new JCheckBox(); |
103 |
jLabel8 = new JLabel(); |
104 |
jComboBox2 = new JComboBox(); |
105 |
jCheckBox6 = new JCheckBox(); |
106 |
jPanel7 = new JPanel(); |
107 |
jLabel9 = new JLabel(); |
108 |
jRadioButton1 = new JRadioButton(); |
109 |
jRadioButton2 = new JRadioButton(); |
110 |
jComboBox3 = new JComboBox(); |
111 |
|
112 |
setTitle("Frame");
|
113 |
jPanel5.setLayout(new GridBagLayout()); |
114 |
|
115 |
gridBagConstraints = new GridBagConstraints(); |
116 |
gridBagConstraints.gridx = 0;
|
117 |
gridBagConstraints.gridy = 6;
|
118 |
gridBagConstraints.weightx = 1.0;
|
119 |
gridBagConstraints.weighty = 1.0;
|
120 |
jPanel5.add(jPanel6, gridBagConstraints); |
121 |
|
122 |
gridBagConstraints = new GridBagConstraints(); |
123 |
gridBagConstraints.gridx = 0;
|
124 |
gridBagConstraints.gridy = 5;
|
125 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
126 |
jPanel5.add(getPreferenceCache().getPanel(), gridBagConstraints); |
127 |
|
128 |
jPanel2.setLayout(new GridBagLayout()); |
129 |
|
130 |
jPanel2.setBorder(BorderFactory.createTitledBorder("Rutas")); |
131 |
jLabel6.setText("Temporales:");
|
132 |
gridBagConstraints = new GridBagConstraints(); |
133 |
gridBagConstraints.insets = new Insets(5, 5, 5, 2); |
134 |
jPanel2.add(jLabel6, gridBagConstraints); |
135 |
|
136 |
gridBagConstraints = new GridBagConstraints(); |
137 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
138 |
gridBagConstraints.weightx = 1.0;
|
139 |
gridBagConstraints.insets = new Insets(5, 2, 5, 2); |
140 |
jPanel2.add(jTextField4, gridBagConstraints); |
141 |
|
142 |
jButton1.setText("Abrir");
|
143 |
gridBagConstraints = new GridBagConstraints(); |
144 |
gridBagConstraints.insets = new Insets(5, 2, 5, 5); |
145 |
jPanel2.add(jButton1, gridBagConstraints); |
146 |
|
147 |
gridBagConstraints = new GridBagConstraints(); |
148 |
gridBagConstraints.gridx = 0;
|
149 |
gridBagConstraints.gridy = 3;
|
150 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
151 |
jPanel5.add(jPanel2, gridBagConstraints); |
152 |
|
153 |
gridBagConstraints = new GridBagConstraints(); |
154 |
gridBagConstraints.gridx = 0;
|
155 |
gridBagConstraints.gridy = 2;
|
156 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
157 |
jPanel5.add(getPreferenceNoData().getPanel(), gridBagConstraints); |
158 |
|
159 |
jPanel4.setLayout(new GridBagLayout()); |
160 |
|
161 |
jPanel4.setBorder(BorderFactory.createTitledBorder("General")); |
162 |
|
163 |
jCheckBox4.setText("Generar estad\u00edsticas al cargar el raster");
|
164 |
jCheckBox4.setToolTipText("Generar estad\u00edsticas al cargar el raster");
|
165 |
jCheckBox4.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
166 |
jCheckBox4.setMargin(new Insets(0, 0, 0, 0)); |
167 |
gridBagConstraints = new GridBagConstraints(); |
168 |
gridBagConstraints.gridx = 0;
|
169 |
gridBagConstraints.gridy = 0;
|
170 |
gridBagConstraints.gridwidth = 2;
|
171 |
gridBagConstraints.fill = GridBagConstraints.BOTH;
|
172 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
173 |
gridBagConstraints.weighty = 1.0;
|
174 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
175 |
jPanel4.add(jCheckBox4, gridBagConstraints); |
176 |
|
177 |
jCheckBox5.setText("Previsualizar autom\u00e1ticamente al cambiar las propiedades de raster");
|
178 |
jCheckBox5.setToolTipText("Previsualizar autom\u00e1ticamente al cambiar las propiedades de raster");
|
179 |
jCheckBox5.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
180 |
jCheckBox5.setMargin(new Insets(0, 0, 0, 0)); |
181 |
gridBagConstraints = new GridBagConstraints(); |
182 |
gridBagConstraints.gridx = 0;
|
183 |
gridBagConstraints.gridy = 1;
|
184 |
gridBagConstraints.gridwidth = 2;
|
185 |
gridBagConstraints.fill = GridBagConstraints.BOTH;
|
186 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
187 |
gridBagConstraints.weighty = 1.0;
|
188 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
189 |
jPanel4.add(jCheckBox5, gridBagConstraints); |
190 |
|
191 |
jLabel8.setText("N\u00ba de clases:");
|
192 |
gridBagConstraints = new GridBagConstraints(); |
193 |
gridBagConstraints.gridx = 0;
|
194 |
gridBagConstraints.gridy = 2;
|
195 |
gridBagConstraints.anchor = GridBagConstraints.EAST;
|
196 |
gridBagConstraints.insets = new Insets(2, 5, 2, 2); |
197 |
jPanel4.add(jLabel8, gridBagConstraints); |
198 |
|
199 |
jComboBox2.setModel(new DefaultComboBoxModel(new String[] { "32", "64", "128", "256" })); |
200 |
gridBagConstraints = new GridBagConstraints(); |
201 |
gridBagConstraints.gridx = 1;
|
202 |
gridBagConstraints.gridy = 2;
|
203 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
204 |
gridBagConstraints.weightx = 1.0;
|
205 |
gridBagConstraints.insets = new Insets(2, 2, 2, 5); |
206 |
jPanel4.add(jComboBox2, gridBagConstraints); |
207 |
|
208 |
jCheckBox6.setText("Pedir las coordenadas de georreferenciaci\u00f3n al cargar un raster que no lo tengo");
|
209 |
jCheckBox6.setToolTipText("Pedir las coordenadas de georreferenciaci\u00f3n al cargar un raster que no lo tengo");
|
210 |
jCheckBox6.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
211 |
jCheckBox6.setMargin(new Insets(0, 0, 0, 0)); |
212 |
gridBagConstraints = new GridBagConstraints(); |
213 |
gridBagConstraints.gridx = 0;
|
214 |
gridBagConstraints.gridy = 3;
|
215 |
gridBagConstraints.gridwidth = 2;
|
216 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
217 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
218 |
gridBagConstraints.insets = new Insets(2, 5, 5, 5); |
219 |
jPanel4.add(jCheckBox6, gridBagConstraints); |
220 |
|
221 |
gridBagConstraints = new GridBagConstraints(); |
222 |
gridBagConstraints.gridx = 0;
|
223 |
gridBagConstraints.gridy = 0;
|
224 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
225 |
jPanel5.add(jPanel4, gridBagConstraints); |
226 |
|
227 |
jPanel7.setLayout(new GridBagLayout()); |
228 |
|
229 |
jPanel7.setBorder(BorderFactory.createTitledBorder("Carga de capas")); |
230 |
jLabel9.setText("Al cargar una imagen no RGB, aplicarle:");
|
231 |
jLabel9.setToolTipText("Al cargar una imagen No RGB");
|
232 |
gridBagConstraints = new GridBagConstraints(); |
233 |
gridBagConstraints.gridx = 0;
|
234 |
gridBagConstraints.gridy = 0;
|
235 |
gridBagConstraints.gridwidth = 2;
|
236 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
237 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
238 |
gridBagConstraints.insets = new Insets(5, 5, 2, 5); |
239 |
jPanel7.add(jLabel9, gridBagConstraints); |
240 |
|
241 |
buttonGroup1.add(jRadioButton1); |
242 |
jRadioButton1.setSelected(true);
|
243 |
jRadioButton1.setText("Realce");
|
244 |
jRadioButton1.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
245 |
jRadioButton1.setMargin(new Insets(0, 0, 0, 0)); |
246 |
gridBagConstraints = new GridBagConstraints(); |
247 |
gridBagConstraints.gridx = 0;
|
248 |
gridBagConstraints.gridy = 1;
|
249 |
gridBagConstraints.gridwidth = 2;
|
250 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
251 |
gridBagConstraints.insets = new Insets(2, 5, 2, 5); |
252 |
jPanel7.add(jRadioButton1, gridBagConstraints); |
253 |
|
254 |
buttonGroup1.add(jRadioButton2); |
255 |
jRadioButton2.setText("Tabla de color");
|
256 |
jRadioButton2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
257 |
jRadioButton2.setMargin(new Insets(0, 0, 0, 0)); |
258 |
gridBagConstraints = new GridBagConstraints(); |
259 |
gridBagConstraints.gridx = 0;
|
260 |
gridBagConstraints.gridy = 2;
|
261 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
262 |
gridBagConstraints.insets = new Insets(2, 5, 5, 2); |
263 |
jPanel7.add(jRadioButton2, gridBagConstraints); |
264 |
|
265 |
gridBagConstraints = new GridBagConstraints(); |
266 |
gridBagConstraints.gridx = 1;
|
267 |
gridBagConstraints.gridy = 2;
|
268 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
269 |
gridBagConstraints.weightx = 1.0;
|
270 |
gridBagConstraints.insets = new Insets(2, 2, 5, 5); |
271 |
jPanel7.add(jComboBox3, gridBagConstraints); |
272 |
|
273 |
gridBagConstraints = new GridBagConstraints(); |
274 |
gridBagConstraints.gridx = 0;
|
275 |
gridBagConstraints.gridy = 1;
|
276 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
277 |
jPanel5.add(jPanel7, gridBagConstraints); |
278 |
|
279 |
gridBagConstraints = new GridBagConstraints(); |
280 |
gridBagConstraints.gridx = 0;
|
281 |
gridBagConstraints.gridy = 4;
|
282 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
283 |
jPanel5.add(getPreferenceOverviews().getPanel(), gridBagConstraints); |
284 |
|
285 |
jScrollPane1.setViewportView(jPanel5); |
286 |
|
287 |
this.setLayout(new BorderLayout()); |
288 |
this.add(jScrollPane1, BorderLayout.CENTER); |
289 |
} |
290 |
|
291 |
private PreferenceNoData getPreferenceNoData() {
|
292 |
if (noData == null) { |
293 |
noData = new PreferenceNoData();
|
294 |
} |
295 |
return noData;
|
296 |
} |
297 |
|
298 |
private PreferenceOverviews getPreferenceOverviews() {
|
299 |
if (overviews == null) { |
300 |
overviews = new PreferenceOverviews();
|
301 |
} |
302 |
return overviews;
|
303 |
} |
304 |
|
305 |
private PreferenceCache getPreferenceCache() {
|
306 |
if (cache == null) { |
307 |
cache = new PreferenceCache();
|
308 |
} |
309 |
return cache;
|
310 |
} |
311 |
|
312 |
/*
|
313 |
* (non-Javadoc)
|
314 |
* @see com.iver.andami.preferences.IPreference#initializeValues()
|
315 |
*/
|
316 |
public void initializeValues() { |
317 |
getPreferenceNoData().initializeValues(); |
318 |
getPreferenceOverviews().initializeValues(); |
319 |
getPreferenceCache().initializeValues(); |
320 |
} |
321 |
|
322 |
/*
|
323 |
* (non-Javadoc)
|
324 |
* @see com.iver.andami.preferences.AbstractPreferencePage#storeValues()
|
325 |
*/
|
326 |
public void storeValues() throws StoreException { |
327 |
getPreferenceNoData().storeValues(); |
328 |
getPreferenceOverviews().storeValues(); |
329 |
getPreferenceCache().storeValues(); |
330 |
} |
331 |
|
332 |
/*
|
333 |
* (non-Javadoc)
|
334 |
* @see com.iver.andami.preferences.IPreference#initializeDefaults()
|
335 |
*/
|
336 |
public void initializeDefaults() { |
337 |
getPreferenceNoData().initializeDefaults(); |
338 |
getPreferenceOverviews().initializeDefaults(); |
339 |
getPreferenceCache().initializeDefaults(); |
340 |
} |
341 |
|
342 |
/*
|
343 |
* (non-Javadoc)
|
344 |
* @see com.iver.andami.preferences.AbstractPreferencePage#isResizeable()
|
345 |
*/
|
346 |
public boolean isResizeable() { |
347 |
return true; |
348 |
} |
349 |
|
350 |
/*
|
351 |
* (non-Javadoc)
|
352 |
* @see com.iver.andami.preferences.IPreference#getID()
|
353 |
*/
|
354 |
public String getID() { |
355 |
return id;
|
356 |
} |
357 |
|
358 |
/*
|
359 |
* (non-Javadoc)
|
360 |
* @see com.iver.andami.preferences.IPreference#getIcon()
|
361 |
*/
|
362 |
public ImageIcon getIcon() { |
363 |
return icon;
|
364 |
} |
365 |
|
366 |
/*
|
367 |
* (non-Javadoc)
|
368 |
* @see com.iver.andami.preferences.IPreference#getPanel()
|
369 |
*/
|
370 |
public JPanel getPanel() { |
371 |
return this; |
372 |
} |
373 |
|
374 |
/*
|
375 |
* (non-Javadoc)
|
376 |
* @see com.iver.andami.preferences.IPreference#getTitle()
|
377 |
*/
|
378 |
public String getTitle() { |
379 |
return "Raster"; |
380 |
} |
381 |
|
382 |
/*
|
383 |
* (non-Javadoc)
|
384 |
* @see com.iver.andami.preferences.IPreference#isValueChanged()
|
385 |
*/
|
386 |
public boolean isValueChanged() { |
387 |
return true; |
388 |
} |
389 |
|
390 |
public void setChangesApplied() {} |
391 |
} |