|
From: David D. <dde...@cs...> - 2004-07-29 16:22:35
|
Greetings,
I am a new user of RePast 2.2. I am building a simulation that uses
RePast's network visualization capabilities.
I believe I've found a bug in the way Network2DDisplay manages the scaled
width/height of its nodes and its SimGraphics instance.
The issue is that
(1) the nodePoint hash table contains scaled widths and
heights for the nodes. (See lines preceding every
nodePoint.put(...) call in Network2DDisplay.java.)
Yet
(2) when Network2DDisplay sets up the SimGraphics instance (g)
before letting the nodes draw themselves, it does a
g.setDrawingParameters(nodePoint width entry,
nodePoint height entry,
0)
rather than a
g.setDrawingParametersNoScale(nodePoint width entry,
nodePoint height entry,
0)
which I believe it should do.
The result is that the SimGraphics instance then rescales both the
width and height parameters *again*, so that graphics drawn with
SimGraphics.drawX method calls grow/shrink faster as they should.
One quick way to see that there is a problem is run the demo/jiggle.jar
and note that the links do not connect the center of masses of the
nodes as the window is scaled. The links connect where the center
of masses *should* be.
Without really understanding all the RePast code, I believe the
fix is to replace very
g.setDrawingParameters
call in Network2DDisplay.java with a corresponding
g.setDrawingParametersNoScale
call.
Works for me. And fixes the jiggle demo too.
Cheers,
David DeVault
|