[Marble-bugs] [marble] [Bug 314542] New: PlacemarkLayout does not handle IDL correctly
Dennis Nienhüser
earthwings at gentoo.org
Wed Feb 6 18:19:22 UTC 2013
https://bugs.kde.org/show_bug.cgi?id=314542
Bug ID: 314542
Summary: PlacemarkLayout does not handle IDL correctly
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:
"3) Again, next issue occurs when displaying two boxes handling crossing the
IDL - some placemarks may suddnely disappear from screen while the IDL is in
view. However, though special case for IDL is provided, there are still
disappearing placemarks, even with provided cities.txt / cityplacemarks.kml !
This is why another fix must be applied. Problem occurs in function
PlacemarkLayout::visibleTiles (file PlacemarkLayout.cpp)."
Proposed fix:
QSet<TileId> PlacemarkLayout::visibleTiles( const ViewportParams *viewport )
const
{
int zoomLevel = qLn( viewport->radius() *4 / 256 ) / qLn( 2.0 );
/**
* rely on m_placemarkCache to find the placemarks for the tiles which
* matter. The top level tiles have the more popular placemarks,
* the bottom level tiles have the smaller ones, and we only get the ones
* matching our latLonAltBox.
*/
QRect rect;
qreal north, south, east, west;
viewport->viewLatLonAltBox().boundaries(north, south, east, west);
QSet<TileId> tileIdSet;
///+
QVector<QRectF> frects;
///+
if( west <= east )
///+
frects << QRectF(west, north, east - west, south - north);
///+
else {
///+
frects << QRectF(west, north, M_PI - west, south - north);
///+
frects << QRectF(-M_PI, north, east + M_PI, south - north);
///+
}
///+
foreach( QRectF frect, frects ) {
///+
TileId key;
///- key = TileId::fromCoordinates( GeoDataCoordinates(west, north, 0),
zoomLevel);
key = TileId::fromCoordinates( GeoDataCoordinates(frect.left(),
///+
north, 0), zoomLevel);
///+
rect.setLeft( key.x() );
rect.setTop( key.y() );
///- key = TileId::fromCoordinates( GeoDataCoordinates(east, south, 0),
zoomLevel);
key = TileId::fromCoordinates( GeoDataCoordinates(frect.right(),
///+
south, 0), zoomLevel);
///+
rect.setRight( key.x() );
rect.setBottom( key.y() );
TileCoordsPyramid pyramid( 0, zoomLevel );
pyramid.setBottomLevelCoords( rect );
///- QSet<TileId> tileIdSet;
bool crossesDateLine = viewport->viewLatLonAltBox().crossesDateLine();
for ( int level = pyramid.topLevel(); level <= pyramid.bottomLevel();
++level ) {
QRect const coords = pyramid.coords( level );
int x1, y1, x2, y2;
coords.getCoords( &x1, &y1, &x2, &y2 );
///- if ( !crossesDateLine ) { // normal case, rect does not cross
dateline
for ( int x = x1; x <= x2; ++x ) {
for ( int y = y1; y <= y2; ++y ) {
TileId const tileId( 0, level, x, y );
tileIdSet.insert(tileId);
}
}
///- } else { // as we cross dateline, we first get west part, then
east part
///- // go till max tile
///- for ( int x = x1; x <= ((2 << (level-1))-1); ++x ) {
///- for ( int y = y1; y <= y2; ++y ) {
///- TileId const tileId( 0, level, x, y );
///- tileIdSet.insert(tileId);
///- }
///- }
///- // start from min tile
///- for ( int x = 0; x <= x2; ++x ) {
///- for ( int y = y1; y <= y2; ++y ) {
///- TileId const tileId( 0, level, x, y );
///- tileIdSet.insert(tileId);
///- }
///- }
///- }
}
}
return tileIdSet;
}
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Marble-bugs
mailing list