• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

C:/CVUT/diplomka/Automata_editor/sources/oneStateTransition.cpp

Go to the documentation of this file.
00001 #include "constants.h"
00002 
00003 #include "oneStateTransition.h"
00004 #include "state.h"
00005 
00006 #include <QGraphicsSceneMouseEvent>
00007 #include <QtDebug>
00008 
00009 QString OneStateTransition::getTypeNameSuffix() const
00010 {
00011     switch (this->getDirection())
00012     {
00013         case NORTH:       return "N";   break;
00014         case SOUTH:       return "S";   break;
00015         case EAST:        return "E";   break;
00016         case WEST:        return "W";   break;
00017         case NORTH_EAST:  return "NE";  break;
00018         case NORTH_WEST:  return "NW";  break;
00019         case SOUTH_EAST:  return "SE";  break;
00020         case SOUTH_WEST:  return "SW";  break;
00021         default: 
00022             RELLOG("unknown direction!!!");
00023             return "N";
00024     }
00025 }
00026 
00027 void OneStateTransition::assign()
00028 {
00029     startState->addTransition(this);
00030 }
00031 
00032 void OneStateTransition::unassign()
00033 {
00034     startState->removeTransition(this);
00035 }
00036 
00037 void OneStateTransition::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
00038 {
00039     DBGLOG_ME("called");
00040     if (m_lastMouseClickType == eMouseRightClick)
00041     {
00042         editor->showPopup(this, mapToScene(event->pos().toPoint()));
00043         return; // could be deleted
00044     }
00045     else if (m_lastMouseClickType == eMouseDoubleClick)
00046     {
00047         editor->editTransition(this);
00048         return; // could be deleted
00049     }
00050     setChecked(false);
00051 }

Generated on Tue Jan 4 2011 03:03:23 for Autoamata editor by  doxygen 1.7.0