Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## turtlekit.kernel
Class Viewer

    java.lang.Object
      madkit.kernel.AbstractAgent
          madkit.kernel.Watcher
              turtlekit.kernel.Observer
                  turtlekit.kernel.Viewer

All Implemented Interfaces:
  java.io.Serializable, ReferenceableAgent

Direct Known Subclasses:
  FlavorViewer, FlavorViewer2, LifeViewer, LifeViewer2, LifeViewer3, SoccerViewer, SpecialViewer

    public class Viewer

extends Observer

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).

Version:
  2.0 22/08/2000
Author:
  Fabien MICHEL
See Also:
  Serialized Form

Field Summary

Fields inherited from class turtlekit.kernel.Observer
`envHeight, envWidth, patchGrid`

Constructor Summary
`Viewer()`

Method Summary
`void` | `display()` the display itself
`boolean` | `getFlash()`
`int` | `getFlashStepSize()`
`boolean` | `getRedrawAll()`
`boolean` | `getShow()`
`void` | `initGUI()` MadKit usage, no redefinition
`void` | `paintPatch(java.awt.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(java.awt.Graphics g, Turtle t, int x, int y, int cellS)` In the same way, you can give a special graphic representation of your turtles.
`void` | `setFlash(boolean add)`
`void` | `setFlashStepSize(int add)`
`void` | `setRedrawAll(boolean b)`
`void` | `setShow(boolean add)`
`void` | `setup()` init the GUI

Methods inherited from class turtlekit.kernel.Observer
`activate, end, getSimulationGroup, watch`

Methods inherited from class madkit.kernel.Watcher
`addProbe, addProbe, getProbes, removeAllProbes, removeProbe, update`

Methods inherited from class madkit.kernel.AbstractAgent
`broadcastMessage, broadcastMessage, connectedWithCommunity, createGroup, createGroup, debug, destroyGroup, disposeMyGUI, foundGroup, getAddress, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getAgentWithRole, getAvailableCommunities, getBean, getController, getCurrentKernelAddress, getDebug, getExistingGroups, getExistingGroups, getExistingRoles, getExistingRoles, getGroups, getGUIObject, getMessageBoxSize, getMyGroups, getMyGroups, getMyRoles, getMyRoles, getName, getRoles, hasGUI, hashCode, hideMyGUI, 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

### Viewer

    public Viewer()

Method Detail

### setFlash

    public void setFlash(boolean add)

### getRedrawAll

    public boolean getRedrawAll()

### setRedrawAll

    public void setRedrawAll(boolean b)

### getFlash

    public boolean getFlash()

### setShow

    public void setShow(boolean add)

### getShow

    public boolean getShow()

### setFlashStepSize

    public void setFlashStepSize(int add)

### getFlashStepSize

    public int getFlashStepSize()

### initGUI

    public final void initGUI()

  MadKit usage, no redefinition

  Overrides:
    `initGUI` in class `AbstractAgent`

### setup

    public void setup()

  init the GUI

  Overrides:
    `setup` in class `Observer`

### paintPatch

    public void paintPatch(java.awt.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. 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);

### paintTurtle

    public void paintTurtle(java.awt.Graphics g,
                            Turtle t,
                            int x,
                            int y,
                            int cellS)

  In the same way, you can give a special graphic representation of your turtles. Default: g.setColor(t.getColor()); g.fillRect(x,y,cellS,cellS);

### display

    public void display()

  the display itself

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.