|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biojava.bio.chromatogram.graphic.ChromatogramGraphic
public class 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
Flag for call boxes. |
protected Map |
colors
The map containing the colors for drawing traces. |
protected boolean |
drawableCallboxesValid
Flag for drawable call boxes. |
protected Map |
fillColors
The map containing the fill colors for callboxes. |
protected Map |
options
The map containing the ChromatogramGraphic.Options and values for this instance. |
protected boolean |
subpathsValid
Flag for subpaths. |
| Constructor Summary | |
|---|---|
ChromatogramGraphic()
Default constructor with no Chromatogram. |
|
ChromatogramGraphic(Chromatogram c)
Creates a new ChromatogramGraphic, initially displaying
the given chromatogram. |
|
| Method Summary | |
|---|---|
Object |
clone()
Performs a partial deep copy and invalidates regenerable structures. |
void |
drawTo(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(AffineTransform shapeTx)
Precomputes the callboxes in screen coordinates. |
protected void |
generateSubpaths()
Precomputes the GeneralPaths used to draw the
traces. |
Color |
getBaseColor(Symbol b)
Returns the color that will be used to draw the trace for the given DNA symbol. |
Color |
getBaseFillColor(Symbol b)
Returns the color that will be used to fill in the callboxes for calls with the given symbol. |
Rectangle2D |
getCallboxBounds(int index)
Returns the screen-coordinate bounds of the callbox for a given call. |
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(Point2D point)
Synonym for getCallContaining(Point2D, boolean) with
pointOnScreen=true. |
int |
getCallContaining(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. |
AffineTransform |
getInvTransform()
Returns a new AffineTransform describing the transformation from output space to chromatogram space. |
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. |
AffineTransform |
getTransform()
Returns a new AffineTransform describing the transformation from chromatogram coordinates to output coordinates. |
void |
getTransformAndConcat(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,
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,
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 Map options
ChromatogramGraphic.Options and values for this instance.
protected Map colors
protected Map fillColors
| Constructor Detail |
|---|
public ChromatogramGraphic()
public ChromatogramGraphic(Chromatogram c)
ChromatogramGraphic, initially displaying
the given chromatogram.
c - the Chromomatogram to display| 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(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.
horizontalScale - the horizontal scale
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 Color getBaseColor(Symbol b)
b - the symbol
public Color getBaseFillColor(Symbol b)
b - the symbol
public void setBaseColor(Symbol b,
Color c)
b - the symbolc - the colorpublic int getCallboxCount()
getChromatogram().getSequenceLength()
public Rectangle2D getCallboxBounds(int index)
index - the callbox for which to get the bounds 0-based
public 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(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(Point2D point)
getCallContaining(Point2D, boolean) with
pointOnScreen=true.
point - the Point2D to search with
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
space
public int getCallContaining(float x)
getCallContaining(float, boolean) with
pointOnScreen=true.
x - the x-coordinate to search for
public AffineTransform getTransform()
public void getTransformAndConcat(AffineTransform target)
public AffineTransform getInvTransform()
getTransform().createInverse()
public void drawTo(Graphics2D g2)
g2 - the Graphics2D to draw to
public void setOption(ChromatogramGraphic.Option opt,
Object value)
opt - Option to setvalue - new value for the optionChromatogramGraphic.Optionpublic Object getOption(ChromatogramGraphic.Option opt)
ChromatogramGraphic.Option
public boolean optionIsTrue(ChromatogramGraphic.Option opt)
throws ClassCastException
Boolean-valued
option into a boolean primitive.
opt - the ChromatogramGraphic.Option to convert
ClassCastException - when the option isn't Boolean-valued
public float getFloatOption(ChromatogramGraphic.Option opt)
throws ClassCastException
Number-valued
option into a float primitive.
opt - the ChromatogramGraphic.Option to convert
ClassCastException - when the option isn't Number-valued
public int getIntOption(ChromatogramGraphic.Option opt)
throws ClassCastException
Number-valued
option into an int primitive.
opt - the ChromatogramGraphic.Option to convert
ClassCastException - when the option isn't Number-valuedpublic Object clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||