Statistics
| Revision:

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

History | View | Annotate | Download (6.58 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
        public Object getWindowProfile(){
88
                return WindowInfo.DIALOG_PROFILE;
89
        }
90
        
91
        /*
92
         * (non-Javadoc)
93
         * @see com.iver.andami.ui.mdiManager.IWindowListener#windowActivated()
94
         */
95
        public void windowActivated() {
96
        }
97

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

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