model.fish.display
Class ParamFishDisplay

java.lang.Object
  extended by model.fish.display.ParamFishDisplay
All Implemented Interfaces:
IFishDisplay
Direct Known Subclasses:
CircleFishDisplay, LittleFishDisplay, NarrowFishDisplay, RoundFishDisplay

public class ParamFishDisplay
extends java.lang.Object
implements IFishDisplay

Parameterized fish display.

Author:
Mathias Ricken

Field Summary
private static java.awt.geom.AffineTransform ATX
           
private static double BODY_LENGTH
           
private static double BODY_WIDTH
           
private  java.awt.Shape bodyAndTail
           
private static double EYE_SIZE
           
private  java.awt.Shape eye1
           
private  java.awt.Shape eye2
           
private static int GRADIENT_SIZE
           
private static double TAIL_LENGTH
           
private static double TAIL_WIDTH
           
 
Constructor Summary
ParamFishDisplay()
          Default constructor.
ParamFishDisplay(double bodyWidth, double bodyLength, double tailWidth, double tailLength, double eyeSize)
          Make an object that knows how to drawFish simple fish.
 
Method Summary
private  void buildPaths(double bodyWidth, double bodyLength, double tailWidth, double tailLength, double eyeSize)
          Set up the paths used for the fish body, tail, and eyes.
 void draw(java.awt.Graphics2D g2, java.awt.Component comp, java.awt.Color fishColor)
          Draw the fish facing north on the Graphics2D object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BODY_WIDTH

private static final double BODY_WIDTH
See Also:
Constant Field Values

BODY_LENGTH

private static final double BODY_LENGTH
See Also:
Constant Field Values

TAIL_WIDTH

private static final double TAIL_WIDTH
See Also:
Constant Field Values

TAIL_LENGTH

private static final double TAIL_LENGTH
See Also:
Constant Field Values

EYE_SIZE

private static final double EYE_SIZE
See Also:
Constant Field Values

GRADIENT_SIZE

private static final int GRADIENT_SIZE
See Also:
Constant Field Values

ATX

private static final java.awt.geom.AffineTransform ATX

bodyAndTail

private java.awt.Shape bodyAndTail

eye1

private java.awt.Shape eye1

eye2

private java.awt.Shape eye2
Constructor Detail

ParamFishDisplay

public ParamFishDisplay(double bodyWidth,
                        double bodyLength,
                        double tailWidth,
                        double tailLength,
                        double eyeSize)
Make an object that knows how to drawFish simple fish.

Parameters:
bodyWidth - width of the body
bodyLength - length of the body
tailWidth - width of the tail
tailLength - length of the tail
eyeSize - size of the eyes

ParamFishDisplay

public ParamFishDisplay()
Default constructor.

Method Detail

buildPaths

private void buildPaths(double bodyWidth,
                        double bodyLength,
                        double tailWidth,
                        double tailLength,
                        double eyeSize)
Set up the paths used for the fish body, tail, and eyes. Different parameters will change the proportions, and thereby control the "look" of the fish. The various parameters should be specified assuming the fish will occupy a cell of size (1, 1).

Parameters:
bodyWidth - width of the elliptical body
bodyLength - length of the elliptical body
tailWidth - width of the triangular tail
tailLength - length of the triangular tail
eyeSize - diameter of the eye

draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.Component comp,
                 java.awt.Color fishColor)
Draw the fish facing north on the Graphics2D object. The Graphics2D object has been prepared such that the center of the fish is at the origin.

Specified by:
draw in interface IFishDisplay
Parameters:
g2 - drawing surface
comp - the component to drawFish on
fishColor - color of the fish