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 <QGraphicsLineItem>
26#include <QGraphicsRectItem>
27#include <QGraphicsScene>
28
30
32{
33 class State;
34 using StatePtr = std::shared_ptr<State>;
35 class StateInstance;
36 using StateInstancePtr = std::shared_ptr<StateInstance>;
37 class Transition;
38 using TransitionCPtr = std::shared_ptr<const Transition>;
39} // namespace armarx::statechartmodel
40
41namespace armarx
42{
43 class StateItem;
44
51
52 class StateScene : public QGraphicsScene, public Logging
53 {
54 Q_OBJECT
55 public:
56 explicit StateScene(QObject* parent = 0);
59
60
61 QMap<QString, StateInstanceData> getStateInstanceData() const;
62
63 signals:
65 QPoint mouseScreenPos,
66 QPointF mouseItemPos);
69 QPoint mouseScreenPos,
70 QPointF mouseItemPos);
71 public slots:
72 void setToplevelState(statechartmodel::StatePtr toplevelStateInstance);
73 void saveSceneToSVG(QString path = "/tmp/statechart.png", int width = 6000);
75
76 private:
77 statechartmodel::StateInstancePtr toplevelStateInstance;
78 StateItem* topLevelStateItem;
79 // QMap<QString, StateItem*> subStates;
80 // QList<QGraphicsLineItem*> transitions;
81 };
82
83} // namespace armarx
void saveSceneToSVG(QString path="/tmp/statechart.png", int width=6000)
void transitionContextMenuRequested(statechartmodel::TransitionCPtr transition, statechartmodel::StatePtr state, QPoint mouseScreenPos, QPointF mouseItemPos)
QMap< QString, StateInstanceData > getStateInstanceData() const
statechartmodel::StateInstancePtr getStateInstance() const
StateScene(QObject *parent=0)
StateItem * getTopLevelStateItem() const
void setToplevelState(statechartmodel::StatePtr toplevelStateInstance)
void stateContextMenuRequested(statechartmodel::StateInstancePtr state, QPoint mouseScreenPos, QPointF mouseItemPos)
void clearActiveSubstates()
std::shared_ptr< State > StatePtr
Definition State.h:48
std::shared_ptr< StateInstance > StateInstancePtr
std::shared_ptr< const Transition > TransitionCPtr
Definition Transition.h:91
This file offers overloads of toIce() and fromIce() functions for STL container types.
statechartmodel::StateInstancePtr stateInstance
Definition StateScene.h:49