Bio::Graphics::Glyph weighted_arrow
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::Graphics::Glyph::weighted_arrow - The "weighted arrow" glyph
Package variables
No package variables defined.
Included modules
Math::Trig
Inherit
Bio::Graphics::Glyph::generic
Synopsis
  See Bio::Graphics::Panel and Bio::Graphics::Glyph.
Description
This glyph draws an arrow which has is "weighted" by a square
on the left side of the glyph or a "weight" and a vertical line, but
no arrow on its right side. The arrow/line is drawn with the foreground
color, the square - with the background color.
The first mode is the default. To get the second mode, specify
the "left_alignment 0" option. In addition to the common options, the following glyph-specific
options are recognized:
  Option      Description                  Default
------ ----------- -------
-weight_size Size of the square 8 -length Length of the arrow 20 -left_alignment Whether the glyph is drawn 1 on the left or on the right side of the available space. -height Standard option, but 10 important here
Methods
default_weight_size
No description
Code
default_length
No description
Code
default_left_alignment
No description
Code
draw_component
No description
Code
Methods description
None available.
Methods code
default_weight_sizedescriptionprevnextTop
sub default_weight_size {
  return 8;
}
default_lengthdescriptionprevnextTop
sub default_length {
  return 20;
}
default_left_alignmentdescriptionprevnextTop
sub default_left_alignment {
  return 1;
}
draw_componentdescriptionprevnextTop
sub draw_component {
  my $self = shift;
  my $gd = shift;
  my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);
  
  my $fg = $self->fgcolor;
  my $bg = $self->bgcolor;
  
  my $weight_size = defined $self->option('weight_size') ? $self->option('weight_size') : $self->default_weight_size();

  my $length = defined $self->option('length') ? $self->option('length') : $self->default_length();
  my $left_alignment = defined $self->option('left_alignment') ? $self->option('left_alignment') : $self->default_left_alignment();
  
  my ($w_x1, $l_x1);
  if ($left_alignment == 1)
  {
    $w_x1 = $x1+1;
    $l_x1 = $x1;
  }
  else
  {
    $w_x1 = $x2-1-$weight_size;
    $l_x1 = $x2;
    
  }
  
  my $poly_pkg = $self->polygon_package;
  my $polygon   = $poly_pkg->new();
  $polygon->addPt($w_x1,$y2);
  $polygon->addPt($w_x1,$y2-$weight_size);
  $polygon->addPt($w_x1+$weight_size,$y2-$weight_size);
  $polygon->addPt($w_x1+$weight_size,$y2);
  $gd->filledPolygon($polygon,$bg);

  my $angle = deg2rad(30);
  my $dx = 6;
  my $dy = 4;
  my $midX = $x2-$dx;
  my $midY = $y1+$dy;
  
  $gd->line($l_x1, $y2, $l_x1, $y1+$dy, $fg);

  return unless $left_alignment == 1;
    
  return if ($x2-$x1 <= $weight_size);
  
  $x2 = $x1+$weight_size+1+$length;
  $gd->line($l_x1, $midY, $x2, $midY, $fg);
  $gd->line($x2, $midY, $x2-$dx, $y1, $fg);
  $gd->line($x2, $midY, $x2-$dx, $y1+2*$dy, $fg);
}
General documentation
BUGSTop
Please report them.
SEE ALSOTop
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
AUTHORTop
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.