Git commit dafcb858b6106da336ace0b1a961e58efc838f3b by Bernhard Beschow. Committed on 31/12/2012 at 13:44. Pushed by beschow into branch 'master'. compile with MSVC8 The error was: error C2668: 'pow' : ambiguous call to overloaded function C:\Programme\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(575): co= uld be 'long double pow(long double,int)' C:\Programme\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(527): or= 'float pow(float,int)' C:\Programme\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(489): or= 'double pow(double,int)' while trying to match the argument list '(int, int)' M +16 -18 src/lib/VectorTileMapper.cpp http://commits.kde.org/marble/dafcb858b6106da336ace0b1a961e58efc838f3b diff --git a/src/lib/VectorTileMapper.cpp b/src/lib/VectorTileMapper.cpp index c9c8a73..fd7d282 100644 --- a/src/lib/VectorTileMapper.cpp +++ b/src/lib/VectorTileMapper.cpp @@ -10,8 +10,6 @@ = #include "VectorTileMapper.h" = -#include - #include = #include "MarbleGlobal.h" @@ -60,21 +58,21 @@ void VectorTileMapper::mapTexture( GeoPainter *painter, // More info: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#= Subtiles // More info: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#= C.2FC.2B.2B // Sometimes the formula returns wrong huge values, x and y have to be= between 0 and 2^ZoomLevel - unsigned int minX =3D qMin( (unsigned int) pow( 2, tileZoomLevel() ), - qMax( (unsigned int) lon2tilex( viewport->vi= ewLatLonAltBox().west(GeoDataCoordinates::Degree), tileZoomLevel() ), - (unsigned int) 0) ); + unsigned int minX =3D qMin( 2 << tileZoomLevel(), + qMax( lon2tilex( viewport->vie= wLatLonAltBox().west(GeoDataCoordinates::Degree), tileZoomLevel() ), + 0 ) ); = - unsigned int minY =3D qMin( (unsigned int) pow( 2, tileZoomLevel() ), - qMax( (unsigned int) lat2tiley( viewport->vi= ewLatLonAltBox().north(GeoDataCoordinates::Degree), tileZoomLevel() ), - (unsigned int) 0) ); + unsigned int minY =3D qMin( 2 << tileZoomLevel(), + qMax( lat2tiley( viewport->vie= wLatLonAltBox().north(GeoDataCoordinates::Degree), tileZoomLevel() ), + 0 ) ); = - unsigned int maxX =3D qMax( (unsigned int) 0, - qMin( (unsigned int) lon2tilex( viewport->vi= ewLatLonAltBox().east(GeoDataCoordinates::Degree), tileZoomLevel() ), - (unsigned int) pow( 2, tileZoomLevel()= )) ); + unsigned int maxX =3D qMax( 0, + qMin( lon2tilex( viewport->vie= wLatLonAltBox().east(GeoDataCoordinates::Degree), tileZoomLevel() ), + 2 << tileZoomLevel() ) ); = - unsigned int maxY =3D qMax( (unsigned int) 0, - qMin( (unsigned int) lat2tiley( viewport->vi= ewLatLonAltBox().south(GeoDataCoordinates::Degree), tileZoomLevel() ), - (unsigned int) pow( 2, tileZoomLevel()= )) ); + unsigned int maxY =3D qMax( 0, + qMin( lat2tiley( viewport->vie= wLatLonAltBox().south(GeoDataCoordinates::Degree), tileZoomLevel() ), + 2 << tileZoomLevel() ) ); = bool left =3D minX < m_minTileX; bool right =3D maxX > m_maxTileX; @@ -119,8 +117,8 @@ void VectorTileMapper::initTileRangeCoords(){ = // Set tile X and Y to the biggest possible values, but inverted so the // left/up/right/down variables can be calculated - m_minTileX =3D pow( 2, tileZoomLevel() ); - m_minTileY =3D pow( 2, tileZoomLevel() ); + m_minTileX =3D 2 << tileZoomLevel(); + m_minTileY =3D 2 << tileZoomLevel(); m_maxTileX =3D 0; m_maxTileY =3D 0; } @@ -160,12 +158,12 @@ void VectorTileMapper::updateTile(TileId const & tile= Id, GeoDataDocument * docum = unsigned int VectorTileMapper::lon2tilex(double lon, int z) { - return (unsigned int)(floor((lon + 180.0) / 360.0 * pow(2.0, z))); + return (unsigned int)(floor((lon + 180.0) / 360.0 * (2 << z))); } = unsigned int VectorTileMapper::lat2tiley(double lat, int z) { - return (unsigned int)(floor((1.0 - log( tan(lat * M_PI/180.0) + 1.0 / = cos(lat * M_PI/180.0)) / M_PI) / 2.0 * pow(2.0, z))); + return (unsigned int)(floor((1.0 - log( tan(lat * M_PI/180.0) + 1.0 / = cos(lat * M_PI/180.0)) / M_PI) / 2.0 * (2 << z))); } = VectorTileMapper::RenderJob::RenderJob( StackedTileLoader *tileLoader, int= tileLevel, const ViewportParams *viewport,