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


Java LineUtilities.clipLine方法代码示例

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


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

示例1: drawPrimaryLine

import org.jfree.chart.util.LineUtilities; //导入方法依赖的package包/类
private void drawPrimaryLine(XYItemRendererState state, Graphics2D g2,
    XYPlot plot, double x0, double y0, double x1, double y1, int pass,
    int series, int item, ValueAxis domainAxis, ValueAxis rangeAxis,
    Rectangle2D dataArea)
{
  RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
  RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
  double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation);
  double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation);
  double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
  double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);
  // only draw if we have good values
  if (Double.isNaN(transX0) || Double.isNaN(transY0) || Double.isNaN(transX1)
      || Double.isNaN(transY1))
  {
    return;
  }
  PlotOrientation orientation = plot.getOrientation();
  boolean visible;
  if (orientation == PlotOrientation.HORIZONTAL)
  {
    state.workingLine.setLine(transY0, transX0, transY1, transX1);
  }
  else if (orientation == PlotOrientation.VERTICAL)
  {
    state.workingLine.setLine(transX0, transY0, transX1, transY1);
  }
  visible = LineUtilities.clipLine(state.workingLine, dataArea);
  if (visible)
  {
    drawFirstPassShape(g2, pass, series, item, state.workingLine);
  }
}
 
开发者ID:debrief,项目名称:limpet,代码行数:34,代码来源:WrappingRenderer.java

示例2: drawPrimaryLine

import org.jfree.chart.util.LineUtilities; //导入方法依赖的package包/类
/**
 * Draws the item (first pass). This method draws the lines
 * connecting the items.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the area within which the data is being drawn.
 * @param plot  the plot (can be used to obtain standard color
 *              information etc).
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param pass  the pass.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 */
protected void drawPrimaryLine(XYItemRendererState state,
                               Graphics2D g2,
                               XYPlot plot,
                               XYDataset dataset,
                               int pass,
                               int series,
                               int item,
                               ValueAxis domainAxis,
                               ValueAxis rangeAxis,
                               Rectangle2D dataArea) {
    if (item == 0) {
        return;
    }

    // get the data point...
    double x1 = dataset.getXValue(series, item);
    double y1 = dataset.getYValue(series, item);
    if (Double.isNaN(y1) || Double.isNaN(x1)) {
        return;
    }

    double x0 = dataset.getXValue(series, item - 1);
    double y0 = dataset.getYValue(series, item - 1);
    if (Double.isNaN(y0) || Double.isNaN(x0)) {
        return;
    }

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation);
    double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation);

    double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
    double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);

    // only draw if we have good values
    if (Double.isNaN(transX0) || Double.isNaN(transY0)
        || Double.isNaN(transX1) || Double.isNaN(transY1)) {
        return;
    }

    PlotOrientation orientation = plot.getOrientation();
    boolean visible;
    if (orientation == PlotOrientation.HORIZONTAL) {
        state.workingLine.setLine(transY0, transX0, transY1, transX1);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        state.workingLine.setLine(transX0, transY0, transX1, transY1);
    }
    visible = LineUtilities.clipLine(state.workingLine, dataArea);
    if (visible) {
        drawFirstPassShape(g2, pass, series, item, state.workingLine);
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:72,代码来源:XYLineAndShapeRenderer.java

示例3: draw

import org.jfree.chart.util.LineUtilities; //导入方法依赖的package包/类
/**
 * Draws the annotation.  This method is called by the {@link XYPlot}
 * class, you won't normally need to call it yourself.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param rendererIndex  the renderer index.
 * @param info  if supplied, this info object will be populated with
 *              entity information.
 */
@Override
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                 ValueAxis domainAxis, ValueAxis rangeAxis,
                 int rendererIndex,
                 PlotRenderingInfo info) {

    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
            plot.getDomainAxisLocation(), orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
            plot.getRangeAxisLocation(), orientation);
    float j2DX1 = 0.0f;
    float j2DX2 = 0.0f;
    float j2DY1 = 0.0f;
    float j2DY2 = 0.0f;
    if (orientation == PlotOrientation.VERTICAL) {
        j2DX1 = (float) domainAxis.valueToJava2D(this.x1, dataArea,
                domainEdge);
        j2DY1 = (float) rangeAxis.valueToJava2D(this.y1, dataArea,
                rangeEdge);
        j2DX2 = (float) domainAxis.valueToJava2D(this.x2, dataArea,
                domainEdge);
        j2DY2 = (float) rangeAxis.valueToJava2D(this.y2, dataArea,
                rangeEdge);
    }
    else if (orientation == PlotOrientation.HORIZONTAL) {
        j2DY1 = (float) domainAxis.valueToJava2D(this.x1, dataArea,
                domainEdge);
        j2DX1 = (float) rangeAxis.valueToJava2D(this.y1, dataArea,
                rangeEdge);
        j2DY2 = (float) domainAxis.valueToJava2D(this.x2, dataArea,
                domainEdge);
        j2DX2 = (float) rangeAxis.valueToJava2D(this.y2, dataArea,
                rangeEdge);
    }
    g2.setPaint(this.paint);
    g2.setStroke(this.stroke);
    Line2D line = new Line2D.Float(j2DX1, j2DY1, j2DX2, j2DY2);
    // line is clipped to avoid JRE bug 6574155, for more info
    // see JFreeChart bug 2221495
    boolean visible = LineUtilities.clipLine(line, dataArea);
    if (visible) {
        g2.draw(line);
    }

    String toolTip = getToolTipText();
    String url = getURL();
    if (toolTip != null || url != null) {
        addEntity(info, ShapeUtilities.createLineRegion(line, 1.0f),
                rendererIndex, toolTip, url);
    }
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:66,代码来源:XYLineAnnotation.java

示例4: draw

import org.jfree.chart.util.LineUtilities; //导入方法依赖的package包/类
/**
 * Draws the annotation.  This method is called by the {@link XYPlot}
 * class, you won't normally need to call it yourself.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param rendererIndex  the renderer index.
 * @param info  if supplied, this info object will be populated with
 *              entity information.
 */
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                 ValueAxis domainAxis, ValueAxis rangeAxis,
                 int rendererIndex,
                 PlotRenderingInfo info) {

    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
            plot.getDomainAxisLocation(), orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
            plot.getRangeAxisLocation(), orientation);
    float j2DX1 = 0.0f;
    float j2DX2 = 0.0f;
    float j2DY1 = 0.0f;
    float j2DY2 = 0.0f;
    if (orientation == PlotOrientation.VERTICAL) {
        j2DX1 = (float) domainAxis.valueToJava2D(this.x1, dataArea,
                domainEdge);
        j2DY1 = (float) rangeAxis.valueToJava2D(this.y1, dataArea,
                rangeEdge);
        j2DX2 = (float) domainAxis.valueToJava2D(this.x2, dataArea,
                domainEdge);
        j2DY2 = (float) rangeAxis.valueToJava2D(this.y2, dataArea,
                rangeEdge);
    }
    else if (orientation == PlotOrientation.HORIZONTAL) {
        j2DY1 = (float) domainAxis.valueToJava2D(this.x1, dataArea,
                domainEdge);
        j2DX1 = (float) rangeAxis.valueToJava2D(this.y1, dataArea,
                rangeEdge);
        j2DY2 = (float) domainAxis.valueToJava2D(this.x2, dataArea,
                domainEdge);
        j2DX2 = (float) rangeAxis.valueToJava2D(this.y2, dataArea,
                rangeEdge);
    }
    g2.setPaint(this.paint);
    g2.setStroke(this.stroke);
    Line2D line = new Line2D.Float(j2DX1, j2DY1, j2DX2, j2DY2);
    // line is clipped to avoid JRE bug 6574155, for more info
    // see JFreeChart bug 2221495
    boolean visible = LineUtilities.clipLine(line, dataArea);
    if (visible) {
        g2.draw(line);
    }

    String toolTip = getToolTipText();
    String url = getURL();
    if (toolTip != null || url != null) {
        addEntity(info, ShapeUtilities.createLineRegion(line, 1.0f),
                rendererIndex, toolTip, url);
    }
}
 
