X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ%2FMod%2FPattern%2FLines.pm;h=10a63f49d470aec29bf0a37786e14a0048bf4873;hb=d8d667d1c5266bff861df78c252c92d1504be92c;hp=494817a0b41edc97dccb4c0bc6bd634e616878a8;hpb=e8f0879ade07eed4f58cd52c0771f4e1ecc90b09;p=perl%2Fmodules%2FLaTeX-TikZ.git diff --git a/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm b/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm index 494817a..10a63f4 100644 --- a/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm +++ b/lib/LaTeX/TikZ/Mod/Pattern/Lines.pm @@ -22,8 +22,20 @@ use LaTeX::TikZ::Tools; use Any::Moose; use Any::Moose 'Util::TypeConstraints'; +=head1 RELATIONSHIPS + +This class inherits the L class and its L, L, L and L methods. + +=cut + extends 'LaTeX::TikZ::Mod::Pattern'; +=head1 ATTRIBUTES + +=head2 C + +=cut + enum 'LaTeX::TikZ::Mod::Pattern::Direction' => ( 'horizontal', 'vertical', 'north east', 'north west', ); @@ -34,16 +46,24 @@ has 'direction' => ( default => 'horizontal', ); +=head2 C + +=cut + has 'line_width' => ( is => 'ro', - isa => 'Int', + isa => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }), default => 1, ); +=head2 C + +=cut + has 'space_width' => ( is => 'ro', - isa => 'Int', - default => 1, + isa => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }), + default => 10, ); my $W = Sub::Name::subname('WIDTH' => sub { sprintf '#WIDTH=%0.1f#', @_ }); @@ -89,18 +109,18 @@ my $forge_template = Sub::Name::subname('forge_template' => sub { return; } - <<" PATTERN"; -\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{% - \\pgfsetlinewidth{$line_width} - \\pgfpathmoveto{$line_begin} - \\pgfpathlineto{$line_end} - \\pgfusepath{stroke} -} - PATTERN + return [ + "\\pgfdeclarepatternformonly{#NAME#}{$low_left}{$up_right}{$tile_size}{", + "\\pgfsetlinewidth{$line_width}", + "\\pgfpathmoveto{$line_begin}", + "\\pgfpathlineto{$line_end}", + "\\pgfusepath{stroke}", + "}", + ]; }); around 'BUILDARGS' => sub { - my ($orig, $class, %args); + my ($orig, $class, %args) = @_; confess('Can\'t specify an explicit template for a '. __PACKAGE__ .' pattern') if exists $args{template}; @@ -119,8 +139,18 @@ around 'BUILDARGS' => sub { $class->$orig(%args); }; +=head1 METHODS + +=head2 C + +=cut + sub tag { join '/', ref $_[0], $_[0]->direction } +=head2 C + +=cut + sub cover { my ($this, $other) = @_; @@ -133,6 +163,10 @@ sub cover { __PACKAGE__->meta->make_immutable; +=head1 SEE ALSO + +L, L. + =head1 AUTHOR Vincent Pit, C<< >>, L.