Bug 128351 - Lines connect to bounding box of component interface instead of interface
Summary: Lines connect to bounding box of component interface instead of interface
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: 2.15 (KDE Applications 14.12)
Assignee: Ralf Habacker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-31 09:26 UTC by Rutger Claes
Modified: 2014-11-26 12:40 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.14.80 (KDE 14.11.80)
Sentry Crash Report:


Attachments
screenshot showing problem (2.55 KB, image/png)
2013-11-14 22:11 UTC, Ralf Habacker
Details
Similar example for instanciated template class (3.03 KB, image/png)
2013-11-15 00:08 UTC, Ralf Habacker
Details
UML2 interface ball and socket notation (4.71 KB, image/png)
2014-07-31 20:55 UTC, Oliver Kellogg
Details
Hiding problems with UML2 interface ball an socket notation (7.38 KB, image/png)
2014-07-31 22:15 UTC, Ralf Habacker
Details
xmi test file (15.99 KB, application/x-uml)
2014-07-31 22:17 UTC, Ralf Habacker
Details
screenshot showing resized interface widget (13.04 KB, image/png)
2014-08-05 04:10 UTC, Ralf Habacker
Details
screenshot with bounding box of interface and draw as circle (17.13 KB, image/png)
2014-08-14 05:57 UTC, Ralf Habacker
Details
testcase for template class association line connections (9.80 KB, application/x-uml)
2014-08-14 06:13 UTC, Ralf Habacker
Details
further testcase for template class association attachment (49.54 KB, text/x-xmi)
2014-08-15 04:23 UTC, Oliver Kellogg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rutger Claes 2006-05-31 09:26:45 UTC
Version:           1.5.3 (using KDE 3.5.2, Debian Package 4:3.5.2-2+b1 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.16-13

In a component diagram lines drawn to an interface never reach the interface circle.  The are connected to some sort of bounding box.
If the line connects to the top of the interface, the line touches the circle.  When the line connects from the left or right of the interface, there is a space.
It would be nice if all lines would connect with the interface like lines connect to a usecase and special activities.
Comment 1 Ralf Habacker 2013-11-14 22:11:22 UTC
Created attachment 83571 [details]
screenshot showing problem
Comment 2 Ralf Habacker 2013-11-14 23:14:41 UTC
Git commit 727b756df423b0fc4342708f0e8b7693b6dd950e by Ralf Habacker.
Committed on 14/11/2013 at 23:11.
Pushed by habacker into branch 'master'.

Add shape() reimplementation for drawing interface widgets.

M  +14   -0    umbrello/widgets/classifierwidget.cpp
M  +1    -0    umbrello/widgets/classifierwidget.h

http://commits.kde.org/umbrello/727b756df423b0fc4342708f0e8b7693b6dd950e
Comment 3 Ralf Habacker 2013-11-15 00:08:41 UTC
Created attachment 83576 [details]
Similar example for instanciated template class
Comment 4 Oliver Kellogg 2014-07-30 17:12:11 UTC
(In reply to Ralf Habacker from comment #2)
> Git commit 727b756df423b0fc4342708f0e8b7693b6dd950e by Ralf Habacker.
> Committed on 14/11/2013 at 23:11.
> Pushed by habacker into branch 'master'.
> 
> Add shape() reimplementation for drawing interface widgets.

When an association enters from left, right, or bottom, it still does not reach the interface ball but instead only reaches the bounding rectangle of the name.
In the case of DrawAsCircle, perhaps we could give the name its own FloatingText?
shape() could then just return the circle (without name-text rectangle) and the user could manually rearrange the name position in case of crossing associations.
Comment 5 Ralf Habacker 2014-07-31 16:50:00 UTC
(In reply to Oliver Kellogg from comment #4)
> (In reply to Ralf Habacker from comment #2)
> > Git commit 727b756df423b0fc4342708f0e8b7693b6dd950e by Ralf Habacker.
> > Committed on 14/11/2013 at 23:11.
> > Pushed by habacker into branch 'master'.
> > 
> > Add shape() reimplementation for drawing interface widgets.
> 
> When an association enters from left, right, or bottom, it still does not
> reach the interface ball but instead only reaches the bounding rectangle of
> the name.
> In the case of DrawAsCircle, perhaps we could give the name its own
> FloatingText?
> shape() could then just return the circle (without name-text rectangle) and
> the user could manually rearrange the name position in case of crossing
> associations.

Would it not be enough to make sure that the association line ends at the circle/box and has a z-order which is below the text/widget, so that the text is drawn in front of the line ?
Comment 6 Oliver Kellogg 2014-07-31 20:55:39 UTC
Created attachment 88068 [details]
UML2 interface ball and socket notation

(In reply to Ralf Habacker from comment #5)
> 
> Would it not be enough to make sure that the association line ends at the
> circle/box and has a z-order which is below the text/widget, so that the
> text is drawn in front of the line ?

I'm not sure. See attached diagram snippet:
If the text covered the interface usage association then the connection to the socket would not be very obvious.
Comment 7 Ralf Habacker 2014-07-31 22:04:30 UTC
(In reply to Oliver Kellogg from comment #4)
> (In reply to Ralf Habacker from comment #2)
> > Git commit 727b756df423b0fc4342708f0e8b7693b6dd950e by Ralf Habacker.
> > Committed on 14/11/2013 at 23:11.
> > Pushed by habacker into branch 'master'.
> > 
> > Add shape() reimplementation for drawing interface widgets.
> 
> When an association enters from left, right, or bottom, it still does not
> reach the interface ball but instead only reaches the bounding rectangle of
> the name.
> In the case of DrawAsCircle, perhaps we could give the name its own
> FloatingText?
> shape() could then just return the circle (without name-text rectangle) and
> the user could manually rearrange the name position in case of crossing
> associations.

In any case are you sure, that the code finding the line intersection to the related widget uses shape() already ? From the AssociationWidget code I would say it uses currently the simple widget rectangle. This would need to be changed first.
Comment 8 Ralf Habacker 2014-07-31 22:15:33 UTC
Created attachment 88069 [details]
Hiding problems with UML2 interface ball an socket notation

There are additional hiding problems in this diagram
Comment 9 Ralf Habacker 2014-07-31 22:16:51 UTC
Comment on attachment 83576 [details]
Similar example for instanciated template class

Here using correct widget shape for line intersecting would solve the issue.
Comment 10 Ralf Habacker 2014-07-31 22:17:48 UTC
Created attachment 88070 [details]
xmi test file
Comment 11 Ralf Habacker 2014-08-04 19:15:18 UTC
(In reply to Ralf Habacker from comment #7)
> (In reply to Oliver Kellogg from comment #4)
> > (In reply to Ralf Habacker from comment #2)
> > > Git commit 727b756df423b0fc4342708f0e8b7693b6dd950e by Ralf Habacker.
> > > Committed on 14/11/2013 at 23:11.
> > > Pushed by habacker into branch 'master'.
> > > 
> > > Add shape() reimplementation for drawing interface widgets.
> > 
> > When an association enters from left, right, or bottom, it still does not
> > reach the interface ball but instead only reaches the bounding rectangle of
> > the name.
> > In the case of DrawAsCircle, perhaps we could give the name its own
> > FloatingText?
> > shape() could then just return the circle (without name-text rectangle) and
> > the user could manually rearrange the name position in case of crossing
> > associations.
> 
> In any case are you sure, that the code finding the line intersection to the
> related widget uses shape() already ? From the AssociationWidget code I
> would say it uses currently the simple widget rectangle. This would need to
> be changed first.

The first and last point of an AssociationWidget is connected to the related widget bounding rectangle in void AssociationWidget::updateRegionLineCount()
Comment 12 Oliver Kellogg 2014-08-04 21:31:17 UTC
Git commit b32458c3013194bb2961269966b8018c5d63c586 by Oliver Kellogg.
Committed on 04/08/2014 at 21:32.
Pushed by okellogg into branch 'master'.

(In reply to Ralf Habacker from comment #8)
> Created attachment 88069 [details]
> Hiding problems with UML2 interface ball an socket notation
>
> There are additional hiding problems in this diagram

Thanks for the test case.  Here is my attempt at fixing; please confirm.

umbrello/widgets/widget_utils.{h,cpp} function closestPoints()
- New function determines the approximate closest points of two polygons.

umbrello/widgets/associationwidget.cpp function calculateEndingPoints()
- In case (size < 2), pass QPainterPath::toFillPolygon() converted shape()
  of pWidgetA and pWidgetB into call of Widget_Utils::closestPoints().
  Pass components p1() and p2() of returned QLine into call of
  m_associationLine->setEndPoints().

umbrello/widgets/classifierwidget.{h,cpp}
- New member m_pInterfaceName of type FloatingTextWidget holds the name in
  case of interface drawn as circle.
- Reimplement UMLWidget functions onWidget() and widgetWithID() to include
  consideration of m_pInterfaceName.

umbrello/widgets/classifierwidget.cpp
- In function shape() case
    (classifier()->isInterface() && visualProperty(DrawAsCircle)),
  add only the ellipse of the current rect() to path.
- In function drawAsCircle(),
  - In case (m_Assocs.size() > 1) fix Y value of requireArc;
  - Remove painting of name underneath circle, this is now delegated to
    the FloatingTextWidget m_pInterfaceName.
- In function calculateAsCircleSize() remove coding of name underneath
  circle, this is now delegated to the FloatingTextWidget m_pInterfaceName.
- In function setDrawAsCircle(),
  - In case drawAsCircle add allocation of m_pInterfaceName and set up its
    geometry;
  - Choose same center point between circular and rectangular display so
    that on toggling argument the widget changes shape but not position.
- In function changeToClass() ensure that visualProperty(DrawAsCircle) is
  false.
- In functions {loadFrom,saveTo}XMI add loading/saving of m_pInterfaceName
  as child <floatingtext>.

umbrello/widgets/floatingtextwidget.cpp function onWidget()
- Consider case pw->baseType() == wt_Interface with
  ClassifierWidget::getDrawAsCircle() returning true in on-widget test.
- Clearly separate handling of parent-widget relative (isWidgetChild=true)
  from absolute (isWidgetChild=false) coordinates.

umbrello/version.h
- Increment XMI_FILE_VERSION due to added <floatingtext> in
  <interfacewidget drawascircle="1">

M  +1    -1    umbrello/version.h
M  +14   -2    umbrello/widgets/associationwidget.cpp
M  +106  -47   umbrello/widgets/classifierwidget.cpp
M  +8    -3    umbrello/widgets/classifierwidget.h
M  +15   -6    umbrello/widgets/floatingtextwidget.cpp
M  +324  -0    umbrello/widgets/widget_utils.cpp
M  +4    -0    umbrello/widgets/widget_utils.h

http://commits.kde.org/umbrello/b32458c3013194bb2961269966b8018c5d63c586
Comment 13 Ralf Habacker 2014-08-05 04:08:39 UTC
(In reply to Oliver Kellogg from comment #12)
> Git commit b32458c3013194bb2961269966b8018c5d63c586 by Oliver Kellogg.
> Committed on 04/08/2014 at 21:32.
> Pushed by okellogg into branch 'master'.
> 
> (In reply to Ralf Habacker from comment #8)
> > Created attachment 88069 [details]
> > Hiding problems with UML2 interface ball an socket notation
> >
> > There are additional hiding problems in this diagram
> 
> Thanks for the test case.  Here is my attempt at fixing; please confirm.

looks good so far. I checked the following use cases:
- Moving interface widget drawn as circle, text is moved too -> okay
- Moving associated text -> okay
- Save and load xmi related file -> okay
- load xmi file with previous version -> okay 
- save xmi file with previous version and load with recent version - text position has been reseted -> okay
Comment 14 Ralf Habacker 2014-08-05 04:10:04 UTC
Created attachment 88118 [details]
screenshot showing resized interface widget

The following use case looks not so good:
- resize the interface widget -> the assocation line ends in empty space
Comment 15 Ralf Habacker 2014-08-05 04:11:00 UTC
(In reply to Ralf Habacker from comment #14)
> Created attachment 88118 [details]
> screenshot showing resized interface widget
> 
> The following use case looks not so good:
> - resize the interface widget -> the assocation line ends in empty space

BTW: I enabled debug for ClassifierWidget, which shows the widget shape as green outline.
Comment 16 Oliver Kellogg 2014-08-05 18:44:41 UTC
(In reply to Ralf Habacker from comment #14)
> Created attachment 88118 [details]
> screenshot showing resized interface widget
> 
> The following use case looks not so good:
> - resize the interface widget -> the assocation line ends in empty space

IMHO resize on interface ball is of dubious value.
How about disabling resize in this case.

BTW, I see this PR is assigned to you.
I hope I'm not interfering with your work?
Comment 17 Ralf Habacker 2014-08-05 19:22:30 UTC
(In reply to Oliver Kellogg from comment #16)
> (In reply to Ralf Habacker from comment #14)
> > Created attachment 88118 [details]
> > screenshot showing resized interface widget
> > 
> > The following use case looks not so good:
> > - resize the interface widget -> the assocation line ends in empty space
> 
> IMHO resize on interface ball is of dubious value.
> How about disabling resize in this case.

good idea. 
 
> BTW, I see this PR is assigned to you.
> I hope I'm not interfering with your work?

no, thanks for working together :-)
Comment 18 Ralf Habacker 2014-08-05 19:28:52 UTC
(In reply to Ralf Habacker from comment #11)

> The first and last point of an AssociationWidget is connected to the related
> widget bounding rectangle in void AssociationWidget::updateRegionLineCount()

In which the intersection point of the widgets shape with the first and/or last association line segment need to be calculated. The Qt bug tracker already has a related request. See https://bugreports.qt-project.org/browse/QTBUG-32313
Comment 19 Oliver Kellogg 2014-08-06 17:38:02 UTC
Git commit 09b6aed9e7c8d0cb94b375a6e59bbb5ac08daaf3 by Oliver Kellogg.
Committed on 06/08/2014 at 17:38.
Pushed by okellogg into branch 'master'.

(In reply to Ralf Habacker from comment #17)
> (In reply to Oliver Kellogg from comment #16)
> >
> > IMHO resize on interface ball is of dubious value.
> > How about disabling resize in this case.
>
> good idea.

umbrello/widgets/classifierwidget.cpp function setDrawAsCircle()
- In case drawAsCircle == true set m_resizable false.
- In case drawAsCircle == false set m_resizable true.

M  +2    -0    umbrello/widgets/classifierwidget.cpp

http://commits.kde.org/umbrello/09b6aed9e7c8d0cb94b375a6e59bbb5ac08daaf3
Comment 20 Oliver Kellogg 2014-08-10 18:27:56 UTC
Git commit 3360998ea25f5974455939bd100fb4c37bd17d36 by Oliver Kellogg.
Committed on 10/08/2014 at 18:28.
Pushed by okellogg into branch 'master'.

(In reply to Ralf Habacker from comment #9)
> Comment on attachment 83576 [details]
> Similar example for instantiated template class
>
> Here using correct widget shape for line intersecting would solve the issue.

Here is an implementation for corrected widget shape of template classes.
However, apparently Widget_Utils::closestPoints() still has a bug related to
anchoring in the NorthWest, West, and SouthWest regions; I'll look into that
next.

umbrello/widgets/umlwidget.{h,cpp}
- At function calculateSize() add optional bool argument `withExtensions'
  defaulting to true.
- At functions calculateSize(), minimumSize(), and getFontMetrics(), add
  `const' qualifier to enable use in overriding QGraphicsItem::shape().
- In function init() add allocation of the m_pFontMetrics array elements.
  Reason: Ad hoc allocation of m_pFontMetrics element is removed from
  getFontMetrics() in order to make that method `const'.
- In function forceUpdateFontMetrics() for-loops let loop variable count
  backwards so that m_font ends up initialized to FT_NORMAL (index 0.)

umbrello/widgets/classifierwidget.{h,cpp}
- UMLWidget overriding function calculateSize() assumes minimumSize() body.
  If `withExtensions' arg is true then size is calculated to include
  template box; else size does not include template box.
- Function minimumSize() now simply calls calculateSize() using default
  withExtensions argument.
- Declare following functions `const':
  calculateTemplatesBoxSize(), calculateAsCircleSize(), minimumSize(),
  displayedMembers(), displayedAttributes(), displayedOperations().
  This is required due to their usage in overriding QGraphicsItem::shape().
- In function paint() rename m_bodyOffsetY to bodyOffsetY.
  Reason: This is a local variable not a class member.
- In function shape(), if calculateTemplatesBoxSize() returns non-zero then
  add the templates box rectangle to the path, and displace the main
  rectangle by a postive Y offset of templatesBoxSize.height() minus MARGIN.

umbrello/widgets/notewidget.{h,cpp}
- Adjust calculateSize() override to changed signature in UMLWidget.

umbrello/widgets/activitywidget.{h,cpp}
umbrello/widgets/actorwidget.{h,cpp}
umbrello/widgets/artifactwidget.{h,cpp}
umbrello/widgets/categorywidget.{h,cpp}
umbrello/widgets/combinedfragmentwidget.{h,cpp}
umbrello/widgets/componentwidget.{h,cpp}
umbrello/widgets/datatypewidget.{h,cpp}
umbrello/widgets/entitywidget.{h,cpp}
umbrello/widgets/enumwidget.{h,cpp}
umbrello/widgets/floatingtextwidget.{h,cpp}
umbrello/widgets/forkjoinwidget.{h,cpp}
umbrello/widgets/nodewidget.{h,cpp}
umbrello/widgets/notewidget.{h,cpp}
umbrello/widgets/usecasewidget.{h,cpp}
umbrello/widgets/objectnodewidget.{h,cpp}
umbrello/widgets/objectwidget.{h,cpp}
umbrello/widgets/packagewidget.{h,cpp}
umbrello/widgets/preconditionwidget.{h,cpp}
umbrello/widgets/regionwidget.{h,cpp}
umbrello/widgets/signalwidget.{h,cpp}
umbrello/widgets/statewidget.{h,cpp}
umbrello/widgets/umlwidget.{h,cpp}
- Adjust minimumSize() override to changed signature in UMLWidget.

umbrello/widgets/associationwidget.cpp
- In function calculateEndingPoints(), apply
    QPolygonF::translated(pWidgetA->pos()) on polyA
  and apply
    QPolygonF::translated(pWidgetB->pos()) on polyB
  to properly handle non child widgets (i.e. with absolute pos().)
- In function updateRegionLineCount(), for calculating `pt' employ
  Widget_Utils::closestPoints() following the pattern used in
  calculateEndingPoints().

umbrello/widgets/widget_utils.cpp
- New function middle() returns the middle value of two axis values.
  The function handles not only relative but also absolute coordinates.
- In function closestPoints() employ function middle() in the
  result.setLine() arguments for regions North, South, West, and East.

M  +1    -1    umbrello/widgets/activitywidget.cpp
M  +1    -1    umbrello/widgets/activitywidget.h
M  +1    -1    umbrello/widgets/actorwidget.cpp
M  +1    -1    umbrello/widgets/actorwidget.h
M  +3    -3    umbrello/widgets/artifactwidget.cpp
M  +3    -3    umbrello/widgets/artifactwidget.h
M  +39   -26   umbrello/widgets/associationwidget.cpp
M  +1    -1    umbrello/widgets/categorywidget.cpp
M  +1    -1    umbrello/widgets/categorywidget.h
M  +50   -31   umbrello/widgets/classifierwidget.cpp
M  +8    -6    umbrello/widgets/classifierwidget.h
M  +1    -1    umbrello/widgets/combinedfragmentwidget.cpp
M  +1    -1    umbrello/widgets/combinedfragmentwidget.h
M  +1    -1    umbrello/widgets/componentwidget.cpp
M  +1    -1    umbrello/widgets/componentwidget.h
M  +1    -1    umbrello/widgets/datatypewidget.cpp
M  +1    -1    umbrello/widgets/datatypewidget.h
M  +1    -1    umbrello/widgets/entitywidget.cpp
M  +1    -1    umbrello/widgets/entitywidget.h
M  +1    -1    umbrello/widgets/enumwidget.cpp
M  +1    -1    umbrello/widgets/enumwidget.h
M  +1    -1    umbrello/widgets/floatingtextwidget.cpp
M  +1    -1    umbrello/widgets/floatingtextwidget.h
M  +1    -1    umbrello/widgets/forkjoinwidget.cpp
M  +1    -1    umbrello/widgets/forkjoinwidget.h
M  +1    -1    umbrello/widgets/nodewidget.cpp
M  +1    -1    umbrello/widgets/nodewidget.h
M  +3    -4    umbrello/widgets/notewidget.cpp
M  +2    -2    umbrello/widgets/notewidget.h
M  +1    -1    umbrello/widgets/objectnodewidget.cpp
M  +1    -1    umbrello/widgets/objectnodewidget.h
M  +1    -1    umbrello/widgets/objectwidget.cpp
M  +1    -1    umbrello/widgets/objectwidget.h
M  +1    -1    umbrello/widgets/packagewidget.cpp
M  +1    -1    umbrello/widgets/packagewidget.h
M  +1    -1    umbrello/widgets/preconditionwidget.cpp
M  +1    -1    umbrello/widgets/preconditionwidget.h
M  +1    -1    umbrello/widgets/regionwidget.cpp
M  +1    -1    umbrello/widgets/regionwidget.h
M  +1    -1    umbrello/widgets/signalwidget.cpp
M  +1    -1    umbrello/widgets/signalwidget.h
M  +3    -3    umbrello/widgets/statewidget.cpp
M  +1    -1    umbrello/widgets/statewidget.h
M  +13   -11   umbrello/widgets/umlwidget.cpp
M  +3    -3    umbrello/widgets/umlwidget.h
M  +1    -1    umbrello/widgets/usecasewidget.cpp
M  +1    -1    umbrello/widgets/usecasewidget.h
M  +15   -8    umbrello/widgets/widget_utils.cpp

http://commits.kde.org/umbrello/3360998ea25f5974455939bd100fb4c37bd17d36
Comment 21 Oliver Kellogg 2014-08-10 22:01:22 UTC
Git commit 933143c62f5877bf649ad090d5d34d2e45e2195f by Oliver Kellogg.
Committed on 10/08/2014 at 22:02.
Pushed by okellogg into branch 'master'.

(In reply to Oliver Kellogg from comment #20)
> Git commit 3360998ea25f5974455939bd100fb4c37bd17d36 by Oliver Kellogg.
> Committed on 10/08/2014 at 18:28.
> Pushed by okellogg into branch 'master'.
> [...]
> However, apparently Widget_Utils::closestPoints() still has a bug related to
> anchoring in the NorthWest, West, and SouthWest regions; I'll look into that
> next.

Here is the fix for this problem.

umbrello/widgets/widget_utils.cpp function closestPoints()
- Introduce constants selfLastIndex and otherLastIndex which exclude the
  redundant point in case QPolygonF::isClosed() returns true on self resp.
  other.
- In for-loops over `other' replace upper bound `other.size() - 1' by
  otherLastIndex.
- In for-loops over `self' replace upper bound `self.size() - 1' by
  selfLastIndex.
- In loops of cases NorthWest, SouthWest, NorthEast, and SouthEast, replace
  "<" comparisons by "<=" and replace ">" comparisons by ">=".

The association lines now do attach to the template-class widgets.
However, the attachment points are not always optimal.
Perhaps the algorithm used by Widget_Utils::closestPoints() can be improved.

M  +28   -26   umbrello/widgets/widget_utils.cpp

http://commits.kde.org/umbrello/933143c62f5877bf649ad090d5d34d2e45e2195f
Comment 22 Ralf Habacker 2014-08-14 05:57:44 UTC
Created attachment 88248 [details]
screenshot with bounding box of interface and draw as circle

Bug report: the bounding box and shape is not aligned with the painted circle.
Comment 23 Ralf Habacker 2014-08-14 06:13:17 UTC
Created attachment 88249 [details]
testcase for template class association line connections
Comment 24 Ralf Habacker 2014-08-14 06:20:28 UTC
(In reply to Oliver Kellogg from comment #21)
> Git commit 933143c62f5877bf649ad090d5d34d2e45e2195f by Oliver Kellogg.
> Committed on 10/08/2014 at 22:02.
> Pushed by okellogg into branch 'master'.
> 
> (In reply to Oliver Kellogg from comment #20)
> > Git commit 3360998ea25f5974455939bd100fb4c37bd17d36 by Oliver Kellogg.
> > Committed on 10/08/2014 at 18:28.
> > Pushed by okellogg into branch 'master'.
> > [...]
> > However, apparently Widget_Utils::closestPoints() still has a bug related to
> > anchoring in the NorthWest, West, and SouthWest regions; I'll look into that
> > next.
> 
> Here is the fix for this problem.
> 
With unchecked "angular association line" settings the connected points looks good (see "testcase for template class association line connections"). You can see by moving the class "neue_klasse" around the template class, that the shape is really used.

With above mentioned settings checked the bounding box of the ClassifierWidget is still used. My guess where to fix is AssociationWidget::updateRegionLineCount() at the locations where angular != 0. 

{ 
> The association lines now do attach to the template-class widgets.
> However, the attachment points are not always optimal.
> Perhaps the algorithm used by Widget_Utils::closestPoints() can be improved.

With which testcase can I see this ?
Comment 25 Oliver Kellogg 2014-08-15 04:23:07 UTC
Created attachment 88264 [details]
further testcase for template class association attachment

(In reply to Ralf Habacker from comment #24)
> (In reply to Oliver Kellogg from comment #21)
> > [...]
> > The association lines now do attach to the template-class widgets.
> > However, the attachment points are not always optimal.
> > Perhaps the algorithm used by Widget_Utils::closestPoints() can be improved.
> 
> With which testcase can I see this ?

On moving class_with_tmplt around, much too strong preference is given to the template box.
Comment 26 Oliver Kellogg 2014-08-18 23:56:47 UTC
(In reply to Oliver Kellogg from comment #25)
> Created attachment 88264 [details]
> further testcase for template class association attachment
> 
> (In reply to Ralf Habacker from comment #24)
> > (In reply to Oliver Kellogg from comment #21)
> > > [...]
> > > The association lines now do attach to the template-class widgets.
> > > However, the attachment points are not always optimal.
> > > Perhaps the algorithm used by Widget_Utils::closestPoints() can be improved.
> > 
> > With which testcase can I see this ?
> 
> On moving class_with_tmplt around, much too strong preference is given to
> the template box.

FYI I found the fix for this.
Will take a few days until I can commit.
Comment 27 Oliver Kellogg 2014-08-21 05:52:48 UTC
(In reply to Ralf Habacker from comment #15)
> (...)
> BTW: I enabled debug for ClassifierWidget, which shows the widget shape as
> green outline.

Thanks for implementing this, it really helped debugging.
Comment 28 Oliver Kellogg 2014-08-22 20:30:35 UTC
Git commit f6708577c462ea7f5d4c4e16605c04b88738f91c by Oliver Kellogg.
Committed on 22/08/2014 at 20:27.
Pushed by okellogg into branch 'master'.

(In reply to Oliver Kellogg from comment #26)
> > [...]
> > On moving class_with_tmplt around, much too strong preference is given to
> > the template box.
>
> FYI I found the fix for this.
> Will take a few days until I can commit.

Here we go:

umbrello/widgets/associationwidget.cpp function updateRegionLineCount()
- In the non angular case, apply QPainterPath::toSubpathPolygons() on
  pWidget{A,B}->shape() instead of toFillPolygon(), and form a single
  poly{A,B} from the polyList{A,B} returned by toSubpathPolygons() by
  uniting together the subpath polygons using QPolygonF::united().

umbrello/widgets/widget_utils.cpp
- In functions prevPoint() and nextPoint() add consideration of
  poly.isClosed() for calculating the index of the result point.
- New function findLine() factors code common to regions North, South,
  West, and East from function closestPoints().
- In function closestPoints(),
  - Remove obsolete local variables;
  - Reduce local variables otherPoint{1,2} to otherPoint and selfPoint{1,2}
    to selfPoint;
  - In regions North, South, West, and East, use new function findLine().

M  +16   -2    umbrello/widgets/associationwidget.cpp
M  +98   -167  umbrello/widgets/widget_utils.cpp

http://commits.kde.org/umbrello/f6708577c462ea7f5d4c4e16605c04b88738f91c
Comment 29 Ralf Habacker 2014-10-27 10:58:49 UTC
In case of Settings->use angular association lines is unchecked the problem is solved.
Comment 30 Ralf Habacker 2014-10-27 11:02:40 UTC
(In reply to Ralf Habacker from comment #22)
> Created attachment 88248 [details]
> screenshot with bounding box of interface and draw as circle
> 
> Bug report: the bounding box and shape is not aligned with the painted
> circle.

This bug is still present
Comment 31 Ralf Habacker 2014-10-27 11:14:12 UTC
(In reply to Ralf Habacker from comment #30)
> (In reply to Ralf Habacker from comment #22)
> > Created attachment 88248 [details]
> > screenshot with bounding box of interface and draw as circle
> > 
> > Bug report: the bounding box and shape is not aligned with the painted
> > circle.
> 
> This bug is still present

The bug is not present anymore if I set ClassifierWidget::SOCKET_INCREMENT = 0
Comment 32 Ralf Habacker 2014-10-27 11:23:33 UTC
Git commit cd1e100060f13872840723d3d3173278b729ced8 by Ralf Habacker.
Committed on 27/10/2014 at 11:21.
Pushed by habacker into branch 'master'.

Fix bug 'Bounding box and shape is not aligned with the painted circle' on drawing interfaces on class diagrams as circle.

M  +3    -1    umbrello/widgets/classifierwidget.cpp

http://commits.kde.org/umbrello/cd1e100060f13872840723d3d3173278b729ced8