[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GraphLib question: setX: Y: behaves fishy for me.
From: |
Paul Johnson |
Subject: |
GraphLib question: setX: Y: behaves fishy for me. |
Date: |
Mon, 30 Dec 2002 17:21:01 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020918 |
I'm using GraphLib 1.2 and I want to position Nodes, then move them
around both by methods like setX:Y: or by repositioning them with the mouse.
What I find is a disconnect between where nodes think they are and where
they show in the picture. Here's what I mean.
The method to nodeItem setX: Y: does not reset items in the Canvas. I
can get the setX:Y: method to work if I change it inside the
DiGraphNode.m file, before createEnd is called on the nodeItem. But, if
I try to use setX:Y: later, it does not register in the Canvas. But the
nodeItem's own coordinates do change.
For example, from the DynamicGraph (boing graph) test example, look
below where I try to position all of the nodes at 55, 66. The set
command is does get through to the nodeItems, but their position on the
grid is not changed accordingly.
This means I have no start time control over positioning of objects, but
I can use the moveX:Y: command to incrementally move.
- buildObjects
{
int i,ii,newK;
id aNode;
[super buildObjects];
theNet = [DiGraph createBegin: [self getZone]];
[theNet setCanvas: graphCanvas];
[theNet createEnd];
for (i = 0; i < population; i++)
[theNet addNode: [[[DiGraphNode createBegin: [self getZone]]
setNodeLabel: "Node"]
createEnd]];
entityList = [theNet getNodeList];
for (i = 0; i < population; i++)
{
aNode = [entityList atOffset: i];
[[aNode getNodeItem] setX: 55 Y: 66];
printf ("aNode says it is at %d %d", [[aNode getNodeItem] getX],
[[aNode getNodeItem] getY]);
}
return self;
}
The output says the node knows its position
./dynamicGraph
aNode says it is at 55 66aNode says it is at 55 66
but they don't show in the graph there.
--
Paul E. Johnson email: address@hidden
Dept. of Political Science http://lark.cc.ku.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- GraphLib question: setX: Y: behaves fishy for me.,
Paul Johnson <=