Statistics
| Revision:

gvsig-raster / org.gvsig.raster.georeferencing / trunk / org.gvsig.raster.georeferencing / org.gvsig.raster.georeferencing.swing / org.gvsig.raster.georeferencing.swing.impl / src / main / java / org / gvsig / raster / georeferencing / swing / impl / option / GeorefOptionsDataModelImpl.java @ 1725

History | View | Annotate | Download (8.72 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.raster.georeferencing.swing.impl.option;
20

    
21
import java.awt.Color;
22
import java.awt.geom.Rectangle2D;
23

    
24
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
25
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
26
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
27
import org.gvsig.raster.georeferencing.swing.GCPList;
28
import org.gvsig.raster.georeferencing.swing.GeoreferencingOptionsDataModel;
29
import org.gvsig.raster.georeferencing.swing.GeoreferencingSwingLibrary;
30

    
31
/**
32
 * Clase para el almacenamiento de opciones. Contiene propiedades y m?todos para
33
 * su asignaci?n y recuperaci?n.
34
 * 
35
 * 31/01/2008
36
 * @author Nacho Brodin nachobrodin@gmail.com
37
 */
38
public class GeorefOptionsDataModelImpl implements GeoreferencingOptionsDataModel {
39
        //        Opciones
40
        private int                           algorithm                = GeoreferencingSwingLibrary.AFFINE;
41
        private int                           degree                   = GeoreferencingSwingLibrary.DEFAULT_DEGREE;
42
        private Color                         backgroundColor          = Color.BLACK;
43
        private Color                         textColor                = Color.RED;
44
        private boolean                       showNumber               = true;
45
        private boolean                       addErrorsCSV             = false;
46
        private boolean                       centerView               = false;
47
        private double                        threshold                = 2.0;        
48
        private int                           interpolationMethod      = Buffer.INTERPOLATION_NearestNeighbour;
49
        private String                        outFile                  = null;
50
        private int                           type                     = GeoreferencingSwingLibrary.WITH_MAP;
51
        private double                        xCellSize                = 0;
52
        private double                        yCellSize                = 0;
53
        private RasterDataStore               store                    = null;
54
        private String                        selectedView             = null;
55
        private GCPList                       pointList                = null;
56
        
57
        public void reset() {
58
                store                    = null;
59
                selectedView             = null;
60
                if(pointList != null)
61
                        pointList.removeAll();
62
        }
63
        
64
        /**
65
         * Obtiene el grado del polin?mio
66
         * @return entero con el valor que representa el grado del polin?mio
67
         */
68
        public int getDegree() {
69
                return degree;
70
        }
71

    
72
        /**
73
         * Asigna el grado del polin?mio
74
         * @param entero con el valor que representa el grado del polin?mio
75
         */
76
        public void setDegree(int optiondegree) {
77
                degree = optiondegree;
78
        }
79

    
80
        /**
81
         * Obtiene el color de los gr?ficos
82
         * @return Color
83
         */
84
        public Color getTextColor() {
85
                return textColor;
86
        }
87

    
88
        /**
89
         * Asigna el color de los gr?ficos
90
         * @param optionTextColor
91
         */
92
        public void setTextColor(Color optionTextColor) {
93
                textColor = optionTextColor;
94
        }
95
        
96
        /**
97
         * Obtiene al algoritmo a utilizar (Transformaci?n af?n, polin?mico, ...)
98
         * Las constantes est?n definidas en la clase Georreferencing
99
         * @return
100
         */
101
        public int getAlgorithm() {
102
                return algorithm;
103
        }
104

    
105
        /**
106
         * Asigna el algoritmo a utilizar (Transformaci?n af?n, polin?mico, ...)
107
         * Las constantes est?n definidas en la clase Georreferencing
108
         * @param
109
         */
110
        public void setAlgorithm(int optionAlgorithm) {
111
                algorithm = optionAlgorithm;
112
        }
113

    
114
        /**
115
         * Obtiene el color de fondo de las vistas
116
         * @return Color
117
         */
118
        public Color getBackgroundColor() {
119
                return backgroundColor;
120
        }
121

    
122
        /**
123
         * Asigna el color de fondo de las vistas
124
         * @param optionBackgroundColor
125
         */
126
        public void setBackgroundColor(Color optionBackgroundColor) {
127
                backgroundColor = optionBackgroundColor;
128
        }
129

    
130
        /**
131
         * Consulta si los errores se escriben en el fichero CSV
132
         * @return true si se escriben en el fichero y false si no se hace
133
         */
134
        public boolean isAddErrorsCSV() {
135
                return addErrorsCSV;
136
        }
137

    
138
        /**
139
         * Asigna el flag que dice si los errores se escriben en el fichero CSV
140
         * @param true para escribirlos en el fichero y false para no hacerlo
141
         */
142
        public void setAddErrorsCSV(boolean addErrorsCSV) {
143
                this.addErrorsCSV = addErrorsCSV;
144
        }
145

    
146
        /**
147
         * Consulta si est? activo el flag de centrar las vistas autom?ticamente sobre
148
         * el punto que est? seleccionado en la tabla.
149
         * @return true para centrar autom?ticamente y false para no hacerlo
150
         */
151
        public boolean isCenterView() {
152
                return centerView;
153
        }
154

    
155
        /**
156
         * Asigna el flag que dice si se centran las vistas autom?ticamente sobre
157
         * el punto que est? seleccionado en la tabla.
158
         * @return true para centrar autom?ticamente y false para no hacerlo
159
         */
160
        public void setCenterView(boolean centerView) {
161
                this.centerView = centerView;
162
        }
163

    
164
        /**
165
         * Consulta el flag que informa si se muestra el n?mero del punto en la vista
166
         * @return true si se muestra y false si no
167
         */
168
        public boolean isShowNumber() {
169
                return showNumber;
170
        }
171

    
172
        /**
173
         * Asigna el flag que dice si se muestra el n?mero del punto en la vista
174
         * @param true para mostrarlo y false para no hacerlo
175
         */
176
        public void setShowNumber(boolean showNumber) {
177
                this.showNumber = showNumber;
178
        }
179

    
180
        /**
181
         * Obtiene el umbral de error a partir del cual se iluminan en rojo en la tabla
182
         * @return double con el valor del umbral
183
         */
184
        public double getThreshold() {
185
                return threshold;
186
        }
187

    
188
        /**
189
         * Asigna el umbral de error a partir del cual se iluminan en rojo en la tabla
190
         * @param double con el valor del umbral
191
         */
192
        public void setThreshold(double threshold) {
193
                this.threshold = threshold;
194
        }
195

    
196
        /**
197
         * Obtiene el m?todo de interpolaci?n del m?todo polinomial
198
         * @return Entero contenido como constante en la clas GridInterpolation
199
         */
200
        public int getInterpolationMethod() {
201
                return interpolationMethod;
202
        }
203

    
204
        /**
205
         * Asigna el m?todo de interpolaci?n del m?todo polinomial
206
         * @param Entero contenido como constante en la clas GridInterpolation
207
         */
208
        public void setInterpolationMethod(int interpolationMethod) {
209
                this.interpolationMethod = interpolationMethod;
210
        }
211
        
212
        /**
213
         * Obtiene el fichero de salida
214
         * @return 
215
         */
216
        public String getOutFile() {
217
                return outFile;
218
        }
219

    
220
        /**
221
         * Asigna el fichero de salida
222
         * @param outputFile
223
         */
224
        public void setOutFile(String outFile) {
225
                this.outFile = outFile;
226
        }
227

    
228
        /**
229
         * Obtiene el tipo de georreferenciaci?n especificado en las constantes de la clase
230
         * georreferencing.
231
         * @return
232
         */
233
        public int getType() {
234
                return type;
235
        }
236

    
237
        /**
238
         * Asigna el tipo de georreferenciaci?n especificado en las constantes de la clase
239
         * georreferencing.
240
         * @param
241
         */
242
        public void setType(int type) {
243
                this.type = type;
244
        }
245
        
246
        /**
247
         * Obtiene el tama?o de celda en X para la georreferenciaci?n con remuestreo
248
         * asignada por el usuario.
249
         * @return
250
         */
251
        public double getXCellSize() {
252
                return xCellSize;
253
        }
254

    
255
        /**
256
         * Asigna el tama?o de celda en X para la georreferenciaci?n con remuestreo 
257
         * asignada por el usuario.
258
         * @param
259
         */
260
        public void setXCellSize(double cellSize) {
261
                this.xCellSize = cellSize;
262
        }
263
        
264
        /**
265
         * Obtiene el tama?o de celda en Y para la georreferenciaci?n con remuestreo
266
         * asignada por el usuario.
267
         * @return
268
         */
269
        public double getYCellSize() {
270
                return yCellSize;
271
        }
272

    
273
        /**
274
         * Asigna el tama?o de celda en Y para la georreferenciaci?n con remuestreo 
275
         * asignada por el usuario.
276
         * @param
277
         */
278
        public void setYCellSize(double cellSize) {
279
                this.yCellSize = cellSize;
280
        }
281

    
282
        public double getThresholdError() {
283
                return threshold;
284
        }
285

    
286
        public void setBackGroundColor(Color c) {
287
                this.backgroundColor = c;
288
        }
289

    
290
        public void setThresholdError(double threshold) {
291
                this.threshold = threshold;
292
        }
293

    
294
        public RasterDataStore getDataStore() {
295
                return store;
296
        }
297
        
298
        public Rectangle2D getRasterExtent() {
299
                Extent ex = store.getExtent();
300
                return ex.toRectangle2D();//new Rectangle2D.Double(0, 0, ex.width(), ex.height());
301
        }
302

    
303
        public String getSelectedView() {
304
                return selectedView;
305
        }
306
        
307
        public void setSelectedView(String v) {
308
                selectedView = v;
309
        }
310
        
311
        public void setDataStore(RasterDataStore store) {
312
                this.store = store;
313
        }
314
        
315
        public GCPList getGCPList() {
316
                if(pointList == null)
317
                        pointList = new GCPListImpl();
318
                return pointList;
319
        }
320
}
321