swarm-support
[Top][All Lists]
Advanced

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

Re: Multiple Value2dDisplay's on a single Raster


From: Doug Donalson
Subject: Re: Multiple Value2dDisplay's on a single Raster
Date: Tue, 21 Apr 1998 19:53:55 -0700

If I understand what you need correctly, I don't think you need to subclass.

Why not create a "cell" object that's id goes into the 2D grid.  Set up
3 (or however many) color intensities like heatbugs does for red.
Let each cell keep track of it's type and have the type correlasted with
a color.  Say blue 0-15 red 16-31 green 32-47.  I do this and then put all the
cells
in a list so I can display with a "for each" statement.  Also, I am not
guarenteed
that I know the real range of my resource (number of agents) so I put
a variable into the model swarm I would be able to adjust the range real time.
I also put in a single "maxed-out" value so I could see when range adjustments
might need to be made.

For example:

-drawNumberOfJuvenileRedScale: (Raster *) r
{
Color color;
//Check if cell is being used
   if( !active )
      color=34;
//check if  "maxed-out"
   else if( numberOfJuvenileRedScale > [myModel getMaxJuvenileRedScale] )
       color=33;
//calculate color intensity
   else
      color=(Color)((numberOfJuvenileRedScale*32)/
                                                                   [myModel
getMaxJuvenileRedScale]);
   [r drawPointX: x Y: y Color: color-1];
   return self;
}

I don't know whether this addresses your problem or if it's any use but
for what it's worth...

Cheers,

   D3
Rick Riolo wrote:

> I'm not sure what your suggestion is.
> I need to have two grid's of values for storing the values,
> because agent's need to know when they are dealing with
> one kind versus another kind.
> Its just for display that I want them to appear on the
> same raster.
>
> Maybe I wasn't clear: I need to have a grid for each
> resource type because while there can only be one type
> in a given cell, whatever is there can be there
> in different amounts.
>
>  - r
>
> Rick Riolo                           address@hidden
> Program for Study of Complex Systems (PSCS)
> 4068 Randall Lab
> University of Michigan         Ann Arbor MI 48109-1120
> Phone: 313 763 3323                  Fax: 313 763 9267
> http://www.pscs.umich.edu/PEOPLE/rlr-home.html
>
> On Tue, 21 Apr 1998, Parviez HosseiniC wrote:
>
> > Date: Tue, 21 Apr 1998 15:13:32 -0700 (PDT)
> > From: Parviez HosseiniC <address@hidden>
> > To: address@hidden
> > Subject: Re: Multiple Value2dDisplay's on a single Raster
> >
> > Rather than using multiple Value2dDisplays, wouldn't the thing to do be add
> > some code like
> >
> > currValue =[myDiscrete2d getValueAtX:x Y:y];
> > [myDiscrete2d  putValue: (myValue+currValue) X:x Y:y];
> >
> >
> > and have forest, grass, lakes, use same display, just different values?
> > That way zeroes are transparent, and you could do some double checking
> > when you want to turn lakes into trees?
> >
> > -Parviez
> >
> >
> >                   ==================================
> >    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.
> >                   ==================================
> >
>
>                   ==================================
>    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.
>                   ==================================




                  ==================================
   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.
                  ==================================


reply via email to

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