Bio::Graphics::Glyph::rndrect - The "round rect" glyph


Bio-Graphics documentation Contained in the Bio-Graphics distribution.

Index


Code Index:

NAME

Top

Bio::Graphics::Glyph::rndrect - The "round rect" glyph

SYNOPSIS

Top

  See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.

DESCRIPTION

Top

This glyph was designed to show seq features in round edge rectangles. The glyph will be a rectangle if its width is < 4 pixels

BUGS

Top

Please report them.

SEE ALSO

Top

Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::cds, Bio::Graphics::Glyph::crossbox, Bio::Graphics::Glyph::diamond, Bio::Graphics::Glyph::dna, Bio::Graphics::Glyph::dot, Bio::Graphics::Glyph::ellipse, Bio::Graphics::Glyph::extending_arrow, Bio::Graphics::Glyph::generic, Bio::Graphics::Glyph::graded_segments, Bio::Graphics::Glyph::heterogeneous_segments, Bio::Graphics::Glyph::line, Bio::Graphics::Glyph::pinsertion, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::rndrect, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::ruler_arrow, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::translation, Bio::Graphics::Glyph::triangle, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD

AUTHOR

Top

Shengqiang Shu <sshu@bdgp.lbl.gov>

Copyright (c) 2001 BDGP

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.


Bio-Graphics documentation Contained in the Bio-Graphics distribution.

package Bio::Graphics::Glyph::rndrect;

use strict;
use base 'Bio::Graphics::Glyph::generic';

# override draw_component to draw an round edge rect rather than a rectangle
sub draw_component {
  my $self = shift;
  my $gd = shift;
  my ($left,$top) = @_;
  my($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);#$self->bounds(@_);

  my $poly_pkg = $self->polygon_package;
  my $poly     = $poly_pkg->new();
  my $boxheight = $y2 - $y1;

  if (($x2-$x1) > 3) {
      $poly->addPt($x1+1, $y1+1);
      $poly->addPt($x1+2, $y1);
      $poly->addPt($x2-2, $y1);
      $poly->addPt($x2-1, $y1+1);
      $poly->addPt($x2, $y1 + $boxheight / 2)
        if (($y2 - $y1) > 6);

      $poly->addPt($x2-1, $y2-1);
      $poly->addPt($x2-2, $y2);
      $poly->addPt($x1+2, $y2);
      $poly->addPt($x1+1, $y2-1);
      $poly->addPt($x1, $y1 + $boxheight / 2)
        if (($y2 - $y1) > 6);
  } else {
      $poly->addPt($x1, $y1);
      $poly->addPt($x2, $y1);

      $poly->addPt($x2, $y2);
      $poly->addPt($x1, $y2);
  }

  $gd->filledPolygon($poly,$self->fillcolor);
  $gd->polygon($poly,$self->fgcolor);
}

# group sets connector to 'solid'
sub connector {
  my $self = shift;
  return $self->SUPER::connector(@_) if $self->all_callbacks;
  return 'solid';
}

sub bump {
  my $self = shift;
  return $self->SUPER::bump(@_) if $self->all_callbacks;
  return 0;
}


1;