/* Establish the currentRange of bases covered by the
    currentFeature of this renderer
 */
 public double[] establishRange(SeqFeatureI sf, int pos, int tier, boolean use_set) {
   double range[];
   if (sf == null || (!use_set && (sf.canHaveChildren()))) {
     range = baseEditor.getRangeAtPosition(tier, pos);
   } else {
     range = new double[2];
     range[0] = (double) baseEditor.basePairToPos(sf.getLow());
     range[1] = (double) baseEditor.basePairToPos(sf.getHigh());
   }
   return range;
 }
 /** True if feat or feats refFeat is fs */
 private boolean featSetContainsFeat(FeatureSetI fs, SeqFeatureI feat) {
   if (fs == null || feat == null) return false;
   if (fs == feat) return true;
   if (fs == feat.getRefFeature()) return true;
   // This should probably be generalized(recursive) for whole ancestor tree and added to
   // FeatureSetI - for now only need to do feat and ref feat
   // could use FeatureSet.find i guess - is that what thats intended for?
   return false;
 }
  /**
   * Get component to be rendered, if pos outside of current range getFeatureAtPosition and reset
   * currentRange, if feature is non null and not an instance of FeatureSetI then its an exon, and
   * set isExon flag
   */
  public Component getBaseRendererComponent(char base, int pos, int tier, SequenceI seq) {
    init(base, pos, tier, seq);

    hatchColor = null;
    if (((BaseEditorPanel) baseEditor).getShowHitZones()) {
      Vector hitZones = ((BaseEditorPanel) baseEditor).hitZones;

      for (int hitIndex = 0; hitIndex < hitZones.size(); hitIndex++) {
        int[] hitZone = (int[]) hitZones.elementAt(hitIndex);

        if (pos >= hitZone[0] && pos < hitZone[1]) {
          hatchColor = Color.yellow;
          break;
        }
      }
    }

    currentFeature = baseEditor.getFeatureAtPosition(pos, tier);
    double[] range = establishRange(currentFeature, pos, tier, false);

    if (range[1] != currentRange[1] || range[0] != currentRange[0]) {
      currentRange[0] = range[0];
      currentRange[1] = range[1];

      currentFeatureSet = baseEditor.getFeatureSetAtPosition(pos, tier);
      range = establishRange(currentFeatureSet, pos, tier, true);
      transcriptRange[0] = range[0];
      transcriptRange[1] = range[1];

      if (currentFeature != null) {
        // This decides the index into the color array, transcripts
        // can have different colors for their features
        transcriptColorIndex =
            (baseEditor.getRangeIndex(tier, (int) currentRange[0], (int) currentRange[1]))
                % transcriptColorList.length;
        exonColorIndex =
            (baseEditor.getExonRangeIndex(tier, (int) currentRange[0], (int) currentRange[1]))
                % transcriptColorList[transcriptColorIndex].length;
      }
      if (currentFeature == null) {
        isExon = false;
        isIntron = false;
        // } else if (currentFeature.canHaveChildren()) {
      } else if (currentFeature.hasKids()) { // 1 level annots can but dont
        isExon = false;
        isIntron = true;
      } else {
        isExon = true;
        isIntron = false;
      }
    }
    return this;
  }
 public boolean canRender(SeqFeatureI feature) {
   return feature.isAnnot();
 }