Revision 9045

View differences:

trunk/extensions/extgvSIGPiloto-Raster/src/org/gvsig/rasterTools/raw/RawDriver.java
1
package org.gvsig.rasterTools.raw;
2

  
3
import java.awt.geom.Rectangle2D;
4
import java.io.File;
5
import java.io.IOException;
6

  
7
import org.cresques.cts.IProjection;
8
import org.cresques.io.GeoRasterFile;
9
import org.cresques.px.PxRaster;
10
import org.gvsig.rasterTools.raw.ui.main.OpenRawFileDefaultView;
11

  
12
import com.iver.cit.gvsig.fmap.drivers.raster.CmsRasterDriver;
13

  
14
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
15
 *
16
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
17
 *
18
 * This program is free software; you can redistribute it and/or
19
 * modify it under the terms of the GNU General Public License
20
 * as published by the Free Software Foundation; either version 2
21
 * of the License, or (at your option) any later version.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 * GNU General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU General Public License
29
 * along with this program; if not, write to the Free Software
30
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
31
 *
32
 * For more information, contact:
33
 *
34
 *  Generalitat Valenciana
35
 *   Conselleria d'Infraestructures i Transport
36
 *   Av. Blasco Ib??ez, 50
37
 *   46010 VALENCIA
38
 *   SPAIN
39
 *
40
 *      +34 963862235
41
 *   gvsig@gva.es
42
 *      www.gvsig.gva.es
43
 *
44
 *    or
45
 *
46
 *   IVER T.I. S.A
47
 *   Salamanca 50
48
 *   46005 Valencia
49
 *   Spain
50
 *
51
 *   +34 963163400
52
 *   dac@iver.es
53
 */
54
/* CVS MESSAGES:
55
 *
56
 * $Id$
57
 * $Log$
58
 * Revision 1.1  2006-11-28 11:49:25  nacho
59
 * *** empty log message ***
60
 *
61
 * Revision 1.1  2006/10/10 16:11:23  nacho
62
 * *** empty log message ***
63
 *
64
 * Revision 1.2  2006/08/01 12:56:00  jorpiell
65
 * Se abre el cuadro de di?logo en el momento de abrir el fichero
66
 *
67
 * Revision 1.1  2006/08/01 11:19:45  jorpiell
68
 * Eliminada la extensi?n y a?adido el driver
69
 *
70
 *
71
 */
72
/**
73
 * This driver loads a Raw file from a file. It opens a 
74
 * properties window to set some params to create a VRT
75
 * file and then uses it to load the raw file in the
76
 * gvSIG current view
77
 * 
78
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
79
 */
80
public class RawDriver extends CmsRasterDriver  {
81
	
82
	/* (non-Javadoc)
83
	 * @see com.hardcode.driverManager.Driver#getName()
84
	 */
85
	public String getName() {
86
		return "gvSIG Raw Image Driver";
87
	}
88
	
89
	/* (non-Javadoc)
90
	 * @see com.iver.cit.gvsig.fmap.drivers.RasterDriver#fileAccepted(java.io.File)
91
	 */
92
	public boolean fileAccepted(File file) {
93
		if (file.getName().toUpperCase().endsWith("RAW")){
94
			return true;
95
		}
96
		return false;
97
	}
98
	
99
	/*
100
	 *  (non-Javadoc)
101
	 * @see com.iver.cit.gvsig.fmap.drivers.raster.CmsRasterDriver#getTransformedFile(java.io.File)
102
	 */
103
	public File getTransformedFile(File file){
104
		OpenRawFileDefaultView view = new OpenRawFileDefaultView(file.getAbsolutePath());
105
		return view.getImageFile();
106
	}
107

  
108
}
0 109

  
trunk/extensions/extgvSIGPiloto-Raster/src/org/gvsig/rasterTools/raw/ui/main/OutputHeaderFormatPanel.java
1
package org.gvsig.rasterTools.raw.ui.main;
2

  
3
import java.awt.Dimension;
4
import java.awt.FlowLayout;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7

  
8
import javax.swing.JLabel;
9
import javax.swing.JPanel;
10
import javax.swing.JTextField;
11

  
12
import org.gvsig.rasterTools.raw.tools.VRTFormatOptions;
13

  
14
import com.iver.andami.PluginServices;
15
import com.iver.utiles.swing.JComboBox;
16

  
17
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
18
 *
19
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
20
 *
21
 * This program is free software; you can redistribute it and/or
22
 * modify it under the terms of the GNU General Public License
23
 * as published by the Free Software Foundation; either version 2
24
 * of the License, or (at your option) any later version.
25
 *
26
 * This program is distributed in the hope that it will be useful,
27
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
 * GNU General Public License for more details.
30
 *
31
 * You should have received a copy of the GNU General Public License
32
 * along with this program; if not, write to the Free Software
33
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
34
 *
35
 * For more information, contact:
36
 *
37
 *  Generalitat Valenciana
38
 *   Conselleria d'Infraestructures i Transport
39
 *   Av. Blasco Ib??ez, 50
40
 *   46010 VALENCIA
41
 *   SPAIN
42
 *
43
 *      +34 963862235
44
 *   gvsig@gva.es
45
 *      www.gvsig.gva.es
46
 *
47
 *    or
48
 *
49
 *   IVER T.I. S.A
50
 *   Salamanca 50
51
 *   46005 Valencia
52
 *   Spain
53
 *
54
 *   +34 963163400
55
 *   dac@iver.es
56
 */
57
/* CVS MESSAGES:
58
 *
59
 * $Id$
60
 * $Log$
61
 * Revision 1.1  2006-11-28 11:49:24  nacho
62
 * *** empty log message ***
63
 *
64
 * Revision 1.1  2006/10/10 16:11:22  nacho
65
 * *** empty log message ***
66
 *
67
 * Revision 1.3  2006/08/01 11:19:04  jorpiell
68
 * Ajustado el tama?o de las ventanas
69
 *
70
 * Revision 1.2  2006/07/31 10:44:28  jorpiell
71
 * Se ha a?adido el tama?o del fichero con un thread.
72
 *
73
 * Revision 1.1  2006/07/28 12:51:40  jorpiell
74
 * Primer commit de las clases empleadas para abrir raw
75
 *
76
 *
77
 */
78
/**
79
 * This class implements one part of the open raw file panel.
80
 * It contains the combobox to select the "output header format".
81
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
82
 */
