svn-gvsig-desktop / trunk / libraries / libRaster / src / org / gvsig / raster / datastruct / GeoPoint.java @ 21227
History | View | Annotate | Download (5.3 KB)
1 | 12392 | nacho | /* 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.datastruct; |
||
20 | |||
21 | import java.awt.Dimension; |
||
22 | import java.awt.geom.Point2D; |
||
23 | |||
24 | /**
|
||
25 | * Esta clase representa a un punto de control que puede estar asociado a un
|
||
26 | * raster. Mantiene informaci?n del punto en coordenadas reales y coordenadas pixel
|
||
27 | *
|
||
28 | * @author Nacho Brodin (nachobrodin@gmail.com)
|
||
29 | *
|
||
30 | */
|
||
31 | 17782 | nbrodin | public class GeoPoint { |
32 | 18613 | nbrodin | public Point2D pixelPoint = null; |
33 | public Point2D mapPoint = null; |
||
34 | public boolean active = true; |
||
35 | public String label = ""; |
||
36 | public int number = 0; |
||
37 | private double errorX = 0; |
||
38 | private double errorY = 0; |
||
39 | private double rms = 0; |
||
40 | private double xEvaluate = 0; |
||
41 | private double yEvaluate = 0; |
||
42 | 17782 | nbrodin | |
43 | //Compatibilidad viejo modelo
|
||
44 | 18613 | nbrodin | public static int WIDTH_WINDOW = 140; |
45 | public static int HEIGHT_WINDOW = 140; |
||
46 | public ViewPortData leftViewPort = null, rightViewPort = null; |
||
47 | public Point2D leftCenterPoint = null, rightCenterPoint = null; |
||
48 | public double zoomLeft = 1, zoomRight = 1; |
||
49 | 12392 | nacho | |
50 | /**
|
||
51 | * Constructor
|
||
52 | */
|
||
53 | public GeoPoint(){}
|
||
54 | |||
55 | /**
|
||
56 | * Constructor
|
||
57 | * @param p pixelPoint
|
||
58 | * @param m mapPoint
|
||
59 | */
|
||
60 | public GeoPoint(Point2D p, Point2D m){ |
||
61 | this.pixelPoint = p;
|
||
62 | this.mapPoint = m;
|
||
63 | } |
||
64 | 18482 | nbrodin | |
65 | /**
|
||
66 | 18613 | nbrodin | * Inicializa a 0 los valores de los errores
|
67 | */
|
||
68 | public void resetErrors() { |
||
69 | xEvaluate = 0;
|
||
70 | yEvaluate = 0;
|
||
71 | errorX = 0;
|
||
72 | errorY = 0;
|
||
73 | rms = 0;
|
||
74 | } |
||
75 | |||
76 | /**
|
||
77 | * Obtiene la predicci?n de la coordenada X
|
||
78 | * @return double
|
||
79 | */
|
||
80 | public double getEvaluateX() { |
||
81 | return xEvaluate;
|
||
82 | } |
||
83 | |||
84 | /**
|
||
85 | * Asigna la predicci?n de la coordenada X
|
||
86 | * @param errorX
|
||
87 | */
|
||
88 | public void setEvaluateX(double xEvaluate) { |
||
89 | this.xEvaluate = xEvaluate;
|
||
90 | } |
||
91 | |||
92 | /**
|
||
93 | * Obtiene la predicci?n de la coordenada Y
|
||
94 | * @return double
|
||
95 | */
|
||
96 | public double getEvaluateY() { |
||
97 | return yEvaluate;
|
||
98 | } |
||
99 | |||
100 | /**
|
||
101 | * Asigna la predicci?n de la coordenada Y
|
||
102 | * @param errorY
|
||
103 | */
|
||
104 | public void setEvaluateY(double yEvaluate) { |
||
105 | this.yEvaluate = yEvaluate;
|
||
106 | } |
||
107 | |||
108 | /**
|
||
109 | 18482 | nbrodin | * Obtiene el error en X
|
110 | * @return double
|
||
111 | */
|
||
112 | public double getErrorX() { |
||
113 | return errorX;
|
||
114 | } |
||
115 | 12392 | nacho | |
116 | /**
|
||
117 | 18482 | nbrodin | * Asigna el error en X
|
118 | * @param errorX
|
||
119 | */
|
||
120 | public void setErrorX(double errorX) { |
||
121 | this.errorX = errorX;
|
||
122 | } |
||
123 | |||
124 | /**
|
||
125 | * Obtiene el error en Y
|
||
126 | * @return double
|
||
127 | */
|
||
128 | public double getErrorY() { |
||
129 | return errorY;
|
||
130 | } |
||
131 | |||
132 | /**
|
||
133 | * Asigna el error en Y
|
||
134 | * @param errorY
|
||
135 | */
|
||
136 | public void setErrorY(double errorY) { |
||
137 | this.errorY = errorY;
|
||
138 | } |
||
139 | |||
140 | /**
|
||
141 | * Obtiene el error RMS
|
||
142 | * @return
|
||
143 | */
|
||
144 | public double getRms() { |
||
145 | return rms;
|
||
146 | } |
||
147 | |||
148 | /**
|
||
149 | * Asigna el error RMS
|
||
150 | * @param rms
|
||
151 | */
|
||
152 | public void setRms(double rms) { |
||
153 | this.rms = rms;
|
||
154 | } |
||
155 | |||
156 | /**
|
||
157 | 12392 | nacho | * Hace una copia de la instancia del punto.
|
158 | * @return GeoPoint
|
||
159 | */
|
||
160 | public GeoPoint cloneGeoPoint(){
|
||
161 | Point2D pixel = null; |
||
162 | Point2D map = null; |
||
163 | if(pixelPoint != null) |
||
164 | pixel = (Point2D)pixelPoint.clone();
|
||
165 | |||
166 | if(mapPoint != null) |
||
167 | map = (Point2D)mapPoint.clone();
|
||
168 | |||
169 | GeoPoint gp = new GeoPoint(pixel, map);
|
||
170 | 18482 | nbrodin | gp.setErrorX(this.getErrorX());
|
171 | gp.setErrorY(this.getErrorY());
|
||
172 | gp.setRms(this.getRms());
|
||
173 | 12392 | nacho | |
174 | if(leftViewPort != null){ |
||
175 | gp.leftViewPort = new ViewPortData();
|
||
176 | gp.leftViewPort.setProjection(leftViewPort.getProjection()); |
||
177 | gp.leftViewPort.setExtent(leftViewPort.getExtent()); |
||
178 | gp.leftViewPort.setSize((Dimension)leftViewPort.getSize().clone());
|
||
179 | 12544 | nacho | gp.leftViewPort.reExtent(); |
180 | 12392 | nacho | } |
181 | |||
182 | if(rightViewPort != null){ |
||
183 | gp.rightViewPort = new ViewPortData();
|
||
184 | gp.rightViewPort.setProjection(rightViewPort.getProjection()); |
||
185 | gp.rightViewPort.setExtent(rightViewPort.getExtent()); |
||
186 | gp.rightViewPort.setSize((Dimension)rightViewPort.getSize().clone());
|
||
187 | 12544 | nacho | gp.rightViewPort.reExtent(); |
188 | 12392 | nacho | } |
189 | |||
190 | if(leftCenterPoint != null) |
||
191 | gp.leftCenterPoint = (Point2D)this.leftCenterPoint.clone(); |
||
192 | if(rightCenterPoint != null) |
||
193 | gp.rightCenterPoint = (Point2D)this.rightCenterPoint.clone(); |
||
194 | gp.active = this.active;
|
||
195 | gp.zoomLeft = this.zoomLeft;
|
||
196 | gp.zoomRight = this.zoomRight;
|
||
197 | return gp;
|
||
198 | } |
||
199 | |||
200 | /**
|
||
201 | * Muestra por consola algunos valores de un geopunto
|
||
202 | */
|
||
203 | public void show(){ |
||
204 | System.out.println("********GeoPoint**********"); |
||
205 | System.out.println("Pixel: "+pixelPoint); |
||
206 | System.out.println("Map: "+mapPoint); |
||
207 | System.out.println("Left Zoom Center: "+leftCenterPoint); |
||
208 | System.out.println("Right Zoom Center: "+rightCenterPoint); |
||
209 | System.out.println("Active: "+active); |
||
210 | System.out.println("ZoomLeft: "+zoomLeft); |
||
211 | System.out.println("ZoomRight: "+zoomRight); |
||
212 | System.out.println("******End GeoPoint********"); |
||
213 | } |
||
214 | } |