]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blob - lib/LaTeX/TikZ/Set/Path.pm
a0b822618b57e55c96f07ebc0413661d397b22c8
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Path.pm
1 package LaTeX::TikZ::Set::Path;
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 LaTeX::TikZ::Set::Path - A role for set objects that can be part of a path.
9
10 =head1 VERSION
11
12 Version 0.02
13
14 =cut
15
16 our $VERSION = '0.02';
17
18 =head1 DESCRIPTION
19
20 Paths are all the elements against which we can call the C<path> method.
21
22 =cut
23
24 use Mouse::Role;
25
26 =head1 RELATIONSHIPS
27
28 This role consumes the L<LaTeX::TikZ::Set> role, and as such implements the L</draw> method.
29
30 =cut
31
32 with 'LaTeX::TikZ::Set';
33
34 =head1 METHODS
35
36 These methods are required by the interface :
37
38 =over 4
39
40 =item *
41
42 C<path $formatter, $context>
43
44 Returns the TikZ code that builds a path out of the current set object as a string formatted by the L<LaTeX::TikZ::Formatter> object C<$formatter>.
45 The current evaluation context is passed as the L<LaTeX::TikZ::Context> object C<$context>.
46
47 =item *
48
49 C<begin>
50
51 Returns a L<LaTeX::TikZ::Point> object pointing to the beginning of the path, or C<undef> if this path has no beginning.
52
53 =item *
54
55 C<end>
56
57 A L<LaTeX::TikZ::Point> object pointing to the end of the path, or C<undef> if this path has no end.
58
59 =back
60
61 =cut
62
63 requires qw<
64  path
65  begin
66  end
67 >;
68
69 =head2 C<draw>
70
71 =cut
72
73 sub draw {
74  my $set = shift;
75
76  [ "\\draw " . $set->path(@_) . ' ;' ];
77 }
78
79 =head1 SEE ALSO
80
81 L<LaTeX::TikZ>, L<LaTeX::TikZ::Set>.
82
83 =head1 AUTHOR
84
85 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
86
87 You can contact me by mail or on C<irc.perl.org> (vincent).
88
89 =head1 BUGS
90
91 Please report any bugs or feature requests to C<bug-latex-tikz at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ>.
92 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
93
94 =head1 SUPPORT
95
96 You can find documentation for this module with the perldoc command.
97
98     perldoc LaTeX::TikZ
99
100 =head1 COPYRIGHT & LICENSE
101
102 Copyright 2010,2011,2012,2013,2014,2015 Vincent Pit, all rights reserved.
103
104 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
105
106 =cut
107
108 1; # End of LaTeX::TikZ::Set::Path;