mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-05 00:09:32 -04:00
More warning fixes
This commit is contained in:
parent
ec35dbee92
commit
2cacc6a3a7
@ -762,7 +762,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
||||
QTransform t;
|
||||
t.translate( shift.x() + offsetX, shift.y() + offsetY );
|
||||
|
||||
if ( rotation != 0 )
|
||||
if ( !qgsDoubleNear( rotation, 0.0 ) )
|
||||
t.rotate( rotation );
|
||||
|
||||
double halfWidth = symbolWidth / 2.0;
|
||||
|
@ -361,7 +361,7 @@ QgsFeatureRendererV2* QgsPointDisplacementRenderer::create( QDomElement& symbolo
|
||||
labelFont.fromString( symbologyElem.attribute( "labelFont", "" ) );
|
||||
}
|
||||
r->setLabelFont( labelFont );
|
||||
r->setPlacement(( Placement )symbologyElem.attribute( "placement", "0" ).toInt() );
|
||||
r->setPlacement( static_cast< Placement >( symbologyElem.attribute( "placement", "0" ).toInt() ) );
|
||||
r->setCircleWidth( symbologyElem.attribute( "circleWidth", "0.4" ).toDouble() );
|
||||
r->setCircleColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "circleColor", "" ) ) );
|
||||
r->setLabelColor( QgsSymbolLayerV2Utils::decodeColor( symbologyElem.attribute( "labelColor", "" ) ) );
|
||||
@ -398,7 +398,7 @@ QDomElement QgsPointDisplacementRenderer::save( QDomDocument& doc )
|
||||
rendererElement.setAttribute( "circleColor", QgsSymbolLayerV2Utils::encodeColor( mCircleColor ) );
|
||||
rendererElement.setAttribute( "labelColor", QgsSymbolLayerV2Utils::encodeColor( mLabelColor ) );
|
||||
rendererElement.setAttribute( "circleRadiusAddition", QString::number( mCircleRadiusAddition ) );
|
||||
rendererElement.setAttribute( "placement", ( int )mPlacement );
|
||||
rendererElement.setAttribute( "placement", static_cast< int >( mPlacement ) );
|
||||
rendererElement.setAttribute( "maxLabelScaleDenominator", QString::number( mMaxLabelScaleDenominator ) );
|
||||
rendererElement.setAttribute( "tolerance", QString::number( mTolerance ) );
|
||||
rendererElement.setAttribute( "toleranceUnit", QgsSymbolLayerV2Utils::encodeOutputUnit( mToleranceUnit ) );
|
||||
|
@ -315,8 +315,8 @@ bool QgsStyleV2::load( const QString& filename )
|
||||
while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
QDomDocument doc;
|
||||
QString symbol_name = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, SymbolName ) );
|
||||
QString xmlstring = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, SymbolXML ) );
|
||||
QString symbol_name = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, SymbolName ) ) );
|
||||
QString xmlstring = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, SymbolXML ) ) );
|
||||
if ( !doc.setContent( xmlstring ) )
|
||||
{
|
||||
QgsDebugMsg( "Cannot open symbol " + symbol_name );
|
||||
@ -336,8 +336,8 @@ bool QgsStyleV2::load( const QString& filename )
|
||||
while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
QDomDocument doc;
|
||||
QString ramp_name = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, ColorrampName ) );
|
||||
QString xmlstring = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, ColorrampXML ) );
|
||||
QString ramp_name = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, ColorrampName ) ) );
|
||||
QString xmlstring = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, ColorrampXML ) ) );
|
||||
if ( !doc.setContent( xmlstring ) )
|
||||
{
|
||||
QgsDebugMsg( "Cannot open symbol " + ramp_name );
|
||||
@ -469,7 +469,7 @@ QStringList QgsStyleV2::groupNames()
|
||||
int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr );
|
||||
while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
groupNames << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, SymgroupName ) );
|
||||
groupNames << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, SymgroupName ) ) );
|
||||
}
|
||||
sqlite3_finalize( ppStmt );
|
||||
return groupNames;
|
||||
@ -513,7 +513,7 @@ QgsSymbolGroupMap QgsStyleV2::childGroupNames( const QString& parent )
|
||||
nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr );
|
||||
while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
QString group = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, SymgroupName ) );
|
||||
QString group = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, SymgroupName ) ) );
|
||||
groupNames.insert( sqlite3_column_int( ppStmt, SymgroupId ), group );
|
||||
}
|
||||
|
||||
@ -551,7 +551,7 @@ QStringList QgsStyleV2::symbolsOfGroup( StyleEntity type, int groupid )
|
||||
QStringList symbols;
|
||||
while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
symbols << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
|
||||
symbols << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, 0 ) ) );
|
||||
}
|
||||
|
||||
sqlite3_finalize( ppStmt );
|
||||
@ -599,7 +599,7 @@ QStringList QgsStyleV2::symbolsWithTag( StyleEntity type, int tagid )
|
||||
int sErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt2, nullptr );
|
||||
while ( sErr == SQLITE_OK && sqlite3_step( ppStmt2 ) == SQLITE_ROW )
|
||||
{
|
||||
symbols << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt2, 0 ) );
|
||||
symbols << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt2, 0 ) ) );
|
||||
}
|
||||
sqlite3_finalize( ppStmt2 );
|
||||
}
|
||||
@ -622,7 +622,7 @@ int QgsStyleV2::addGroup( const QString& groupName, int parentid )
|
||||
|
||||
sqlite3_finalize( ppStmt );
|
||||
|
||||
return ( int )sqlite3_last_insert_rowid( mCurrentDB );
|
||||
return static_cast< int >( sqlite3_last_insert_rowid( mCurrentDB ) );
|
||||
}
|
||||
|
||||
int QgsStyleV2::addTag( const QString& tagname )
|
||||
@ -637,7 +637,7 @@ int QgsStyleV2::addTag( const QString& tagname )
|
||||
( void )sqlite3_step( ppStmt );
|
||||
sqlite3_finalize( ppStmt );
|
||||
|
||||
return ( int )sqlite3_last_insert_rowid( mCurrentDB );
|
||||
return static_cast< int >( sqlite3_last_insert_rowid( mCurrentDB ) );
|
||||
}
|
||||
|
||||
void QgsStyleV2::rename( StyleEntity type, int id, const QString& newName )
|
||||
@ -777,7 +777,7 @@ QStringList QgsStyleV2::findSymbols( StyleEntity type, const QString& qword )
|
||||
QStringList symbols;
|
||||
while ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
symbols << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
|
||||
symbols << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, 0 ) ) );
|
||||
}
|
||||
|
||||
sqlite3_finalize( ppStmt );
|
||||
@ -919,7 +919,7 @@ QStringList QgsStyleV2::tagsOfSymbol( StyleEntity type, const QString& symbol )
|
||||
int pErr = sqlite3_prepare_v2( mCurrentDB, subquery, -1, &ppStmt2, nullptr );
|
||||
if ( pErr == SQLITE_OK && sqlite3_step( ppStmt2 ) == SQLITE_ROW )
|
||||
{
|
||||
tagList << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt2, 0 ) );
|
||||
tagList << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt2, 0 ) ) );
|
||||
}
|
||||
sqlite3_finalize( ppStmt2 );
|
||||
}
|
||||
@ -1003,7 +1003,7 @@ int QgsStyleV2::addSmartgroup( const QString& name, const QString& op, const Qgs
|
||||
|
||||
if ( runEmptyQuery( query ) )
|
||||
{
|
||||
return ( int )sqlite3_last_insert_rowid( mCurrentDB );
|
||||
return static_cast< int >( sqlite3_last_insert_rowid( mCurrentDB ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1029,7 +1029,7 @@ QgsSymbolGroupMap QgsStyleV2::smartgroupsListMap()
|
||||
QgsSymbolGroupMap groupNames;
|
||||
while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
QString group = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, SmartgroupName ) );
|
||||
QString group = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, SmartgroupName ) ) );
|
||||
groupNames.insert( sqlite3_column_int( ppStmt, SmartgroupId ), group );
|
||||
}
|
||||
|
||||
@ -1055,7 +1055,7 @@ QStringList QgsStyleV2::smartgroupNames()
|
||||
QStringList groups;
|
||||
while ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
groups << QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
|
||||
groups << QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, 0 ) ) );
|
||||
}
|
||||
|
||||
sqlite3_finalize( ppStmt );
|
||||
@ -1079,7 +1079,7 @@ QStringList QgsStyleV2::symbolsOfSmartgroup( StyleEntity type, int id )
|
||||
else
|
||||
{
|
||||
QDomDocument doc;
|
||||
QString xmlstr = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
|
||||
QString xmlstr = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, 0 ) ) );
|
||||
if ( !doc.setContent( xmlstr ) )
|
||||
{
|
||||
QgsDebugMsg( QString( "Cannot open smartgroup id: %1" ).arg( id ) );
|
||||
@ -1194,7 +1194,7 @@ QgsSmartConditionMap QgsStyleV2::smartgroup( int id )
|
||||
if ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
QDomDocument doc;
|
||||
QString xmlstr = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
|
||||
QString xmlstr = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, 0 ) ) );
|
||||
if ( !doc.setContent( xmlstr ) )
|
||||
{
|
||||
QgsDebugMsg( QString( "Cannot open smartgroup id: %1" ).arg( id ) );
|
||||
@ -1236,7 +1236,7 @@ QString QgsStyleV2::smartgroupOperator( int id )
|
||||
if ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
|
||||
{
|
||||
QDomDocument doc;
|
||||
QString xmlstr = QString::fromUtf8(( const char * ) sqlite3_column_text( ppStmt, 0 ) );
|
||||
QString xmlstr = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, 0 ) ) );
|
||||
if ( !doc.setContent( xmlstr ) )
|
||||
{
|
||||
QgsDebugMsg( QString( "Cannot open smartgroup id: %1" ).arg( id ) );
|
||||
|
@ -76,8 +76,8 @@ QgsSvgCacheEntry::~QgsSvgCacheEntry()
|
||||
|
||||
bool QgsSvgCacheEntry::operator==( const QgsSvgCacheEntry& other ) const
|
||||
{
|
||||
return other.file == file && other.size == size && other.outlineWidth == outlineWidth && other.widthScaleFactor == widthScaleFactor
|
||||
&& other.rasterScaleFactor == rasterScaleFactor && other.fill == fill && other.outline == outline;
|
||||
return other.file == file && qgsDoubleNear( other.size, size ) && qgsDoubleNear( other.outlineWidth, outlineWidth ) && qgsDoubleNear( other.widthScaleFactor, widthScaleFactor )
|
||||
&& qgsDoubleNear( other.rasterScaleFactor, rasterScaleFactor ) && other.fill == fill && other.outline == outline;
|
||||
}
|
||||
|
||||
int QgsSvgCacheEntry::dataSize() const
|
||||
@ -136,7 +136,7 @@ const QImage& QgsSvgCache::svgAsImage( const QString& file, double size, const Q
|
||||
}
|
||||
long cachedDataSize = 0;
|
||||
cachedDataSize += currentEntry->svgContent.size();
|
||||
cachedDataSize += ( int )( currentEntry->size * currentEntry->size * hwRatio * 32 );
|
||||
cachedDataSize += static_cast< int >( currentEntry->size * currentEntry->size * hwRatio * 32 );
|
||||
if ( cachedDataSize > mMaximumSize / 2 )
|
||||
{
|
||||
fitsInCache = false;
|
||||
@ -337,7 +337,7 @@ double QgsSvgCache::calcSizeScaleFactor( QgsSvgCacheEntry* entry, const QDomElem
|
||||
QString viewBox;
|
||||
|
||||
//bad size
|
||||
if ( !entry || entry->size == 0 )
|
||||
if ( !entry || qgsDoubleNear( entry->size, 0.0 ) )
|
||||
return 1.0;
|
||||
|
||||
//find svg viewbox attribute
|
||||
@ -511,13 +511,13 @@ void QgsSvgCache::cacheImage( QgsSvgCacheEntry* entry )
|
||||
hwRatio = r.viewBoxF().height() / r.viewBoxF().width();
|
||||
}
|
||||
double wSize = entry->size;
|
||||
int wImgSize = ( int )wSize;
|
||||
int wImgSize = static_cast< int >( wSize );
|
||||
if ( wImgSize < 1 )
|
||||
{
|
||||
wImgSize = 1;
|
||||
}
|
||||
double hSize = wSize * hwRatio;
|
||||
int hImgSize = ( int )hSize;
|
||||
int hImgSize = static_cast< int >( hSize );
|
||||
if ( hImgSize < 1 )
|
||||
{
|
||||
hImgSize = 1;
|
||||
@ -527,7 +527,7 @@ void QgsSvgCache::cacheImage( QgsSvgCacheEntry* entry )
|
||||
image->fill( 0 ); // transparent background
|
||||
|
||||
QPainter p( image );
|
||||
if ( r.viewBoxF().width() == r.viewBoxF().height() )
|
||||
if ( qgsDoubleNear( r.viewBoxF().width(), r.viewBoxF().height() ) )
|
||||
{
|
||||
r.render( &p );
|
||||
}
|
||||
@ -588,7 +588,8 @@ QgsSvgCacheEntry* QgsSvgCache::cacheEntry( const QString& file, double size, con
|
||||
{
|
||||
QgsSvgCacheEntry* cacheEntry = *entryIt;
|
||||
if ( qgsDoubleNear( cacheEntry->size, size ) && cacheEntry->fill == fill && cacheEntry->outline == outline &&
|
||||
cacheEntry->outlineWidth == outlineWidth && cacheEntry->widthScaleFactor == widthScaleFactor && cacheEntry->rasterScaleFactor == rasterScaleFactor )
|
||||
qgsDoubleNear( cacheEntry->outlineWidth, outlineWidth ) && qgsDoubleNear( cacheEntry->widthScaleFactor, widthScaleFactor )
|
||||
&& qgsDoubleNear( cacheEntry->rasterScaleFactor, rasterScaleFactor ) )
|
||||
{
|
||||
currentEntry = cacheEntry;
|
||||
break;
|
||||
|
@ -93,15 +93,15 @@ QgsSymbolLayerV2* QgsVectorFieldSymbolLayer::create( const QgsStringMap& propert
|
||||
}
|
||||
if ( properties.contains( "vector_field_type" ) )
|
||||
{
|
||||
symbolLayer->setVectorFieldType(( VectorFieldType )( properties["vector_field_type"].toInt() ) );
|
||||
symbolLayer->setVectorFieldType( static_cast< VectorFieldType >( properties["vector_field_type"].toInt() ) );
|
||||
}
|
||||
if ( properties.contains( "angle_orientation" ) )
|
||||
{
|
||||
symbolLayer->setAngleOrientation(( AngleOrientation )( properties["angle_orientation"].toInt() ) );
|
||||
symbolLayer->setAngleOrientation( static_cast< AngleOrientation >( properties["angle_orientation"].toInt() ) );
|
||||
}
|
||||
if ( properties.contains( "angle_units" ) )
|
||||
{
|
||||
symbolLayer->setAngleUnits(( AngleUnits )( properties["angle_units"].toInt() ) );
|
||||
symbolLayer->setAngleUnits( static_cast< AngleUnits >( properties["angle_units"].toInt() ) );
|
||||
}
|
||||
if ( properties.contains( "size" ) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user