public class ChromatogramGraphic extends Object implements Cloneable
Chromatogram 
 into a graphics context.| Modifier and Type | Class and Description | 
|---|---|
static class  | 
ChromatogramGraphic.Option
A typesafe enumeration of the options available for configuring
 the behavior of a  
ChromatogramGraphic instance. | 
| Modifier and Type | Field and Description | 
|---|---|
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 and Description | 
|---|
ChromatogramGraphic()
Default constructor with no Chromatogram. 
 | 
ChromatogramGraphic(Chromatogram c)
Creates a new  
ChromatogramGraphic, initially displaying
 the given chromatogram. | 
| Modifier and Type | Method and Description | 
|---|---|
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). 
 | 
protected boolean subpathsValid
protected boolean callboxesValid
protected boolean drawableCallboxesValid
protected Map options
ChromatogramGraphic.Options and values for this instance.protected Map fillColors
public ChromatogramGraphic()
public ChromatogramGraphic(Chromatogram c)
ChromatogramGraphic, initially displaying
 the given chromatogram.c - the Chromomatogram to displayprotected 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 scalepublic 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 symbolpublic Color getBaseFillColor(Symbol b)
b - the symbolpublic 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-basedpublic 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
        boundsboundsOnScreen is true, otherwise the bounds
          of the callbox in chromatogram coordinatespublic 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 withpublic 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.x - the x-coordinate to search forpublic AffineTransform getTransform()
public void getTransformAndConcat(AffineTransform target)
public AffineTransform getInvTransform()
getTransform().createInverse()public void drawTo(Graphics2D g2)
g2 - the Graphics2D to draw topublic void setOption(ChromatogramGraphic.Option opt, Object value)
opt - Option to setvalue - new value for the optionChromatogramGraphic.Optionpublic Object getOption(ChromatogramGraphic.Option opt)
ChromatogramGraphic.Optionpublic boolean optionIsTrue(ChromatogramGraphic.Option opt) throws ClassCastException
Boolean-valued
 option into a boolean primitive.opt - the ChromatogramGraphic.Option to convertClassCastException - when the option isn't Boolean-valuedpublic float getFloatOption(ChromatogramGraphic.Option opt) throws ClassCastException
Number-valued
 option into a float primitive.opt - the ChromatogramGraphic.Option to convertClassCastException - when the option isn't Number-valuedpublic int getIntOption(ChromatogramGraphic.Option opt) throws ClassCastException
Number-valued
 option into an int primitive.opt - the ChromatogramGraphic.Option to convertClassCastException - when the option isn't Number-valuedCopyright © 2020 BioJava. All rights reserved.