|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread jsim.animator.AnimationImp
public class AnimationImp
This class implements the Animation front end for the JSIM Simulation package. It uses a shared data Structure to receive AnimatorMessages from the Simulator and then repaints the Animation to reflect these changes.
Nested Class Summary | |
---|---|
class |
AnimationImp.AnimationFrame
Frame class for holding the components of the Animation |
class |
AnimationImp.AnimationPanel
Panel Class for holding Animation components |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected static java.util.logging.Logger |
trc
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
AnimationImp(Graph g,
AnimationQueue q)
Constructor Initializes all dataMembers |
|
AnimationImp(Graph g,
AnimationQueue q,
Model env)
Constructor Initializes all dataMembers |
Method Summary | |
---|---|
void |
beginSim()
Begins the Animation by setting start to true |
void |
changeSpeed(int value)
Controls the speed of the Animation |
void |
create(int shapeID,
java.lang.String shape,
java.awt.Label l,
double x,
double y,
double w,
double h,
double arcW,
double arcH,
double x2,
double y2,
int type,
double time)
Adds a Shape at given location Shapes: Line2D, QuadCurve2D, CubicCurve2D, Rectangle2D, RoundRectangle2D, Arc2D, Ellipse2D Qparam shapeID id for the new Shape |
void |
dequeueEntity(int shapeID,
double time)
Dequeues an entity |
void |
destroy(int shapeID,
double time)
Destroys a Shape based on ShapeID |
void |
endSim()
Ends the Animation by setting end to true |
void |
enqueueEntity(int shapeID,
double time)
Enqueues an entity |
void |
executeInstruction()
Gets an instruction from the shared queue and performs the instruction |
void |
incrementLost()
Increments the number of lost entities |
static void |
main(java.lang.String[] args)
Main Function used for testing purposes |
void |
move(int shapeID,
int edgeID,
int endNodeID,
double time)
Moves an entity from a starting node to an ending node along a given edge |
void |
rotate(int shapeID,
double theta,
double x,
double y,
double time)
Rotates a shape |
void |
run()
run() Responsible for the main control loop of the Animation Creates the Frame and Panel, then sleeps and repaints until the animation is through |
void |
scale(int shapeID,
double sx,
double sy,
double time)
Scales a Shape |
void |
setPaint(int shapeID,
java.awt.Color c1,
java.awt.Color c2,
double time)
Paint Method for gradient color, uses 2 Color arguments |
void |
setPaint(int shapeID,
java.awt.Color c,
double time)
Paint Method for solid color, uses 1 Color argument |
void |
setToLocation(int shapeID,
double x_location,
double y_location)
Moves an entity to the specified location |
void |
shear(int shapeID,
double shx,
double shy,
double time)
Shears a Shape |
void |
translate(int shapeID,
double tx,
double ty,
double time)
Translates a Shape to a new (x,y) location |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static java.util.logging.Logger trc
Constructor Detail |
---|
public AnimationImp(Graph g, AnimationQueue q)
g
- initial Graph for animationq
- Animation queue for communication with Simulatorpublic AnimationImp(Graph g, AnimationQueue q, Model env)
g
- initial Graph for animationq
- Animation queue for communication with Simulatorenv
- creating Model objectMethod Detail |
---|
public void create(int shapeID, java.lang.String shape, java.awt.Label l, double x, double y, double w, double h, double arcW, double arcH, double x2, double y2, int type, double time)
create
in interface Animator
shape
- Shape of the objectl
- Label for the created Shapex
- x-coordinate of the locationy
- y-coordinate of the locationw
- width of the shapeh
- height of the shapearcW
- arc width for curvesarcH
- arc height for curvesx2
- double needed for some shapesy2
- double needed for some shapestype
- type needed for certian shapestime
- Simulation timeshapeID
- id for the new Shapepublic void destroy(int shapeID, double time)
destroy
in interface Animator
shapeID
- id of the Shape to destroytime
- SImulation timepublic void incrementLost()
public void translate(int shapeID, double tx, double ty, double time)
translate
in interface Animator
shapeID
- id of Shape to translatetx
- new x-coordinatety
- new y-coordinatetime
- Simulation timepublic void rotate(int shapeID, double theta, double x, double y, double time)
rotate
in interface Animator
shapeID
- id of Shape to tanslatetheta
- angle of rotationx
- new x-coordinatey
- new y-coordinatetime
- Simulation timepublic void scale(int shapeID, double sx, double sy, double time)
scale
in interface Animator
shapeID
- id of Shape to scalesx
- scaled x-coordinatesy
- scaled y-coordiantetime
- simulation timepublic void shear(int shapeID, double shx, double shy, double time)
shear
in interface Animator
shapeID
- id of Shape to shearshx
- scaled x-coordinateshy
- scaled y-cooordinatetime
- Simulation timepublic void setPaint(int shapeID, java.awt.Color c, double time)
setPaint
in interface Animator
shapeID
- id for Shape to paintc
- Color for the Shapetime
- Simulation timepublic void setPaint(int shapeID, java.awt.Color c1, java.awt.Color c2, double time)
setPaint
in interface Animator
shapeID
- id for SHape to paintc1
- 1st Color for Shapec2
- 2nd Color for Shapetime
- Simulation timepublic void move(int shapeID, int edgeID, int endNodeID, double time)
shapeID
- id for Shape to moveedgeID
- id for edge to move alongendNodeID
- id of end nodetime
- Simulation timepublic void setToLocation(int shapeID, double x_location, double y_location)
shapeID
- id of shape to movex_location
- new x-coordinatey_location
- new y-coordinatepublic void beginSim()
public void endSim()
public void changeSpeed(int value)
value
- the value used to adjust speedpublic void enqueueEntity(int shapeID, double time)
shapeID
- id of the entitytime
- time in simulationpublic void dequeueEntity(int shapeID, double time)
shapeID
- id of the entitytime
- time in simulationpublic void executeInstruction()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |