Public Member Functions | Protected Member Functions | Protected Attributes | Friends

State Class Reference

#include <state.h>

Inheritance diagram for State:
Collaboration diagram for State:

List of all members.

Public Member Functions

 State (const QPoint &position, Editor *parent, const QString label="", const QString name="", bool dBorder=false, bool dim=false)
 State ()
virtual ~State ()
virtual void addTransition (Transition *transition)
void adjustTransitions ()
virtual QRectF boundingRect () const
void clearTransitionList ()
virtual void deleteTransitions ()
virtual int getHeight () const =0
virtual QString getLabel () const
virtual QPolygonF getMyPolygon () const
virtual QString getName () const
int getTextAscent () const
int getTextDescent () const
int getTextHeight () const
int getTextWidth () const
QList< Transition * > getTransitionList ()
virtual QString getTypeName () const =0
virtual QString getVCCommand () const
virtual bool getVCParams (QTextStream &out, StatePrevParams &prevParams)
virtual int getWidth () const =0
virtual bool isAutoNammed () const
virtual bool isDimmed () const
virtual bool isDoubleBorder () const
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)=0
virtual void paintSelectionDecoration (QPainter *painter)
virtual void removeTransition (Transition *transition)
virtual void setAutoNammed (bool autoNammed)
void setChecked (bool checked=true)
virtual void setDimmed (bool dim)
void setDimStateLineCoef (float lineCoef)
virtual void setDoubleBorder (bool dBroder)
virtual void setLabel (const QString &label)
void setMarked (bool marked)
virtual void setName (const QString &name)
void setStateLabelScale (float labelScale)
void setStateLineDoubleCoef (float lineCoef)
void setStateLineDoubleSep (float lineSep)
void setStateLineWidth (float lineWidth)
void setTransitionList (const QList< Transition * > &trList)
virtual QPainterPath shape () const =0
Support methods for IState creation

bool isInitial () const
bool isFinal () const
QList< State * > getAccessibleStates () const
 returns list of accessible states from this state on sigle transition, ignores orientation
QList< Transition * > getOutgoingTransitions () const

Protected Member Functions

virtual QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 give know about moving with state to all connected trasitions
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 moving with state
void mousePressEvent (QGraphicsSceneMouseEvent *event)
 mouseEvents
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
virtual void updateMyPolygon ()=0
 compute states polygon

Protected Attributes

bool autoNammed
 atomatic naming
bool checked
const QColor checkedColor
bool dimmed
 by default solid gray
bool doubleBorder
 if true, it is FinalState
Editoreditor
QString label
 original label
EMouseClick m_lastMouseClickType
float m_lineWidth
bool m_marked
QString m_origColor
 stores original color before state is marked
bool m_otherMoved
 for moving with multiple states
QPainterPath myPath
 state painter path, corresponding to myPolygon
QPolygonF myPolygon
 polygon to finding intersection with transitions
QString name
 name of state
QPointF oldPos
 due to Undo and Redo
int stateLabelSize
StringProcessorstringProcessor
 handles greek symbols, provide painting and export funcitons
QList< Transition * > transitionList
 transitions connected to state
state parameters

Qt::PenStyle stateLineStyle
float stateLineWidth
QString stateLineColor
QString stateLabelColor
float stateLabelScale
Qt::BrushStyle stateFillStatus
QString stateFillColor
state parametres dimmed

Qt::PenStyle dimStateLineStyle
QString dimStateLineColor
float dimStateLineCoef
QString dimStateLabelColor
QString dimStateFillColor
state parametres double

float stateLineDoubleCoef
float stateLineDoubleSep

Friends

void Editor::exportToGraphML (const QString &fn)
class Parser
class StateEditExtendedCommand
class StateEditWithDelCommand
class StateExtendedDialog
struct StateSerializer
class StateStyleChangeCommand

Detailed Description

Definition at line 35 of file state.h.


Constructor & Destructor Documentation

State::State ( const QPoint &  position,
Editor parent,
const QString  label = "",
const QString  name = "",
bool  dBorder = false,
bool  dim = false 
)
State::~State (  )  [virtual]

Definition at line 73 of file state.cpp.

References DBGLOG, deleteTransitions(), and stringProcessor.

Here is the call graph for this function:

State::State (  )  [inline]

Definition at line 43 of file state.h.


Member Function Documentation

void State::addTransition ( Transition transition  )  [virtual]

Definition at line 219 of file state.cpp.

References RELLOG, and transitionList.

Referenced by TwoStatesTransition::assign(), and OneStateTransition::assign().

Here is the caller graph for this function:

void State::adjustTransitions (  ) 

Definition at line 343 of file state.cpp.

References Transition::adjust(), and transitionList.

