Class Cgview

java.lang.Object
ca.ualberta.stothard.cgview.Cgview
All Implemented Interfaces:
CgviewConstants

public class Cgview extends Object implements CgviewConstants
Represents a circular map of a DNA sequence. Numerous methods are available for controlling the overall appearance of the map (width, height, background color, etc). The contents of the map are described in terms of FeatureSlot, Feature, FeatureRange, Legend, and LegendItem objects.
Author:
Paul Stothard
  • Constructor Details

    • Cgview

      public Cgview(int sequenceLength)
      Constructs a new Cgview object.
      Parameters:
      sequenceLength - the length of the sequence to be mapped.
  • Method Details

    • setSequenceLength

      public void setSequenceLength(int bases)
      Sets the length of the sequence to be mapped.
      Parameters:
      bases - the sequence length.
    • getSequenceLength

      public int getSequenceLength()
      Returns the length of the sequence to be mapped.
      Returns:
      the length of the sequence.
    • getGraphics

      protected Graphics2D getGraphics()
      Returns the Graphics2D object for this Cgview.
      Returns:
      the Graphics2D object.
    • setHeight

      public void setHeight(int height)
      Sets the height of the map.
      Parameters:
      height - the height of the map.
    • getHeight

      public int getHeight()
      Returns the height of the map.
      Returns:
      the height of the map.
    • setTickDensity

      public void setTickDensity(double density)
      Adjusts the tick density, with 0 being the minimum, 1 being the maximum.
      Parameters:
      density - a double between 0.0 and 1.0.
    • getTickDensity

      public double getTickDensity()
      Returns the tick density, with 0 being the minimum, 1 being the maximum.
      Returns:
      a double between 0.0 and 1.0 representing the tick density.
    • setWidth

      public void setWidth(int width)
      Sets the width of the map.
      Parameters:
      width - the width of the map.
    • getWidth

      public int getWidth()
      Returns the width of the map.
      Returns:
      the width of the map.
    • getSmallestDimension

      public int getSmallestDimension()
      Returns the width or the height of the map, whichever is smaller.
      Returns:
      the width or the height of the map, whichever is smaller.
    • setBackgroundColor

      public void setBackgroundColor(Color color)
      Sets the background color of the map.
      Parameters:
      color - the background color.
    • getBackgroundColor

      public Color getBackgroundColor()
      Returns the background color of the map.
      Returns:
      the background color.
    • setBorderColor

      public void setBorderColor(Color color)
      Sets the color of the map border.
      Parameters:
      color - the border color.
    • getBorderColor

      public Color getBorderColor()
      Returns the color of the map border.
      Returns:
      the border color.
    • setBackboneRadius

      public void setBackboneRadius(double radius)
      Sets the radius of the circle that represents the DNA sequence.
      Parameters:
      radius - the backbone radius.
    • getBackboneRadius

      public double getBackboneRadius()
      Returns the radius of the circle that represents the DNA sequence.
      Returns:
      the backbone radius.
    • setBackboneThickness

      public void setBackboneThickness(float thickness)
      Sets the thickness of the line used to draw the circle that represents the DNA sequence.
      Parameters:
      thickness - the thickness of the line.
    • getBackboneThickness

      public double getBackboneThickness()
      Returns the thickness of the line used to draw the circle that represents the DNA sequence.
      Returns:
      the thickness of the line.
    • setRulerFontColor

      public void setRulerFontColor(Color color)
      Sets the color of the text used for the sequence ruler.
      Parameters:
      color - the font color.
    • getRulerFontColor

      public Color getRulerFontColor()
      Returns the color of the text used for the sequence ruler.
      Returns:
      the font color.
    • setTitleFontColor

      public void setTitleFontColor(Color color)
      Sets the color of the text used for the sequence title.
      Parameters:
      color - the color of the font.
    • getTitleFontColor

      public Color getTitleFontColor()
      Returns the color of the text used for the sequence title.
      Returns:
      the font color.
    • getLegendTextColor

      public Color getLegendTextColor()
      Returns the default color of the text used for Legend objects.
      Returns:
      the font color.
    • setLegendTextColor

      public void setLegendTextColor(Color color)
      Sets the default color of the text used for Legend objects.
      Parameters:
      color - the font color.
    • setWarningFontColor

      public void setWarningFontColor(Color color)
      Sets the color of the text used for warnings that appear at the bottom of the figure.
      Parameters:
      color - the font color.
    • getWarningFontColor

      public Color getWarningFontColor()
      Returns the color of the text used for warnings that appear at the bottom of the figure.
      Returns:
      the font color.
    • setGlobalLabelColor

      public void setGlobalLabelColor(Color color)
      By default, feature labels are colored to match the color of the feature they represent. The setGlobalLabelColor() method can be used to specify a single color for all labels.
      Parameters:
      color - the color of all labels.
    • getGlobalLabelColor

      public Color getGlobalLabelColor()
      Returns the color of all labels, or null if the labels are colored based on the feature they represent.
      Returns:
      the color of all labels.
    • setShowWarning

      public void setShowWarning(boolean showWarning)
      Sets whether or not the message set using setWarningText() should be drawn at the bottom of the figure.
      Parameters:
      showWarning - whether or not the message should be drawn.
    • getShowWarning

      public boolean getShowWarning()
      Returns whether or not the message set using setWarningText() should be drawn at the bottom of the figure.
      Returns:
      whether or not the message should be drawn.
    • setIsLinear

      public void setIsLinear(boolean isLinear)
      Sets whether or not the map should be drawn with a broken backbone line to indicate a linear molecule.
      Parameters:
      isLinear - whether or not the map should be drawn with a broken backbone line.
    • getIsLinear

      public boolean getIsLinear()
      Returns whether or not the map should be drawn with a broken backbone line to indicate a linear molecule.
      Returns:
      whether or not the map should be drawn with a broken backbone.
    • setLinearBreakText

      public void setLinearBreakText(String text)
      Sets the text to draw at the sequence start/end boundary if this is a linear molecule.
      Parameters:
      text - the text to draw at the start/end boundary.
    • getLinearBreakText

      public String getLinearBreakText()
      Returns the text to draw at the sequence start/end boundary if this is a linear molecule.
      Returns:
      the text to draw at the start/end boundary.
    • setShowBorder

      public void setShowBorder(boolean showBorder)
      Sets whether or not a border should be drawn around the map.
      Parameters:
      showBorder - whether or not a border should be drawn.
    • getShowBorder

      public boolean getShowBorder()
      Returns whether or not a border should be drawn around the map.
      Returns:
      whether or not a border should be drawn.
    • setMoveInnerLabelsToOuter

      public void setMoveInnerLabelsToOuter(boolean moveInnerLabelsToOuter)
      Sets whether or not inner labels should be moved from the inside of the backbone circle to the outside of the backbone circle when there is insufficient room on the inside of the backbone circle.
      Parameters:
      moveInnerLabelsToOuter - whether or not labels should be moved from the inside to the outside.
    • getMoveInnerLabelsToOuter

      public boolean getMoveInnerLabelsToOuter()
      Returns whether or not inner labels should be moved from the inside of the backbone circle to the outside of the backbone circle when there is insufficient room on the inside of the backbone circle.
      Returns:
      whether or not labels should be moved from the inside to the outside.
    • setShowShading

      public void setShowShading(boolean showShading)
      Sets whether or not items on the map should be drawn with shading. This setting can be overridden by individual FeatureSlot objects.
      Parameters:
      showShading - whether or not items on the map should be drawn with shading.
    • getShowShading

      public boolean getShowShading()
      Returns whether or not items on the map should be drawn with shading.
      Returns:
      whether or not items on the map should be drawn with shading.
    • setBackboneColor

      public void setBackboneColor(Color color)
      Sets the color of the circle that represents the DNA sequence.
      Parameters:
      color - the backbone color.
    • getBackboneColor

      public Color getBackboneColor()
      Returns the color of the circle that represents the DNA sequence.
      Returns:
      the backbone color.
    • setFeatureThickness

      public void setFeatureThickness(float thickness)
      Sets the default thickness of the line used to represent sequence features. This value can be changed for individual featureSlots using the FeatureSlot.setFeatureThickness() method.
      Parameters:
      thickness - the default feature thickness.
    • getFeatureThickness

      public float getFeatureThickness()
      Returns the default thickness of the line used to represent sequence features. This value can be changed for individual featureSlots using the FeatureSlot.setFeatureThickness() method.
      Returns:
      the default feature thickness.
    • setMinimumFeatureLength

      public void setMinimumFeatureLength(double length)
      Sets the minimum feature length to use when drawing sequence features. Features smaller than this setting are artificially increased in length, to make them more visible.
      Parameters:
      length - the minimum feature length.
    • getMinimumFeatureLength

      public double getMinimumFeatureLength()
      Returns the minimum feature length to use when drawing sequence features. Features smaller than this setting are artificially increased in length, to make them more visible.
      Returns:
      the minimum feature length.
    • setFeatureSlotSpacing

      public void setFeatureSlotSpacing(double spacing)
      Sets the amount of blank space placed between the concentric feature rings (FeatureSlot objects).
      Parameters:
      spacing - the spacing between FeatureSlot objects.
    • getFeatureSlotSpacing

      public double getFeatureSlotSpacing()
      Returns the amount of blank space placed between the concentric feature rings (FeatureSlot objects).
      Returns:
      the spacing between FeatureSlot objects.
    • setArrowheadLength

      public void setArrowheadLength(double length)
      Sets the length of the arrowheads used for features that are drawn as arrows.
      Parameters:
      length - the arrowhead length.
    • getArrowheadLength

      public double getArrowheadLength()
      Returns the length of the arrowheads used for features that are drawn as arrows.
      Returns:
      the arrowhead length.
    • setShiftSmallFeatures

      public void setShiftSmallFeatures(boolean shift)
      Sets the alignment behavior of small features when they are drawn. Small features are those features drawn larger than they actually are, in order to make them visible on the map. If shift is set to true, the drawn representation of the feature is shifted so that its center coincides with the true center of the feature. If shift is set to false, the drawing begins at the true beginning of the feature, and extends the length specified using the setMinimumFeatureLength() method.
      Parameters:
      shift - whether or not to shift small features so that their center coincides with the true center of the feature.
      See Also:
    • getShiftSmallFeatures

      public boolean getShiftSmallFeatures()
      Returns the alignment behavior of small features when they are drawn. Small features are those features drawn larger than they actually are, in order to make them visible on the map. If shift is set to true, the drawing of the feature is shifted so that its center coincides with the true center of the feature. If shift is set to false, the drawing begins at the true beginning of the feature, and extends the length specified using the setMinimumFeatureLength().
      Returns:
      whether or not to shift small features so that their center coincides with the true center of the feature.
    • setShadingProportion

      public void setShadingProportion(float proportion)
      Sets the proportion of the width of the features to be redrawn for highlighting and shadowing purposes.
      Parameters:
      proportion - the proportion (between 0 and 1).
    • getShadingProportion

      public float getShadingProportion()
      Returns the proportion of the width of the features to be redrawn for highlighting and shadowing purposes.
      Returns:
      the proportion (between 0 and 1).
    • setHighlightOpacity

      public void setHighlightOpacity(float opacity)
      Sets the opacity of the highlighting added to map items. The higher the opacity, the more obvious the highlighting.
      Parameters:
      opacity - the opacity (between 0 and 1).
    • getHighlightOpacity

      public float getHighlightOpacity()
      Returns the opacity of the highlighting added to map items. The higher the opacity, the more obvious the highlighting.
      Returns:
      the opacity (between 0 and 1).
    • setShadowOpacity

      public void setShadowOpacity(float opacity)
      Sets the opacity of the shadowing added to map items. The higher the opacity, the more obvious the shadowing.
      Parameters:
      opacity - the opacity (between 0 and 1).
    • getShadowOpacity

      public float getShadowOpacity()
      Returns the opacity of the shadowing added to map items. The higher the opacity, the more obvious the shadowing.
      Returns:
      the opacity (between 0 and 1).
    • setTickThickness

      public void setTickThickness(float thickness)
      Sets the thickness of the tick marks in the sequence ruler.
      Parameters:
      thickness - the thickness of the tick marks.
    • getTickThickness

      public float getTickThickness()
      Returns the thickness of the tick marks in the sequence ruler.
      Returns:
      the thickness of the tick marks.
    • setTickLength

      public void setTickLength(float length)
      Sets the length of the tick marks in the sequence ruler.
      Parameters:
      length - the length of the tick marks.
    • getTickLength

      public float getTickLength()
      Returns the length of the tick marks in the sequence ruler.
      Returns:
      the length of the tick marks.
    • setShortTickThickness

      public void setShortTickThickness(float thickness)
      Sets the thickness of the short tick marks in the sequence ruler.
      Parameters:
      thickness - the thickness of the short tick marks.
    • getShortTickThickness

      public float getShortTickThickness()
      Returns the thickness of the short tick marks in the sequence ruler.
      Returns:
      the thickness of the short tick marks.
    • setLongTickColor

      public void setLongTickColor(Color color)
      Sets the color of the tick marks in the sequence ruler.
      Parameters:
      color - the color of the tick marks.
    • getLongTickColor

      public Color getLongTickColor()
      Returns the color of the tick marks in the sequence ruler.
      Returns:
      the color of the tick marks.
    • setShortTickColor

      public void setShortTickColor(Color color)
      Sets the color of the short tick marks in the sequence ruler.
      Parameters:
      color - the color of the short tick marks.
    • getShortTickColor

      public Color getShortTickColor()
      Returns the color of the short tick marks in the sequence ruler.
      Returns:
      the color of the short tick marks.
    • setZeroTickColor

      public void setZeroTickColor(Color color)
      Sets the color of the tick mark drawn at the boundary between the end and beginning of the sequence.
      Parameters:
      color - the color of the tick mark drawn at the boundary between the end and beginning of the sequence.
    • getZeroTickColor

      public Color getZeroTickColor()
      Returns the color of the tick mark drawn at the boundary between the end and beginning of the sequence.
      Returns:
      the color of the tick mark drawn at the boundary between the end and beginning of the sequence.
    • setDesiredNumberOfTicks

      public void setDesiredNumberOfTicks(int ticks)
      Sets the approximate number of long tick marks to be drawn in the sequence ruler.
      Parameters:
      ticks - the approximate number of tick marks.
    • getDesiredNumberOfTicks

      public int getDesiredNumberOfTicks()
      Returns the approximate number of long tick marks to be drawn in the sequence ruler.
      Returns:
      the approximate number of tick marks.
    • setDesiredZoomCenter

      public void setDesiredZoomCenter(int zoomCenter)
      Can be used to store a zoom center value when a Cgview object is read from XML data. This value does not alter drawing directly.
      Parameters:
      zoomCenter - a base position to center the map on.
    • getDesiredZoomCenter

      public int getDesiredZoomCenter()
      Returns the zoomCenter value stored using the setDesiredZoomCenter() method.
      Returns:
      a base position to center the map on.
    • setDesiredZoom

      public void setDesiredZoom(double zoom)
      Can be used to store a zoom value when a Cgview object is read from XML data. This value does not alter drawing directly.
      Parameters:
      zoom - a factor to zoom in by.
    • getDesiredZoom

      public double getDesiredZoom()
      Returns the zoom value stored using the setDesiredZoom() method.
      Returns:
      a factor to zoom in by.
    • setRulerFont

      public void setRulerFont(Font font)
      Sets the font of the number labels in the sequence ruler.
      Parameters:
      font - the font of the number labels.
    • getRulerFont

      public Font getRulerFont()
      Returns the font of the number labels in the sequence ruler.
      Returns:
      the font of the number labels.
    • setLegendFont

      public void setLegendFont(Font font)
      Sets the default font used for text in Legend objects added to this Cgview.
      Parameters:
      font - the fault font for Legend objects.
    • getLegendFont

      public Font getLegendFont()
      Returns the default font used for text in Legend objects added to this Cgview.
      Returns:
      the default font for Legend objects.
    • getLegends

      protected ArrayList getLegends()
      Returns an arrayList of the Legend objects in this Cgview.
      Returns:
      the Legend objects in this Cgview.
    • setWarningFont

      public void setWarningFont(Font font)
      Sets the font used for any warnings that appear at the bottom of the map.
      Parameters:
      font - the font used for warning messages.
    • getWarningFont

      public Font getWarningFont()
      Returns the font used for any warnings that appear at the bottom of the map.
      Returns:
      the font used for warning messages.
    • setWarningText

      public void setWarningText(String message)
      Specifies a warning message to appear at the bottom of the map.
      Parameters:
      message - the contents of the message.
    • getWarningText

      public String getWarningText()
      Returns a warning message to appear at the bottom of the map.
      Returns:
      the warning message.
    • setRulerUnits

      public void setRulerUnits(int rulerUnits)
      Sets the units to be used for the sequence ruler.
      Parameters:
      rulerUnits - CgviewConstants.BASES or CgviewConstants.CENTISOMES.
    • getRulerUnits

      public int getRulerUnits()
      Returns the units to be used for the sequence ruler.
      Returns:
      CgviewConstants.BASES or CgviewConstants.CENTISOMES.
    • setGlobalLabel

      public void setGlobalLabel(int labelType)
      Sets whether or not feature labels should be shown on this map. This setting is not overridden by Feature and FeatureRange objects.
      Parameters:
      labelType - CgviewConstants.LABEL_NONE, CgviewConstants.LABEL, or CgviewConstants.LABEL_ZOOMED.
    • getGlobalLabel

      public int getGlobalLabel()
      Returns whether or not feature labels should be shown on this map. This setting is not overridden by Feature and FeatureRange objects.
      Returns:
      CgviewConstants.LABEL_NONE, CgviewConstants.LABEL, or CgviewConstants.LABEL_ZOOMED.
    • setDrawLegends

      public void setDrawLegends(boolean drawLegends)
      Sets whether or not legends should be drawn on this map.
      Parameters:
      drawLegends - whether or not to draw legends.
    • getDrawLegends

      public boolean getDrawLegends()
      Returns boolean indicating whether or not legends should be drawn on this map.
      Returns:
      whether or not legends should be drawn on this map.
    • setTitleFont

      public void setTitleFont(Font font)
      Sets the font of the map title.
      Parameters:
      font - the font of the map title.
    • getTitleFont

      public Font getTitleFont()
      Returns the font of the map title.
      Returns:
      the font of the map title.
    • setLabelFont

      public void setLabelFont(Font font)
      Sets the default font of the feature labels. This font selection will be ignored if a new font is specified in the Feature or FeatureRange objects.
      Parameters:
      font - the font of the feature labels.
      See Also:
    • getLabelFont

      public Font getLabelFont()
      Returns the font of the feature labels. This font selection will be ignored if a font is specified in the Feature or FeatureRange objects.
      Returns:
      the font of the feature labels.
    • setRulerTextPadding

      public void setRulerTextPadding(double padding)
      Sets the spacing between the ruler number labels and the tick marks.
      Parameters:
      padding - the spacing between the ruler number labels and the tick marks.
    • getRulerTextPadding

      public double getRulerTextPadding()
      Returns the spacing between the ruler number labels and the tick marks.
      Returns:
      the spacing between the ruler number labels and the tick marks.
    • setOrigin

      public void setOrigin(double degrees)
      Sets the origin of the sequence in relation to the backbone drawing. By default the sequence begins at the twelve o'clock position.
      Parameters:
      degrees - the number of degrees (between -360.0 and 360.0d) to advance the sequence origin in the counterclockwise direction from the three o'clock position.
    • getOrigin

      public double getOrigin()
      Returns the number of degrees that the origin is to be moved in the counterclockwise direction from the three o'clock position.
      Returns:
      the number of degrees.
    • setLabelLineThickness

      public void setLabelLineThickness(float thickness)
      Sets the thickness of the line that extends from features to feature labels.
      Parameters:
      thickness - the thickness of the line.
    • getLabelLineThickness

      public float getLabelLineThickness()
      Returns the thickness of the line that extends from features to feature labels.
      Returns:
      the thickness of the line.
    • setLabelLineLength

      public void setLabelLineLength(double length)
      Sets the length of the line that extends from the feature to the feature label. If feature labels clash with the number labels in the sequence ruler, the length of the label line should be increased using this method.
      Parameters:
      length - the length of the label line.
    • getLabelLineLength

      public double getLabelLineLength()
      Returns the length of the line that extends from the feature to the feature label.
      Returns:
      the length of the label line.
    • setZoomShift

      protected void setZoomShift(double zoom)
      Sets the minimum zoom value necessary for labels to be drawn below the backbone. When the map is drawn using a zoom value less than the value set using this method, all the labels are drawn on the outside of the backbone circle. When the map is drawn using a zoom value greater than the value set using this method, the labels for features on the reverse strand are drawn on the inside of the backbone circle. Also, when the zoom value is greater than the value set using this method, only the features in the visible portion of the map are drawn.
      Parameters:
      zoom - the minimum zoom value necessary for labels to be drawn below the backbone.
    • getZoomShift

      protected double getZoomShift()
      Returns the minimum zoom value necessary for labels to be drawn below the backbone. When the map is drawn using a zoom value less than the value set using this method, all the labels are drawn on the outside of the backbone circle. When the map is drawn using a zoom value greater than the value set using this method, the labels for features on the reverse strand are drawn on the inside of the backbone circle. Also, when the zoom value is greater than the value set using this method, only the features in the visible portion of the map are drawn.
      Returns:
      the minimum zoom value necessary for labels to be drawn below the backbone.
    • setLabelsToKeep

      public void setLabelsToKeep(int number)
      Sets the maximum number of labels to attempt to arrange for display. Additional labels are discarded prior to the arrangement process.
      Parameters:
      number - the maximum number of labels to attempt to arrange for display.
    • getLabelsToKeep

      public int getLabelsToKeep()
      Returns the maximum number of labels to attempt to arrange for display. Additional labels are discarded prior to the arrangement process.
      Returns:
      the maximum number of labels to attempt to arrange for display.
    • setLabelShuffle

      public void setLabelShuffle(boolean shuffle)
      Sets whether or not labels should be randomly shuffled before removing excess labels.
      Parameters:
      shuffle - whether or not labels should be randomly shuffled before removing excess labels.
    • getLabelShuffle

      public boolean getLabelShuffle()
      Returns true if labels are to be randomly shuffled before removing excess labels.
      Returns:
      whether or not labels should be randomly shuffled before removing excess labels.
    • setUseColoredLabelBackgrounds

      public void setUseColoredLabelBackgrounds(boolean coloredBackground)
      Sets whether or not labels should be drawn with a colored background.
      Parameters:
      coloredBackground - whether or not labels should be drawn with a colored background.
    • getUseColoredLabelBackgrounds

      public boolean getUseColoredLabelBackgrounds()
      Returns true if labels are to be drawn with a colored background.
      Returns:
      whether or not labels are to be drawn with a colored background.
    • setDrawTickMarks

      public void setDrawTickMarks(boolean draw)
      Sets whether or not tick marks are drawn.
      Parameters:
      draw - whether or not tick marks are drawn.
    • getDrawTickMarks

      public boolean getDrawTickMarks()
      Returns true if tick marks are to be drawn.
      Returns:
      whether or not tick marks are to be drawn.
    • setTitle

      public void setTitle(String title)
      Sets the title of of the map. This title is drawn in the center of the backbone circle when an unzoomed map is drawn.
      Parameters:
      title - the title of the map.
    • getTitle

      public String getTitle()
      Returns the title of the map. This title is drawn in the center of the backbone circle when an unzoomed map is drawn.
      Returns:
      the title of the map.
    • getFeatureSlots

      protected ArrayList getFeatureSlots()
      Returns an arrayList containing the FeatureSlot objects associated with this Cgview.
      Returns:
      an arrayList of FeatureSlot objects.
    • removeLegends

      protected void removeLegends()
      Removes legends from this Cgview.
    • removeLabels

      protected void removeLabels()
      Removes labels from this Cgview.
    • getOuterLabels

      protected ArrayList getOuterLabels()
      Returns an arrayList of OuterLabel objects associated with this Cgview.
      Returns:
      an arrayList of OuterLabel objects.
    • getInnerLabels

      protected ArrayList getInnerLabels()
      Returns an arrayList of InnerLabel objects associated with this Cgview.
      Returns:
      an arrayList of InnerLabel objects.
    • getLabelBounds

      public ArrayList getLabelBounds()
      Returns an arrayList of LabelBounds objects associated with this Cgview.
      Returns:
      an arrayList of LabelBounds objects.
    • getFirstOuterFeatureRadius

      protected double getFirstOuterFeatureRadius()
      Returns the radius of the first (nearest to the backbone) direct strand FeatureSlot in this Cgview.
      Returns:
      the radius.
    • getFirstInnerFeatureRadius

      protected double getFirstInnerFeatureRadius()
      Returns the radius of the first (nearest to the backbone) reverse strand FeatureSlot in this Cgview.
      Returns:
      the radius.
    • getLastOuterFeatureRadius

      protected double getLastOuterFeatureRadius()
      Returns the radius of the last (furthest from the backbone) direct strand FeatureSlot in this Cgview.
      Returns:
      the radius.
    • getLastInnerFeatureRadius

      protected double getLastInnerFeatureRadius()
      Returns the radius of the last (furthest from the backbone) reverse strand FeatureSlot in this Cgview.
      Returns:
      the radius.
    • getBackgroundRectangle

      protected Rectangle2D getBackgroundRectangle()
      Returns a rectangle corresponding to the visible portion of the map.
      Returns:
      a rectangle.
    • getTitleRectangle

      protected Rectangle2D getTitleRectangle()
      Returns a rectangle that covers the map title.
      Returns:
      a rectangle.
    • getLengthRectangle

      protected Rectangle2D getLengthRectangle()
      Returns a rectangle that covers the length portion of the map title.
      Returns:
      a rectangle.
    • getRadians

      protected double getRadians(double base)
      Returns a radians representation of the given base.
      Returns:
      a radians representation of the given base.
    • getRadians

      protected double getRadians(int base)
      Returns a radians representation of the given base.
      Returns:
      a radians representation of the given base.
    • getCenter

      protected Point2D getCenter()
      Returns a Point2D specifying the center of this cgview.
      Returns:
      the center of this cgview.
    • getDegrees

      protected double getDegrees(int base)
      Returns a degrees representation of the given base. The virtualZoomMultiplier stretches features.
      Returns:
      a degrees representation of the given base.
    • setUseInnerLabels

      public void setUseInnerLabels(int useInnerLabels)
      Specifies under what circumstances labels should be drawn on the inside of the backbone circle. When set to CgviewConstants.INNER_LABELS_NO_SHOW, all the labels are drawn on the outside of the backbone circle. When set to CgviewConstants.INNER_LABELS_AUTO, all the labels are drawn on the outside of the backbone circle, unless a zoomed map is drawn. When set to CgviewConstants.INNER_LABELS_SHOW, the labels for features on the reverse strand are drawn on the inside of the backbone circle.
      Parameters:
      useInnerLabels -
    • getUseInnerLabels

      public int getUseInnerLabels()
      Returns the inner label behaviour of this Cgview.
      Returns:
      CgviewConstants.INNER_LABELS_NO_SHOW, CgviewConstants.INNER_LABELS_AUTO, or CgviewConstants.INNER_LABELS_SHOW.
    • setGiveFeaturePositions

      public void setGiveFeaturePositions(int giveFeaturePositions)
      Specifies under what circumstances feature position information should be added to the label text. When set to CgviewConstants.POSITIONS_NO_SHOW, position information is not added to the label. When set to CgviewConstants.POSITIONS_AUTO, position information is added only when a zoomed map is drawn. When set to CgviewConstants.POSITIONS_SHOW, position information is added to the labels.
      Parameters:
      giveFeaturePositions -
    • getGiveFeaturePositions

      public int getGiveFeaturePositions()
      Returns the feature position labelling behaviour of this Cgview.
      Returns:
      CgviewConstants.POSITIONS_NO_SHOW, CgviewConstants.POSITIONS_AUTO, or CgviewConstants.POSITIONS_SHOW.
    • getRadiusShiftAmount

      protected double getRadiusShiftAmount()
      Returns the distance moved by the labels each time they are moved away from the map backbone during label repositioning.
      Returns:
      the distance moved by the labels.
    • setRadiansShiftConstant

      protected void setRadiansShiftConstant(double shiftValue)
      Controls label movement along the map backbone. When labels are moved along the backbone during label placement, the increment moved by labels is proportional to the shiftValue constant. If the lines extending to labels are crossing over one another the shiftValue constant should be set to a smaller value. The default value is 0.20.
      Parameters:
      shiftValue - a value that controls label movement along the map backbone.
    • getRadiansShiftConstant

      protected double getRadiansShiftConstant()
      Returns a constant that controls label movement along the map backbone. When labels are moved along the backbone during label placement, the increment moved by labels is proportional to the RADIANS_SHIFT constant. If the lines extending to labels are crossing over one another the RADIANS_SHIFT constant should be set to a smaller value. The default value is 0.20.
      Returns:
      the shiftValue. It controls label movement along the map backbone.
    • setLabelPlacementQuality

      public void setLabelPlacementQuality(int labelPlacementQuality)
      Specifies how carefully labels placed on the map. Higher values lead to more labels being placed without overlaps. Higher values also lead to slower program execution. Hight quality label placement can be used when there are fewer than 100 labels, but when there are more than 100 a low quality setting is recommended.
      Parameters:
      labelPlacementQuality - a value between 0 and 10 specifying how carefully labels are placed on the map. The default value is 5.
      See Also:
    • getZoomMultiplier

      protected double getZoomMultiplier()
      Returns the zoom multiplier for the map, as set using the drawZoomed() method.
      Returns:
      the zoom multiplier.
    • getDrawEntirePlasmid

      protected boolean getDrawEntirePlasmid()
      Returns true if the entire plasmid should be drawn.
      Returns:
      true if the entire plasmid should be drawn.
    • getZoomRangeOneStart

      protected int getZoomRangeOneStart()
      Returns the number of the first base inside the first zoom range. When drawing a zoomed map, two ranges are calculated. These ranges contain all the base positions that should be drawn.
      Returns:
      the number of the first base inside the first zoom range.
    • getZoomRangeOneStop

      protected int getZoomRangeOneStop()
      Returns the number of the last base inside the first zoom range. When drawing a zoomed map, two ranges are calculated. These ranges contain all the base positions that should be drawn.
      Returns:
      the number of the last base inside the first zoom range.
    • getZoomRangeTwoStart

      protected int getZoomRangeTwoStart()
      Returns the number of the first base inside the second zoom range. When drawing a zoomed map, two ranges are calculated. These ranges contain all the base positions that should be drawn.
      Returns:
      the number of the first base inside the second zoom range.
    • getZoomRangeTwoStop

      protected int getZoomRangeTwoStop()
      Returns the number of the last base inside the second zoom range. When drawing a zoomed map, two ranges are calculated. These ranges contain all the base positions that should be drawn.
      Returns:
      the number of the last base inside the second zoom range.
    • getKeepLastLabels

      protected boolean getKeepLastLabels()
      Returns true if the existing labels (those generated by the previous draw operation) are to be drawn. Returns false if a new set of labels is to be generated and positioned.
      Returns:
      whether or not the existing labels are to be drawn.
    • baseIsDrawable

      protected boolean baseIsDrawable(int base)
      Returns true if the base is located within the visible region of the map.
      Returns:
      whether or not the base is located within the visible region of the map.
    • inZoomRangeOne

      protected boolean inZoomRangeOne(int base)
      Returns true if the base is located within the first zoom range.
      Returns:
      whether or not the base is located within the first zoom range.
    • inZoomRangeOne

      protected boolean inZoomRangeOne(double base)
      Returns true if the base is located within the first zoom range.
      Returns:
      whether or not the base is located within the first zoom range.
    • almostInZoomRangeOne

      protected boolean almostInZoomRangeOne(int base)
      Returns true if the base is located within the first zoom range, or if it is one base less than the start.
      Returns:
      whether or not the base is located within the first zoom range, or if it is one base less than the start.
    • inZoomRangeTwo

      protected boolean inZoomRangeTwo(int base)
      Returns true if the base is located within the second zoom range.
      Returns:
      whether or not the base is located within the first zoom range.
    • inZoomRangeTwo

      protected boolean inZoomRangeTwo(double base)
      Returns true if the base is located within the second zoom range.
      Returns:
      whether or not the base is located within the first zoom range.
    • inZoomRange

      protected boolean inZoomRange(int base)
      Returns true if the base is located within the first zoom range or the second zoom range.
      Returns:
      whether or not the base is located within the first zoom range.
    • inZoomRange

      protected boolean inZoomRange(double base)
      Returns true if the base is located within the first zoom range or the second zoom range.
      Returns:
      whether or not the base is located within the first zoom range.
    • addOuterLabel

      protected void addOuterLabel(Label label)
      Adds an outerLabel object to this cgview object.
      Parameters:
      label - an outerLabel object.
    • addInnerLabel

      protected void addInnerLabel(Label label)
      Adds an InnerLabel object to this cgview object.
      Parameters:
      label - an innerLabel object.
    • getZoomMax

      public double getZoomMax()
      Returns an estimate of the maximum suitable zoom value for this map.
      Returns:
      an estimate of the maximum suitable zoom value for this map.
    • translateCanvas

      protected void translateCanvas()
      Translates the canvas.
    • untranslateCanvas

      protected void untranslateCanvas()
      Undoes the canvas translation, so that point(0,0) is in upper left.
    • translateZeroCenter

      protected void translateZeroCenter()
      Translates the canvas so that point (0,0) is in the center.
    • untranslateZeroCenter

      protected void untranslateZeroCenter()
      Undoes the translation of the canvas that was done to place point (0,0) at the center, so that point(0,0) becomes upper left.
    • adjustZoom

      protected double adjustZoom(double zoomMultiplier)
      Checks the zoomMultiplier value and makes adjustments if necessary
      Parameters:
      zoomMultiplier - the factor to zoom in by.
    • drawZoomed

      public void drawZoomed(Graphics2D gg, double zoom, int center, boolean keepLastLabels)
      Draws this Cgview map into the specified Graphics2D context. The map is drawn such that it is zoomed in by a factor of zoom, and centered on the base at position centerBase.
      Parameters:
      gg - the Graphics2D context for rendering.
      zoom - the factor to zoom in by.
      center - the base position to center the map on.
      keepLastLabels - true if the labels from the last draw operation should be redrawn without repositioning, or false if instead new labels should be generated and then positioned.
    • drawZoomed

      public void drawZoomed(Graphics2D gg, double zoom, int center)
      Draws this Cgview map into the specified Graphics2D context. The map is drawn such that it is zoomed in by a factor of zoom, and centered on the base at position centerBase.
      Parameters:
      gg - the graphics2D context for rendering.
      zoom - the factor to zoom in by.
      center - the base position to center the map on.
    • draw

      public void draw(Graphics2D gg, boolean keepLastLabels)
      Draws this Cgview map into the specified Graphics2D context
      Parameters:
      gg - the graphics2D context for rendering.
      keepLastLabels - true if the labels from the last draw operation should be redrawn without repositioning, or false if instead new labels should be generated and then positioned.
    • draw

      public void draw(Graphics2D gg)
      Draws this Cgview map into the specified Graphics2D context
      Parameters:
      gg - the Graphics2D context for rendering.
    • main

      public static void main(String[] ars)