fr.lifl.jedi.gui.display.colorGrid.view
Interface AgentDisplayer

All Known Implementing Classes:
ColorRectangleDisplayer, ColorRectangleWithLineDisplayer, ColorTriangleDisplayer, EmptyDisplayer, IconDisplayer, StaticColorRectangleDisplayer, StaticColorTriangleDisplayer, StaticIconDisplayer

public interface AgentDisplayer

This is the parent interface of all objects that are used by the ColorGridGUI in order to display an instance of an agent family.

Version:
JEDI V 2.2
Created the 4th nov. 2008
Modified the 5th may 2009
Author:
Yoann Kubera
SMAC Team (Systèmes Multi-Agents et Comportement)
LIFL (Laboratoire d'Informatique Fondamentale de Lille)
University of Lille, France

Method Summary
 void drawAgent(java.awt.Graphics g, Environment e, Agent a, int factor, int height)
          Displays the agent in the environment.
 boolean isDisplayable(Agent a)
          Checks if the agent is displayed in GUI or not.
 boolean isDisplayedInBackground()
          Checks if the agent has to be displayed on the background of the GUI.
 

Method Detail

isDisplayable

boolean isDisplayable(Agent a)
Checks if the agent is displayed in GUI or not.

Parameters:
a - The agent checked by this method
Returns:
true if the agent is displayed in the GUI.

isDisplayedInBackground

boolean isDisplayedInBackground()
Checks if the agent has to be displayed on the background of the GUI.

Returns:
true if the agent has to be displayed on the background of the GUI.

drawAgent

void drawAgent(java.awt.Graphics g,
               Environment e,
               Agent a,
               int factor,
               int height)
Displays the agent in the environment.

Sadly, Swing uses a cartesian coordinate system where the y axis goes from up to down. Thus, y coordinates have to be inverted, in order to correspond to coordinates in the model used in JEDI.

This requires a particular additional parameter, that corresponds to the total height of displayed simulation.

The width of the black border around the environment is equal to factor. Keep in mind that the black border all around the environment has to be taken into account when computing displayed areas: the (0, 0) coordinate of the environment lies in the (factor, factor - height) coordinate of the panel.

Parameters:
g - The object where drawing is made.
e - The environment of the simulation.
a - The agent to be displayed.
factor - The scaling factor used. It defines the number of pixels corresponding to a unit in the environment.
height - The height of the rectangle displaying the environment. It is equal to the height of the environment * the scaling factor.