MASON-INTEREST-L Archives

November 2008

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:
Pelle Evensen <[log in to unmask]>
Reply To:
Date:
Tue, 11 Nov 2008 21:33:34 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (40 lines)
I have a problem in a portrayal's draw() method, sometimes the draw 
field from the DrawInfo2D object and the newinfo and info from
SparseGridPortrayal2D looks like this for *some* calls in an update;

SparseGridPortrayal2D
newinfo: DrawInfo2D[ Draw:
java.awt.geom.Rectangle2D$Double[x=352.0,y=107.0,w=0.0,h=0.0] Clip:
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=500.0,h=400.0]]
info: DrawInfo2D[ Draw:
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=500.0,h=400.0] Clip:
java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=500.0,h=400.0]]
Our portrayal's draw(), info.draw:
java.awt.geom.Rectangle2D$Double[x=352.0,y=107.0,w=0.0,h=0.0]

This is the code (more or less) where we set up the portrayal;
    public static void setupPortrayals(SimState state, Display2D display) {
        SparseGridPortrayal2D barterPortrayal = new SparseGridPortrayal2D();
        int width = display.getWidth();
        int height = display.getHeight();
        SparseGrid2D agentPositions = new SparseGrid2D(width, height);
      
        for(Agent e : agents) {
            agentPositions.setObjectLocation(e, Math.sin(idx) * idx,
Math.cos(idx) * idx);
            idx++;
        }
        barterPortrayal.setField(agentPositions);
       
        display.attach(barterPortrayal, "Agents");
        barterPortrayal.setPortrayalForClass(
                Agent.class,
                new BasicAgentPortrayal((Simulation) state));

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

Regards,
  Pelle

ATOM RSS1 RSS2