On Oct 1, 2004, at 11:25 AM, Niels Grabe wrote:
> I am trying to figure out how to introduce new agents into my
> during run time. My conceptual problem seems to be that due to the
> of visualization and simulation I cannot simply add a portrayal to a
> agent. I studied Crowd3D Simulation but did it wasn`t of much help to
> me. Is
> there some documentation with explanation available ? PS: I wasn`t
> sure whether to post the mail on the listserver..
MASON's field portrayals are designed to check to see if new objects
have entered the scene and handle that properly. All they need to have
is a portrayal registered for that kind of object. You can always
register a portrayal in the middle of the run, but it's rarely
necessary -- just register portrayals for all possible kinds of
expected objects beforehand.
- In the field portrayal:
- setPortrayalForObject(...) specifies a portrayal for a specific
object (if the object shows up)
- setPortrayalForClass(...) specifies a portrayal for any objects
showing up which belong to a specific class. That may be quite useful
- setDefaultPortrayal(...) specifies the portrayal to use when no
other portrayal is registered. You may find that helpful as well.
- setPortrayalForAll(...) says that ALL objects in the field must use
this same portrayal. This overrides all other methods, so don't use it
unless your field has only one kind of object.
- An object can always portray itself. The easiest approach here is to
just make the object a subclass of SimplePortrayal2D (or
SimplePortrayal3D) and override the relevant code. If you're
unfamiliar with Java3D or 2D Java graphics, it's probably easiest to
subclass from some subclass like OvalPortrayal2D or CubePortrayal3D.