diff options
| author | franck cuny <franck@lumberjaph.net> | 2011-06-13 18:38:56 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2011-06-13 18:38:56 +0200 |
| commit | a972089fecb01c62880c6a2a5bc5cbcb96105580 (patch) | |
| tree | 87468ea945f6e5fb457249142e1d4b5f5dc71c5a /lib/Graph/GEXF/Role/Viz/Shape.pm | |
| parent | add flash (diff) | |
| download | stargit-a972089fecb01c62880c6a2a5bc5cbcb96105580.tar.gz | |
add Graph::GEXF while it's not on CPAN
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to 'lib/Graph/GEXF/Role/Viz/Shape.pm')
| -rw-r--r-- | lib/Graph/GEXF/Role/Viz/Shape.pm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/Graph/GEXF/Role/Viz/Shape.pm b/lib/Graph/GEXF/Role/Viz/Shape.pm new file mode 100644 index 0000000..b092d6d --- /dev/null +++ b/lib/Graph/GEXF/Role/Viz/Shape.pm @@ -0,0 +1,39 @@ +package Graph::GEXF::Role::Viz::Shape; + +use Moose::Util::TypeConstraints; +use MooseX::Role::Parameterized; + +enum EdgeShape => qw(solid doted dashed double); +enum NodeShape => qw(disc square triangle diamond); + +parameter for => ( + is => 'ro', + required => 1, +); + +role { + my $p = shift; + + my ( $type, $default ); + + $type = ucfirst( $p->for ) . 'Shape'; + + if ( $p->for eq 'node' ) { + $default = 'disc'; + } + else { + $default = 'solid'; + } + + has shape => ( + is => 'rw', + isa => $type, + default => $default, + traits => ['Chained'], + ); +}; + +no Moose::Util::TypeConstraints; + +1; + |
