java.awt.geom

Class Line2D.Double

Enclosing Class:
Line2D
Implemented Interfaces:
Cloneable, Shape

public static class Line2D.Double
extends Line2D

A line segment specified with double coordinates.

Nested Class Summary

Nested classes/interfaces inherited from class java.awt.geom.Line2D

Line2D.Double, Line2D.Float

Field Summary

double
x1
The X coordinate of the start point of the line segment.
double
x2
The X coordinate of the end point of the line segment.
double
y1
The Y coordinate of the start point of the line segment.
double
y2
The Y coordinate of the end point of the line segment.

Constructor Summary

Double()
Constructs and initializes a Line with coordinates (0, 0) -> (0, 0).
Double(double X1, double Y1, double X2, double Y2)
Constructs and initializes a Line2D from the specified coordinates.
Double(Point2D p1, Point2D p2)
Constructs and initializes a Line2D from the specified Point2D objects.

Method Summary

Rectangle2D
getBounds2D()
Returns the high-precision bounding box of this Line2D.
Point2D
getP1()
Returns the starting Point2D of this Line2D.
Point2D
getP2()
Returns the end Point2D of this Line2D.
double
getX1()
Returns the X coordinate of the start point in double precision.
double
getX2()
Returns the X coordinate of the end point in double precision.
double
getY1()
Returns the Y coordinate of the start point in double precision.
double
getY2()
Returns the Y coordinate of the end point in double precision.
void
setLine(double X1, double Y1, double X2, double Y2)
Sets the location of the endpoints of this Line2D to the specified double coordinates.

Methods inherited from class java.awt.geom.Line2D

clone, contains, contains, contains, contains, getBounds, getP1, getP2, getPathIterator, getPathIterator, getX1, getX2, getY1, getY2, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine, setLine

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

x1

public double x1
The X coordinate of the start point of the line segment.

x2

public double x2
The X coordinate of the end point of the line segment.

y1

public double y1
The Y coordinate of the start point of the line segment.

y2

public double y2
The Y coordinate of the end point of the line segment.

Constructor Details

Double

public Double()
Constructs and initializes a Line with coordinates (0, 0) -> (0, 0).
Usages and Demos :

View More Examples of Double()
   1:         super(info);
   2:         this.workingLine = new Line2D.Double();
   3:     }
   4:     
   5: }

View Full Code Here
   1:         super(info);
   2:         this.workingLine = new Line2D.Double();
   3:     }
   4:     
   5: }

View Full Code Here
   1: 
   2:         Line2D shape = new Line2D.Double();
   3: 
   4:         double x = plotArea.getMinX() + (plotArea.getWidth() / 2);
   5:         shape.setLine(x, plotArea.getMinY(), x, plotArea.getMaxY());

View Full Code Here
   1: 
   2:   protected Line2D line = new Line2D.Double();
   3:   protected TPoint end1 = new LineEnd();
   4:   protected TPoint end2 = new LineEnd();
   5:   protected Rectangle end1Rect = new Rectangle(0, 0, 8, 8);

View Full Code Here
   1:     TTrack track;
   2:   protected Line2D xAxis = new Line2D.Double();
   3:         ...
   4:   protected Line2D yAxis = new Line2D.Double();
   5:   protected Point xEnd1 = new Point(), xEnd2 = new Point();
   6:   protected Point yEnd1 = new Point(), yEnd2 = new Point();
   7:     boolean drawX, drawY;

View Full Code Here

Double

public Double(double X1,
              double Y1,
              double X2,
              double Y2)
Constructs and initializes a Line2D from the specified coordinates.
Parameters:
Usages and Demos :

View More Examples of Double(double X1,double Y1,double X2,double Y2)
   1:         
   2:         Rectangle2D r= new Rectangle2D.Double(10.0,80.0,10.0,10.0);
   3:         Point2D pa = new Point2D.Double(0.0, 100.0);
   4:         ...
   5:         
   6:         Rectangle2D r0= new Rectangle2D.Double(0.0,0.0,100.0,100.0);
   7:         ...
   8:         Line2D l0 = new Line2D.Double(-10.0,50.0,110.0,50.0);
   9:         Point2D p0[] = AlgoRectangle2D.intersectionRectangleLine(r0,l0);

