Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / ui / options / GeorefOptionsDialog.java @ 19621

History | View | Annotate | Download (6.5 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.georeferencing.ui.options;
20

    
21
import java.awt.BorderLayout;
22
import java.awt.Color;
23

    
24
import javax.swing.JPanel;
25

    
26
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
27
import org.gvsig.gui.beans.datainput.DataInputContainer;
28

    
29
import com.iver.andami.ui.mdiManager.IWindow;
30
import com.iver.andami.ui.mdiManager.IWindowListener;
31
import com.iver.andami.ui.mdiManager.WindowInfo;
32

    
33
/**
34
 * Dialogo de opciones de georreferenciaci?n
35
 * 
36
 * 10/01/2008
37
 * @author Nacho Brodin nachobrodin@gmail.com
38
 */
39
public class GeorefOptionsDialog extends JPanel implements IWindow, IWindowListener {
40
        private static final long            serialVersionUID = 7362459094802955247L;
41
        private GeorefOptionsPanel           geoOptionsPanel  = null;
42
        
43
        private int                          polynomialDegree;
44

    
45
        /**
46
         * Tama?o de la ventana
47
         */
48
        private int                          widthWindow      = 440;
49
        private int                          heightWindow     = 460;
50
                
51
        /**
52
         * Constructor
53
         * @param viewList Lista de nombres de las vistas disponibles
54
         * @param degreeList grado m?ximo para la georreferenciaci?n polinomial
55
         */
56
        public GeorefOptionsDialog(int polynomialDegree, ButtonsPanelListener listener) {
57
                this.polynomialDegree = polynomialDegree;
58
                
59
                BorderLayout bl = new BorderLayout();
60
                this.setLayout(bl);
61
                
62
                this.add(getOptionsPanel(listener), BorderLayout.CENTER);
63
        }
64
                
65
        /**
66
         * Obtiene el panel general del lanzador  de la georreferenciaci?n
67
         * @return GeorefLauncherPanel
68
         */
69
        public GeorefOptionsPanel getOptionsPanel(ButtonsPanelListener listener) {
70
                if (geoOptionsPanel == null) 
71
                        geoOptionsPanel = new GeorefOptionsPanel(polynomialDegree, listener);
72
                
73
                return geoOptionsPanel;
74
        }
75
        
76
        /*
77
         * (non-Javadoc)
78
         * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
79
         */
80
        public WindowInfo getWindowInfo() {
81
                WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
82
                m_viewinfo.setHeight(heightWindow);
83
                m_viewinfo.setWidth(widthWindow);
84
                return m_viewinfo;
85
        }
86
        
87
        /*
88
         * (non-Javadoc)
89
         * @see com.iver.andami.ui.mdiManager.IWindowListener#windowActivated()
90
         */
91
        public void windowActivated() {
92
        }
93

    
94
        /*
95
         * (non-Javadoc)
96
         * @see com.iver.andami.ui.mdiManager.IWindowListener#windowClosed()
97
         */
98
        public void windowClosed() {
99
        }
100
        
101
        //-------Consulta de propiedades seleccionadas---------
102
        
103

    
104
        /**
105
         * Obtiene el tipo de algoritmo seleccionado
106
         * @return entero con el tipo de algoritmo. Es una constante definida 
107
         * en la clase georreferencing. 
108
         */
109
        public int getAlgorithm() {
110
                return geoOptionsPanel.getAlgorithmSelectionPanel().getAlgorithm();
111
        }
112
        
113
        /**
114
         * Obtiene el grado del algoritmo si este es polinomial
115
         * @return entero con el grado del algoritmo. 
116
         */
117
        public int getDegree() {
118
                return geoOptionsPanel.getAlgorithmSelectionPanel().getSelectedDegree();
119
        }
120
        
121
        /**
122
         * Obtiene el m?todo de interpolaci?n del algoritmo si este es polinomial
123
         * @return entero con el m?todo de interpolaci?n 
124
         */
125
        public int getInterpolationMethod() {
126
                return geoOptionsPanel.getAlgorithmSelectionPanel().getSelectedInterpolationMethod();
127
        }
128
        
129
        /**
130
         * Obtiene el tama?o de celda en X.
131
         * @return double con el tama?o de celda. 
132
         */
133
        public double getXCellSize() {
134
                return geoOptionsPanel.getCellSizePanel().getXCellSizeValue();
135
        }
136
        
137
        /**
138
         * Asigna el tama?o de celda en X.
139
         * @param cellSize
140
         */
141
        public void setXCellSize(double cellSize) {
142
                geoOptionsPanel.getCellSizePanel().setXCellSize(cellSize);
143
        }
144
        
145
        /**
146
         * Obtiene el tama?o de celda en Y.
147
         * @return double con el tama?o de celda. 
148
         */
149
        public double getYCellSize() {
150
                return geoOptionsPanel.getCellSizePanel().getYCellSizeValue();
151
        }
152
        
153
        /**
154
         * Asigna el tama?o de celda en Y.
155
         * @param cellSize
156
         */
157
        public void setYCellSize(double cellSize) {
158
                geoOptionsPanel.getCellSizePanel().setYCellSize(cellSize);
159
        }
160
        
161
        /**
162
         * Asigna el m?todo de interpolaci?n
163
         * @param interpolationMethod
164
         */
165
        public void setInterpolationMethod(int interpolationMethod) {
166
                geoOptionsPanel.getAlgorithmSelectionPanel().setInterpolationMethod(interpolationMethod);
167
        }
168
        
169
        /**
170
         * Asigna el nombre del fichero de salida
171
         * @param interpolationMethod
172
         */
173
        public void setOutFile(String out) {
174
                geoOptionsPanel.getOutFileSelectionPanel().setOutFile(out);
175
        }
176
        
177
        /**
178
         * Asigna el grado del algoritmo cuando es polinomial
179
         * @param optiondegree
180
         */
181
        public void setDegree(int optiondegree) {
182
                geoOptionsPanel.getAlgorithmSelectionPanel().setDegree(optiondegree);
183
        }
184
        
185
        /**
186
         * Asigna el algoritmo
187
         * @param alg
188
         */
189
        public void setAlgorithm(int alg) {
190
                geoOptionsPanel.getAlgorithmSelectionPanel().setAlgorithm(alg);
191
        }
192
        
193
        /**
194
         * Asigna el color de fonfo
195
         * @param c
196
         */
197
        public void setBackGroundColor(Color c) {
198
                geoOptionsPanel.getCheckOptionsPanel().getBackGroundColorSelector().setColor(c);
199
        }
200
        
201
        /**
202
         * Obtiene el color de fondo
203
         * @return
204
         */
205
        public Color getBackGroundColor() {
206
                return geoOptionsPanel.getCheckOptionsPanel().getBackGroundColorSelector().getColor();
207
        }
208
        
209
        /**
210
         * Asigna el color del texto
211
         * @param c
212
         */
213
        public void setTextColor(Color c) {
214
                geoOptionsPanel.getCheckOptionsPanel().getTextSelector().setColor(c);
215
        }
216
        
217
        /**
218
         * Obtiene el color del texto
219
         * @return
220
         */
221
        public Color getTextColor() {
222
                return geoOptionsPanel.getCheckOptionsPanel().getTextSelector().getColor();
223
        }
224
        
225
        /**
226
         * Obtiene el control para selecci?n de umbral de error
227
         * @return JButton
228
         */
229
        public DataInputContainer getThresholdError() {
230
                return geoOptionsPanel.getCheckOptionsPanel().getThresholdError();
231
        }
232
        
233
        /**
234
         * Asigna el control para selecci?n de umbral de error
235
         * @return JButton
236
         */
237
        public void setThresholdError(double threshold) {
238
                geoOptionsPanel.getCheckOptionsPanel().getThresholdError().setValue(new Double(threshold).toString());
239
        }
240
}
241