69 |
); |
); |
70 |
|
|
71 |
|
|
72 |
|
has layout => ( |
73 |
|
documentation => 'layout algorithm', |
74 |
|
is => 'rw', |
75 |
|
isa => 'Str', |
76 |
|
required => 1, |
77 |
|
); |
78 |
|
|
79 |
|
sub layout_available { q/ |
80 |
|
dot directed graph |
81 |
|
neato spring model |
82 |
|
twopi radial |
83 |
|
circo circular |
84 |
|
fdp force directed spring model |
85 |
|
/ } |
86 |
|
|
87 |
has portrait => ( |
has portrait => ( |
88 |
documentation => 'vertical layout', |
documentation => 'vertical layout', |
89 |
is => 'rw', |
is => 'rw', |
90 |
isa => 'Bool', |
isa => 'Bool', |
91 |
); |
); |
92 |
|
|
93 |
|
has no_overlap => ( |
94 |
|
documentation => 'avoid overlaping nodes', |
95 |
|
is => 'rw', |
96 |
|
isa => 'Bool', |
97 |
|
); |
98 |
|
|
99 |
has produce_dot => ( |
has produce_dot => ( |
100 |
documentation => 'dump .dot text format', |
documentation => 'dump .dot text format', |
101 |
is => 'rw', |
is => 'rw', |
111 |
|
|
112 |
my $g = GraphViz->new( |
my $g = GraphViz->new( |
113 |
rankdir => $rankdir, |
rankdir => $rankdir, |
114 |
|
layout => $self->layout, |
115 |
# layout => 'neato', # grabs too much memory |
# layout => 'neato', # grabs too much memory |
116 |
# layout => 'twopi', # grabs too much memory |
# layout => 'twopi', # grabs too much memory |
117 |
# overlap => 'compress', |
# overlap => 'compress', |
118 |
# no_overlap => 1, |
no_overlap => $self->no_overlap, |
119 |
|
|
120 |
node => { |
node => { |
121 |
shape => 'box', |
shape => 'box', |
164 |
foreach my $role ( keys %{ $data->{roles} } ) { |
foreach my $role ( keys %{ $data->{roles} } ) { |
165 |
next if $filter && $self->filter_roles && $role !~ m{$filter}; |
next if $filter && $self->filter_roles && $role !~ m{$filter}; |
166 |
warn "# $class\trole\t$role\n"; |
warn "# $class\trole\t$role\n"; |
167 |
$g->add_edge( $role => $class, label => 'role', color => 'yellow' ); |
$g->add_edge( $role => $class, label => 'with', color => 'yellow' ); |
168 |
# $g->add_node( $role, rank => 'role' ); |
$g->add_node( $role, shape => 'diamond' ); |
169 |
$count->{$class}++; |
$count->{$class}++; |
170 |
$count->{$role}++; |
$count->{$role}++; |
171 |
} |
} |