~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to Bio/Graphics/Glyph/tic_tac_toe.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package Bio::Graphics::Glyph::tic_tac_toe;
2
 
 
3
 
use strict;
4
 
use base qw(Bio::Graphics::Glyph::generic);
5
 
 
6
 
sub default_mode
7
 
{
8
 
  return 'x';  
9
 
}
10
 
 
11
 
sub default_size
12
 
{
13
 
  return 10;  
14
 
}
15
 
 
16
 
sub draw_component {
17
 
  my $self = shift;
18
 
  my $gd = shift;
19
 
  my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);
20
 
  
21
 
  my $fg = $self->fgcolor;
22
 
  
23
 
  my $size = defined $self->option('size') ? $self->option('size') : $self->default_size();
24
 
 
25
 
  my $mode= defined $self->option('mode') ? $self->option('mode') : $self->default_mode();
26
 
  
27
 
  my $midY = ($y1+$y2)/2;
28
 
  
29
 
  for (my $i=0; $i<($x2-$x1)/$size; $i++)
30
 
  {
31
 
    my $start = $x1+$i*$size;
32
 
    my $end = $x1+($i+1)*$size;
33
 
    if ($mode eq "x" || ($mode eq "xo" && $i%2==0))
34
 
    {
35
 
      $gd->line($start, $midY-$size/2, $end, $midY+$size/2, $fg);
36
 
      $gd->line($end, $midY-$size/2, $start, $midY+$size/2, $fg);
37
 
    }
38
 
    elsif ($mode eq "o" || ($mode eq "xo" && $i%2==1))
39
 
    {
40
 
      $gd->ellipse(($start+$end)/2, $midY, $size, $size, $fg);
41
 
    }
42
 
  }   
43
 
}
44
 
 
45
 
1;
46
 
 
47
 
__END__
48
 
 
49
 
=head1 NAME
50
 
 
51
 
Bio::Graphics::Glyph::tic_tac_toe - The "tic-tac-toe" 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 a sequence of either 'xxx', 'ooo' or 'xoxo',
60
 
depending on the value of 'mode'.
61
 
 
62
 
=head2 OPTIONS
63
 
 
64
 
In addition to the common options, the following glyph-specific
65
 
options are recognized:
66
 
 
67
 
  Option      Description                  Default
68
 
  ------      -----------                  -------
69
 
 
70
 
  -mode       One of 'x', 'o', or 'xo'.     'x'
71
 
 
72
 
  -size       Size of either 'x' or 'o'     10
73
 
 
74
 
=head1 BUGS
75
 
 
76
 
Please report them.
77
 
 
78
 
=head1 SEE ALSO
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
 
Vsevolod (Simon) Ilyushchenko E<lt>simonf@cshl.eduE<gt>.
113
 
 
114
 
Copyright (c) 2004 Cold Spring Harbor Laboratory
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