1
package Bio::Graphics::Glyph::two_bolts;
4
use base qw(Bio::Graphics::Glyph::generic);
6
sub default_bolt_height
11
sub default_bolt_length
16
sub default_remainder_length
21
sub default_bolt_color
29
my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);
31
my $fg = $self->fgcolor;
33
my $midY1 = $y1+($y2-$y1) / 3;
34
my $midY2 = $y1 + 2*($y2-$y1) / 3;
36
my $bolt_color = defined $self->option('bolt_color') ? $self->option('bolt_color') : $self->default_bolt_color();
37
$bolt_color = $self->factory->translate_color($bolt_color);
39
my $bolt_height = defined $self->option('bolt_height') ? $self->option('bolt_height') : $self->default_bolt_height();
40
my $bolt_length = defined $self->option('bolt_length') ? $self->option('bolt_length') : $self->default_bolt_length();
41
my $remainder_length = defined $self->option('remainder_length') ? $self->option('remaindert_length') : $self->default_remainder_length();
43
if ($x2-$x1 < $bolt_length+$remainder_length)
45
$gd->line($x1, $y1, $x2, $y2, $bolt_color);
49
my $bolt_start = $x2-$bolt_length-$remainder_length;
50
my $step = $bolt_length / 8;
51
my $shift = $bolt_height/2;
52
$gd->line($x1, $midY1, $bolt_start, $midY1, $fg);
53
$self->draw_bolt($gd, $bolt_start, $step, $midY1, $shift, $bolt_color);
54
$gd->line($x2-$remainder_length, $midY1, $x2, $midY1, $fg);
56
$bolt_start = $x1+$remainder_length;
57
$gd->line($x1, $midY2, $bolt_start, $midY2, $fg);
58
$self->draw_bolt($gd, $bolt_start, $step, $midY2, $shift, $bolt_color);
59
$gd->line($x1+$bolt_length+$remainder_length, $midY2, $x2, $midY2, $fg);
66
my ($self, $gd, $bolt_start, $step, $y, $shift, $bolt_color) = @_;
67
$gd->line($bolt_start, $y, $bolt_start+$step, $y-$shift, $bolt_color);
68
$gd->line($bolt_start+$step, $y-$shift, $bolt_start+3*$step, $y+$shift, $bolt_color);
69
$gd->line($bolt_start+3*$step, $y+$shift, $bolt_start+5*$step, $y-$shift, $bolt_color);
70
$gd->line($bolt_start+5*$step, $y-$shift, $bolt_start+7*$step, $y+$shift, $bolt_color);
71
$gd->line($bolt_start+7*$step, $y+$shift, $bolt_start+8*$step, $y, $bolt_color);
81
Bio::Graphics::Glyph::two_bolts - The "two bolts" glyph
85
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.
89
This glyph draws two "bolts" on a line. They look like this;
96
In addition to the common options, the following glyph-specific
97
options are recognized:
99
Option Description Default
100
------ ----------- -------
102
-bolt_height Height of the bolt 10
104
-bolt_length Length of the bolt 20
106
-bolt_color Color of the bolt red
109
Length of the short line 10
117
L<Bio::Graphics::Panel>,
118
L<Bio::Graphics::Glyph>,
119
L<Bio::Graphics::Glyph::arrow>,
120
L<Bio::Graphics::Glyph::cds>,
121
L<Bio::Graphics::Glyph::crossbox>,
122
L<Bio::Graphics::Glyph::diamond>,
123
L<Bio::Graphics::Glyph::dna>,
124
L<Bio::Graphics::Glyph::dot>,
125
L<Bio::Graphics::Glyph::ellipse>,
126
L<Bio::Graphics::Glyph::extending_arrow>,
127
L<Bio::Graphics::Glyph::generic>,
128
L<Bio::Graphics::Glyph::graded_segments>,
129
L<Bio::Graphics::Glyph::heterogeneous_segments>,
130
L<Bio::Graphics::Glyph::line>,
131
L<Bio::Graphics::Glyph::pinsertion>,
132
L<Bio::Graphics::Glyph::primers>,
133
L<Bio::Graphics::Glyph::rndrect>,
134
L<Bio::Graphics::Glyph::segments>,
135
L<Bio::Graphics::Glyph::ruler_arrow>,
136
L<Bio::Graphics::Glyph::toomany>,
137
L<Bio::Graphics::Glyph::transcript>,
138
L<Bio::Graphics::Glyph::transcript2>,
139
L<Bio::Graphics::Glyph::translation>,
140
L<Bio::Graphics::Glyph::triangle>,
149
Vsevolod (Simon) Ilyushchenko E<lt>simonf@cshl.eduE<gt>.
151
Copyright (c) 2004 Cold Spring Harbor Laboratory
153
This library is free software; you can redistribute it and/or modify
154
it under the same terms as Perl itself. See DISCLAIMER.txt for
155
disclaimers of warranty.