[Bioperl-guts-l] [14795] bioperl-live/trunk/Bio/Graphics: improved the way that several glyphs are grouped when exporting panels as SVG

Lincoln Stein lstein at dev.open-bio.org
Sun Aug 10 19:34:07 EDT 2008


Revision: 14795
Author:   lstein
Date:     2008-08-10 19:34:07 -0400 (Sun, 10 Aug 2008)

Log Message:
-----------
improved the way that several glyphs are grouped when exporting panels as SVG

Modified Paths:
--------------
    bioperl-live/trunk/Bio/Graphics/Glyph/cds.pm
    bioperl-live/trunk/Bio/Graphics/Glyph/stackedplot.pm
    bioperl-live/trunk/Bio/Graphics/Glyph/xyplot.pm
    bioperl-live/trunk/Bio/Graphics/Panel.pm

Modified: bioperl-live/trunk/Bio/Graphics/Glyph/cds.pm
===================================================================
--- bioperl-live/trunk/Bio/Graphics/Glyph/cds.pm	2008-08-10 22:16:20 UTC (rev 14794)
+++ bioperl-live/trunk/Bio/Graphics/Glyph/cds.pm	2008-08-10 23:34:07 UTC (rev 14795)
@@ -66,6 +66,8 @@
   my $self = shift;
   my ($gd,$left,$top) = @_;
 
+  $self->panel->startGroup($gd);
+
   my @parts = $self->parts;
   @parts    = $self if !@parts && $self->level == 0 && !$self->require_subparts;
 
@@ -170,6 +172,8 @@
   }
 
   $self->Bio::Graphics::Glyph::generic::draw($gd,$left,$top);
+
+  $self->panel->endGroup($gd);
 }
 
 

Modified: bioperl-live/trunk/Bio/Graphics/Glyph/stackedplot.pm
===================================================================
--- bioperl-live/trunk/Bio/Graphics/Glyph/stackedplot.pm	2008-08-10 22:16:20 UTC (rev 14794)
+++ bioperl-live/trunk/Bio/Graphics/Glyph/stackedplot.pm	2008-08-10 23:34:07 UTC (rev 14795)
@@ -201,6 +201,8 @@
   my ($gd,$left,$top,$right,$bottom) = @_;
   my ($min,$max) = $self->min_max;
 
+  $self->panel->startGroup($gd);
+
   my $simple = GD::Simple->new($gd);
   $simple->font($self->scale_font);
   my $dx     = 1;
@@ -224,6 +226,8 @@
   $simple->line(3);
   $simple->move($dx,$dy);
   $simple->string($min);
+
+  $self->panel->endGroup($gd);
 }
 
 1;

Modified: bioperl-live/trunk/Bio/Graphics/Glyph/xyplot.pm
===================================================================
--- bioperl-live/trunk/Bio/Graphics/Glyph/xyplot.pm	2008-08-10 22:16:20 UTC (rev 14794)
+++ bioperl-live/trunk/Bio/Graphics/Glyph/xyplot.pm	2008-08-10 23:34:07 UTC (rev 14795)
@@ -73,6 +73,8 @@
 
   return $self->SUPER::draw(@_) unless @parts > 0;
 
+  $self->panel->startGroup($gd);
+
   my ($min_score,$max_score) = $self->minmax(\@parts);
 
   my $side = $self->_determine_side();
@@ -112,7 +114,9 @@
   my (@draw_methods) = $self->lookup_draw_method($type);
   $self->throw("Invalid graph type '$type'") unless @draw_methods;
 
+  $self->panel->startGroup($gd);
   $self->_draw_scale($gd,$scale,$min_score,$max_score,$dx,$dy,$y_origin);
+  $self->panel->endGroup($gd);
 
   for my $draw_method (@draw_methods) {
     $self->$draw_method($gd,$dx,$dy,$y_origin);
@@ -120,6 +124,8 @@
 
   $self->draw_label(@_)       if $self->option('label');
   $self->draw_description(@_) if $self->option('description');
+
+  $self->panel->endGroup($gd);
 }
 
 sub lookup_draw_method {

Modified: bioperl-live/trunk/Bio/Graphics/Panel.pm
===================================================================
--- bioperl-live/trunk/Bio/Graphics/Panel.pm	2008-08-10 22:16:20 UTC (rev 14794)
+++ bioperl-live/trunk/Bio/Graphics/Panel.pm	2008-08-10 23:34:07 UTC (rev 14795)
@@ -538,11 +538,11 @@
     $offset += $track->layout_height + $spacing;
   }
 
-  $gd->startGroup() if $gd->can('startGroup');
+  $self->startGroup($gd);
   $self->draw_background($gd,$self->{background})  if $self->{background};
   $self->draw_grid($gd)                            if $self->{grid};
   $self->draw_background($gd,$self->{postgrid})    if $self->{postgrid};
-  $gd->endGroup() if $gd->can('endGroup');
+  $self->endGroup($gd);
 
   $offset = $pt;
   for my $track (@{$self->{tracks}}) {




More information about the Bioperl-guts-l mailing list