83
public class OutputHeaderFormatPanel extends JPanel{
84
	private JPanel labelsPanel = null;
85
	private JPanel fieldsPanel = null;
86
	private JPanel OutputFormatTextPanel = null;
87
	private JPanel outputFormatLabelPanel = null;
88
	private JLabel outputFormatLabel = null;
89
	private JComboBox outputFormatText = null;
90
	private final int WIDTH = 510;
91
	private final int HEIGHT = 25;
92
	private final int LABELS_PANEL_WIDTH = 250;
93
	private final int TEXTS_PANEL_WIDTH = 250;
94
	private final int LABELS_WIDTH = 245;
95
	private final int LABELS_HEIGHT = 19;
96
	private final int TEXTS_WIDTH = 245;
97
	private final int TEXTS_HEIGHT = 19;
98
	
99
	/**
100
	 * This is the default constructor
101
	 */
102
	public OutputHeaderFormatPanel() {
103
		super();
104
		initialize();
105
	}
106

  
107
	/**
108
	 * This method initializes this
109
	 * 
110
	 * @return void
111
	 */
112
	private void initialize() {    
113
		
114
		this.setLayout(new GridBagLayout());
115
		this.setPreferredSize(new java.awt.Dimension(WIDTH,HEIGHT));
116
		this.add(getLabelsPanel(), new GridBagConstraints());
117
		this.add(getFieldsPanel(), new GridBagConstraints());
118
	}
119
	
120
	/**
121
	 * This method initializes jPanel3	
122
	 * 	
123
	 * @return javax.swing.JPanel	
124
	 */
125
	private JPanel getOutputFormatLabelPanel() {
126
		if (outputFormatLabelPanel == null) {
127
			outputFormatLabel = new JLabel();
128
			outputFormatLabel.setText(PluginServices.getText(this, "output_header_format"));
129
			FlowLayout flowLayout4 = new FlowLayout();
130
			flowLayout4.setHgap(0);
131
			flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
132
			flowLayout4.setVgap(1);
133
			outputFormatLabelPanel = new JPanel();
134
			outputFormatLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
135
			outputFormatLabelPanel.setLayout(flowLayout4);
136
			outputFormatLabelPanel.add(outputFormatLabel, null);
137
		}
138
		return outputFormatLabelPanel;
139
	}
140
	
141
	
142

  
143
	
144
	/**
145
	 * This method initializes jPanel	
146
	 * 	
147
	 * @return javax.swing.JPanel	
148
	 */
149
	private JPanel getLabelsPanel() {
150
		if (labelsPanel == null) {
151
			labelsPanel = new JPanel();
152
			labelsPanel.setPreferredSize(new java.awt.Dimension(LABELS_PANEL_WIDTH,HEIGHT));
153
			labelsPanel.add(getOutputFormatLabelPanel(), null);
154
		}
155
		return labelsPanel;
156
	}
157

  
158
	/**
159
	 * This method initializes jPanel	
160
	 * 	
161
	 * @return javax.swing.JPanel	
162
	 */
163
	private JPanel getFieldsPanel() {
164
		if (fieldsPanel == null) {
165
			fieldsPanel = new JPanel();
166
			fieldsPanel.setPreferredSize(new java.awt.Dimension(TEXTS_PANEL_WIDTH,HEIGHT));
167
			fieldsPanel.add(getOutputFormatTextPanel(), null);
168
		}
169
		return fieldsPanel;
170
	}
171

  
172
	/**
173
	 * This method initializes jPanel	
174
	 * 	
175
	 * @return javax.swing.JPanel	
176
	 */
177
	private JPanel getOutputFormatTextPanel() {
178
		if (OutputFormatTextPanel == null) {
179
			FlowLayout flowLayout = new FlowLayout();
180
			flowLayout.setHgap(0);
181
			flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
182
			flowLayout.setVgap(1);
183
			OutputFormatTextPanel = new JPanel();
184
			OutputFormatTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
185
			OutputFormatTextPanel.setLayout(flowLayout);
186
			OutputFormatTextPanel.add(getOutputFormatText(), null);
187
		}
188
		return OutputFormatTextPanel;
189
	}
190
	
191
	/**
192
	 * This method initializes pronunciacionText	
193
	 * 	
194
	 * @return javax.swing.JTextField	
195
	 */
196
	private JComboBox getOutputFormatText() {
197
		if (outputFormatText == null) {
198
			outputFormatText = new JComboBox(VRTFormatOptions.getOutputHeaderFormats());
199
			outputFormatText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
200
		}
201
		return outputFormatText;
202
	}
203
	
204
	/**
205
	 * gets the selected outputformat
206
	 * @return
207
	 */
208
	public String getOutputHeaderFormat(){
209
		return ((VRTFormatOptions.UIOption)getOutputFormatText().getSelectedItem()).getVrtOptionName();
210
	}
211
}  //  @jve:decl-index=0:visual-constraint="10,10"
0 212

  
trunk/extensions/extgvSIGPiloto-Raster/src/org/gvsig/rasterTools/raw/ui/main/GeometryPropertiesLeftPanel.java
1
package org.gvsig.rasterTools.raw.ui.main;
2

  
3
import java.awt.Dimension;
4
import java.awt.FlowLayout;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7
import java.text.NumberFormat;
8

  
9
import javax.swing.JFormattedTextField;
10
import javax.swing.JLabel;
11
import javax.swing.JPanel;
12
import javax.swing.JTextField;
13

  
14
import com.iver.andami.PluginServices;
15
import com.iver.utiles.StringUtilities;
16

  
17
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
18
 *
19
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
20
 *
21
 * This program is free software; you can redistribute it and/or
22
 * modify it under the terms of the GNU General Public License
23
 * as published by the Free Software Foundation; either version 2
24
 * of the License, or (at your option) any later version.
25
 *
26
 * This program is distributed in the hope that it will be useful,
27
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
 * GNU General Public License for more details.
30
 *
31
 * You should have received a copy of the GNU General Public License
32
 * along with this program; if not, write to the Free Software
33
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
34
 *
35
 * For more information, contact:
36
 *
37
 *  Generalitat Valenciana
38
 *   Conselleria d'Infraestructures i Transport
39
 *   Av. Blasco Ib??ez, 50
40
 *   46010 VALENCIA
41
 *   SPAIN
42
 *
43
 *      +34 963862235
