|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmadkit.kernel.AbstractAgent
madkit.kernel.Watcher
edu.turtlekit2.kernel.agents.Observer
edu.turtlekit2.kernel.agents.Viewer
public class Viewer
Viewer is the simulation default world displayer agent (an specialized Observer, it can be extended to redefine the default representation of patches and turtles (a square fill with the color return by the getColor() method of them).
Nested Class Summary | |
---|---|
protected class |
Viewer.GridCanvas
Titre : GridCanvas Description : a convenient class to display a view of the world |
Field Summary | |
---|---|
TurtleProbe |
allTurtles
|
int |
cellSize
|
Point |
clickedPoint
Mouse interaction |
Viewer.GridCanvas |
onScreen
|
boolean |
redrawAll
|
int |
xDecay
|
int |
yDecay
|
Fields inherited from class edu.turtlekit2.kernel.agents.Observer |
---|
attrib, envHeight, envWidth, flavors, gridValues, patchGrid, probe1, probe2, simulationGroup |
Constructor Summary | |
---|---|
Viewer()
|
Method Summary | |
---|---|
void |
display()
the display itself |
void |
initGUI()
MadKit usage, no redefinition |
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
void |
mouseWheelMoved(MouseWheelEvent e)
|
void |
paintInfo(Graphics g)
|
void |
paintPatch(Graphics g,
Patch p,
int x,
int y,
int cellS)
override this method if you want an other patch graphic representation giving an on screen location (x,y), a patch p to draw and a reserved on screen patch size: a square of pixels with a side of cellS. |
void |
paintTurtle(Graphics g,
Turtle t,
int x,
int y,
int cellS)
In the same way, you can give a special graphic representation of your turtles. |
boolean |
readyToDisplay()
|
void |
setup()
init the GUI |
Methods inherited from class edu.turtlekit2.kernel.agents.Observer |
---|
activate, flavorsContains, getAllValues, getAttrib, getBooleanParam, getBooleanParam, getColorParam, getColorParam, getDoubleParam, getDoubleParam, getFlavor, getFlavorName, getFlavors, getFloatParam, getFloatParam, getIntParam, getIntParam, getParam, getParam, getSimulationGroup, getStringParam, getStringParam, setAttrib, setFlavors, watch |
Methods inherited from class madkit.kernel.Watcher |
---|
addProbe, addProbe, end, getProbes, removeAllProbes, removeProbe, update |
Methods inherited from class madkit.kernel.AbstractAgent |
---|
broadcastMessage, broadcastMessage, connectedWithCommunity, createGroup, createGroup, debug, disposeMyGUI, foundGroup, getAddress, getAgentInformation, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getAgentWithRole, getAvailableCommunities, getBean, getController, getCurrentKernelAddress, getDebug, getExistingGroups, getExistingGroups, getExistingRoles, getExistingRoles, getGroups, getGUIObject, getMessageBoxSize, getMyGroups, getMyGroups, getMyRoles, getMyRoles, getName, getRoles, hasGUI, hashCode, isBelongingToGroup, isBelongingToGroup, isCommunity, isGroup, isGroup, isMemberOf, isMemberOf, isMessageBoxEmpty, isRole, isRole, joinGroup, killAgent, launchAgent, launchAgent, leaveGroup, leaveGroup, leaveRole, leaveRole, nextMessage, print, println, receiveMessage, redisplayMyGUI, requestRole, requestRole, requestRole, restoreAgent, sendMessage, sendMessage, sendMessage, setBean, setController, setDebug, setGUIObject, setName, setOutput, setOutputWriter, toString, windowClosing |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int cellSize
public Viewer.GridCanvas onScreen
public TurtleProbe allTurtles
public boolean redrawAll
public int xDecay
public int yDecay
public Point clickedPoint
Constructor Detail |
---|
public Viewer()
Method Detail |
---|
public void initGUI()
initGUI
in class madkit.kernel.AbstractAgent
public void setup()
setup
in class Observer
public void paintPatch(Graphics g, Patch p, int x, int y, int cellS)
public void paintTurtle(Graphics g, Turtle t, int x, int y, int cellS)
public void paintInfo(Graphics g)
public void display()
public boolean readyToDisplay()
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |