com.rubecula.darwin.examples.pepperedmoth
Class Painter_PepperedMoth

java.lang.Object
  extended by com.rubecula.darwin.visualization.Painter_
      extended by com.rubecula.darwin.examples.pepperedmoth.Painter_PepperedMoth
All Implemented Interfaces:
Painter

public class Painter_PepperedMoth
extends Painter_

TODO fix the architectural issues. Implementation of Painter for the PepperedMoth example. In this implementation, there is only ever one visualization model. The method paintPopulation() resets the given graphics context to the background, then draws a given title (in red); and paintIndividual draws a circle (diameter 20) of the appropriate color at the appropriate location.

Author:
Robin Hillyard

Field Summary
 
Fields inherited from interface com.rubecula.darwin.visualization.Painter
BACKGROUND_COLOR
 
Constructor Summary
Painter_PepperedMoth(java.lang.String title)
           
 
Method Summary
protected  java.lang.String getTitle()
           
 void paintBase(java.awt.Graphics g, int width, int height)
          Base method: simply clears the rectangle defined by {0, 0, width, height} to the (previously defined) background color.
 void paintIndividual(java.awt.Graphics g, Avatar avatar)
          Method to paint a representation of an organism.
 
Methods inherited from class com.rubecula.darwin.visualization.Painter_
isIdentify, paintIdentification, paintVisualization, setIdentify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Painter_PepperedMoth

public Painter_PepperedMoth(java.lang.String title)
Parameters:
title -
Method Detail

paintBase

public void paintBase(java.awt.Graphics g,
                      int width,
                      int height)
Description copied from class: Painter_
Base method: simply clears the rectangle defined by {0, 0, width, height} to the (previously defined) background color. /* (non-Javadoc)

Specified by:
paintBase in interface Painter
Overrides:
paintBase in class Painter_
Parameters:
g - a graphics context, typically a buffered image.
width - the width of the area in which we may draw (0..width are legal for x coordinates).
height - the height of the area in which we may draw (0..height are legal for y coordinates).
See Also:
Painter_.paintBase(java.awt.Graphics, int, int)

paintIndividual

public void paintIndividual(java.awt.Graphics g,
                            Avatar avatar)
Description copied from interface: Painter
Method to paint a representation of an organism. This method is called (indirectly) by Visualizer_.paintComponent(Graphics) method, once for each individual.

Parameters:
g - a graphics context, typically a buffered image.
avatar - the individual from the population model to be painted.
See Also:
Painter.paintIndividual(java.awt.Graphics, com.rubecula.darwin.visualization.Avatar)

getTitle

protected java.lang.String getTitle()
Returns:
the title XXX this is never used.


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.