44
 *   gvsig@gva.es
45
 *      www.gvsig.gva.es
46
 *
47
 *    or
48
 *
49
 *   IVER T.I. S.A
50
 *   Salamanca 50
51
 *   46005 Valencia
52
 *   Spain
53
 *
54
 *   +34 963163400
55
 *   dac@iver.es
56
 */
57
/* CVS MESSAGES:
58
 *
59
 * $Id$
60
 * $Log$
61
 * Revision 1.1  2006-11-28 11:49:25  nacho
62
 * *** empty log message ***
63
 *
64
 * Revision 1.1  2006/10/10 16:11:22  nacho
65
 * *** empty log message ***
66
 *
67
 * Revision 1.3  2006/08/01 11:19:04  jorpiell
68
 * Ajustado el tama?o de las ventanas
69
 *
70
 * Revision 1.2  2006/07/28 13:13:27  jorpiell
71
 * Unos peque?os cambios para que coja el ancho y el alto de la imagen
72
 *
73
 * Revision 1.1  2006/07/28 12:51:40  jorpiell
74
 * Primer commit de las clases empleadas para abrir raw
75
 *
76
 *
77
 */
78
/**
79
 * This panel contains the left panel of the "Set Geometry"
80
 * panel. It is the imput to write the image width, the heigth,
81
 * the number of bands and the image header size.
82
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
83
 */
