Using Gaphas with libavoid

Jump to: navigation, search

Libavoid is a library that does 2D line-routing to avoid obstacles. Gaphas is a canvas widget written in Python using Cairo. We use Gaphas in our canvas-based modeller. We would like now to incorporate Gaphas' support for libavoid so that building diagrams on our canvas-based modeller is much easier to do.

Gaphas is by Arjan Molenaar; Adaptagrams is by Michael Wybrow.

This is still work in progress, so expect the instructions to change!

Building the Python wrapper of libavoid

  • Install Cython. You need 0.14 or later. For Ubuntu 10.04, you can use a PPA build from here. It seems to also work with Ubuntu 9.10.
  • Obtain latest patched libavoid code from Arjan Molenaar using

git clone
cd adaptagrams/cola
git checkout -b cython origin/cython

You will need to make a small change (tested on Ubuntu 9.10 and 10.04): add "#include <stdlib.h>" to assertions.h, just before '#ifdef NDEBUG'.

python build_ext
sudo python install

Building the patched version of Gaphas

git clone
cd gaphas
git checkout -b avoid origin/avoid
python build_ext
sudo python install

Test libavoid with Gaphas

From the gaphas director avoid, just run "python"