From: <ai...@us...> - 2011-07-17 17:34:09
|
Revision: 11818 http://plplot.svn.sourceforge.net/plplot/?rev=11818&view=rev Author: airwin Date: 2011-07-17 17:34:03 +0000 (Sun, 17 Jul 2011) Log Message: ----------- Make second call to calculate_limits with appropriate transformation of input and output results. Since additional coordinate system tranformations are involved the results are numerically different, but the ndiff app confirms these changes are only for one unit in the last PostScript place. That numerical result helps to verify that the correct transformations are being used for the second calculate_limits call. ToDo: Implement bounding box calculation in draw_label so that the overall position and bounding box will (finally) be correct. Modified Paths: -------------- trunk/src/pllegend.c Modified: trunk/src/pllegend.c =================================================================== --- trunk/src/pllegend.c 2011-07-17 16:30:21 UTC (rev 11817) +++ trunk/src/pllegend.c 2011-07-17 17:34:03 UTC (rev 11818) @@ -1661,38 +1661,42 @@ plot_x_subpage = plot_x_subpage_bb + dx_subpage; plot_y_subpage = plot_y_subpage_bb + dy_subpage; + // Coordinates of bounding box for decorated colorbar (without overall label). label_vpor_xmin = plot_x_subpage_bb; label_vpor_xmax = plot_x_subpage_bb + colorbar_width_bb; label_vpor_ymin = plot_y_subpage_bb - colorbar_height_bb; label_vpor_ymax = plot_y_subpage_bb; - if ( 0 ) - { - // Viewport for draw_label is correct size, but has a shifted zero - // point compared to the final result but consistent with the - // coordinate scheme for bb_xmin, etc., established above with the - // previous plvpor call. calculate_limits below takes account of - // this shifted zero point so its results such as bounding-box - // range and position of the bounding box should be unaffected. - plvpor( 0., label_vpor_xmax - label_vpor_xmin, 0., label_vpor_ymax - label_vpor_ymin ); + // Viewport for draw_label is correct size, but has a shifted zero + // point compared to the final result but consistent with the + // coordinate scheme for bb_xmin, etc., established above with the + // previous plvpor call. calculate_limits below takes account of + // this shifted zero point so its results such as bounding-box + // range and position of the bounding box should be unaffected. + plvpor( 0., label_vpor_xmax - label_vpor_xmin, 0., label_vpor_ymax - label_vpor_ymin ); - // Calculate the bounding box for combined label + decorated box. - draw_label( TRUE, opt, label ); + // Calculate the bounding box for combined label + decorated box. + draw_label( TRUE, opt, label ); - // Calculate overall limits. - calculate_limits( position, x, y, - xdmin_adopted, xdmax_adopted, ydmin_adopted, ydmax_adopted, - label_vpor_ymax - label_vpor_ymin, - &colorbar_width_bb, &colorbar_height_bb, - &colorbar_width_ac, &colorbar_height_ac, - &plot_x_subpage_bb, &plot_y_subpage_bb, - &dx_subpage, &dy_subpage ); + // Calculate overall limits. + calculate_limits( position, x, y, + xdmin_adopted, xdmax_adopted, ydmin_adopted, ydmax_adopted, + label_vpor_ymax - label_vpor_ymin, + &colorbar_width_bb, &colorbar_height_bb, + &colorbar_width_ac, &colorbar_height_ac, + &plot_x_subpage_bb, &plot_y_subpage_bb, + &dx_subpage, &dy_subpage ); - // Normalized subpage coordinates (top-left corner) for undecorated - // colorbar - //plot_x_subpage = plot_x_subpage_bb + dx_subpage; - //plot_y_subpage = plot_y_subpage_bb + dy_subpage; - } + // Transform normalized subpage coordinates (top-left corner) for undecorated + // colorbar to new coordinate system. + plot_x_subpage += dx_subpage; + plot_y_subpage += dy_subpage; + // Transform bounding box for decorated colorbar (without label) to + // new coordinate system. + label_vpor_xmin += dx_subpage; + label_vpor_xmax += dx_subpage; + label_vpor_ymin += dy_subpage; + label_vpor_ymax += dy_subpage; *p_colorbar_width = colorbar_width_ac; *p_colorbar_height = colorbar_height_ac; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |