当前位置: 首页>>代码示例>>Java>>正文


Java RectangleEdge.isLeftOrRight方法代码示例

本文整理汇总了Java中org.jfree.ui.RectangleEdge.isLeftOrRight方法的典型用法代码示例。如果您正苦于以下问题:Java RectangleEdge.isLeftOrRight方法的具体用法?Java RectangleEdge.isLeftOrRight怎么用?Java RectangleEdge.isLeftOrRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.ui.RectangleEdge的用法示例。


在下文中一共展示了RectangleEdge.isLeftOrRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMaxDim

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Returns the maximum of the relevant dimension (height or width) of the 
 * subcategory labels.
 * 
 * @param g2  the graphics device.
 * @param edge  the edge.
 * 
 * @return The maximum dimension.
 */
private double getMaxDim(Graphics2D g2, RectangleEdge edge) {
    double result = 0.0;
    g2.setFont(this.subLabelFont);
    FontMetrics fm = g2.getFontMetrics();
    Iterator iterator = this.subCategories.iterator();
    while (iterator.hasNext()) {
        Comparable subcategory = (Comparable) iterator.next();
        String label = subcategory.toString();
        Rectangle2D bounds = TextUtilities.getTextBounds(label, g2, fm);
        double dim = 0.0;
        if (RectangleEdge.isLeftOrRight(edge)) {
            dim = bounds.getWidth();   
        }
        else {  // must be top or bottom
            dim = bounds.getHeight();
        }
        result = Math.max(result, dim);
    }   
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:SubCategoryAxis.java

示例2: valueToJava2D

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Converts a data value to a coordinate in Java2D space, assuming that the
 * axis runs along one edge of the specified dataArea.
 * <p>
 * Note that it is possible for the coordinate to fall outside the plotArea.
 *
 * @param value  the data value.
 * @param area  the area for plotting the data.
 * @param edge  the axis location.
 *
 * @return The Java2D coordinate.
 */
public double valueToJava2D(double value, Rectangle2D area, RectangleEdge edge) {
    
    Range range = getRange();
    double axisMin = range.getLowerBound();
    double axisMax = range.getUpperBound();

    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        max = area.getMinY();
        min = area.getMaxY();
    }
    if (isInverted()) {
        return max - ((value - axisMin) / (axisMax - axisMin)) * (max - min);
    }
    else {
        return min + ((value - axisMin) / (axisMax - axisMin)) * (max - min);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:NumberAxis.java

示例3: java2DToValue

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Converts a coordinate in Java2D space to the corresponding data value,
 * assuming that the axis runs along one edge of the specified dataArea.
 *
 * @param java2DValue  the coordinate in Java2D space.
 * @param area  the area in which the data is plotted.
 * @param edge  the location.
 *
 * @return The data value.
 */
public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) {
    
    Range range = getRange();
    double axisMin = range.getLowerBound();
    double axisMax = range.getUpperBound();

    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = area.getMaxY();
        max = area.getY();
    }
    if (isInverted()) {
        return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin);
    }
    else {
        return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:NumberAxis.java

示例4: transStart

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Translates a data value to a Java2D value for the first section of the 
 * axis.
 * 
 * @param value  the value.
 * @param area  the data area.
 * @param edge  the edge along which the axis lies.
 * @param length1  the length of the first section.
 * @param length2  the length of the second section.
 * 
 * @return The Java2D coordinate.
 */
private double transStart(double value, Rectangle2D area, RectangleEdge edge,
                          double length1, double length2) {
    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getX() + area.getWidth() * length1 / (length1 + length2);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = area.getMaxY();
        max = area.getMaxY() - area.getHeight() * length1 / (length1 + length2);
    }
    if (isInverted()) {
        return max - ((value - this.displayStart) 
            / (this.fixedRange.getUpperBound() - this.displayStart)) * (max - min);
    }
    else {
        return min + ((value - this.displayStart) 
            / (this.fixedRange.getUpperBound() - this.displayStart)) * (max - min);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:ModuloAxis.java

示例5: trans

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * A regular translation from a data value to a Java2D value.
 * 
 * @param value  the value.
 * @param area  the data area.
 * @param edge  the edge along which the axis lies.
 * 
 * @return The Java2D coordinate.
 */
private double trans(double value, Rectangle2D area, RectangleEdge edge) {
    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getX() + area.getWidth();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = area.getMaxY();
        max = area.getMaxY() - area.getHeight();
    }
    if (isInverted()) {
        return max - ((value - this.displayStart) 
               / (this.displayEnd - this.displayStart)) * (max - min);
    }
    else {
        return min + ((value - this.displayStart) 
               / (this.displayEnd - this.displayStart)) * (max - min);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:ModuloAxis.java

示例6: valueToJava2D

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Translates the data value to the display coordinates (Java 2D User Space)
 * of the chart.
 *
 * @param value  the date to be plotted.
 * @param area  the rectangle (in Java2D space) where the data is to be plotted.
 * @param edge  the axis location.
 *
 * @return the coordinate corresponding to the supplied data value.
 */
public double valueToJava2D(double value, Rectangle2D area, RectangleEdge edge) {
    
    value = this.timeline.toTimelineValue(new Date((long) value));

    DateRange range = (DateRange) getRange();
    double axisMin = this.timeline.toTimelineValue(range.getLowerDate());
    double axisMax = this.timeline.toTimelineValue(range.getUpperDate());
    double result = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        double minX = area.getX();
        double maxX = area.getMaxX();
        if (isInverted()) {
            result = maxX + ((value - axisMin) / (axisMax - axisMin)) * (minX - maxX);
        }
        else {
            result = minX + ((value - axisMin) / (axisMax - axisMin)) * (maxX - minX);
        }
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        double minY = area.getMinY();
        double maxY = area.getMaxY();
        if (isInverted()) {
            result = minY + (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
        }
        else {
            result = maxY - (((value - axisMin) / (axisMax - axisMin)) * (maxY - minY));
        }
    }
    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:42,代码来源:DateAxis.java

示例7: refreshTicks

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Calculates the positions of the tick labels for the axis, storing the 
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 * 
 * @return A list of ticks.
 *
 */
public List refreshTicks(Graphics2D g2, AxisState state, 
        Rectangle2D dataArea, RectangleEdge edge) {

    List result = new java.util.ArrayList();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        result = refreshTicksVertical(g2, dataArea, edge);
    }
    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:LogAxis.java

示例8: java2DToValue

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Converts a coordinate in Java2D space to the corresponding data value,
 * assuming that the axis runs along one edge of the specified dataArea.
 *
 * @param java2DValue  the coordinate in Java2D space.
 * @param area  the area in which the data is plotted.
 * @param edge  the edge along which the axis lies.
 *
 * @return The data value.
 */
public double java2DToValue(double java2DValue,
                            Rectangle2D area,
                            RectangleEdge edge) {

    double result = Double.NaN;
    double min = 0.0;
    double max = 0.0;
    double axisMin = this.first.getFirstMillisecond(this.calendar);
    double axisMax = this.last.getLastMillisecond(this.calendar);
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = area.getMaxY();
        max = area.getY();
    }
    if (isInverted()) {
         result = axisMax - ((java2DValue - min) / (max - min) 
                  * (axisMax - axisMin));
    }
    else {
         result = axisMin + ((java2DValue - min) / (max - min) 
                  * (axisMax - axisMin));
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:PeriodAxis.java

示例9: valueToJava2D

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Converts a data value to a coordinate in Java2D space, assuming that the
 * axis runs along one edge of the specified dataArea.
 * <p>
 * Note that it is possible for the coordinate to fall outside the area.
 *
 * @param value  the data value.
 * @param area  the area for plotting the data.
 * @param edge  the edge along which the axis lies.
 *
 * @return The Java2D coordinate.
 */
public double valueToJava2D(double value,
                            Rectangle2D area,
                            RectangleEdge edge) {
    
    double result = Double.NaN;
    double axisMin = this.first.getFirstMillisecond(this.calendar);
    double axisMax = this.last.getLastMillisecond(this.calendar);
    if (RectangleEdge.isTopOrBottom(edge)) {
        double minX = area.getX();
        double maxX = area.getMaxX();
        if (isInverted()) {
            result = maxX + ((value - axisMin) / (axisMax - axisMin)) 
                     * (minX - maxX);
        }
        else {
            result = minX + ((value - axisMin) / (axisMax - axisMin)) 
                     * (maxX - minX);
        }
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        double minY = area.getMinY();
        double maxY = area.getMaxY();
        if (isInverted()) {
            result = minY + (((value - axisMin) / (axisMax - axisMin)) 
                     * (maxY - minY));
        }
        else {
            result = maxY - (((value - axisMin) / (axisMax - axisMin)) 
                     * (maxY - minY));
        }
    }
    return result;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:PeriodAxis.java

示例10: reserveSpace

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Reserve some space on each axis side because we draw a centered label at
 * each extremity. 
 * 
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param plotArea  the plot area.
 * @param edge  the edge.
 * @param space  the space already reserved.
 * 
 * @return The reserved space.
 */
public AxisSpace reserveSpace(Graphics2D g2, 
                              Plot plot, 
                              Rectangle2D plotArea, 
                              RectangleEdge edge, 
                              AxisSpace space) {
    
    this.internalMarkerCycleBoundTick = null;
    AxisSpace ret = super.reserveSpace(g2, plot, plotArea, edge, space);
    if (this.internalMarkerCycleBoundTick == null) {
        return ret;
    }

    FontMetrics fm = g2.getFontMetrics(getTickLabelFont());
    Rectangle2D r = TextUtilities.getTextBounds(
        this.internalMarkerCycleBoundTick.getText(), g2, fm
    );

    if (RectangleEdge.isTopOrBottom(edge)) {
        if (isVerticalTickLabels()) {
            space.add(r.getHeight() / 2, RectangleEdge.RIGHT);
        }
        else {
            space.add(r.getWidth() / 2, RectangleEdge.RIGHT);
        }
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        if (isVerticalTickLabels()) {
            space.add(r.getWidth() / 2, RectangleEdge.TOP);
        }
        else {
            space.add(r.getHeight() / 2, RectangleEdge.TOP);
        }
    }
    
    return ret;
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:50,代码来源:CyclicNumberAxis.java

示例11: refreshTicks

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Calculates the positions of the tick labels for the axis, storing the 
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the data should be drawn.
 * @param edge  the location of the axis.
 * 
 * @return A list of ticks.
 */
public List refreshTicks(Graphics2D g2, 
                         AxisState state,
                         Rectangle2D dataArea,
                         RectangleEdge edge) {
    List ticks = null;
    if (RectangleEdge.isTopOrBottom(edge)) {
        ticks = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        ticks = refreshTicksVertical(g2, dataArea, edge);
    }
    return ticks;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:SymbolAxis.java

示例12: drawTickMarks

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Draws the tick marks for the axis.
 * 
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarks(Graphics2D g2, AxisState state, 
                             Rectangle2D dataArea, 
                             RectangleEdge edge) {
    if (RectangleEdge.isTopOrBottom(edge)) {
        drawTickMarksHorizontal(g2, state, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        drawTickMarksVertical(g2, state, dataArea, edge);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:PeriodAxis.java

示例13: java2DToValue

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Converts a coordinate in Java2D space to the corresponding data
 * value, assuming that the axis runs along one edge of the specified plotArea.
 *
 * @param java2DValue  the coordinate in Java2D space.
 * @param plotArea  the area in which the data is plotted.
 * @param edge  the axis location.
 *
 * @return the data value.
 */
public double java2DToValue(double java2DValue, Rectangle2D plotArea, RectangleEdge edge) {

    Range range = getRange();
    double axisMin = switchedLog10(range.getLowerBound());
    double axisMax = switchedLog10(range.getUpperBound());

    double plotMin = 0.0;
    double plotMax = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        plotMin = plotArea.getX();
        plotMax = plotArea.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        plotMin = plotArea.getMaxY();
        plotMax = plotArea.getMinY();
    }

    if (isInverted()) {
        return Math.pow(
            10, axisMax - ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)
        );
    }
    else {
        return Math.pow(
            10, axisMin + ((java2DValue - plotMin) / (plotMax - plotMin)) * (axisMax - axisMin)
        );
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:LogarithmicAxis.java

示例14: reserveSpace

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Estimates the space required for the axis, given a specific drawing area.
 *
 * @param g2  the graphics device (used to obtain font information).
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the axis should be drawn.
 * @param edge  the axis location (top or bottom).
 * @param space  the space already reserved.
 *
 * @return The space required to draw the axis.
 */
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, 
                              Rectangle2D plotArea, 
                              RectangleEdge edge, AxisSpace space) {

    // create a new space object if one wasn't supplied...
    if (space == null) {
        space = new AxisSpace();
    }
    
    // if the axis is not visible, no additional space is required...
    if (!isVisible()) {
        return space;
    }

    // calculate the max size of the tick labels (if visible)...
    double tickLabelHeight = 0.0;
    double tickLabelWidth = 0.0;
    if (isTickLabelsVisible()) {
        g2.setFont(getTickLabelFont());
        AxisState state = new AxisState();
        // we call refresh ticks just to get the maximum width or height
        refreshTicks(g2, state, plotArea, edge);
        if (edge == RectangleEdge.TOP) {
            tickLabelHeight = state.getMax();
        }
        else if (edge == RectangleEdge.BOTTOM) {
            tickLabelHeight = state.getMax();
        }
        else if (edge == RectangleEdge.LEFT) {
            tickLabelWidth = state.getMax(); 
        }
        else if (edge == RectangleEdge.RIGHT) {
            tickLabelWidth = state.getMax(); 
        }
    }
    
    // get the axis label size and update the space object...
    Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge);
    double labelHeight = 0.0;
    double labelWidth = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        labelHeight = labelEnclosure.getHeight();
        space.add(labelHeight + tickLabelHeight 
                + this.categoryLabelPositionOffset, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        labelWidth = labelEnclosure.getWidth();
        space.add(labelWidth + tickLabelWidth 
                + this.categoryLabelPositionOffset, edge);
    }
    return space;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:65,代码来源:CategoryAxis.java

示例15: reserveSpace

import org.jfree.ui.RectangleEdge; //导入方法依赖的package包/类
/**
 * Estimates the space (height or width) required to draw the axis.
 *
 * @param g2  the graphics device.
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the plot (including axes) should 
 *                  be drawn.
 * @param edge  the axis location.
 * @param space  space already reserved.
 *
 * @return The space required to draw the axis (including pre-reserved 
 *         space).
 */
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, 
                              Rectangle2D plotArea, RectangleEdge edge, 
                              AxisSpace space) {
    // create a new space object if one wasn't supplied...
    if (space == null) {
        space = new AxisSpace();
    }
    
    // if the axis is not visible, no additional space is required...
    if (!isVisible()) {
        return space;
    }

    // if the axis has a fixed dimension, return it...
    double dimension = getFixedDimension();
    if (dimension > 0.0) {
        space.ensureAtLeast(dimension, edge);
    }
    
    // get the axis label size and update the space object...
    Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge);
    double labelHeight = 0.0;
    double labelWidth = 0.0;
    double tickLabelBandsDimension = 0.0;
    
    for (int i = 0; i < this.labelInfo.length; i++) {
        PeriodAxisLabelInfo info = this.labelInfo[i];
        FontMetrics fm = g2.getFontMetrics(info.getLabelFont());
        tickLabelBandsDimension 
            += info.getPadding().extendHeight(fm.getHeight());
    }
    
    if (RectangleEdge.isTopOrBottom(edge)) {
        labelHeight = labelEnclosure.getHeight();
        space.add(labelHeight + tickLabelBandsDimension, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        labelWidth = labelEnclosure.getWidth();
        space.add(labelWidth + tickLabelBandsDimension, edge);
    }

    // add space for the outer tick labels, if any...
    double tickMarkSpace = 0.0;
    if (isTickMarksVisible()) {
        tickMarkSpace = getTickMarkOutsideLength();
    }
    if (this.minorTickMarksVisible) {
        tickMarkSpace = Math.max(tickMarkSpace, 
                this.minorTickMarkOutsideLength);
    }
    space.add(tickMarkSpace, edge);
    return space;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:67,代码来源:PeriodAxis.java


注:本文中的org.jfree.ui.RectangleEdge.isLeftOrRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。