Referenced by itemChange(), StateEditExtendedCommand::redo(), StateEditWithDelCommand::redo(), StateVar::setLabel(), StateEditExtendedCommand::undo(), and StateEditWithDelCommand::undo().

Here is the call graph for this function:

Here is the caller graph for this function:

QRectF State::boundingRect (  )  const [virtual]

Definition at line 286 of file state.cpp.

References doubleBorder, getHeight(), getTextHeight(), getTextWidth(), getWidth(), m_lineWidth, stateLineDoubleCoef, and stateLineDoubleSep.

Referenced by Editor::getExpandedGridRect(), StateVar::paint(), StateNormal::paint(), paintSelectionDecoration(), and SelectionSerializer::SelectionSerializer().

Here is the call graph for this function:

Here is the caller graph for this function:

void State::clearTransitionList (  )  [inline]

Definition at line 89 of file state.h.

References transitionList.

Referenced by StateEditWithDelCommand::redo(), and StateEditWithDelCommand::undo().

Here is the caller graph for this function:

void State::deleteTransitions (  )  [virtual]

Definition at line 233 of file state.cpp.

References transitionList, and Transition::unassign().

Referenced by ~State().

Here is the call graph for this function:

Here is the caller graph for this function:

QList< State * > State::getAccessibleStates (  )  const

returns list of accessible states from this state on sigle transition, ignores orientation

only for BFS - finding automata, so orientation of transition is skipped

Definition at line 616 of file state.cpp.

References Transition::getEndState(), Transition::getStartState(), and transitionList.

Here is the call graph for this function:

virtual int State::getHeight (  )  const [pure virtual]

Implemented in StateNormal, and StateVar.

Referenced by TransitionSELine::adjust(), and boundingRect().

Here is the caller graph for this function:

virtual QString State::getLabel (  )  const [inline, virtual]

Definition at line 74 of file state.h.

References label.

Referenced by Editor::editState(), Editor::exportToGraphML(), Editor::getAutomaton(), getVCCommand(), Editor::showPopup(), and StateEditCommand::StateEditCommand().

Here is the caller graph for this function:

QPolygonF State::getMyPolygon (  )  const [virtual]

Definition at line 80 of file state.cpp.

References myPolygon.

Referenced by TransitionVCurve::adjust(), TransitionVArc::adjust(), TransitionLoop::adjust(), TransitionLine::adjust(), and TransitionArc::adjust().

Here is the caller graph for this function:

virtual QString State::getName (  )  const [inline, virtual]
QList< Transition * > State::getOutgoingTransitions (  )  const

Definition at line 599 of file state.cpp.

References Transition::getStartState(), Transition::getTypeName(), and transitionList.

Referenced by Editor::detectAutomataSettings(), Editor::getExpandedGridRect(), and transitionCountBetween().

Here is the call graph for this function:

Here is the caller graph for this function:

int State::getTextAscent (  )  const [inline]

Definition at line 65 of file state.h.

References StringProcessor::getAscent(), and stringProcessor.

Referenced by StateVar::paint(), and StateNormal::paint().

Here is the call graph for this function:

Here is the caller graph for this function:

int State::getTextDescent (  )  const [inline]

Definition at line 66 of file state.h.

References StringProcessor::getDescent(), and stringProcessor.

Referenced by StateVar::paint(), and StateNormal::paint().

Here is the call graph for this function:

Here is the caller graph for this function:

int State::getTextHeight (  )  const [inline]

Definition at line 64 of file state.h.

References StringProcessor::getHeight(), and stringProcessor.

Referenced by boundingRect().

Here is the call graph for this function:

Here is the caller graph for this function:

int State::getTextWidth (  )  const [inline]

Definition at line 63 of file state.h.

References StringProcessor::getWidth(), and stringProcessor.

Referenced by boundingRect(), StateVar::paint(), and StateNormal::paint().

Here is the call graph for this function:

Here is the caller graph for this function:

QList<Transition *> State::getTransitionList (  )  [inline]
virtual QString State::getTypeName (  )  const [pure virtual]

Implemented in StateNormal, and StateVar.

Referenced by Editor::editState(), Editor::exportToGraphML(), and getVCCommand().

Here is the caller graph for this function:

QString State::getVCCommand (  )  const [virtual]

Definition at line 204 of file state.cpp.

References editor, getLabel(), getName(), getTypeName(), and Editor::mapToGrid().

Referenced by Editor::saveGraph().

Here is the call graph for this function:

Here is the caller graph for this function:

bool State::getVCParams ( QTextStream &  out,
StatePrevParams prevParams 
) [virtual]
virtual int State::getWidth (  )  const [pure virtual]
virtual bool State::isAutoNammed (  )  const [inline, virtual]

Definition at line 78 of file state.h.

References autoNammed.

Referenced by Editor::editState(), and StateEditCommand::StateEditCommand().

Here is the caller graph for this function:

