The LayoutPlugin abstract class. More...
#include <LayoutPlugin.h>
Public Member Functions | |
LayoutPlugin () | |
LayoutPlugin. | |
LayoutPlugin (const LayoutPlugin &other) | |
copy constructor to inherit option values | |
void | clear () |
clear, called when re-using the layout object for another graph | |
virtual void | setGraph (SharedGraph graph)=0 |
set the graph that this layout must animate | |
virtual QJsonObject | json () const |
virtual void | fromJson (const QJsonObject &layout) |
QVector2D | startPosition (const NodeID &id) |
startPosition of a Node | |
virtual void | setGraph (SharedEGraph g, const NodePositions &positions) |
alternate setGraph where you can provide initial position | |
virtual void | quickSim (size_t ticks) |
tells the plugin to simulate a certain number of ticks in a quick way | |
virtual void | tick (float dt, bool fast) |
advance the simulation one step | |
virtual SharedLayout | create ()=0 |
make a shared copy of this layout | |
virtual QString | name () const =0 |
the main name of the layout displayed in the GUIs | |
virtual std::string | cliName ()=0 |
the command line interface name of the GUI | |
virtual void | uiStart (Elve::GraphWidgetListener *listener, const SharedEGraph &graph) |
called when the command is started from the GUI | |
System & | system () |
get the default physical system | |
const System & | system () const |
get a const reference to the default physical system | |
virtual | ~LayoutPlugin () |
~LayoutPlugin virtual for inheritance |
The LayoutPlugin abstract class.
This QPlugin interface allow to add new layout types and systems to elve. It redefines how the nodes are positioned and animated.
As Graph nodes don't have a position on their own, the Layouts output a collection of Points that are then linked with movable objects in the viewport.
Definition at line 33 of file LayoutPlugin.h.
Elve::LayoutPlugin::LayoutPlugin | ( | const LayoutPlugin & | other | ) |
copy constructor to inherit option values
other |
Definition at line 17 of file LayoutPlugin.cpp.
void Elve::LayoutPlugin::clear | ( | ) |
clear, called when re-using the layout object for another graph
Definition at line 46 of file LayoutPlugin.cpp.
virtual std::string Elve::LayoutPlugin::cliName | ( | ) | [pure virtual] |
the command line interface name of the GUI
virtual SharedLayout Elve::LayoutPlugin::create | ( | ) | [pure virtual] |
make a shared copy of this layout
virtual QString Elve::LayoutPlugin::name | ( | ) | const [pure virtual] |
the main name of the layout displayed in the GUIs
void Elve::LayoutPlugin::quickSim | ( | size_t | ticks | ) | [virtual] |
tells the plugin to simulate a certain number of ticks in a quick way
ticks | the tick count |
Default implementation of this method just call tick repeatedly
Definition at line 94 of file LayoutPlugin.cpp.
virtual void Elve::LayoutPlugin::setGraph | ( | SharedGraph | graph | ) | [pure virtual] |
set the graph that this layout must animate
graph | A graph to genereate layout for |
void Elve::LayoutPlugin::setGraph | ( | SharedEGraph | g, |
const NodePositions & | positions | ||
) | [virtual] |
alternate setGraph where you can provide initial position
g | the graph |
positions | a map of nodes positions |
This is the entry point of elve's core to the plugin, the default implementation of this method calls the other pure virtual method after optionnaly retrieving the ancient positions
Definition at line 39 of file LayoutPlugin.cpp.
QVector2D Elve::LayoutPlugin::startPosition | ( | const NodeID & | id | ) |
startPosition of a Node
id | the node id |
This is used to abstract the place of the layout in the pipeline, by calling this method to get starting position of a particular node, one ensure that if the layout is succeding another in the viewport, simulation will continue from the same state as before but with potentially new constraints.
Definition at line 23 of file LayoutPlugin.cpp.
const System & Elve::LayoutPlugin::system | ( | ) | const |
get a const reference to the default physical system
Definition at line 85 of file LayoutPlugin.cpp.
void Elve::LayoutPlugin::tick | ( | float | dt, |
bool | fast | ||
) | [virtual] |
advance the simulation one step
dt | time delta in seconds since last invoke |
fast | indicate that the simulation do not need to acknowledge the gui part. |
The default implementation of this method ticks the default physical system.
Definition at line 90 of file LayoutPlugin.cpp.
void Elve::LayoutPlugin::uiStart | ( | Elve::GraphWidgetListener * | listener, |
const SharedEGraph & | graph | ||
) | [virtual] |
called when the command is started from the GUI
listener | the command listener currently bound |
graph | the graph |
Usefull if you want to display custom GUI wizard or dialogs when your plugin is triggered, You can do anything in this method but don't forget that it is executed as part of the Qt event loop and will stall everything until it returns.
Definition at line 108 of file LayoutPlugin.cpp.