Re: API



2008/10/11 Lars Ræder Clausen <lars raeder dk>:
You may want to look at projects like http://www.graphviz.org/

Thank you for the suggestion.

Sounds like you are talking about an API for generating .dia files.
Since .dia files are (optionally gzipped) XML files, there is no
code-based API as such. A number of programs generate .dia files, see
the page <URL:http://live.gnome.org/Dia/Links> under "Tools that
generate Dia diagrams" for some examples.  Any XML generator will work,
and there are DTDs available in the doc directory of the source.

+1

If you look inside Diagram.pm of the Autodia project you can find
templates of XML output for Dia as well as Umbrello, etc.

You can even use graphviz to do the layout using an option I can't
remember and requires 30 minutes of googling to find last time I
checked :)

There are libraries available that you can use to work out the
positioning of the elements in the file, but dia will (to date) allow
you to provide almost any sane positions for elements and so you can
just lay out the objects like a hand of cards and make the user
organise them, or calculate the positioning yourself (unfortunately,
that is buried deep inside the C so I've never been able to work it
out).

Examples of how to position elements would be pretty cool, either
snippets of the C code, or worked examples with plain math would be
very handy for those of us who programmatically create dia files.

Also it's worth noting that the standard behaviour of dia when
encountering a file with an extension of .xml is to use some random
python plugin to read it and then barf, rather than spotting that it's
a dia file and handling it correctly - I've raised this bug and
hopefully it will DTRT in the next release.

Cheers.

A.

-- 
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting



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