swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swarm-Support] Problems with ObserverSwarm Solved


From: Crile Doscher
Subject: [Swarm-Support] Problems with ObserverSwarm Solved
Date: Tue, 4 Oct 2005 15:57:18 -0400

For the benefit of those who might encounter the same problem, I switched my elevDisplay from a Value2dDisplay to an Object2dDisplay and set the ObjectCollection to a list of cells. I then added a line to the Cell.m: -drawSelfOn method that reads the cell elevation and converts it to a number comparable to my colormap. My thanks to Steve Railsback for putting me on the right track - relevant code included below.
C

From ObserverSwarm.m:
. . .
colormap = [Colormap create: [self getZone]];

//colours [0,90) are assigned to the gray range - darker means lower

//code based on HeatbugObserverSwarm.m

for (i = 0; i < 90; i++)

[colormap setColor: i ToRed: (double)i / 89.0 Green: (double) i / 89.0

Blue: (double) i / 89.0];

//colour 90 is set to blue for cumec display

[colormap setColor: 90 ToName: "blue"];

. . .

elevDisplay = [Object2dDisplay createBegin: self];

[elevDisplay setDisplayWidget: worldRaster];

[elevDisplay setDiscrete2dToDisplay: [modelSwarm getElevSpace]];

[elevDisplay setDisplayMessage: M(drawSelfOn:)];

[elevDisplay setObjectCollection: [[modelSwarm getElevSpace] getCellList]];

From Cell.m:

-drawSelfOn: (id <Raster>) r {


cellColor = [self getElevLevel]/11.0;

[r drawPointX: x Y: y Color: cellColor];


return self;

}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]