84
public class GeometryPropertiesLeftPanel extends JPanel{
85
	private JPanel bandsLabelPanel = null;
86
	private JPanel headerSizeLabelPanel = null;
87
	private JPanel heigthLabelPanel = null;
88
	private JLabel heigthLabel = null;
89
	private JPanel labelsPanel = null;
90
	private JPanel fieldsPanel = null;
91
	private JPanel widthTextPanel = null;
92
	private JPanel heigthTextPanel = null;
93
	private JPanel widthLabelPanel = null;
94
	private JLabel widthLabel = null;
95
	private JLabel bandsLabel = null;
96
	private JPanel bandsTextPanel = null;
97
	private JPanel headerSizeTextPanel = null;
98
	private JFormattedTextField widthText = null;
99
	private JLabel headerSizeLabel = null;
100
	private JFormattedTextField heigthText = null;
101
	private JFormattedTextField bandsText = null;
102
	private JFormattedTextField headerSizeText = null;
103
	
104
	private final int WIDTH = 245;
105
	private final int HEIGHT = 110;
106
	private final int LABELS_PANEL_WIDTH = 120;
107
	private final int TEXTS_PANEL_WIDTH = 125;
108
	private final int LABELS_WIDTH = 120;
109
	private final int LABELS_HEIGHT = 19;
110
	private final int TEXTS_WIDTH = 120;
111
	private final int TEXTS_HEIGHT = 19;
112
	
113
	/**
114
	 * This is the default constructor
115
	 */
116
	public GeometryPropertiesLeftPanel() {
117
		super();
118
		initialize();
119
	}
120

  
121
	/**
122
	 * This method initializes this
123
	 * 
124
	 * @return void
125
	 */
126
	private void initialize() {                
127
		
128
		this.setLayout(new GridBagLayout());
129
		this.setPreferredSize(new java.awt.Dimension(WIDTH,HEIGHT));
130
		this.add(getLabelsPanel(), new GridBagConstraints());
131
		this.add(getFieldsPanel(), new GridBagConstraints());
132
	}
133
	
134
	/**
135
	 * This method initializes pX	
136
	 * 	
137
	 * @return javax.swing.JPanel	
138
	 */
139
	private JPanel getBandsLabelPanel() {
140
		if (bandsLabelPanel == null) {
141
			bandsLabel = new JLabel();
142
			bandsLabel.setText(PluginServices.getText(this, "bands_number"));
143
			FlowLayout flowLayout2 = new FlowLayout();
144
			flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
145
			bandsLabelPanel = new JPanel();
146
			bandsLabelPanel.setLayout(flowLayout2);
147
			bandsLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
148
			bandsLabelPanel.add(bandsLabel, null);
149
			flowLayout2.setVgap(1);
150
			flowLayout2.setHgap(0);
151
		}
152
		return bandsLabelPanel;
153
	}
154

  
155
	/**
156
	 * This method initializes pY	
157
	 * 	
158
	 * @return javax.swing.JPanel	
159
	 */
160
	private JPanel getHeaderSizeLabelPanel() {
161
		if (headerSizeLabelPanel == null) {
162
			headerSizeLabel = new JLabel();
163
			headerSizeLabel.setText(PluginServices.getText(this, "header_Size"));
164
			FlowLayout flowLayout1 = new FlowLayout();
165
			flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
166
			headerSizeLabelPanel = new JPanel();
167
			headerSizeLabelPanel.setLayout(flowLayout1);
168
			headerSizeLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
169
			headerSizeLabelPanel.add(headerSizeLabel, null);
170
			flowLayout1.setHgap(0);
171
			flowLayout1.setVgap(1);
172
		}
173
		return headerSizeLabelPanel;
174
	}
175

  
176
	/**
177
	 * This method initializes pLatitud	
178
	 * 	
179
	 * @return javax.swing.JPanel	
180
	 */
181
	private JPanel getHeigthLabelPanel() {
182
		if (heigthLabelPanel == null) {
183
			heigthLabel = new JLabel();
184
			heigthLabel.setText(PluginServices.getText(this, "alto"));
185
			FlowLayout flowLayout3 = new FlowLayout();
186
			flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
187
			heigthLabelPanel = new JPanel();
188
			heigthLabelPanel.setLayout(flowLayout3);
189
			heigthLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
190
			flowLayout3.setHgap(0);
191
			flowLayout3.setVgap(1);
192
			heigthLabelPanel.add(heigthLabel, null);
193
		}
194
		return heigthLabelPanel;
195
	}
196
	
197
	/**
198
	 * This method initializes jPanel3	
199
	 * 	
200
	 * @return javax.swing.JPanel	
201
	 */
202
	private JPanel getWidthLabelPanel() {
203
		if (widthLabelPanel == null) {
204
			widthLabel = new JLabel();
205
			widthLabel.setText(PluginServices.getText(this, "ancho"));
206
			FlowLayout flowLayout4 = new FlowLayout();
207
			flowLayout4.setHgap(0);
208
			flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
209
			flowLayout4.setVgap(1);
210
			widthLabelPanel = new JPanel();
211
			widthLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
212
			widthLabelPanel.setLayout(flowLayout4);
213
			widthLabelPanel.add(widthLabel, null);
214
		}
215
		return widthLabelPanel;
216
	}
217
	
218
	
219

  
220
	
221
	/**
222
	 * This method initializes jPanel	
223
	 * 	
224
	 * @return javax.swing.JPanel	
225
	 */
226
	private JPanel getLabelsPanel() {
227
		if (labelsPanel == null) {
228
			labelsPanel = new JPanel();
229
			labelsPanel.setPreferredSize(new java.awt.Dimension(LABELS_PANEL_WIDTH,HEIGHT));
230
			labelsPanel.add(getWidthLabelPanel(), null);
231
			labelsPanel.add(getHeigthLabelPanel(), null);
232
			labelsPanel.add(getBandsLabelPanel(), null);
233
			labelsPanel.add(getHeaderSizeLabelPanel(), null);
234
		}
235
		return labelsPanel;
236
	}
237

  
238
	/**
239
	 * This method initializes jPanel	
240
	 * 	
241
	 * @return javax.swing.JPanel	
242
	 */
243
	private JPanel getFieldsPanel() {
244
		if (fieldsPanel == null) {
245
			fieldsPanel = new JPanel();
246
			fieldsPanel.setPreferredSize(new java.awt.Dimension(TEXTS_PANEL_WIDTH,HEIGHT));
247
			fieldsPanel.add(getWidthTextPanel(), null);
248
			fieldsPanel.add(getHeigthTextPanel(), null);
249
			fieldsPanel.add(getBandsTextPanel(), null);
250
			fieldsPanel.add(getHeaderSizeTextPanel(), null);
251
		}
252
		return fieldsPanel;
253
	}
254

  
255
	/**
256
	 * This method initializes jPanel	
257
	 * 	
258
	 * @return javax.swing.JPanel	
259
	 */
260
	private JPanel getWidthTextPanel() {
261
		if (widthTextPanel == null) {
262
			FlowLayout flowLayout = new FlowLayout();
263
			flowLayout.setHgap(0);
264
			flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
265
			flowLayout.setVgap(1);
266
			widthTextPanel = new JPanel();
267
			widthTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
268
			widthTextPanel.setLayout(flowLayout);
269
			widthTextPanel.add(getWidthText(), null);
270
		}
271
		return widthTextPanel;
272
	}
273
	
274
	/**
275
	 * This method initializes jPanel1	
276
	 * 	
277
	 * @return javax.swing.JPanel	
278
	 */
279
	private JPanel getHeigthTextPanel() {
280
		if (heigthTextPanel == null) {
281
			FlowLayout flowLayout5 = new FlowLayout();
282
			flowLayout5.setHgap(0);
283
			flowLayout5.setAlignment(java.awt.FlowLayout.LEFT);
284
			flowLayout5.setVgap(1);
285
			heigthTextPanel = new JPanel();
286
			heigthTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
287
			heigthTextPanel.setLayout(flowLayout5);
288
			heigthTextPanel.add(getHeigthText(), null);
289
		}
290
		return heigthTextPanel;
291
	}	
292

  
293
	/**
294
	 * This method initializes jPanel2	
295
	 * 	
296
	 * @return javax.swing.JPanel	
297
	 */
298
	private JPanel getHeaderSizeTextPanel() {
299
		if (headerSizeTextPanel == null) {
300
			FlowLayout flowLayout8 = new FlowLayout();
301
			flowLayout8.setHgap(0);
302
			flowLayout8.setAlignment(FlowLayout.LEFT);
303
			flowLayout8.setVgap(1);
304
			headerSizeTextPanel = new JPanel();
305
			headerSizeTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
306
			headerSizeTextPanel.setLayout(flowLayout8);
307
			headerSizeTextPanel.add(getHeaderSizeText(), null);
308
		}
309
		return headerSizeTextPanel;
310
	}
311
	
312
	/**
313
	 * This method initializes oficialTextPanel	
314
	 * 	
315
	 * @return javax.swing.JPanel	
316
	 */
317
	private JPanel getBandsTextPanel() {
318
		if (bandsTextPanel == null) {
319
			FlowLayout flowLayout9 = new FlowLayout();
320
			flowLayout9.setHgap(0);
321
			flowLayout9.setAlignment(FlowLayout.LEFT);
322
			flowLayout9.setVgap(1);
323
			bandsTextPanel = new JPanel();
324
			bandsTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
325
			bandsTextPanel.setLayout(flowLayout9);			
326
			bandsTextPanel.add(getBandsText(), null);
327
		}
328
		return bandsTextPanel;
329
	}
330

  
331

  
332
	
333
	/**
334
	 * This method initializes pronunciacionText	
335
	 * 	
336
	 * @return javax.swing.JTextField	
337
	 */
338
	private JFormattedTextField getWidthText() {
339
		if (widthText == null) {
340
			widthText = new JFormattedTextField(NumberFormat.getIntegerInstance());
341
			widthText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
342
			widthText.setText("0");
343
		}
344
		return widthText;
345
	}
346

  
347
	/**
348
	 * This method initializes etimologyText	
349
	 * 	
350
	 * @return javax.swing.JTextField	
351
	 */
352
	private JFormattedTextField getHeigthText() {
353
		if (heigthText == null) {
354
			heigthText = new JFormattedTextField(NumberFormat.getIntegerInstance());
355
			heigthText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
356
			heigthText.setText("0");
357
		}
358
		return heigthText;
359
	}
360

  
361
	/**
362
	 * This method initializes bandsText	
363
	 * 	
364
	 * @return javax.swing.JTextField	
365
	 */
366
	private JFormattedTextField getBandsText() {
367
		if (bandsText == null) {
368
			bandsText = new JFormattedTextField(NumberFormat.getIntegerInstance());
369
			bandsText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
370
			bandsText.setText("0");
371
		}
372
		return bandsText;
373
	}
374

  
375
	/**
376
	 * This method initializes headerSizeText	
377
	 * 	
378
	 * @return javax.swing.JTextField	
379
	 */
380
	private JFormattedTextField getHeaderSizeText() {
381
		if (headerSizeText == null) {
382
			headerSizeText = new JFormattedTextField(NumberFormat.getIntegerInstance());
383
			headerSizeText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
384
			headerSizeText.setText("0");
385
		}
386
		return headerSizeText;
387
	}
388
	
389
	/**
390
	 * gets the image width
391
	 * @return
392
	 */
393
	public int getImageWidth(){
394
		try{
395
			String buffer = StringUtilities.replace(getWidthText().getText(),".","");
396
			buffer = StringUtilities.replace(buffer,",","");
397
			return Integer.parseInt(buffer);
398
		}catch(NumberFormatException e){
399
			return 0;
400
		}
401
	}
402
	
403
	/**
404
	 * gets the image height
405
	 * @return
406
	 */
407
	public int getImageHeight(){
408
		try{
409
			String buffer = StringUtilities.replace(getHeigthText().getText(),".","");
410
			buffer = StringUtilities.replace(buffer,",","");
411
			return Integer.parseInt(buffer);
412
		}catch(NumberFormatException e){
413
			return 0;
414
		}
415
	}
416
	
417
	/**
418
	 * gets the number of bands
419
	 * @return
420
	 */
421
	public int getNumberOfBands(){
422
		try{
423
			return Integer.valueOf(getBandsText().getText()).intValue();
424
		}catch(NumberFormatException e){
425
			return 0;
426
		}
427
	}
428
	
429
	/**
430
	 * gets the header size
431
	 * @return
432
	 */
433
	public int getHeaderSize(){
434
		try{
435
			return Integer.valueOf(getHeaderSizeText().getText()).intValue();
436
		}catch(NumberFormatException e){
437
			return 0;
438
		}
439
	}
440
}
0 441

  
trunk/extensions/extgvSIGPiloto-Raster/src/org/gvsig/rasterTools/raw/ui/main/GeometryPropertiesRigthPanel.java
1
package org.gvsig.rasterTools.raw.ui.main;
2

  
3
import java.awt.Dimension;
4
import java.awt.FlowLayout;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7

  
8
import javax.swing.JLabel;
9
import javax.swing.JPanel;
10
import javax.swing.JTextField;
11

  
12
import org.gvsig.rasterTools.raw.tools.VRTFormatOptions;
13

  
14
import com.iver.andami.PluginServices;
15
import com.iver.utiles.swing.JComboBox;
16

  
17
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
18
 *
