[PATCH] Improved text label placement in KPlotWidget

Jason Harris kstars at 30doradus.org
Tue Aug 19 15:10:12 BST 2008


Hi,

Here is an improved patch for label placement in KPlotWidget.  Now it
will start over when finding a local minimum that is not below the
maxCost threshold.  The code comments refer to "first-step paths".  By
this I just mean that we have four path choices at the beginning: up,
down, left, right.  It will try these in order of increasing cost.  If
all four paths lead to local minima that are above maxCost, then it
adopts the best of these minima (called bestBadCost in the code).

I have verified that the code is only a bit slower than the previous
patch (now 85-95 msec in the solar system tool, instead of 80-90).

Note that I haven't implemented the "start at last label position"
feature which should prevent the labels from jumping around so much.
This change may require an API addition to KPlotPoint (to retrieve the
last label position), whereas the current patch doesn't affect the API
at all.  If we are planning KDE-4.1.x releases, I'd like to apply the
current patch to the 4.1 branch as well as trunk.

thanks for any feedback,
Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kplotwidget_cpp.diff
Type: text/x-patch
Size: 16890 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080819/4ff5945d/attachment.bin>


More information about the kde-core-devel mailing list