Bio::Graphics::Glyph::christmas_arrow - The "christmas arrow" glyph


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

Index


Code Index:

NAME

Top

Bio::Graphics::Glyph::christmas_arrow - The "christmas arrow" glyph

SYNOPSIS

Top

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

DESCRIPTION

Top

This glyph draws an arrow which has a circle ("christmas ball") dangling at one end.

OPTIONS

In addition to the common options, the following glyph-specific options are recognized:

  Option      Description                  Default
  ------      -----------                  -------

  -radius     Radius of the circle          4
              glyph

  -length     Length of the arrow           20

  -height     Standard option, but          10
              important here

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

Vsevolod (Simon) Ilyushchenko <simonf@cshl.edu>.

Copyright (c) 2004 Cold Spring Harbor Laboratory

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::christmas_arrow;

use strict;
use base qw(Bio::Graphics::Glyph::generic);

use Math::Trig;

sub my_description {
    return <<END;
This glyph draws an arrow which has a circle ("christmas ball")
dangling at one end.
END
}
sub my_options {
    return {
	radius => ['integer',4, 'Radius of the circle glyph.'],
	length => ['integer',20,'Length of the arrow.'],
    }
}

sub default_radius
{
  return 4;  
}

sub default_length
{
  return 20;  
}

sub draw_component {
  my $self = shift;
  my $gd = shift;
  my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);
  
  my $fg = $self->fgcolor;
  
  my $radius = defined $self->option('radius') ? $self->option('radius') : $self->default_radius ();
  
  $gd->filledEllipse($x1+$radius, $y2-$radius, 2*$radius, 2*$radius, $fg);
  
  my $length = defined $self->option('length') ? $self->option('length') : $self->default_length();

  my $angle = deg2rad(30);
  my $dx = 6;
  my $dy = 4;
  my $midX = $x2-$dx;
  my $midY = $y1+$dy;

  $gd->line($x1+$radius, $y2-$radius, $x1+$radius, $y1+$dy, $fg);

  return if ($x2-$x1 <= $radius);
  
  $x2 = $x1+$radius+$length;
  $gd->line($x1+$radius, $midY, $x2, $midY, $fg);
  $gd->line($x2, $midY, $x2-$dx, $y1, $fg);
  $gd->line($x2, $midY, $x2-$dx, $y1+2*$dy, $fg);
   
}


1;

__END__