19
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
20
 *
21
 * This program is free software; you can redistribute it and/or
22
 * modify it under the terms of the GNU General Public License
23
 * as published by the Free Software Foundation; either version 2
24
 * of the License, or (at your option) any later version.
25
 *
26
 * This program is distributed in the hope that it will be useful,
27
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
 * GNU General Public License for more details.
30
 *
31
 * You should have received a copy of the GNU General Public License
32
 * along with this program; if not, write to the Free Software
33
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
34
 *
35
 * For more information, contact:
36
 *
37
 *  Generalitat Valenciana
38
 *   Conselleria d'Infraestructures i Transport
39
 *   Av. Blasco Ib??ez, 50
40
 *   46010 VALENCIA
41
 *   SPAIN
42
 *
43
 *      +34 963862235
44
 *   gvsig@gva.es
45
 *      www.gvsig.gva.es
46
 *
47
 *    or
48
 *
49
 *   IVER T.I. S.A
50
 *   Salamanca 50
51
 *   46005 Valencia
52
 *   Spain
53
 *
54
 *   +34 963163400
55
 *   dac@iver.es
56
 */
57
/* CVS MESSAGES:
58
 *
59
 * $Id$
60
 * $Log$
61
 * Revision 1.1  2006-11-28 11:49:24  nacho
62
 * *** empty log message ***
63
 *
64
 * Revision 1.1  2006/10/10 16:11:22  nacho
65
 * *** empty log message ***
66
 *
67
 * Revision 1.3  2006/08/01 11:19:04  jorpiell
68
 * Ajustado el tama?o de las ventanas
69
 *
70
 * Revision 1.2  2006/07/31 10:44:28  jorpiell
71
 * Se ha a?adido el tama?o del fichero con un thread.
72
 *
73
 * Revision 1.1  2006/07/28 12:51:40  jorpiell
74
 * Primer commit de las clases empleadas para abrir raw
75
 *
76
 *
77
 */
78
/**
79
 * This panel contains the rigth panel of the "Set Geometry"
80
 * panel. It is the imput to write the file size in bytes,
81
 * the data type, the byte order and the type of
82
 * interleaving.
83
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
84
 */
