org.proteinshader.structure.visitor.modifiers
Class DrawableModifier

java.lang.Object
  extended by org.proteinshader.structure.visitor.modifiers.DrawableModifier
Direct Known Subclasses:
AtomModifier, BondModifier, SegmentModifier

public class DrawableModifier
extends Object

This helper class for the ModifierVisitor knows how to accept a Drawable object and modify its attributes.

The setter methods defined below store a memory of what modifications need to be made to the visibility status, RGBA color, and radius of the Drawable object that will be modified later on when the ModifierVisitor hands a Drawable object to the modify() method of this DrawableModifier.

The clear() method erases all memory of what modifications to make.


Constructor Summary
DrawableModifier()
          Constructs a DrawableModifier
 
Method Summary
 void clear()
          Clears the memory of what modifications have been requested.
 void clearColorChangeMemory()
          Clears any memory of color change that have been requested.
 void modify(Drawable d)
          Modifies the visibility, RGBA color, and/or radius of the Drawable object given as an argument.
 void scaleRadius(double scaleFactor)
          Stores a memory that the radius needs to be multiplied by the scale factor given as an argument.
 void setAlpha(float alpha)
          Stores a memory that the alpha component of the RGBA color needs to be set to the value given as an argument.
 void setAlphaToDefault()
          Stores a memory that the alpha value of the RGBA color needs to be set to its default.
 void setColor(float red, float green, float blue)
          Stores a memory that the (red, green, blue) components of the RGBA color need to be set to the values given as arguments.
 void setColor(float red, float green, float blue, float alpha)
          Stores a memory that the (red, green, blue, alpha) components of the RGBA color all need to be set to the values given as arguments.
 void setRadius(double radius)
          Stores a memory that the radius needs to be set to the value given as an argument.
 void setRadiusToDefault()
          Stores a memory that the radius needs to be set to its default.
 void setRGBAToDefault()
          Stores a memory that the (red, green, blue, alpha) components of the RGBA color all need to be set to their defaults.
 void setRGBToDefault()
          Stores a memory that the (red, green, blue) components of the RGBA color need to be set to their default.
 void setSpecularExp(float specularExp)
          Stores a memory that the specular exponent needs to be set to the value given as an argument.
 void setSpecularExpToDefault()
          Stores a memory that the specular exponent needs to be set to its default.
 void setVisibility(VisibilityEnum visibility)
          Stores a memory that the visibility status needs to be set to the value given as an argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawableModifier

public DrawableModifier()
Constructs a DrawableModifier

Method Detail

clear

public void clear()
Clears the memory of what modifications have been requested.


clearColorChangeMemory

public void clearColorChangeMemory()
Clears any memory of color change that have been requested.


modify

public void modify(Drawable d)
            throws ColorOutOfRangeException
Modifies the visibility, RGBA color, and/or radius of the Drawable object given as an argument. The modifications performed depend on which setter methods have been called since the last time clear() was called.

Parameters:
d - the Drawable to modify.
Throws:
ColorOutOfRangeException - if a color value (red, green, blue, alpha) is less than 0.0 or greater than 1.0.

setVisibility

public void setVisibility(VisibilityEnum visibility)
Stores a memory that the visibility status needs to be set to the value given as an argument.

Parameters:
visibility - the visibility as an enum.

setColor

public void setColor(float red,
                     float green,
                     float blue,
                     float alpha)
              throws ColorOutOfRangeException
Stores a memory that the (red, green, blue, alpha) components of the RGBA color all need to be set to the values given as arguments.

Parameters:
red - component of the RGBA color.
green - component of the RGBA color.
blue - component of the RGBA color.
alpha - component of the RGBA color.
Throws:
ColorOutOfRangeException - if a color value is less than 0.0 or greater than 1.0.

setColor

public void setColor(float red,
                     float green,
                     float blue)
              throws ColorOutOfRangeException
Stores a memory that the (red, green, blue) components of the RGBA color need to be set to the values given as arguments.

Parameters:
red - component of the RGBA color.
green - component of the RGBA color.
blue - component of the RGBA color.
Throws:
ColorOutOfRangeException - if a color value is less than 0.0 or greater than 1.0.

setAlpha

public void setAlpha(float alpha)
              throws ColorOutOfRangeException
Stores a memory that the alpha component of the RGBA color needs to be set to the value given as an argument.

Parameters:
alpha - component of the RGBA color.
Throws:
ColorOutOfRangeException - if alpha is less than 0.0 or greater than 1.0.

setRGBAToDefault

public void setRGBAToDefault()
Stores a memory that the (red, green, blue, alpha) components of the RGBA color all need to be set to their defaults.


setRGBToDefault

public void setRGBToDefault()
Stores a memory that the (red, green, blue) components of the RGBA color need to be set to their default.


setAlphaToDefault

public void setAlphaToDefault()
Stores a memory that the alpha value of the RGBA color needs to be set to its default.


scaleRadius

public void scaleRadius(double scaleFactor)
Stores a memory that the radius needs to be multiplied by the scale factor given as an argument. A scale factor of 0 or less will be ignored.

Parameters:
scaleFactor - the scale factor to multiply by.

setRadius

public void setRadius(double radius)
Stores a memory that the radius needs to be set to the value given as an argument.

Parameters:
radius - the radius as a double.

setRadiusToDefault

public void setRadiusToDefault()
Stores a memory that the radius needs to be set to its default.


setSpecularExp

public void setSpecularExp(float specularExp)
Stores a memory that the specular exponent needs to be set to the value given as an argument.

Parameters:
specularExp - the specular exponent as a float.

setSpecularExpToDefault

public void setSpecularExpToDefault()
Stores a memory that the specular exponent needs to be set to its default.



Copyright © 2007-2008