virtual bool State::isDimmed (  )  const [inline, virtual]

Definition at line 77 of file state.h.

References dimmed.

Referenced by Editor::editState(), Editor::exportToGraphML(), Editor::saveGraph(), setMarked(), and StateEditCommand::StateEditCommand().

Here is the caller graph for this function:

virtual bool State::isDoubleBorder (  )  const [inline, virtual]

Definition at line 75 of file state.h.

References doubleBorder.

Referenced by Editor::exportToGraphML(), and StateEditCommand::StateEditCommand().

Here is the caller graph for this function:

bool State::isFinal (  )  const

Definition at line 584 of file state.cpp.

References doubleBorder, Transition::getTypeName(), and transitionList.

Referenced by Editor::getAutomaton(), and Editor::getFinalStates().

Here is the call graph for this function:

Here is the caller graph for this function:

bool State::isInitial (  )  const

Definition at line 571 of file state.cpp.

References Transition::getTypeName(), and transitionList.

Referenced by Editor::editState(), Editor::getAutomaton(), and Editor::getInitialStates().

Here is the call graph for this function:

Here is the caller graph for this function:

QVariant State::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
) [protected, virtual]

give know about moving with state to all connected trasitions

Definition at line 329 of file state.cpp.

References adjustTransitions().

Here is the call graph for this function:

void State::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

Definition at line 414 of file state.cpp.

References DBGLOG_ME, editor, Editor::getAction(), m_lastMouseClickType, and setChecked().

Here is the call graph for this function:

void State::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

moving with state

Definition at line 424 of file state.cpp.

References editor, eMouseLeftClick, eMouseMove, Editor::getAction(), GRID_STEP, Editor::itemAlignToGrid(), m_lastMouseClickType, and Editor::snapped().

Here is the call graph for this function:

void State::mousePressEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]

mouseEvents

Definition at line 351 of file state.cpp.

References DBGLOG_ME, editor, Editor::eSelection, Editor::getAction(), m_lastMouseClickType, oldPos, and setChecked().

Here is the call graph for this function:

void State::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event  )  [protected]
virtual void State::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
) [pure virtual]

Implemented in StateNormal, and StateVar.

void State::paintSelectionDecoration ( QPainter *  painter  )  [virtual]

Definition at line 309 of file state.cpp.

References SelectedColor::a, SelectedColor::b, boundingRect(), SelectedColor::g, and SelectedColor::r.

Referenced by StateVar::paint(), and StateNormal::paint().

Here is the call graph for this function:

Here is the caller graph for this function:

void State::removeTransition ( Transition transition  )  [virtual]

Definition at line 227 of file state.cpp.

References transitionList.

Referenced by TwoStatesTransition::unassign(), and OneStateTransition::unassign().

Here is the caller graph for this function:

void State::setAutoNammed ( bool  autoNammed  )  [virtual]

Definition at line 281 of file state.cpp.

References autoNammed.

Referenced by Editor::insertState(), Editor::paste(), StateEditCommand::redo(), and StateEditCommand::undo().

Here is the caller graph for this function:

void State::setChecked ( bool  checked = true  ) 
void State::setDimmed ( bool  dim  )  [virtual]

Definition at line 267 of file state.cpp.

References dimmed, dimStateLineCoef, m_lineWidth, stateLineWidth, and updateMyPolygon().

Referenced by StateEditCommand::redo(), and StateEditCommand::undo().

Here is the call graph for this function:

Here is the caller graph for this function:

void State::setDimStateLineCoef ( float  lineCoef  ) 
void State::setDoubleBorder ( bool  dBroder  )  [virtual]

Definition at line 256 of file state.cpp.

References doubleBorder, and updateMyPolygon().

Referenced by NaiveDrawAlgorithm::drawAutomaton(), StateEditCommand::redo(), and StateEditCommand::undo().

Here is the call graph for this function:

Here is the caller graph for this function:

void State::setLabel ( const QString &  label  )  [virtual]

Reimplemented in StateVar.

Definition at line 244 of file state.cpp.

References label, StringProcessor::setText(), and stringProcessor.

Referenced by StateEditCommand::redo(), and StateEditCommand::undo().

Here is the call graph for this function:

Here is the caller graph for this function:

void State::setMarked ( bool  marked  ) 

Definition at line 537 of file state.cpp.

References dimStateFillColor, isDimmed(), m_marked, m_origColor, stateFillColor, and toMarkerColor().

Referenced by StatesSetMarkedCommand::redo(), and StatesSetMarkedCommand::undo().

Here is the call graph for this function:

Here is the caller graph for this function:

void State::setName ( const QString &  name  )  [virtual]

Definition at line 251 of file state.cpp.

References name.

Referenced by Editor::renameState().

Here is the caller graph for this function:

