Package ca.ualberta.stothard.cgview
Class OuterLabel
java.lang.Object
ca.ualberta.stothard.cgview.Label
ca.ualberta.stothard.cgview.OuterLabel
- All Implemented Interfaces:
CgviewConstants
This class is used by Cgview objects to facilitate label layout and drawing. The labels
represented by this class are drawn on the outside of the sequence backbone.
- Author:
- Paul Stothard
-
Field Summary
Fields inherited from class ca.ualberta.stothard.cgview.Label
allowedRadiansDelta, ascent, cgview, color, descent, extendedLineEndRadius, extendedLineStartRadius, extendedRadius, fixedInPlace, font, forceLabel, hyperlink, labelText, lineEndRadians, lineEndRadius, lineStartRadians, lineStartRadius, mouseover, placedBounds, RADIAN_SHIFT_PADDING, radiansShiftAmount, radiusShiftAmount, smallestDimension, strand, unplacedBounds
Fields inherited from interface ca.ualberta.stothard.cgview.CgviewConstants
BASES, BOUNDS_BUTTON, BOUNDS_FEATURE, BOUNDS_RULER, CENTISOMES, DECORATION_CLOCKWISE_ARROW, DECORATION_COUNTERCLOCKWISE_ARROW, DECORATION_HIDDEN, DECORATION_STANDARD, DIRECT_STRAND, INNER_LABELS_AUTO, INNER_LABELS_NO_SHOW, INNER_LABELS_SHOW, LABEL, LABEL_FORCE, LABEL_NONE, LABEL_ZOOMED, LEGEND_DRAW_ZOOMED, LEGEND_ITEM_ALIGN_CENTER, LEGEND_ITEM_ALIGN_LEFT, LEGEND_ITEM_ALIGN_RIGHT, LEGEND_LOWER_CENTER, LEGEND_LOWER_LEFT, LEGEND_LOWER_RIGHT, LEGEND_MIDDLE_CENTER, LEGEND_MIDDLE_LEFT, LEGEND_MIDDLE_LEFT_OF_CENTER, LEGEND_MIDDLE_RIGHT, LEGEND_MIDDLE_RIGHT_OF_CENTER, LEGEND_NO_DRAW_ZOOMED, LEGEND_UPPER_CENTER, LEGEND_UPPER_LEFT, LEGEND_UPPER_RIGHT, POSITIONS_AUTO, POSITIONS_NO_SHOW, POSITIONS_SHOW, REVERSE_STRAND, SWATCH_NO_SHOW, SWATCH_SHOW
-
Constructor Summary
ModifierConstructorDescriptionprotected
OuterLabel
(Cgview cgview, String labelText, String hyperlink, String mouseover, Font font, Color color, boolean forceLabel, double lineStartRadians, int strand) Constructs a new OuterLabel object.protected
OuterLabel
(InnerLabel innerLabel) Constructs a new OuterLabel object from an InnerLabel object, and adds the new OuterLabel to the parent Cgview object. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Returns a boolean specifying whether or not this Label clashes with other Label objects in the Cgview object containing this Label.protected void
Draws a line joining the feature to this Label.protected void
Draws the text portion of this Label.protected final boolean
Attempts to move this Label by extending its radius value.protected boolean
Returns a boolean specifying whether or not this Label can completely fit inside of the map canvas.protected void
setLineStartRadius
(double lineStartRadius) Specifies radius of the innermost point in the line extending from the feature to this Label.protected void
Recalculates the rectangle that represents the bounds of this Label.protected void
updateBounds
(double padding) Recalculates the rectangle that represents the bounds of this Label.Methods inherited from class ca.ualberta.stothard.cgview.Label
clashes, clashesWithAny, drawLine, drawLine, getBounds, getExtendedLineEndRadius, getForceLabel, getHyperlink, getLabelText, getLineAsArea, getLineEndRadians, getLineEndRadius, getLineStart, getLineStartRadians, getLineStartRadius, getMouseover, isExtendedRadius, setHyperlink, setMouseover, shiftRadiansHigher, shiftRadiansLower, shiftRadiansToOriginal
-
Constructor Details
-
OuterLabel
protected OuterLabel(Cgview cgview, String labelText, String hyperlink, String mouseover, Font font, Color color, boolean forceLabel, double lineStartRadians, int strand) Constructs a new OuterLabel object.- Parameters:
cgview
- the Cgview object to contain this Label.labelText
- the text that is to be drawn.hyperlink
- a hyperlink to be associated with this Label.mouseover
- mouseover information to be associated with this Label.font
- the font to use when drawing this Label.color
- the color to use when drawing this Label.forceLabel
- whether or not this Label should be drawn even if it cannot be placed such that it does not clash with other labels.lineStartRadians
- the angle in radians of the line extending from the feature to this Label.strand
- the strand of this Label (CgviewConstants.DIRECT_STRAND
orCgviewConstants.REVERSE_STRAND
).
-
OuterLabel
Constructs a new OuterLabel object from an InnerLabel object, and adds the new OuterLabel to the parent Cgview object. This method is used to convert an InnerLabel to an OuterLabel.- Parameters:
innerLabel
- the innerLabel object to convert to an outerLabel.
-
-
Method Details
-
clashesWithAny
protected boolean clashesWithAny()Returns a boolean specifying whether or not this Label clashes with other Label objects in the Cgview object containing this Label.- Specified by:
clashesWithAny
in classLabel
- Returns:
- a
boolean
specifying whether or not this Label clashes with other Labels.
-
drawLabelLine
protected void drawLabelLine()Draws a line joining the feature to this Label.- Specified by:
drawLabelLine
in classLabel
-
drawLabelText
protected void drawLabelText()Draws the text portion of this Label.- Specified by:
drawLabelText
in classLabel
-
updateBounds
protected void updateBounds()Recalculates the rectangle that represents the bounds of this Label.- Specified by:
updateBounds
in classLabel
-
updateBounds
protected void updateBounds(double padding) Recalculates the rectangle that represents the bounds of this Label.- Specified by:
updateBounds
in classLabel
- Parameters:
padding
- the amount of padding to add to the bounds box.
-
extendRadius
protected final boolean extendRadius()Attempts to move this Label by extending its radius value. If this Label is already at the edge of the canvas it is not moved.- Specified by:
extendRadius
in classLabel
- Returns:
- a
boolean
specifing whether or not this Label was moved.
-
setLineStartRadius
protected void setLineStartRadius(double lineStartRadius) Specifies radius of the innermost point in the line extending from the feature to this Label.- Specified by:
setLineStartRadius
in classLabel
- Parameters:
lineStartRadius
- the radius of the innermost point in the line extending from the feature to this Label.
-
fitsInBackground
protected boolean fitsInBackground()Returns a boolean specifying whether or not this Label can completely fit inside of the map canvas.- Specified by:
fitsInBackground
in classLabel
- Returns:
- a
boolean
specifying whether this label can completely fit inside of the map canvas.
-