Question

I am using Dia to draw a few simple class diagrams.

However I cannot make an association class (I can't connect a class to an association). Probably the program does not support it natively, but if anyone knows it is possible I'd really be glad, and someone in the future would then find this question and get a clear answer (other sites I found on the web were kinda vague).

Was it helpful?

Solution

Here's what you could do:

  • Make sure that your association is one straight line.
  • On top/below your association, add a standard line object.
  • You'll be able to connect to the middle of the standard line object using a connection line of your choice.

OTHER TIPS

Here's another alternative, albeit merely a variation of Steffen's approach.

First draw your two associated classes, and the Association object connecting them.

Then draw a simple Line object that attaches to the same exact connection points as the association object. Of course now you've got this ugly extra line in there, so to fix that double-click the line (or right-click, Properties), and change the color to match the background color, effectively hiding it from view.

Now you have a connection point right at the middle of the association line where you can attach a dotted line connected to your Association Class.

You'll probably want to ensure you use menu Objects, Send to Back on your invisible line so that it doesn't get drawn over top of other objects.

With this approach, you don't have to ensure that your Association object stays as a straight line, and you can also move your objects all around and everything will stay connected.

Good news: The UML association has been improved and will allow for such connections: http://git.gnome.org/browse/dia/commit/?id=302d5038e755cabb5ce9292d66d0ab9113153e15 This new feature will be included in the upcoming version 0.98. Until it is released, you can use the Dia Development VM to testdrive the new functionalities: http://dia-installer.de/developer/index.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top