[Marble-bugs] [marble] [Bug 314539] New: ClipPainter does not handle LineEnd position

Dennis Nienhüser earthwings at gentoo.org
Wed Feb 6 18:16:58 UTC 2013


https://bugs.kde.org/show_bug.cgi?id=314539

            Bug ID: 314539
           Summary: ClipPainter does not handle LineEnd position
    Classification: Unclassified
           Product: marble
           Version: 1.6.0 (KDE 4.11.0)
          Platform: Other
               URL: https://forum.kde.org/viewtopic.php?f=217&t=109874&p=2
                    58141#p258141
                OS: Linux
            Status: CONFIRMED
          Severity: crash
          Priority: NOR
         Component: general
          Assignee: marble-bugs at kde.org
          Reporter: earthwings at gentoo.org

Quoting the forum thread:
"When drawing a polyline with a label at the end, out of bounds occurs in
function ClipPainterPrivate::labelPosition (file ClipPainter.cpp)."

Proposed fix:
void ClipPainterPrivate::labelPosition( const QPolygonF & polygon,
QVector<QPointF>& labelNodes, 
                                        LabelPositionFlags labelPositionFlags)
{
    int labelPosition = 0;

    <...>

    if ( polygon.size() > 1 && labelPositionFlags.testFlag( LineEnd ) ) {
        if ( pointAllowsLabel( polygon.at( polygon.size() - 1 ) ) ) {
            labelNodes << polygon.at( polygon.size() - 1 );
        }

///# Error occurs at first iteration
///-        // The Label at the start of the polyline:
///-        for ( int it = polygon.size() - 1; it > 1; --it ) {
///# Instead use this:
        // The Label at the end of the polyline: 
        for ( int it = polygon.size() - 2; it > 0; --it ) {
///# End of fix.
            currentAllowsLabel = pointAllowsLabel( polygon.at( it ) );

            if ( currentAllowsLabel ) {
                QPointF node = interpolateLabelPoint( polygon.at( it + 1 ),
polygon.at( it ),
                                                    labelPositionFlags );
                if ( node != QPointF( -1.0, -1.0 ) ) {
                    labelNodes << node;
                }
                break;
            }
        }
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Marble-bugs mailing list