On 01.11.2013 18:21, Rob Weir wrote:
On Fri, Nov 1, 2013 at 12:51 PM, Armin Le Grand <armin.le.gr...@me.com> wrote:
     Hi Rob,


On 01.11.2013 17:23, Rob Weir wrote:
Yesterday I was create a diagram in Impress.  It was a complicated
diagram, around 20 small circles and squares, with a lot of connectors
between them.  I wasted a lot of time to make it look good, making the
nodes so they did not overlap, getting the nodes arranged so the
closely-connected ones were adjacent, optimizing the placement of the
connectors, etc.  It was a tedious manual process.

I wish there was a button I could press in the toolbar called
"optimize layout" that would do that all for me.

This should be possible.  Graph layout algorithms are well-known [1].
There are popular open source packages like graphviz that implement
some of these algorithms.  You define the nodes and the edges and
graphviz determines an optimal layout.

It should be possible to take an Impress (or Draw) diagram and extract
the abstract qualities of the diagram (the nodes, and their
connections), create an optimal layout using graphviz and then bring
that layout back into the diagram and apply it.   I know it could be
done by directly operating on the ODF XML.  I assume it could be done
at runtime as well.

That sounds like it could be done easily with an extension that adds a panel to the sidebar. That would solve the two biggest problems (from my point of view):

- provide additional libraries for graph layout and possibly visualization (but not drawing; visualization more in the sense of determining the exact path a connecting curve takes). Graphviz would certainly be one good choice.

- provide the user interface for
= choosing the set of objects to layout (all, selection, all that "look like graph nodes").
  = choose one of many layout algorithms
  = set parameters for the chosen layout algorithm


We can probably not use our connectors for the edges between nodes. They are too restricted in their abilities (fan out/in of only four, predefined connection points, automatic path layout that may or may not be what the graphiviz algorithm wants.

And we have to mark the node shapes in the ODF and store additional information for graphviz (chosen algorithm, parameters). That is the part where my knowledge is not good enough to say whether that is (easily) possible. The rest could probably be done in a week. Maybe this could be task for the next GSOC?

-Andre


Nice idea, and surely useful, but connectors know only the two objects they
are connected with, thus there is no way for them to find out what 'other'
objects they should avoid to travel over. That would be a lot of 'guessing',
That's the point of a graph layout algorithm.  All graphviz needs is a
list of nodes and edges and it applies an algorithm to create an
optimal layout.  There are various algorithms.  Some use physical
analogies, treating the edges as idealized springs and use a
simulation of the physical forces to determine the layout.  Others
apply simulated annealing with an objective function based on number
of overlapping lines and similar aesthetic factors,

e.g. do you avoid objects on the masterpage, too? The rectangle shape the
whole structure is lying above? Who defines what the 'whole structure' is?
When I do diagrams like this I do it on a blank page, with no
masterpage objects.

Surely it can be done e.g. with an extension working on a selection of
objects; as input that selection would need something like the connectors
(how else to define the connecitons?), but potentially cannot use these for
output, simply because connectors are limited to 5 line segments currently
(the whole layouting is based on this, and - even worse - the possible
maximum thee control points to adjust the maximum three inner edges).
Thus, it may be possible by creating simple polygons as output instead of
the connectors, but else I doubt it could be done without core changes,
sorry

I'd do it as three stages:

1) Determine the ideal layout, based on just knowledge of the
topology, i.e., the nodes and edges as points and lines.

2) Apply the ideal layout back to the original diagram.

3) Scale the nodes  if needed to avoid overlap of nodes.  (Or allow
the user to tweak the diagram manually)

It is worth reviewing the example graphviz layouts.  It works rather well:

http://www.graphviz.org/Gallery.php

-Rob


Sincerely,
     Armin

Something to think about.

[1] http://en.wikipedia.org/wiki/Graph_drawing

[2] http://www.graphviz.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org

Reply via email to