/** * Returns a high precision and more accurate bounding box of the <code>Shape</code> than the * <code>getBounds</code> method. * * @todo REVISIT: tranform currently results in a new rectangle being created, is this a memory * overhead? */ public Rectangle2D getBounds2D() { final Rectangle2D rect = shape.getBounds2D(); return XAffineTransform.transform(this, rect, null); // REVISIT: used to read (this,rect,rect) - this can result in an // unmidifiable geometry exception }
/** * Returns an integer {@link Rectangle} that completely encloses the * <code>Shape</code>. */ public Rectangle getBounds() { final Rectangle rect = shape.getBounds(); return (Rectangle) XAffineTransform.transform(this, rect, rect); }
/** * Returns a high precision and more accurate bounding box of the * <code>Shape</code> than the <code>getBounds</code> method. * * @todo REVISIT: tranform currently results in a new rectangle being * created, is this a memory overhead? */ public Rectangle2D getBounds2D() { final Rectangle2D rect = shape.getBounds2D(); return XAffineTransform.transform(this, rect, null); // REVISIT: used to read (this,rect,rect) - this can result in an // unmidifiable geometry exception }
/** * Returns a high precision and more accurate bounding box of the * <code>Shape</code> than the <code>getBounds</code> method. * * @todo REVISIT: tranform currently results in a new rectangle being * created, is this a memory overhead? */ public Rectangle2D getBounds2D() { final Rectangle2D rect = shape.getBounds2D(); return XAffineTransform.transform(this, rect, null); // REVISIT: used to read (this,rect,rect) - this can result in an // unmidifiable geometry exception }
XAffineTransform.transform( crsToGrid, (area != null) ? area.getBounds2D() : this.bounds, null); final int xmin = (int) Math.round(bounds.getMinX());
/** * Returns the size (in pixels) that {@code ZoomPane} would have if it displayed the whole of * the {@link #getArea} region with the current zoom ({@link #zoom}). This method is practical * for determining the maximum values to assign to the scrollbars. For example, the horizontal * bar could cover the range {@code [0..viewSize.width]} whilst the vertical bar could cover * the range {@code [0..viewSize.height]}. */ private final Dimension getViewSize() { if (!visibleArea.isEmpty()) { Rectangle2D area = getArea(); if (isValid(area)) { area = XAffineTransform.transform(zoom, area, null); return new Dimension((int) Math.rint(area.getWidth()), (int) Math.rint(area.getHeight())); } return getSize(); } return new Dimension(DEFAULT_SIZE, DEFAULT_SIZE); }
/** * Method called each time the zoom changes. * * @param change Ignored. Can be null and will effectively sometimes be null. */ public void zoomChanged(final ZoomChangeEvent change) { if (!isAdjusting) { Rectangle2D area = getArea(); if (isValid(area)) { area = XAffineTransform.transform(zoom, area, null); try { isAdjusting = true; setRangeProperties(xm, area.getX(), getWidth(), area.getWidth()); setRangeProperties(ym, area.getY(), getHeight(), area.getHeight()); } finally { isAdjusting = false; } } } } }
XAffineTransform.transform( sourceWorldToGridTransform, cropEnvelope.toRectangle2D(), null); final Rectangle finalRasterArea = finalRasterAreaDouble.getBounds();
/** * Modifies the position in pixels of the visible part of {@code ZoomPane}. {@code viewSize} * is the size {@code ZoomPane} would be (in pixels) if its visible surface covered the whole * of the {@link #getArea} region with the current zoom (Note: {@code viewSize} can be obtained * by {@link #getPreferredSize} if {@link #setPreferredSize} hasn't been called with a non-null * value). Therefore, by definition, the region {@link #getArea} converted into pixel space * would give the rectangle * <code>bounds=Rectangle(0, 0, ,viewSize.width, ,viewSize.height)</code>. * <p> * This {@code scrollRectToVisible} method allows us to define the sub-region of {@code bounds} * which must appear in the {@code ZoomPane} window. */ public void scrollRectToVisible(final Rectangle rect) { Rectangle2D area = getArea(); if (isValid(area)) { area = XAffineTransform.transform(zoom, area, null); area.setRect(area.getX() + rect.getX(), area.getY() + rect.getY(), rect.getWidth(), rect.getHeight()); try { setVisibleArea(XAffineTransform.inverseTransform(zoom, area, area)); } catch (NoninvertibleTransformException exception) { unexpectedException("scrollRectToVisible", exception); } } }
area = XAffineTransform.transform(zoom, area, null); double x = area.getX(); double y = area.getY();
legendBounds = XAffineTransform.transform(rotatedTr, bounds, bounds);
final Rectangle2D bounds = XAffineTransform.transform(crsToGrid, (area != null) ? area.getBounds2D() : this.bounds, null); final int xmin = (int) Math.round(bounds.getMinX());
final Rectangle2D bounds = XAffineTransform.transform(crsToGrid, (area != null) ? area.getBounds2D() : this.bounds, null); final int xmin = (int) Math.round(bounds.getMinX());
Rectangle2D finalGridRange = XAffineTransform.transform( sourceWorldToGridTransform, cropEnvelope.toRectangle2D(), null); new Envelope2D( cropEnvelope.getCoordinateReferenceSystem(), XAffineTransform.transform(sourceGridToWorldTransform, finalGridRange,null))); assert testEnvelope.equals(cropEnvelope, XAffineTransform.getScale(sourceGridToWorldTransform)/2,false );
final Rectangle2D finalRasterAreaDouble = XAffineTransform.transform(sourceWorldToGridTransform, cropEnvelope.toRectangle2D(),null); final Rectangle finalRasterArea = finalRasterAreaDouble.getBounds();