MASON-INTEREST-L Archives

February 2015

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Wed, 11 Feb 2015 17:59:33 +0100
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
MIME-Version:
1.0
Message-ID:
In-Reply-To:
Content-Type:
multipart/alternative; boundary=089e0160ac6ea89e55050ed2ee98
From:
Simone Gabbriellini <[log in to unmask]>
Parts/Attachments:
text/plain (2282 bytes) , text/html (3506 bytes)
perfect, they both works...

I only have to move part of the labels from behind the agents, but I think
it won't be hard...

Thank you very much!

Best,
Simone

2015-02-11 17:46 GMT+01:00 Sean Luke <[log in to unmask]>:

> On Feb 11, 2015, at 11:35 AM, Simone Gabbriellini <
> [log in to unmask]> wrote:
>
> > Actually I was copying your code from antsforage, but if I do as you
> suggest here, my agents don't get colored, they remains grey as default.
>
> I'm sorry, I should have said:
>
>     public final void draw(Object object, Graphics2D graphics, DrawInfo2D
> info) {
>         if (answer)
>             paint = rightAnswer;
>         else
>             paint = badAnswer;
>         super.draw(object, graphics, info);
>         }
>
> > About the labeling, I have added these lines as suggested:
> > But nothing's happening... where am I wrong?
>
> I forgot that your agents are also SimplePortrayals.  In the
> FieldPortrayal, when it needs to know how to draw an object, it does this:
>
> If there is a portrayalForAll, use it.
> Else if the object is null:
>         Use the portrayalForNull if there is one
>         Else if a portrayal is explicitly registered for null, use it.
>         Else use the defaultNullPortrayal.
> Else if the object is non-null:
>         If the object implements the appropriate Portrayal interface, use
> the object itself.
>         Else use the portrayalForNonNull if there is one
>         Else if a portrayal is explicitly registered for the object, use
> that portrayal.
>         Else if a Portrayal is registered for the object's exact class
> (superclasses are ignored), use that portrayal.
>         Else use the portrayalForRemainder if there is one
>         Else use the default Portrayal object.
>
> The problem is that your object implements the Portrayal interface, so it
> overrides the portrayal we set up for the object's class.  If your field
> only contains object of this type simplest solution would be to register
> the portrayal for ALL rather than for a given CLASS:
>
> bugPortrayal.setPortrayalForAll(foo);
>
> Sean
>



-- 
-----------------------------------------------------------------

Simone Gabbriellini, PhD

Post-doctoral Researcher
ANR founded research project "DIFFCERAM"
GEMASS, CNRS & Paris-Sorbonne.

mobile: +39 340 39 75 626
email: [log in to unmask]


ATOM RSS1 RSS2