2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
extends 'Frey'; |
extends 'Frey'; |
5 |
with 'Frey::Web'; |
with 'Frey::Web', 'Frey::File', 'Frey::Storage'; |
|
with 'Frey::File'; |
|
|
with 'Frey::Storage'; |
|
6 |
|
|
7 |
use GraphViz; |
use GraphViz; |
8 |
|
|
67 |
); |
); |
68 |
|
|
69 |
|
|
70 |
|
has layout => ( |
71 |
|
documentation => 'layout algorithm', |
72 |
|
is => 'rw', |
73 |
|
isa => 'Str', |
74 |
|
required => 1, |
75 |
|
); |
76 |
|
|
77 |
|
sub layout_available { q/ |
78 |
|
dot directed graph |
79 |
|
neato spring model |
80 |
|
twopi radial |
81 |
|
circo circular |
82 |
|
fdp force directed spring model |
83 |
|
/ } |
84 |
|
|
85 |
has portrait => ( |
has portrait => ( |
86 |
documentation => 'vertical layout', |
documentation => 'vertical layout', |
87 |
is => 'rw', |
is => 'rw', |
88 |
isa => 'Bool', |
isa => 'Bool', |
89 |
); |
); |
90 |
|
|
91 |
|
has no_overlap => ( |
92 |
|
documentation => 'avoid overlaping nodes', |
93 |
|
is => 'rw', |
94 |
|
isa => 'Bool', |
95 |
|
); |
96 |
|
|
97 |
has produce_dot => ( |
has produce_dot => ( |
98 |
documentation => 'dump .dot text format', |
documentation => 'dump .dot text format', |
99 |
is => 'rw', |
is => 'rw', |
109 |
|
|
110 |
my $g = GraphViz->new( |
my $g = GraphViz->new( |
111 |
rankdir => $rankdir, |
rankdir => $rankdir, |
112 |
|
layout => $self->layout, |
113 |
# layout => 'neato', # grabs too much memory |
# layout => 'neato', # grabs too much memory |
114 |
# layout => 'twopi', # grabs too much memory |
# layout => 'twopi', # grabs too much memory |
115 |
# overlap => 'compress', |
# overlap => 'compress', |
116 |
# no_overlap => 1, |
no_overlap => $self->no_overlap, |
117 |
|
|
118 |
node => { |
node => { |
119 |
shape => 'box', |
shape => 'box', |
162 |
foreach my $role ( keys %{ $data->{roles} } ) { |
foreach my $role ( keys %{ $data->{roles} } ) { |
163 |
next if $filter && $self->filter_roles && $role !~ m{$filter}; |
next if $filter && $self->filter_roles && $role !~ m{$filter}; |
164 |
warn "# $class\trole\t$role\n"; |
warn "# $class\trole\t$role\n"; |
165 |
$g->add_edge( $role => $class, label => 'role', color => 'yellow' ); |
$g->add_edge( $role => $class, label => 'with', color => 'yellow' ); |
166 |
# $g->add_node( $role, rank => 'role' ); |
$g->add_node( $role, shape => 'diamond' ); |
167 |
$count->{$class}++; |
$count->{$class}++; |
168 |
$count->{$role}++; |
$count->{$role}++; |
169 |
} |
} |
215 |
|
|
216 |
} |
} |
217 |
|
|
218 |
|
__PACKAGE__->meta->make_immutable; |
219 |
|
no Moose; |
220 |
|
|
221 |
1; |
1; |