MASON-INTEREST-L Archives

August 2011

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Sat, 13 Aug 2011 09:17:59 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (72 lines)
On Aug 13, 2011, at 3:57 AM, Martin Erdelen wrote:

> I have then practically copy-pasted the code from the first stages  
> of the
> tutorial into my own simulation, except that:
> -- all "buddy network" related stuff has been omitted;
> -- I am using a toroidal SparseGrid2D field (and  
> SparseGridPortrayal2D), 
>    instead of Continuous2D*

> -- But when 
>    onlyCircleWhenSelected == true,
>    i.e. label and circle only to be displayed when the agent is  
> selected,
>    they are *not* shown.

Right you are.  I tried this out in HeatBugs (which also uses a  
SparseGridPortrayal2D) and changed setupPortrayals as follows:

     public void setupPortrayals()
         {
         bugPortrayal.setField(((HeatBugs)state).buggrid);
		
	SimplePortrayal2D p = new  
sim.portrayal.simple.OvalPortrayal2D(Color.white);
	p = new sim.portrayal.simple.LabelledPortrayal2D(p, "yo");
	((LabelledPortrayal2D)p).setOnlyLabelWhenSelected(true);
	p = new sim.portrayal.simple.CircledPortrayal2D(p);
	((CircledPortrayal2D)p).setOnlyCircleWhenSelected(true);
		
         bugPortrayal.setPortrayalForAll( new MovablePortrayal2D(p));

         heatPortrayal.setField(((HeatBugs)state).valgrid);
         heatPortrayal.setMap(new  
sim.util.gui.SimpleColorMap(0,HeatBugs.MAX_HEAT,Color.black,Color.red));

         display.reset();
	display.repaint();
         }

And it exhibits exactly the behavior you describe.  I'll try to find  
the bug.  (BTW, be sure you're using the SVN repository version of the  
code so as to be in sync with whatever bugfix I find).  BTW, I thought  
this might be an issue of MovablePortrayal2D not passing information  
through (it's on the top of the portrayal chain in the previous  
example.  But it's not.  If you delete it, the problem's still there,  
and if you put it at the BOTTOM of the chain, like the example below,  
MovablePortrayal2D doesn't work either!  :-)

     public void setupPortrayals()
         {
         bugPortrayal.setField(((HeatBugs)state).buggrid);
		
	SimplePortrayal2D p = new MovablePortrayal2D(new  
sim.portrayal.simple.OvalPortrayal2D(Color.white));
	p = new sim.portrayal.simple.LabelledPortrayal2D(p, "yo");
	((LabelledPortrayal2D)p).setOnlyLabelWhenSelected(true);
	p = new sim.portrayal.simple.CircledPortrayal2D(p);
	((CircledPortrayal2D)p).setOnlyCircleWhenSelected(true);
		
         bugPortrayal.setPortrayalForAll( p);

         heatPortrayal.setField(((HeatBugs)state).valgrid);
         heatPortrayal.setMap(new  
sim.util.gui.SimpleColorMap(0,HeatBugs.MAX_HEAT,Color.black,Color.red));

         display.reset();
         display.repaint();
         }

Sean

ATOM RSS1 RSS2