Changeset 289


Ignore:
Timestamp:
Sep 26, 2017, 3:10:56 PM (7 years ago)
Author:
g7moreau
Message:
  • Add shift option 1 or 2 when exportsw in dot format
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r288 r289  
    27312731
    27322732   my $format = 'txt';
    2733    my $modulo = 0;
     2733   my $graph_modulo = 0;
     2734   my $graph_shift  = 1;
    27342735
    27352736   GetOptions(
    27362737      'format|f=s'  => \$format,
    2737       'modulo|m=i'  => \$modulo,
     2738      'modulo|m=i'  => \$graph_modulo,
     2739      'shift|s=i'   => \$graph_shift,
    27382740      );
    27392741
     
    27452747   $format = 'txt' if not defined $possible_format{$format};
    27462748
    2747    $possible_format{$format}->($modulo, @ARGV);
     2749   $possible_format{$format}->($graph_modulo, $graph_shift, @ARGV);
    27482750   return;
    27492751   }
     
    27922794#---------------------------------------------------------------
    27932795sub cmd_exportsw_dot {
    2794    my $modulo = shift;
     2796   my $graph_modulo = shift;
     2797   my $graph_shift  = shift;
    27952798
    27962799   my $switch_connection = YAML::Syck::LoadFile("$KLASK_SW_FILE");
     
    29222925            printf "   \"%s:%s\" -> \"%s:%s\" [style=$style, color=$color];\n", $sw, $db_switch_output_port{$sw}, $sw_connect, $port_connect;
    29232926
    2924             next if $modulo == 0; # No shift (invisible nodes) in graph
     2927            next if $graph_modulo == 0; # No shift (invisible nodes) in graph
    29252928            $db_switch_line{$sw_connect}++;
    2926             if ($db_switch_line{$sw_connect} % $modulo == 0) {
     2929            if ($db_switch_line{$sw_connect} % $graph_modulo == 0) {
    29272930               # Create invisible node
    29282931               $invisible_node++;
    29292932               my $invisible = '__Invisible_' . $invisible_node;
    2930                print  "   $invisible [shape=none, label=\"\"];\n";
    2931                printf "   \"%s:%s\"  -> $invisible [style=invis];\n", $sw, $db_switch_output_port{$sw};
    2932                printf "   $invisible -> \"%s:%s\"  [style=invis];\n", $sw_connect, $port_connect;
     2933               print  "   \"$invisible.a\" [shape=none, label=\"\"];\n";
     2934               printf "   \"%s:%s\"  -> \"$invisible.a\" [style=invis];\n", $sw, $db_switch_output_port{$sw};
     2935               if ($graph_shift == 2) {
     2936                  # Two invisible node
     2937                  print  "   \"$invisible.b\" [shape=none, label=\"\"];\n";
     2938                  print  "   \"$invisible.a\" -> \"$invisible.b\" [style=invis];\n";
     2939                  printf "   \"$invisible.b\" -> \"%s:%s\"  [style=invis];\n", $sw_connect, $port_connect;
     2940                  }
     2941               else {
     2942                  # One invisible node
     2943                  printf "   \"$invisible.a\" -> \"%s:%s\"  [style=invis];\n", $sw_connect, $port_connect;
     2944                  }
    29332945               }
    29342946            }
Note: See TracChangeset for help on using the changeset viewer.