umbrello 2.39.0
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
#include <layoutgenerator.h>
Public Types | |
typedef QHash< QString, QRectF > | NodeType |
typedef QList< QPointF > | EdgePoints |
typedef QHash< QString, EdgePoints > | EdgeType |
typedef QMap< QString, QStringList > | ParameterList |
Public Member Functions | |
LayoutGenerator () | |
bool | isEnabled () const |
bool | generate (UMLScene *scene, const QString &variant=QString()) |
bool | apply (UMLScene *scene) |
QPointF | origin (const QString &id) |
bool | readGeneratedDotFile (const QString &fileName) |
bool | parseLine (const QString &line) |
bool | splitParameters (QMap< QString, QStringList > &map, const QString &s) |
QPointF | mapToScene (const QPointF &p) |
![]() | |
DotGenerator () | |
bool | usePosition () const |
void | setUsePosition (bool state) |
bool | useFullNodeLabels () const |
void | setUseFullNodeLabels (bool state) |
bool | readConfigFile (QString diagramType, const QString &variant=QStringLiteral("default")) |
bool | createDotFile (UMLScene *scene, const QString &fileName, const QString &variant=QStringLiteral("default")) |
void | setGeneratorName (const QString &name) |
QString | generatorFullPath () const |
Static Public Member Functions | |
static bool | availableConfigFiles (UMLScene *scene, QHash< QString, QString > &configFiles) |
![]() | |
static bool | availableConfigFiles (UMLScene *scene, QHash< QString, QString > &configFiles) |
static QString | currentDotPath () |
Protected Attributes | |
QRectF | m_boundingRect |
NodeType | m_nodes |
list of nodes found in parsed dot file | |
EdgeType | m_edges |
list of edges found in parsed dot file | |
QHash< QString, QPointF > | m_edgeLabelPosition |
contains global node parameters | |
![]() | |
double | m_scale |
scale factor | |
QString | m_configFileName |
template filename | |
QHash< QString, QString > | m_dotParameters |
contains global graph parameters | |
QHash< QString, QString > | m_edgeParameters |
contains global edge parameters | |
QHash< QString, QString > | m_nodeParameters |
contains global node parameters | |
QPointF | m_origin |
QString | m_generator |
name of graphviz generator | |
bool | m_usePosition |
use position tag from dot (not used yet) | |
bool | m_useFullNodeLabels |
use full node labels | |
QString | m_dotPath |
contains path to generator executable | |
int | m_version {0} |
version of graphviz generator | |
Friends | |
QDebug | operator<< (QDebug out, LayoutGenerator &c) |
Additional Inherited Members | |
![]() | |
bool | findItem (QStringList ¶ms, const QString &search) |
QString | fixID (const QString &_id) |
int | generatorVersion () const |
The class LayoutGenerator provides calculated layouts of diagrams.
It uses the dot executable from the graphviz package for calculation of widget positions.
The implementation calls dot with information from the displayed widgets and associations by creating a temporary dot file based on a layout configure file, which is located in the umbrello/layouts subdir of the "data" resource type. The config file is determined from the type of the currently displayed diagram and the layout chosen by the user.
Dot creates a file containing the calculated widget positions. The widget positions are retrieved from this file and used to move widgets on the provided diagram. Additional points in association lines are removed.
typedef QList<QPointF> LayoutGenerator::EdgePoints |
typedef QHash<QString,EdgePoints> LayoutGenerator::EdgeType |
typedef QHash<QString,QRectF> LayoutGenerator::NodeType |
typedef QMap<QString,QStringList> LayoutGenerator::ParameterList |
LayoutGenerator::LayoutGenerator | ( | ) |
constructor
bool LayoutGenerator::apply | ( | UMLScene * | scene | ) |
apply auto layout to the given scene
scene |
|
static |
Return a list of available templates for a given scene type
scene | The diagram |
configFiles | will contain the collected list of config files |
bool LayoutGenerator::generate | ( | UMLScene * | scene, |
const QString & | variant = QString() ) |
generate layout and apply it to the given diagram.
bool LayoutGenerator::isEnabled | ( | ) | const |
Return state if layout generator is enabled. It is enabled when the dot application has been found.
QPointF LayoutGenerator::mapToScene | ( | const QPointF & | p | ) |
map dot coordinate to scene coordinate
p | dot point to map |
QPointF LayoutGenerator::origin | ( | const QString & | id | ) |
Return the origin of node based on the bottom/left corner
id | The widget id to fetch the origin from |
bool LayoutGenerator::parseLine | ( | const QString & | line | ) |
Parse line from dot generated plain-ext output format
The format is documented at https://graphviz.gitlab.io/_pages/doc/info/output.html and looks like:
graph 1 28.083 10.222 node ITfDmJvJE00m 8.0833 8.7361 0.86111 0.45833 QObject solid box black lightgrey edge sL4cKPpHnJkU sL4cKPpHnJkU 7 8.1253 7.2568 8.2695 7.2687 8.375 7.3127 8.375 7.3889 8.375 7.4377 8.3317 7.4733 8.2627 7.4957 Aggregation 8.8472 7.3889 solid black
line | line in dot plain-ext output format |
bool LayoutGenerator::readGeneratedDotFile | ( | const QString & | fileName | ) |
Read generated dot file and extract positions of the contained widgets.
bool LayoutGenerator::splitParameters | ( | QMap< QString, QStringList > & | map, |
const QString & | s ) |
|
friend |
|
protected |
|
protected |
contains global node parameters
|
protected |
list of edges found in parsed dot file
|
protected |
list of nodes found in parsed dot file