I have a grid of "culture" agents, each one has a different color based on features of the culture.
I don't know how to portray a grid of agents (here - class Culture) in which each agent can have it's own color.
setPortrayalForAll() colors all of the agents the same. I don't know how to
"setPortrayalForEach"
In the code segment below, getColorIndex() could access the color for each agent in a Bag. Is this the general idea?
Thanks
Randy Latimer
SparseGridPortrayal2D individCulturePortrayal = new SparseGridPortrayal2D()
...
individCulturePortrayal.setField(((CultureWorld)state).getCultureGrid());
individCulturePortrayal.setPortrayalForAll(
new sim.portrayal.simple.RectanglePortrayal2D(
colorMap[((CultureWorld)state).getColorIndex()],.8) );
|