/** * Gets the factor which has to be multiplied with a relative y coordinate * or height to get their size in pixel. * @return the vertical stretch factor */ public double getHeightFactor(){ return getBaseBounds().getHeight(); }
/** * Gets the factor which has to be multiplied with relative x coordinates * and widths to get their size in pixel. * @return the horizontal stretch factor */ public double getWidthFactor(){ return getBaseBounds().getWidth(); }
/** * Gets the size and location of this node in pixel where the point * 0/0 is equal to the point 0/0 on the owner-station. This method calculates * these values anew, clients interested in the current bounds should * use {@link VisibleSplitNode#getCurrentBounds()}. * @return the size and location */ public Rectangle getBounds(){ Root root = getRoot(); double fw = root.getWidthFactor(); double fh = root.getHeightFactor(); Rectangle rec = new Rectangle( (int)(x * fw + 0.5), (int)(y * fh + 0.5), (int)(width * fw + 0.5), (int)(height * fh + 0.5 )); Rectangle base = root.getBaseBounds(); rec.x = Math.min( base.width, Math.max( base.x, rec.x )); rec.y = Math.min( base.height, Math.max( base.y, rec.y )); rec.width = Math.min( base.width - rec.x + base.x, Math.max( 0, rec.width )); rec.height = Math.min( base.height - rec.y + base.y, Math.max( 0, rec.height )); return rec; }