Class Feature

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

public class Feature extends Object implements 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
  • Constructor Details

    • Feature

      public Feature(FeatureSlot featureSlot, String label)
      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

      public Feature(FeatureSlot featureSlot)
      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 the setFeatureSlot() method. method.
    • Feature

      public Feature(boolean showShading)
      Constructs a new Feature object. The Feature object must be added to a FeatureSlot using the setFeatureSlot() method. method.
      Parameters:
      showShading - whether or not this Feature should be drawn with shading.
  • Method Details

    • setFeatureSlot

      public void setFeatureSlot(FeatureSlot featureSlot)
      Places this Feature into a FeatureSlot.
      Parameters:
      featureSlot - the FeatureSlot to contain this Feature.
    • addRange

      protected void addRange(FeatureRange featureRange)
      Adds a FeatureRange to this Feature.
      Parameters:
      featureRange - the FeatureRange object to add to this Feature.
    • getRanges

      protected ArrayList getRanges()
      Returns an ArrayList of FeatureRange objects contained by this Feature.
      Returns:
      an ArrayList of FeatureRange objects.
    • setColor

      public void setColor(Color color)
      Sets the default color that will be assigned to FeatureRange objects added to this Feature. This color can be changed for individual FeatureRange objects using FeatureRange.setColor().
      Parameters:
      color - the default FeatureRange color.
    • getColor

      public 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 using FeatureRange.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

      public void setLabel(String label)
      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 using FeatureRange.setLabel().
      Parameters:
      label - the label for this Feature.
    • getLabel

      public String 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 using FeatureRange.setLabel().
      Returns:
      the label for this Feature.
    • setHyperlink

      public void setHyperlink(String hyperlink)
      Specifies a hyperlink to be associated with this Feature. Hyperlinks are included in SVG output generated using CgviewIO.writeToSVGFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, boolean, boolean) or in image maps for PNG and JPG images generated using CgviewIO.writeHTMLFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, java.lang.String, java.lang.String).
      Parameters:
      hyperlink - a hyperlink for this Feature.
    • getHyperlink

      public String getHyperlink()
      Returns the hyperlink to be associated with this Feature.
      Returns:
      the hyperlink for this Feature.
    • setMouseover

      public void setMouseover(String mouseover)
      Specifies a mouseover to be associated with this Feature. Mouseovers are included in SVG output generated using CgviewIO.writeToSVGFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, boolean, boolean) or in image maps for PNG and JPG images generated using CgviewIO.writeHTMLFile(ca.ualberta.stothard.cgview.Cgview, java.lang.String, java.lang.String, java.lang.String).
      Parameters:
      mouseover - the mouseover for this feature.
    • getMouseover

      public String getMouseover()
      Returns the mouseover to be associated with this Feature.
      Returns:
      the mouseover for this Feature.
    • setFont

      public void setFont(Font font)
      Sets the font used for labels generated for this Feature. This font can be changed for individual FeatureRange objects using FeatureRange.setFont().
      Parameters:
      font - the font used for labels generated for this Feature.
    • getFont

      public Font getFont()
      Returns the font used for labels generated for this Feature. This font can be changed for individual FeatureRanges using FeatureRange.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 using FeatureRange.setShowLabel().
      Parameters:
      showLabel - CgviewConstants.LABEL, CgviewConstants.NO_LABEL, or CgviewConstants.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 using FeatureRange.setShowLabel().
      Returns:
      CgviewConstants.LABEL, CgviewConstants.NO_LABEL, or CgviewConstants.LABEL_FORCE.
    • 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 using FeatureRange.setDecoration().
      Parameters:
      decoration - CgviewConstants.DECORATION_STANDARD, CgviewConstants.DECORATION_COUNTERCLOCKWISE_ARROW, CgviewConstants.DECORATION_CLOCKWISE_ARROW, CgviewConstants.DECORATION_HIDDEN.
    • 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 using FeatureRange.setDecoration().
      Returns:
      CgviewConstants.DECORATION_STANDARD, CgviewConstants.DECORATION_COUNTERCLOCKWISE_ARROW, CgviewConstants.DECORATION_CLOCKWISE_ARROW, CgviewConstants.DECORATION_HIDDEN.
    • 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 using setProportionOfThickness(float) so that it is less than 1.0. This setting can be changed for individual FeatureRange objects using FeatureRange.setProportionOfThickness().
      Parameters:
      radiusAdjustment - between 0 and 1, with 1 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 using setProportionOfThickness(float) so that it is less than 1.0. This setting can be changed for individual FeatureRange objects using FeatureRange.setProportionOfThickness().
      Returns:
      a float between 0 and 1, with 1 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 using FeatureRange.setProportionOfThickness().
      Parameters:
      proportionOfThickness - between 0 and 1, with 1 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 using FeatureRange.setProportionOfThickness().
      Returns:
      a float between 0 and 1, with 1 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 using FeatureRange.setSwatchOpacity().
      Parameters:
      opacity - the opacity between 0 and 1, with 1 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 using FeatureRange.setSwatchOpacity().
      Returns:
      the opacity between 0 and 1, with 1 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

      protected void draw(Cgview cgview, double radius, float thickness, double minimumFeatureLength)
      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.