Revision 3019 trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/ZoomControlPanel.java
ZoomControlPanel.java | ||
---|---|---|
193 | 193 |
private FLayers flayers = null; |
194 | 194 |
private ViewPort viewPort = null; |
195 | 195 |
private ViewPort newViewPort = null; |
196 |
private Rectangle2D fullExtent = null; |
|
197 | 196 |
private Point2D centerPoint = null; |
197 |
private final int ZOOM = 12; |
|
198 | 198 |
|
199 | 199 |
public CanvasZone( int anc,int alt) { |
200 | 200 |
ancho = anc; |
... | ... | |
218 | 218 |
public void calcViewPort(){ |
219 | 219 |
if(centerPoint != null){ |
220 | 220 |
newViewPort = this.viewPort.cloneViewPort(); |
221 |
System.out.println(" *** "+viewPort.getImageWidth()+" "+viewPort.getImageHeight()); |
|
222 |
System.out.println(" *** "+viewPort.getExtent().getMinX()+" "+viewPort.getExtent().getMinY()+" "+viewPort.getExtent().getMaxX()+" "+viewPort.getExtent().getMaxY()); |
|
223 |
Rectangle2D ext = new Rectangle2D.Double( centerPoint.getX() - 750, |
|
224 |
centerPoint.getY() - 750, |
|
225 |
1500, |
|
226 |
1500); |
|
227 |
newViewPort.setExtent(ext); |
|
228 |
newViewPort.setImageSize(new java.awt.Dimension(this.getWidth(), this.getHeight())); |
|
229 |
newViewPort.setScale(); |
|
230 | 221 |
|
231 |
//A centro de vista |
|
232 |
double wcOriginCenterX = centerPoint.getX(); |
|
233 |
double wcOriginCenterY = centerPoint.getY(); |
|
234 |
|
|
235 | 222 |
//Hallamos la relaci?n entre el pixel y las WC a partir de la imagen de la capa |
236 |
double relacionPixelWcWidth = (fullExtent.getMaxX() - fullExtent.getMinX())/this.getWidth();
|
|
237 |
double relacionPixelWcHeight = (fullExtent.getMaxY() - fullExtent.getMinY())/this.getHeight();
|
|
223 |
double relacionPixelWcWidth = ((viewPort.getExtent().getMaxX() - viewPort.getExtent().getMinX()) / ZOOM)/this.getWidth();
|
|
224 |
double relacionPixelWcHeight = ((viewPort.getExtent().getMaxY() - viewPort.getExtent().getMinY()) / ZOOM)/this.getHeight();
|
|
238 | 225 |
|
239 |
double wcOriginX = wcOriginCenterX - ((viewPort.getImageWidth()*relacionPixelWcWidth)/2);
|
|
240 |
double wcOriginY = wcOriginCenterY - ((viewPort.getImageHeight()*relacionPixelWcHeight)/2);
|
|
226 |
double wcOriginX = centerPoint.getX() - ((viewPort.getImageWidth()*relacionPixelWcWidth)/2);
|
|
227 |
double wcOriginY = centerPoint.getY() - ((viewPort.getImageHeight()*relacionPixelWcHeight)/2);
|
|
241 | 228 |
|
242 | 229 |
double wcDstMinX = wcOriginX; |
243 | 230 |
double wcDstMinY = wcOriginY; |
... | ... | |
247 | 234 |
double wcDstWidth = wcDstMaxX - wcDstMinX; |
248 | 235 |
double wcDstHeight = wcDstMaxY - wcDstMinY; |
249 | 236 |
|
250 |
ext = new Rectangle2D.Double(wcDstMinX, wcDstMinY, wcDstWidth, wcDstHeight); |
|
251 |
//getMapContext().getViewPort().setExtent(r); |
|
252 |
|
|
237 |
Rectangle2D ext = new Rectangle2D.Double(wcDstMinX, wcDstMinY, wcDstWidth, wcDstHeight); |
|
238 |
|
|
239 |
newViewPort.setExtent(ext); |
|
240 |
newViewPort.setImageSize(new java.awt.Dimension(this.getWidth(), this.getHeight())); |
|
241 |
newViewPort.setScale(); |
|
253 | 242 |
} |
254 | 243 |
} |
255 | 244 |
|
... | ... | |
292 | 281 |
this.centerPoint = pto; |
293 | 282 |
} |
294 | 283 |
|
295 |
/** |
|
296 |
* |
|
297 |
*/ |
|
298 |
public void setFullExtent(Rectangle2D fe){ |
|
299 |
this.fullExtent = fe; |
|
300 |
} |
|
301 | 284 |
|
302 | 285 |
} |
303 | 286 |
|
Also available in: Unified diff