Commit e7cb330d authored by Ralf Habacker's avatar Ralf Habacker

Show parsed data by layout generator in graphics scene

CCBUG:414595
parent a1048817
......@@ -255,6 +255,8 @@ bool DotGenerator::readConfigFile(QString diagramType, const QString &variant)
KConfigGroup edgesAttributes(&desktopFile,"X-UMBRELLO-Dot-Edges");
KConfigGroup nodesAttributes(&desktopFile,"X-UMBRELLO-Dot-Nodes");
KConfigGroup attributes(&desktopFile,"X-UMBRELLO-Dot-Attributes");
QString layoutType = Uml::LayoutType::toString(Settings::optionState().generalState.layoutType);
KConfigGroup layoutAttributes(&desktopFile,QString(QLatin1String("X-UMBRELLO-Dot-Attributes-%1")).arg(layoutType));
// settings are not needed by dotgenerator
KConfigGroup settings(&desktopFile,"X-UMBRELLO-Dot-Settings");
......@@ -268,6 +270,16 @@ bool DotGenerator::readConfigFile(QString diagramType, const QString &variant)
m_dotParameters[key] = value;
}
foreach(const QString &key, layoutAttributes.keyList()) {
QString value = layoutAttributes.readEntry(key);
if (!value.isEmpty()) {
if (!m_dotParameters.contains(key))
m_dotParameters[key] = value;
else
m_dotParameters[key].append(QLatin1String(",") + value);
}
}
foreach(const QString &key, nodesAttributes.keyList()) {
QString value = nodesAttributes.readEntry(key);
m_nodeParameters[key] = value;
......
......@@ -46,6 +46,8 @@
#define LAYOUTGENERATOR_DEBUG
//#define LAYOUTGENERATOR_DATA_DEBUG
//#define SHOW_CONTROLPOINTS
#ifdef LAYOUTGENERATOR_DEBUG
static QString pngViewer()
......@@ -75,6 +77,11 @@ static QString textViewer()
}
#endif
#ifdef SHOW_CONTROLPOINTS
static QGraphicsPathItem *s_debugItems;
static QPainterPath s_path;
#endif
/**
* constructor
*/
......@@ -149,6 +156,14 @@ bool LayoutGenerator::generate(UMLScene *scene, const QString &variant)
return false;
}
#ifdef SHOW_CONTROLPOINTS
if (!s_debugItems) {
s_debugItems = new QGraphicsPathItem;
scene->addItem(s_debugItems);
}
s_path = QPainterPath();
s_debugItems->setPath(s_path);
#endif
#ifdef LAYOUTGENERATOR_DEBUG
in.setAutoRemove(false);
out.setAutoRemove(false);
......@@ -260,11 +275,22 @@ bool LayoutGenerator::apply(UMLScene *scene)
/*
for(int i = 1; i < len-1; i++) {
path->insertPoint(i, mapToScene((p[i]));
#ifdef SHOW_CONTROLPOINTS
QPolygonF pf;
QFont f;
for (int i=0; i < len; i++) {
pf << mapToScene(p[i]);
s_path.addText(mapToScene(p[i] + QPointF(5,0)), f, QString::number(i));
}
*/
/*
* here stuff could be added to add more points from information returned by dot.
*/
s_path.addPolygon(pf);
s_path.addEllipse(mapToScene(l), 5, 5);
s_debugItems->setPath(s_path);
#endif
}
UMLApp::app()->beginMacro(i18n("Apply layout"));
......@@ -275,6 +301,12 @@ bool LayoutGenerator::apply(UMLScene *scene)
continue;
if (widget->isPortWidget() || widget->isPinWidget())
continue;
#ifdef SHOW_CONTROLPOINTS
s_path.addRect(QRectF(mapToScene(m_nodes[id].bottomLeft()), m_nodes[id].size()));
s_path.addRect(QRectF(origin(id), m_nodes[id].size()));
s_debugItems->setPath(s_path);
#endif
QPointF p = origin(id);
widget->setStartMovePosition(widget->pos());
widget->setX(p.x());
......
......@@ -109,7 +109,27 @@ ranking::type::default=len=1.5
id::type::default=swap
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -112,7 +112,27 @@ id::type::composition=swap
id::type::containment=swap
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -96,7 +96,27 @@ id::type::composition=swap
id::type::containment=swap
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=LR,outputorder=nodesfirst,ranksep=1.0,nodesep=0.8
graph=rankdir=LR,outputorder=nodesfirst,ranksep=1.0,nodesep=0.8
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -111,7 +111,27 @@ id::type::composition=swap
id::type::containment=swap
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -89,7 +89,27 @@ ranking::type::uniassociation=weight=0.8
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=LR,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=LR,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -104,7 +104,27 @@ ranking::type::uniassociation=weight=0.8
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -97,7 +97,27 @@ ranking::type::relationship=weight=1.0
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -82,7 +82,27 @@ ranking::type::relationship=weight=1.0
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=LR,outputorder=nodesfirst,ranksep=1.0,nodesep=0.8
graph=rankdir=LR,outputorder=nodesfirst,ranksep=1.0,nodesep=0.8
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -96,7 +96,27 @@ ranking::type::relationship=weight=1.0
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -85,7 +85,27 @@ ranking::type::association=weight=0.001
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -78,7 +78,27 @@ ranking::type::association=weight=0.001
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=LR,outputorder=nodesfirst,ranksep=1.0,nodesep=0.8
graph=rankdir=LR,outputorder=nodesfirst,ranksep=1.0,nodesep=0.8
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -93,7 +93,27 @@ ranking::type::association=weight=0.001
ranking::type::default=weight=0.001
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -98,7 +98,27 @@ ranking::type::default=len=2
id::type::state=swap
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,model=mds,normalize=yes
graph=model=mds,normalize=yes
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -91,14 +91,34 @@ type::default=shape=box
[X-UMBRELLO-Dot-Edges]
# for visual representation
visual::type::state=arrowhead=normal,label=""
visual::type::state=arrowhead=normal
#visual::type::default=arrowhead=none,minlen=0.5
ranking::type::default=weight=0.8
# id handling
id::type::state=swap
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
graph=rankdir=TB,outputorder=nodesfirst,ranksep=0.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
[Desktop Entry]
Desktop Entry]
Type=Service
Name=UseCase Default Layout
Name[bs]=UseCase podrazumijevani raspored
......@@ -100,7 +100,27 @@ ranking::type::anchor=weight=1.0
ranking::type::default=constraint=false
[X-UMBRELLO-Dot-Attributes]
graph=splines=polyline,rankdir=RL,outputorder=nodesfirst,ranksep=1.5,nodesep=0.5
graph=rankdir=RL,outputorder=nodesfirst,ranksep=1.5,nodesep=0.5
node=
edge=
[X-UMBRELLO-Dot-Attributes-Spline]
graph=splines=true
node=
edge=
[X-UMBRELLO-Dot-Attributes-Orthogonal]
graph=splines=ortho
node=
edge=
[X-UMBRELLO-Dot-Attributes-Polyline]
graph=splines=polyline
node=
edge=
[X-UMBRELLO-Dot-Attributes-Direct]
graph=splines=false
node=
edge=
......
......@@ -115,6 +115,11 @@ QPointF AssociationLine::endPoint() const
return m_points.at(m_points.size()-1);
}
void AssociationLine::addPoint(const QPointF &point)
{
m_points.append(point);
}
/**
* Inserts the passed in \a point at the \a index passed in and
* recalculates the bounding rect.
......
......@@ -117,6 +117,7 @@ public:
QPointF startPoint() const;
QPointF endPoint() const;
void addPoint(const QPointF& point);
void insertPoint(int index, const QPointF& point);
void removePoint(int index);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment