Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
behaviour_canvas.h
1#pragma once
2
3#include "canvas.h"
4#include "elements/transition.h"
5
14class BehaviourCanvas : public Canvas
15{
16 Q_OBJECT
17public:
26 BehaviourCanvas(Flow* flow, std::shared_ptr<ConfigurationTable> configTable, std::shared_ptr<EdgeRouter> router, QObject* parent = nullptr);
27
33 virtual Types::LibraryTypes type() const override;
34
40 bool canAddTransition(NodeItem* node) const override;
41
50 TransitionConfig nextTransition(NodeItem* node) const override;
51
55 QVector<QGraphicsItem*> cleanTransitionsOfNode(const QString& nodeId) override;
56
57 QVector<TransitionSaveInfo> transitionsOfNode(const QString& nodeId) override;
58
62 void addTransition(TransitionItem* transition) override;
63
67 void removeTransition(TransitionItem* transition) override;
68
72 void onNodeMoved(const NodeItem* node) override;
73
77 void setupInitialNodes();
78
79protected:
83 void cleanFlow();
84
85 bool insertDroppedNodeOnTransition(TransitionItem* transition, std::shared_ptr<NodeSaveInfo> info) override;
86
87private:
92
102 void updateParent(NodeItem* node, std::shared_ptr<NodeSaveInfo> storage, bool adding) override;
103
104 std::shared_ptr<const NodeSaveInfo> addInitialNode(const QString& nodeType, const QPointF& position);
105
106 TransitionSaveInfo makeTransitionInfo(const QString& sourceId, const QString& destinationId, const QString& event, const QString& label) const;
107};
void cleanFlow()
Deletes the Flow managed by this Canvas. This should not be called if the Flow is created by a NodeIt...
Definition behaviour_canvas.cpp:66
BehaviourCanvas(Flow *flow, std::shared_ptr< ConfigurationTable > configTable, std::shared_ptr< EdgeRouter > router, QObject *parent=nullptr)
Constructs a BehaviourCanvas object.
Definition behaviour_canvas.cpp:11
void setupInitialNodes()
Used to create the start and end nodes of a flow.
Definition behaviour_canvas.cpp:17
bool canAddTransition(NodeItem *node) const override
Checkes whether it is possible to add a new trasition to a node.
Definition behaviour_canvas.cpp:83
TransitionConfig nextTransition(NodeItem *node) const override
Gets the next transition configuration for a given node.
Definition behaviour_canvas.cpp:94
void updateParent(NodeItem *node, std::shared_ptr< NodeSaveInfo > storage, bool adding) override
Updates the parent node of a given node item.
Definition behaviour_canvas.cpp:72
virtual Types::LibraryTypes type() const override
Retrieves the type of library associated with this canvas.
Definition behaviour_canvas.cpp:61
void addTransition(TransitionItem *transition) override
Add the TransitionItem to the Flow managed by this Canvas.
Definition behaviour_canvas.cpp:134
void removeTransition(TransitionItem *transition) override
Removed the TransitionItem from the Flow managed by this Canvas.
Definition behaviour_canvas.cpp:140
void onNodeMoved(const NodeItem *node) override
Callback triggered whenever a node moves significantly.
Definition behaviour_canvas.cpp:149
QVector< QGraphicsItem * > cleanTransitionsOfNode(const QString &nodeId) override
Remove all transitions to and from a node with id nodeId.
Definition behaviour_canvas.cpp:108
Flow * mFlow
A pointer to the Flow object associated with this canvas.
Definition behaviour_canvas.h:91
Canvas(const QString &canvasId, std::shared_ptr< ConfigurationTable > configTable, std::shared_ptr< EdgeRouter > router, QObject *parent=nullptr)
Constructs a new Canvas object.
Definition canvas.cpp:41
Represents a flow in the system.
Definition flow.h:17
Represents a graphical node item in a flowchart.
Definition node.h:26
Configuration for a transition between nodes.
Definition config.h:44
Represents a transition between two nodes in a graphical representation.
Definition transition.h:15
Represents transition save information.
Definition transition_info.h:14