StateModelLayoutMediator Class Reference

#include <ArmarXGui/gui-plugins/StatechartViewerPlugin/layout/StateModelLayoutMediator.h>

+ Inheritance diagram for StateModelLayoutMediator:

Public Slots

void buildUpGraph (LockableGraphPtr graph)
 buildUpGraph To be called when the corresponding worker initialized the graph. More...
 
void startLayouting (bool layoutAll, int counter)
 layout Tells the worker to layout edges and, if layoutAlgo is true, nodes of the graph. More...
 
void stateChanged (statechartmodel::SignalType signalType)
 
void stateDeleted ()
 stateDeleted To be called when the corresponding state is deleted. More...
 
void substateChanged (statechartmodel::StateInstancePtr substate, statechartmodel::SignalType signalType)
 substateAdded To be called when a substate of state has changed. More...
 
void transitionChanged (statechartmodel::TransitionCPtr transition, statechartmodel::SignalType signalType)
 transitionAdded To be called when a transition of state has changed. More...
 
void workerFinishedLayouting ()
 workerFinishedLayouting To be called when the worker is finished layouting. More...
 

Signals

void deleteMe (size_t id)
 deleteMe To be emitted when this mediator and its worker ought to be deleted because their corresponding state was deleted. More...
 
void layout (bool layoutAll)
 layout Tells worker to layout the graph. More...
 
void layoutingFinished ()
 layoutingFinished Notifies that the latest layout task was finished. More...
 
void mediatorDeleted ()
 mediatorDeleted Tells worker that is has to be deleted. More...
 
void scheduleMe (size_t id, bool layoutAll)
 scheduleMe To be called when its graph should be layouted. More...
 
void substateFound (statechartmodel::StateInstancePtr substate, statechartmodel::SignalType signalType)
 substateFound To be emitted when a substate is found when building up the graph for the first time. More...
 
void supportPointsChanged (statechartmodel::TransitionCPtr transition, const SupportPoints &suppPoints, const QPointPtr &labelCenterPoint, const FloatPtr &labelFontPointSize)
 supportPointsChanged Notifies of changed support points of the given transition. More...
 

Public Member Functions

QRectF boundingRectForAgraph (Agraph_t *graph) const
 
template<typename ElementType >
std::string getGraphAttribute (ElementType *element, const std::string &attributeName) const
 
size_t getID () const
 getID Returns this mediator's id. More...
 
statechartmodel::StatePtr getState () const
 getState Returns the state associated with this mediator. More...
 
template<typename ElementType >
bool hasGraphAttribute (ElementType *element, const std::string &attributeName) const
 
bool isConnected ()
 isConnected Indicates whether this mediator is connected to a worker. More...
 
template<typename ElementType , typename ValueType >
int setGraphAttribute (ElementType *element, const std::string &attributeName, const ValueType &value) const
 
 StateModelLayoutMediator (statechartmodel::StatePtr state, size_t mediator_id)
 LayoutWorker Sets state and id as specified. More...
 

Detailed Description

Definition at line 50 of file StateModelLayoutMediator.h.

Constructor & Destructor Documentation

◆ StateModelLayoutMediator()

StateModelLayoutMediator ( statechartmodel::StatePtr  state,
size_t  mediator_id 
)

LayoutWorker Sets state and id as specified.

Initializes an empty Graph.

Parameters
stateThe state which this worker layouts.
idThe mediator's ID for communication with the LayoutController.

Definition at line 48 of file StateModelLayoutMediator.cpp.

Member Function Documentation

◆ boundingRectForAgraph()

QRectF boundingRectForAgraph ( Agraph_t *  graph) const

Definition at line 265 of file StateModelLayoutMediator.cpp.

◆ buildUpGraph

void buildUpGraph ( LockableGraphPtr  graph)
slot

buildUpGraph To be called when the corresponding worker initialized the graph.

Traverses the state and adds all transitions and states to the graph as well as to EdgeList and NodeMap.

Parameters
graphThe graphviz graph that shall represent the state.

Definition at line 75 of file StateModelLayoutMediator.cpp.

◆ deleteMe

void deleteMe ( size_t  id)
signal

deleteMe To be emitted when this mediator and its worker ought to be deleted because their corresponding state was deleted.

Parameters
idThis mediator's id.

◆ getGraphAttribute()

std::string getGraphAttribute ( ElementType element,
const std::string &  attributeName 
) const
inline

Definition at line 88 of file StateModelLayoutMediator.h.

+ Here is the call graph for this function:

◆ getID()

size_t getID ( ) const

getID Returns this mediator's id.

Returns
ID for communication with the LayoutController

Definition at line 68 of file StateModelLayoutMediator.cpp.

◆ getState()

getState Returns the state associated with this mediator.

Returns
The state that is layouted by the mediator's worker.

