StateScene.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::
17 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 #include <QGraphicsScene>
26 
27 #include <QGraphicsRectItem>
28 #include <QGraphicsLineItem>
29 
31 
33 {
34  class State;
35  using StatePtr = std::shared_ptr<State>;
36  class StateInstance;
37  using StateInstancePtr = std::shared_ptr<StateInstance>;
38  class Transition;
39  using TransitionCPtr = std::shared_ptr<const Transition>;
40 }
41 
42 namespace armarx
43 {
44  class StateItem;
45 
47  {
48  bool active = false;
49  QString fullStatePath;
51  };
52 
53  class StateScene :
54  public QGraphicsScene,
55  public Logging
56  {
57  Q_OBJECT
58  public:
59  explicit StateScene(QObject* parent = 0);
62 
63 
64 
65  QMap<QString, StateInstanceData> getStateInstanceData() const;
66 
67  signals:
68  void stateContextMenuRequested(statechartmodel::StateInstancePtr state, QPoint mouseScreenPos, QPointF mouseItemPos);
69  void transitionContextMenuRequested(statechartmodel::TransitionCPtr transition, statechartmodel::StatePtr state, QPoint mouseScreenPos, QPointF mouseItemPos);
70  public slots:
71  void setToplevelState(statechartmodel::StatePtr toplevelStateInstance);
72  void saveSceneToSVG(QString path = "/tmp/statechart.png", int width = 6000);
73  void clearActiveSubstates();
74  private:
75  statechartmodel::StateInstancePtr toplevelStateInstance;
76  StateItem* topLevelStateItem;
77  // QMap<QString, StateItem*> subStates;
78  // QList<QGraphicsLineItem*> transitions;
79 
80  };
81 
82 }
83 
armarx::StateInstanceData::fullStatePath
QString fullStatePath
Definition: StateScene.h:49
armarx::StateScene::saveSceneToSVG
void saveSceneToSVG(QString path="/tmp/statechart.png", int width=6000)
Definition: StateScene.cpp:57
armarx::StateScene::getStateInstanceData
QMap< QString, StateInstanceData > getStateInstanceData() const
Definition: StateScene.cpp:91
armarx::StateScene::clearActiveSubstates
void clearActiveSubstates()
Definition: StateScene.cpp:69
armarx::StateScene::getStateInstance
statechartmodel::StateInstancePtr getStateInstance() const
Definition: StateScene.cpp:42
armarx::statechartmodel::StateInstancePtr
std::shared_ptr< StateInstance > StateInstancePtr
Definition: StateInstance.h:138
armarx::StateScene::getTopLevelStateItem
StateItem * getTopLevelStateItem() const
Definition: StateScene.cpp:130
armarx::StateScene::transitionContextMenuRequested
void transitionContextMenuRequested(statechartmodel::TransitionCPtr transition, statechartmodel::StatePtr state, QPoint mouseScreenPos, QPointF mouseItemPos)
armarx::statechartmodel
Definition: XmlWriter.h:36
KITProsthesis::ProsthesisState::State
State
Definition: KITProstheticHandInterface.ice:32
armarx::StateScene::StateScene
StateScene(QObject *parent=0)
Definition: StateScene.cpp:36
armarx::StateInstanceData::active
bool active
Definition: StateScene.h:48
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
armarx::statechartmodel::TransitionCPtr
std::shared_ptr< const Transition > TransitionCPtr
Definition: Transition.h:94
armarx::StateScene::setToplevelState
void setToplevelState(statechartmodel::StatePtr toplevelStateInstance)
Definition: StateScene.cpp:47
armarx::statechartmodel::StatePtr
std::shared_ptr< State > StatePtr
Definition: State.h:46
armarx::StateItem
Definition: StateItem.h:58
armarx::StateScene::stateContextMenuRequested
void stateContextMenuRequested(statechartmodel::StateInstancePtr state, QPoint mouseScreenPos, QPointF mouseItemPos)
Logging.h
armarx::StateInstanceData
Definition: StateScene.h:46
armarx::StateScene
Definition: StateScene.h:53
armarx::StateInstanceData::stateInstance
statechartmodel::StateInstancePtr stateInstance
Definition: StateScene.h:50
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28