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


Java Line2D.Double方法代码示例

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


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

示例1: drawVerticalLine

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Utility method for drawing a vertical line on the data area of the plot.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param value  the coordinate, where to draw the line.
 * @param stroke  the stroke to use.
 * @param paint  the paint to use.
 */
protected void drawVerticalLine(Graphics2D g2, Rectangle2D dataArea,
                                double value, Stroke stroke, Paint paint) {

    ValueAxis axis = getDomainAxis();
    if (getOrientation() == PlotOrientation.HORIZONTAL) {
        axis = getRangeAxis();
    }
    if (axis.getRange().contains(value)) {
        double xx = axis.valueToJava2D(value, dataArea, 
                RectangleEdge.BOTTOM);
        Line2D line = new Line2D.Double(xx, dataArea.getMinY(), xx, 
                dataArea.getMaxY());
        g2.setStroke(stroke);
        g2.setPaint(paint);
        g2.draw(line);
    }

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

示例2: drawRangeLine

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Utility method for drawing a line perpendicular to the range axis (used for crosshairs).
 *
 * @param g2  the graphics device.
 * @param dataArea  the area defined by the axes.
 * @param value  the data value.
 * @param stroke  the line stroke.
 * @param paint  the line paint.
 */
protected void drawRangeLine(Graphics2D g2,
                             Rectangle2D dataArea,
                             double value, Stroke stroke, Paint paint) {

    double java2D = getRangeAxis().valueToJava2D(value, dataArea, getRangeAxisEdge());
    Line2D line = null;
    if (this.orientation == PlotOrientation.HORIZONTAL) {
        line = new Line2D.Double(java2D, dataArea.getMinY(), java2D, dataArea.getMaxY());
    }
    else if (this.orientation == PlotOrientation.VERTICAL) {
        line = new Line2D.Double(dataArea.getMinX(), java2D, dataArea.getMaxX(), java2D);
    }
    g2.setStroke(stroke);
    g2.setPaint(paint);
    g2.draw(line);

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

示例3: addRemoveControlPoint

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Adds or removes a control point on a specified location
 * @param localLocation the local location
 */
public void addRemoveControlPoint (Point localLocation) {
    ArrayList<Point> list = new ArrayList<Point> (getControlPoints());
        if(!removeControlPoint(localLocation,list,deleteSensitivity)){
            Point exPoint=null;int index=0;
            for (Point elem : list) {
                if(exPoint!=null){
                    Line2D l2d=new Line2D.Double(exPoint,elem);
                    if(l2d.ptLineDist(localLocation)<createSensitivity){
                        list.add(index,localLocation);
                        break;
                    }
                }
                exPoint=elem;index++;
            }
        }
        setControlPoints(list,false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:FreeConnectionWidget.java

示例4: paint

import java.awt.geom.Line2D; //导入方法依赖的package包/类
@Override
public void paint(Graphics2D g, Bounds aBounds, Diagram diagram) {
    QBounds bounds = (QBounds) aBounds;
    label.setLocation(0, 0);
    Dimension size = new Dimension((int) bounds.getSize().getWidth() - 4,
            (int) bounds.getSize().getHeight());
    label.setPreferredSize(size);
    label.setSize(label.getPreferredSize());
    g.setColor(Color.black);
    Line2D line = new Line2D.Double(8, getMinHeight(), getMinWidth() - 16,
            getMinHeight());
    Stroke stroke = g.getStroke();
    g.setStroke(this.stroke);
    g.draw(line);
    g.setStroke(stroke);
    paintText(g);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:18,代码来源:Label.java

示例5: drawHorizontalLine

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Utility method for drawing a horizontal line across the data area of the plot.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param value  the coordinate, where to draw the line.
 * @param stroke  the stroke to use.
 * @param paint  the paint to use.
 */
protected void drawHorizontalLine(Graphics2D g2, Rectangle2D dataArea,
                                  double value, Stroke stroke, Paint paint) {

    ValueAxis axis = getRangeAxis();  
    if (getOrientation() == PlotOrientation.HORIZONTAL) {
        axis = getDomainAxis();   
    }
    if (axis.getRange().contains(value)) {
        double yy = axis.valueToJava2D(value, dataArea, RectangleEdge.LEFT);
        Line2D line = new Line2D.Double(dataArea.getMinX(), yy, dataArea.getMaxX(), yy);
        g2.setStroke(stroke);
        g2.setPaint(paint);
        g2.draw(line);
    }

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

示例6: XYLineAndShapeRenderer

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Creates a new renderer.
 * 
 * @param lines  lines visible?
 * @param shapes  shapes visible?
 */
public XYLineAndShapeRenderer(boolean lines, boolean shapes) {
    this.linesVisible = null;
    this.seriesLinesVisible = new BooleanList();
    this.baseLinesVisible = lines;
    this.legendLine = new Line2D.Double(-7.0, 0.0, 7.0, 0.0);
    
    this.shapesVisible = null;
    this.seriesShapesVisible = new BooleanList();
    this.baseShapesVisible = shapes;
    
    this.shapesFilled = null;
    this.useFillPaint = false;     // use item paint for fills by default
    this.seriesShapesFilled = new BooleanList();
    this.baseShapesFilled = true;

    this.drawOutlines = true;     
    this.useOutlinePaint = false;  // use item paint for outlines by 
                                   // default, not outline paint
    
    this.drawSeriesLineAsPath = false;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:XYLineAndShapeRenderer.java

示例7: drawRangeCrosshair

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Draws a range crosshair.
 * 
 * @param g2  the graphics target.
 * @param dataArea  the data area.
 * @param orientation  the plot orientation.
 * @param value  the crosshair value.
 * @param axis  the axis against which the value is measured.
 * @param stroke  the stroke used to draw the crosshair line.
 * @param paint  the paint used to draw the crosshair line.
 * 
 * @since 1.0.4
 */
protected void drawRangeCrosshair(Graphics2D g2, Rectangle2D dataArea, 
        PlotOrientation orientation, double value, ValueAxis axis, 
        Stroke stroke, Paint paint) {
    
    if (axis.getRange().contains(value)) {
        Line2D line = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            double xx = axis.valueToJava2D(value, dataArea, 
                    RectangleEdge.BOTTOM);
            line = new Line2D.Double(xx, dataArea.getMinY(), xx, 
                    dataArea.getMaxY());
        }
        else {
            double yy = axis.valueToJava2D(value, dataArea, 
                    RectangleEdge.LEFT);
            line = new Line2D.Double(dataArea.getMinX(), yy, 
                    dataArea.getMaxX(), yy);
        }
        g2.setStroke(stroke);
        g2.setPaint(paint);
        g2.draw(line);
    }
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:XYPlot.java

示例8: StackedXYAreaRendererState

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Creates a new state for the renderer.
 * 
 * @param info  the plot rendering info.
 */
public StackedXYAreaRendererState(PlotRenderingInfo info) {
    super(info);
    this.seriesArea = null;
    this.line = new Line2D.Double();
    this.lastSeriesPoints = new Stack();
    this.currentSeriesPoints = new Stack();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:StackedXYAreaRenderer.java

示例9: mouseMoved

import java.awt.geom.Line2D; //导入方法依赖的package包/类
public void mouseMoved( MouseEvent evt ) {
	if(selected || evt.isControlDown())return;
	if( map.getCursor() != cursor ) map.setCursor( cursor );
	if( points.size()==0 )return;
	drawSeg();
	double[] xyz = (double[])points.get(points.size()-1);
	Point2D.Double pt = new Point2D.Double(xyz[0], xyz[1]);
	currentSeg = new Line2D.Double( pt,
			map.getScaledPoint( evt.getPoint() ) );
	drawSeg();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:12,代码来源:LineSegmentsObject.java

示例10: free

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/** Returns true if a direct line between a and b will not intersect any other node. */
private boolean free(GraphNode a, GraphNode b) {
   if (a.layer() > b.layer()) { GraphNode tmp=a; a=b; b=tmp; }
   Line2D.Double line = new Line2D.Double(a.x(), a.y(), b.x(), b.y());
   for(GraphNode n:nodes) if (n!=a && n!=b && a.layer()<n.layer() && n.layer()<b.layer() && n.shape()!=null) {
      if (line.intersects(n.getBoundingBox(10,10))) return false;
   }
   return true;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:10,代码来源:Graph.java

示例11: drag

import java.awt.geom.Line2D; //导入方法依赖的package包/类
void drag(MouseEvent e) {
	if (p0==null) { begin(e); return; }
	drawLine();
	Point2D p = map.getScaledPoint(e.getPoint());
	currentLine = new Line2D.Double(map.getScaledPoint(p0), p);
	Point2D[] pts = getPath(currentLine, 5);
	currentPath =  getGeneralPath(pts);
	drawLine();
	java.text.NumberFormat fmt = java.text.NumberFormat.getInstance();
	fmt.setMaximumFractionDigits(2);

	map.setXY(e.getPoint());
	map.getMapTools().setInfoText( map.getMapTools().getInfoText() + ", distance = " +
			fmt.format(distance(pts)) +" km");
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:16,代码来源:GMAProfile.java

示例12: drawOccupiedPercentage

import java.awt.geom.Line2D; //导入方法依赖的package包/类
private void drawOccupiedPercentage(Color startC, Color border, boolean gradientFill, Graphics2D g2d) {

		if (remainingTime[0] != 0) {
			double x = getProcessorXY().x, y = getProcessorXY().y;
			occupiedRect = new Rectangle2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD * (1 - (double) remainingTime[0] / (double) totTime[0]));
			occupiedEll = new Ellipse2D.Double(x, y, 2 * PROC_RAD, 2 * PROC_RAD);
			if (gradientFill) {
				GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
						false);
				g2d.setPaint(gp);
			} else {
				g2d.setPaint(startC);
			}
			occupiedArea = new Area(occupiedEll);
			occupiedArea.subtract(new Area(occupiedRect));
			g2d.fill(occupiedArea);
			g2d.setPaint(Color.BLACK);
			g2d.draw(occupiedArea);

			// draw orizontal line parallel to occupation
			Line2D.Double l = new Line2D.Double(x + PROC_RAD * 2 + ELEMS_GAP, y + PROC_RAD * 2
					* (1 - (double) remainingTime[0] / (double) totTime[0]), x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2
					* (1 - (double) remainingTime[0] / (double) totTime[0]));
			g2d.draw(l);

			// draw vertical line
			l = new Line2D.Double(x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2 * (1 - (double) remainingTime[0] / (double) totTime[0]), x
					+ PROC_RAD * 2 + 2 * ELEMS_GAP, y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2);
			g2d.draw(l);

			// draw horizontal line under text
			txtBounds.setFrame(x + PROC_RAD - txtBounds.getWidth() / 2, y + 2 * PROC_RAD + 4 * ELEMS_GAP - txtBounds.getHeight() / 2, txtBounds
					.getWidth(), txtBounds.getHeight());

			g2d.draw(txtBounds);
		}
	}
 
开发者ID:max6cn,项目名称:jmt,代码行数:38,代码来源:QueueDrawer.java

示例13: drawOccupiedPercentage2

import java.awt.geom.Line2D; //导入方法依赖的package包/类
private void drawOccupiedPercentage2(Color startC, Color border, boolean gradientFill, Graphics2D g2d, int cpu) {
	//processor.setFrame(x+PROC_RAD/2 , y + cpu*PROC_RAD, 2 * PROC_RAD /2, 2 * PROC_RAD /2);

	//		if (remainingTime[cpu] != 0) {
	double x = getProcessorXY().x, y = getProcessorXY().y;
	occupiedRect = new Rectangle2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD
			* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2);
	occupiedEll = new Ellipse2D.Double(x + PROC_RAD / 2, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2, 2 * PROC_RAD / 2, 2 * PROC_RAD / 2);
	if (gradientFill) {
		GradientPaint gp = new GradientPaint((float) x, (float) y, startC.brighter(), (float) x, (float) (y + 2 * PROC_RAD), startC.darker(),
				false);
		g2d.setPaint(gp);
	} else {
		g2d.setPaint(startC);
	}
	occupiedArea = new Area(occupiedEll);
	occupiedArea.subtract(new Area(occupiedRect));
	g2d.fill(occupiedArea);
	g2d.setPaint(Color.BLACK);
	g2d.draw(occupiedArea);

	// draw orizontal line parallel to occupation
	Line2D.Double l = new Line2D.Double(x + PROC_RAD * 2 + ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
			* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2,//y + PROC_RAD * 2 * (1 - (double) remainingTime / (double) totTime) /2 + ELEMS_GAP * cpu -  ELEMS_GAP /2  , 
			x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
					* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2);//y + PROC_RAD * 2 * (1 - (double) remainingTime / (double) totTime) /2 + ELEMS_GAP * cpu -  ELEMS_GAP /2 );
	g2d.draw(l);

	// draw vertical line
	l = new Line2D.Double(x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + cpu * PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2 + 2 * PROC_RAD
			* (1 - (double) remainingTime[cpu] / (double) totTime[cpu]) / 2, x + PROC_RAD * 2 + 2 * ELEMS_GAP, y + PROC_RAD * 2 / 2 + cpu
			* PROC_RAD + ELEMS_GAP * cpu - ELEMS_GAP / 2);
	g2d.draw(l);

	//		}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:37,代码来源:QueueDrawer.java

示例14: draw

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * 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,代码行数:42,代码来源:CyclicNumberAxis.java

示例15: drawDomainGridline

import java.awt.geom.Line2D; //导入方法依赖的package包/类
/**
 * Draws a grid line against the domain axis.
 * <P>
 * Note that this default implementation assumes that the horizontal axis
 * is the domain axis. If this is not the case, you will need to override
 * this method.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area for plotting data (not yet adjusted for any
 *                  3D effect).
 * @param value  the Java2D value at which the grid line should be drawn.
 *
 * @see #drawRangeGridline(Graphics2D, CategoryPlot, ValueAxis,
 *     Rectangle2D, double)
 */
public void drawDomainGridline(Graphics2D g2,
                               CategoryPlot plot,
                               Rectangle2D dataArea,
                               double value) {

    Line2D line = null;
    PlotOrientation orientation = plot.getOrientation();

    if (orientation == PlotOrientation.HORIZONTAL) {
        line = new Line2D.Double(dataArea.getMinX(), value,
                dataArea.getMaxX(), value);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        line = new Line2D.Double(value, dataArea.getMinY(), value,
                dataArea.getMaxY());
    }

    Paint paint = plot.getDomainGridlinePaint();
    if (paint == null) {
        paint = CategoryPlot.DEFAULT_GRIDLINE_PAINT;
    }
    g2.setPaint(paint);

    Stroke stroke = plot.getDomainGridlineStroke();
    if (stroke == null) {
        stroke = CategoryPlot.DEFAULT_GRIDLINE_STROKE;
    }
    g2.setStroke(stroke);

    g2.draw(line);

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


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