|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fdda.graphics.java2d.Component | +--fdda.graphics.java2d.LineSegment
A LineSegment is a segment of a line, bordered either by a point or by a node. The coordinates are the coordinates of the start point.
Field Summary |
Fields inherited from class fdda.graphics.java2d.Component |
COLOR_NORMAL, COLOR_SELECTED, dirtyShape, selected, shape, x, y |
Fields inherited from interface fdda.graphics.Component |
SEL_ALL, SEL_EQUALS, SEL_MOVABLES, SEL_NOTHING |
Constructor Summary | |
LineSegment(double startX,
double startY,
double endX,
double endY)
Constructor |
Method Summary | |
protected void |
calcShape()
Recalculates the shape. |
Object |
clone()
Clones the component |
void |
draw(Graphics2D graphContext)
Draws the component, using the given graphics. |
double |
getEndX()
Returns the x coordinate of the end point |
double |
getEndY()
Returns the y coordinate of the end point |
double |
getLength()
Returns the length of the segment |
boolean |
isMovable()
Returns false. |
void |
move(double x,
double y)
Moves both start and end point. |
void |
moveIn(double x,
double y)
Moves the start point. |
void |
moveOut(double x,
double y)
Moves the end point. |
int |
selectableWith()
Returns SEL_EQUALS |
void |
setEndXY(double x,
double y)
Resets the end point. |
void |
setXY(double x,
double y)
Sets the coordinates of the component (or of its most prominent point). |
Object |
visit(ComponentVisitor visitor)
Calls visitLineSegment according to visitor pattern. |
Methods inherited from class fdda.graphics.java2d.Component |
deselect, getGraphicalSystem, getShape, getX, getY, isSelected, recalculateShape, select, setGraphicalSystem |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LineSegment(double startX, double startY, double endX, double endY)
startX
- x coordinate of start pointstartY
- y coordinate of start pointendX
- x coordinate of end pointendY
- y coordinate of end pointMethod Detail |
public Object clone()
Component
clone
in interface Component
clone
in class Component
public void draw(Graphics2D graphContext)
Component
draw
in class Component
graphContext
- the graphicspublic double getEndX()
public double getEndY()
public double getLength()
public void move(double x, double y)
x
- offset for move in x directiony
- offset for move in y directionComponent.move(double, double)
public void moveIn(double x, double y)
x
- offset for x coordinatey
- offset for y coordinatepublic void moveOut(double x, double y)
x
- offset for x coordinatey
- offset for y coordinatepublic void setXY(double x, double y)
Component
setXY
in interface Component
setXY
in class Component
x
- the x coordinatey
- the y coordinatepublic void setEndXY(double x, double y)
x
- the new x coordinate of the end pointy
- the new y coordinate of the end pointprotected void calcShape()
Component
calcShape
in class Component
public boolean isMovable()
Component.isMovable()
public int selectableWith()
Component.selectableWith()
public Object visit(ComponentVisitor visitor)
visitor
- the visitor
Component.visit(fdda.graphics.ComponentVisitor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |