Improving lifeline objects behaviour

Hi guys!

I'm a student of Computer Science at Venice University and, during the software engineering course, i had to spend a lot of time designing UML diagrams. After a couple of days searching for a good (possibly free) software i found Dia.
Let me first say that this piece of software is really great, not only for his simplicity but particularly for his ability to create diagrams very close to UML standards.
The only thing that lets me go totally mad is about UML sequence diagrams. Editing even a simple diagram by adding another call to an object (2 min operation), often cause about 10 min of work to re-align all other arrows, object activation rectangles in lifelines etc.
After some meditation i finally decided to download Dia source code and hack lifeline behaviour by myself trying to improve it in a way that (imho) could tend to speed up sequence diagrams editing process...

There are two main problems in the original version of lifeline object (objects/UML/lifeline.c):
1) Moving boxbot or boxtop handle cause a resize of activation rectangle (the box placed on the dashed line)
2) The distance between connectionpoints in lifeline object activation rectangle are proportional to activation rectangle height (delimited by rtop and rbot)

This cause a misalignment between different lifetimes objects every time you have to move activation rectangle (but not to resize it!) with the pain to re-adjust every other object to maintain arrows (indicating objects messages) looking good.

To explain better what I'm trying to say, i have created a little video of the old behaviour of lifeline object:     (1.2 Mb)

As you can see, simple operation such as adding a new lifetime cause you to spend a lot of time just to re-arrange all activation rectangles.

So... this is what I've done:

* ConnectionPoints distance are no more function of box height, but is box height that is function of ConnectionPoints distance and the number of connection points.

This simple change ensure that, unless you mantain stable cp distance:
1) you can add connection points without loose alignment between connectionpoints of different lifetime objects.
2) you can move activation rectangle in lifetime object without the need to resize it (the operation of resizing activation rectangle is not as necessary as moving it, because it size depends of number of connectionpoints that you need on it)

* I have added a new connectionpoint in the same place of rbot handle so you can attach another lifetime object at the bottom of activation rectangle of the current one in case of multiple activation times in a sequence diagram (this occurs very often)

* I have added 3 new menu items to:
1) Increase distance of connectionpoints by a specific factor
2) Decrease distance of connectionpoints by a specific factor
3) Set distance of connectionpoints to default

What about backward compatibility in loading/saving diagrams?

Old lifeline objects contains in their saved properties rtop, rbot (activation rectangle height) and number of connection points. So.. for us is simple to calculate cp distance by reversing the function explained before. This cause painless perfect loading of old objects, that will operate with new behaviour once loaded.
Also, new objects are saved exactly like old ones ( i haven't modified properties metadata) because there was no need to do that.

To show you the new behaviour of lifetime objects there is (of course!) a video:      (735k)

And this is my patch:

Final considerations:

I decided to post to Dia mailing list because maybe someone of you could find this changes useful or just a good base to start a discussion about how to improve lifeline objects. This is only my proposal... of course i don't expect it will be merged  to Dia main development tree, but for me if just one of you will try to apply the patch to see the result... will be a great success :)

Filippo Bergamasco (fbergama gmail com)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]