|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.lifl.jedi.gui.display.colorGrid.view.agentDisplay.EmptyDisplayer
public class EmptyDisplayer
This class defines a tool used to display agents in the environment.
It does not display the agent.
This class uses the singleton design pattern.
JEDI V 2.0 |
Created the 4th nov. 2008 |
Modified the 5th may 2009 |
Yoann Kubera |
SMAC Team (Systèmes Multi-Agents et Comportement) |
LIFL (Laboratoire d'Informatique Fondamentale de Lille) |
University of Lille, France |
Constructor Summary | |
---|---|
EmptyDisplayer()
|
Method Summary | |
---|---|
void |
drawAgent(java.awt.Graphics g,
Environment e,
Agent a,
int factor,
int height)
Displays the agent in the environment. |
static EmptyDisplayer |
getInstance()
Gets the instance of this singleton class. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EmptyDisplayer()
Method Detail |
---|
public static EmptyDisplayer getInstance()
public void drawAgent(java.awt.Graphics g, Environment e, Agent a, int factor, int height)
AgentDisplayer
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.
drawAgent
in interface AgentDisplayer
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.AgentDisplayer.drawAgent(java.awt.Graphics, fr.lifl.jedi.model.Environment, fr.lifl.jedi.model.Agent, int, int)
public boolean isDisplayable(Agent a)
AgentDisplayer
isDisplayable
in interface AgentDisplayer
a
- The agent checked by this method
true
if the agent is
displayed in the GUI.AgentDisplayer.isDisplayable(fr.lifl.jedi.model.Agent)
public boolean isDisplayedInBackground()
AgentDisplayer
isDisplayedInBackground
in interface AgentDisplayer
true
if the agent has to be
displayed on the background of the GUI.AgentDisplayer.isDisplayedInBackground()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |