Permalink
Browse files

move get_sections_from_label method into DataSource where it belongs

  • Loading branch information...
lstein committed Oct 7, 2011
1 parent 4f8deba commit b823aedddd529aab40b9aba737c779a1097eb107
@@ -495,7 +495,7 @@ sub show_summary {
return 0 if $self->semantic_fallback_setting($label=>'global feature',$length);
return 0 unless $c;
- my $section = Bio::Graphics::Browser2::Render->get_section_from_label($label) || 'detail';
+ my $section = $self->get_section_from_label($label) || 'detail';
$length /= $self->details_multiplier if $section eq 'detail';
$c =~ s/_//g;
@@ -608,7 +608,7 @@ sub semantic_label {
return $label unless defined $length && $length > 0;
# adjust for details_mult of we are on a 'details' label
- my $section = Bio::Graphics::Browser2::Render->get_section_from_label($label) || 'detail';
+ my $section = $self->get_section_from_label($label) || 'detail';
$length /= $self->details_multiplier if $section eq 'detail';
# look for:
@@ -1327,5 +1327,21 @@ sub fix_sqlite {
*Bio::DB::SeqFeature::Store::DBI::SQLite::_has_spatial_index = sub { return };
}
+sub get_section_from_label {
+ my $self = shift;
+ my $label = shift;
+
+ return 'detail' if ref $label; # work around a DAS bug
+
+ if ($label eq 'overview' || $label =~ /:overview$/){
+ return 'overview';
+ }
+ elsif ($label eq 'region' || $label =~ /:region$/){
+ return 'region';
+ }
+ return 'detail'
+
+}
+
1;
@@ -581,7 +581,7 @@ sub add_tracks {
= $self->background_individual_track_render($track_id);
my $track_key = $track_keys->{$track_id};
- my $track_section = $self->get_section_from_label($track_id);
+ my $track_section = $self->data_source->get_section_from_label($track_id);
my $image_width = $self->get_image_width($self->state);
my $image_element_id = $track_name . "_image";
@@ -3361,22 +3361,6 @@ sub expand_track_names {
return @results;
}
-sub get_section_from_label {
- my $self = shift;
- my $label = shift;
-
- return 'detail' if ref $label; # work around a DAS bug
-
- if ($label eq 'overview' || $label =~ /:overview$/){
- return 'overview';
- }
- elsif ($label eq 'region' || $label =~ /:region$/){
- return 'region';
- }
- return 'detail'
-
-}
-
# This turns track names into IDs for use at the client side.
# This is necessary because tracks from external files/URLs
# may generate more than one track
@@ -1976,7 +1976,7 @@ sub wrap_track_in_track_div {
# track_type used in register_track() javascript method
my $track_type = $args{'track_type'} || 'standard';
- my $section = $self->get_section_from_label($track_id);
+ my $section = $self->data_source->get_section_from_label($track_id);
my $class = $track_id =~ /scale/i ? 'scale' : 'track';
return div(
@@ -648,7 +648,7 @@ sub wrap_rendered_track {
# when the track is collapsed. Otherwise the track labels get moved
# to the center of the page!
my $pad = $self->render_image_pad(
- $args{section}||Bio::Graphics::Browser2::Render->get_section_from_label($label),
+ $args{section}||Bio::Graphics::Browser2::DataSource->get_section_from_label($label),
);
my $pad_url = $self->source->generate_image($pad);
my $pad_img = img(
@@ -2463,7 +2463,7 @@ sub segment_length {
my $self = shift;
my $label = shift;
my $section = $label
- ? Bio::Graphics::Browser2::Render->get_section_from_label($label)
+ ? Bio::Graphics::Browser2::DataSource->get_section_from_label($label)
: 'detail';
return eval {$section eq 'detail' ? $self->segment->length
:$section eq 'region' ? $self->region_segment->length

0 comments on commit b823aed

Please sign in to comment.