Bio::Graphics::Glyph broken_line
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::Graphics::Glyph::broken_line - The "broken line" glyph
Package variables
No package variables defined.
Inherit
Bio::Graphics::Glyph::generic
Synopsis
  See Bio::Graphics::Panel and Bio::Graphics::Glyph.
Description
This glyph draws a straight line whose segment is shifted ('sheared')
up or down. There can be an optional "beak' (two diagonal lines
passing between the main line and its segment).
Either the left or the right side of the main line can be absent.
The line can be of fixed size or extend to take up all available space. In addition to the common options, the following glyph-specific
options are recognized:
  Option      Description                  Default
------ ----------- -------
-draw_beak Whether to draw the 'beak'. 1 -shear Vertical distance between 5 the main line and the segment -shear_up Whether to shift the segment 1 up or down (1 or 0) -break Width of the break in the line 8 -extend Whether to extend the line or 1 to keep the length fixed (1 or 0) -size Total length of the line and 30 the break, if extend is 0 -omit_left Whether to omit the left 0 half of the main line -omit_right Whether to omit the right 0 half of the main line
Methods
default_draw_beak
No description
Code
default_shear
No description
Code
default_shear_up
No description
Code
default_break
No description
Code
default_extend
No description
Code
default_size
No description
Code
default_omit_left
No description
Code
default_omit_right
No description
Code
draw_component
No description
Code
Methods description
None available.
Methods code
default_draw_beakdescriptionprevnextTop
sub default_draw_beak {
  return 1;
}
default_sheardescriptionprevnextTop
sub default_shear {
  return 5;
}
default_shear_updescriptionprevnextTop
sub default_shear_up {
  return 1;
}
default_breakdescriptionprevnextTop
sub default_break {
  return 8;
}
default_extenddescriptionprevnextTop
sub default_extend {
  return 1;
}
default_sizedescriptionprevnextTop
sub default_size {
  return 30;
}
default_omit_leftdescriptionprevnextTop
sub default_omit_left {
  return 0;
}
default_omit_rightdescriptionprevnextTop
sub default_omit_right {
  return 0;
}
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 $shear = defined $self->option('shear') ? $self->option('shear') : $self->default_shear();
  my $shear_up = defined $self->option('shear_up') ? $self->option('shear_up') : $self->default_shear_up();
  my $break = defined $self->option('break') ? $self->option('break') : $self->default_break();
  my $draw_beak = defined $self->option('draw_beak') ? $self->option('draw_beak') : $self->default_draw_beak();
  my $extend= defined $self->option('extend') ? $self->option('extend') : $self->default_extend();
  my $size = defined $self->option('size') ? $self->option('size') : $self->default_size();
  my $omit_left = defined $self->option('omit_left') ? $self->option('omit_left') : $self->default_omit_left();
  my $omit_right = defined $self->option('omit_right') ? $self->option('omit_right') : $self->default_omit_right();

  my $midY = ($y1+$y2)/2;
if ($x2-$x1 < $size) { $gd->line($x1, $midY, $x2, $midY, $bg); return; } my $midX = ($x1+$x2)/2;
my $break_start = $midX - $break/2;
my $break_end = $midX + $break/2;
my ($x11, $x12, $x21, $x22); $x12 = $break_start; $x21 = $break_end; if ($omit_left) { $break_start = $x1; $break_end = $x1+$break; $x21 = $break_end; $x22 = ($extend ? $x2 : $x21 + $size - $break); } elsif ($omit_right) { $x11 = $x1; $x12 = ($extend ? $x2 - $break : $x11 + $size - $break); $break_end = $x12+$break; $break_start = $x12; } else { if ($extend) { $x11 = $x1; $x22 = $x2; } else { $x11 = $break_start - ($size - $break) / 2;
$x22 = $break_end + ($size - $break) / 2;
} } unless ($omit_left) { $gd->line($x11, $midY, $x12, $midY, $bg); } my $shear_y = ($shear_up ? $midY - $shear : $midY + $shear); $gd->line($break_start, $shear_y, $break_end, $shear_y, $fg); if ($draw_beak) { $midX = ($break_start + $break_end) / 2;
my $beak_y1 = $shear_up ? $midY + $shear/2 : $midY - $shear/2; my $beak_y2 = $shear_up ? $midY - $shear/2 : $midY + $shear/2; $gd->line($midX, $beak_y1, $midX-$shear, $beak_y2, $fg); $gd->line($midX, $beak_y1, $midX+$shear, $beak_y2, $fg); } unless ($omit_right) { $gd->line($x21, $midY, $x22, $midY, $bg); }
}
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.