Thursday, September 24, 2009

Random Thoughts: Visas and RaVis

1. Visas

I'm applying for a visa to the Russian Federation. One of the questions they ask on the visa application is to list all of the countries you've visited in the past 10 years and the years you visited them. This is a non-trivial question for me.

2. RaVis

This is a textbook example of everything that's wrong with open source software. And probably a perfect example of Conway's Law. It's mainly developed by the UN (yes, that UN). I have an import line like this:

import org.un.cava.birdeye.ravis.graphLayout.visual.edgeRenderers.BaseEdgeRenderer


Yeah. Right.

3. RaVis, Part II

Because this took me literally all morning to figure out. Here's how you add nodes to an existing RaVis graph:


// I'm using XML-formatted objects, as per the example code.
var o : XML = new XML("");

// What none of the postings tell you is that you need to
// create the new node on the vgraph (view), not the model
// graph. The vgraph will automatically create the model
// nodes for you.

var n1 : IVisualNode = vgraph.createNode(null, o);

// I'm using an existing node as the second part of the link
var n2 : IVisualNode = graph.nodeByStringId("1").vnode;

// Then, again in the view, link the two nodes together.
// The vgraph will create the edge in the model for you
var ive : IVisualEdge = vgraph.linkNodes(n1, n2);

// If you have MXML edgeLabelRenderers, you'll need to add
// data to the model and view Edge object. (Oddly, the model
// linkNodes takes an object parameter. But the view does not.)
o = new XML("")
ive.data = ive.edge.data = o;

// With this code, you don't have to do something like
// vgraph.graph = graph or a vgraph.draw. It just happens


Hopefully this will help someone else...

0 Comments:

Post a Comment

<< Home