edu.brook.ascape.view
Class DrawImageFeature

java.lang.Object
  |
  +--edu.brook.ascape.view.DrawFeature
        |
        +--edu.brook.ascape.view.DrawImageFeature

public class DrawImageFeature
extends DrawFeature
implements ImageFeature

A class using a image feature to determine the image to use to draw a feature.

Since:
1.0
Version:
1.2

Field Summary
protected  java.awt.Color backgroundColor
           
 ImageFeature imageFeature
          The image feature to use for drawing this feature.
 
Fields inherited from class edu.brook.ascape.view.DrawFeature
name, nestedFeature
 
Constructor Summary
DrawImageFeature()
          Constructs a DrawImageFeature.
DrawImageFeature(DrawFeature nestedFeature)
          Constructs a DrawImageFeature with a nested feature.
DrawImageFeature(java.lang.String name)
          Constructs the feature with the supplied name.
DrawImageFeature(java.lang.String name, DrawFeature nestedFeature)
          Constructs the feature with a name and nested feature.
DrawImageFeature(java.lang.String name, ImageFeature imageFeature)
          Constructs the feature with a name and image feature.
 
Method Summary
 void draw(java.awt.Graphics g, java.lang.Object object, int width, int height)
          Draws a graphic interpreation of the object into the supplied graphics port, (typically) within the supplied dimensions.
 java.awt.Image getImage(java.lang.Object object)
          Returns the image feature's image interpretation of the object.
 ImageFeature getImageFeature()
          Returns the image feature this object is using to interpret the object's image.
 java.lang.String getName()
          Returns the user relevant name of this feature.
 void setImageFeature(ImageFeature imageFeature)
          Sets the image feature this object uses to interpret the object's image.
 
Methods inherited from class edu.brook.ascape.view.DrawFeature
getNestedFeature, setName, setNestedFeature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageFeature

public ImageFeature imageFeature
The image feature to use for drawing this feature. By default, black.

backgroundColor

protected java.awt.Color backgroundColor
Constructor Detail

DrawImageFeature

public DrawImageFeature()
Constructs a DrawImageFeature.

DrawImageFeature

public DrawImageFeature(java.lang.String name)
Constructs the feature with the supplied name.
Parameters:
the - name of this draw feature
nestedFeature - the feature to nest within this feature

DrawImageFeature

public DrawImageFeature(java.lang.String name,
                        ImageFeature imageFeature)
Constructs the feature with a name and image feature.
Parameters:
the - name of this draw feature
nestedFeature - the feature to nest within this feature

DrawImageFeature

public DrawImageFeature(java.lang.String name,
                        DrawFeature nestedFeature)
Constructs the feature with a name and nested feature.
Parameters:
the - name of this draw feature
nestedFeature - the feature to nest within this feature

DrawImageFeature

public DrawImageFeature(DrawFeature nestedFeature)
Constructs a DrawImageFeature with a nested feature.
Parameters:
nestedFeature - the feature to nest
Method Detail

draw

public void draw(java.awt.Graphics g,
                 java.lang.Object object,
                 int width,
                 int height)
Draws a graphic interpreation of the object into the supplied graphics port, (typically) within the supplied dimensions. Views which use this class are responsible for translating the graphics so that the object is drawn at the approriate location. Please let us know if you think you need a directly addressed alternative.
Parameters:
g - the Graphics context to draw into
object - the object to interpret for drawing
width - the width of the space that should be drawn into
height - the height of the space that should be drawn into
Overrides:
draw in class DrawFeature

getImage

public final java.awt.Image getImage(java.lang.Object object)
Returns the image feature's image interpretation of the object.
Specified by:
getImage in interface ImageFeature
Parameters:
object - the object to interpret image for

getImageFeature

public ImageFeature getImageFeature()
Returns the image feature this object is using to interpret the object's image.

setImageFeature

public void setImageFeature(ImageFeature imageFeature)
Sets the image feature this object uses to interpret the object's image.
Parameters:
imageFeature - the feature to use for imageing

getName

public java.lang.String getName()
Returns the user relevant name of this feature. "Unnamed", the name of the nested feature, or the name of the image feature, by default. Override or set name to provide a name.
Overrides:
getName in class DrawFeature

(c) 1998-2000 The Brookings Insitution
Webpage