开发者ID:lulab,项目名称:PI,代码行数:65,代码来源:XYLineAnnotation.java

示例5: drawPrimaryLine

import org.jfree.chart.util.LineUtilities; //导入方法依赖的package包/类
/**
 * Draws the item (first pass). This method draws the lines
 * connecting the items.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param plot  the plot (can be used to obtain standard color
 *              information etc).
 * @param dataset  the dataset.
 * @param pass  the pass.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param selected  is the data item selected?
 * @param dataArea  the area within which the data is being drawn.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 *
 * @since 1.2.0
 */
protected void drawPrimaryLine(XYItemRendererState state, Graphics2D g2,
        XYPlot plot, XYDataset dataset, int pass, int series, int item,
        boolean selected, ValueAxis domainAxis, ValueAxis rangeAxis,
        Rectangle2D dataArea) {
    
    if (item == 0) {
        return;
    }

    // get the data point...
    double x1 = dataset.getXValue(series, item);
    double y1 = dataset.getYValue(series, item);
    if (Double.isNaN(y1) || Double.isNaN(x1)) {
        return;
    }

    double x0 = dataset.getXValue(series, item - 1);
    double y0 = dataset.getYValue(series, item - 1);
    if (Double.isNaN(y0) || Double.isNaN(x0)) {
        return;
    }

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation);
    double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation);

    double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
    double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);

    // only draw if we have good values
    if (Double.isNaN(transX0) || Double.isNaN(transY0)
        || Double.isNaN(transX1) || Double.isNaN(transY1)) {
        return;
    }

    PlotOrientation orientation = plot.getOrientation();
    boolean visible = false;
    if (orientation == PlotOrientation.HORIZONTAL) {
        state.workingLine.setLine(transY0, transX0, transY1, transX1);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        state.workingLine.setLine(transX0, transY0, transX1, transY1);
    }
    visible = LineUtilities.clipLine(state.workingLine, dataArea);
    if (visible) {
        drawShape1(g2, pass, series, item, selected, state.workingLine);
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:70,代码来源:XYLineAndShapeRenderer.java

示例6: drawPrimaryLine

import org.jfree.chart.util.LineUtilities; //导入方法依赖的package包/类
/**
 * Draws the item (first pass). This method draws the lines
 * connecting the items.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the area within which the data is being drawn.
 * @param plot  the plot (can be used to obtain standard color
 *              information etc).
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param pass  the pass.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 */
protected void drawPrimaryLine(XYItemRendererState state,
                               Graphics2D g2,
                               XYPlot plot,
                               XYDataset dataset,
                               int pass,
                               int series,
                               int item,
                               ValueAxis domainAxis,
                               ValueAxis rangeAxis,
                               Rectangle2D dataArea) {
    if (item == 0) {
        return;
    }

    // get the data point...
    double x1 = dataset.getXValue(series, item);
    double y1 = dataset.getYValue(series, item);
    if (Double.isNaN(y1) || Double.isNaN(x1)) {
        return;
    }

    double x0 = dataset.getXValue(series, item - 1);
    double y0 = dataset.getYValue(series, item - 1);
    if (Double.isNaN(y0) || Double.isNaN(x0)) {
        return;
    }

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();

    double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation);
    double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation);

    double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
    double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);

    // only draw if we have good values
    if (Double.isNaN(transX0) || Double.isNaN(transY0)
        || Double.isNaN(transX1) || Double.isNaN(transY1)) {
        return;
    }

    PlotOrientation orientation = plot.getOrientation();
    boolean visible = false;
    if (orientation == PlotOrientation.HORIZONTAL) {
        state.workingLine.setLine(transY0, transX0, transY1, transX1);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        state.workingLine.setLine(transX0, transY0, transX1, transY1);
    }
    visible = LineUtilities.clipLine(state.workingLine, dataArea);
    if (visible) {
        drawFirstPassShape(g2, pass, series, item, state.workingLine);
    }
}
 
开发者ID:pablopatarca,项目名称:proyecto-teoria-control-utn-frro,代码行数:72,代码来源:XYLineAndShapeRenderer.java


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