]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/blob - lib/LaTeX/TikZ/Set/Line.pm
ffe5975c89a27be0db00f3ec03860b0903fb1829
[perl/modules/LaTeX-TikZ.git] / lib / LaTeX / TikZ / Set / Line.pm
1 package LaTeX::TikZ::Set::Line;
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 LaTeX::TikZ::Set::Line - A set object representing a line.
9
10 =head1 VERSION
11
12 Version 0.01
13
14 =cut
15
16 our $VERSION = '0.01';
17
18 use LaTeX::TikZ::Set::Point;
19
20 use LaTeX::TikZ::Interface;
21 use LaTeX::TikZ::Functor;
22
23 use Any::Moose;
24
25 with 'LaTeX::TikZ::Set::Op';
26
27 has 'from' => (
28  is       => 'ro',
29  isa      => 'LaTeX::TikZ::Set::Point',
30  required => 1,
31  coerce   => 1,
32 );
33
34 has 'to' => (
35  is       => 'ro',
36  isa      => 'LaTeX::TikZ::Set::Point',
37  required => 1,
38  coerce   => 1,
39 );
40
41 sub path {
42  my $set = shift;
43
44  $set->from->path(@_) . ' -- ' . $set->to->path(@_);
45 }
46
47 LaTeX::TikZ::Interface->register(
48  line => sub {
49   shift;
50
51   __PACKAGE__->new(from => $_[0], to => $_[1]);
52  },
53 );
54
55 LaTeX::TikZ::Functor->default_rule(
56  (__PACKAGE__) => sub {
57   my ($functor, $set, @args) = @_;
58   $set->new(map { $_ => $set->$_->$functor(@args) } qw/from to/)
59  }
60 );
61
62 __PACKAGE__->meta->make_immutable;
63
64 =head1 AUTHOR
65
66 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
67
68 You can contact me by mail or on C<irc.perl.org> (vincent).
69
70 =head1 BUGS
71
72 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>.
73 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
74
75 =head1 SUPPORT
76
77 You can find documentation for this module with the perldoc command.
78
79     perldoc LaTeX::TikZ
80
81 =head1 COPYRIGHT & LICENSE
82
83 Copyright 2010 Vincent Pit, all rights reserved.
84
85 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
86
87 =cut
88
89 1; # End of LaTeX::TikZ::Set::Line