diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-11-17 02:15:07 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-11-17 06:10:34 +0100 |
commit | 4e158477364f5f75b12b7f93d94207394f741e98 (patch) | |
tree | 6d684655cc1df3cf9c5c86b8bfe2bc28802b517f /examples/uml | |
parent | 5df612493f17895780134ed0c3feae5150645571 (diff) |
Add handling of UML association with aggregation = 'composite'
Change-Id: I10a9c266df43c4c43eb98e9aca820a1c049e8be6
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'examples/uml')
-rw-r--r-- | examples/uml/duse-mt/src/app/example.xmi | 2 | ||||
-rw-r--r-- | examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/examples/uml/duse-mt/src/app/example.xmi b/examples/uml/duse-mt/src/app/example.xmi index e733ab01..26f0e517 100644 --- a/examples/uml/duse-mt/src/app/example.xmi +++ b/examples/uml/duse-mt/src/app/example.xmi @@ -23,7 +23,7 @@ <ownedAttribute xmi:type="uml:Property" visibility="public" name="age" xmi:id="MyRootPackage-Package1-Student-age"> <type href=":/metamodels/PrimitiveTypes.xmi#Integer"/> </ownedAttribute> - <ownedAttribute xmi:type="uml:Property" visibility="public" name="advisor" xmi:id="MyRootPackage-Package1-Student-advisor"> + <ownedAttribute xmi:type="uml:Property" visibility="public" name="advisor" xmi:id="MyRootPackage-Package1-Student-advisor" aggregation="composite"> <type href="MyRootPackage-Package1-Professor"/> </ownedAttribute> <ownedOperation xmi:type="uml:Operation" name="getName" xmi:id="MyRootPackage-Package1-Student-getName"/> diff --git a/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp b/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp index 807ad3f4..b1790525 100644 --- a/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp +++ b/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp @@ -74,11 +74,20 @@ void RelationshipItem::paint(QPainter *painter) if (originalLine.intersect(QLineF(x2 + w2, y2 , x2 + w2, y2 + h2), &p2) == QLineF::BoundedIntersection) {} painter->drawLine(p1.x()-x(), p1.y()-y(), p2.x()-x(), p2.y()-y()); + QPolygonF arrow(QVector<QPointF>() << QPointF(-10, -10) << QPointF(0, 0) << QPointF(-10, +10)); QTransform transform; transform.translate(p2.x()-x(), p2.y()-y()); transform.rotate(-originalLine.angle()); - QPolygonF arrow(QVector<QPointF>() << QPointF(-10, -10) << QPointF(0, 0) << QPointF(-10, +10)); painter->drawPolyline(transform.map(arrow)); + + if (_end1Aggregation == "composite") { + painter->setBrush(QBrush(Qt::black)); + QPolygon diamond(QVector<QPoint>() << QPoint(0, 0) << QPoint(10, -10) << QPoint(20, 0) << QPoint(10, 10)); + QTransform transform; + transform.translate(p1.x()-x(), p1.y()-y()); + transform.rotate(-originalLine.angle()); + painter->drawPolygon(transform.map(diamond)); + } } QQuickRectangle *RelationshipItem::end1() const |