Class ncsa.horizon.awt.Line
java.lang.Object
|
+--java.awt.geom.RectangularShape
|
+--java.awt.geom.Rectangle2D
|
+--java.awt.Rectangle
|
+--ncsa.horizon.awt.Line
- public class Line
- extends java.awt.Rectangle
Line class is a geometry entity represent a line segment vector
with start point and x, y vector components.
Now, it just extends java.awt.Rectangle with Rectangle's x, y as
start point and width, height as x, y vector components.
Since it extends Rectangle, outside objects have access to (x, y),
which is the start point of the Line, and width, height which are
the x, y components of the line.
- See Also:
- Serialized Form
| Inner classes inherited from class java.awt.geom.Rectangle2D |
| java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float |
| Fields inherited from class java.awt.Rectangle |
| height, width, x, y |
| Fields inherited from class java.awt.geom.Rectangle2D |
| OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP |
|
Constructor Summary
|
Line()
Constructs a new Line whose start point is at (0, 0) |
Line(int delta_x,
int delta_y)
Constructs a new Line whose start point is at (0, 0) |
Line(int x,
int y,
int delta_x,
int delta_y)
Constructs a new Line whose start point is at (x, y),
vector componet delta_x, and delta_y |
Line(java.awt.Point p)
Constructs a new line whose start is the
specified point argument and whose x, y components
are 0, 0. |
Line(java.awt.Point p,
int delta_x,
int delta_y)
Constructs a new line whose start is the
specified point argument and whose x, y components
are delta_x, delta_y |
Line(java.awt.Point p1,
java.awt.Point p2)
create a line that spans from one point to another |
|
Method Summary
|
|
java.awt.Point
|
endPoint()
Return a copy of the end point. |
|
int
|
length()
Return line length. |
|
java.awt.Point
|
startPoint()
return a copy of start point. |
| Methods inherited from class java.awt.Rectangle |
| add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getHeight, getLocation, getSize, getWidth, getX, getY, grow, hashCode, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union |
| Methods inherited from class java.awt.geom.Rectangle2D |
| add, add, add, contains, contains, createIntersection, createUnion, equals, getBounds2D, getPathIterator, getPathIterator, intersect, intersectsLine, intersectsLine, intersects, outcode, outcode, setFrame, setRect, setRect, union |
| Methods inherited from class java.awt.geom.RectangularShape |
| clone, contains, contains, contains, contains, getBounds2D, getBounds, getCenterX, getCenterY, getFrame, getHeight, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, getPathIterator, getWidth, getX, getY, intersects, intersects, isEmpty, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal, setFrame, setFrame, setFrame |
| Methods inherited from class java.lang.Object |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Line
public Line()
- Constructs a new Line whose start point is at (0, 0),
vector componet 0, and 0.
Line
public Line(int delta_x,
int delta_y)
- Constructs a new Line whose start point is at (0, 0),
vector componet delta_x, and delta_y
- Parameters:
delta_x
- the Line's x component
delta_y
- the Line's y component
Line
public Line(int x,
int y,
int delta_x,
int delta_y)
- Constructs a new Line whose start point is at (x, y),
vector componet delta_x, and delta_y
- Parameters:
x
- the x coordinate of start point
y
- the y coordinate of start point
delta_x
- the Line's x component
delta_y
- the Line's y component
Line
public Line(java.awt.Point p)
- Constructs a new line whose start is the
specified point argument and whose x, y components
are 0, 0.
- Parameters:
p
- start point
Line
public Line(java.awt.Point p,
int delta_x,
int delta_y)
- Constructs a new line whose start is the
specified point argument and whose x, y components
are delta_x, delta_y
- Parameters:
p
- start point
delta_x
- the Line's x component
delta_y
- the Line's y component
Line
public Line(java.awt.Point p1,
java.awt.Point p2)
- create a line that spans from one point to another
endPoint
public java.awt.Point endPoint()
- Return a copy of the end point.
length
public int length()
- Return line length.
- Returns:
- length of this Line.
startPoint
public java.awt.Point startPoint()
- return a copy of start point.