svn-gvsig-desktop / tags / v1_1_Build_1004 / extensions / extGeoreferencing / src / com / iver / cit / gvsig / fmap / layers / FLyrPoints.java @ 12319
History | View | Annotate | Download (35.5 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 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 com.iver.cit.gvsig.fmap.layers; |
20 |
|
21 |
import java.awt.Color; |
22 |
import java.awt.Dimension; |
23 |
import java.awt.Graphics2D; |
24 |
import java.awt.geom.Point2D; |
25 |
import java.awt.geom.Rectangle2D; |
26 |
import java.awt.image.BufferedImage; |
27 |
import java.util.ArrayList; |
28 |
import java.util.Iterator; |
29 |
|
30 |
import org.gvsig.georeferencing.utils.GeoPointPersistence; |
31 |
import org.gvsig.georeferencing.utils.PointManager; |
32 |
|
33 |
import com.iver.andami.PluginServices; |
34 |
import com.iver.cit.gvsig.fmap.DriverException; |
35 |
import com.iver.cit.gvsig.fmap.ViewPort; |
36 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
37 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
38 |
import com.iver.utiles.XMLEntity; |
39 |
import com.iver.utiles.swing.threads.Cancellable; |
40 |
|
41 |
|
42 |
/**
|
43 |
* Clase de capa de marcado de puntos sobre una vista. Dibuja un puntero sobre
|
44 |
* cada punto en la vista. Esta capa hereda de GraphicLayer que es una capa que est?
|
45 |
* metida de forma fija en FMap. Con esto conseguimos que nuestra capa de puntos
|
46 |
* no aparezca en el TOC y siempre se dibuje por encima de todas las capas. Tiene
|
47 |
* el inconveniente de que est? en FMap y si hacemos un dibujado de las capas
|
48 |
* sobre un panel que no sea la vista de gvSIG este GraphicLayer no aparece.
|
49 |
* Si queremos hacer este tipo de dibujados tendremos que dibujar todas las capas
|
50 |
* con el draw de FLayers y al final llamar al draw de FLyrPoints.
|
51 |
*
|
52 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
53 |
*/
|
54 |
public class FLyrPoints extends GraphicLayer { |
55 |
|
56 |
//**********************Params********************************
|
57 |
/**
|
58 |
* Diametro del centro de la cruz
|
59 |
*/
|
60 |
private final int DIAM_CIRCLE = 18; |
61 |
/**
|
62 |
* ?ltima herramienta seleccionada. Despu?s de marcar el segundo punto en la vista ser? la
|
63 |
* herramienta por defecto.
|
64 |
*/
|
65 |
private String lastTool = "zoomIn"; |
66 |
//**********************End Params****************************
|
67 |
|
68 |
//**********************Vars**********************************
|
69 |
private ArrayList pointList = new ArrayList(); |
70 |
private boolean showNumber = true; |
71 |
private FLyrPointsState state = null; |
72 |
private IPersistence geoPointPersistence = null; |
73 |
private FLyrGeoRaster lyrGeoRaster = null; |
74 |
public static boolean isDrawing = false; |
75 |
private PointManager pointManager = null; |
76 |
private boolean lyrVisible = true; |
77 |
private boolean lyrHideViewOnly = true; |
78 |
private Point2D[] transformPointList = null; |
79 |
private boolean withoutBlue = false; |
80 |
private boolean withoutRed = false; |
81 |
//**********************End Vars**********************************
|
82 |
|
83 |
//**********************Classes***********************************
|
84 |
/**
|
85 |
* Estado de la capa de puntos.
|
86 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
87 |
*/
|
88 |
public class FLyrPointsState{ |
89 |
public ArrayList pointList = new ArrayList(); |
90 |
public boolean showNumber = true; |
91 |
public String lastTool = "zoomIn"; |
92 |
} |
93 |
//**********************End Classes*******************************
|
94 |
|
95 |
//**********************Methods***********************************
|
96 |
/**
|
97 |
* Constructor
|
98 |
* @param flyGeoRaster
|
99 |
*/
|
100 |
public FLyrPoints(FLyrGeoRaster lyGeoRaster, IPersistence persistence){
|
101 |
this.lyrGeoRaster = lyGeoRaster;
|
102 |
geoPointPersistence = persistence; |
103 |
} |
104 |
|
105 |
/**
|
106 |
* Salva el estado actual de la capa de puntos. Podr? ser recuperado
|
107 |
* este ?ltimo estado salvado con la funci?n recoveryState
|
108 |
*
|
109 |
*/
|
110 |
public void saveState(){ |
111 |
if(state == null) |
112 |
state = new FLyrPointsState();
|
113 |
else
|
114 |
state.pointList.clear(); |
115 |
|
116 |
for(int i=0;i<this.length();i++) |
117 |
state.pointList.add(((GeoPoint)pointList.get(i)).cloneGeoPoint()); |
118 |
|
119 |
state.showNumber = showNumber; |
120 |
state.lastTool = lastTool; |
121 |
} |
122 |
|
123 |
/**
|
124 |
* Recupera el estado de la capa de puntos desde la ?ltima vez que se
|
125 |
* ejecut? la funci?n saveState. Si no hay ning?n estdo salvado es que
|
126 |
* al principio estaba la capa vacia por lo que reiniciamos la capa de puntos.
|
127 |
*/
|
128 |
public void recoveryState(){ |
129 |
if(state != null){ |
130 |
pointList.clear(); |
131 |
for(int i=0;i<state.pointList.size();i++) |
132 |
pointList.add(((GeoPoint)state.pointList.get(i)).cloneGeoPoint()); |
133 |
|
134 |
showNumber = state.showNumber; |
135 |
lastTool = state.lastTool; |
136 |
} |
137 |
} |
138 |
|
139 |
/**
|
140 |
* Asigna el array de puntos
|
141 |
* @param list
|
142 |
*/
|
143 |
public void setListPoint(ArrayList list){ |
144 |
pointList = list; |
145 |
} |
146 |
|
147 |
/**
|
148 |
* Dibujado de la capa de raster georeferenciado aplicando la
|
149 |
* transformaci?n del viewPort.
|
150 |
*/
|
151 |
public void draw(BufferedImage image, Graphics2D g, ViewPort vp, |
152 |
Cancellable cancel,double scale) throws DriverException { |
153 |
|
154 |
Point2D pto = null; |
155 |
|
156 |
if(lyrHideViewOnly && lyrVisible && lyrGeoRaster != null){ |
157 |
//vp = lyrGeoRaster.toImageCoord(vp);
|
158 |
synchronized (this) { |
159 |
for(int i=0; i<pointList.size();i++){ |
160 |
//Punto de la imagen
|
161 |
if(((GeoPoint)pointList.get(i)).active){
|
162 |
pto = ((GeoPoint)pointList.get(i)).pixelPoint; |
163 |
if(pto != null){ |
164 |
Point2D p = lyrGeoRaster.img2World(pto);
|
165 |
p = vp.fromMapPoint(p); |
166 |
drawPixelCrux(g, p, i); |
167 |
} |
168 |
|
169 |
//Punto de la vista
|
170 |
pto = ((GeoPoint)pointList.get(i)).mapPoint; |
171 |
if(pto != null){ |
172 |
Point2D p = null; |
173 |
p = vp.fromMapPoint(pto); |
174 |
drawMapCrux(g, p, i); |
175 |
} |
176 |
} |
177 |
} |
178 |
} |
179 |
} |
180 |
} |
181 |
|
182 |
/**
|
183 |
* Dibuja el gr?fico que corresponde a los puntos de coordenadas relativas a la imagen de origen
|
184 |
* @param g Graphics sobre el que se dibuja
|
185 |
* @param vp Viewport
|
186 |
* @param cancel
|
187 |
*/
|
188 |
public void drawPixelCrux(Graphics2D g, ViewPort vp, Cancellable cancel){ |
189 |
Point2D pto = null; |
190 |
if(lyrVisible && lyrGeoRaster != null){ |
191 |
for(int i=0; i<pointList.size();i++){ |
192 |
if(((GeoPoint)pointList.get(i)).active){
|
193 |
pto = ((GeoPoint)pointList.get(i)).pixelPoint; |
194 |
if(pto != null){ |
195 |
Point2D p = lyrGeoRaster.img2World(pto);
|
196 |
p = vp.fromMapPoint(p); |
197 |
drawPixelCrux(g, p, i); |
198 |
} |
199 |
} |
200 |
} |
201 |
} |
202 |
} |
203 |
|
204 |
/**
|
205 |
* Dibuja el gr?fico que corresponde a los puntos de coordenadas de mundo real.
|
206 |
* @param g Graphics sobre el que se dibuja
|
207 |
* @param vp Viewport
|
208 |
* @param cancel
|
209 |
*/
|
210 |
public void drawMapCrux(Graphics2D g, ViewPort vp, Cancellable cancel){ |
211 |
Point2D pto = null; |
212 |
if(lyrVisible && lyrGeoRaster != null){ |
213 |
for(int i=0; i<pointList.size();i++){ |
214 |
if(((GeoPoint)pointList.get(i)).active){
|
215 |
pto = ((GeoPoint)pointList.get(i)).mapPoint; |
216 |
if(pto != null){ |
217 |
Point2D p = null; |
218 |
p = vp.fromMapPoint(pto); |
219 |
drawMapCrux(g, p, i); |
220 |
} |
221 |
} |
222 |
} |
223 |
} |
224 |
} |
225 |
|
226 |
/**
|
227 |
* Dibuja sobre el graphics pasado la cruz del punto que marca
|
228 |
* el pixel de la imagen.
|
229 |
* @param g Graphics
|
230 |
*/
|
231 |
private void drawPixelCrux(Graphics2D g, Point2D p, int pointNumber){ |
232 |
int dpto = (DIAM_CIRCLE >> 1); |
233 |
int incr = 5; |
234 |
g.setColor(Color.WHITE);
|
235 |
g.drawOval( (int)p.getX() - dpto + 1, |
236 |
(int)p.getY() - dpto + 1, |
237 |
DIAM_CIRCLE - 2,
|
238 |
DIAM_CIRCLE - 2);
|
239 |
g.drawLine((int)p.getX() - incr, (int)p.getY() - 1, (int)p.getX() - 1, (int)p.getY() - 1); |
240 |
g.drawLine((int)p.getX() - incr, (int)p.getY() + 1, (int)p.getX() - 1, (int)p.getY() + 1); |
241 |
|
242 |
g.drawLine((int)p.getX() + incr, (int)p.getY() - 1, (int)p.getX() + 1, (int)p.getY() - 1); |
243 |
g.drawLine((int)p.getX() + incr, (int)p.getY() + 1, (int)p.getX() + 1, (int)p.getY() + 1); |
244 |
|
245 |
g.drawLine((int)p.getX() - 1, (int)p.getY() - incr, (int)p.getX() - 1, (int)p.getY() - 1); |
246 |
g.drawLine((int)p.getX() + 1, (int)p.getY() - incr, (int)p.getX() + 1, (int)p.getY() - 1); |
247 |
|
248 |
g.drawLine((int)p.getX() - 1, (int)p.getY() + incr, (int)p.getX() - 1, (int)p.getY() + 1); |
249 |
g.drawLine((int)p.getX() + 1, (int)p.getY() + incr, (int)p.getX() + 1, (int)p.getY() + 1); |
250 |
|
251 |
g.setColor(Color.red);
|
252 |
g.drawOval( (int)p.getX() - dpto,
|
253 |
(int)p.getY() - dpto,
|
254 |
DIAM_CIRCLE, |
255 |
DIAM_CIRCLE); |
256 |
g.drawLine((int)p.getX(), (int)p.getY() - dpto - incr, (int)p.getX(), (int)p.getY() + dpto + incr); |
257 |
g.drawLine((int)p.getX() - dpto - incr, (int)p.getY(), (int)p.getX() + dpto + incr, (int)p.getY()); |
258 |
|
259 |
if(showNumber){
|
260 |
String pt = String.valueOf(pointNumber + 1); |
261 |
int ptX = (int)(p.getX() + dpto + 1); |
262 |
int ptY = (int)(p.getY() + dpto - 1); |
263 |
g.setColor(Color.WHITE);
|
264 |
for (int i= -1; i<2; i++) |
265 |
for (int j= -1; j<2; j++) |
266 |
g.drawString(pt, ptX + i, ptY + j ); |
267 |
g.setColor(Color.red);
|
268 |
g.drawString(pt, ptX, ptY ); |
269 |
} |
270 |
} |
271 |
|
272 |
/**
|
273 |
* Dibuja sobre el graphics pasado la cruz del punto que marca
|
274 |
* la coordenada de la vista.
|
275 |
* @param g Graphics
|
276 |
*/
|
277 |
private void drawMapCrux(Graphics2D g, Point2D p, int pointNumber){ |
278 |
int dpto = (DIAM_CIRCLE >> 1); |
279 |
int incr = 5; |
280 |
g.setColor(Color.WHITE);
|
281 |
g.drawRect( (int)p.getX() - dpto + 1, |
282 |
(int)p.getY() - dpto + 1, |
283 |
DIAM_CIRCLE - 2,
|
284 |
DIAM_CIRCLE - 2);
|
285 |
g.drawLine((int)p.getX() - incr, (int)p.getY() - 1, (int)p.getX() - 1, (int)p.getY() - 1); |
286 |
g.drawLine((int)p.getX() - incr, (int)p.getY() + 1, (int)p.getX() - 1, (int)p.getY() + 1); |
287 |
|
288 |
g.drawLine((int)p.getX() + incr, (int)p.getY() - 1, (int)p.getX() + 1, (int)p.getY() - 1); |
289 |
g.drawLine((int)p.getX() + incr, (int)p.getY() + 1, (int)p.getX() + 1, (int)p.getY() + 1); |
290 |
|
291 |
g.drawLine((int)p.getX() - 1, (int)p.getY() - incr, (int)p.getX() - 1, (int)p.getY() - 1); |
292 |
g.drawLine((int)p.getX() + 1, (int)p.getY() - incr, (int)p.getX() + 1, (int)p.getY() - 1); |
293 |
|
294 |
g.drawLine((int)p.getX() - 1, (int)p.getY() + incr, (int)p.getX() - 1, (int)p.getY() + 1); |
295 |
g.drawLine((int)p.getX() + 1, (int)p.getY() + incr, (int)p.getX() + 1, (int)p.getY() + 1); |
296 |
|
297 |
g.setColor(new Color(45, 8 , 165)); |
298 |
g.drawRect( (int)p.getX() - dpto,
|
299 |
(int)p.getY() - dpto,
|
300 |
DIAM_CIRCLE, |
301 |
DIAM_CIRCLE); |
302 |
g.drawLine((int)p.getX(), (int)p.getY() - dpto - incr, (int)p.getX(), (int)p.getY() + dpto + incr); |
303 |
g.drawLine((int)p.getX() - dpto - incr, (int)p.getY(), (int)p.getX() + dpto + incr, (int)p.getY()); |
304 |
if(showNumber){
|
305 |
String pt = String.valueOf(pointNumber + 1); |
306 |
int ptX = (int)(p.getX() + dpto + 1); |
307 |
int ptY = (int)(p.getY() - dpto - 1); |
308 |
g.setColor(Color.WHITE);
|
309 |
for (int i= -1; i<2; i++) |
310 |
for (int j= -1; j<2; j++) |
311 |
g.drawString(pt, ptX + i, ptY + j ); |
312 |
g.setColor(new Color(45, 8 , 165)); |
313 |
g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 1), (int)(p.getY() - dpto - 1) ); |
314 |
} |
315 |
} |
316 |
|
317 |
/* (non-Javadoc)
|
318 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.cit.gvsig.fmap.operations.Cancellable, double)
|
319 |
*/
|
320 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
321 |
double scale) throws DriverException { |
322 |
|
323 |
} |
324 |
|
325 |
/**
|
326 |
* Elimina los puntos de la lista que no tiene las dos coordenadas asignadas.
|
327 |
*/
|
328 |
public void clean(){ |
329 |
Iterator iter = pointList.iterator();
|
330 |
while (iter.hasNext()) {
|
331 |
GeoPoint gp = (GeoPoint) iter.next(); |
332 |
if(gp.mapPoint == null || gp.pixelPoint == null) |
333 |
iter.remove(); |
334 |
} |
335 |
} |
336 |
/**
|
337 |
* A?ade un punto a la lista
|
338 |
* @param point punto para la lista
|
339 |
*/
|
340 |
public GeoPoint addPoint(Point2D pixel, Point2D map){ |
341 |
GeoPoint p = new GeoPoint(pixel, map);
|
342 |
pointList.add(p); |
343 |
return p;
|
344 |
} |
345 |
|
346 |
/**
|
347 |
* Obtiene el punto de la posici?n pos
|
348 |
*/
|
349 |
public GeoPoint getPoint(int pos){ |
350 |
try{
|
351 |
return (GeoPoint)pointList.get(pos);
|
352 |
}catch(IndexOutOfBoundsException exc){ |
353 |
return null; |
354 |
} |
355 |
} |
356 |
|
357 |
/**
|
358 |
* Elimina la lista de puntos almacenada
|
359 |
*/
|
360 |
public void clear(){ |
361 |
pointList = new ArrayList(); |
362 |
} |
363 |
|
364 |
/**
|
365 |
* Elimina el punto de la posici?n indicada por el par?metro pos
|
366 |
* @param pos Posici?n del punto a eliminar
|
367 |
*/
|
368 |
public void remove(int pos){ |
369 |
pointList.remove(pos); |
370 |
} |
371 |
|
372 |
/**
|
373 |
*Elimina el ?ltimo punto de la lista.
|
374 |
*/
|
375 |
public void delLastPoint(){ |
376 |
pointList.remove(pointList.size() - 1);
|
377 |
} |
378 |
|
379 |
/**
|
380 |
* Funci?n que obtiene si un punto es nuevo o no. Un punto es nuevo si todavia
|
381 |
* no han sido asignadas todas sus coordenadas.
|
382 |
* @param n N?mero de punto a obtener si es nuevo
|
383 |
* @return true si es nuevo o false si no lo es
|
384 |
*/
|
385 |
public boolean isNewPoint(int n){ |
386 |
if(this.getPoint(n) == null) |
387 |
return false; |
388 |
if(this.getPoint(n).pixelPoint == null || this.getPoint(n).mapPoint == null) |
389 |
return true; |
390 |
return false; |
391 |
} |
392 |
|
393 |
/**
|
394 |
* Devuelve el n?mero de puntos de la capa
|
395 |
* @return entero que representa el n?mero de puntos de la capa
|
396 |
*/
|
397 |
public int length(){ |
398 |
return pointList.size();
|
399 |
} |
400 |
|
401 |
/**
|
402 |
* Actualiza un punto de la lista de una posici?n determinada
|
403 |
* @param point punto para la lista
|
404 |
*/
|
405 |
public void updatePoint(Point2D pixel, Point2D map, int pos){ |
406 |
GeoPoint gp = (GeoPoint)pointList.get(pos); |
407 |
if(pixel != null) |
408 |
gp.pixelPoint = pixel; |
409 |
if(map != null) |
410 |
gp.mapPoint = map; |
411 |
} |
412 |
|
413 |
/**
|
414 |
* Calcula el RMS para el punto de la posici?n pos
|
415 |
* @param pos Posici?n
|
416 |
* @return valor RMS para el punto solicitado
|
417 |
*/
|
418 |
public double calcDoubleRMS(int pos){ |
419 |
if(getPoint(pos).active && transformPointList != null && getPoint(pos).mapPoint != null){ |
420 |
try{
|
421 |
double a = (transformPointList[pos].getX() - getPoint(pos).mapPoint.getX());
|
422 |
double b = (transformPointList[pos].getY() - getPoint(pos).mapPoint.getY());
|
423 |
return Math.sqrt(a*a + b*b); |
424 |
}catch(ArrayIndexOutOfBoundsException e){ |
425 |
//No hacemos nada pq ha intentado obtener un punto que no existe. Hace un return 0
|
426 |
}catch(NullPointerException e){ |
427 |
//No hacemos nada pq el punto a?n no est? completo y est? intentando obtener un valor que no existe.Hace un return 0
|
428 |
} |
429 |
} |
430 |
return -0D; |
431 |
} |
432 |
|
433 |
/**
|
434 |
* Calcula el RMS para el punto de la posici?n pos
|
435 |
* @param pos Posici?n
|
436 |
* @return RMS en forma de String
|
437 |
*/
|
438 |
public String calcRMS(int pos){ |
439 |
return String.valueOf(calcDoubleRMS(pos)); |
440 |
} |
441 |
|
442 |
/**
|
443 |
* Calcula el residuo en X para el punto de la posici?n pos
|
444 |
* @param pos Posici?n
|
445 |
* @return residuo Y en forma de double
|
446 |
*/
|
447 |
public double calcDoubleResX(int pos){ |
448 |
if( getPoint(pos).active &&
|
449 |
transformPointList != null &&
|
450 |
transformPointList[pos] != null &&
|
451 |
getPoint(pos).mapPoint != null){
|
452 |
try{
|
453 |
double a = (transformPointList[pos].getX() - getPoint(pos).mapPoint.getX());
|
454 |
return Math.sqrt(a*a); |
455 |
}catch(ArrayIndexOutOfBoundsException e){ |
456 |
//No hacemos nada pq ha intentado obtener un punto que no existe. Hace un return 0
|
457 |
}catch(NullPointerException e){ |
458 |
//No hacemos nada pq el punto a?n no est? completo y est? intentando obtener un valor que no existe.Hace un return 0
|
459 |
} |
460 |
} |
461 |
return -0; |
462 |
} |
463 |
|
464 |
/**
|
465 |
* Calcula el residuo en X para el punto de la posici?n pos
|
466 |
* @param pos Posici?n
|
467 |
* @return residuo Y en forma de String
|
468 |
*/
|
469 |
public String calcResX(int pos){ |
470 |
return String.valueOf(calcDoubleResX(pos)); |
471 |
} |
472 |
|
473 |
/**
|
474 |
* Calcula el residuo en Y para el punto de la posici?n pos
|
475 |
* @param pos Posici?n
|
476 |
* @return residuo Y en forma de double
|
477 |
*/
|
478 |
public double calcDoubleResY(int pos){ |
479 |
if( getPoint(pos).active &&
|
480 |
transformPointList != null &&
|
481 |
transformPointList[pos] != null &&
|
482 |
getPoint(pos).mapPoint != null){
|
483 |
try{
|
484 |
double b = (transformPointList[pos].getY() - getPoint(pos).mapPoint.getY());
|
485 |
return Math.sqrt(b*b); |
486 |
}catch(ArrayIndexOutOfBoundsException e){ |
487 |
//No hacemos nada pq ha intentado obtener un punto que no existe. Hace un return 0
|
488 |
}catch(NullPointerException e){ |
489 |
//No hacemos nada pq el punto a?n no est? completo y est? intentando obtener un valor que no existe.Hace un return 0
|
490 |
} |
491 |
} |
492 |
return -0D; |
493 |
} |
494 |
|
495 |
/**
|
496 |
* Calcula el residuo en Y para el punto de la posici?n pos
|
497 |
* @param pos Posici?n
|
498 |
* @return residuo Y en forma de String
|
499 |
*/
|
500 |
public String calcResY(int pos){ |
501 |
return String.valueOf(calcDoubleResY(pos)); |
502 |
} |
503 |
|
504 |
/**
|
505 |
* Calcula el error RMS para todos los puntos
|
506 |
* @return Error RMS total en forma de String
|
507 |
*/
|
508 |
public double calcDoubleTotal(){ |
509 |
double add = 0D; |
510 |
int len = 0; |
511 |
try{
|
512 |
for(int i=0;i<transformPointList.length;i++){ |
513 |
add += calcDoubleRMS(i); |
514 |
if(getPoint(i).active)
|
515 |
len ++; |
516 |
} |
517 |
}catch(NullPointerException e){ |
518 |
//transformPointList es null por lo que no hay puntos a transformar devolviendo 0.
|
519 |
return 0D; |
520 |
} |
521 |
return Math.sqrt(add/len); |
522 |
} |
523 |
|
524 |
/**
|
525 |
* Calcula el error RMS para todos los puntos
|
526 |
* @return Error RMS total en forma de String
|
527 |
*/
|
528 |
public String calcTotal(){ |
529 |
return String.valueOf(calcDoubleTotal()); |
530 |
} |
531 |
|
532 |
/**
|
533 |
* Muestra en consola los puntos de la capa
|
534 |
*/
|
535 |
public void showPoints(){ |
536 |
for(int i=0;i<pointList.size();i++) |
537 |
((GeoPoint)pointList.get(i)).show(); |
538 |
} |
539 |
|
540 |
/**
|
541 |
* Salva la lista de puntos sobre el fichero que se la pasa por
|
542 |
* par?metro
|
543 |
* @param file Nombre del fichero
|
544 |
*/
|
545 |
public void PointList2XML(String file){; |
546 |
geoPointPersistence.savePointList(file); |
547 |
} |
548 |
|
549 |
/**
|
550 |
* Recupera una lista de puntos desde un fichero XML
|
551 |
* @param file Nombre del fichero
|
552 |
*/
|
553 |
public void XML2PointList(String file){ |
554 |
geoPointPersistence.loadPointList(file); |
555 |
} |
556 |
|
557 |
/**
|
558 |
* Salva la lista de puntos en forma tabular sobre el fichero que se la pasa por
|
559 |
* par?metro
|
560 |
* @param file Nombre del fichero
|
561 |
*/
|
562 |
public void PointList2CSV(String file){; |
563 |
geoPointPersistence.saveCSVPointList(file); |
564 |
} |
565 |
|
566 |
/**
|
567 |
* Recupera la lista de puntos desde un fichero CSV
|
568 |
* @param file Nombre del fichero
|
569 |
*/
|
570 |
public void PointListFromCSV(String file){; |
571 |
geoPointPersistence.loadCSVPointList(file); |
572 |
} |
573 |
|
574 |
/* (non-Javadoc)
|
575 |
* @see com.iver.cit.gvsig.fmap.layers.StatusRasterInterface#setXMLEntity(com.iver.utiles.XMLEntity)
|
576 |
*/
|
577 |
public void setXMLEntity(XMLEntity xml)throws XMLException { |
578 |
int nPoints = -1; |
579 |
if (xml.contains("raster.geoPoints.nPoints")) { |
580 |
nPoints = xml.getIntProperty("raster.geoPoints.nPoints");
|
581 |
GeoPoint point = null;
|
582 |
Point2D pixel = new Point2D.Double(), map = new Point2D.Double(); |
583 |
if(nPoints > 0){ |
584 |
|
585 |
for(int i = 0;i<nPoints;i++){ |
586 |
|
587 |
if (xml.contains("raster.geoPoint."+i+".pixelX") && xml.contains("raster.geoPoint."+i+".pixelY")) |
588 |
pixel.setLocation(xml.getDoubleProperty("raster.geoPoint."+i+".pixelX"), xml.getDoubleProperty("raster.geoPoint."+i+".pixelY")); |
589 |
|
590 |
if (xml.contains("raster.geoPoint."+i+".mapX") && xml.contains("raster.geoPoint."+i+".mapY")) |
591 |
map.setLocation(xml.getDoubleProperty("raster.geoPoint."+i+".mapX"), xml.getDoubleProperty("raster.geoPoint."+i+".mapY")); |
592 |
|
593 |
point = this.addPoint(pixel, map);
|
594 |
|
595 |
if (xml.contains("raster.geoPoint."+i+".active")) |
596 |
point.active = xml.getBooleanProperty("raster.geoPoint."+i+".active"); |
597 |
|
598 |
point.leftCenterPoint = new Point2D.Double(); |
599 |
if (xml.contains("raster.geoPoint."+i+".leftCenterX") && xml.contains("raster.geoPoint."+i+".leftCenterY")) |
600 |
point.leftCenterPoint.setLocation(xml.getDoubleProperty("raster.geoPoint."+i+".leftCenterX"), xml.getDoubleProperty("raster.geoPoint."+i+".leftCenterY")); |
601 |
|
602 |
point.rightCenterPoint = new Point2D.Double(); |
603 |
if (xml.contains("raster.geoPoint."+i+".rightCenterX") && xml.contains("raster.geoPoint."+i+".rightCenterY")) |
604 |
point.rightCenterPoint.setLocation(xml.getDoubleProperty("raster.geoPoint."+i+".rightCenterX"), xml.getDoubleProperty("raster.geoPoint."+i+".rightCenterY")); |
605 |
|
606 |
point.leftViewPort = new ViewPort(null); |
607 |
point.rightViewPort = new ViewPort(null); |
608 |
|
609 |
double x = 0D, y = 0D, w = 0D, h = 0D; |
610 |
int width = 0, height = 0; |
611 |
Rectangle2D r = new Rectangle2D.Double(); |
612 |
if (xml.contains("raster.geoPoint."+i+".leftViewPort.proj")) |
613 |
point.leftViewPort.setProjection(CRSFactory.getCRS(xml.getStringProperty("raster.geoPoint."+i+".leftViewPort.proj"))); |
614 |
if (xml.contains("raster.geoPoint."+i+".leftViewPort.x")) |
615 |
x = xml.getDoubleProperty("raster.geoPoint."+i+".leftViewPort.x"); |
616 |
if (xml.contains("raster.geoPoint."+i+".leftViewPort.y")) |
617 |
y = xml.getDoubleProperty("raster.geoPoint."+i+".leftViewPort.y"); |
618 |
if (xml.contains("raster.geoPoint."+i+".leftViewPort.w")) |
619 |
w = xml.getDoubleProperty("raster.geoPoint."+i+".leftViewPort.w"); |
620 |
if (xml.contains("raster.geoPoint."+i+".leftViewPort.h")) |
621 |
h = xml.getDoubleProperty("raster.geoPoint."+i+".leftViewPort.h"); |
622 |
r.setRect(x, y, w, h); |
623 |
point.leftViewPort.setExtent(r); |
624 |
if (xml.contains("raster.geoPoint."+i+".leftViewPort.imgWidth")) |
625 |
width = xml.getIntProperty("raster.geoPoint."+i+".leftViewPort.imgWidth"); |
626 |
if (xml.contains("raster.geoPoint."+i+".leftViewPort.imgHeight")) |
627 |
height = xml.getIntProperty("raster.geoPoint."+i+".leftViewPort.imgHeight"); |
628 |
point.leftViewPort.setImageSize(new Dimension(width, height)); |
629 |
|
630 |
r = new Rectangle2D.Double(); |
631 |
if (xml.contains("raster.geoPoint."+i+".rightViewPort.proj")) |
632 |
point.rightViewPort.setProjection(CRSFactory.getCRS(xml.getStringProperty("raster.geoPoint."+i+".rightViewPort.proj"))); |
633 |
if (xml.contains("raster.geoPoint."+i+".rightViewPort.x")) |
634 |
x = xml.getDoubleProperty("raster.geoPoint."+i+".rightViewPort.x"); |
635 |
if (xml.contains("raster.geoPoint."+i+".rightViewPort.y")) |
636 |
y = xml.getDoubleProperty("raster.geoPoint."+i+".rightViewPort.y"); |
637 |
if (xml.contains("raster.geoPoint."+i+".rightViewPort.w")) |
638 |
w = xml.getDoubleProperty("raster.geoPoint."+i+".rightViewPort.w"); |
639 |
if (xml.contains("raster.geoPoint."+i+".rightViewPort.h")) |
640 |
h = xml.getDoubleProperty("raster.geoPoint."+i+".rightViewPort.h"); |
641 |
r.setRect(x, y, w, h); |
642 |
point.rightViewPort.setExtent(r); |
643 |
if (xml.contains("raster.geoPoint."+i+".rightViewPort.imgWidth")) |
644 |
width = xml.getIntProperty("raster.geoPoint."+i+".rightViewPort.imgWidth"); |
645 |
if (xml.contains("raster.geoPoint."+i+".rightViewPort.imgHeight")) |
646 |
height = xml.getIntProperty("raster.geoPoint."+i+".rightViewPort.imgHeight"); |
647 |
point.rightViewPort.setImageSize(new Dimension(width, height)); |
648 |
|
649 |
} |
650 |
} |
651 |
} |
652 |
} |
653 |
|
654 |
/* (non-Javadoc)
|
655 |
* @see com.iver.cit.gvsig.fmap.layers.StatusRasterInterface#getXMLEntity(com.iver.utiles.XMLEntity)
|
656 |
*/
|
657 |
public void getXMLEntity(XMLEntity xml) throws XMLException { |
658 |
xml.putProperty("raster.geoPoints.nPoints", getCountPoints());
|
659 |
for(int i=0;i<this.getCountPoints();i++){ |
660 |
xml.putProperty("raster.geoPoint."+i+".pixelX", getPoint(i).pixelPoint.getX()); |
661 |
xml.putProperty("raster.geoPoint."+i+".pixelY", getPoint(i).pixelPoint.getY()); |
662 |
xml.putProperty("raster.geoPoint."+i+".mapX", getPoint(i).mapPoint.getX()); |
663 |
xml.putProperty("raster.geoPoint."+i+".mapY", getPoint(i).mapPoint.getX()); |
664 |
|
665 |
xml.putProperty("raster.geoPoint."+i+".active", getPoint(i).active); |
666 |
|
667 |
xml.putProperty("raster.geoPoint."+i+".leftCenterX", getPoint(i).leftCenterPoint.getX()); |
668 |
xml.putProperty("raster.geoPoint."+i+".leftCenterY", getPoint(i).leftCenterPoint.getY()); |
669 |
xml.putProperty("raster.geoPoint."+i+".rightCenterX", getPoint(i).rightCenterPoint.getX()); |
670 |
xml.putProperty("raster.geoPoint."+i+".rightCenterY", getPoint(i).rightCenterPoint.getY()); |
671 |
|
672 |
xml.putProperty("raster.geoPoint."+i+".leftViewPort.proj", getPoint(i).leftViewPort.getProjection().getAbrev()); |
673 |
xml.putProperty("raster.geoPoint."+i+".leftViewPort.x", getPoint(i).leftViewPort.getExtent().getX()); |
674 |
xml.putProperty("raster.geoPoint."+i+".leftViewPort.y", getPoint(i).leftViewPort.getExtent().getY()); |
675 |
xml.putProperty("raster.geoPoint."+i+".leftViewPort.w", getPoint(i).leftViewPort.getExtent().getWidth()); |
676 |
xml.putProperty("raster.geoPoint."+i+".leftViewPort.h", getPoint(i).leftViewPort.getExtent().getHeight()); |
677 |
xml.putProperty("raster.geoPoint."+i+".leftViewPort.imgWidth", getPoint(i).leftViewPort.getImageWidth()); |
678 |
xml.putProperty("raster.geoPoint."+i+".leftViewPort.imgHeight", getPoint(i).leftViewPort.getImageHeight()); |
679 |
|
680 |
xml.putProperty("raster.geoPoint."+i+".rightViewPort.proj", getPoint(i).rightViewPort.getProjection().getAbrev()); |
681 |
xml.putProperty("raster.geoPoint."+i+".rightViewPort.x", getPoint(i).rightViewPort.getExtent().getX()); |
682 |
xml.putProperty("raster.geoPoint."+i+".rightViewPort.y", getPoint(i).rightViewPort.getExtent().getY()); |
683 |
xml.putProperty("raster.geoPoint."+i+".rightViewPort.w", getPoint(i).rightViewPort.getExtent().getWidth()); |
684 |
xml.putProperty("raster.geoPoint."+i+".rightViewPort.h", getPoint(i).rightViewPort.getExtent().getHeight()); |
685 |
xml.putProperty("raster.geoPoint."+i+".rightViewPort.imgWidth", getPoint(i).rightViewPort.getImageWidth()); |
686 |
xml.putProperty("raster.geoPoint."+i+".rightViewPort.imgHeight", getPoint(i).rightViewPort.getImageHeight()); |
687 |
} |
688 |
} |
689 |
//**********************End Methods********************************
|
690 |
|
691 |
//**********************Setters & Getters**************************
|
692 |
/**
|
693 |
* Asigna el viewPort de la mini imagen de la derecha en
|
694 |
* el punto de la posici?n que se le pasa por par?metro
|
695 |
* @param pos Posici?n del punto
|
696 |
* @param vp ViewPort asignado
|
697 |
*/
|
698 |
public void setRightViewPort(int pos, ViewPort vp){ |
699 |
getPoint(pos).rightViewPort = vp; |
700 |
} |
701 |
/**
|
702 |
* @return Returns the showNumber.
|
703 |
*/
|
704 |
public boolean isShowNumber() { |
705 |
return showNumber;
|
706 |
} |
707 |
|
708 |
/**
|
709 |
* @param showNumber The showNumber to set.
|
710 |
*/
|
711 |
public void setShowNumber(boolean showNumber) { |
712 |
this.showNumber = showNumber;
|
713 |
} |
714 |
|
715 |
/**
|
716 |
* Asigna el punto central de la mini imagen de la izquierda
|
717 |
* en el punto de la posici?n que se le pasa por par?metro
|
718 |
* @param pos Posici?n del punto
|
719 |
* @param p Punto asignado
|
720 |
*/
|
721 |
public void setLeftCenterPoint(int pos, Point2D p){ |
722 |
try{
|
723 |
getPoint(pos).leftCenterPoint = p; |
724 |
}catch(NullPointerException ex){ |
725 |
//Si getPoint devuelve null es que hemos intentado acceder a una posici?n que no
|
726 |
//existe por lo que no asignamos ningun valor.
|
727 |
} |
728 |
} |
729 |
|
730 |
/**
|
731 |
* Asigna el punto central de la mini imagen de la derecha
|
732 |
* en el punto de la posici?n que se le pasa por par?metro
|
733 |
* @param pos Posici?n del punto
|
734 |
* @param p Punto asignado
|
735 |
*/
|
736 |
public void setRightCenterPoint(int pos, Point2D p){ |
737 |
try{
|
738 |
getPoint(pos).rightCenterPoint = p; |
739 |
}catch(NullPointerException ex){ |
740 |
//Si getPoint devuelve null es que hemos intentado acceder a una posici?n que no
|
741 |
//existe por lo que no asignamos ningun valor.
|
742 |
} |
743 |
} |
744 |
|
745 |
/**
|
746 |
* Asigna el viewPort de la mini imagen de la izquierda en
|
747 |
* el punto de la posici?n que se le pasa por par?metro
|
748 |
* @param pos Posici?n del punto
|
749 |
* @param vp ViewPort asignado
|
750 |
*/
|
751 |
public void setLeftViewPort(int pos, ViewPort vp){ |
752 |
try{
|
753 |
getPoint(pos).leftViewPort = vp; |
754 |
}catch(NullPointerException ex){ |
755 |
//Si getPoint devuelve null es que hemos intentado acceder a una posici?n que no
|
756 |
//existe por lo que no asignamos ningun valor.
|
757 |
} |
758 |
} |
759 |
|
760 |
/**
|
761 |
* Asigna el zoom al punto de una posici?n. Este zoom es el que corresponde
|
762 |
* a la miniimagen de la izquierda, es decir la que tiene las coordenadas en pixeles.
|
763 |
* @param pos Posici?n del punto a asignar el zoom
|
764 |
* @param zoom Zoom a asignar.
|
765 |
*/
|
766 |
public void setZoomLeft(int pos, double zoom){ |
767 |
try{
|
768 |
getPoint(pos).zoomLeft = zoom; |
769 |
}catch(NullPointerException ex){ |
770 |
//Si getPoint devuelve null es que hemos intentado acceder a una posici?n que no
|
771 |
//existe por lo que no asignamos ningun valor.
|
772 |
} |
773 |
} |
774 |
|
775 |
/**
|
776 |
* Asigna el zoom al punto de una posici?n. Este zoom es el que corresponde
|
777 |
* a la miniimagen de la derecha, es decir la que tiene las coordenadas relativas
|
778 |
* al mundo real.
|
779 |
* @param pos Posici?n del punto a asignar el zoom
|
780 |
* @param zoom Zoom a asignar.
|
781 |
*/
|
782 |
public void setZoomRight(int pos, double zoom){ |
783 |
try{
|
784 |
getPoint(pos).zoomRight = zoom; |
785 |
}catch(NullPointerException ex){ |
786 |
//Si getPoint devuelve null es que hemos intentado acceder a una posici?n que no
|
787 |
//existe por lo que no asignamos ningun valor.
|
788 |
} |
789 |
} |
790 |
|
791 |
/**
|
792 |
* Obtiene el zoom de un punto y posici?n. Este zoom es el que corresponde
|
793 |
* a la miniimagen de la izquierda, es decir la que tiene las coordenadas en pixeles.
|
794 |
* @param pos Posici?n del punto a asignar el zoom
|
795 |
* @return Zoom a asignado.
|
796 |
*/
|
797 |
public double getZoomLeft(int pos){ |
798 |
try{
|
799 |
return getPoint(pos).zoomLeft;
|
800 |
}catch(NullPointerException ex){ |
801 |
//Si getPoint devuelve null es que hemos intentado acceder a una posici?n que no
|
802 |
//existe por lo que devolvemos un zoom de 1.0.
|
803 |
return 1.0; |
804 |
} |
805 |
} |
806 |
|
807 |
/**
|
808 |
* Obtiene el zoom de un punto y posici?n. Este zoom es el que corresponde
|
809 |
* a la miniimagen de la derecha, es decir la que tiene las coordenadas relativas
|
810 |
* al mundo real.
|
811 |
* @param pos Posici?n del punto a asignar el zoom
|
812 |
* @return Zoom a asignado.
|
813 |
*/
|
814 |
public double getZoomRight(int pos){ |
815 |
try{
|
816 |
return getPoint(pos).zoomRight;
|
817 |
}catch(NullPointerException ex){ |
818 |
//Si getPoint devuelve null es que hemos intentado acceder a una posici?n que no
|
819 |
//existe por lo que devolvemos un zoom de 1.0.
|
820 |
return 1.0; |
821 |
} |
822 |
} |
823 |
|
824 |
/**
|
825 |
* Devuelve el n?mero de puntos de la lista
|
826 |
* @return entero que representa el n?mero de puntos
|
827 |
*/
|
828 |
public int getCountPoints(){ |
829 |
if(pointList != null) |
830 |
return pointList.size();
|
831 |
else
|
832 |
return 0; |
833 |
} |
834 |
|
835 |
/**
|
836 |
* Devuelve el n?mero de puntos de la lista que est?n activos
|
837 |
* @return entero que representa el n?mero de puntos
|
838 |
*/
|
839 |
public int getCountActivePoints(){ |
840 |
int activePoints = 0; |
841 |
if(pointList != null){ |
842 |
for(int i = 0; i< pointList.size(); i++) |
843 |
if(getPoint(i).active)
|
844 |
activePoints ++; |
845 |
return activePoints;
|
846 |
}else
|
847 |
return 0; |
848 |
} |
849 |
|
850 |
/**
|
851 |
* Activa o desactiva el punto de una posici?n de la lista
|
852 |
* @param n N?mero de punto
|
853 |
* @param active true activo, false desactivo
|
854 |
*/
|
855 |
public void setPointActive(int n, boolean active){ |
856 |
if(n < 0 || n >= this.length()) |
857 |
return;
|
858 |
((GeoPoint)pointList.get(n)).active = active; |
859 |
} |
860 |
|
861 |
/**
|
862 |
* Dice si un punto de la lista est? activo o no
|
863 |
* @param n Posici?n del punto
|
864 |
* @return true si est? activo y false si no lo est?.
|
865 |
*/
|
866 |
public boolean isPointActive(int n){ |
867 |
if(n < 0 || n >= this.length()) |
868 |
return false; |
869 |
return ((GeoPoint)pointList.get(n)).active;
|
870 |
} |
871 |
|
872 |
/**
|
873 |
* Obtiene el extent de la capa
|
874 |
* @return extent en Rectangle2D.
|
875 |
*/
|
876 |
public Rectangle2D getFullExtent()throws DriverException { |
877 |
View theView = (View) PluginServices.getMDIManager().getActiveWindow(); |
878 |
return theView.getMapControl().getMapContext().getViewPort().getExtent();
|
879 |
} |
880 |
|
881 |
/**
|
882 |
* @return Returns the lastTool.
|
883 |
*/
|
884 |
public String getLastTool() { |
885 |
return lastTool;
|
886 |
} |
887 |
|
888 |
/**
|
889 |
* @param lastTool The lastTool to set.
|
890 |
*/
|
891 |
public void setLastTool(String lastTool) { |
892 |
this.lastTool = lastTool;
|
893 |
} |
894 |
|
895 |
/**
|
896 |
*Asigna el extent para las mini imagenes. Estas deben ser recuperadas cuando se selecciona
|
897 |
*un punto
|
898 |
*/
|
899 |
public void setMiniExtent(int nPoint, Point2D centerPoint, ViewPort vp, boolean isRight){ |
900 |
ViewPort viewPortBlock = new ViewPort(vp.getProjection());
|
901 |
viewPortBlock.setExtent(vp.getExtent()); |
902 |
viewPortBlock.setImageSize(vp.getImageSize()); |
903 |
viewPortBlock.refreshExtent(); |
904 |
|
905 |
if(isRight){
|
906 |
((GeoPoint)pointList.get(nPoint)).rightCenterPoint = (Point2D)centerPoint.clone();
|
907 |
((GeoPoint)pointList.get(nPoint)).rightViewPort = viewPortBlock; |
908 |
}else{
|
909 |
((GeoPoint)pointList.get(nPoint)).leftCenterPoint = (Point2D)centerPoint;
|
910 |
((GeoPoint)pointList.get(nPoint)).leftViewPort = viewPortBlock; |
911 |
} |
912 |
} |
913 |
|
914 |
/**
|
915 |
* Obtiene el extent de la mini imagen
|
916 |
* @param nPoint Punto de la lista
|
917 |
* @return
|
918 |
*/
|
919 |
public ViewPort getMiniExtent(int nPoint, boolean isRight){ |
920 |
if(isRight)
|
921 |
return ((GeoPoint)pointList.get(nPoint)).rightViewPort;
|
922 |
else
|
923 |
return ((GeoPoint)pointList.get(nPoint)).leftViewPort;
|
924 |
} |
925 |
|
926 |
/**
|
927 |
* Obtiene el punto central de la mini imagen
|
928 |
* @param nPoint Punto de la lista
|
929 |
* @return
|
930 |
*/
|
931 |
public Point2D getCenterPoint(int nPoint, boolean isRight){ |
932 |
if(isRight)
|
933 |
return ((GeoPoint)pointList.get(nPoint)).rightCenterPoint;
|
934 |
else
|
935 |
return ((GeoPoint)pointList.get(nPoint)).leftCenterPoint;
|
936 |
} |
937 |
|
938 |
/**
|
939 |
* Obtiene le ?ltimo punto de la lista
|
940 |
* @return El ?ltimo punto georreferenciado de la lista
|
941 |
*/
|
942 |
public GeoPoint getLastPoint(){
|
943 |
return (GeoPoint)pointList.get(pointList.size());
|
944 |
} |
945 |
|
946 |
/**
|
947 |
* Obtiene el array de puntos
|
948 |
* @return
|
949 |
*/
|
950 |
public ArrayList getListPoint(){ |
951 |
return pointList;
|
952 |
} |
953 |
|
954 |
/**
|
955 |
* Obtiene el gestor de puntos
|
956 |
* @return PointManager
|
957 |
*/
|
958 |
public PointManager getPointManager() {
|
959 |
return pointManager;
|
960 |
} |
961 |
|
962 |
/**
|
963 |
* Asigna el gestor de puntos
|
964 |
* @param PointManager
|
965 |
*/
|
966 |
public void setPointManager(PointManager pointManager) { |
967 |
this.pointManager = pointManager;
|
968 |
} |
969 |
|
970 |
/**
|
971 |
* Obtiene la capa de la imagen a georreferenciar
|
972 |
* @return FLyrGeoRaster
|
973 |
*/
|
974 |
public FLyrGeoRaster getLyrGeoRaster() {
|
975 |
return lyrGeoRaster;
|
976 |
} |
977 |
|
978 |
/**
|
979 |
* Asigna la capa de la imagen a georreferenciar
|
980 |
* @param flyGeoRaster
|
981 |
*/
|
982 |
public void setLyrGeoRaster(FLyrGeoRaster lyGeoRaster){ |
983 |
this.lyrGeoRaster = lyGeoRaster;
|
984 |
if(geoPointPersistence == null) |
985 |
geoPointPersistence = new GeoPointPersistence(this); |
986 |
} |
987 |
|
988 |
/**
|
989 |
* Asigna el flag de visibilidad a true o false. Si est? a true la capa
|
990 |
* es visible normalmente y si est? a false no se mostrar?
|
991 |
* @param visible flag de visibilidad
|
992 |
*/
|
993 |
public void setVisible(boolean visible){ |
994 |
this.lyrVisible = visible;
|
995 |
} |
996 |
|
997 |
/**
|
998 |
* Obtiene el flag de visibilidad true o false. Si est? a true la capa
|
999 |
* es visible normalmente y si est? a false no se muestra
|
1000 |
* @return flag de visibilidad
|
1001 |
*/
|
1002 |
public boolean isVisible(){ |
1003 |
return this.lyrVisible; |
1004 |
} |
1005 |
|
1006 |
/**
|
1007 |
* Asigna el flag de visibilidad a true o false. Si est? a true la capa
|
1008 |
* es visible normalmente y si est? a false no se mostrar?. Este flag solo
|
1009 |
* afecta a la vista de gvSIG. Las mini-imagenes seguiran mostrandose.
|
1010 |
* @param visible flag de visibilidad
|
1011 |
*/
|
1012 |
public void setHideViewOnly(boolean hideViewOnly){ |
1013 |
lyrHideViewOnly = hideViewOnly; |
1014 |
} |
1015 |
|
1016 |
/**
|
1017 |
* Obtiene el flag de visibilidad true o false. Si est? a true la capa
|
1018 |
* es visible normalmente y si est? a false no se muestra. Este flag solo
|
1019 |
* afecta a la vista de gvSIG. Las mini-imagenes seguiran mostrandose.
|
1020 |
* @return flag de visibilidad
|
1021 |
*/
|
1022 |
public boolean isHideViewOnly(){ |
1023 |
return lyrHideViewOnly;
|
1024 |
} |
1025 |
|
1026 |
/**
|
1027 |
* Obtiene la lista de puntos transformados. La lista de puntos transformada es la lista de puntos
|
1028 |
* a la que se le ha aplicado la transformaci?n af?n en base a las muestras tomadas.
|
1029 |
* Esta lista de puntos transformados hay que mantenerla actualizada cada vez que se hace un
|
1030 |
* update de un punto ya se usa para calcular los errores.
|
1031 |
* @return Lista de puntos transformada.
|
1032 |
*/
|
1033 |
public Point2D[] getTransformPointList() { |
1034 |
return transformPointList;
|
1035 |
} |
1036 |
|
1037 |
/**
|
1038 |
* Asigna la lista de puntos transformada. La lista de puntos transformada es la lista de puntos
|
1039 |
* a la que se le ha aplicado la transformaci?n af?n en base a las muestras tomadas.
|
1040 |
* Esta lista de puntos transformados hay que mantenerla actualizada cada vez que se hace un
|
1041 |
* update de un punto ya se usa para calcular los errores.
|
1042 |
* @param transformPointList Lista de puntos transformada.
|
1043 |
*/
|
1044 |
public void setTransformPointList(Point2D[] transformPointList) { |
1045 |
this.transformPointList = transformPointList;
|
1046 |
} |
1047 |
|
1048 |
/**
|
1049 |
* Asigna el objeto que gestiona la persistencia
|
1050 |
*/
|
1051 |
public void setPersistence(IPersistence geoPointPersistence) { |
1052 |
if(this.geoPointPersistence == null) |
1053 |
this.geoPointPersistence = geoPointPersistence;
|
1054 |
} |
1055 |
|
1056 |
/**
|
1057 |
* Obtiene el valor del flag que dice si se dibuja la cruz azul
|
1058 |
* @return
|
1059 |
*/
|
1060 |
public boolean isWithoutBlue() { |
1061 |
return withoutBlue;
|
1062 |
} |
1063 |
|
1064 |
/**
|
1065 |
* Asigna valor al flag que dice si se dibuja la cruz azul. Ser? true si no queremos
|
1066 |
* dibujarla y false si queremos.
|
1067 |
* @param withoutBlue
|
1068 |
*/
|
1069 |
public void setWithoutBlue(boolean withoutBlue) { |
1070 |
this.withoutBlue = withoutBlue;
|
1071 |
} |
1072 |
|
1073 |
/**
|
1074 |
* Obtiene el valor del flag que dice si se dibuja la cruz roja
|
1075 |
* @return
|
1076 |
*/
|
1077 |
public boolean isWithoutRed() { |
1078 |
return withoutRed;
|
1079 |
} |
1080 |
|
1081 |
/**
|
1082 |
* Asigna valor al flag que dice si se dibuja la cruz roja. Ser? true si no queremos
|
1083 |
* dibujarla y false si queremos.
|
1084 |
* @param withoutRed
|
1085 |
*/
|
1086 |
public void setWithoutRed(boolean withoutRed) { |
1087 |
this.withoutRed = withoutRed;
|
1088 |
} |
1089 |
//**********************End Setters & Getters*********************
|
1090 |
} |