X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FMod%2FLayer.pm;h=1b915b98f4ee107a88c3638bed7ac96440da9a0c;hb=4f696c03a66ef6b52ee7b9b3c74a71d5abc64f7e;hp=bfab947ddfbaa4e291eeab1a198a47ed4a688e2a;hpb=39ceba3937f8397bcb0874419d78f3c4adc427fb;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Mod/Layer.pm b/lib/LaTeX/TikZ/Mod/Layer.pm index bfab947..1b915b9 100644 --- a/lib/LaTeX/TikZ/Mod/Layer.pm +++ b/lib/LaTeX/TikZ/Mod/Layer.pm @@ -9,28 +9,46 @@ LaTeX::TikZ::Mod::Layer - A modifier that specifies a drawing layer. =head1 VERSION -Version 0.01 +Version 0.03 =cut -our $VERSION = '0.01'; +our $VERSION = '0.03'; use Scalar::Util (); use List::Util (); use LaTeX::TikZ::Mod::Formatted; -use Any::Moose; -use Any::Moose 'Util::TypeConstraints'; +use LaTeX::TikZ::Interface; + +use Mouse; +use Mouse::Util::TypeConstraints; + +=head1 RELATIONSHIPS + +This class consumes the L role, and as such implements the L, L, L and L methods. + +=cut with 'LaTeX::TikZ::Mod'; +=head1 ATTRIBUTES + +=head2 C + +=cut + has 'name' => ( is => 'ro', isa => 'Str', required => 1, ); +=head2 C + +=cut + subtype 'LaTeX::TikZ::Mod::LevelList' => as 'ArrayRef[LaTeX::TikZ::Mod::Layer]'; @@ -52,6 +70,10 @@ has '_above' => ( sub above { @{$_[0]->_above} } +=head2 C + +=cut + has '_below' => ( is => 'ro', isa => 'LaTeX::TikZ::Mod::LevelList', @@ -70,6 +92,10 @@ has '_score' => ( builder => '_build_score', ); +=head1 METHODS + +=cut + my %layers; around 'new' => sub { @@ -103,13 +129,25 @@ sub DEMOLISH { delete $layers{$self->name}; } +=head2 C + +=cut + sub tag { my ($self) = @_; ref($self) . '/' . $self->name; } -sub cover { $_[0]->name eq $_[1]->name } +=head2 C + +=cut + +sub covers { $_[0]->name eq $_[1]->name } + +=head2 C + +=cut { our %score; @@ -160,6 +198,10 @@ sub cover { $_[0]->name eq $_[1]->name } $score{$name} } +=head2 C + +=cut + sub declare { shift; @@ -184,6 +226,10 @@ sub cover { $_[0]->name eq $_[1]->name } } } +=head2 C + +=cut + sub apply { my ($self) = @_; @@ -193,17 +239,23 @@ sub apply { ) } -use LaTeX::TikZ::Interface layer => sub { - shift; +LaTeX::TikZ::Interface->register( + layer => sub { + shift; - my $name = shift; - __PACKAGE__->new(name => $name, @_); -}; + my $name = shift; + __PACKAGE__->new(name => $name, @_); + }, +); __PACKAGE__->meta->make_immutable( inline_constructor => 0, ); +=head1 SEE ALSO + +L, L. + =head1 AUTHOR Vincent Pit, C<< >>, L. @@ -223,7 +275,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2010 Vincent Pit, all rights reserved. +Copyright 2010,2011,2012,2013,2014,2015 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.