85
public class GeometryPropertiesRigthPanel extends JPanel{
86
	private JPanel byteOrderLabelPanel = null;
87
	private JPanel interleavingLabelPanel = null;
88
	private JPanel dataTypeLabelPanel = null;
89
	private JLabel dataTypeLabel = null;
90
	private JPanel labelsPanel = null;
91
	private JPanel fieldsPanel = null;
92
	private JPanel fileSizeTextPanel = null;
93
	private JPanel dataTypeTextPanel = null;
94
	private JPanel fileSizeLabelPanel = null;
95
	private JLabel fileSizeLabel = null;
96
	private JLabel byteOrderLabel = null;
97
	private JPanel byteOrderTextPanel = null;
98
	private JPanel interleavingTextPanel = null;
99
	private JTextField fileSizeText = null;
100
	private JLabel interleavingLabel = null;
101
	private JComboBox dataTypeText = null;
102
	private JComboBox byteOrderText = null;
103
	private JComboBox interleavingText = null;
104
	
105
	private final int WIDTH = 245;
106
	private final int HEIGHT = 110;
107
	private final int LABELS_PANEL_WIDTH = 120;
108
	private final int TEXTS_PANEL_WIDTH = 125;
109
	private final int LABELS_WIDTH = 120;
110
	private final int LABELS_HEIGHT = 19;
111
	private final int TEXTS_WIDTH = 120;
112
	private final int TEXTS_HEIGHT = 19;
113
	
114
	/**
115
	 * This is the default constructor
116
	 */
117
	public GeometryPropertiesRigthPanel() {
118
		super();
119
		initialize();
120
	}
121

  
122
	/**
123
	 * This method initializes this
124
	 * 
125
	 * @return void
126
	 */
127
	private void initialize() {    
128
		
129
		this.setLayout(new GridBagLayout());
130
		this.setPreferredSize(new java.awt.Dimension(WIDTH,HEIGHT));
131
		this.add(getLabelsPanel(), new GridBagConstraints());
132
		this.add(getFieldsPanel(), new GridBagConstraints());
133
	}
134
	
135
	/**
136
	 * This method initializes pX	
137
	 * 	
138
	 * @return javax.swing.JPanel	
139
	 */
140
	private JPanel getByteOrderLabelPanel() {
141
		if (byteOrderLabelPanel == null) {
142
			byteOrderLabel = new JLabel();
143
			byteOrderLabel.setText(PluginServices.getText(this, "byte_order"));
144
			FlowLayout flowLayout2 = new FlowLayout();
145
			flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
146
			byteOrderLabelPanel = new JPanel();
147
			byteOrderLabelPanel.setLayout(flowLayout2);
148
			byteOrderLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
149
			byteOrderLabelPanel.add(byteOrderLabel, null);
150
			flowLayout2.setVgap(1);
151
			flowLayout2.setHgap(0);
152
		}
153
		return byteOrderLabelPanel;
154
	}
155

  
156
	/**
157
	 * This method initializes pY	
158
	 * 	
159
	 * @return javax.swing.JPanel	
160
	 */
161
	private JPanel getInterleavingLabelPanel() {
162
		if (interleavingLabelPanel == null) {
163
			interleavingLabel = new JLabel();
164
			interleavingLabel.setText(PluginServices.getText(this, "type_of_interleaving"));
165
			FlowLayout flowLayout1 = new FlowLayout();
166
			flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
167
			interleavingLabelPanel = new JPanel();
168
			interleavingLabelPanel.setLayout(flowLayout1);
169
			interleavingLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
170
			interleavingLabelPanel.add(interleavingLabel, null);
171
			flowLayout1.setHgap(0);
172
			flowLayout1.setVgap(1);
173
		}
174
		return interleavingLabelPanel;
175
	}
176

  
177
	/**
178
	 * This method initializes pLatitud	
179
	 * 	
180
	 * @return javax.swing.JPanel	
181
	 */
182
	private JPanel getDataTypeLabelPanel() {
183
		if (dataTypeLabelPanel == null) {
184
			dataTypeLabel = new JLabel();
185
			dataTypeLabel.setText(PluginServices.getText(this, "data_type"));
186
			FlowLayout flowLayout3 = new FlowLayout();
187
			flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
188
			dataTypeLabelPanel = new JPanel();
189
			dataTypeLabelPanel.setLayout(flowLayout3);
190
			dataTypeLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
191
			flowLayout3.setHgap(0);
192
			flowLayout3.setVgap(1);
193
			dataTypeLabelPanel.add(dataTypeLabel, null);
194
		}
195
		return dataTypeLabelPanel;
196
	}
197
	
198
	/**
199
	 * This method initializes jPanel3	
200
	 * 	
201
	 * @return javax.swing.JPanel	
202
	 */
203
	private JPanel getFileSizeLabelPanel() {
204
		if (fileSizeLabelPanel == null) {
205
			fileSizeLabel = new JLabel();
206
			fileSizeLabel.setText(PluginServices.getText(this, "file_size_in_bytes"));
207
			FlowLayout flowLayout4 = new FlowLayout();
208
			flowLayout4.setHgap(0);
209
			flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
210
			flowLayout4.setVgap(1);
211
			fileSizeLabelPanel = new JPanel();
212
			fileSizeLabelPanel.setPreferredSize(new java.awt.Dimension(LABELS_WIDTH,LABELS_HEIGHT));
213
			fileSizeLabelPanel.setLayout(flowLayout4);
214
			fileSizeLabelPanel.add(fileSizeLabel, null);
215
		}
216
		return fileSizeLabelPanel;
217
	}
218
	
219
	
220

  
221
	
222
	/**
223
	 * This method initializes jPanel	
224
	 * 	
225
	 * @return javax.swing.JPanel	
226
	 */
227
	private JPanel getLabelsPanel() {
228
		if (labelsPanel == null) {
229
			labelsPanel = new JPanel();
230
			labelsPanel.setPreferredSize(new java.awt.Dimension(LABELS_PANEL_WIDTH,HEIGHT));
231
			labelsPanel.add(getFileSizeLabelPanel(), null);
232
			labelsPanel.add(getDataTypeLabelPanel(), null);
233
			labelsPanel.add(getByteOrderLabelPanel(), null);
234
			labelsPanel.add(getInterleavingLabelPanel(), null);
235
		}
236
		return labelsPanel;
237
	}
238

  
239
	/**
240
	 * This method initializes jPanel	
241
	 * 	
242
	 * @return javax.swing.JPanel	
243
	 */
244
	private JPanel getFieldsPanel() {
245
		if (fieldsPanel == null) {
246
			fieldsPanel = new JPanel();
247
			fieldsPanel.setPreferredSize(new java.awt.Dimension(TEXTS_PANEL_WIDTH,HEIGHT));
248
			fieldsPanel.add(getFileSizeTextPanel(), null);
249
			fieldsPanel.add(getDataTypeTextPanel(), null);
250
			fieldsPanel.add(getByteOrderTextPanel(), null);
251
			fieldsPanel.add(getInterleavingTextPanel(), null);
252
		}
253
		return fieldsPanel;
254
	}
255

  
256
	/**
257
	 * This method initializes jPanel	
258
	 * 	
259
	 * @return javax.swing.JPanel	
260
	 */
261
	private JPanel getFileSizeTextPanel() {
262
		if (fileSizeTextPanel == null) {
263
			FlowLayout flowLayout = new FlowLayout();
264
			flowLayout.setHgap(0);
265
			flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
266
			flowLayout.setVgap(1);
267
			fileSizeTextPanel = new JPanel();
268
			fileSizeTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
269
			fileSizeTextPanel.setLayout(flowLayout);
270
			fileSizeTextPanel.add(getFileSizeText(), null);
271
		}
272
		return fileSizeTextPanel;
273
	}
274
	
275
	/**
276
	 * This method initializes jPanel1	
277
	 * 	
278
	 * @return javax.swing.JPanel	
279
	 */
280
	private JPanel getDataTypeTextPanel() {
281
		if (dataTypeTextPanel == null) {
282
			FlowLayout flowLayout5 = new FlowLayout();
283
			flowLayout5.setHgap(0);
284
			flowLayout5.setAlignment(java.awt.FlowLayout.LEFT);
285
			flowLayout5.setVgap(1);
286
			dataTypeTextPanel = new JPanel();
287
			dataTypeTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
288
			dataTypeTextPanel.setLayout(flowLayout5);
289
			dataTypeTextPanel.add(getDataTypeText(), null);
290
		}
291
		return dataTypeTextPanel;
292
	}	
293

  
294
	/**
295
	 * This method initializes jPanel2	
296
	 * 	
297
	 * @return javax.swing.JPanel	
298
	 */
299
	private JPanel getInterleavingTextPanel() {
300
		if (interleavingTextPanel == null) {
301
			FlowLayout flowLayout8 = new FlowLayout();
302
			flowLayout8.setHgap(0);
303
			flowLayout8.setAlignment(FlowLayout.LEFT);
304
			flowLayout8.setVgap(1);
305
			interleavingTextPanel = new JPanel();
306
			interleavingTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
307
			interleavingTextPanel.setLayout(flowLayout8);
308
			interleavingTextPanel.add(getInterleavingText(), null);
309
		}
310
		return interleavingTextPanel;
311
	}
312
	
313
	/**
314
	 * This method initializes oficialTextPanel	
315
	 * 	
316
	 * @return javax.swing.JPanel	
317
	 */
318
	private JPanel getByteOrderTextPanel() {
319
		if (byteOrderTextPanel == null) {
320
			FlowLayout flowLayout9 = new FlowLayout();
321
			flowLayout9.setHgap(0);
322
			flowLayout9.setAlignment(FlowLayout.LEFT);
323
			flowLayout9.setVgap(1);
324
			byteOrderTextPanel = new JPanel();
325
			byteOrderTextPanel.setPreferredSize(new java.awt.Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
326
			byteOrderTextPanel.setLayout(flowLayout9);			
327
			byteOrderTextPanel.add(getByteOrderText(), null);
328
		}
329
		return byteOrderTextPanel;
330
	}
331

  
332

  
333
	
334
	/**
335
	 * This method initializes pronunciacionText	
336
	 * 	
337
	 * @return javax.swing.JTextField	
338
	 */
339
	private JTextField getFileSizeText() {
340
		if (fileSizeText == null) {
341
			fileSizeText = new JTextField();
342
			fileSizeText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
343
			fileSizeText.setText("0");
344
			fileSizeText.setEnabled(false);
345
		}
346
		return fileSizeText;
347
	}
348

  
349
	/**
350
	 * This method initializes etimologyText	
351
	 * 	
352
	 * @return javax.swing.JTextField	
353
	 */
354
	private JComboBox getDataTypeText() {
355
		if (dataTypeText == null) {
356
			dataTypeText = new JComboBox(VRTFormatOptions.getDataTypes());
357
			dataTypeText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
358
		}
359
		return dataTypeText;
360
	}
361

  
362
	/**
363
	 * This method initializes bandsText	
364
	 * 	
365
	 * @return javax.swing.JTextField	
366
	 */
367
	private JComboBox getByteOrderText() {
368
		if (byteOrderText == null) {
369
			byteOrderText = new JComboBox(VRTFormatOptions.getByteOrder());
370
			byteOrderText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
371
		}
372
		return byteOrderText;
373
	}
374

  
375
	/**
376
	 * This method initializes headerSizeText	
377
	 * 	
378
	 * @return javax.swing.JTextField	
379
	 */
380
	private JComboBox getInterleavingText() {
381
		if (interleavingText == null) {
382
			interleavingText = new JComboBox(VRTFormatOptions.getInterleaving());
383
			interleavingText.setPreferredSize(new Dimension(TEXTS_WIDTH,TEXTS_HEIGHT));
384
		}
385
		return interleavingText;
386
	}
387

  
388
	/**
389
	 * Sets the file size into the text field
390
	 * @param fileSize
391
	 */
392
	public void setFileSize(long fileSize){
393
		getFileSizeText().setText(String.valueOf(fileSize));
394
	}
395
	
396
	/**
397
	 * Gets the data type
398
	 * @return
399
	 */
400
	public VRTFormatOptions.UIOption getDataType(){
401
		return (VRTFormatOptions.UIOption)getDataTypeText().getSelectedItem();
402
	}	
403
	
404
	/**
405
	 * Gets the byte order
406
	 * @return
407
	 */
408
	public String getByteOrder(){
409
		return ((VRTFormatOptions.UIOption)getByteOrderText().getSelectedItem()).getVrtOptionName();
410
	}
411

  
412
	/**
413
	 * Gets the type of interleaving
414
	 * @return
415
	 */
416
	public String getInterleaving(){
417
		return ((VRTFormatOptions.UIOption)getInterleavingText().getSelectedItem()).getVrtOptionName();
418
	}
419
}
0 420

  
trunk/extensions/extgvSIGPiloto-Raster/src/org/gvsig/rasterTools/raw/ui/main/GeometryPropertiesPanel.java
1
package org.gvsig.rasterTools.raw.ui.main;
2

  
3
import java.awt.Dimension;
4
import java.awt.GridBagConstraints;
5
import java.awt.GridBagLayout;
6

  
7
import javax.swing.JPanel;
8

  
9
import org.gvsig.rasterTools.raw.tools.VRTFormatOptions;
10

  
11
import com.iver.andami.PluginServices;
12

  
13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
14
 *
15
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
16
 *
17
 * This program is free software; you can redistribute it and/or
18
 * modify it under the terms of the GNU General Public License
19
 * as published by the Free Software Foundation; either version 2
20
 * of the License, or (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
30
 *
31
 * For more information, contact:
32
 *
33
 *  Generalitat Valenciana
34
 *   Conselleria d'Infraestructures i Transport
35
 *   Av. Blasco Ib??ez, 50
36
 *   46010 VALENCIA
37
 *   SPAIN
38
 *
39
 *      +34 963862235
40
 *   gvsig@gva.es
41
 *      www.gvsig.gva.es
42
 *
43
 *    or
44
 *
45
 *   IVER T.I. S.A
46
 *   Salamanca 50
47
 *   46005 Valencia
48
 *   Spain
49
 *
50
 *   +34 963163400
51
 *   dac@iver.es
52
 */
53
/* CVS MESSAGES:
54
 *
55
 * $Id$
56
 * $Log$
57
 * Revision 1.1  2006-11-28 11:49:25  nacho
58
 * *** empty log message ***
59
 *
60
 * Revision 1.1  2006/10/10 16:11:22  nacho
61
 * *** empty log message ***
62
 *
63
 * Revision 1.5  2006/08/01 13:12:56  jorpiell
64
 * Separado un poco las dos columnas del panel
65
 *
66
 * Revision 1.4  2006/08/01 11:19:04  jorpiell
67
 * Ajustado el tama?o de las ventanas
68
 *
69
 * Revision 1.3  2006/07/31 10:44:28  jorpiell
70
 * Se ha a?adido el tama?o del fichero con un thread.
71
 *
72
 * Revision 1.2  2006/07/28 12:53:45  jorpiell
73
 * Cambiado el Messages por el Plugin services
74
 *
75
 * Revision 1.1  2006/07/28 12:51:40  jorpiell
76
 * Primer commit de las clases empleadas para abrir raw
77
 *
78
 *
79
 */
80
/**
81
 * This panel implements all the geometry properties panel.
82
 * The "guess image geometry" button can be enabled or disabled
83
 * changing the GUESS_IMAGE_BUTTON_VISIBLE attribute value.
84
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
85
 */
86
public class GeometryPropertiesPanel extends JPanel {
87
	private final int WIDTH = 510;
88
	private final int HEIGHT = 155;
89
	
90
	private boolean GUESS_IMAGE_BUTTON_VISIBLE = false;
91
	private GeometryPropertiesLeftPanel leftPanel = null;
92
	private GeometryPropertiesRigthPanel rigthPanel = null;
93
	private GuessImagePanel guessImagePanel = null;
94
	public GeometryPropertiesPanel() {
95
		super();
96
		initialize();		
97
	}
98

  
99
	/**
100
	 * This method initializes this
101
	 * 
102
	 */
103
	private void initialize() {
104
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
105
        gridBagConstraints2.insets = new java.awt.Insets(0,0,0,0);
106
        gridBagConstraints2.gridy = 1;
107
        gridBagConstraints2.gridx = 0;
108
		GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
109
        gridBagConstraints1.insets = new java.awt.Insets(0,2,0,0);
110
        gridBagConstraints1.gridy = 0;
111
        gridBagConstraints1.gridx = 1;
112
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
113
        gridBagConstraints.insets = new java.awt.Insets(0,0,0,0);
114
        gridBagConstraints.gridy = 0;
115
        gridBagConstraints.gridx = 0;
116
        this.setLayout(new GridBagLayout());
117
        this.setSize(new java.awt.Dimension(WIDTH,HEIGHT));
118
        this.setPreferredSize(new java.awt.Dimension(WIDTH,HEIGHT));
119
        this.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"select_image_geometry"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
120
        this.add(getLeftPanel(), gridBagConstraints);
121
        this.add(getRigthPanel(), gridBagConstraints1);
122
        if (GUESS_IMAGE_BUTTON_VISIBLE){
123
        	this.add(getGuessImagePanel(), gridBagConstraints2);
124
        }
125
			
126
	}
127

  
128
	/**
129
	 * This method initializes leftPanel	
130
	 * 	
131
	 * @return javax.swing.JPanel	
132
	 */
133
	private GeometryPropertiesLeftPanel getLeftPanel() {
134
		if (leftPanel == null) {
135
			leftPanel = new GeometryPropertiesLeftPanel();
136
		}
137
		return leftPanel;
138
	}
139

  
140
	/**
141
	 * This method initializes rigthPanel	
142
	 * 	
143
	 * @return javax.swing.JPanel	
144
	 */
145
	private GeometryPropertiesRigthPanel getRigthPanel() {
146
		if (rigthPanel == null) {
147
			rigthPanel = new GeometryPropertiesRigthPanel();
148
		}
149
		return rigthPanel;
150
	}
151

  
152
	/**
153
	 * This method initializes guessImagePanel	
154
	 * 	
155
	 * @return javax.swing.JPanel	
156
	 */
157
	private GuessImagePanel getGuessImagePanel() {
158
		if (guessImagePanel == null) {
159
			guessImagePanel = new GuessImagePanel();
160
		}
161
		return guessImagePanel;
162
	}
163
	
164
	/**
165
	 * Sets the file size into the text field
166
	 * @param fileSize
167
	 */
168
	public void setFileSize(long fileSize){
169
		getRigthPanel().setFileSize(fileSize);
170
	}
171
	
172
	/**
173
	 * Gets the data type
174
	 * @return
175
	 */
176
	public VRTFormatOptions.UIOption getDataType(){
177
		return getRigthPanel().getDataType();
178
	}
179
	
180
	/**
181
	 * Gets the byte order
182
	 * @return
183
	 */
184
	public String getByteOrder(){
185
		return getRigthPanel().getByteOrder();
186
	}
187

  
188
	/**
189
	 * Gets the type of interleaving
190
	 * @return
191
	 */
192
	public String getInterleaving(){
193
		return getRigthPanel().getInterleaving();
194
	}
195
	
196
	/**
197
	 * gets the image width
198
	 * @return
199
	 */
200
	public int getImageWidth(){
201
		return getLeftPanel().getImageWidth();
202
	}
203
	
204
	/**
205
	 * gets the image height
206
	 * @return
207
	 */
208
	public int getImageHeight(){
209
		return getLeftPanel().getImageHeight();
210
	}
211
	
212
	/**
213
	 * gets the number of bands
214
	 * @return
215
	 */
216
	public int getNumberOfBands(){
217
		return getLeftPanel().getNumberOfBands();
218
	}
219
	
220
	/**
221
	 * gets the header size
222
	 * @return
223
	 */
224
	public int getHeaderSize(){
225
		return getLeftPanel().getHeaderSize();
226
	}
227
}  //  @jve:decl-index=0:visual-constraint="10,10"
0 228

  
trunk/extensions/extgvSIGPiloto-Raster/src/org/gvsig/rasterTools/raw/ui/main/GuessImagePanel.java
1
package org.gvsig.rasterTools.raw.ui.main;
2

  
3
import javax.swing.JPanel;
4
import javax.swing.JButton;
5

  
6
import com.iver.andami.PluginServices;
7

  
8
import java.awt.GridBagLayout;
9
import java.awt.GridBagConstraints;
10

  
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
 *
13
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
 *
15
 * This program is free software; you can redistribute it and/or
16
 * modify it under the terms of the GNU General Public License
17
 * as published by the Free Software Foundation; either version 2
18
 * of the License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff