Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / cutting / ui / CuttingPanel.java @ 11228

History | View | Annotate | Download (7.87 KB)

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.cutting.ui;
20

    
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
import java.awt.FlowLayout;
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
26

    
27
import javax.swing.JCheckBox;
28
import javax.swing.JLabel;
29
import javax.swing.JPanel;
30

    
31
import org.gvsig.gui.beans.buttonbar.ButtonBarContainer;
32
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
33
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
34
import org.gvsig.gui.beans.coorddatainput.CoordDataInputContainer;
35
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
36
import org.gvsig.gui.beans.table.TableContainer;
37

    
38
import com.iver.andami.PluginServices;
39
/**
40
 * <code>CuttingPanel</code>. Interfaz de usuario para el recorte de rasters.
41
 *
42
 * @version 17/04/2007
43
 * @author Borja S?nchez Zamorano (borja.sanchez@iver.es)
44
 */
45
public class CuttingPanel extends DefaultButtonsPanel implements ButtonsPanelListener {
46
        private static final long serialVersionUID = 3078196473228467834L;
47

    
48
        private int                                                wPanel = 420, hPanel = 534;
49
        private int                                                wComp = wPanel - 6, hComp = hPanel - 40;
50
        private int                                                wTable = wComp - 10;
51
        private int                                                hTable = hComp - 370 ;
52
        
53
        private CoordDataInputContainer        coor_pixel = null;
54
        private CoordDataInputContainer        coor_reales = null;
55
        private ButtonBarContainer                        buttonBarContainer = null;
56
        private JPanel                                                                        pSelection = null;
57
        private TableContainer                                        tSelection = null;
58
        private JPanel                                                                        pCheck = null;
59
        private JCheckBox                                                                jCheckBox = null;
60
        private ResolutionPanel                                        pResolution = null;
61

    
62
        /**
63
         * This method initializes 
64
         * 
65
         */
66
        public CuttingPanel() {
67
                super();
68
                initialize();
69
        }
70

    
71
        /**
72
         * This method initializes this
73
         * 
74
         */
75
        private void initialize() {
76
                GridBagConstraints gridBagConstraints = new GridBagConstraints();
77
                gridBagConstraints.gridx = 0;
78
                gridBagConstraints.gridy = 0;
79
                GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
80
                gridBagConstraints1.gridx = 0;
81
                gridBagConstraints1.gridy = 1;
82
                GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
83
                gridBagConstraints2.gridx = 0;
84
                gridBagConstraints2.gridy = 2;
85
                GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
86
                gridBagConstraints3.gridx = 0;
87
                gridBagConstraints3.gridy = 3;
88
                GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
89
                gridBagConstraints4.gridx = 0;
90
                gridBagConstraints4.gridy = 4;
91
                GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
92
                gridBagConstraints5.gridx = 0;
93
                gridBagConstraints5.gridy = 5;
94
                this.setLayout(new GridBagLayout());
95
                this.setSize(new java.awt.Dimension(wPanel, hPanel));
96
                this.add(getCoor_pixel(), gridBagConstraints);
97
                this.add(getCoor_reales(), gridBagConstraints1);
98
                this.add(getButtonBarContainer(), gridBagConstraints2);
99
                this.add(getPResolution(), gridBagConstraints3);
100
                this.add(getPSelection(), gridBagConstraints4);
101
                this.add(getPCheck(), gridBagConstraints5);
102
        }
103

    
104
        /*
105
         * (non-Javadoc)
106
         * @see org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener#actionButtonPressed(org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent)
107
         */
108
        public void actionButtonPressed(ButtonsPanelEvent e) {
109
        }
110

    
111
        /**
112
         * This method initializes jPanel        
113
         *         
114
         * @return javax.swing.JPanel        
115
         */
116
        private CoordDataInputContainer getCoor_pixel() {
117
                if (coor_pixel == null) {
118
                        coor_pixel = new CoordDataInputContainer(wPanel, 90);
119
                        coor_pixel.setParameters(PluginServices.getText(this, "coordenadas_pixel"),
120
                                        PluginServices.getText(this, "sup_izq"),
121
                                        "X" ,"Y", 
122
                                        PluginServices.getText(this, "inf_der"),
123
                                        "X", "Y");
124
                        coor_pixel.setDecimalValues(true);
125
                }
126
                return coor_pixel;
127
        }
128

    
129
        /**
130
         * This method initializes jPanel1        
131
         *         
132
         * @return javax.swing.JPanel        
133
         */
134
        private CoordDataInputContainer getCoor_reales() {
135
                if (coor_reales == null) {
136
                        coor_reales = new CoordDataInputContainer(wPanel, 90);
137
                        coor_reales.setParameters(PluginServices.getText(this, "coordenadas_reales"),
138
                                        PluginServices.getText(this, "sup_izq"),
139
                                        "X" ,"Y", 
140
                                        PluginServices.getText(this, "inf_der"),
141
                                        "X", "Y");
142
                        coor_reales.setDecimalValues(true);
143
                }
144
                return coor_reales;
145
        }
146

    
147
        /**
148
         * This method initializes jButton        
149
         *         
150
         * @return javax.swing.JButton        
151
         */
152
        private ButtonBarContainer getButtonBarContainer() {
153
                if (buttonBarContainer == null) {
154
                        buttonBarContainer = new ButtonBarContainer();
155
                        buttonBarContainer.setPreferredSize(new java.awt.Dimension(wPanel - 4, 32));
156
                        buttonBarContainer.addButton("fullExtent.png", PluginServices.getText(this, "fullExtent"), 0);
157
                        buttonBarContainer.addButton("selectTool.png", PluginServices.getText(this, "select_tool"), 1);
158
                        buttonBarContainer.addButton("down.png", PluginServices.getText(this, "expandir"), 2);
159
                        buttonBarContainer.setButtonAlignment("right");
160
                        buttonBarContainer.setComponentBorder(true);
161
                }
162
                return buttonBarContainer;
163
        }
164
        
165
        /**
166
         * This method initializes jPanel        
167
         *         
168
         * @return javax.swing.JPanel        
169
         */
170
        public ResolutionPanel getPResolution() {
171
                if (pResolution == null) {
172
                        pResolution = new ResolutionPanel();
173
                        pResolution.setPreferredSize(new java.awt.Dimension(wTable,120));
174
                        pResolution.setComponentSize(wTable,120);
175
                }
176
                return pResolution;
177
        }
178

    
179
        /**
180
         * This method initializes jPanel1        
181
         *         
182
         * @return javax.swing.JPanel        
183
         */
184
        private JPanel getPSelection() {
185
                if (pSelection == null) {
186
                        pSelection = new JPanel();
187
                        pSelection.setLayout(new FlowLayout());
188
                        pSelection.setPreferredSize(new java.awt.Dimension(wTable, hTable));
189
                        pSelection.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this, "seleccion_bandas"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10), null));
190
                        pSelection.add(getTSelection(), null);
191
                        
192
                }
193
                return pSelection;
194
        }
195

    
196
        /**
197
         * Obtiene la tabla de selecci?n de bandas
198
         * @return Tabla de selecci?n de bandas
199
         */
200
        public TableContainer getTSelection(){
201
                if (tSelection == null) {
202
                        String[] columnNames = {PluginServices.getText(this, "bandas"), PluginServices.getText(this, "nombre")};
203
                        int[] columnWidths = {75, 305};
204
                        tSelection = new TableContainer(columnNames, columnWidths);
205
                        tSelection.setModel("CheckBoxModel");
206
                        tSelection.setControlVisible(false);
207
                        tSelection.initialize();
208
                }
209
                
210
                return tSelection;
211
        }
212

    
213
        /**
214
         * This method initializes jPanel        
215
         *         
216
         * @return javax.swing.JPanel        
217
         */
218
        private JPanel getPCheck() {
219
                if (pCheck == null) {
220
                        JLabel jLabel = new JLabel();
221
                        jLabel.setText(PluginServices.getText(this, "crear_1_capa_por_banda"));
222
                        pCheck = new JPanel();
223
                        pCheck.setLayout(new BorderLayout());
224
                        pCheck.setPreferredSize(new Dimension(410 - 10, 30));
225
                        pCheck.add(getCbOneLyrPerBand(), java.awt.BorderLayout.WEST);
226
                        pCheck.add(jLabel, java.awt.BorderLayout.CENTER);
227
                }
228
                return pCheck;
229
        }
230
        
231

    
232
        /**
233
         * This method initializes jCheckBox1        
234
         *         
235
         * @return javax.swing.JCheckBox        
236
         */
237
        public JCheckBox getCbOneLyrPerBand() {
238
                if (jCheckBox == null) {
239
                        jCheckBox = new JCheckBox();
240
                }
241
                return jCheckBox;
242
        }
243
}  //  @jve:decl-index=0:visual-constraint="10,10"