[Marble-commits] KDE/kdeedu/marble/src/lib
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Wed Jan 19 18:11:57 CET 2011
SVN commit 1215795 by beschow:
forward-port r1215778: don't crash in equirectangular projection when the map doesn't cover the whole view
M +8 -8 AbstractScanlineTextureMapper.cpp
M +8 -8 AbstractScanlineTextureMapper.h
M +0 -2 EquirectScanlineTextureMapper.cpp
M +0 -2 MercatorScanlineTextureMapper.cpp
M +0 -2 SphericalScanlineTextureMapper.cpp
M +0 -2 TileScalingTextureMapper.cpp
--- trunk/KDE/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.cpp #1215794:1215795
@@ -29,8 +29,6 @@
m_maxGlobalY( 0 ),
m_prevLat( 0.0 ),
m_prevLon( 0.0 ),
- m_toTileCoordinatesLon( 0.0 ),
- m_toTileCoordinatesLat( 0.0 ),
m_interlaced( false ),
m_tileLoader( tileLoader ),
m_tilePosX( 0 ),
@@ -39,6 +37,8 @@
m_tileSize( tileLoader->tileSize() ), // cache tile size
m_tile( 0 ),
m_previousRadius( 0 ),
+ m_toTileCoordinatesLon( 0.0 ),
+ m_toTileCoordinatesLat( 0.0 ),
m_tileLevel( 0 ),
m_globalWidth( 0 ),
m_globalHeight( 0 ),
@@ -91,8 +91,8 @@
// the center to the upper left corner and subtract the tile position
// in that coordinate system. In total this equals a coordinate
// transformation to tile coordinates.
- m_toTileCoordinatesLon = (qreal)(m_globalWidth / 2 - m_tilePosX);
- m_toTileCoordinatesLat = (qreal)(m_globalHeight / 2 - m_tilePosY);
+ m_toTileCoordinatesLon = (qreal)(0.5 * m_globalWidth - m_tilePosX);
+ m_toTileCoordinatesLat = (qreal)(0.5 * m_globalHeight - m_tilePosY);
if ( changedTileLevel ) {
m_tileLoader->flush();
@@ -501,11 +501,11 @@
// ( origin upper left, measured in pixels )
m_tilePosX = tileCol * m_tileSize.width();
- m_toTileCoordinatesLon = (qreal)(m_globalWidth / 2 - m_tilePosX);
+ m_toTileCoordinatesLon = (qreal)(0.5 * m_globalWidth - m_tilePosX);
posX = lon - m_tilePosX;
m_tilePosY = tileRow * m_tileSize.height();
- m_toTileCoordinatesLat = (qreal)(m_globalHeight / 2 - m_tilePosY);
+ m_toTileCoordinatesLat = (qreal)(0.5 * m_globalHeight - m_tilePosY);
posY = lat - m_tilePosY;
}
@@ -541,11 +541,11 @@
// ( origin upper left, measured in pixels )
m_tilePosX = tileCol * m_tileSize.width();
- m_toTileCoordinatesLon = (qreal)(m_globalWidth / 2 - m_tilePosX);
+ m_toTileCoordinatesLon = (qreal)(0.5 * m_globalWidth - m_tilePosX);
posX = lon - m_tilePosX;
m_tilePosY = tileRow * m_tileSize.height();
- m_toTileCoordinatesLat = (qreal)(m_globalHeight / 2 - m_tilePosY);
+ m_toTileCoordinatesLat = (qreal)(0.5 * m_globalHeight - m_tilePosY);
posY = lat - m_tilePosY;
}
--- trunk/KDE/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.h #1215794:1215795
@@ -105,14 +105,6 @@
qreal m_prevLat;
qreal m_prevLon;
- // Coordinate transformations:
-
- // Converts global texture coordinates
- // ( with origin in center, measured in pixel)
- // to tile coordinates ( measured in pixel )
- qreal m_toTileCoordinatesLon;
- qreal m_toTileCoordinatesLat;
-
bool m_interlaced;
StackedTileLoader *m_tileLoader;
@@ -131,6 +123,14 @@
StackedTile *m_tile;
int m_previousRadius;
+ // Coordinate transformations:
+
+ // Converts global texture coordinates
+ // ( with origin in center, measured in pixel)
+ // to tile coordinates ( measured in pixel )
+ qreal m_toTileCoordinatesLon;
+ qreal m_toTileCoordinatesLat;
+
int m_tileLevel;
int m_globalWidth;
int m_globalHeight;
--- trunk/KDE/kdeedu/marble/src/lib/EquirectScanlineTextureMapper.cpp #1215794:1215795
@@ -81,8 +81,6 @@
m_tilePosX = 65535;
m_tilePosY = 65535;
- m_toTileCoordinatesLon = (qreal)(globalWidth() / 2 - m_tilePosX);
- m_toTileCoordinatesLat = (qreal)(globalHeight() / 2 - m_tilePosY);
// Calculate how many degrees are being represented per pixel.
const float rad2Pixel = (float)( 2 * radius ) / M_PI;
--- trunk/KDE/kdeedu/marble/src/lib/MercatorScanlineTextureMapper.cpp #1215794:1215795
@@ -85,8 +85,6 @@
m_tilePosX = 65535;
m_tilePosY = 65535;
- m_toTileCoordinatesLon = (qreal)(globalWidth() / 2 - m_tilePosX);
- m_toTileCoordinatesLat = (qreal)(globalHeight() / 2 - m_tilePosY);
// Calculate how many degrees are being represented per pixel.
const float rad2Pixel = (float)( 2 * radius ) / M_PI;
--- trunk/KDE/kdeedu/marble/src/lib/SphericalScanlineTextureMapper.cpp #1215794:1215795
@@ -87,8 +87,6 @@
m_tilePosX = 65535;
m_tilePosY = 65535;
- m_toTileCoordinatesLon = (qreal)(globalWidth() / 2 - m_tilePosX);
- m_toTileCoordinatesLat = (qreal)(globalHeight() / 2 - m_tilePosY);
// Reset backend
m_tileLoader->resetTilehash();
--- trunk/KDE/kdeedu/marble/src/lib/TileScalingTextureMapper.cpp #1215794:1215795
@@ -83,8 +83,6 @@
m_tilePosX = 65535;
m_tilePosY = 65535;
- m_toTileCoordinatesLon = (qreal)(globalWidth() / 2 - m_tilePosX);
- m_toTileCoordinatesLat = (qreal)(globalHeight() / 2 - m_tilePosY);
// Reset backend
m_tileLoader->resetTilehash();
More information about the Marble-commits
mailing list