Graph-Layout-Aesthetic
view release on metacpan or search on metacpan
lib/Graph/Layout/Aesthetic/Force.pm view on Meta::CPAN
Called once when a force is added to a state (see
L<Graph::Layout::Aesthetic::add_force|Graph::Layout::Aesthetic/add_force>).
It should do any necessary preparation for later
L<aesth_gradient|"aesth_gradient"> (e.g. L<Graph::Layout::Aesthetic::Force::MinLevelVariance|Graph::Layout::Aesthetic::Force::MinLevelVariance> uses it to
calculate the levels of each node in a graph so they don't have to be
recalculated every time). It should return a pointer that will be passed to
every L<aesth_gradient|"aesth_gradient"> call and later to
L<aesth_cleanup|"aesth_cleanup"> for any needed cleanup. This for example can
be used to set up scratch memory that will be needed during calculations.
=item aesth_cleanup
This gets called when a forced gets detached from a state, and should do any
needed cleanup, for example cleaning up the scratch memory allocated by
L<aesth_setup|"aesth_setup">
=item aesth_gradient
The actual workhorse of the aesthetic force. It will be passed the current
state, the pointer returned by L<aesth_setup|"aesth_setup"> and a gradient
pointer which is to be filled in with the aesthetic force. The gradient
pointer is already initialized with zeros.
=back
=head1 METHODS
=over
=item X<register>$force->register
=item $force->register($name)
The Graph::Layout::Aesthetic::Force module holds a mapping from names
to forces. This method registers such a force. The name will be $name, unless
that is undefined or not given, in which case it is determined by calling
the L<name|"name"> method on the given $force. The force corresponding to a
given name can be looked up using L<name2force|"name2force"> after this call.
A given name can only be registered once.
=item X<name>$force->name
This methods should return the "official" name for a given force. If it's not
overridden in the subclass, it defaults to the last component of the class the
force belongs to.
=item X<name2force>Graph::Layout::Aesthetic::Force::name2force($name)
This looks up $name in the name to force mapping of this module. If found,
it directly returns the corresponding force. If not, it tries to
L<require|perlfunc/require> Graph::Layout::Aesthetic::Force::$name and
tries again. If still not found, it throws an exception.
This method gets used by L<Graph::Layout::Aesthetic|Graph::Layout::Aesthetic>
to load forces on demand.
=item X<private_data>$old_private_data = $force->_private_data
Every force object is associated with one scalar of private data (default
undef). This is perl data meant for the implementer of a force class, and
should normally not be manipulated by the user (see
L<user_data|"user_data"> for that).
This method returns that private data.
Don't confuse this with the closure data returned by
L<aesth_setup|"aesth_setup">. That one is associated with a force/state
combination and normally only exists as long as a certain force is associated
with a certain state, while this one is associated with the force itself.
=item $old_private_data = $force->_private_data($new_private_data)
Sets new private data, returns the old value.
=item X<user_data>$old_user_data = $force->user_data
Every force object is associated with one scalar of user data (default
undef). This is perl data meant for the enduser of a force class,
and should normally not be manipulated inside the force class
(see L<private_data|"private_data"> for that).
This method returns that user data.
=item $old_user_data = $force->user_data($new_user_data)
Sets new user data, returns the old value.
=back
=head1 EXPORTS
None.
=head1 SEE ALSO
L<Graph::Layout::Aesthetic>,
L<Graph::Layout::Aesthetic::Force::Perl>,
L<Graph::Layout::Aesthetic::Force::Centripetal>,
L<Graph::Layout::Aesthetic::Force::MinEdgeLength>,
L<Graph::Layout::Aesthetic::Force::NodeRepulsion>,
L<Graph::Layout::Aesthetic::Force::MinEdgeIntersect>,
L<Graph::Layout::Aesthetic::Force::MinLevelVariance>,
L<Graph::Layout::Aesthetic::Force::ParentLeft>,
L<Graph::Layout::Aesthetic::Force::MinEdgeIntersect2>,
L<Graph::Layout::Aesthetic::Force::NodeEdgeRepulsion>,
L<Graph::Layout::Aesthetic::Include>
=head1 AUTHOR
Ton Hospel, E<lt>Graph-Layout-Aesthetic@ton.iguana.beE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2004 by Ton Hospel
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.6.1 or,
at your option, any later version of Perl 5 you may have available.
=cut
( run in 0.797 second using v1.01-cache-2.11-cpan-ceb78f64989 )