~ubuntu-branches/ubuntu/utopic/circos/utopic

« back to all changes in this revision

Viewing changes to lib/Circos/Text.pm

  • Committer: Package Import Robot
  • Author(s): Olivier Sallou
  • Date: 2013-05-20 09:01:27 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130520090127-s5nbumg8563x00ee
Tags: 0.64-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
                                                                                                 is_parallel => { default => 0 },
89
89
                                                                                                 is_rotated  => { default => 1 },
90
90
 
91
 
                                                                                                 rotation  => { default => 0 },
 
91
                                                                                                 rotation   => { default => 0 },
92
92
                                        
93
93
                                                                                                 x_offset   => { default => 0 },
94
94
                                                                                                 y_offset   => { default => 0 },
95
95
                                        
96
 
                                                                                                 guides    => { default => 0 },
 
96
                                                                                                 guides     => { default => 0 },
 
97
 
 
98
                                                                                                 mapoptions => { optional => 1, type => HASHREF },
97
99
                                                                                                });
98
100
        } else {
99
101
                %params = @args;
192
194
                                                                                                                                $x,$y,
193
195
                                                                                                                                $params{text});
194
196
 
 
197
                if ($MAP_MAKE) {
 
198
                        if($params{mapoptions}{url}) {
 
199
                                my $xshift = $CONF{image}{image_map_xshift}||0;
 
200
                                my $yshift = $CONF{image}{image_map_xshift}||0;
 
201
                                my $xmult  = $CONF{image}{image_map_xfactor}||1;
 
202
                                my $ymult  = $CONF{image}{image_map_yfactor}||1;
 
203
                                my @coords = map { ( $_->[0]*$xmult + $xshift , $_->[1]*$ymult + $yshift ) } ([@bounds[0,1]],
 
204
                                                                                                                                                                                                                                                                                                                                                        [@bounds[2,3]],
 
205
                                                                                                                                                                                                                                                                                                                                                        [@bounds[4,5]],
 
206
                                                                                                                                                                                                                                                                                                                                                        [@bounds[6,7]]);
 
207
                                Circos::report_image_map(shape=>"poly",
 
208
                                                                                                                                 coords=>\@coords,
 
209
                                                                                                                                 href=>$params{mapoptions}{url});
 
210
                        }
 
211
                }
195
212
        }
196
213
 
197
214
        if ($SVG_MAKE) {
198
 
                Circos::SVG::draw_text(
199
 
                                                                                                         %params,
200
 
                                                                                                         angle_offset=>$angle_offset,
201
 
                                                                                                        );
202
 
 
 
215
                Circos::SVG::draw_text(%params,angle_offset=>$angle_offset);
203
216
        }
204
217
 
205
218
        if ($params{guides}) {
206
219
                my @bounds = string_ttf(font_file => get_font_file_from_key($params{font}),
207
 
                                                                                                                size => $params{size},
208
 
                                                                                                                angle => $text_angle * $DEG2RAD,
209
 
                                                                                                                x => $x, "y" => $y,
210
 
                                                                                                                text=> $params{text});
 
220
                                                                                                                size      => $params{size},
 
221
                                                                                                                angle     => $text_angle * $DEG2RAD,
 
222
                                                                                                                x         => $x, 
 
223
                                                                                                                "y"       => $y,
 
224
                                                                                                                text      => $params{text});
211
225
                my $guide_size = fetch_conf("guides","size");
212
226
                my $color      = fetch_conf("guides","color","text") || fetch_conf("guides","color","default");
213
227
                my $thickness  = fetch_conf("guides","thickness") || 1;
214
 
                Circos::draw_line( [$x-$guide_size,$y,$x+$guide_size,$y],$thickness,$color );
215
 
                Circos::draw_line( [$x,$y-$guide_size,$x,$y+$guide_size],$thickness,$color );
216
 
                Circos::draw_line( [$bounds[6],$bounds[7],$bounds[4],$bounds[5]],$thickness, $color );
217
 
                Circos::draw_line( [$bounds[4],$bounds[5],$bounds[2],$bounds[3]],$thickness, $color );
218
 
                Circos::draw_line( [$bounds[2],$bounds[3],$bounds[0],$bounds[1]],$thickness, $color );
219
 
                Circos::draw_line( [$bounds[0],$bounds[1],$bounds[6],$bounds[7]],$thickness, $color );
 
228
                my $guide_type = fetch_conf("guides","type");
 
229
                if(! defined $guide_type || $guide_type =~ /cross|hatch|position/) {
 
230
                        Circos::draw_line( [$x-$guide_size,$y,$x+$guide_size,$y],$thickness,$color );
 
231
                        Circos::draw_line( [$x,$y-$guide_size,$x,$y+$guide_size],$thickness,$color );
 
232
                }
 
233
                if(! defined $guide_type || $guide_type =~ /outline|box/) {
 
234
                        Circos::draw_line( [$bounds[6],$bounds[7],$bounds[4],$bounds[5]],$thickness, $color );
 
235
                        Circos::draw_line( [$bounds[4],$bounds[5],$bounds[2],$bounds[3]],$thickness, $color );
 
236
                        Circos::draw_line( [$bounds[2],$bounds[3],$bounds[0],$bounds[1]],$thickness, $color );
 
237
                        Circos::draw_line( [$bounds[0],$bounds[1],$bounds[6],$bounds[7]],$thickness, $color );
 
238
                }
220
239
        }
221
240
}
222
241