|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.structure.Drawable
public abstract class Drawable
This abstract class defines attributes and methods that are shared by
all drawable objects, including the xyz-coordinates for the Drawable's
center and methods that will allow each object to be sorted based on
distance from the camera.
Known subclasses are Atom, Bond, and Region (Helix and BetaStrand).
Field Summary | |
---|---|
static float |
DEFAULT_ALPHA
The default value for alpha is 0.0. |
static float |
DEFAULT_BLUE
The default value for blue is 0.0. |
static float |
DEFAULT_GREEN
The default value for green is 0.0. |
static double |
DEFAULT_RADIUS
The default radius is 1.0. |
static float |
DEFAULT_RED
The default value for red is 0.0. |
static float |
DEFAULT_SPECULAR_EXP
The default value for the specular exponent is 20.0. |
Constructor Summary | |
---|---|
Drawable(double x,
double y,
double z,
VisibilityEnum visibility,
DrawableEnum drawableType)
Constructor for use by subclasses. |
|
Drawable(double x,
double y,
double z,
VisibilityEnum visibility,
DrawableEnum drawableType,
float red,
float green,
float blue,
float alpha)
Constructor for use by subclasses. |
Method Summary | |
---|---|
abstract void |
accept(Visitor visitor)
Accepts a Visitor and does a callback. |
double |
distance(Drawable other)
Returns the distance in angstroms between the xyz-center of the calling Drawable object and the xyz-center of the Drawable object given as an argument. |
float |
getAlpha()
Returns the alpha component of the RGBA color. |
double |
getAngstromsPerPixel()
Returns the angstrom per pixel conversion factor, which is expected to be set by the Camera class after the object to camera distance has been calculated. |
float |
getBlue()
Returns the blue component of the RGBA color. |
double |
getCameraDepth()
Returns the camera depth (z-coordinate in camera space). |
double |
getCameraDistance()
Returns the camera distance (based on xyz-coordinates in camera space). |
float[] |
getColor()
Returns a copy of the RGBA color as an array. |
DrawableEnum |
getDrawableType()
Returns the Drawable type (ATOM, BOND, HELIX, or BETA_STRAND). |
float |
getGreen()
Returns the green component of the RGBA color. |
Point3d |
getPoint()
Returns the xyz-center of the Drawable as a point. |
double |
getRadius()
Returns the radius. |
float |
getRed()
Returns the red component of the RGBA color. |
float |
getSpecularExp()
Returns the specular exponent for use in lighting calculations. |
Vec3d |
getTranslation()
Returns the xyz-center of the Drawable as a vector. |
VisibilityEnum |
getVisibility()
Returns the visibility status of the Drawable object. |
double |
getX()
Returns the x-coordinate of the Drawable's center. |
double |
getY()
Returns the y-coordinate of the Drawable's center. |
double |
getZ()
Returns the z-coordinate of the Drawable's center. |
Vec3d |
minus(Drawable other)
Returns a vector created by subtracting the xyz-center of the Drawable given as an argument from the xyz-center of the calling Drawable object. |
void |
scaleRadius(double scaleFactor)
Multiplies the default radius by the scale factor given as an argument. |
void |
setAlpha(float alpha)
Sets the alpha component of the RGBA color. |
void |
setAlphaToDefault()
Sets the alpha component of the RGBA color to DEFAULT_ALPHA. |
void |
setAngstromsPerPixel(double angstromsPerPixel)
The Camera class should use this method to set a conversion factor that will allow an x or y axis distance in viewport pixels be converted to an x or y distance in world coordinates (angstroms) at the current object to camera distance. |
void |
setCameraDepth(double cameraDepth)
The camera class should use this method to set a memory of the camera depth (z-coordinate of Drawable object in camera space). |
void |
setCameraDistance(double cameraDistance)
The camera class should use this method to set a memory of the distance between the xyz-center of this object and the camera. |
void |
setColor(float[] color)
Sets the RGBA color by copying the values from the color array given as an argument. |
void |
setColor(float red,
float green,
float blue)
Sets the (red, green, blue) components of the RGBA color. |
void |
setColor(float red,
float green,
float blue,
float alpha)
Sets the (red, green, blue, alpha ) components of the RGBA color. |
void |
setRadius(double radius)
Sets the radius. |
void |
setRadiusToDefault()
Sets the radius to DEFAULT_RADIUS. |
void |
setRGBAToDefault()
Sets the color by calling on setRGBToDefault() and setAlphaToDefault(). |
void |
setRGBToDefault()
Sets the (red, green, blue) components of the color to DEFAULT_RED, DEFAULT_GREEN, and DEFAULT_BLUE, respectively. |
void |
setSpecularExp(float specularExp)
Sets the specular exponent to be used in lighting calculations. |
void |
setSpecularExpToDefault()
Sets the specular exponent to the default value, DEFAULT_SPECULAR_EXP. |
void |
setVisibility(VisibilityEnum visibility)
Sets the visibility status of the Drawable object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float DEFAULT_RED
public static final float DEFAULT_GREEN
public static final float DEFAULT_BLUE
public static final float DEFAULT_ALPHA
public static final float DEFAULT_SPECULAR_EXP
public static final double DEFAULT_RADIUS
Constructor Detail |
---|
public Drawable(double x, double y, double z, VisibilityEnum visibility, DrawableEnum drawableType)
x
- coordinate of the Drawable's center.y
- coordinate of the Drawable's center.z
- coordinate of the Drawable's center.visibility
- visiblity status (OPAQUE, TRANSLUCENT, or INVISIBLE)drawableType
- drawable type (ATOM, BOND, HELIX, or BETASTRAND)public Drawable(double x, double y, double z, VisibilityEnum visibility, DrawableEnum drawableType, float red, float green, float blue, float alpha) throws ColorOutOfRangeException
x
- coordinate of the Drawable's center.y
- coordinate of the Drawable's center.z
- coordinate of the Drawable's center.visibility
- visiblity status (OPAQUE, TRANSLUCENT, or
INVISIBLE)drawableType
- drawable type (ATOM, BOND, HELIX, BETASTRAND)red
- component of RGBA colorgreen
- component of RGBA colorblue
- component of RGBA coloralpha
- component of RGBA color
ColorOutOfRangeException
- if a color value is less than
0.0 or greater than 1.0.Method Detail |
---|
public abstract void accept(Visitor visitor) throws VisitorException
accept
in interface Visitable
visitor
- the Visitor to do a callback with.
VisitorException
- if an error occurs while an object is
being visited.public void setCameraDistance(double cameraDistance)
cameraDistance
- the distance to the camera in angstroms.public double getCameraDistance()
public void setCameraDepth(double cameraDepth)
cameraDepth
- the depth in angstroms.public double getCameraDepth()
public void setAngstromsPerPixel(double angstromsPerPixel)
angstromsPerPixel
- the angstroms per pixel conversion factor.public double getAngstromsPerPixel()
public double getX()
public double getY()
public double getZ()
public VisibilityEnum getVisibility()
public DrawableEnum getDrawableType()
public float[] getColor()
public float getRed()
public float getGreen()
public float getBlue()
public float getAlpha()
public float getSpecularExp()
public double getRadius()
public void setVisibility(VisibilityEnum visibility)
visibility
- the visibility as an enum.public void setColor(float red, float green, float blue, float alpha) throws ColorOutOfRangeException
red
- component of the RGBA color.green
- component of the RGBA color.blue
- component of the RGBA color.alpha
- component of the RGBA color.
ColorOutOfRangeException
- if a color value is less than
0.0 or greater than 1.0.public void setColor(float red, float green, float blue) throws ColorOutOfRangeException
red
- component of the RGBA color.green
- component of the RGBA color.blue
- component of the RGBA color.
ColorOutOfRangeException
- if a color value is less than
0.0 or greater than 1.0.public void setAlpha(float alpha) throws ColorOutOfRangeException
alpha
- component of the RGBA color.
ColorOutOfRangeException
- if alpha is less than 0.0 or
greater than 1.0.public void setColor(float[] color) throws ColorOutOfRangeException
color
- an array of floats with the RGBA color.
ColorOutOfRangeException
- if a value is less than 0.0 or
more than 1.0.
IllegalArgumentException
- if the color array has a length
less than 3.public void setRGBAToDefault()
public void setRGBToDefault()
public void setAlphaToDefault()
public void setSpecularExp(float specularExp)
specularExp
- the specular exponent for Phong lighting
calculations.public void setSpecularExpToDefault()
public void scaleRadius(double scaleFactor)
scaleFactor
- the scale factor to multiply the default
radius by.public void setRadius(double radius)
radius
- the radius as a double.public void setRadiusToDefault()
public double distance(Drawable other)
other
- the Drawable to measure the distance from.
public Vec3d minus(Drawable other)
other
- the other Drawable object.
public Point3d getPoint()
public Vec3d getTranslation()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |