comparison variant_effect_predictor/Bio/Graphics/Glyph/dot.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 package Bio::Graphics::Glyph::dot;
2 # DAS-compatible package to use for drawing a ring or filled circle
3
4 use strict;
5 use vars '@ISA';
6 use Bio::Graphics::Glyph::generic;
7 @ISA = 'Bio::Graphics::Glyph::generic';
8 use constant PI => 3.14159;
9
10 sub draw {
11 my $self = shift;
12 # $self->SUPER::draw(@_);
13 my $gd = shift;
14 my $fg = $self->fgcolor;
15
16 # now draw a circle
17 my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);
18 my $xmid = (($x1+$x2)/2); my $width = abs($x2-$x1);
19 my $ymid = (($y1+$y2)/2); my $height = abs($y2-$y1);
20
21 #only point ovals allowed now
22 my $r = $self->height ;
23 $gd->arc($xmid,$ymid,$r,$r,0,360,$fg);
24
25
26 if ($self->option('bgcolor')){
27 my $c = $self->color('bgcolor');
28 $gd->fill($xmid,$ymid,$c);
29 }
30
31 #how about a fuse for the bomb?
32 #work in degrees, not radians. So we define PI above
33 if(defined $self->option('stem')){
34 my $angle = $self->option('stem');
35
36 $gd->line($xmid+($r/PI*sin($angle*PI/180)),
37 $ymid+($r/PI*cos($angle*PI/180)),
38 $xmid+($r*sin($angle*PI/180)),
39 $ymid+($r*cos($angle*PI/180)),$fg);
40 }
41
42 $self->draw_label($gd,@_) if $self->option('label');
43 }
44
45 1;
46
47 __END__
48
49 =head1 NAME
50
51 Bio::Graphics::Glyph::dot - The "dot" glyph
52
53 =head1 SYNOPSIS
54
55 See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.
56
57 =head1 DESCRIPTION
58
59 This glyph draws an ellipse the width of the scaled feature passed,
60 and height a possibly configured height (See Bio::Graphics::Glyph).
61
62 =head2 OPTIONS
63
64 The following options are standard among all Glyphs. See
65 L<Bio::Graphics::Glyph> for a full explanation.
66
67 Option Description Default
68 ------ ----------- -------
69
70 -fgcolor Foreground color black
71
72 -outlinecolor Synonym for -fgcolor
73
74 -bgcolor Background color turquoise
75
76 -fillcolor Synonym for -bgcolor
77
78 -linewidth Line width 1
79
80 -height Height of glyph 10
81
82 -font Glyph font gdSmallFont
83
84 -connector Connector type 0 (false)
85
86 -connector_color
87 Connector color black
88
89 -label Whether to draw a label 0 (false)
90
91 -description Whether to draw a description 0 (false)
92
93 In addition to the common options, the following glyph-specific
94 options are recognized:
95
96 Option Description Default
97 ------ ----------- -------
98
99 -point Whether to draw an ellipse feature width
100 the scaled width of the
101 feature or with radius
102 point.
103
104 =head1 BUGS
105
106 Please report them.
107
108 =head1 SEE ALSO
109
110 L<Bio::Graphics::Panel>,
111 L<Bio::Graphics::Glyph>,
112 L<Bio::Graphics::Glyph::arrow>,
113 L<Bio::Graphics::Glyph::cds>,
114 L<Bio::Graphics::Glyph::crossbox>,
115 L<Bio::Graphics::Glyph::diamond>,
116 L<Bio::Graphics::Glyph::dna>,
117 L<Bio::Graphics::Glyph::dot>,
118 L<Bio::Graphics::Glyph::ellipse>,
119 L<Bio::Graphics::Glyph::extending_arrow>,
120 L<Bio::Graphics::Glyph::generic>,
121 L<Bio::Graphics::Glyph::graded_segments>,
122 L<Bio::Graphics::Glyph::heterogeneous_segments>,
123 L<Bio::Graphics::Glyph::line>,
124 L<Bio::Graphics::Glyph::pinsertion>,
125 L<Bio::Graphics::Glyph::primers>,
126 L<Bio::Graphics::Glyph::rndrect>,
127 L<Bio::Graphics::Glyph::segments>,
128 L<Bio::Graphics::Glyph::ruler_arrow>,
129 L<Bio::Graphics::Glyph::toomany>,
130 L<Bio::Graphics::Glyph::transcript>,
131 L<Bio::Graphics::Glyph::transcript2>,
132 L<Bio::Graphics::Glyph::translation>,
133 L<Bio::Graphics::Glyph::triangle>,
134 L<Bio::DB::GFF>,
135 L<Bio::SeqI>,
136 L<Bio::SeqFeatureI>,
137 L<Bio::Das>,
138 L<GD>
139
140 =head1 AUTHOR
141
142 Allen Day E<lt>day@cshl.orgE<gt>.
143
144 Copyright (c) 2001 Cold Spring Harbor Laboratory
145
146 This library is free software; you can redistribute it and/or modify
147 it under the same terms as Perl itself. See DISCLAIMER.txt for
148 disclaimers of warranty.
149
150 =cut