[Bio] / Sprout / ScenarioSaplingLoader.pm Repository:
ViewVC logotype

Diff of /Sprout/ScenarioSaplingLoader.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10, Wed Sep 29 18:00:40 2010 UTC revision 1.11, Wed Dec 22 17:46:06 2010 UTC
# Line 22  Line 22 
22      use strict;      use strict;
23      use Tracer;      use Tracer;
24      use ERDB;      use ERDB;
     require Image::Magick;  
25      use FIGMODEL;      use FIGMODEL;
26      use Rectangle;      use Rectangle;
27      use GD;      use GD;
# Line 240  Line 239 
239  sub LoadDiagrams {  sub LoadDiagrams {
240      # Get the parameters.      # Get the parameters.
241      my ($self, $fig) = @_;      my ($self, $fig) = @_;
     # Get an Image::Magick object. This enables us to convert GIFs to PNGs.  
     my $p = Image::Magick->new();  
     # Create a temporary file name for the PNGs.  
     my $pngTempFileName = "$FIG_Config::temp/map$$.png";  
242      # Loop through the maps.      # Loop through the maps.
243      my @maps = $fig->all_maps();      my @maps = $fig->all_maps();
244      for my $map (sort @maps) {      for my $map (sort @maps) {
# Line 257  Line 252 
252          my $pngFileName;          my $pngFileName;
253          if (-f "$mapTitle.png") {          if (-f "$mapTitle.png") {
254              $pngFileName = "$mapTitle.png";              $pngFileName = "$mapTitle.png";
         } else {  
             # Here we must use Image::Magick to convert from a GIF to a PNG.  
             $pngFileName = $pngTempFileName;  
             $p->Read("$mapTitle.gif");  
             $p->Write($pngFileName);  
         }  
255          # Read the PNG file in as a GD::Image.          # Read the PNG file in as a GD::Image.
256          my $diagram = GD::Image->new($pngFileName);          my $diagram = GD::Image->new($pngFileName);
257          # Write the diagram record.          # Write the diagram record.
# Line 272  Line 261 
261          $self->Connect($map, $mapTitle . "_cpd.coord", 'Shows', 'id_of_compound');          $self->Connect($map, $mapTitle . "_cpd.coord", 'Shows', 'id_of_compound');
262          # Finally, the reactions.          # Finally, the reactions.
263          $self->Connect($map, $mapTitle . "_rn.coord", 'Displays', 'id_of_reaction');          $self->Connect($map, $mapTitle . "_rn.coord", 'Displays', 'id_of_reaction');
264            } else {
265                $self->Add(mapNotPNG => 1);
266            }
267      }      }
268  }  }
269    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3