umbrello 26.03.70-1a62d36 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
LayoutGenerator Class Reference

`#include <layoutgenerator.h>`

Inheritance diagram for LayoutGenerator:

## 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)
Public Member Functions inherited from DotGenerator
| 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 Public Member Functions inherited from DotGenerator
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 More...
EdgeType | m_edges
| list of edges found in parsed dot file More...
QHash< QString, QPointF > | m_edgeLabelPosition
| contains global node parameters More...
Protected Attributes inherited from DotGenerator
double | m_scale
| scale factor More...
QString | m_configFileName
| template filename More...
QHash< QString, QString > | m_dotParameters
| contains global graph parameters More...
QHash< QString, QString > | m_edgeParameters
| contains global edge parameters More...
QHash< QString, QString > | m_nodeParameters
| contains global node parameters More...
QPointF | m_origin
QString | m_generator
| name of graphviz generator More...
bool | m_usePosition
| use position tag from dot (not used yet) More...
bool | m_useFullNodeLabels
| use full node labels More...
QString | m_dotPath
| contains path to generator executable More...
int | m_version {0}
| version of graphviz generator More...

## Friends

QDebug | operator<< (QDebug out, LayoutGenerator &c)

## Additional Inherited Members

Protected Member Functions inherited from DotGenerator
bool | findItem (QStringList &params, const QString &search)
QString | fixID (const QString &_id)
int | generatorVersion () const

## Detailed Description

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.

Author
  Ralf Habacker ralf..nosp@m.haba.nosp@m.cker@.nosp@m.free.nosp@m.net.d.nosp@m.e

## Member Typedef Documentation

## ◆ EdgePoints

typedef QList<QPointF> LayoutGenerator::EdgePoints

## ◆ EdgeType

typedef QHash<QString,EdgePoints> LayoutGenerator::EdgeType

## ◆ NodeType

typedef QHash<QString,QRectF> LayoutGenerator::NodeType

## ◆ ParameterList

typedef QMap<QString,QStringList> LayoutGenerator::ParameterList

## Constructor & Destructor Documentation

## ◆ LayoutGenerator()

LayoutGenerator::LayoutGenerator | ( |  | ) |

constructor

## Member Function Documentation

## ◆ apply()

bool LayoutGenerator::apply | ( | UMLScene * | scene | ) |

apply auto layout to the given scene

Parameters

  scene |

Returns
  true if autolayout has been applied

## ◆ availableConfigFiles()

bool LayoutGenerator::availableConfigFiles | ( | UMLScene * | scene,
|  | QHash< QString, QString > & | configFiles
| ) |  |

static

Return a list of available templates for a given scene type

Parameters

  scene | The diagram
  configFiles | will contain the collected list of config files

Returns
  true if collecting succeeds

## ◆ generate()

bool LayoutGenerator::generate | ( | UMLScene * | scene,
|  | const QString & | variant = `QString()`
| ) |  |

generate layout and apply it to the given diagram.

Returns
  true if generating succeeded

## ◆ isEnabled()

bool LayoutGenerator::isEnabled | ( |  | ) | const

Return state if layout generator is enabled. It is enabled when the dot application has been found.

Returns
  true if enabled

## ◆ mapToScene()

QPointF LayoutGenerator::mapToScene | ( | const QPointF & | p | ) |

map dot coordinate to scene coordinate

Parameters

  p | dot point to map

Returns
  uml scene coordinate

## ◆ origin()

QPointF LayoutGenerator::origin | ( | const QString & | id | ) |

Return the origin of node based on the bottom/left corner

Parameters

  id | The widget id to fetch the origin from

Returns
  QPoint instance with the coordinates

## ◆ parseLine()

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

Parameters

  line | line in dot plain-ext output format

Returns
  true if line could be parsed successfully

## ◆ readGeneratedDotFile()

bool LayoutGenerator::readGeneratedDotFile | ( | const QString & | fileName | ) |

Read generated dot file and extract positions of the contained widgets.

Returns
  true if extracting succeeded

## ◆ splitParameters()

bool LayoutGenerator::splitParameters | ( | QMap< QString, QStringList > & | map,
|  | const QString & | s
| ) |  |

## Friends And Related Function Documentation

## ◆ operator<<

QDebug operator<< | ( | QDebug | out,
|  | LayoutGenerator & | c
| ) |  |

friend

## Member Data Documentation

## ◆ m_boundingRect

QRectF LayoutGenerator::m_boundingRect

protected

## ◆ m_edgeLabelPosition

QHash<QString, QPointF> LayoutGenerator::m_edgeLabelPosition

protected

contains global node parameters

## ◆ m_edges

EdgeType LayoutGenerator::m_edges

protected

list of edges found in parsed dot file

## ◆ m_nodes

NodeType LayoutGenerator::m_nodes

protected

list of nodes found in parsed dot file

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

- umbrello/layoutgenerator.h
- umbrello/layoutgenerator.cpp