Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

GState Class Reference

Graphical Object of a state. More...

#include <GState.h>

Inheritance diagram for GState::

State GObject List of all members.

Public Methods

 GState (Machine *m, const QString, QString, int, double, double, int, QPen, bool end)
 Constructor. More...

 GState (Machine *m)
 Constructor. More...

 GState ()
 Constructor.

QPen & getPen ()
 Returns pen to draw the state.

void setPen (const QPen &p)
 Sets the pen to draw the state.

QBrush & getBrush ()
 Returns the brush to draw the state.

void setBrush (const QBrush &b)
 Sets the brush to draw the state.

int getRadius ()
 Returns the radius.

void setRadius (const int r)
 Sets the radius.

int getLineWidth ()
 Returns the linewidth.

void setLineWidth (const int l)
 Sets the line width.

QColor getColor ()
 Returns the color of the state.

void setColor (QColor c)
 Sets the color of the state.

void copyTransitions (GState *, bool=FALSE)
 Makes a deep copy of the transitions of a state. More...

void copyTransitionAttributes (GState *, QList< GTransition > *)
 Copys the attributes of transitions. More...

void copyAttributes (GState *)
 Copys attributes of the state s.

void debugTransitions ()
 Used for debugging.

void addTransition (Project *, GState *, TransitionInfo *, double, double, double, double, double, double, double, double, QString, bool straight=TRUE, bool withundo=TRUE)
 Adds a new transition in this state. More...

void addTransition (Project *, GTransition *t, bool withundo=TRUE)
 Adds a transition to the state. More...

void move (double, double, ScrollView *, Machine *m, bool redraw=TRUE, bool firstRedraw=FALSE)
 Moves the state. More...

void removeTransition (GTransition *)
 Removes the transition trem from the list of this state.

void removeTransitionEnd (GTransition *)
 Removes the transition trem which ends at this state from the list.

DRect getMaxRect ()
 Returns the bounding rectangle of this state.

int countTransitions ()
 Returns the number of all (non-deleted) transitions which start at this state.

int countRefTransitions ()
 Returns the number of all (non-deleted) transitions which end at this state.

void setTransitionsToRadius (Machine *, int)
 Sets transitions to the boundary of this state. More...

QString getToolTipInfo ()
 Returns the tooltip string for this object.

QRect getToolTipRect (const QPoint &)
 Returns the tooltip rectangle (if the mouse leaves this rectangle the TT is closed).

GState * next (IOInfo *in)
 Returns the following state assuming inputs in are input to the machine.


Static Public Methods

void circleEdge (double, double, int, double, double, double &, double &, double addphi=0)
 Calculates a point at the edge of the state relative to the position (mousex, mousey). More...

void calcLoop (double, double, int, double, double, double &, double &, double &, double &)
 Calculates a loop. More...


Public Attributes

QList< GTransitiontlist
 List of transitions starting from that state (this state is responsible for deleting these).

QList< GTransitionreflist
 List of transitions ending in this state (this state must not delete these).


Private Attributes

QPen pen
 Pen used to draw the circle and the line in the middle.

QBrush brush
 Brush used for the background color.

int radius
 Radius of the circle.


Detailed Description

Graphical Object of a state.

A state is drawn as a circle with its name and its code in it.


Constructor & Destructor Documentation

GState::GState Machine * m,
const QString n,
QString d,
int c,
double x,
double y,
int r,
QPen p,
bool end
 

Constructor.

Parameters:
n   name of the state
c   code of the state
x   x coordinate
y   y coordinate
r   radius
p   pen to draw the state with

GState::GState Machine * m
 

Constructor.

Initialises a standard GState


Member Function Documentation

void GState::addTransition Project * p,
GTransition * t,
bool withundo = TRUE
 

Adds a transition to the state.

Parameters:
p   Project that contains the state
t   Transition to add
withundo   If TRUE this step will be put into the undo buffer.

void GState::addTransition Project * p,
GState * s,
TransitionInfo * i,
double sx,
double sy,
double ex,
double ey,
double c1x,
double c1y,
double c2x,
double c2y,
QString description,
bool str = TRUE,
bool withundo = TRUE
 

Adds a new transition in this state.

Parameters:
p   project which contains this state
s   state where the transition ends
i   information about the transition (condition)
sx   x coordinate of the starting point
sy   y coordinate of the starting point
ex   x coordinate of the ending point
ey   y coordinate of the ending point
c1x   x coordinate of the first control point
c1y   y coordinate of the first control point
c2x   x coordinate of the second control point
c2y   y coordinate of the second control point
str   if TRUE the transition will be straight otherwise the transition will be treated as not straight
withundo   If TRUE this step will be put into the undo buffer.

void GState::calcLoop double x,
double y,
int rad,
double mousex,
double mousey,
double & c1x,
double & c1y,
double & c2x,
double & c2y
[static]
 

Calculates a loop.

Calculates the position of the control points in order to get a loop.

Parameters:
x   x position of the state
y   y position of the state
rad   radius of the state
mousex   x position of the mouse
mousey   y position of the mosue
c1x   x coordinate of the first control point
c1y   y coordinate of the first control point
c2x   x coordinate of the second control point
c2y   y coordinate of the second control point

void GState::circleEdge double x,
double y,
int rad,
double mousex,
double mousey,
double & destx,
double & desty,
double addphi = 0
[static]
 

Calculates a point at the edge of the state relative to the position (mousex, mousey).

Parameters:
x   state x position
y   state y position
rad   state radius
mousex   mouse x position (inside state)
mousey   mouse y position (inside state)
destx   resulting x coordinate
desty   resulting y coordinate
addphi   angle to add to the point. (relative to center of circle)

void GState::copyTransitionAttributes GState * s,
QList< GTransition > * clist
 

Copys the attributes of transitions.

The attributes of the transitions in the list @clist are copied into the transitions in of the state s.

Parameters:
s   state containing the transitions which will be copied into
clist   list containing the transitions which will be copied

void GState::copyTransitions GState * s,
bool deleteold = FALSE
 

Makes a deep copy of the transitions of a state.

A deep copy is also made of the transitions ending at this state.

Parameters:
s   state containing the transitions to copy
deleteold   if TRUE deletes the old transitions in this state otherwise not.

void GState::move double x,
double y,
ScrollView * sv,
Machine * m,
bool redraw = TRUE,
bool firstRedraw = FALSE
 

Moves the state.

Parameters:
x   x value to move
y   y value to move
sv   respective scrollview
m   machine constaining this state
redraw   if TRUE the scrollview will be redrawn otherwise it won't
firstRedraw   if TRUE it is the first movement of a series

void GState::setTransitionsToRadius Machine * m,
int radius
 

Sets transitions to the boundary of this state.

Sets all transitions which start and end at this state to the boundary of the circle of this state.

Parameters:
m   machine containing this state
radius   new radius


The documentation for this class was generated from the following files:
Generated at Fri Apr 11 22:37:15 2003 for Qfsm by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001