Using Gaphas with libavoid

From ASCEND
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 https://github.com/amolenaar/adaptagrams.git
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 setup.py build_ext
sudo python setup.py install

Building the patched version of Gaphas

git clone https://github.com/amolenaar/gaphas.git
cd gaphas
git checkout -b avoid origin/avoid
python setup.py build_ext
sudo python setup.py install

Test libavoid with Gaphas

From the gaphas director avoid, just run "python avoid-demo.py"