Statistics
| Revision:

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

History | View | Annotate | Download (9.11 KB)

1 4547 nacho
package org.gvsig.rasterTools.saveRaster.ui.main;
2
3
import java.awt.GridBagConstraints;
4
import java.awt.GridBagLayout;
5 12388 jmvivo
import java.awt.GridLayout;
6 4547 nacho
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 12388 jmvivo
32 4547 nacho
    private IProjection                                        proj = null;
33
        private int                                                        widthInPixelsGeodesicas = 0;
34
    private int                                                        heightInPixelsGeodesicas = 0;
35 12388 jmvivo
36 4547 nacho
        /**
37
         * This is the default constructor
38
         */
39
        public SaveRasterControlsPanel() {
40
                super();
41
                initialize();
42
        }
43 12388 jmvivo
44 4547 nacho
        /**
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 12388 jmvivo
54 4547 nacho
                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 12388 jmvivo
59 4547 nacho
                InputSizeDataPanel size = ((InputSizeDataPanel)method.getPSouth());
60
                size.getLHeight().setText(" "+PluginServices.getText(this,"height"));
61
                size.getLWidth().setText(PluginServices.getText(this,"width"));
62 12388 jmvivo
63 4547 nacho
                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 5496 jaume
                                                                                                        " X: ",
68
                                                                                                        " Y: ");
69 4547 nacho
                ((DoubleJTextInputPanel)pSupIzq).setTexts(        PluginServices.getText(this,"lsup_izq"),
70 5496 jaume
                                                                                                        " X: ",
71
                                                                                                        " Y: ");
72 4547 nacho
        }
73
74
        /**
75
         * This method initializes this
76 12388 jmvivo
         *
77 4547 nacho
         * @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 12388 jmvivo
                this.setSize(390, 325);
94
                this.setPreferredSize(new java.awt.Dimension(341,237));
95 4547 nacho
                this.add(getPWorldCoordinates(), gridBagConstraints);
96
                this.add(getPMethod(), gridBagConstraints1);
97
                this.add(getPButtons(), gridBagConstraints2);
98
                this.setTranslation();
99
        }
100
101
        /**
102 12388 jmvivo
         * This method initializes jPanel
103
         *
104
         * @return javax.swing.JPanel
105 4547 nacho
         */
106
        public JPanel getPWorldCoordinates() {
107
                if (pWorldCoordinates == null) {
108
                        pWorldCoordinates = new JPanel();
109 12388 jmvivo
                        pWorldCoordinates.setLayout(new GridLayout(2,1));
110 4844 nacho
                        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 12388 jmvivo
                        pWorldCoordinates.add(getPInfDer(), null);
113
                        pWorldCoordinates.add(getPSupIzq(), null);
114 4547 nacho
                }
115
                return pWorldCoordinates;
116
        }
117
118
        /**
119 12388 jmvivo
         * This method initializes jPanel1
120
         *
121
         * @return javax.swing.JPanel
122 4547 nacho
         */
123
        public JPanel getPMethod() {
124
                if (pMethod == null) {
125
                        pMethod = new MethodDataInputPanel();
126 4625 nacho
                        pMethod.setPreferredSize(new java.awt.Dimension(371,160));
127 4547 nacho
                        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 12388 jmvivo
         * This method initializes jPanel2
134
         *
135
         * @return javax.swing.JPanel
136 4547 nacho
         */
137
        public JPanel getPButtons() {
138
                if (pButtons == null) {
139
                        pButtons = new ButtonsPanel();
140 12388 jmvivo
                        pButtons.setPreferredSize(new java.awt.Dimension(371,75));
141 4547 nacho
                        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 12388 jmvivo
         * This method initializes jPanel
148
         *
149
         * @return javax.swing.JPanel
150 4547 nacho
         */
151
        public JPanel getPInfDer() {
152
                if (pInfDer == null) {
153
                        pInfDer = new DoubleJTextInputPanel();
154
                        ((DoubleJTextInputPanel)pInfDer).setWidthText1(105);
155
                        ((DoubleJTextInputPanel)pInfDer).setWidthText2(105);
156 5829 nacho
                        pInfDer.setPreferredSize(new java.awt.Dimension(350,21));
157 4547 nacho
                }
158
                return pInfDer;
159
        }
160
161
        /**
162 12388 jmvivo
         * This method initializes jPanel1
163
         *
164
         * @return javax.swing.JPanel
165 4547 nacho
         */
166
        public JPanel getPSupIzq() {
167
                if (pSupIzq == null) {
168
                        pSupIzq = new DoubleJTextInputPanel();
169
                        ((DoubleJTextInputPanel)pSupIzq).setWidthText1(105);
170
                        ((DoubleJTextInputPanel)pSupIzq).setWidthText2(105);
171 5829 nacho
                        pSupIzq.setPreferredSize(new java.awt.Dimension(350,21));
172 4547 nacho
                }
173
                return pSupIzq;
174
        }
175 12388 jmvivo
176 4547 nacho
        //-------------------------------------------
177 12388 jmvivo
178 4547 nacho
        public JLabel getLFileName(){
179
                return ((ButtonsPanel)pButtons).getLabelText();
180
        }
181 12388 jmvivo
182 4547 nacho
        public JButton getBProperties(){
183
                return ((ButtonsPanel)pButtons).getBProperties();
184
        }
185 12388 jmvivo
186 4547 nacho
        public JButton getBSelect(){
187
                return ((ButtonsPanel)pButtons).getBSelect();
188
        }
189 12388 jmvivo
190 4547 nacho
        public JTextField getTSupIzqX(){
191
                return ((DoubleJTextInputPanel)pSupIzq).getJTextField();
192
        }
193 12388 jmvivo
194 4547 nacho
        public JTextField getTSupIzqY(){
195
                return ((DoubleJTextInputPanel)pSupIzq).getJTextField1();
196
        }
197 12388 jmvivo
198 4547 nacho
        public JTextField getTInfDerX(){
199
                return ((DoubleJTextInputPanel)pInfDer).getJTextField();
200
        }
201 12388 jmvivo
202 4547 nacho
        public JTextField getTInfDerY(){
203
                return ((DoubleJTextInputPanel)pInfDer).getJTextField1();
204
        }
205 12388 jmvivo
206 4547 nacho
        public JTextField getTWidth(){
207
                return ((InputSizeDataPanel)((MethodDataInputPanel)getPMethod()).getPSouth()).getTWidth();
208
        }
209 12388 jmvivo
210 4547 nacho
        public JTextField getTHeight(){
211
                return ((InputSizeDataPanel)((MethodDataInputPanel)getPMethod()).getPSouth()).getTHeight();
212
        }
213 12388 jmvivo
214 4547 nacho
        public JComboBox getCbMeasureType(){
215
                return ((InputSizeDataPanel)((MethodDataInputPanel)getPMethod()).getPSouth()).getCbMeasureType();
216
        }
217 12388 jmvivo
218 4547 nacho
        public JTextField getTScale(){
219
                return ((InputScaleDataPanel)((MethodDataInputPanel)getPMethod()).getPEast()).getTScale();
220
        }
221 12388 jmvivo
222 4547 nacho
        public JComboBox getCbResolution(){
223
                return ((InputScaleDataPanel)((MethodDataInputPanel)getPMethod()).getPEast()).getCbResolution();
224
        }
225 12388 jmvivo
226 4547 nacho
        public JTextField getTMtsPixel(){
227
                return ((InputScaleDataPanel)((MethodDataInputPanel)getPMethod()).getPEast()).getTMtsPixel();
228
        }
229 12388 jmvivo
230 4547 nacho
        public JRadioButton getRbScale(){
231
                return ((MethodSaveRasterSelectorPanel)((MethodDataInputPanel)getPMethod()).getPWest()).getRbScale();
232
        }
233 12388 jmvivo
234 4547 nacho
        public JRadioButton getRbMtsPixel(){
235
                return ((MethodSaveRasterSelectorPanel)((MethodDataInputPanel)getPMethod()).getPWest()).getRbMtsPixel();
236
        }
237 12388 jmvivo
238 4547 nacho
        public JRadioButton getRbSize(){
239
                return ((MethodSaveRasterSelectorPanel)((MethodDataInputPanel)getPMethod()).getPWest()).getRbSize();
240
        }
241 12388 jmvivo
242 4547 nacho
        /**
243 12388 jmvivo
         * Obtiene el ancho en pixeles del recuadro seleccionado para su uso en
244 4547 nacho
         * 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 12388 jmvivo
         * Asigna el ancho en pixeles del recuadro seleccionado para su uso en
253 4547 nacho
         * 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 12388 jmvivo
260 4547 nacho
        /**
261 12388 jmvivo
         * Obtiene el alto en pixeles del recuadro seleccionado para su uso en
262 4547 nacho
         * 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 12388 jmvivo
         * Asigna el alto en pixeles del recuadro seleccionado para su uso en
271 4547 nacho
         * 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 12388 jmvivo
278 4547 nacho
        /**
279 12388 jmvivo
         * Asigna la proyecci?n
280 4547 nacho
         * @param proj Interfaz IProjection
281
         */
282
        public void setProjection(IProjection proj){
283
                this.proj = proj;
284
        }
285 12388 jmvivo
286 4547 nacho
        /**
287
         * Obtiene la proyecci?n
288
         * @return Interfaz IProjection
289
         */
290
        public IProjection getProjection(){
291
                return proj;
292
        }
293
}