|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.biojava.bio.chromatogram.graphic.ChromatogramGraphic
Encapsulates a configurable method for drawing a Chromatogram
into a graphics context.
| Nested Class Summary | |
static class |
ChromatogramGraphic.Option
A typesafe enumeration of the options available for configuring the behavior of a ChromatogramGraphic instance. |
| Field Summary | |
protected boolean |
callboxesValid
|
protected java.util.Map |
colors
The map containing the colors for drawing traces. |
protected boolean |
drawableCallboxesValid
|
protected java.util.Map |
fillColors
The map containing the fill colors for callboxes. |
protected java.util.Map |
options
The map containing the ChromatogramGraphic.Options and values for this instance. |
protected boolean |
subpathsValid
|
| Constructor Summary | |
ChromatogramGraphic()
Default constructor with no Chromatogram. |
|
ChromatogramGraphic(Chromatogram c)
Creates a new ChromatogramGraphic, initially displaying
the given chromatogram. |
|
| Method Summary | |
java.lang.Object |
clone()
Performs a partial deep copy and invalidates regenerable structures |
void |
drawTo(java.awt.Graphics2D g2)
Draws the chromatogram onto the provided graphics context. |
protected void |
generateCallboxes()
Precomputes the Rectangle2Ds that are the in-memory
representation of the callboxes. |
protected void |
generateDrawableCallboxes(java.awt.geom.AffineTransform shapeTx)
Precomputes the callboxes in screen coordinates. |
protected void |
generateSubpaths()
Precomputes the GeneralPaths used to draw the
traces. |
java.awt.Color |
getBaseColor(Symbol b)
Returns the color that will be used to draw the trace for the given DNA symbol. |
java.awt.Color |
getBaseFillColor(Symbol b)
Returns the color that will be used to fill in the callboxes for calls with the given symbol. |
java.awt.geom.Rectangle2D |
getCallboxBounds(int index)
Returns the screen-coordinate bounds of the callbox for a given call. |
java.awt.geom.Rectangle2D |
getCallboxBounds(int index,
boolean boundsOnScreen)
Returns the bounds of the callbox for a given call. |
int |
getCallboxCount()
Returns the number of callboxes, regenerating them if necessary. |
int |
getCallContaining(float x)
Synonym for getCallContaining(float, boolean) with
pointOnScreen=true. |
int |
getCallContaining(float x,
boolean xOnScreen)
Same as getCallContaining(Point2D, boolean), except that
only the x-coordinate of the point is specified. |
int |
getCallContaining(java.awt.geom.Point2D point)
Synonym for getCallContaining(Point2D, boolean) with
pointOnScreen=true. |
int |
getCallContaining(java.awt.geom.Point2D point,
boolean pointOnScreen)
Returns the 0-based index of the call containing a given point. |
Chromatogram |
getChromatogram()
Accessor for the in-use chromatogram. |
float |
getFloatOption(ChromatogramGraphic.Option opt)
Helper method for converting a Number-valued
option into a float primitive. |
int |
getHeight()
Returns the height of the whole graphic (in pixels). |
float |
getHorizontalScale()
Returns the in-use horizontal scale factor. |
int |
getIntOption(ChromatogramGraphic.Option opt)
Helper method for converting a Number-valued
option into an int primitive. |
java.awt.geom.AffineTransform |
getInvTransform()
Returns a new AffineTransform describing the transformation from output space to chromatogram space. |
java.lang.Object |
getOption(ChromatogramGraphic.Option opt)
Returns the current value for the specified option. |
int |
getRenderedWidth()
Returns the width of the graphic as it will be rendered. |
int |
getRenderedWidth(float horizontalScale)
Returns the width of the graphic as it would be rendered with the specified horizontal scale. |
java.awt.geom.AffineTransform |
getTransform()
Returns a new AffineTransform describing the transformation from chromatogram coordinates to output coordinates. |
void |
getTransformAndConcat(java.awt.geom.AffineTransform target)
Concatenates the chromatogram-to-output transform to the provided given AffineTransform. |
float |
getVerticalScale()
Returns the in use vertical scale factor. |
int |
getWidth()
Returns the width of the whole graphic (in pixels). |
boolean |
optionIsTrue(ChromatogramGraphic.Option opt)
Helper method for converting a Boolean-valued
option into a boolean primitive. |
void |
setBaseColor(Symbol b,
java.awt.Color c)
Maps a color to a DNA symbol. |
void |
setChromatogram(Chromatogram c)
Sets the chromatogram to draw. |
void |
setHeight(int h)
Sets the height (in pixels). |
void |
setHorizontalScale(float hs)
Sets the horizontal scale (proportional). |
void |
setOption(ChromatogramGraphic.Option opt,
java.lang.Object value)
Sets a new value for the specified option. |
void |
setVerticalScale(float vs)
Sets the vertical scale (proportional). |
void |
setWidth(int w)
Sets the width of the whole graphic (in pixels). |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean subpathsValid
protected boolean callboxesValid
protected boolean drawableCallboxesValid
protected java.util.Map options
ChromatogramGraphic.Options and values for this instance.
protected java.util.Map colors
protected java.util.Map fillColors
| Constructor Detail |
public ChromatogramGraphic()
public ChromatogramGraphic(Chromatogram c)
ChromatogramGraphic, initially displaying
the given chromatogram.
| Method Detail |
protected void generateSubpaths()
GeneralPaths used to draw the
traces.
protected void generateCallboxes()
Rectangle2Ds that are the in-memory
representation of the callboxes. These rectangles are used for drawing
(via generateDrawableCallboxes) as well as queries (e.g.,
getCallContaining(java.awt.geom.Point2D, boolean)).
protected void generateDrawableCallboxes(java.awt.geom.AffineTransform shapeTx)
shapeTx - the transform to apply to the callboxes to move them into
screen space.public Chromatogram getChromatogram()
drawTo(java.awt.Graphics2D) will drawpublic void setChromatogram(Chromatogram c)
c - the new chromatogramChromatogramGraphic.Option.WIDTH_IS_AUTHORITATIVE,
ChromatogramGraphic.Option.HEIGHT_IS_AUTHORITATIVEpublic int getWidth()
public int getHeight()
public float getHorizontalScale()
public float getVerticalScale()
getChromatogram().getMax()].
public int getRenderedWidth()
ChromatogramGraphic.Option.FROM_TRACE_SAMPLE and
ChromatogramGraphic.Option.TO_TRACE_SAMPLE bounds are taken into account.
public int getRenderedWidth(float horizontalScale)
ChromatogramGraphic.Option.FROM_TRACE_SAMPLE and
ChromatogramGraphic.Option.TO_TRACE_SAMPLE bounds are taken into account.
public void setHeight(int h)
h - the desired height in pixelsChromatogramGraphic.Option.HEIGHT_IS_AUTHORITATIVEpublic void setVerticalScale(float vs)
vs - the desired vertical scale. See getVerticalScale()
for semantics.ChromatogramGraphic.Option.HEIGHT_IS_AUTHORITATIVEpublic void setWidth(int w)
w - the desired width in pixelsChromatogramGraphic.Option.WIDTH_IS_AUTHORITATIVEpublic void setHorizontalScale(float hs)
hs - the desired vertical scale. See getHorizontalScale()
for semantics.ChromatogramGraphic.Option.WIDTH_IS_AUTHORITATIVEpublic java.awt.Color getBaseColor(Symbol b)
b - the symbol
public java.awt.Color getBaseFillColor(Symbol b)
b - the symbol
public void setBaseColor(Symbol b,
java.awt.Color c)
b - the symbolc - the colorpublic int getCallboxCount()
getChromatogram().getSequenceLength()
public java.awt.geom.Rectangle2D getCallboxBounds(int index)
index - the callbox for which to get the bounds 0-based.
public java.awt.geom.Rectangle2D getCallboxBounds(int index,
boolean boundsOnScreen)
index - the callbox for which to get the bounds 0-based.boundsOnScreen - determines the coordinate system of the returned
bounds
boundsOnScreen is true, otherwise the bounds
of the callbox in chromatogram coordinates
public int getCallContaining(java.awt.geom.Point2D point,
boolean pointOnScreen)
point - the point to search forpointOnScreen - if true, the point will be treated as though it
is in screen space. Otherwise, it will be considered to be
in chromatogram space.
public int getCallContaining(java.awt.geom.Point2D point)
getCallContaining(Point2D, boolean) with
pointOnScreen=true.
public int getCallContaining(float x,
boolean xOnScreen)
getCallContaining(Point2D, boolean), except that
only the x-coordinate of the point is specified.
x - the x-coordinate to search forxOnScreen - whether the coordinate in screen space or chromatogram
spacepublic int getCallContaining(float x)
getCallContaining(float, boolean) with
pointOnScreen=true.
public java.awt.geom.AffineTransform getTransform()
public void getTransformAndConcat(java.awt.geom.AffineTransform target)
public java.awt.geom.AffineTransform getInvTransform()
getTransform().createInverse()
public void drawTo(java.awt.Graphics2D g2)
public void setOption(ChromatogramGraphic.Option opt,
java.lang.Object value)
ChromatogramGraphic.Optionpublic java.lang.Object getOption(ChromatogramGraphic.Option opt)
ChromatogramGraphic.Option
public boolean optionIsTrue(ChromatogramGraphic.Option opt)
throws java.lang.ClassCastException
Boolean-valued
option into a boolean primitive.
opt - the ChromatogramGraphic.Option to convert
java.lang.ClassCastException - when the option isn't Boolean-valued
public float getFloatOption(ChromatogramGraphic.Option opt)
throws java.lang.ClassCastException
Number-valued
option into a float primitive.
opt - the ChromatogramGraphic.Option to convert
java.lang.ClassCastException - when the option isn't Number-valued
public int getIntOption(ChromatogramGraphic.Option opt)
throws java.lang.ClassCastException
Number-valued
option into an int primitive.
opt - the ChromatogramGraphic.Option to convert
java.lang.ClassCastException - when the option isn't Number-valuedpublic java.lang.Object clone()
clone in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||