|
From: <ai...@us...> - 2011-07-12 04:17:01
|
Revision: 11810
http://plplot.svn.sourceforge.net/plplot/?rev=11810&view=rev
Author: airwin
Date: 2011-07-12 04:16:54 +0000 (Tue, 12 Jul 2011)
Log Message:
-----------
Update bounding box to include vertical axis exponents for plbox
bounding box. Example 33 confirms this improvement is working
properly. This completes the bounding box calculation for plbox!
ToDo: For plcolorbar still need to implement bounding-box
functionality for horizontal and vertical axes of custom labels and
bounding-box functionality for overall colorbar label.
Modified Paths:
--------------
trunk/src/plbox.c
Modified: trunk/src/plbox.c
===================================================================
--- trunk/src/plbox.c 2011-07-12 01:47:09 UTC (rev 11809)
+++ trunk/src/plbox.c 2011-07-12 04:16:54 UTC (rev 11810)
@@ -1752,30 +1752,54 @@
{
offset = 0.02;
height = 2.0;
+ // Left axis exponent
if ( lny )
{
pos = 0.0 - offset;
just = 1.0;
if ( plsc->if_boxbb )
{
- // FIXME: Add X bounding box calculations for
- // numerical labels that slop over the end of the
- // axis.
+ // For horizontal axes, height of zero corresponds
+ // to character centred on edge so should add 0.5
+ // to height to obtain bounding box edge in
+ // direction away from edge if no exponent. Add
+ // an additional offset to make exponent fit.
+ height_mm = ( height + 1.4 ) * char_height_mm;
+ plsc->boxbb_ymax = MAX( plsc->boxbb_ymax, plsc->vppyma /
+ plsc->ypmm + height_mm );
+ string_length_mm = plstrl( string );
+ pos_mm = ( plsc->vppxmi + pos *
+ ( plsc->vppxma - plsc->vppxmi ) ) /
+ plsc->xpmm;
+ plsc->boxbb_xmin = MIN( plsc->boxbb_xmin,
+ pos_mm - string_length_mm );
}
else
{
plmtex( "t", height, pos, just, string );
}
}
+ // Right axis exponent.
if ( lmy )
{
pos = 1.0 + offset;
just = 0.0;
if ( plsc->if_boxbb )
{
- // FIXME: Add X bounding box calculations for
- // numerical labels that slop over the end of the
- // axis.
+ // For horizontal axes, height of zero corresponds
+ // to character centred on edge so should add 0.5
+ // to height to obtain bounding box edge in
+ // direction away from edge if no exponent. Add
+ // an additional offset to make exponent fit.
+ height_mm = ( height + 1.4 ) * char_height_mm;
+ plsc->boxbb_ymax = MAX( plsc->boxbb_ymax, plsc->vppyma /
+ plsc->ypmm + height_mm );
+ string_length_mm = plstrl( string );
+ pos_mm = ( plsc->vppxmi + pos *
+ ( plsc->vppxma - plsc->vppxmi ) ) /
+ plsc->xpmm;
+ plsc->boxbb_xmax = MAX( plsc->boxbb_xmin,
+ pos_mm + string_length_mm );
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|