From: Jens K. <jen...@fr...> - 2004-09-12 21:24:44
|
Hi, Using hypergraph.graphapi in Panckoucke : Since Hypergraph is open source, anyone is free to use the packages hypergraph.graphapi (an api similar to TMAPI) and hypergraph.graph (the actual implementation), so it can be used in Panckoucke as well. But that's something you have to decide. Bearing in mind that Panckoucke might get a more general visualisation project, it might be a good idea to develop a generic graph api as a subproject and an implementation that could be used by Panckoucke and Hypergraph and maybe also other projects. This of course means that such an api (resp. implementation) must be quite flexible, resource saving and fast. One could than build abstractors that could abstract from a TM structure but also from a database organisation (tables = nodes, relations = edges or so) etc. When I thought about hypergraph.graphapi, one of the most difficult issues was to decide where to store information like color etc. I didn't want to store it at the node itself, because for me the node really represented the abstract notion of a node.. So I decided to create an AttributeManager (probably similar to your "Gestalten"). This AttributeManger can attach any object to any part of the graph, e.g. : public static final String NODE_FOREGROUND = "nodecolour"; public static final String NODE_BACKROUND = "nodecolour_back"; ... AttributeManager attrMgr = graph.getAttributeManager(); attrMgr.setAttribute(NODE_FOREGROUND, someNode, Color.green); attrMgr.setAttribute(NODE_BACKGROUND, someNode, Color.red); This attaches the object "Color.green" to the node "someNode" and the first parameter is the name of the attribute to allow more than one. Of course, the third parameter could be anything, also a TMObject. An interesting feature of the AttributeManager is that it uses a hierarchy of three levels : 1. The whole graph: attrMgr.setAttribute(NODE_FOREGROUND, graph, Color.white); sets the attribute NODE_FOREGROUND to white or all nodes and edges, unless it's overwritten. 2. Groups of nodes or edges. Any element of a graph can belong to at most one group (for example all edges that represent an instanceOf relationship). One can attach an attribute to a group as a single default for all elements belonging to a group. 3. Single nodes and edges. So, you could set an attribute to a default value for the whole graph, but also for groups. You are also not restricted to special objects, you could use Color, Integer (for line width), float[] for the line stroke (dashed etc) or also Double to attach a weight to an egde. At the moment I don't know the Gestalt design in detail, so I'm not able to compare both ways to add visualisation information to the graph, maybe I'll do this in the next days. By the way, I think information visualisation is a very interesting topic, so I would like to work on the Panckoucke project. This project sounds good. Regards, Jens. |