Bug 314540 - GeoGraphicsScene does not handle IDL crossing correctly, creates two objects
Summary: GeoGraphicsScene does not handle IDL crossing correctly, creates two objects
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: 1.6 (KDE 4.11)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: marble-bugs
URL: https://forum.kde.org/viewtopic.php?f...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-06 18:18 UTC by Dennis Nienhüser
Modified: 2013-02-06 18:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Nienhüser 2013-02-06 18:18:13 UTC
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;
}
Comment 1 Dennis Nienhüser 2013-02-06 18:55:08 UTC
Git commit 23e1f6e7fbc13ad11b989f81874e3e110fe7dcef by Dennis Nienhüser.
Committed on 06/02/2013 at 19:53.
Pushed by nienhueser into branch 'master'.

Do not render objects crossing the IDL twice.

Based on a patch by artembogdanov, thanks!

M  +7    -1    src/lib/GeoGraphicsScene.cpp

http://commits.kde.org/marble/23e1f6e7fbc13ad11b989f81874e3e110fe7dcef