Java Code Examples for java.awt.geom.RectangularShape#getWidth()

The following examples show how to use java.awt.geom.RectangularShape#getWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GradientXYBarPainter.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 2
Source File: GradientBarPainter.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 3
Source File: GradientXYBarPainter.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 4
Source File: GradientBarPainter.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 5
Source File: GradientXYBarPainter.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 6
Source File: GradientBarPainter.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 7
Source File: GradientXYBarPainter.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 8
Source File: GradientBarPainter.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 9
Source File: GradientXYBarPainter.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 10
Source File: GradientBarPainter.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 11
Source File: GradientXYBarPainter.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 12
Source File: GradientBarPainter.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 13
Source File: GradientXYBarPainter.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}
 
Example 14
Source File: GradientBarPainter.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Splits a bar into subregions (elsewhere, these subregions will have
 * different gradients applied to them).
 *
 * @param bar  the bar shape.
 * @param a  the first division.
 * @param b  the second division.
 * @param c  the third division.
 *
 * @return An array containing four subregions.
 */
private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a,
        double b, double c) {
    Rectangle2D[] result = new Rectangle2D[4];
    double y0 = bar.getMinY();
    double y1 = Math.rint(y0 + (bar.getHeight() * a));
    double y2 = Math.rint(y0 + (bar.getHeight() * b));
    double y3 = Math.rint(y0 + (bar.getHeight() * c));
    result[0] = new Rectangle2D.Double(bar.getMinX(), bar.getMinY(),
            bar.getWidth(), y1 - y0);
    result[1] = new Rectangle2D.Double(bar.getMinX(), y1, bar.getWidth(),
            y2 - y1);
    result[2] = new Rectangle2D.Double(bar.getMinX(), y2, bar.getWidth(),
            y3 - y2);
    result[3] = new Rectangle2D.Double(bar.getMinX(), y3, bar.getWidth(),
            bar.getMaxY() - y3);
    return result;
}