Class ChromatogramGraphic

    • Constructor Detail

      • ChromatogramGraphic

        public ChromatogramGraphic​(Chromatogram c)
        Creates a new ChromatogramGraphic, initially displaying the given chromatogram.
        Parameters:
        c - the Chromomatogram to display
    • Method Detail

      • generateDrawableCallboxes

        protected void generateDrawableCallboxes​(AffineTransform shapeTx)
        Precomputes the callboxes in screen coordinates.
        Parameters:
        shapeTx - the transform to apply to the callboxes to move them into screen space.
      • getWidth

        public int getWidth()
        Returns the width of the whole graphic (in pixels).
        Returns:
        the width
      • getHeight

        public int getHeight()
        Returns the height of the whole graphic (in pixels).
        Returns:
        the height
      • getHorizontalScale

        public float getHorizontalScale()
        Returns the in-use horizontal scale factor. The "units" of this value are (trace samples) / pixel. For example, a horizontal scale of 1.0 means that there will be one pixel horizontally for each trace sample.
        Returns:
        the horizontal scale
      • getVerticalScale

        public float getVerticalScale()
        Returns the in use vertical scale factor. The "units" of this value are (trace value bins) / pixel. For example, a vertical scale of 1.0 means that there will be one pixel vertically for each value in the range [0, getChromatogram().getMax()].
        Returns:
        the vertical scale
      • getBaseColor

        public Color getBaseColor​(Symbol b)
        Returns the color that will be used to draw the trace for the given DNA symbol.
        Parameters:
        b - the symbol
        Returns:
        the color, or null if none is set
      • getBaseFillColor

        public Color getBaseFillColor​(Symbol b)
        Returns the color that will be used to fill in the callboxes for calls with the given symbol.
        Parameters:
        b - the symbol
        Returns:
        the color, or null if none is set
      • setBaseColor

        public void setBaseColor​(Symbol b,
                                 Color c)
        Maps a color to a DNA symbol. The color as specified will be used for to draw the trace for the symbol (if any). The fill color for calls to the symbol will be derived from the trace color.
        Parameters:
        b - the symbol
        c - the color
      • getCallboxCount

        public int getCallboxCount()
        Returns the number of callboxes, regenerating them if necessary. This should almost always equal getChromatogram().getSequenceLength()
        Returns:
        the number of callboxes
      • getCallboxBounds

        public Rectangle2D getCallboxBounds​(int index)
        Returns the screen-coordinate bounds of the callbox for a given call.
        Parameters:
        index - the callbox for which to get the bounds 0-based
        Returns:
        a Rectangle2D giving the bounds of the call box
      • getCallboxBounds

        public Rectangle2D getCallboxBounds​(int index,
                                            boolean boundsOnScreen)
        Returns the bounds of the callbox for a given call.
        Parameters:
        index - the callbox for which to get the bounds 0-based.
        boundsOnScreen - determines the coordinate system of the returned bounds
        Returns:
        the bounds of the callbox in screen coordinates if boundsOnScreen is true, otherwise the bounds of the callbox in chromatogram coordinates
      • getCallContaining

        public int getCallContaining​(Point2D point,
                                     boolean pointOnScreen)
        Returns the 0-based index of the call containing a given point. The point may be either in screen space or chromatogram space, scale-wise. If the point is in screen space, the caller must translate the point such that if it is, for instance, from a mouse click, a click on the upper-left corner of the graphic would be (0,0).
        Parameters:
        point - the point to search for
        pointOnScreen - if true, the point will be treated as though it is in screen space. Otherwise, it will be considered to be in chromatogram space.
        Returns:
        the 0-based index of the callbox which contains the point
      • getCallContaining

        public int getCallContaining​(float x,
                                     boolean xOnScreen)
        Same as getCallContaining(Point2D, boolean), except that only the x-coordinate of the point is specified.
        Parameters:
        x - the x-coordinate to search for
        xOnScreen - whether the coordinate in screen space or chromatogram space
        Returns:
        the index of the call containing the position x
      • getTransform

        public AffineTransform getTransform()
        Returns a new AffineTransform describing the transformation from chromatogram coordinates to output coordinates.
      • getInvTransform

        public AffineTransform getInvTransform()
        Returns a new AffineTransform describing the transformation from output space to chromatogram space. Should be much more efficient than getTransform().createInverse()
      • drawTo

        public void drawTo​(Graphics2D g2)
        Draws the chromatogram onto the provided graphics context.
        Parameters:
        g2 - the Graphics2D to draw to
      • setOption

        public void setOption​(ChromatogramGraphic.Option opt,
                              Object value)
        Sets a new value for the specified option. Be sure that the value is appropriate per the documentation, or you'll induce a ClassCastException somewhere else.
        Parameters:
        opt - Option to set
        value - new value for the option
        See Also:
        ChromatogramGraphic.Option
      • clone

        public Object clone()
        Performs a partial deep copy and invalidates regenerable structures.
        Overrides:
        clone in class Object
        Returns:
        an Object that is castable to ChromatogramGraphic