4 use CXGN
::Cview
::Label
;
6 package CXGN
::Cview
::Label
::RangeLabel
;
8 use base qw
/ CXGN::Cview::Label /;
23 my $self = $class->SUPER::new
(@_);
25 # set some interesting defaults
27 $self->set_align_side("left");
28 $self->set_label_spacer(20);
29 $self->set_vertical_stacking_spacing(0);
35 =head2 function render_line()
49 my $line_color = $image->colorResolve($self->get_line_color());
51 $image -> setAntiAliased
($line_color);
54 # calculate the point that the line should connect to
57 my ($x, $y, $a, $b) = $self->get_enclosing_rect();
58 my ($connection_x, $connection_y) = (0, 0);
60 if ($self->get_align_side() eq "right") {
63 $connection_y = $y + CXGN
::Cview
::ImageObject
::round
(($b - $y ) /2);
65 my $horizontal = ($self->get_reference_point())[0]-$self->get_stacking_level()*$self->get_stacking_height();
67 $image->line($connection_x, $connection_y,
68 $horizontal, ($self->get_reference_point())[1],
70 #$image->colorResolve(255,0,0)
73 # draw the lines for the northern range
75 $image->line($horizontal, $self->get_north_position(),
76 $horizontal, $self->get_south_position(), $line_color);
80 $image->line($horizontal, $self->get_north_position(), $horizontal+$self->get_stacking_level()* $self->get_stacking_height(), $self->get_north_position(), $line_color);
82 # draw the line for the southern range tick
84 $image->line($horizontal, $self->get_south_position(), $horizontal + $self->get_stacking_level()*$self->get_stacking_height(), $self->get_south_position(), $line_color);
87 if ($self->get_align_side() eq "left") {
90 $connection_y = $y + CXGN
::Cview
::ImageObject
::round
(($b - $y)/2);
92 my $horizontal = ($self->get_reference_point())[0]+$self->get_stacking_level()*$self->get_stacking_height();
94 # draw the line from the text box to the chromosome
96 $image->line($connection_x, $connection_y,
97 $horizontal, ($self->get_reference_point())[1], $line_color );
99 # draw the line of the region
101 $image->line($horizontal, $self->get_north_position(), $horizontal, $self->get_south_position(), $line_color);
103 # draw the lines for the northern range
105 $image->line($horizontal, $self->get_north_position(), $horizontal-$self->get_stacking_level()*$self->get_stacking_height(), $self->get_north_position(), $line_color);
107 # draw the line for the southern range
109 $image->line($horizontal, $self->get_south_position(), $horizontal-$self->get_stacking_level()*$self->get_stacking_height(), $self->get_south_position(), $line_color);
111 #$image->rectangle($self->get_enclosing_rect(), $line_color);
114 =head2 function get_stacking_height
124 sub get_stacking_height
{
126 return $self->{stacking_height
} || 3;
129 =head2 function set_stacking_height
139 sub set_stacking_height
{
141 $self->{stacking_height
}=shift;