當前位置: 首頁>>代碼示例>>Java>>正文


Java RectangleEdge.LEFT屬性代碼示例

本文整理匯總了Java中org.jfree.ui.RectangleEdge.LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Java RectangleEdge.LEFT屬性的具體用法?Java RectangleEdge.LEFT怎麽用?Java RectangleEdge.LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.jfree.ui.RectangleEdge的用法示例。


在下文中一共展示了RectangleEdge.LEFT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateCategoryGapSize

/**
 * Calculates the size (width or height, depending on the location of the 
 * axis) of a category gap.
 *
 * @param categoryCount  the number of categories.
 * @param area  the area within which the categories will be drawn.
 * @param edge  the axis location.
 *
 * @return The category gap width.
 */
protected double calculateCategoryGapSize(int categoryCount, 
                                          Rectangle2D area,
                                          RectangleEdge edge) {

    double result = 0.0;
    double available = 0.0;

    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
        available = area.getWidth();
    }
    else if ((edge == RectangleEdge.LEFT) 
            || (edge == RectangleEdge.RIGHT)) {
        available = area.getHeight();
    }

    if (categoryCount > 1) {
        result = available * getCategoryMargin() / (categoryCount - 1);
    }

    return result;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:32,代碼來源:CategoryAxis.java

示例2: calculateAnchorPoint

/**
 * Calculates the anchor point for a tick label.
 * 
 * @param tick  the tick.
 * @param cursor  the cursor.
 * @param dataArea  the data area.
 * @param edge  the edge on which the axis is drawn.
 * 
 * @return  the x and y coordinates of the anchor point.
 */
protected float[] calculateAnchorPoint(ValueTick tick, 
                                       double cursor, 
                                       Rectangle2D dataArea, 
                                       RectangleEdge edge) {

    float[] result = new float[2];
    if (edge == RectangleEdge.TOP) {
        result[0] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
        result[1] = (float) (cursor - getTickLabelInsets().bottom - 2.0);    
    }
    else if (edge == RectangleEdge.BOTTOM) {
        result[0] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
        result[1] = (float) (cursor + getTickLabelInsets().top + 2.0);                
    }
    else if (edge == RectangleEdge.LEFT) {
        result[0] = (float) (cursor - getTickLabelInsets().left - 2.0);    
        result[1] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
    }
    else if (edge == RectangleEdge.RIGHT) {
        result[0] = (float) (cursor + getTickLabelInsets().right + 2.0);    
        result[1] = (float) this.valueToJava2D(tick.getValue(), dataArea, edge);
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:34,代碼來源:ValueAxis.java

示例3: add

/**
 * Adds space to the top, bottom, left or right edge of the plot area.
 * 
 * @param space  the space (in Java2D units).
 * @param edge  the edge (<code>null</code> not permitted).
 */
public void add(double space, RectangleEdge edge) {
    if (edge == null) {
        throw new IllegalArgumentException("Null 'edge' argument.");
    }
    if (edge == RectangleEdge.TOP) {     
        this.top += space;
    }
    else if (edge == RectangleEdge.BOTTOM) {
        this.bottom += space;
    }
    else if (edge == RectangleEdge.LEFT) {
        this.left += space;
    }
    else if (edge == RectangleEdge.RIGHT) {
        this.right += space;
    }
    else {
        throw new IllegalStateException("Unrecognised 'edge' argument.");
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:26,代碼來源:AxisSpace.java

示例4: reserved

/**
 * Calculates the reserved area.
 * 
 * @param area  the area.
 * @param edge  the edge.
 * 
 * @return The reserved area.
 */
public Rectangle2D reserved(Rectangle2D area, RectangleEdge edge) {
    Rectangle2D result = null;
    if (edge == RectangleEdge.TOP) {
        result = new Rectangle2D.Double(area.getX(), area.getY(),
                                        area.getWidth(), this.top);
    }
    else if (edge == RectangleEdge.BOTTOM) {
        result = new Rectangle2D.Double(area.getX(), area.getMaxY() - this.top,
                                        area.getWidth(), this.bottom);
    }
    else if (edge == RectangleEdge.LEFT) {
        result = new Rectangle2D.Double(area.getX(), area.getY(),
                                        this.left, area.getHeight());
    }
    else if (edge == RectangleEdge.RIGHT) {
        result = new Rectangle2D.Double(area.getMaxX() - this.right, area.getY(),
                                        this.right, area.getHeight());
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:28,代碼來源:AxisSpace.java

示例5: getCategoryStart

/**
 * Returns the starting coordinate for the specified category.
 *
 * @param category  the category.
 * @param categoryCount  the number of categories.
 * @param area  the data area.
 * @param edge  the axis location.
 *
 * @return The coordinate.
 * 
 * @see #getCategoryMiddle(int, int, Rectangle2D, RectangleEdge)
 * @see #getCategoryEnd(int, int, Rectangle2D, RectangleEdge)
 */
public double getCategoryStart(int category, int categoryCount, 
                               Rectangle2D area,
                               RectangleEdge edge) {

    double result = 0.0;
    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
        result = area.getX() + area.getWidth() * getLowerMargin();
    }
    else if ((edge == RectangleEdge.LEFT) 
            || (edge == RectangleEdge.RIGHT)) {
        result = area.getMinY() + area.getHeight() * getLowerMargin();
    }

    double categorySize = calculateCategorySize(categoryCount, area, edge);
    double categoryGapWidth = calculateCategoryGapSize(categoryCount, area,
            edge);

    result = result + category * (categorySize + categoryGapWidth);
    return result;
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:34,代碼來源:CategoryAxis.java

示例6: calculateCategoryGapSize

/**
 * Calculates the size (width or height, depending on the location of the axis) of a category
 * gap.
 *
 * @param categoryCount  the number of categories.
 * @param area  the area within which the categories will be drawn.
 * @param edge  the axis location.
 *
 * @return the category gap width.
 */
protected double calculateCategoryGapSize(int categoryCount, Rectangle2D area,
                                          RectangleEdge edge) {

    double result = 0.0;
    double available = 0.0;

    if ((edge == RectangleEdge.TOP) || (edge == RectangleEdge.BOTTOM)) {
        available = area.getWidth();
    }
    else if ((edge == RectangleEdge.LEFT) || (edge == RectangleEdge.RIGHT)) {
        available = area.getHeight();
    }

    if (categoryCount > 1) {
        result = available * getCategoryMargin() / (categoryCount - 1);
    }

    return result;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:CategoryAxis.java

示例7: getRectX

/**
 * Adjusts the supplied x-value.
 *
 * @param x  the x-value.
 * @param w1  width 1.
 * @param w2  width 2.
 * @param edge  the edge (left or right).
 *
 * @return The adjusted x-value.
 */
protected double getRectX(double x, double w1, double w2, 
                          RectangleEdge edge) {

    double result = x;
    if (edge == RectangleEdge.LEFT) {
        result = result + w1;
    }
    else if (edge == RectangleEdge.RIGHT) {
        result = result + w2;
    }
    return result;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:23,代碼來源:Plot.java

示例8: ContourPlot

/**
 * Constructs a contour plot with the specified axes (other attributes take
 * default values).
 *
 * @param dataset  The dataset.
 * @param domainAxis  The domain axis.
 * @param rangeAxis  The range axis.
 * @param colorBar  The z-axis axis.
*/
public ContourPlot(ContourDataset dataset,
                   ValueAxis domainAxis, ValueAxis rangeAxis, 
                   ColorBar colorBar) {

    super();

    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    
    this.domainAxis = domainAxis;
    if (domainAxis != null) {
        domainAxis.setPlot(this);
        domainAxis.addChangeListener(this);
    }

    this.rangeAxis = rangeAxis;
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
        rangeAxis.addChangeListener(this);
    }

    this.colorBar = colorBar;
    if (colorBar != null) {
        colorBar.getAxis().setPlot(this);
        colorBar.getAxis().addChangeListener(this);
        colorBar.configure(this);
    }
    this.colorBarLocation = RectangleEdge.LEFT;

    this.toolTipGenerator = new StandardContourToolTipGenerator();

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:43,代碼來源:ContourPlot.java

示例9: draw

/**
 * Draws the axis.
 * 
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param cursor  the cursor position.
 * @param plotArea  the plot area (<code>null</code> not permitted).
 * @param dataArea  the data area (<code>null</code> not permitted).
 * @param edge  the edge (<code>null</code> not permitted).
 * @param plotState  collects information about the plot (<code>null</code> permitted).
 * 
 * @return the axis state (never <code>null</code>).
 */
public AxisState draw(Graphics2D g2, 
                      double cursor,
                      Rectangle2D plotArea, 
                      Rectangle2D dataArea, 
                      RectangleEdge edge,
                      PlotRenderingInfo plotState) {
    
    AxisState ret = super.draw(g2, cursor, plotArea, dataArea, edge, plotState);
    if (isAdvanceLineVisible()) {
        double xx = valueToJava2D(getRange().getUpperBound(), dataArea, edge);
        Line2D mark = null;
        g2.setStroke(getAdvanceLineStroke());
        g2.setPaint(getAdvanceLinePaint());
        if (edge == RectangleEdge.LEFT) {
            mark = new Line2D.Double(cursor, xx, cursor + dataArea.getWidth(), xx);
        }
        else if (edge == RectangleEdge.RIGHT) {
            mark = new Line2D.Double(cursor - dataArea.getWidth(), xx, cursor, xx);
        }
        else if (edge == RectangleEdge.TOP) {
            mark = new Line2D.Double(xx, cursor + dataArea.getHeight(), xx, cursor);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            mark = new Line2D.Double(xx, cursor, xx, cursor - dataArea.getHeight());
        }
        g2.draw(mark);
    }
    return ret;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:41,代碼來源:CyclicNumberAxis.java

示例10: moveCursor

/**
 * Moves the cursor outwards by the specified number of units.
 * 
 * @param units  the units.
 * @param edge  the edge.
 */
public void moveCursor(double units, RectangleEdge edge) {
    if (edge == RectangleEdge.TOP) {
        cursorUp(units);   
    }
    else if (edge == RectangleEdge.BOTTOM) {
        cursorDown(units);   
    }
    else if (edge == RectangleEdge.LEFT) {
        cursorLeft(units);   
    }
    else if (edge == RectangleEdge.RIGHT) {
        cursorRight(units);   
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:AxisState.java

示例11: reserved

/**
 * Calculates the reserved area.
 * 
 * @param area  the area.
 * @param edge  the edge.
 * 
 * @return The reserved area.
 */
public Rectangle2D reserved(Rectangle2D area, RectangleEdge edge) {
    Rectangle2D result = null;
    if (edge == RectangleEdge.TOP) {
        result = new Rectangle2D.Double(
            area.getX(), area.getY(), area.getWidth(), this.top
        );
    }
    else if (edge == RectangleEdge.BOTTOM) {
        result = new Rectangle2D.Double(
            area.getX(), area.getMaxY() - this.top,
            area.getWidth(), this.bottom
        );
    }
    else if (edge == RectangleEdge.LEFT) {
        result = new Rectangle2D.Double(
            area.getX(), area.getY(), this.left, area.getHeight()
        );
    }
    else if (edge == RectangleEdge.RIGHT) {
        result = new Rectangle2D.Double(
            area.getMaxX() - this.right, area.getY(),
            this.right, area.getHeight()
        );
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:34,代碼來源:AxisSpace.java

示例12: drawTickMarksAndLabels

protected AxisState drawTickMarksAndLabels(Graphics2D g2, double cursor, Rectangle2D plotArea, 
        Rectangle2D dataArea, RectangleEdge edge) {
    this.internalMarkerWhenTicksOverlap = false;
    AxisState ret = super.drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
    
    // continue and separate the labels only if necessary
    if (!this.internalMarkerWhenTicksOverlap) {
        return ret;
    }
    
    double ol = getTickMarkOutsideLength();
    FontMetrics fm = g2.getFontMetrics(getTickLabelFont());
    
    if (this.isVerticalTickLabels()) {
        ol = fm.getMaxAdvance(); 
    }
    else {
        ol = fm.getHeight();
    }
    
    double il = 0;
    if (isTickMarksVisible()) {
        float xx = (float) valueToJava2D(getRange().getUpperBound(), dataArea, edge);
        Line2D mark = null;
        g2.setStroke(getTickMarkStroke());
        g2.setPaint(getTickMarkPaint());
        if (edge == RectangleEdge.LEFT) {
            mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx);
        }
        else if (edge == RectangleEdge.RIGHT) {
            mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx);
        }
        else if (edge == RectangleEdge.TOP) {
            mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il);
        }
        g2.draw(mark);
    }
    return ret;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:42,代碼來源:CyclicNumberAxis.java

示例13: drawTickMarksAndLabels

/**
 * Draws the tick marks and labels.
 * 
 * @param g2  the graphics device.
 * @param cursor  the cursor.
 * @param plotArea  the plot area.
 * @param dataArea  the area inside the axes.
 * @param edge  the side on which the axis is displayed.
 * 
 * @return The axis state.
 */
protected AxisState drawTickMarksAndLabels(Graphics2D g2, double cursor, 
                                           Rectangle2D plotArea, 
                                           Rectangle2D dataArea, 
                                           RectangleEdge edge) {
    this.internalMarkerWhenTicksOverlap = false;
    AxisState ret = super.drawTickMarksAndLabels(
        g2, cursor, plotArea, dataArea, edge
    );
    
    // continue and separate the labels only if necessary
    if (!this.internalMarkerWhenTicksOverlap) {
        return ret;
    }
    
    double ol = getTickMarkOutsideLength();
    FontMetrics fm = g2.getFontMetrics(getTickLabelFont());
    
    if (isVerticalTickLabels()) {
        ol = fm.getMaxAdvance(); 
    }
    else {
        ol = fm.getHeight();
    }
    
    double il = 0;
    if (isTickMarksVisible()) {
        float xx = (float) valueToJava2D(
            getRange().getUpperBound(), dataArea, edge
        );
        Line2D mark = null;
        g2.setStroke(getTickMarkStroke());
        g2.setPaint(getTickMarkPaint());
        if (edge == RectangleEdge.LEFT) {
            mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx);
        }
        else if (edge == RectangleEdge.RIGHT) {
            mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx);
        }
        else if (edge == RectangleEdge.TOP) {
            mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il);
        }
        g2.draw(mark);
    }
    return ret;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:59,代碼來源:CyclicNumberAxis.java

示例14: refreshTicksVertical

/**
 * Recalculates the ticks for the date axis.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 *
 * @return A list of ticks.
 */
protected List refreshTicksVertical(Graphics2D g2,
                                    Rectangle2D dataArea,
                                    RectangleEdge edge) {

    List result = new java.util.ArrayList();

    Font tickLabelFont = getTickLabelFont();
    g2.setFont(tickLabelFont);

    if (isAutoTickUnitSelection()) {
        selectAutoTickUnit(g2, dataArea, edge);
    }
    DateTickUnit unit = getTickUnit();
    Date tickDate = calculateLowestVisibleTickValue(unit);
    //Date upperDate = calculateHighestVisibleTickValue(unit);
    Date upperDate = getMaximumDate();
    while (tickDate.before(upperDate)) {

        if (!isHiddenValue(tickDate.getTime())) {
            // work out the value, label and position
            String tickLabel;
            DateFormat formatter = getDateFormatOverride();
            if (formatter != null) {
                tickLabel = formatter.format(tickDate);
            }
            else {
                tickLabel = this.tickUnit.dateToString(tickDate);
            }
            TextAnchor anchor = null;
            TextAnchor rotationAnchor = null;
            double angle = 0.0;
            if (isVerticalTickLabels()) {
                anchor = TextAnchor.BOTTOM_CENTER;
                rotationAnchor = TextAnchor.BOTTOM_CENTER;
                if (edge == RectangleEdge.LEFT) {
                    angle = -Math.PI / 2.0;
                }
                else {
                    angle = Math.PI / 2.0;
                }
            }
            else {
                if (edge == RectangleEdge.LEFT) {
                    anchor = TextAnchor.CENTER_RIGHT;
                    rotationAnchor = TextAnchor.CENTER_RIGHT;
                }
                else {
                    anchor = TextAnchor.CENTER_LEFT;
                    rotationAnchor = TextAnchor.CENTER_LEFT;
                }
            }

            Tick tick = new DateTick(tickDate, tickLabel, anchor, 
                    rotationAnchor, angle);
            result.add(tick);
            tickDate = unit.addToDate(tickDate);
        }
        else {
            tickDate = unit.rollDate(tickDate);
        }
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:72,代碼來源:DateAxis.java

示例15: resolveDomainAxisLocation

/**
 * Resolves a domain axis location for a given plot orientation.
 *
 * @param location  the location (<code>null</code> not permitted).
 * @param orientation  the orientation (<code>null</code> not permitted).
 *
 * @return The edge (never <code>null</code>).
 */
public static RectangleEdge resolveDomainAxisLocation(AxisLocation location,
                                                      PlotOrientation orientation) {
    
    if (location == null) {
        throw new IllegalArgumentException("Null 'location' argument.");   
    }
    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");   
    }

    RectangleEdge result = null;
    
    if (location == AxisLocation.TOP_OR_RIGHT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.RIGHT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.TOP;
        }
    }
    else if (location == AxisLocation.TOP_OR_LEFT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.LEFT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.TOP;
        }
    }
    else if (location == AxisLocation.BOTTOM_OR_RIGHT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.RIGHT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.BOTTOM;
        }
    }
    else if (location == AxisLocation.BOTTOM_OR_LEFT) {
        if (orientation == PlotOrientation.HORIZONTAL) {
            result = RectangleEdge.LEFT;
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            result = RectangleEdge.BOTTOM;
        }
    }
    // the above should cover all the options...
    if (result == null) {
        throw new IllegalStateException("XYPlot.resolveDomainAxisLocation(...)");
    }
    return result;
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:59,代碼來源:Plot.java


注:本文中的org.jfree.ui.RectangleEdge.LEFT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。