Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1008 / extensions / extRasterTools / src / org / gvsig / rasterTools / saveRaster / ui / main / SaveRasterControlsPanel.java @ 12520

History | View | Annotate | Download (9.11 KB)

1
package org.gvsig.rasterTools.saveRaster.ui.main;
2

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

    
7
import javax.swing.JButton;
8
import javax.swing.JComboBox;
9
import javax.swing.JLabel;
10
import javax.swing.JPanel;
11
import javax.swing.JRadioButton;
12
import javax.swing.JTextField;
13

    
14
import org.cresques.cts.IProjection;
15

    
16
import com.iver.andami.PluginServices;
17

    
18
/**
19
 * Panel General de salvar a raster
20
 * @author Nacho Brodin (brodin_ign@gva.es)
21
 *
22
 */
23
public class SaveRasterControlsPanel extends JPanel {
24

    
25
        //Panels
26
        private JPanel                                                 pWorldCoordinates = null;
27
        private JPanel                                                 pMethod = null;
28
        private JPanel                                                 pButtons = null;
29
        private JPanel                                                 pInfDer = null;
30
        private JPanel                                                 pSupIzq = null;
31

    
32
    private IProjection                                        proj = null;
33
        private int                                                        widthInPixelsGeodesicas = 0;
34
    private int                                                        heightInPixelsGeodesicas = 0;
35

    
36
        /**
37
         * This is the default constructor
38
         */
39
        public SaveRasterControlsPanel() {
40
                super();
41
                initialize();
42
        }
43

    
44
        /**
45
         * Asigna las traducciones del dialogo
46
         */
47
        public void setTranslation(){
48
                MethodDataInputPanel method = ((MethodDataInputPanel)pMethod);
49
                InputScaleDataPanel scaleData = ((InputScaleDataPanel)method.getPEast());
50
                scaleData.getLScale().setText(PluginServices.getText(this,"scale"));
51
                scaleData.getLResolution().setText(PluginServices.getText(this,"resolution"));
52
                scaleData.getLMtsPixel().setText(PluginServices.getText(this,"mtspixel"));
53

    
54
                MethodSaveRasterSelectorPanel selector = ((MethodSaveRasterSelectorPanel)method.getPWest());
55
                selector.getRbMtsPixel().setText(PluginServices.getText(this,"mtspixel"));
56
                selector.getRbSize().setText(PluginServices.getText(this,"size"));
57
                selector.getRbScale().setText(PluginServices.getText(this,"scale"));
58

    
59
                InputSizeDataPanel size = ((InputSizeDataPanel)method.getPSouth());
60
                size.getLHeight().setText(" "+PluginServices.getText(this,"height"));
61
                size.getLWidth().setText(PluginServices.getText(this,"width"));
62

    
63
                ButtonsPanel but = ((ButtonsPanel)pButtons);
64
                but.setTag(PluginServices.getText(this,"file")+": ");
65
                but.getBSelect().setText(PluginServices.getText(this,"select"));
66
                ((DoubleJTextInputPanel)pInfDer).setTexts(        PluginServices.getText(this,"linf_der"),
67
                                                                                                        " X: ",
68
                                                                                                        " Y: ");
69
                ((DoubleJTextInputPanel)pSupIzq).setTexts(        PluginServices.getText(this,"lsup_izq"),
70
                                                                                                        " X: ",
71
                                                                                                        " Y: ");
72
        }
73

    
74
        /**
75
         * This method initializes this
76
         *
77
         * @return void
78
         */
79
        private void initialize() {
80
                GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
81
                gridBagConstraints2.gridx = 0;
82
                gridBagConstraints2.insets = new java.awt.Insets(3,0,0,0);
83
                gridBagConstraints2.gridy = 2;
84
                GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
85
                gridBagConstraints1.gridx = 0;
86
                gridBagConstraints1.insets = new java.awt.Insets(0,0,0,0);
87
                gridBagConstraints1.gridy = 1;
88
                GridBagConstraints gridBagConstraints = new GridBagConstraints();
89
                gridBagConstraints.gridx = 0;
90
                gridBagConstraints.insets = new java.awt.Insets(0,0,3,0);
91
                gridBagConstraints.gridy = 0;
92
                this.setLayout(new GridBagLayout());
93
                this.setSize(390, 325);
94
                this.setPreferredSize(new java.awt.Dimension(341,237));
95
                this.add(getPWorldCoordinates(), gridBagConstraints);
96
                this.add(getPMethod(), gridBagConstraints1);
97
                this.add(getPButtons(), gridBagConstraints2);
98
                this.setTranslation();
99
        }
100

    
101
        /**
102
         * This method initializes jPanel
103
         *
104
         * @return javax.swing.JPanel
105
         */
106
        public JPanel getPWorldCoordinates() {
107
                if (pWorldCoordinates == null) {
108
                        pWorldCoordinates = new JPanel();
109
                        pWorldCoordinates.setLayout(new GridLayout(2,1));
110
                        pWorldCoordinates.setPreferredSize(new java.awt.Dimension(371,70));
111
                        pWorldCoordinates.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Coordenadas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10), null));
