本文整理汇总了C++中TileId::mapThemeIdHash方法的典型用法代码示例。如果您正苦于以下问题:C++ TileId::mapThemeIdHash方法的具体用法?C++ TileId::mapThemeIdHash怎么用?C++ TileId::mapThemeIdHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileId
的用法示例。
在下文中一共展示了TileId::mapThemeIdHash方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scaledLowerLevelTile
QImage TileLoader::scaledLowerLevelTile( const GeoSceneTextureTile * textureLayer, TileId const & id )
{
mDebug() << Q_FUNC_INFO << id;
for ( int level = qMax<int>( 0, id.zoomLevel() - 1 ); level >= 0; --level ) {
int const deltaLevel = id.zoomLevel() - level;
TileId const replacementTileId( id.mapThemeIdHash(), level,
id.x() >> deltaLevel, id.y() >> deltaLevel );
QString const fileName = tileFileName( textureLayer, replacementTileId );
mDebug() << "TileLoader::scaledLowerLevelTile" << "trying" << fileName;
QImage toScale = QFile::exists(fileName) ? QImage(fileName) : QImage();
if ( level == 0 && toScale.isNull() ) {
mDebug() << "No level zero tile installed in map theme dir. Falling back to a transparent image for now.";
QSize tileSize = textureLayer->tileSize();
Q_ASSERT( !tileSize.isEmpty() ); // assured by textureLayer
toScale = QImage( tileSize, QImage::Format_ARGB32_Premultiplied );
toScale.fill( qRgba( 0, 0, 0, 0 ) );
}
if ( !toScale.isNull() ) {
// which rect to scale?
int const restTileX = id.x() % ( 1 << deltaLevel );
int const restTileY = id.y() % ( 1 << deltaLevel );
int const partWidth = qMax(1, toScale.width() >> deltaLevel);
int const partHeight = qMax(1, toScale.height() >> deltaLevel);
int const startX = restTileX * partWidth;
int const startY = restTileY * partHeight;
mDebug() << "QImage::copy:" << startX << startY << partWidth << partHeight;
QImage const part = toScale.copy( startX, startY, partWidth, partHeight );
mDebug() << "QImage::scaled:" << toScale.size();
return part.scaled( toScale.size() );
}
}