Revision 18277 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/ui/zoom/CanvasZone.java
CanvasZone.java | ||
---|---|---|
101 | 101 |
public Point2D viewCoordsToWorld(Point2D p) { |
102 | 102 |
int w = getVisibleRect().width; |
103 | 103 |
int h = getVisibleRect().height; |
104 |
double cx = lastExtent.getX() + ((p.getX() * lastExtent.getWidth()) / w); |
|
105 |
double cy = lastExtent.getY() - (p.getY() * lastExtent.getHeight()) / h; |
|
104 |
Rectangle2D ex = lastExtent; |
|
105 |
if(lastExtent == null) |
|
106 |
ex = extent; |
|
107 |
double cx = ex.getX() + ((p.getX() * ex.getWidth()) / w); |
|
108 |
double cy = ex.getY() - (p.getY() * ex.getHeight()) / h; |
|
106 | 109 |
return new Point2D.Double(cx, cy); |
107 | 110 |
} |
108 | 111 |
|
... | ... | |
114 | 117 |
public Point2D viewCoordsFromWorld(Point2D p) { |
115 | 118 |
int w = getVisibleRect().width; |
116 | 119 |
int h = getVisibleRect().height; |
117 |
double cx = ((p.getX() - lastExtent.getMinX()) * w) / lastExtent.getWidth(); |
|
118 |
double cy = ((Math.abs(p.getY() - lastExtent.getMinY()) * h) / lastExtent.getHeight()); |
|
120 |
Rectangle2D ex = lastExtent; |
|
121 |
if(lastExtent == null) |
|
122 |
ex = extent; |
|
123 |
double cx = ((p.getX() - ex.getMinX()) * w) / ex.getWidth(); |
|
124 |
double cy = ((Math.abs(p.getY() - ex.getMinY()) * h) / ex.getHeight()); |
|
119 | 125 |
return new Point2D.Double(cx, cy); |
120 | 126 |
} |
121 | 127 |
|
Also available in: Unified diff