View Full Code Here
   1:   public InteractiveArrow(double x, double y, double w, double h) {
   2:     super(new Line2D.Double(0, 0, w, h), x, y);
   3:     theta = (w==0) ? 0 : Math.atan2(h, w);
   4:         ...
   5:     double dy = len*Math.sin(theta);
   6:     shape = new Line2D.Double(this.x, this.y, this.x+dx, this.y+dy);
   7:     shape = AffineTransform.getTranslateInstance(x, y).createTransformedShape(shape);
   8:         ...
   9:       double dy = y-this.y;
  10:       shape = new Line2D.Double(this.x, this.y, this.x+dx, this.y+dy);
  11:       width = dx;

View Full Code Here
   1:   public InteractiveCenteredArrow(double x, double y, double w, double h) {
   2:     super(new Line2D.Double(-w/2, -h/2, w/2, h/2), x, y);
   3:     theta = (w==0) ? 0 : Math.atan2(h, w);
   4:         ...
   5:     double dy = len*Math.sin(theta);
   6:     shape = new Line2D.Double(this.x-dx, this.y-dy, this.x+dx, this.y+dy);
   7:     width = 2*dx;
   8:         ...
   9:       double dy = y-this.y;
  10:       shape = new Line2D.Double(this.x-dx, this.y-dy, this.x+dx, this.y+dy);
  11:       width = 2*dx;

View Full Code Here
   1:       double h = pf.getImageableHeight();
   2:       g2.draw(new Line2D.Double(0, 0, 0, C));
   3:         ...
   4:       g2.draw(new Line2D.Double(0, 0, C, 0));
   5:         ...
   6:       g2.draw(new Line2D.Double(w, 0, w, C));
   7:       g2.draw(new Line2D.Double(w, 0, w - C, 0));

View Full Code Here
   1: 
   2:     private transient Icon objectIcon = getIcon(new Line2D.Double(-4, 0, 4, 0), false, true);
   3: 
   4:         ...
   5:             Shape shape = null;
   6:             shape = new Rectangle2D.Double(x1 - 4, y1 - 4, 8.0, 8.0);
   7:             this.objectIcon.paintIcon(null, g2, (int) x1, (int) y1);
   8:         ...
   9:                     g2.setStroke(this.groupStroke);
  10:                     g2.draw(new Line2D.Double(x1, this.min, x1, this.max));
  11:                     this.minIcon.paintIcon(null, g2, (int) x1, (int) this.min);

View Full Code Here

Double

public Double(Point2D p1,
              Point2D p2)
Constructs and initializes a Line2D from the specified Point2D objects.
Parameters:
Usages and Demos :

View More Examples of Double(Point2D p1,Point2D p2)
   1:             double x = util.xd.get(i);
   2:             f.draw(new Line2D.Double(x, util.calcCarrier(x), x, util.calcWire(x)));
   3:         }
   4:     }

View Full Code Here
   1:          RADIUS - handLength * Math.sin(angle));
   2:       Point2D center = new Point2D.Double(RADIUS, RADIUS);
   3:         ...
   4:       g2.draw(new Line2D.Double(center, end));
   5:    }
   6:    
   7:    public void setTime(int h, int m)

View Full Code Here
   1:     for (int i=0; i <= 5; i++) {
   2:       g2.draw(new Line2D.Double(40,dim.height-60-(i*60), 
   3:                                 dim.width-40, dim.height-60-(i*60)));
   4:     }

View Full Code Here
   1:     protected Shape getShape(Point2D source, Point2D destination) {
   2:         return new Line2D.Double(source, destination);
   3:     }
   4: 
   5:     protected abstract AbstractVectorLayerFinder createVectorLayerFinder(LayerManagerProxy layerManagerProxy);

View Full Code Here
   1:     protected Shape getShape(Point2D source, Point2D destination) {
   2:         return new Line2D.Double(source, destination);
   3:     }
   4: 
   5:     protected void add(Coordinate c) {

View Full Code Here

Method Details

getBounds2D

public Rectangle2D getBounds2D()
Returns the high-precision bounding box of this Line2D.
Specified by:
getBounds2D in interface Shape
Returns:
a Rectangle2D that is the high-precision bounding box of this Line2D.

getP1

public Point2D getP1()
Returns the starting Point2D of this Line2D.
Overrides:
getP1 in interface Line2D
Returns:
the starting Point2D of this Line2D

getP2

public Point2D getP2()
Returns the end Point2D of this Line2D.
Overrides:
getP2 in interface Line2D
Returns:
the ending Point2D of this Line2D.

getX1

public double getX1()
Returns the X coordinate of the start point in double precision.
Overrides:
getX1 in interface Line2D
Returns:
the X coordinate of this Line2D object's starting point.

getX2

public double getX2()
Returns the X coordinate of the end point in double precision.
Overrides:
getX2 in interface Line2D
Returns:
the X coordinate of this Line2D object's ending point.

getY1

public double getY1()
Returns the Y coordinate of the start point in double precision.
Overrides:
getY1 in interface Line2D
Returns:
the X coordinate of this Line2D object's starting point.

getY2

public double getY2()
Returns the Y coordinate of the end point in double precision.
Overrides:
getY2 in interface Line2D
Returns:
the Y coordinate of this Line2D object's starting point.

setLine

public void setLine(double X1,
                    double Y1,
                    double X2,
                    double Y2)
Sets the location of the endpoints of this Line2D to the specified double coordinates.
Overrides:
setLine in interface Line2D
Parameters: