1 package LaTeX::TikZ::Set::Union;
8 LaTeX::TikZ::Set::Union - A set object representing a path formed by the reunion of several subpaths.
16 our $VERSION = '0.02';
18 use LaTeX::TikZ::Interface;
19 use LaTeX::TikZ::Functor;
21 use LaTeX::TikZ::Tools;
27 This class consumes the L<LaTeX::TikZ::Set::Path> and L<LaTeX::TikZ::Set::Container> roles, and as such implements the L</path>, L</kids> and L</add> methods.
32 LaTeX::TikZ::Set::Path
33 LaTeX::TikZ::Set::Container
40 The L<LaTeX::TikZ::Set::Path> objects that form the path.
46 isa => 'Maybe[ArrayRef[LaTeX::TikZ::Set::Path]]',
48 default => sub { [ ] },
51 sub kids { @{$_[0]->_kids} }
59 my $ltsp_tc = LaTeX::TikZ::Tools::type_constraint('LaTeX::TikZ::Set::Path');
64 $ltsp_tc->assert_valid($_) for @_;
66 push @{$set->_kids}, @_;
78 join ' ', map $_->path(@_), $set->kids;
88 my @kids = $set->kids;
89 return undef unless @kids;
101 my @kids = $set->kids;
102 return undef unless @kids;
107 LaTeX::TikZ::Interface->register(
111 __PACKAGE__->new(kids => \@_);
116 __PACKAGE__->new(kids => \@_);
120 LaTeX::TikZ::Functor->default_rule(
121 (__PACKAGE__) => sub {
122 my ($functor, $set, @args) = @_;
123 $set->new(kids => [ map $_->$functor(@args), $set->kids ])
127 __PACKAGE__->meta->make_immutable;
131 L<LaTeX::TikZ>, L<LaTeX::TikZ::Set::Path>, L<LaTeX::TikZ::Set::Container>.
135 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
137 You can contact me by mail or on C<irc.perl.org> (vincent).
141 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>.
142 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
146 You can find documentation for this module with the perldoc command.
150 =head1 COPYRIGHT & LICENSE
152 Copyright 2010 Vincent Pit, all rights reserved.
154 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
158 1; # End of LaTeX::TikZ::Set::Union