Revision 2977 trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/layers/FLyrGeoRaster.java
FLyrGeoRaster.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap.layers; |
42 | 42 |
|
43 | 43 |
import java.awt.Graphics2D; |
44 |
import java.awt.geom.Point2D; |
|
44 | 45 |
import java.awt.geom.Rectangle2D; |
45 | 46 |
import java.awt.image.BufferedImage; |
46 | 47 |
|
... | ... | |
50 | 51 |
import com.iver.cit.gvsig.fmap.DriverException; |
51 | 52 |
import com.iver.cit.gvsig.fmap.ViewPort; |
52 | 53 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
54 |
import com.iver.cit.gvsig.gui.Panels.SelectFilePanel; |
|
53 | 55 |
|
54 | 56 |
|
55 | 57 |
/** |
... | ... | |
267 | 269 |
public StackZoom getStackZoom(){ |
268 | 270 |
return zoom; |
269 | 271 |
} |
272 |
|
|
273 |
/** |
|
274 |
* Transforma un pixel de la imagen cuyas coordenadas son (0..maxWidth, 0..maxHeight) |
|
275 |
* en coordenadas del mundo real a partir del extent asignado a la imagen. |
|
276 |
* @param pixel Pixel de la imagen |
|
277 |
* @return Coordenadas del mundo de ese pixel |
|
278 |
*/ |
|
279 |
public Point2D img2World(Point2D pixel){ |
|
280 |
Point2D p = new Point2D.Double(); |
|
281 |
double wcWidth = 0.0, wcHeight = 0.0, ptoWCX = 0.0, ptoWCY = 0.0; |
|
282 |
int pixelImgX = 0, pixelImgY = 0; |
|
283 |
try{ |
|
284 |
wcWidth = getFullExtent().getWidth(); |
|
285 |
wcHeight = getFullExtent().getHeight(); |
|
286 |
pixelImgX = (int)((pixel.getX() * wcWidth) / SelectFilePanel.widthPxImg); |
|
287 |
pixelImgY = (int)((pixel.getY() * wcHeight) / SelectFilePanel.heightPxImg); |
|
288 |
}catch(DriverException ex){} |
|
289 |
p.setLocation(pixelImgX, pixelImgY); |
|
290 |
System.out.println("ENTRADA="+pixel); |
|
291 |
System.out.println("SALIDA="+p); |
|
292 |
System.out.println("wc AxH="+wcWidth+" "+wcHeight); |
|
293 |
System.out.println("img AxH="+SelectFilePanel.widthPxImg+" "+SelectFilePanel.heightPxImg); |
|
294 |
return p; |
|
295 |
} |
|
296 |
|
|
297 |
/** |
|
298 |
* Transforma un pixel de la imagen cuyas coordenadas son (0..maxWidth, 0..maxHeight) |
|
299 |
* en coordenadas del mundo real a partir del extent asignado a la imagen. |
|
300 |
* @param x Coordenada X del pixel de la imagen |
|
301 |
* @param y Coordenada Y del pixel de la imagen |
|
302 |
* @return Coordenadas del mundo de ese pixel |
|
303 |
*/ |
|
304 |
public Point2D img2World(double x, double y){ |
|
305 |
Point2D p = new Point2D.Double(); |
|
306 |
p.setLocation(x, y); |
|
307 |
return this.img2World(p); |
|
308 |
} |
|
270 | 309 |
} |
Also available in: Unified diff