Definition at line 63 of file StateModelLayoutMediator.cpp.

◆ hasGraphAttribute()

bool hasGraphAttribute ( ElementType element,
const std::string &  attributeName 
) const
inline

Definition at line 80 of file StateModelLayoutMediator.h.

+ Here is the call graph for this function:

◆ isConnected()

bool isConnected ( )

isConnected Indicates whether this mediator is connected to a worker.

Returns
True if it is connected to a worker.

◆ layout

void layout ( bool  layoutAll)
signal

layout Tells worker to layout the graph.

Parameters
layoutAllTrue: layout nodes and edgese. False: layout only edges.

◆ layoutingFinished

void layoutingFinished ( )
signal

layoutingFinished Notifies that the latest layout task was finished.

◆ mediatorDeleted

void mediatorDeleted ( )
signal

mediatorDeleted Tells worker that is has to be deleted.

◆ scheduleMe

void scheduleMe ( size_t  id,
bool  layoutAll 
)
signal

scheduleMe To be called when its graph should be layouted.

Is meant for the Controller to schedule this mediator in its layout queue.

Parameters
idThis mediator's id.
layoutAllIndicates whether the whole graph (including nodes) should be layouted or only the edges.

◆ setGraphAttribute()

int setGraphAttribute ( ElementType element,
const std::string &  attributeName,
const ValueType &  value 
) const
inline

Definition at line 97 of file StateModelLayoutMediator.h.

+ Here is the call graph for this function:

◆ startLayouting

void startLayouting ( bool  layoutAll,
int  counter 
)
slot

layout Tells the worker to layout edges and, if layoutAlgo is true, nodes of the graph.

Signals changes of positions to the state.

Parameters
layoutAllIf true, nodes and edges are layouted, if false, node positions are assumed to be fixed and only edges are routed.

Definition at line 257 of file StateModelLayoutMediator.cpp.

◆ stateChanged

void stateChanged ( statechartmodel::SignalType  signalType)
slot

comment to prevent warnings if (!isConnectedToWorker) { return; }

    switch (signalType)
    {
        case (statechartmodel::eUnchanged):
        case (statechartmodel::eActivated):

nothing to do return; case (statechartmodel::eAdded): case (statechartmodel::eRemoved): case (statechartmodel::eChanged): auto sizeString = GraphvizConverter::convertFromPoint(QPointF(m_state->getSize().width() / dpi.width(), m_state->getSize().height() / dpi.height())); ARMARX_INFO_S << "state changed for" << m_state->getStateName(); ARMARX_INFO_S << "Graphviz graph size: " << sizeString; setGraphAttribute(m_graph->graph, "size", sizeString); setGraphAttribute(m_graph->graph, "ratio", m_state->getSize().height() / m_state->getSize().width()); default: ARMARX_WARNING << "CASE NOT HANDLED " << signalType; }

emit scheduleMe(id, true);

Definition at line 118 of file StateModelLayoutMediator.cpp.

◆ stateDeleted

void stateDeleted ( )
slot

stateDeleted To be called when the corresponding state is deleted.

Definition at line 293 of file StateModelLayoutMediator.cpp.

◆ substateChanged

void substateChanged ( statechartmodel::StateInstancePtr  substate,
statechartmodel::SignalType  signalType 
)
slot

substateAdded To be called when a substate of state has changed.

Parameters
substateThe changed substate.
signalTypeThe type of signal (added, removed, moved etc.).

Definition at line 150 of file StateModelLayoutMediator.cpp.

◆ substateFound

void substateFound ( statechartmodel::StateInstancePtr  substate,
statechartmodel::SignalType  signalType 
)
signal

substateFound To be emitted when a substate is found when building up the graph for the first time.

Parameters
substateThe substate that was discovered.
signalTypeType of change to the substate. Should be eAdded.

◆ supportPointsChanged

void supportPointsChanged ( statechartmodel::TransitionCPtr  transition,
const SupportPoints suppPoints,
const QPointPtr labelCenterPoint,
const FloatPtr labelFontPointSize 
)
signal

supportPointsChanged Notifies of changed support points of the given transition.

Parameters
transitionTransition whose support points have changed.
suppPointsNew support points.

◆ transitionChanged

void transitionChanged ( statechartmodel::TransitionCPtr  transition,
statechartmodel::SignalType  signalType 
)
slot

transitionAdded To be called when a transition of state has changed.

Parameters
transitionThe changed transition.
signalTypeThe type of signal (added, removed, moved etc.).

Definition at line 205 of file StateModelLayoutMediator.cpp.

◆ workerFinishedLayouting

void workerFinishedLayouting ( )
slot

workerFinishedLayouting To be called when the worker is finished layouting.

Notifies the controller.

Definition at line 275 of file StateModelLayoutMediator.cpp.

+ Here is the call graph for this function:

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