fdda.graphics.java2d
Class Point

java.lang.Object
  |
  +--fdda.graphics.java2d.Component
        |
        +--fdda.graphics.java2d.Point
All Implemented Interfaces:
Cloneable, Component

public class Point
extends Component

Represents a point on a line. The point appears as a small black rectangle; the coordinates are the middle point of this rectangle.

Author:
Jörg Rüdenauer

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
Point(double x, double y)
          Default constructor.
Point(double x, double y, boolean selected)
          Constructor
 
Method Summary
protected  void calcShape()
          Recalculates the shape.
 void draw(Graphics2D graphContext)
          Draws the component, using the given graphics.
 Line getLine()
          Returns the line that contains the point.
 boolean isMovable()
          Returns true.
 void move(double x, double y)
          Move the component (or its most prominent point).
 int selectableWith()
          Returns SEL_ALL.
 void setLine(Line line)
          Sets the line that contains the point.
 Object visit(ComponentVisitor visitor)
          Calls visitPoint according to visitor pattern.
 
Methods inherited from class fdda.graphics.java2d.Component
clone, deselect, getGraphicalSystem, getShape, getX, getY, isSelected, recalculateShape, select, setGraphicalSystem, setXY
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Point

public Point(double x,
             double y)
Default constructor. Point is not selected.

Parameters:
x - the x coordinate
y - the y coordinate

Point

public Point(double x,
             double y,
             boolean selected)
Constructor

Parameters:
x - the x coordinate
y - the y coordinate
selected - whether the point shall be selected
Method Detail

getLine

public Line getLine()
Returns the line that contains the point.

Returns:
the line

setLine

public void setLine(Line line)
Sets the line that contains the point.

Parameters:
line - the line

move

public void move(double x,
                 double y)
Description copied from interface: Component
Move the component (or its most prominent point).

Parameters:
x - offset for move in x direction
y - offset for move in y direction

draw

public void draw(Graphics2D graphContext)
Description copied from class: Component
Draws the component, using the given graphics. The graphics should have the same attributes (color, pen, etc.) after the call as before the call.

Specified by:
draw in class Component
Parameters:
graphContext - the graphics

isMovable

public boolean isMovable()
Returns true.

Returns:
true, iff the user can move the component
See Also:
Component.isMovable()

selectableWith

public int selectableWith()
Returns SEL_ALL.

Returns:
constant indicating the selection class
See Also:
Component.selectableWith()

visit

public Object visit(ComponentVisitor visitor)
Calls visitPoint according to visitor pattern.

Parameters:
visitor - the visitor
Returns:
specific to subclass
See Also:
Component.visit(fdda.graphics.ComponentVisitor)

calcShape

protected void calcShape()
Description copied from class: Component
Recalculates the shape. Is called by getShape if the flag dirtyShape is set. Must unset the flag after calculation.

Specified by:
calcShape in class Component


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.