[Marble-bugs] [marble] [Bug 314540] New: GeoGraphicsScene does not handle IDL crossing correctly, creates two objects

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


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

            Bug ID: 314540
           Summary: GeoGraphicsScene does not handle IDL crossing
                    correctly, creates two objects
    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: normal
          Priority: NOR
         Component: general
          Assignee: marble-bugs at kde.org
          Reporter: earthwings at gentoo.org

Quoting the forum thread:

"2) When displaying two boxes handling crossing the IDL there may have
duplicate objects from left and right box - this duplicates must be erased,
otherwise they will be drawn twice. This effect can be seen on the
semitransparent objects, such as user-opened files (kml for example) with alpha
channel in fill polygon colors. Issue occurs in function
GeoGraphicsScene::items (file GeoGraphicsScene.cpp)."

Proposed fix:
QList< GeoGraphicsItem* > GeoGraphicsScene::items( const
Marble::GeoDataLatLonAltBox& box, int zoomLevel ) const
{
    if ( box.west() > box.east() ) {
        // Handle boxes crossing the IDL by splitting it into two separate
boxes
        GeoDataLatLonAltBox left;
        left.setWest( -M_PI );
        left.setEast( box.east() );
        left.setNorth( box.north() );
        left.setSouth( box.south() );

        GeoDataLatLonAltBox right;
        right.setWest( box.west() );
        right.setEast( M_PI );
        right.setNorth( box.north() );
        right.setSouth( box.south() );

///-        return items( left, zoomLevel ) + items( right, zoomLevel );
        QList<GeoGraphicsItem *> leftItems = items( left, zoomLevel );     
///+
        QList<GeoGraphicsItem *> rightItems = items( right, zoomLevel );   
///+
        for( int i = 0; i < leftItems.size(); i++ ) {                      
///+
            for( int j = 0; j < rightItems.size(); ) {                     
///+
                if( leftItems.at( i ) == rightItems.at( j ) ) {            
///+
                    rightItems.removeAt( j );                              
///+
                    continue;                                              
///+
                }                                                          
///+
                j++;                                                       
///+
            }                                                              
///+
        }                                                                  
///+
        return leftItems + rightItems;                                     
///+
    }

    <...>

    return result;
}

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


More information about the Marble-bugs mailing list