Re: [graphviz-interest] graphviz on iphone ?
Glen Low <glen.low <at> pixelglow.com>
2009-06-19 14:27:45 GMT
Oliver, All
> hello.
>
> is there a way to embed graphviz in iphone apps ? instaviz does a
> great job, but sometimes graphiz functionality is needed as part of
> an application, i. e. to display workflows in a worklflow application.
>
> best regards
> oliver bruening
Yes you can indeed embed Graphviz in iPhone apps. I've generally
contributed all iPhone-related changes due to Instaviz back to the
mainline, so at the very least you can compile a minimal Graphviz that
supports output to Quartz, the native rendering system on OS X.
First though a little diversion into the different ways you could
incorporate Graphviz graphs into your iPhone app:
1. Instaviz has a URL scheme so you can simply just open an Instaviz
URL with your graph to get it to display. See
http://www.cocoadev.com/index.pl?ChooseYourOwniPhoneURLScheme
(at the bottom).
This is probably easiest but means you have a dependency on the user
having Instaviz, and no nice way to get back to your app. (Although
I'm hoping to get two-way URL handling working in Instaviz 2.0, so
users can click on nodes and be sent back to the program. Nice to
simulate HTML maps for example.)
E.g. Nocsos DBR and IdeaTree have successfully implemented the
instaviz URL.
2. You could try any of the wrappers/modules I wrote around the
Graphviz guts. I haven't yet decided whether to license them or just
open-source them... they are:
a. GraphKit is a simple wrapper around Graphviz, so that each
Graphviz component becomes an Objective-C object. You can then use
Objective-C to do rendering etc.
b. GraphKitDraw is another layer which provides a persistent,
rendered object model, this would be useful for things like displaying
selections, displaying part of a graph, hit-testing etc.
3. You could use Graphviz embedded as-is:
Here's the configure I use for iPhoneOS 3.0 and Graphviz 2.22:
./configure
--build=i686-apple-darwin9
--host=arm-apple-darwin9
--disable-dependency-tracking
--enable-shared=no
--enable-static=yes
--enable-ltdl=no
--enable-swig=no
--enable-tcl=no
--with-codegens=no
--with-fontconfig=no
--with-freetype2=no
--with-ipsepcola=yes
--with-libgd=no
--with-quartz=yes
--with-visio=yes
--with-x=no
CC="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2"
CPP="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
-E"
CXX="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2"
CXXCPP="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g+
+-4.2 -E"
OBJC="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2"
LD="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld"
CPPFLAGS="-arch armv6 -isysroot /Developer/Platforms/
iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk -miphoneos-version-
min=3.0"
CXXCPPFLAGS="-arch armv6 -isysroot /Developer/Platforms/
iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk -miphoneos-version-
min=3.0"
These are the Graphviz modules I build:
patchwork
sparse
rbtree
visio
cdt
circogen
common
core
dot_layout
dotgen
fdpgen
graph
gvc
neato_layout
neatogen
pack
pathplan
twopigen
quartz
vpsc
At the end of the build process you should get a bunch of static libs
that you can "just" link into your iPhone executable. The libs will
allow you to output PDF's, CGImage's or directly onto a CGContext.
Hope that helps.
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen
twitter: pixelglow
_______________________________________________
graphviz-interest <at> research.att.com
https://mailman.research.att.com/mailman/listinfo/graphviz-interest