Package ca.ualberta.stothard.cgview
Class Feature
java.lang.Object
ca.ualberta.stothard.cgview.Feature
- All Implemented Interfaces:
CgviewConstants
This class represents a sequence feature. Feature objects (along with the FeatureRange objects)
are used to describe individual sequence features. Feature objects can specify, for example, the
color, opacity, and thickness of a sequence feature. They can also be used to provide a text
label. The Feature object does not dictate which bases contain the sequence feature. The position
information is instead provided by FeatureRange objects contained by the Feature objects.
- Author:
- Paul Stothard
-
Nested Class Summary
-
Field Summary
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
ConstructorDescriptionFeature()
Constructs a new Feature object.Feature
(boolean showShading) Constructs a new Feature object.Feature
(FeatureSlot featureSlot) Constructs a new Feature object.Feature
(FeatureSlot featureSlot, String label) Constructs a new Feature object. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addRange
(FeatureRange featureRange) Adds a FeatureRange to this Feature.protected void
Draws this Feature and creates labels if necessary.getColor()
Returns the default color that will be assigned to FeatureRange objects added to this Feature.int
Returns an integer indicating what type of decoration will be added to this Feature when drawn.getFont()
Returns the font used for labels generated for this Feature.boolean
Returns a boolean specifying whether or not labels created for this Feature should be drawn even if they cannot be placed such that they do not clash with other labels.Returns the hyperlink to be associated with this Feature.getLabel()
Returns the label text for this Feature.Returns the mouseover to be associated with this Feature.float
Returns the opacity of this Feature when drawn.float
Returns the thickness of this Feature when drawn, as a proportion of the thickness of the FeatureSlot containing this Feature.float
Returns the position of this Feature relative to the FeatureSlot object that contains it.protected ArrayList
Returns an ArrayList of FeatureRange objects contained by this Feature.int
Returns whether or not a label should be generated for this Feature when drawn.boolean
Returns whether or not this Feature should be drawn with shading.protected int
getStart()
Returns the smallest start value from the featureRanges in this Feature, or -1 if there are no featureRanges.protected int
Returns the strand of this Feature, which is determined by the FeatureSlot that contains this Feature.void
Sets the default color that will be assigned to FeatureRange objects added to this Feature.void
setDecoration
(int decoration) Sets the type of decoration added to this Feature when drawn.void
setFeatureSlot
(FeatureSlot featureSlot) Places this Feature into a FeatureSlot.void
Sets the font used for labels generated for this Feature.void
setForceLabel
(boolean forceLabel) Specifies whether or not labels created for this Feature should be drawn even if they cannot be placed such that they do not clash with other labels.void
setHyperlink
(String hyperlink) Specifies a hyperlink to be associated with this Feature.void
Sets the label text for this Feature.void
setMouseover
(String mouseover) Specifies a mouseover to be associated with this Feature.void
setOpacity
(float opacity) Sets the opacity of this Feature when drawn.void
setProportionOfThickness
(float proportionOfThickness) Sets the thickness of this Feature when drawn, as a proportion of the thickness of the FeatureSlot containing this Feature.void
setRadiusAdjustment
(float radiusAdjustment) Sets the position of this Feature relative to the FeatureSlot object that contains it.void
setShowLabel
(int showLabel) Sets whether or not a label should be drawn for this Feature.void
setShowShading
(boolean showShading) Sets whether or not this Feature should be drawn with shading.
-
Constructor Details
-
Feature
Constructs a new Feature object.- Parameters:
featureSlot
- the FeatureSlot object to contain this Feature.label
- the text label for this Feature. This label will be used in any labels generated for the Feature when it is drawn.
-
Feature
Constructs a new Feature object.- Parameters:
featureSlot
- the FeatureSlot object to contain this Feature.
-
Feature
public Feature()Constructs a new Feature object. The Feature object must be added to a FeatureSlot using thesetFeatureSlot()
method. method. -
Feature
public Feature(boolean showShading) Constructs a new Feature object. The Feature object must be added to a FeatureSlot using thesetFeatureSlot()
method. method.- Parameters:
showShading
- whether or not this Feature should be drawn with shading.
-
-
Method Details
-
setFeatureSlot
Places this Feature into a FeatureSlot.- Parameters:
featureSlot
- the FeatureSlot to contain this Feature.
-
addRange
Adds a FeatureRange to this Feature.- Parameters:
featureRange
- the FeatureRange object to add to this Feature.
-
getRanges
Returns an ArrayList of FeatureRange objects contained by this Feature.- Returns:
- an ArrayList of FeatureRange objects.
-
setColor
Sets the default color that will be assigned to FeatureRange objects added to this Feature. This color can be changed for individual FeatureRange objects usingFeatureRange.setColor()
.- Parameters:
color
- the default FeatureRange color.
-
getColor
Returns the default color that will be assigned to FeatureRange objects added to this Feature.- Returns:
- the default FeatureRange color.
-
setForceLabel
public void setForceLabel(boolean forceLabel) Specifies whether or not labels created for this Feature should be drawn even if they cannot be placed such that they do not clash with other labels. This behaviour can be set for individual FeatureRange objects usingFeatureRange.setForceLabel()
.- Parameters:
forceLabel
- a boolean specifying whether or not to draw labels for this Feature even if they cannot be placed such that they do not clash with other labels.
-
getForceLabel
public boolean getForceLabel()Returns a boolean specifying whether or not labels created for this Feature should be drawn even if they cannot be placed such that they do not clash with other labels.- Returns:
- whether or not to draw labels for this Feature even if they cannot be placed such that they do not clash with other labels.
-
setLabel
Sets the label text for this Feature. This label will be used in any labels generated for this Feature. This label can be changed for individual FeatureRange objects usingFeatureRange.setLabel()
.- Parameters:
label
- the label for this Feature.
-
getLabel
Returns the label text for this Feature. This label will be used in any labels generated for this Feature. This label can be changed for individual featureRanges usingFeatureRange.setLabel()
.- Returns:
- the label for this Feature.
-
setHyperlink
Specifies a hyperlink to be associated with this Feature. Hyperlinks are included in SVG output generated usingCgviewIO.writeToSVGFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, boolean, boolean)
or in image maps for PNG and JPG images generated usingCgviewIO.writeHTMLFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, java.lang.String, java.lang.String)
.- Parameters:
hyperlink
- a hyperlink for this Feature.
-
getHyperlink
Returns the hyperlink to be associated with this Feature.- Returns:
- the hyperlink for this Feature.
-
setMouseover
Specifies a mouseover to be associated with this Feature. Mouseovers are included in SVG output generated usingCgviewIO.writeToSVGFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, boolean, boolean)
or in image maps for PNG and JPG images generated usingCgviewIO.writeHTMLFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, java.lang.String, java.lang.String)
.- Parameters:
mouseover
- the mouseover for this feature.
-
getMouseover
Returns the mouseover to be associated with this Feature.- Returns:
- the mouseover for this Feature.
-
setFont
Sets the font used for labels generated for this Feature. This font can be changed for individual FeatureRange objects usingFeatureRange.setFont()
.- Parameters:
font
- the font used for labels generated for this Feature.
-
getFont
Returns the font used for labels generated for this Feature. This font can be changed for individual FeatureRanges usingFeatureRange.setFont()
.- Returns:
- the font used for labels generated for this Feature.
-
getStrand
protected int getStrand()Returns the strand of this Feature, which is determined by the FeatureSlot that contains this Feature.- Returns:
- an
int
representing the strand of this feature.
-
setShowLabel
public void setShowLabel(int showLabel) Sets whether or not a label should be drawn for this Feature. This setting can be changed for individual FeatureRange objects usingFeatureRange.setShowLabel()
.- Parameters:
showLabel
-CgviewConstants.LABEL
,CgviewConstants.NO_LABEL
, orCgviewConstants.LABEL_FORCE
.
-
getShowLabel
public int getShowLabel()Returns whether or not a label should be generated for this Feature when drawn. This setting can be changed for individual FeatureRange objects usingFeatureRange.setShowLabel()
. -
setDecoration
public void setDecoration(int decoration) Sets the type of decoration added to this Feature when drawn. This decoration can be changed for individual FeatureRange objects usingFeatureRange.setDecoration()
. -
getDecoration
public int getDecoration()Returns an integer indicating what type of decoration will be added to this Feature when drawn. This decoration can be changed for individual FeatureRange objects usingFeatureRange.setDecoration()
. -
setRadiusAdjustment
public void setRadiusAdjustment(float radiusAdjustment) Sets the position of this Feature relative to the FeatureSlot object that contains it. This value is only applied when the thickness of this Feature is adjusted usingsetProportionOfThickness(float)
so that it is less than 1.0. This setting can be changed for individual FeatureRange objects usingFeatureRange.setProportionOfThickness()
.- Parameters:
radiusAdjustment
- between0
and1
, with1
being near the edge furthest from the map center.
-
getRadiusAdjustment
public float getRadiusAdjustment()Returns the position of this Feature relative to the FeatureSlot object that contains it. This value is only applied when the thickness of this Feature is adjusted usingsetProportionOfThickness(float)
so that it is less than 1.0. This setting can be changed for individual FeatureRange objects usingFeatureRange.setProportionOfThickness()
.- Returns:
- a
float
between0
and1
, with1
being near the edge furthest from the map center. - See Also:
-
setProportionOfThickness
public void setProportionOfThickness(float proportionOfThickness) Sets the thickness of this Feature when drawn, as a proportion of the thickness of the FeatureSlot containing this Feature. This setting can be changed for individual FeatureRange objects usingFeatureRange.setProportionOfThickness()
.- Parameters:
proportionOfThickness
- between0
and1
, with1
being full thickness.
-
getProportionOfThickness
public float getProportionOfThickness()Returns the thickness of this Feature when drawn, as a proportion of the thickness of the FeatureSlot containing this Feature. This setting can be changed for individual FeatureRange objects usingFeatureRange.setProportionOfThickness()
.- Returns:
- a
float
between0
and1
, with1
being full thickness.
-
setOpacity
public void setOpacity(float opacity) Sets the opacity of this Feature when drawn. This setting can be changed for individual FeatureRange objects usingFeatureRange.setSwatchOpacity()
.- Parameters:
opacity
- the opacity between0
and1
, with1
being the most opaque.
-
getOpacity
public float getOpacity()Returns the opacity of this Feature when drawn. This setting can be changed for individual FeatureRange objects usingFeatureRange.setSwatchOpacity()
.- Returns:
- the opacity between
0
and1
, with1
being the most opaque.
-
setShowShading
public void setShowShading(boolean showShading) Sets whether or not this Feature should be drawn with shading.- Parameters:
showShading
- whether or not this Feature should be drawn with shading.
-
getShowShading
public boolean getShowShading()Returns whether or not this Feature should be drawn with shading.- Returns:
- whether or not this Feature should be drawn with shading.
-
draw
Draws this Feature and creates labels if necessary.- Parameters:
cgview
- the Cgview object containing this Feature.radius
- the radius of the FeatureSlot containing this Feature.thickness
- the thickness of the FeatureSlot containing this Feature.
-
getStart
protected int getStart()Returns the smallest start value from the featureRanges in this Feature, or -1 if there are no featureRanges.- Returns:
- the smallest featureRange start in this featureRange or -1.
-