void State::setStateLabelScale ( float  labelScale  ) 
void State::setStateLineDoubleCoef ( float  lineCoef  ) 
void State::setStateLineDoubleSep ( float  lineSep  ) 
void State::setStateLineWidth ( float  lineWidth  ) 
void State::setTransitionList ( const QList< Transition * > &  trList  )  [inline]

Definition at line 88 of file state.h.

References transitionList.

Referenced by StateEditWithDelCommand::redo(), and StateEditWithDelCommand::undo().

Here is the caller graph for this function:

virtual QPainterPath State::shape (  )  const [pure virtual]

Implemented in StateNormal, and StateVar.

virtual void State::updateMyPolygon (  )  [protected, pure virtual]

compute states polygon

Implemented in StateNormal, and StateVar.

Referenced by setDimmed(), setDimStateLineCoef(), setDoubleBorder(), setStateLabelScale(), setStateLineDoubleCoef(), setStateLineDoubleSep(), and setStateLineWidth().

Here is the caller graph for this function:


Friends And Related Function Documentation

void Editor::exportToGraphML ( const QString &  fn  )  [friend]
friend class Parser [friend]

Definition at line 43 of file state.h.

friend class StateEditExtendedCommand [friend]

Definition at line 48 of file state.h.

friend class StateEditWithDelCommand [friend]

Definition at line 47 of file state.h.

friend class StateExtendedDialog [friend]

Definition at line 46 of file state.h.

friend struct StateSerializer [friend]

Definition at line 51 of file state.h.

friend class StateStyleChangeCommand [friend]

Definition at line 49 of file state.h.


Member Data Documentation

bool State::autoNammed [protected]

atomatic naming

Definition at line 132 of file state.h.

Referenced by isAutoNammed(), and setAutoNammed().

bool State::checked [protected]

Definition at line 171 of file state.h.

Referenced by StateVar::paint(), and StateNormal::paint().

const QColor State::checkedColor [protected]

Definition at line 172 of file state.h.

Referenced by StateVar::paint(), and StateNormal::paint().

bool State::dimmed [protected]

by default solid gray

Definition at line 138 of file state.h.

Referenced by getVCParams(), isDimmed(), StateVar::paint(), StateNormal::paint(), setDimmed(), setDimStateLineCoef(), setStateLineWidth(), and State().

QString State::dimStateFillColor [protected]
QString State::dimStateLabelColor [protected]
float State::dimStateLineCoef [protected]
QString State::dimStateLineColor [protected]
Qt::PenStyle State::dimStateLineStyle [protected]
bool State::doubleBorder [protected]
Editor* State::editor [protected]
QString State::label [protected]

original label

Definition at line 135 of file state.h.

Referenced by getLabel(), setLabel(), and State().

Definition at line 179 of file state.h.

Referenced by mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

float State::m_lineWidth [protected]
bool State::m_marked [protected]

Definition at line 175 of file state.h.

Referenced by setMarked().

QString State::m_origColor [protected]

stores original color before state is marked

Definition at line 174 of file state.h.

Referenced by setMarked().

bool State::m_otherMoved [protected]

for moving with multiple states

Definition at line 177 of file state.h.

QPainterPath State::myPath [protected]

state painter path, corresponding to myPolygon

Definition at line 127 of file state.h.

Referenced by StateVar::shape(), StateNormal::shape(), StateVar::updateMyPolygon(), and StateNormal::updateMyPolygon().

QPolygonF State::myPolygon [protected]

polygon to finding intersection with transitions

Definition at line 126 of file state.h.

Referenced by getMyPolygon(), StateVar::updateMyPolygon(), and StateNormal::updateMyPolygon().

QString State::name [protected]

name of state

Definition at line 133 of file state.h.

Referenced by getName(), and setName().

QPointF State::oldPos [protected]

due to Undo and Redo

Definition at line 124 of file state.h.

Referenced by mousePressEvent(), and mouseReleaseEvent().

QString State::stateFillColor [protected]
Qt::BrushStyle State::stateFillStatus [protected]
QString State::stateLabelColor [protected]
float State::stateLabelScale [protected]
int State::stateLabelSize [protected]

Definition at line 168 of file state.h.

Referenced by StateSerializer::createState(), setStateLabelScale(), and State().

QString State::stateLineColor [protected]
float State::stateLineDoubleCoef [protected]
float State::stateLineDoubleSep [protected]
Qt::PenStyle State::stateLineStyle [protected]
float State::stateLineWidth [protected]

handles greek symbols, provide painting and export funcitons

Definition at line 136 of file state.h.

Referenced by getTextAscent(), getTextDescent(), getTextHeight(), getTextWidth(), StateVar::getWidth(), StateVar::paint(), StateNormal::paint(), setLabel(), setStateLabelScale(), State(), and ~State().

QList<Transition *> State::transitionList [protected]

The documentation for this class was generated from the following files: