]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blobdiff - lib/LaTeX/TikZ/Formatter.pm
First cut at the documentation
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Formatter.pm
index efa7dc6ed1da9c6558a18a02940163bdaa3d55b7..426263f16a517c434e7c2920fb58865c39fa99a9 100644 (file)
@@ -15,6 +15,12 @@ Version 0.01
 
 our $VERSION = '0.01';
 
+=head1 DESCRIPTION
+
+A formatter object turns a L<LaTeX::TikZ::Set> tree into the actual TikZ code, depending on some parameters such as the scale, the unit or the origin.
+
+=cut
+
 use Sub::Name ();
 
 use LaTeX::TikZ::Point;
@@ -26,40 +32,72 @@ use LaTeX::TikZ::Tools;
 use Any::Moose;
 use Any::Moose 'Util::TypeConstraints';
 
+=head1 ATTRIBUTES
+
+=head2 C<unit>
+
+=cut
+
 has 'unit' => (
  is      => 'ro',
  isa     => enum([ qw/cm pt/ ]),
  default => 'cm',
 );
 
+=head2 C<format>
+
+=cut
+
 has 'format' => (
  is      => 'ro',
  isa     => 'Str',
  default => '%s',
 );
 
+=head2 C<scale>
+
+=cut
+
 has 'scale' => (
  is      => 'rw',
  isa     => 'Num',
  default => 1,
 );
 
+=head2 C<width>
+
+=cut
+
 has 'width' => (
  is  => 'rw',
  isa => 'Maybe[Num]',
 );
 
+=head2 C<height>
+
+=cut
+
 has 'height' => (
  is  => 'rw',
  isa => 'Maybe[Num]',
 );
 
+=head2 C<origin>
+
+=cut
+
 has 'origin' => (
  is     => 'rw',
  isa    => 'LaTeX::TikZ::Point::Autocoerce',
  coerce => 1,
 );
 
+=head1 METHODS
+
+=head2 C<id>
+
+=cut
+
 sub id {
  my $tikz = shift;
 
@@ -76,6 +114,10 @@ sub id {
  } map($tikz->$_, qw/unit format scale width height/), $origin;
 }
 
+=head2 C<render>
+
+=cut
+
 my $find_mods = do {
  our %seen;
 
@@ -183,6 +225,10 @@ sub render {
  return \@header, \@decls, @bodies;
 }
 
+=head2 C<len>
+
+=cut
+
 sub len {
  my ($tikz, $len) = @_;
 
@@ -191,6 +237,10 @@ sub len {
  sprintf $tikz->format . $tikz->unit, $len * $tikz->scale;
 }
 
+=head2 C<angle>
+
+=cut
+
 sub angle {
  my ($tikz, $a) = @_;
 
@@ -201,6 +251,10 @@ sub angle {
  sprintf $tikz->format, POSIX::ceil($a);
 }
 
+=head2 C<label>
+
+=cut
+
 sub label {
  my ($tikz, $name, $pos) = @_;
 
@@ -209,6 +263,10 @@ sub label {
  "node[scale=$scale,$pos] {$name}";
 }
 
+=head2 C<thickness>
+
+=cut
+
 sub thickness {
  my ($tikz, $width) = @_;