- LICENSE AND COPYRIGHT
Math::Geometry::Construction::Role::Output - graphical output issues
This role provides attributes and methods that are common to all classes which actually draw something.
If set to a true value, the respective object does not create any drawing output.
Hash reference with style settings. You can get the reference using the
style_hash accessor. However, the recommended way to set arguments after construction is to use the
style accessor to access single entries of the hash. (For people familiar with Moose, this is the
accessor method of the
$point->style(fill => 'red') if(!$point->style('fill'));
The valid keys and values depend on the output type. From the point of view of
Math::Geometry::Construction, any defined strings for keys and values are allowed. For
SVG output, the hash is handed over as a style hash to the respective element (see SVG). For
TikZ output, the style settings are realized by
raw_mod calls (see LaTeX::TikZ).
A label is a little piece of text next to an object. The default text anchor for the label is provided by the class consuming this role. The positioning of the label is a tricky task. For example, should the label of a point be printed left of right of the point, above or below etc.? - Ideally, wherever is most space left by lines and circles crossing that point. Obviously, the extension of the label's bounding box has to be taken into account.
So far, I have not come up with a very convincing concept for achieving this. At the moment, the label positions provided by the objects are very primitive. For example, for a point, it is just the position of the point itself. This looks very ugly and has to be corrected by setting label_offset_x and/or label_offset_y. In the future, these might be estimated if not set by the user. Also possibly, the user might be able to provide some kind of direction and the distance is calculated automatically. All I can say at the moment is that label positioning is prone to change and that currently, you will only get decently looking results if you set the
offset values yourself.
Holds the label text. If not set nothing is drawn. If
undef the empty string is drawn. Usually there will be no visible difference. However, to really disable label output, call the
clear_label method instead of setting the label to
Offset in x direction.
Offset in y direction.
Style settings for the label. The comments for the style attribute also apply here.
Draws the label. Called by objects that have consumed this role.
<perl at lutzgehlen.de>
Copyright 2011 Lutz Gehlen.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.