]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Mod/Pattern/Lines.pm
This is 0.02
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Mod / Pattern / Lines.pm
index 494817a0b41edc97dccb4c0bc6bd634e616878a8..c9978e0bc580867db431068cf0dfe38d8d0d7c56 100644 (file)
@@ -9,11 +9,11 @@ LaTeX::TikZ::Mod::Pattern::Lines - An hatched pattern modifier.
 
 =head1 VERSION
 
-Version 0.01
+Version 0.02
 
 =cut
 
-our $VERSION = '0.01';
+our $VERSION = '0.02';
 
 use Sub::Name ();
 
@@ -22,8 +22,20 @@ use LaTeX::TikZ::Tools;
 use Any::Moose;
 use Any::Moose 'Util::TypeConstraints';
 
+=head1 RELATIONSHIPS
+
+This class inherits the L<LaTeX::TikZ::Mod::Pattern> class and its L</tag>, L</covers>, L<LaTeX::TikZ::Mod::Pattern/declare> and L<LaTeX::TikZ::Mod::Pattern/apply> methods.
+
+=cut
+
 extends 'LaTeX::TikZ::Mod::Pattern';
 
+=head1 ATTRIBUTES
+
+=head2 C<direction>
+
+=cut
+
 enum 'LaTeX::TikZ::Mod::Pattern::Direction' => (
  'horizontal', 'vertical', 'north east', 'north west',
 );
@@ -34,16 +46,24 @@ has 'direction' => (
  default => 'horizontal',
 );
 
+=head2 C<line_width>
+
+=cut
+
 has 'line_width' => (
  is      => 'ro',
- isa     => 'Int',
+ isa     => subtype('Num' => where { LaTeX::TikZ::Tools::numcmp($_, 0) >= 0 }),
  default => 1,
 );
 
+=head2 C<space_width>
+
+=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,9 +139,19 @@ around 'BUILDARGS' => sub {
  $class->$orig(%args);
 };
 
+=head1 METHODS
+
+=head2 C<tag>
+
+=cut
+
 sub tag { join '/', ref $_[0], $_[0]->direction }
 
-sub cover {
+=head2 C<covers>
+
+=cut
+
+sub covers {
  my ($this, $other) = @_;
 
  LaTeX::TikZ::Tools::numeq($this->line_width, $other->line_width) or return 0;
@@ -133,6 +163,10 @@ sub cover {
 
 __PACKAGE__->meta->make_immutable;
 
+=head1 SEE ALSO
+
+L<LaTeX::TikZ>, L<LaTeX::TikZ::Mod::Pattern>.
+
 =head1 AUTHOR
 
 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.