edu.turtlekit2.demos.diffusion
Class PheroViewer

java.lang.Object
  extended by madkit.kernel.AbstractAgent
      extended by madkit.kernel.Watcher
          extended by edu.turtlekit2.kernel.agents.Observer
              extended by edu.turtlekit2.kernel.agents.Viewer
                  extended by edu.turtlekit2.demos.diffusion.PheroViewer
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, Serializable, EventListener, MouseInputListener, madkit.kernel.ReferenceableAgent

public class PheroViewer
extends Viewer

Adapted from the diffusion simulation of TurtleKit (v1). FlavorViewer overrides the paintPatch method in order to adjust the onscreen color of a patch to the flavor's value and then make the diffusion visible

Version:
1.2 4/1/2000
Author:
F. MICHEL
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.turtlekit2.kernel.agents.Viewer
Viewer.GridCanvas
 
Field Summary
 
Fields inherited from class edu.turtlekit2.kernel.agents.Viewer
allTurtles, cellSize, clickedPoint, onScreen, redrawAll, xDecay, yDecay
 
Fields inherited from class edu.turtlekit2.kernel.agents.Observer
attrib, envHeight, envWidth, flavors, gridValues, patchGrid, probe1, probe2, simulationGroup
 
Constructor Summary
PheroViewer()
           
 
Method Summary
 void paintPatch(Graphics g, Patch p, int x, int y, int CellSize)
          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.
 
Methods inherited from class edu.turtlekit2.kernel.agents.Viewer
display, initGUI, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, paintInfo, paintTurtle, readyToDisplay, setup
 
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
 

Constructor Detail

PheroViewer

public PheroViewer()
Method Detail

paintPatch

public void paintPatch(Graphics g,
                       Patch p,
                       int x,
                       int y,
                       int CellSize)
Description copied from class: Viewer
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. As the simulation display is optimized, be sure that you draw a figure that is contained in the reserved square or set the redrawAll variable to true (in the property box or in constructor so the patches are all repainted first, then the turtles (avoid to leave turtle trace on the floor, but realy slow down the simulation). By example you can use the patch access methods to decide the color to display for this. default: g.setColor(p.getColor()); g.fillRect(x,y,cellS,cellS);

Overrides:
paintPatch in class Viewer