112
                        pWorldCoordinates.add(getPInfDer(), null);
113
                        pWorldCoordinates.add(getPSupIzq(), null);
114
                }
115
                return pWorldCoordinates;
116
        }
117

    
118
        /**
119
         * This method initializes jPanel1
120
         *
121
         * @return javax.swing.JPanel
122
         */
123
        public JPanel getPMethod() {
124
                if (pMethod == null) {
125
                        pMethod = new MethodDataInputPanel();
126
                        pMethod.setPreferredSize(new java.awt.Dimension(371,160));
127
                        pMethod.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Seleccion", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10), null));
128
                }
129
                return pMethod;
130
        }
131

    
132
        /**
133
         * This method initializes jPanel2
134
         *
135
         * @return javax.swing.JPanel
136
         */
137
        public JPanel getPButtons() {
138
                if (pButtons == null) {
139
                        pButtons = new ButtonsPanel();
140
                        pButtons.setPreferredSize(new java.awt.Dimension(371,75));
141
                        pButtons.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Fichero", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10), null));
142
                }
143
                return pButtons;
144
        }
145

    
146
        /**
147
         * This method initializes jPanel
148
         *
149
         * @return javax.swing.JPanel
150
         */
151
        public JPanel getPInfDer() {
152
                if (pInfDer == null) {
153
                        pInfDer = new DoubleJTextInputPanel();
154
                        ((DoubleJTextInputPanel)pInfDer).setWidthText1(105);
155
                        ((DoubleJTextInputPanel)pInfDer).setWidthText2(105);
156
                        pInfDer.setPreferredSize(new java.awt.Dimension(350,21));
157
                }
158
                return pInfDer;
159
        }
160

    
161
        /**
162
         * This method initializes jPanel1
163
         *
164
         * @return javax.swing.JPanel
165
         */
166
        public JPanel getPSupIzq() {
167
                if (pSupIzq == null) {
168
                        pSupIzq = new DoubleJTextInputPanel();
169
                        ((DoubleJTextInputPanel)pSupIzq).setWidthText1(105);
170
                        ((DoubleJTextInputPanel)pSupIzq).setWidthText2(105);
171
                        pSupIzq.setPreferredSize(new java.awt.Dimension(350,21));
172
                }
173
                return pSupIzq;
174
        }
175

    
176
        //-------------------------------------------
177

    
178
        public JLabel getLFileName(){
179
                return ((ButtonsPanel)pButtons).getLabelText();
180
        }
181

    
182
        public JButton getBProperties(){
183
                return ((ButtonsPanel)pButtons).getBProperties();
184
        }
185

    
186
        public JButton getBSelect(){
187
                return ((ButtonsPanel)pButtons).getBSelect();
188
        }
189

    
190
        public JTextField getTSupIzqX(){
191
                return ((DoubleJTextInputPanel)pSupIzq).getJTextField();
192
        }
193

    
194
        public JTextField getTSupIzqY(){
195
                return ((DoubleJTextInputPanel)pSupIzq).getJTextField1();
196
        }
197

    
198
        public JTextField getTInfDerX(){
199
                return ((DoubleJTextInputPanel)pInfDer).getJTextField();
200
        }
201

    
202
        public JTextField getTInfDerY(){
203
                return ((DoubleJTextInputPanel)pInfDer).getJTextField1();
204
        }
205

    
206
        public JTextField getTWidth(){
207
                return ((InputSizeDataPanel)((MethodDataInputPanel)getPMethod()).getPSouth()).getTWidth();
208
        }
209

    
210
        public JTextField getTHeight(){
211
                return ((InputSizeDataPanel)((MethodDataInputPanel)getPMethod()).getPSouth()).getTHeight();
212
        }
213

    
214
        public JComboBox getCbMeasureType(){
215
                return ((InputSizeDataPanel)((MethodDataInputPanel)getPMethod()).getPSouth()).getCbMeasureType();
216
        }
217

    
218
        public JTextField getTScale(){
219
                return ((InputScaleDataPanel)((MethodDataInputPanel)getPMethod()).getPEast()).getTScale();
220
        }
221

    
222
        public JComboBox getCbResolution(){
223
                return ((InputScaleDataPanel)((MethodDataInputPanel)getPMethod()).getPEast()).getCbResolution();
224
        }
225

    
226
        public JTextField getTMtsPixel(){
227
                return ((InputScaleDataPanel)((MethodDataInputPanel)getPMethod()).getPEast()).getTMtsPixel();
228
        }
229

    
230
        public JRadioButton getRbScale(){
231
                return ((MethodSaveRasterSelectorPanel)((MethodDataInputPanel)getPMethod()).getPWest()).getRbScale();
232
        }
233

    
234
        public JRadioButton getRbMtsPixel(){
235
                return ((MethodSaveRasterSelectorPanel)((MethodDataInputPanel)getPMethod()).getPWest()).getRbMtsPixel();
236
        }
237

    
238
        public JRadioButton getRbSize(){
239
                return ((MethodSaveRasterSelectorPanel)((MethodDataInputPanel)getPMethod()).getPWest()).getRbSize();
240
        }
241

    
242
        /**
243
         * Obtiene el ancho en pixeles del recuadro seleccionado para su uso en
244
         * el calculo cuando la vista est? en coordenadas geograficas
245
         * @return ancho en pixeles de la selecci?n
246
         */
247
        public int getWidthInPixelsGeodesicas() {
248
                return widthInPixelsGeodesicas;
249
        }
250

    
251
        /**
252
         * Asigna el ancho en pixeles del recuadro seleccionado para su uso en
253
         * el calculo cuando la vista est? en coordenadas geograficas
254
         * @param widthInPixelsGeodesicas ancho en pixeles de la selecci?n
255
         */
256
        public void setWidthInPixelsGeodesicas(int widthInPixelsGeodesicas) {
257
                this.widthInPixelsGeodesicas = widthInPixelsGeodesicas;
258
        }
259

    
260
        /**
261
         * Obtiene el alto en pixeles del recuadro seleccionado para su uso en
262
         * el calculo cuando la vista est? en coordenadas geograficas
263
         * @return alto en pixeles de la selecci?n
264
         */
265
        public int getHeightInPixelsGeodesicas() {
266
                return heightInPixelsGeodesicas;
267
        }
268

    
269
        /**
270
         * Asigna el alto en pixeles del recuadro seleccionado para su uso en
271
         * el calculo cuando la vista est? en coordenadas geograficas
272
         * @param heightInPixelsGeodesicas alto en pixeles de la selecci?n
273
         */
274
        public void setHeightInPixelsGeodesicas(int heightInPixelsGeodesicas) {
275
                this.heightInPixelsGeodesicas = heightInPixelsGeodesicas;
276
        }
277

    
278
        /**
279
         * Asigna la proyecci?n
280
         * @param proj Interfaz IProjection
281
         */
282
        public void setProjection(IProjection proj){
283
                this.proj = proj;
284
        }
285

    
286
        /**
287
         * Obtiene la proyecci?n
288
         * @return Interfaz IProjection
289
         */
290
        public IProjection getProjection(){
291
                return proj;
292
        }
293
}