|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdevisor2.foundation.GridItem
This is the abstract superclass for EVERYTHING that can be displayed, modified or messed with on the DrawingArea. It provides abstract method definitions which are common to all grid items: All grid items must be able to draw themselves, perform an affine transformation on themselves, they must calculate their own perimeter etc etc.
Field Summary | |
protected ControlCenter |
cc
the all-important ControlCenter reference |
protected boolean |
marked
flag to indicate if the item is currently selected |
protected boolean |
transformed
flag to indicate that in the currect transform step, this item has already been performed. |
protected int |
xmax
for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the updateInnerData()<\code> method |
protected int |
xmin
for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the updateInnerData()<\code> method |
protected int |
ymax
for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the updateInnerData()<\code> method |
protected int |
ymin
for better performance, the extremal coordinates of the grid item are stored as separate variables and are updated via the updateInnerData()<\code> method |
Constructor Summary | |
GridItem()
superconstructor just sets references correctly |
Method Summary | |
void |
clearTransformedFlag()
clears the "a transformation has already been performed"-flag |
abstract void |
draw(java.awt.Graphics g)
in this method, the item paints itself to the given graphics context |
abstract double[] |
getParameters()
returns all parameters of the griditem in an int array |
abstract java.awt.Rectangle |
getPerimeter()
This method returns the perimeter of the item, that is the smallest bounding rectangle the item lies is completely inside of. |
abstract boolean |
isHit(int x,
int y)
Determines if the item has been hit by a click on the grid ALL IN SCREEN COORDINATES to avoid the snap mechanism |
abstract boolean |
isInside(int[] topleft,
int[] bottomright)
Is the item inside a given rectangular area? All in WORLD COORDINATES!!! |
boolean |
isMarked()
returns if the item is selected |
abstract void |
performMirror(double nx,
double ny,
double px,
double py)
This method mirrors the grid item at the given line |
abstract void |
performTransformation(GridTransformation trafo)
This method performs the given affine transformation (in homogenous world coordinates) on the grid item and updates its position and appearance |
void |
setMarker()
marks the item as selected |
void |
setMarker(boolean m)
sets the marker variable directly |
abstract void |
setParameters(double[] para)
sets all parameters of the GridItem according to the given int array |
void |
unsetMarker()
marks the item as unselected |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ControlCenter cc
protected boolean marked
protected boolean transformed
protected int xmin
updateInnerData()<\code> method
protected int xmax
updateInnerData()<\code> method
protected int ymin
updateInnerData()<\code> method
protected int ymax
updateInnerData()<\code> method
Constructor Detail |
public GridItem()
Method Detail |
public void clearTransformedFlag()
public void setMarker()
public void unsetMarker()
public boolean isMarked()
public void setMarker(boolean m)
public abstract void draw(java.awt.Graphics g)
public abstract boolean isInside(int[] topleft, int[] bottomright)
topleft
- - the topleft corner of the rectanglebottomright
- - the bottom right corner of the rectangle
public abstract boolean isHit(int x, int y)
public abstract double[] getParameters()
public abstract void setParameters(double[] para)
public abstract java.awt.Rectangle getPerimeter()
public abstract void performTransformation(GridTransformation trafo)
trafo
- - a GridTransform instance representing the transformationpublic abstract void performMirror(double nx, double ny, double px, double py)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |