Re: Avoiding connection conflicts/cross-overs in UML diagrams



On Mon, Jul 14, 2008 at 5:13 PM, David Laban <alsuren gmail com> wrote:
Hello

I want to make dia automatically lay out connections on UML diagrams so
that  they avoid hitting other objects and crossing over each other as much as
possible. My uncle pointed out that MS visio does a pretty good job of this
on-the-fly.

Are there any scripts that will already do this? (I would be happy to have
it as a keyboard shortcut)
There are no scripts currently doing this that I know of. There currently only is the lib/autoroute.c approach pointed to by Lars, but that is restricted to information available for a single connection line.

If not, how should I start going about making one?

Now that I've ported Fred Morcos' autolayout algorithm to a PyDia plug-in I can give my usual answer: you should start with a PyDia script ;) See: http://svn.gnome.org/viewvc/dia/trunk/plug-ins/python/autolayoutforce.py?view=markup

Also, if I wanted to make it re-arrange the nodes optimally
(graphviz-style)  how easy would that be?

This is the part I usually find hard, at least my amateur attempts on layout algorithms did not produce results worth publishing. But read on ...

On 14.07.2008 23:59, Avijit Ghosh wrote:
> This is a good idea, in fact we are thinking of outsourcing a
> project that is going to do just this on a related type of editor.
> I am trying to get them to move this to dia actually rather than a
> new invention of the wheel.
> That said, the way to go is basic monte carlo / optimization as it
> is easy to implement and works.
Could you give us some references on the algorithm? If it really easy to implement I just may do it ;-)

> If you have your head around the GUI / DIA code internals (which I
> do not),
For me this part looks easy, but of course this a matter of experience ;)

> the math side is relatively easy.  I can help if you need.
Some pseudo code would certainly help.

> For straight lines you need just the coordinates and sizes,
These are already used with the "force based autolayout" mentioned above.

> For the other straight lines you also need the line info and the
> "turn" point thingy.
Getting all the points from a polygon is just:

        points = object.properties["orth_points"].value
        # modify to your needs and set them again
        object.properties["orth_points"] = points

object.properties["poly_points"] for a PolyLine and
object.properties["bez_points"] for a BezierLine

For a straigt line autolayout would only be possible by moving the Object they are connected to or by moving the line Handles to different connection points on the Object.

> For Bezier curves things would be a bit complicated.
> But for the first three if you can work out where that info is
> stored (and modified obviously) it would be pretty easy to do.
I have tried to document the above mentioned plug-in to show where to get the information. Please don't hesitate to ask for specific points - regarding Dia object access - where it is still unclear.

        Hans

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert



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