[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz] Gulp.
From: |
Benja Fallenstein |
Subject: |
[Gzz] Gulp. |
Date: |
Tue, 01 Apr 2003 04:10:59 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030327 Debian/1.3-4 |
I've swallowed :-)
In the proposed system, vobs would be organized in a DAG (directed,
acyclic graph). A vob cannot contain itself; otherwise it would have an
infinite number of children...
It follows that if we start at some place in the hierarchy and walk
upwards towards the root, we can find at most one instance of any given vob.
We specify the endpoints of a connection by specifying--
- a vob that contains both endpoints, and the connection itself;
- the indices of the endpoints, inside said vob.
We then have the slightly weird situation that the connection has a
pointer to a vob which contains the connection. Huh! But since the
connection doesn't *contain* that vob-- it just has a pointer to it-- we
don't run into problems.
When we want to render the connection, we go upwards in the tree until
we find the containing vob. From there, we can interpret the endpoint
indices, and see how they're interpolated.
For example, we could have an Overlay or Tray or Stack or Scene or
Sequence or List or whatever-it-is-called vob as the container. Let's
say that Sequence (or whatever) has this interface:
int add(Vob);
void close();
The vob would be mutable until closed; it could be placed into another
vob only after closing it. (If violated, an exception is thrown.) Being
able to build its contents up iteratively instead of passing them all to
the constructor is more convenient. -- add() returns the index the added
vob has been assigned inside the Sequence vob.
Then placing two ends and a connection could be something like this:
seq = Sequence()
a = seq.add(Translate(Circle(r=20), 70, 30)) + 1
b = seq.add(Translate(Circle(r=15), 50, 50)) + 1
seq.add(Connection(seq, a, b))
seq.close()
Note: a,b would be integers (paths inside the Sequence vob); add()
returns the indices of the Translate vobs, while add()+1 returns the
indices of the Translate vobs' contents, i.e., the circles.
Maybe we could get a little more object-oriented by writing,
seq.add(Connection(seq.getTransform(a), seq.getTransform(b)))
In this case, the reference to the Sequence vob would be encapsulated in
the Transform object. This seems like quite a natural way to do this,
actually.
The Sequence could still be used as a flyweight.
So this part does work out! :-)
- Benja
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz] Gulp.,
Benja Fallenstein <=