6 my($grid_size)=225; # xfig
14 open INPUT, $filename;
16 while (defined($line=<INPUT>)) {
19 my($event,$date,$id,$type,$father,@name) = split(/\s+/,$line);
21 $Cat{$id}{name}="@name ";
22 $Cat{$id}{name}=~s/\"//g;
23 $Cat{$id}{father}=$father;
24 $Cat{$id}{type}=$type;
25 $Cat{$id}{date}=$date;
38 foreach $cat (keys %$Cat) {
39 if($$Cat{$cat}{father} eq $root) {
40 push @childs, build_cat_tree($cat,$Cat);
42 # print "$$Cat{$cat}{name}\t\t $Cat{$cat}{father}\n";
45 return [$root,@childs];
49 my($tree,$cat_list)=@_;
50 my($root) = shift @$tree;
53 push @$cat_list,$root;
56 build_cat_list($u,$cat_list);
58 unshift @$tree, $root;
62 sub set_cat_position {
63 my($Cat,$cat_list)=@_;
66 foreach $cat (@$cat_list) {
67 $$Cat{$cat}{X_min} = $i;
68 $$Cat{$cat}{X_max} = $i+1;
76 $fig->{object} = 'compound'; # Compound
77 $fig->{elements} = [];
78 $fig->{version} = 3.2;
79 $fig->{orientation} = 'Landscape';
80 $fig->{justification} = 'Center';
81 $fig->{units} = 'Metric';
82 $fig->{papersize} = 'A4';
83 $fig->{magnification} = '100.00';
84 $fig->{multiplepage} = 'Single';
85 $fig->{transparent} = '-2';
86 $fig->{resolution} = '1200';
87 $fig->{coordsystem} = '2';
88 $fig->{filename} = $filename;
93 my($Cat) = read_cat($ARGV[0]);
94 my($cat_tree)=build_cat_tree("0",$Cat);
95 # print Dumper($cat_tree);
97 build_cat_list($cat_tree,$cat_list);
100 print "@$cat_list \n";
102 set_cat_position($Cat,$cat_list);
104 my($fig)=create_fig("toto.fig");
106 foreach $cat (@$cat_list) {
107 my($text) = new XFig ('text');
108 $text->{'text'} = $cat;
109 $text->{'y'} = ($$Cat{$cat}{X_min}+$$Cat{$cat}{X_max})/2*$grid_size+68;