[BACK]Return to make_dot.pl CVS log [TXT][DIR] Up to [pgFoundry] / pgtreelib / pgtreelib / src / graph

Diff for /pgtreelib/pgtreelib/src/graph/make_dot.pl between version 1.1 and 1.2

version 1.1, 2008/09/11 05:38:55 version 1.2, 2008/09/11 15:47:21
Line 1 
Line 1 
 #!/usr/bin/perl -w  #!/usr/bin/perl -w
   
 use DBI;  use DBI;
   use File::HomeDir;
   
   
   
 my $tree;  my $tree;
 my  $dbh;  my  $dbh;
Line 52  sub work(){
Line 55  sub work(){
   
         eval {          eval {
   
                 $sth = $dbh->prepare(q{ SELECT n.* from tree_util.tree_node n JOIN tree_util.tree t ON (t.id = n.tree_id) WHERE t.tree_name = ? ORDER BY n.lft});                  $sth = $dbh->prepare(q{ SELECT n.* from tree_util.tree_node n JOIN tree_util.tree t ON (t.id = n.tree_id) WHERE t.tree_name = ? ORDER BY n.set_id, n.lft});
   
                 my $rv;                  my $rv;
                 $sth->bind_param(1, $tree);                  $sth->bind_param(1, $tree);
Line 126  sub work(){
Line 129  sub work(){
                                         $n2 .= "{" . $row->{weight} . ',' . $row->{internal_weight}  . '} ';                                          $n2 .= "{" . $row->{weight} . ',' . $row->{internal_weight}  . '} ';
                                 }                                  }
   
                                   if ($up{"disp.set_id"}){
                                           $n1 .= $pdata->{set_id} . ' ';
                                           $n2 .= $row->{set_id} . ' ';
                                   }
   
   
                                 if ($up{"disp.left_right"}){                                  if ($up{"disp.left_right"}){
                                         $n1 .= '(' . $pdata->{lft} . ',' . $pdata->{rgt} . ') ';                                          $n1 .= '(' . $pdata->{lft} . ',' . $pdata->{rgt} . ') ';
                                         $n2 .= '(' . $row->{lft} . ',' . $row->{rgt} . ') ';                                          $n2 .= '(' . $row->{lft} . ',' . $row->{rgt} . ') ';
                                 }                                  }
   
                                   if ($up{"disp.ntype"}){
                                           $n1 .= $pdata->{ntype} . ' ';
                                           $n2 .= $row->{ntype} . ' ';
                                   }
   
   
   
                                 $n1 =~ s/\s+$//;                                  $n1 =~ s/\s+$//;
Line 148  sub work(){
Line 160  sub work(){
   
                                 print "$n1 -> $n2 \n";                                  print "$n1 -> $n2 \n";
   
                         } else {                          } elsif ($row->{ntype} == 0) {
                                 #orphan nodes not displayed  
                                   my $n2 = '';
   
                                   if ($up{"disp.id"}){
                                           $n2 .= $id . ' ';
                                   }
   
                                   if ($up{"disp.node_sn"}){
                                           $n2 .= $row->{node_sn} . ' ';
                                   }
   
   
                                   if ($up{"disp.name"}){
                                           $n2 .= '[' . $name . '] ';
                                   }
   
   
                                   if ($up{"disp.node_data"}){
                                           $n2 .=  $row->{node_data_id} . ' ';
                                   }
   
   
   
                                   if ($up{"disp.level"}){
                                           $n2 .= $row->{level} . ' ';
                                   }
   
   
                                   if ($up{"disp.weights"}){
                                           $n2 .= "{" . $row->{weight} . ',' . $row->{internal_weight}  . '} ';
                                   }
   
                                   if ($up{"disp.set_id"}){
                                           $n2 .= $row->{set_id} . ' ';
                                   }
   
   
                                   if ($up{"disp.left_right"}){
                                           $n2 .= '(' . $row->{lft} . ',' . $row->{rgt} . ') ';
                                   }
   
                                   if ($up{"disp.ntype"}){
                                           $n2 .= $row->{ntype} . ' ';
                                   }
   
   
                                   $n2 =~ s/\s+$//;
   
                                   $n2 =~ s/\s+$//;
   
                                   $n2 = '"' . $n2;
                                   $n2 = $n2 . '"';
   
                                   print " $n2 \n";
   
   
                         }                          }
                 }                  }
   
Line 174  sub work(){
Line 241  sub work(){
   
 sub load_config(){  sub load_config(){
   
   
           my $cfile = File::HomeDir->my_home . "/make_dot.conf";
   
         open(CONFIG,'<','make_dot.conf') or die "Canot Open make_dot.conf: $!";          if (! (-e $cfile))
           {
                   $cfile = "make_dot.conf";
           };
   
   
           open(CONFIG,'<',$cfile) or die "Canot Open make_dot.conf: $!";
   
   
         while (<CONFIG>) {          while (<CONFIG>) {
                 chomp;                  # no newline                  chomp;                  # no newline
                 s/#.*//;                # no comments                  s/#.*//;                # no comments
Line 193  sub header(){
Line 270  sub header(){
 print  << "EOF"  print  << "EOF"
 /*tree  */  /*tree  */
 digraph tree {  digraph tree {
                 size="6,6";                  size="12,12";
                 node [color=lightblue2, style=filled];                  node [color=lightblue2, style=filled];
   
 EOF  EOF

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

PgFoundry-cvsweb <pgfoundry-cvsweb@pgFoundry.org>