0
|
1 package Bio::Graphics::Glyph::rndrect;
|
|
2
|
|
3 use strict;
|
|
4 use base 'Bio::Graphics::Glyph::generic';
|
|
5
|
|
6 # override draw_component to draw an round edge rect rather than a rectangle
|
|
7 sub draw_component {
|
|
8 my $self = shift;
|
|
9 my $gd = shift;
|
|
10 my ($left,$top) = @_;
|
|
11 my($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);#$self->bounds(@_);
|
|
12 require GD;
|
|
13 my $poly = GD::Polygon->new;
|
|
14 my $boxheight = $y2 - $y1;
|
|
15
|
|
16 if (($x2-$x1) > 3) {
|
|
17 $poly->addPt($x1+1, $y1+1);
|
|
18 $poly->addPt($x1+2, $y1);
|
|
19 $poly->addPt($x2-2, $y1);
|
|
20 $poly->addPt($x2-1, $y1+1);
|
|
21 $poly->addPt($x2, $y1 + $boxheight / 2)
|
|
22 if (($y2 - $y1) > 6);
|
|
23
|
|
24 $poly->addPt($x2-1, $y2-1);
|
|
25 $poly->addPt($x2-2, $y2);
|
|
26 $poly->addPt($x1+2, $y2);
|
|
27 $poly->addPt($x1+1, $y2-1);
|
|
28 $poly->addPt($x1, $y1 + $boxheight / 2)
|
|
29 if (($y2 - $y1) > 6);
|
|
30 } else {
|
|
31 $poly->addPt($x1, $y1);
|
|
32 $poly->addPt($x2, $y1);
|
|
33
|
|
34 $poly->addPt($x2, $y2);
|
|
35 $poly->addPt($x1, $y2);
|
|
36 }
|
|
37
|
|
38 $gd->filledPolygon($poly, $self->fillcolor);
|
|
39
|
|
40 $gd->polygon($poly, $self->fgcolor);
|
|
41 }
|
|
42
|
|
43 # group sets connector to 'solid'
|
|
44 sub connector {
|
|
45 my $self = shift;
|
|
46 return $self->SUPER::connector(@_) if $self->all_callbacks;
|
|
47 return 'solid';
|
|
48 }
|
|
49
|
|
50 sub bump {
|
|
51 my $self = shift;
|
|
52 return $self->SUPER::bump(@_) if $self->all_callbacks;
|
|
53 return 0;
|
|
54 }
|
|
55
|
|
56
|
|
57 1;
|
|
58
|
|
59
|
|
60 =head1 NAME
|
|
61
|
|
62 Bio::Graphics::Glyph::rndrect - The "round rect" glyph
|
|
63
|
|
64 =head1 SYNOPSIS
|
|
65
|
|
66 See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.
|
|
67
|
|
68 =head1 DESCRIPTION
|
|
69
|
|
70 This glyph was designed to show seq features in round edge rectangles.
|
|
71 The glyph will be a rectangle if its width is E<lt> 4 pixels
|
|
72
|
|
73 =head1 BUGS
|
|
74
|
|
75 Please report them.
|
|
76
|
|
77 =head1 SEE ALSO
|
|
78
|
|
79
|
|
80 L<Bio::Graphics::Panel>,
|
|
81 L<Bio::Graphics::Glyph>,
|
|
82 L<Bio::Graphics::Glyph::arrow>,
|
|
83 L<Bio::Graphics::Glyph::cds>,
|
|
84 L<Bio::Graphics::Glyph::crossbox>,
|
|
85 L<Bio::Graphics::Glyph::diamond>,
|
|
86 L<Bio::Graphics::Glyph::dna>,
|
|
87 L<Bio::Graphics::Glyph::dot>,
|
|
88 L<Bio::Graphics::Glyph::ellipse>,
|
|
89 L<Bio::Graphics::Glyph::extending_arrow>,
|
|
90 L<Bio::Graphics::Glyph::generic>,
|
|
91 L<Bio::Graphics::Glyph::graded_segments>,
|
|
92 L<Bio::Graphics::Glyph::heterogeneous_segments>,
|
|
93 L<Bio::Graphics::Glyph::line>,
|
|
94 L<Bio::Graphics::Glyph::pinsertion>,
|
|
95 L<Bio::Graphics::Glyph::primers>,
|
|
96 L<Bio::Graphics::Glyph::rndrect>,
|
|
97 L<Bio::Graphics::Glyph::segments>,
|
|
98 L<Bio::Graphics::Glyph::ruler_arrow>,
|
|
99 L<Bio::Graphics::Glyph::toomany>,
|
|
100 L<Bio::Graphics::Glyph::transcript>,
|
|
101 L<Bio::Graphics::Glyph::transcript2>,
|
|
102 L<Bio::Graphics::Glyph::translation>,
|
|
103 L<Bio::Graphics::Glyph::triangle>,
|
|
104 L<Bio::DB::GFF>,
|
|
105 L<Bio::SeqI>,
|
|
106 L<Bio::SeqFeatureI>,
|
|
107 L<Bio::Das>,
|
|
108 L<GD>
|
|
109
|
|
110 =head1 AUTHOR
|
|
111
|
|
112 Shengqiang Shu E<lt>sshu@bdgp.lbl.govE<gt>
|
|
113
|
|
114 Copyright (c) 2001 BDGP
|
|
115
|
|
116 This library is free software; you can redistribute it and/or modify
|
|
117 it under the same terms as Perl itself. See DISCLAIMER.txt for
|
|
118 disclaimers of warranty.
|
|
119
|
|
120 =cut
|