mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Fix more warnings when building under clang with -wEverything
This commit is contained in:
parent
144ca8da2e
commit
2eb95f081f
@ -120,5 +120,5 @@ for f in sorted(glob.glob('resources/function_help/text/*')):
|
||||
cpp.write("\n\n gFunctionHelpTexts.insert( \"{0}\",\n Help( tr( \"{0}\" ), tr( \"group\" ), tr( \"{1}\" ), QList<HelpVariant>() ) );\n".format(
|
||||
n, content.read().replace("\\", "\").replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n')))
|
||||
|
||||
cpp.write("\n}")
|
||||
cpp.write("\n}\n")
|
||||
cpp.close()
|
||||
|
@ -2564,7 +2564,7 @@ void QgisApp::createOverview()
|
||||
|
||||
int action = mySettings.value( "/qgis/wheel_action", 2 ).toInt();
|
||||
double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble();
|
||||
mMapCanvas->setWheelAction(( QgsMapCanvas::WheelAction ) action, zoomFactor );
|
||||
mMapCanvas->setWheelAction( static_cast< QgsMapCanvas::WheelAction >( action ), zoomFactor );
|
||||
|
||||
mMapCanvas->setCachingEnabled( mySettings.value( "/qgis/enable_render_caching", true ).toBool() );
|
||||
|
||||
@ -3015,13 +3015,13 @@ void QgisApp::restoreWindowState()
|
||||
// restore the toolbar and dock widgets positions using Qt4 settings API
|
||||
QSettings settings;
|
||||
|
||||
if ( !restoreState( settings.value( "/UI/state", QByteArray::fromRawData(( char * )defaultUIstate, sizeof defaultUIstate ) ).toByteArray() ) )
|
||||
if ( !restoreState( settings.value( "/UI/state", QByteArray::fromRawData( reinterpret_cast< const char * >( defaultUIstate ), sizeof defaultUIstate ) ).toByteArray() ) )
|
||||
{
|
||||
QgsDebugMsg( "restore of UI state failed" );
|
||||
}
|
||||
|
||||
// restore window geometry
|
||||
if ( !restoreGeometry( settings.value( "/UI/geometry", QByteArray::fromRawData(( char * )defaultUIgeometry, sizeof defaultUIgeometry ) ).toByteArray() ) )
|
||||
if ( !restoreGeometry( settings.value( "/UI/geometry", QByteArray::fromRawData( reinterpret_cast< const char * >( defaultUIgeometry ), sizeof defaultUIgeometry ) ).toByteArray() ) )
|
||||
{
|
||||
QgsDebugMsg( "restore of UI geometry failed" );
|
||||
}
|
||||
@ -3970,7 +3970,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
|
||||
// write the projections _proj string_ to project settings
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", srs.toProj4() );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", srs.authid() );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", ( int ) srs.srsid() );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", static_cast< int >( srs.srsid() ) );
|
||||
prj->dirty( false );
|
||||
if ( srs.mapUnits() != QGis::UnknownUnit )
|
||||
{
|
||||
@ -5621,7 +5621,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt
|
||||
datasourceOptions, dialog->layerOptions(),
|
||||
dialog->skipAttributeCreation(),
|
||||
&newFilename,
|
||||
( QgsVectorFileWriter::SymbologyExport )( dialog->symbologyExport() ),
|
||||
static_cast< QgsVectorFileWriter::SymbologyExport >( dialog->symbologyExport() ),
|
||||
dialog->scaleDenominator(),
|
||||
dialog->hasFilterExtent() ? &filterExtent : nullptr,
|
||||
autoGeometryType ? QgsWKBTypes::Unknown : forcedGeometryType,
|
||||
@ -7949,7 +7949,7 @@ void QgisApp::loadPythonSupport()
|
||||
|
||||
//QgsDebugMsg("Python support library loaded successfully.");
|
||||
typedef QgsPythonUtils*( *inst )();
|
||||
inst pythonlib_inst = ( inst ) cast_to_fptr( pythonlib.resolve( "instance" ) );
|
||||
inst pythonlib_inst = reinterpret_cast< inst >( cast_to_fptr( pythonlib.resolve( "instance" ) ) );
|
||||
if ( !pythonlib_inst )
|
||||
{
|
||||
//using stderr on purpose because we want end users to see this [TS]
|
||||
@ -8063,7 +8063,7 @@ void QgisApp::showOptionsDialog( QWidget *parent, const QString& currentPage )
|
||||
|
||||
int action = mySettings.value( "/qgis/wheel_action", 2 ).toInt();
|
||||
double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble();
|
||||
mMapCanvas->setWheelAction(( QgsMapCanvas::WheelAction ) action, zoomFactor );
|
||||
mMapCanvas->setWheelAction( static_cast< QgsMapCanvas::WheelAction >( action ), zoomFactor );
|
||||
|
||||
mMapCanvas->setCachingEnabled( mySettings.value( "/qgis/enable_render_caching", true ).toBool() );
|
||||
|
||||
@ -10432,7 +10432,7 @@ void QgisApp::writeProject( QDomDocument &doc )
|
||||
delete clonedRoot;
|
||||
doc.firstChildElement( "qgis" ).appendChild( oldLegendElem );
|
||||
|
||||
QgsProject::instance()->writeEntry( "Legend", "filterByMap", ( bool ) layerTreeView()->layerTreeModel()->legendFilterMapSettings() );
|
||||
QgsProject::instance()->writeEntry( "Legend", "filterByMap", static_cast< bool >( layerTreeView()->layerTreeModel()->legendFilterMapSettings() ) );
|
||||
|
||||
projectChanged( doc );
|
||||
}
|
||||
@ -10801,8 +10801,8 @@ void QgisApp::authMessageOut( const QString& message, const QString& authtag, Qg
|
||||
if ( qApp->activeWindow() != this )
|
||||
return;
|
||||
|
||||
int levelint = ( int )level;
|
||||
messageBar()->pushMessage( authtag, message, ( QgsMessageBar::MessageLevel )levelint, 7 );
|
||||
int levelint = static_cast< int >( level );
|
||||
messageBar()->pushMessage( authtag, message, static_cast< QgsMessageBar::MessageLevel >( levelint ), 7 );
|
||||
}
|
||||
|
||||
void QgisApp::completeInitialization()
|
||||
|
@ -270,7 +270,7 @@ bool QgsComposerTable::tableWriteXML( QDomElement& elem, QDomDocument & doc ) co
|
||||
elem.setAttribute( "lineTextDist", QString::number( mLineTextDistance ) );
|
||||
elem.appendChild( QgsFontUtils::toXmlElement( mHeaderFont, doc, "headerFontProperties" ) );
|
||||
elem.setAttribute( "headerFontColor", QgsSymbolLayerV2Utils::encodeColor( mHeaderFontColor ) );
|
||||
elem.setAttribute( "headerHAlignment", QString::number(( int )mHeaderHAlignment ) );
|
||||
elem.setAttribute( "headerHAlignment", QString::number( static_cast< int >( mHeaderHAlignment ) ) );
|
||||
elem.appendChild( QgsFontUtils::toXmlElement( mContentFont, doc, "contentFontProperties" ) );
|
||||
elem.setAttribute( "contentFontColor", QgsSymbolLayerV2Utils::encodeColor( mContentFontColor ) );
|
||||
elem.setAttribute( "gridStrokeWidth", QString::number( mGridStrokeWidth ) );
|
||||
|
@ -109,20 +109,20 @@ QgsComposerTableV2::~QgsComposerTableV2()
|
||||
bool QgsComposerTableV2::writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames ) const
|
||||
{
|
||||
elem.setAttribute( "cellMargin", QString::number( mCellMargin ) );
|
||||
elem.setAttribute( "emptyTableMode", QString::number(( int )mEmptyTableMode ) );
|
||||
elem.setAttribute( "emptyTableMode", QString::number( static_cast< int >( mEmptyTableMode ) ) );
|
||||
elem.setAttribute( "emptyTableMessage", mEmptyTableMessage );
|
||||
elem.setAttribute( "showEmptyRows", mShowEmptyRows );
|
||||
elem.appendChild( QgsFontUtils::toXmlElement( mHeaderFont, doc, "headerFontProperties" ) );
|
||||
elem.setAttribute( "headerFontColor", QgsSymbolLayerV2Utils::encodeColor( mHeaderFontColor ) );
|
||||
elem.setAttribute( "headerHAlignment", QString::number(( int )mHeaderHAlignment ) );
|
||||
elem.setAttribute( "headerMode", QString::number(( int )mHeaderMode ) );
|
||||
elem.setAttribute( "headerHAlignment", QString::number( static_cast< int >( mHeaderHAlignment ) ) );
|
||||
elem.setAttribute( "headerMode", QString::number( static_cast< int >( mHeaderMode ) ) );
|
||||
elem.appendChild( QgsFontUtils::toXmlElement( mContentFont, doc, "contentFontProperties" ) );
|
||||
elem.setAttribute( "contentFontColor", QgsSymbolLayerV2Utils::encodeColor( mContentFontColor ) );
|
||||
elem.setAttribute( "gridStrokeWidth", QString::number( mGridStrokeWidth ) );
|
||||
elem.setAttribute( "gridColor", QgsSymbolLayerV2Utils::encodeColor( mGridColor ) );
|
||||
elem.setAttribute( "showGrid", mShowGrid );
|
||||
elem.setAttribute( "backgroundColor", QgsSymbolLayerV2Utils::encodeColor( mBackgroundColor ) );
|
||||
elem.setAttribute( "wrapBehaviour", QString::number(( int )mWrapBehaviour ) );
|
||||
elem.setAttribute( "wrapBehaviour", QString::number( static_cast< int >( mWrapBehaviour ) ) );
|
||||
|
||||
//columns
|
||||
QDomElement displayColumnsElem = doc.createElement( "displayColumns" );
|
||||
@ -435,7 +435,7 @@ void QgsComposerTableV2::render( QPainter *p, const QRectF &, const int frameInd
|
||||
|
||||
currentX += mCellMargin;
|
||||
|
||||
Qt::TextFlag textFlag = ( Qt::TextFlag )0;
|
||||
Qt::TextFlag textFlag = static_cast< Qt::TextFlag >( 0 );
|
||||
if (( *columnIt )->width() <= 0 )
|
||||
{
|
||||
//automatic column width, so we use the Qt::TextDontClip flag when drawing contents, as this works nicer for italicised text
|
||||
@ -506,7 +506,7 @@ void QgsComposerTableV2::render( QPainter *p, const QRectF &, const int frameInd
|
||||
QVariant cellContents = mTableContents.at( row ).at( col );
|
||||
QString str = cellContents.toString();
|
||||
|
||||
Qt::TextFlag textFlag = ( Qt::TextFlag )0;
|
||||
Qt::TextFlag textFlag = static_cast< Qt::TextFlag >( 0 );
|
||||
if (( *columnIt )->width() <= 0 && mWrapBehaviour == TruncateText )
|
||||
{
|
||||
//automatic column width, so we use the Qt::TextDontClip flag when drawing contents, as this works nicer for italicised text
|
||||
@ -587,7 +587,7 @@ void QgsComposerTableV2::render( QPainter *p, const QRectF &, const int frameInd
|
||||
double messageX = gridSize + mCellMargin;
|
||||
double messageY = gridSize + ( drawHeader ? cellHeaderHeight + gridSize : 0 );
|
||||
cell = QRectF( messageX, messageY, mTableSize.width() - messageX, cellBodyHeight );
|
||||
QgsComposerUtils::drawText( p, cell, mEmptyTableMessage, mContentFont, mContentFontColor, Qt::AlignHCenter, Qt::AlignVCenter, ( Qt::TextFlag )0 );
|
||||
QgsComposerUtils::drawText( p, cell, mEmptyTableMessage, mContentFont, mContentFontColor, Qt::AlignHCenter, Qt::AlignVCenter, static_cast< Qt::TextFlag >( 0 ) );
|
||||
}
|
||||
|
||||
p->restore();
|
||||
@ -596,7 +596,7 @@ void QgsComposerTableV2::render( QPainter *p, const QRectF &, const int frameInd
|
||||
|
||||
void QgsComposerTableV2::setCellMargin( const double margin )
|
||||
{
|
||||
if ( margin == mCellMargin )
|
||||
if ( qgsDoubleNear( margin, mCellMargin ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -747,7 +747,7 @@ void QgsComposerTableV2::setShowGrid( const bool showGrid )
|
||||
|
||||
void QgsComposerTableV2::setGridStrokeWidth( const double width )
|
||||
{
|
||||
if ( width == mGridStrokeWidth )
|
||||
if ( qgsDoubleNear( width, mGridStrokeWidth ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1163,7 +1163,7 @@ void QgsComposerTableV2::drawVerticalGridLines( QPainter *painter, const QMap<in
|
||||
|
||||
bool QgsComposerTableV2::textRequiresWrapping( const QString& text, double columnWidth, const QFont &font ) const
|
||||
{
|
||||
if ( columnWidth == 0 || mWrapBehaviour != WrapText )
|
||||
if ( qgsDoubleNear( columnWidth, 0.0 ) || mWrapBehaviour != WrapText )
|
||||
return false;
|
||||
|
||||
QStringList multiLineSplit = text.split( '\n' );
|
||||
|
@ -681,7 +681,7 @@ void QgsProjectFileTransform::convertRasterProperties( QDomDocument& doc, QDomNo
|
||||
QDomElement colorRampEntryElem = colorRampEntryList.at( i ).toElement();
|
||||
QString strValue = colorRampEntryElem.attribute( "value" );
|
||||
double value = strValue.toDouble();
|
||||
if ( value < 0 || value > 10000 || value != static_cast< int >( value ) )
|
||||
if ( value < 0 || value > 10000 || !qgsDoubleNear( value, static_cast< int >( value ) ) )
|
||||
{
|
||||
QgsDebugMsg( QString( "forcing SingleBandPseudoColor value = %1" ).arg( value ) );
|
||||
drawingStyle = "SingleBandPseudoColor";
|
||||
|
@ -80,7 +80,7 @@ void QgsProviderRegistry::init()
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(__CYGWIN__)
|
||||
mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
|
||||
#elif ANDROID
|
||||
#elif defined(ANDROID)
|
||||
mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );
|
||||
#else
|
||||
mLibraryDirectory.setNameFilters( QStringList( "*.so" ) );
|
||||
@ -131,7 +131,7 @@ void QgsProviderRegistry::init()
|
||||
|
||||
//MH: Added a further test to detect non-provider plugins linked to provider plugins.
|
||||
//Only pure provider plugins have 'type' not defined
|
||||
isprovider_t *hasType = ( isprovider_t * ) cast_to_fptr( myLib.resolve( "type" ) );
|
||||
isprovider_t *hasType = reinterpret_cast< isprovider_t * >( cast_to_fptr( myLib.resolve( "type" ) ) );
|
||||
if ( hasType )
|
||||
{
|
||||
QgsDebugMsg( QString( "Checking %1: ...invalid (has type method)" ).arg( myLib.fileName() ) );
|
||||
@ -139,7 +139,7 @@ void QgsProviderRegistry::init()
|
||||
}
|
||||
|
||||
// get the description and the key for the provider plugin
|
||||
isprovider_t *isProvider = ( isprovider_t * ) cast_to_fptr( myLib.resolve( "isProvider" ) );
|
||||
isprovider_t *isProvider = reinterpret_cast< isprovider_t * >( cast_to_fptr( myLib.resolve( "isProvider" ) ) );
|
||||
if ( !isProvider )
|
||||
{
|
||||
QgsDebugMsg( QString( "Checking %1: ...invalid (no isProvider method)" ).arg( myLib.fileName() ) );
|
||||
@ -154,14 +154,14 @@ void QgsProviderRegistry::init()
|
||||
}
|
||||
|
||||
// looks like a provider. get the key and description
|
||||
description_t *pDesc = ( description_t * ) cast_to_fptr( myLib.resolve( "description" ) );
|
||||
description_t *pDesc = reinterpret_cast< description_t * >( cast_to_fptr( myLib.resolve( "description" ) ) );
|
||||
if ( !pDesc )
|
||||
{
|
||||
QgsDebugMsg( QString( "Checking %1: ...invalid (no description method)" ).arg( myLib.fileName() ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
providerkey_t *pKey = ( providerkey_t * ) cast_to_fptr( myLib.resolve( "providerKey" ) );
|
||||
providerkey_t *pKey = reinterpret_cast< providerkey_t * >( cast_to_fptr( myLib.resolve( "providerKey" ) ) );
|
||||
if ( !pKey )
|
||||
{
|
||||
QgsDebugMsg( QString( "Checking %1: ...invalid (no providerKey method)" ).arg( myLib.fileName() ) );
|
||||
@ -172,28 +172,28 @@ void QgsProviderRegistry::init()
|
||||
mProviders[pKey()] = new QgsProviderMetadata( pKey(), pDesc(), myLib.fileName() );
|
||||
|
||||
// load database drivers
|
||||
databaseDrivers_t *pDatabaseDrivers = ( databaseDrivers_t * ) cast_to_fptr( myLib.resolve( "databaseDrivers" ) );
|
||||
databaseDrivers_t *pDatabaseDrivers = reinterpret_cast< databaseDrivers_t * >( cast_to_fptr( myLib.resolve( "databaseDrivers" ) ) );
|
||||
if ( pDatabaseDrivers )
|
||||
{
|
||||
mDatabaseDrivers = pDatabaseDrivers();
|
||||
}
|
||||
|
||||
// load directory drivers
|
||||
directoryDrivers_t *pDirectoryDrivers = ( directoryDrivers_t * ) cast_to_fptr( myLib.resolve( "directoryDrivers" ) );
|
||||
directoryDrivers_t *pDirectoryDrivers = reinterpret_cast< directoryDrivers_t * >( cast_to_fptr( myLib.resolve( "directoryDrivers" ) ) );
|
||||
if ( pDirectoryDrivers )
|
||||
{
|
||||
mDirectoryDrivers = pDirectoryDrivers();
|
||||
}
|
||||
|
||||
// load protocol drivers
|
||||
protocolDrivers_t *pProtocolDrivers = ( protocolDrivers_t * ) cast_to_fptr( myLib.resolve( "protocolDrivers" ) );
|
||||
protocolDrivers_t *pProtocolDrivers = reinterpret_cast< protocolDrivers_t * >( cast_to_fptr( myLib.resolve( "protocolDrivers" ) ) );
|
||||
if ( pProtocolDrivers )
|
||||
{
|
||||
mProtocolDrivers = pProtocolDrivers();
|
||||
}
|
||||
|
||||
// now get vector file filters, if any
|
||||
fileVectorFilters_t *pFileVectorFilters = ( fileVectorFilters_t * ) cast_to_fptr( myLib.resolve( "fileVectorFilters" ) );
|
||||
fileVectorFilters_t *pFileVectorFilters = reinterpret_cast< fileVectorFilters_t * >( cast_to_fptr( myLib.resolve( "fileVectorFilters" ) ) );
|
||||
if ( pFileVectorFilters )
|
||||
{
|
||||
QString fileVectorFilters = pFileVectorFilters();
|
||||
@ -207,7 +207,7 @@ void QgsProviderRegistry::init()
|
||||
// now get raster file filters, if any
|
||||
// this replaces deprecated QgsRasterLayer::buildSupportedRasterFileFilter
|
||||
buildsupportedrasterfilefilter_t *pBuild =
|
||||
( buildsupportedrasterfilefilter_t * ) cast_to_fptr( myLib.resolve( "buildSupportedRasterFileFilter" ) );
|
||||
reinterpret_cast< buildsupportedrasterfilefilter_t * >( cast_to_fptr( myLib.resolve( "buildSupportedRasterFileFilter" ) ) );
|
||||
if ( pBuild )
|
||||
{
|
||||
QString fileRasterFilters;
|
||||
@ -239,7 +239,7 @@ void QgsProviderRegistry::clean()
|
||||
QLibrary myLib( lib );
|
||||
if ( myLib.isLoaded() )
|
||||
{
|
||||
cleanupProviderFunction_t* cleanupFunc = ( cleanupProviderFunction_t* ) cast_to_fptr( myLib.resolve( "cleanupProvider" ) );
|
||||
cleanupProviderFunction_t* cleanupFunc = reinterpret_cast< cleanupProviderFunction_t* >( cast_to_fptr( myLib.resolve( "cleanupProvider" ) ) );
|
||||
if ( cleanupFunc )
|
||||
cleanupFunc();
|
||||
}
|
||||
@ -384,7 +384,7 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
classFactoryFunction_t *classFactory = ( classFactoryFunction_t * ) cast_to_fptr( myLib.resolve( "classFactory" ) );
|
||||
classFactoryFunction_t *classFactory = reinterpret_cast< classFactoryFunction_t * >( cast_to_fptr( myLib.resolve( "classFactory" ) ) );
|
||||
if ( !classFactory )
|
||||
{
|
||||
QgsDebugMsg( QString( "Failed to load %1: no classFactory method" ).arg( lib ) );
|
||||
@ -411,7 +411,7 @@ int QgsProviderRegistry::providerCapabilities( const QString &providerKey ) cons
|
||||
return QgsDataProvider::NoDataCapabilities;
|
||||
}
|
||||
|
||||
dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
|
||||
dataCapabilities_t * dataCapabilities = reinterpret_cast< dataCapabilities_t *>( cast_to_fptr( library->resolve( "dataCapabilities" ) ) );
|
||||
if ( !dataCapabilities )
|
||||
{
|
||||
return QgsDataProvider::NoDataCapabilities;
|
||||
@ -427,7 +427,7 @@ QWidget* QgsProviderRegistry::selectWidget( const QString & providerKey,
|
||||
QWidget * parent, const Qt::WindowFlags& fl )
|
||||
{
|
||||
selectFactoryFunction_t * selectFactory =
|
||||
( selectFactoryFunction_t * ) cast_to_fptr( function( providerKey, "selectWidget" ) );
|
||||
reinterpret_cast< selectFactoryFunction_t * >( cast_to_fptr( function( providerKey, "selectWidget" ) ) );
|
||||
|
||||
if ( !selectFactory )
|
||||
return nullptr;
|
||||
@ -495,7 +495,7 @@ void QgsProviderRegistry::registerGuis( QWidget *parent )
|
||||
|
||||
Q_FOREACH ( const QString &provider, providerList() )
|
||||
{
|
||||
registerGui_function *registerGui = ( registerGui_function * ) cast_to_fptr( function( provider, "registerGui" ) );
|
||||
registerGui_function *registerGui = reinterpret_cast< registerGui_function * >( cast_to_fptr( function( provider, "registerGui" ) ) );
|
||||
|
||||
if ( !registerGui )
|
||||
continue;
|
||||
|
@ -221,9 +221,9 @@ bool QgsRectangle::isEmpty() const
|
||||
bool QgsRectangle::isNull() const
|
||||
{
|
||||
// rectangle created QgsRectangle() or with rect.setMinimal() ?
|
||||
return ( xmin == 0 && xmax == 0 && ymin == 0 && ymax == 0 ) ||
|
||||
( xmin == std::numeric_limits<double>::max() && ymin == std::numeric_limits<double>::max() &&
|
||||
xmax == -std::numeric_limits<double>::max() && ymax == -std::numeric_limits<double>::max() );
|
||||
return ( qgsDoubleNear( xmin, 0.0 ) && qgsDoubleNear( xmax, 0.0 ) && qgsDoubleNear( ymin, 0.0 ) && qgsDoubleNear( ymax, 0.0 ) ) ||
|
||||
( qgsDoubleNear( xmin, std::numeric_limits<double>::max() ) && qgsDoubleNear( ymin, std::numeric_limits<double>::max() ) &&
|
||||
qgsDoubleNear( xmax, -std::numeric_limits<double>::max() ) && qgsDoubleNear( ymax, -std::numeric_limits<double>::max() ) );
|
||||
}
|
||||
|
||||
QString QgsRectangle::asWktCoordinates() const
|
||||
@ -252,7 +252,7 @@ QString QgsRectangle::asWktPolygon() const
|
||||
//! returns a QRectF with same coordinates.
|
||||
QRectF QgsRectangle::toRectF() const
|
||||
{
|
||||
return QRectF(( qreal )xmin, ( qreal )ymin, ( qreal )xmax - xmin, ( qreal )ymax - ymin );
|
||||
return QRectF( static_cast< qreal >( xmin ), static_cast< qreal >( ymin ), static_cast< qreal >( xmax - xmin ), static_cast< qreal >( ymax - ymin ) );
|
||||
}
|
||||
|
||||
// Return a string representation of the rectangle with automatic or high precision
|
||||
@ -321,10 +321,10 @@ QString QgsRectangle::asPolygon() const
|
||||
|
||||
bool QgsRectangle::operator==( const QgsRectangle & r1 ) const
|
||||
{
|
||||
return r1.xMaximum() == xMaximum() &&
|
||||
r1.xMinimum() == xMinimum() &&
|
||||
r1.yMaximum() == yMaximum() &&
|
||||
r1.yMinimum() == yMinimum();
|
||||
return qgsDoubleNear( r1.xMaximum(), xMaximum() ) &&
|
||||
qgsDoubleNear( r1.xMinimum(), xMinimum() ) &&
|
||||
qgsDoubleNear( r1.yMaximum(), yMaximum() ) &&
|
||||
qgsDoubleNear( r1.yMinimum(), yMinimum() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -404,13 +404,13 @@ bool QgsRenderChecker::compareImages( const QString& theTestName,
|
||||
int maxWidth = qMin( myExpectedImage.width(), myResultImage.width() );
|
||||
|
||||
mMismatchCount = 0;
|
||||
int colorTolerance = ( int ) mColorTolerance;
|
||||
int colorTolerance = static_cast< int >( mColorTolerance );
|
||||
for ( int y = 0; y < maxHeight; ++y )
|
||||
{
|
||||
const QRgb* expectedScanline = ( const QRgb* )myExpectedImage.constScanLine( y );
|
||||
const QRgb* resultScanline = ( const QRgb* )myResultImage.constScanLine( y );
|
||||
const QRgb* maskScanline = hasMask ? ( const QRgb* )maskImage->constScanLine( y ) : nullptr;
|
||||
QRgb* diffScanline = ( QRgb* )myDifferenceImage.scanLine( y );
|
||||
const QRgb* expectedScanline = reinterpret_cast< const QRgb* >( myExpectedImage.constScanLine( y ) );
|
||||
const QRgb* resultScanline = reinterpret_cast< const QRgb* >( myResultImage.constScanLine( y ) );
|
||||
const QRgb* maskScanline = hasMask ? reinterpret_cast< const QRgb* >( maskImage->constScanLine( y ) ) : nullptr;
|
||||
QRgb* diffScanline = reinterpret_cast< QRgb* >( myDifferenceImage.scanLine( y ) );
|
||||
|
||||
for ( int x = 0; x < maxWidth; ++x )
|
||||
{
|
||||
|
@ -79,12 +79,12 @@ double QgsScaleCalculator::calculate( const QgsRectangle &mapExtent, int canvasW
|
||||
delta = calculateGeographicDistance( mapExtent );
|
||||
break;
|
||||
}
|
||||
if ( canvasWidth == 0 || mDpi == 0 )
|
||||
if ( canvasWidth == 0 || qgsDoubleNear( mDpi, 0.0 ) )
|
||||
{
|
||||
QgsDebugMsg( "Can't calculate scale from the input values" );
|
||||
return 0;
|
||||
}
|
||||
double scale = ( delta * conversionFactor ) / (( double )canvasWidth / mDpi );
|
||||
double scale = ( delta * conversionFactor ) / ( static_cast< double >( canvasWidth ) / mDpi );
|
||||
QgsDebugMsg( QString( "scale = %1 conversionFactor = %2" ).arg( scale ).arg( conversionFactor ) );
|
||||
return scale;
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ void QgsSnappingUtils::readConfigFromProject()
|
||||
else if ( snapType == "to vertex" )
|
||||
type = QgsPointLocator::Vertex;
|
||||
double tolerance = QgsProject::instance()->readDoubleEntry( "Digitizing", "/DefaultSnapTolerance", 0 );
|
||||
QgsTolerance::UnitType unit = ( QgsTolerance::UnitType ) QgsProject::instance()->readNumEntry( "Digitizing", "/DefaultSnapToleranceUnit", QgsTolerance::ProjectUnits );
|
||||
QgsTolerance::UnitType unit = static_cast< QgsTolerance::UnitType >( QgsProject::instance()->readNumEntry( "Digitizing", "/DefaultSnapToleranceUnit", QgsTolerance::ProjectUnits ) );
|
||||
setDefaultSettings( type, tolerance, unit );
|
||||
|
||||
//snapping on intersection on?
|
||||
@ -464,7 +464,7 @@ void QgsSnappingUtils::readConfigFromProject()
|
||||
QgsPointLocator::Vertex | QgsPointLocator::Edge
|
||||
)
|
||||
);
|
||||
mLayers.append( LayerConfig( vlayer, t, tolIt->toDouble(), ( QgsTolerance::UnitType ) tolUnitIt->toInt() ) );
|
||||
mLayers.append( LayerConfig( vlayer, t, tolIt->toDouble(), static_cast< QgsTolerance::UnitType >( tolUnitIt->toInt() ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ double QgsTolerance::vertexSearchRadius( const QgsMapSettings& mapSettings )
|
||||
{
|
||||
QSettings settings;
|
||||
double tolerance = settings.value( "/qgis/digitizing/search_radius_vertex_edit", 10 ).toDouble();
|
||||
UnitType units = ( QgsTolerance::UnitType ) settings.value( "/qgis/digitizing/search_radius_vertex_edit_unit", QgsTolerance::Pixels ).toInt();
|
||||
UnitType units = static_cast< QgsTolerance::UnitType >( settings.value( "/qgis/digitizing/search_radius_vertex_edit_unit", QgsTolerance::Pixels ).toInt() );
|
||||
if ( units == LayerUnits )
|
||||
units = ProjectUnits;
|
||||
return toleranceInProjectUnits( tolerance, nullptr, mapSettings, units );
|
||||
@ -86,7 +86,7 @@ double QgsTolerance::vertexSearchRadius( QgsMapLayer *layer, const QgsMapSetting
|
||||
{
|
||||
QSettings settings;
|
||||
double tolerance = settings.value( "/qgis/digitizing/search_radius_vertex_edit", 10 ).toDouble();
|
||||
UnitType units = ( QgsTolerance::UnitType ) settings.value( "/qgis/digitizing/search_radius_vertex_edit_unit", QgsTolerance::Pixels ).toInt();
|
||||
UnitType units = static_cast< QgsTolerance::UnitType >( settings.value( "/qgis/digitizing/search_radius_vertex_edit_unit", QgsTolerance::Pixels ).toInt() );
|
||||
return toleranceInMapUnits( tolerance, layer, mapSettings, units );
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ double QgsTolerance::defaultTolerance( QgsMapLayer *layer, const QgsMapSettings&
|
||||
{
|
||||
QSettings settings;
|
||||
double tolerance = settings.value( "/qgis/digitizing/default_snapping_tolerance", 0 ).toDouble();
|
||||
UnitType units = ( QgsTolerance::UnitType ) settings.value( "/qgis/digitizing/default_snapping_tolerance_unit", ProjectUnits ).toInt();
|
||||
UnitType units = static_cast< QgsTolerance::UnitType >( settings.value( "/qgis/digitizing/default_snapping_tolerance_unit", ProjectUnits ).toInt() );
|
||||
return toleranceInMapUnits( tolerance, layer, mapSettings, units );
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ QgsTransaction* QgsTransaction::create( const QString& connString, const QString
|
||||
if ( !lib )
|
||||
return nullptr;
|
||||
|
||||
createTransaction_t* createTransaction = ( createTransaction_t* ) cast_to_fptr( lib->resolve( "createTransaction" ) );
|
||||
createTransaction_t* createTransaction = reinterpret_cast< createTransaction_t* >( cast_to_fptr( lib->resolve( "createTransaction" ) ) );
|
||||
if ( !createTransaction )
|
||||
return nullptr;
|
||||
|
||||
|
@ -47,10 +47,8 @@
|
||||
#include <cpl_conv.h>
|
||||
|
||||
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
|
||||
#define TO8(x) (x).toUtf8().constData()
|
||||
#define TO8F(x) (x).toUtf8().constData()
|
||||
#else
|
||||
#define TO8(x) (x).toLocal8Bit().constData()
|
||||
#define TO8F(x) QFile::encodeName( x ).constData()
|
||||
#endif
|
||||
|
||||
@ -499,7 +497,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
|
||||
|
||||
OGRGeometryH QgsVectorFileWriter::createEmptyGeometry( QGis::WkbType wkbType )
|
||||
{
|
||||
return OGR_G_CreateGeometry(( OGRwkbGeometryType ) wkbType );
|
||||
return OGR_G_CreateGeometry( static_cast< OGRwkbGeometryType >( wkbType ) );
|
||||
}
|
||||
|
||||
QMap<QString, QgsVectorFileWriter::MetaData> QgsVectorFileWriter::initMetaData()
|
||||
@ -1746,7 +1744,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
|
||||
QgsWKBTypes::Type wkbType = QGis::fromOldWkbType( geom->wkbType() );
|
||||
if ( wkbType >= QgsWKBTypes::PointZ && wkbType <= QgsWKBTypes::MultiPolygonZ )
|
||||
{
|
||||
QGis::WkbType wkbType25d = ( QGis::WkbType )( geom->wkbType() - QgsWKBTypes::PointZ + QgsWKBTypes::Point25D );
|
||||
QGis::WkbType wkbType25d = static_cast< QGis::WkbType >( geom->wkbType() - QgsWKBTypes::PointZ + QgsWKBTypes::Point25D );
|
||||
mGeom2 = createEmptyGeometry( wkbType25d );
|
||||
}
|
||||
}
|
||||
@ -1774,7 +1772,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OGRErr err = OGR_G_ImportFromWkb( mGeom2, const_cast<unsigned char *>( geom->asWkb() ), ( int ) geom->wkbSize() );
|
||||
OGRErr err = OGR_G_ImportFromWkb( mGeom2, const_cast<unsigned char *>( geom->asWkb() ), static_cast< int >( geom->wkbSize() ) );
|
||||
if ( err != OGRERR_NONE )
|
||||
{
|
||||
mErrorMessage = QObject::tr( "Feature geometry not imported (OGR error: %1)" )
|
||||
@ -1790,7 +1788,7 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
|
||||
}
|
||||
else if ( geom )
|
||||
{
|
||||
OGRErr err = OGR_G_ImportFromWkb( mGeom, const_cast<unsigned char *>( geom->asWkb() ), ( int ) geom->wkbSize() );
|
||||
OGRErr err = OGR_G_ImportFromWkb( mGeom, const_cast<unsigned char *>( geom->asWkb() ), static_cast< int >( geom->wkbSize() ) );
|
||||
if ( err != OGRERR_NONE )
|
||||
{
|
||||
mErrorMessage = QObject::tr( "Feature geometry not imported (OGR error: %1)" )
|
||||
|
@ -164,7 +164,7 @@ QgsVectorLayer::QgsVectorLayer( const QString& vectorLayerPath,
|
||||
|
||||
// Default simplify drawing settings
|
||||
QSettings settings;
|
||||
mSimplifyMethod.setSimplifyHints(( QgsVectorSimplifyMethod::SimplifyHints ) settings.value( "/qgis/simplifyDrawingHints", ( int ) mSimplifyMethod.simplifyHints() ).toInt() );
|
||||
mSimplifyMethod.setSimplifyHints( static_cast< QgsVectorSimplifyMethod::SimplifyHints >( settings.value( "/qgis/simplifyDrawingHints", static_cast< int>( mSimplifyMethod.simplifyHints() ) ).toInt() ) );
|
||||
mSimplifyMethod.setThreshold( settings.value( "/qgis/simplifyDrawingTol", mSimplifyMethod.threshold() ).toFloat() );
|
||||
mSimplifyMethod.setForceLocalOptimization( settings.value( "/qgis/simplifyLocal", mSimplifyMethod.forceLocalOptimization() ).toBool() );
|
||||
mSimplifyMethod.setMaximumScale( settings.value( "/qgis/simplifyMaxScale", mSimplifyMethod.maximumScale() ).toFloat() );
|
||||
@ -577,7 +577,7 @@ QGis::GeometryType QgsVectorLayer::geometryType() const
|
||||
if ( mValid && mDataProvider )
|
||||
{
|
||||
QGis::WkbType type = mDataProvider->geometryType();
|
||||
return ( QGis::GeometryType )( QgsWKBTypes::geometryType(( QgsWKBTypes::Type )type ) );
|
||||
return static_cast< QGis::GeometryType >( QgsWKBTypes::geometryType( static_cast< QgsWKBTypes::Type >( type ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,
|
||||
return;
|
||||
}
|
||||
|
||||
createEmptyLayer_t * pCreateEmpty = ( createEmptyLayer_t * ) cast_to_fptr( myLib->resolve( "createEmptyLayer" ) );
|
||||
createEmptyLayer_t * pCreateEmpty = reinterpret_cast< createEmptyLayer_t * >( cast_to_fptr( myLib->resolve( "createEmptyLayer" ) ) );
|
||||
if ( !pCreateEmpty )
|
||||
{
|
||||
delete myLib;
|
||||
@ -97,7 +97,7 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,
|
||||
|
||||
QgsDebugMsg( "Created empty layer" );
|
||||
|
||||
QgsVectorDataProvider *vectorProvider = ( QgsVectorDataProvider* ) pReg->provider( providerKey, uri );
|
||||
QgsVectorDataProvider *vectorProvider = dynamic_cast< QgsVectorDataProvider* >( pReg->provider( providerKey, uri ) );
|
||||
if ( !vectorProvider || !vectorProvider->isValid() || ( vectorProvider->capabilities() & QgsVectorDataProvider::AddFeatures ) == 0 )
|
||||
{
|
||||
mError = ErrInvalidLayer;
|
||||
|
@ -140,7 +140,7 @@ bool CustomLayerOrderModel::setData( const QModelIndex& index, const QVariant& v
|
||||
QgsLayerTreeLayer* nodeLayer = mBridge->rootGroup()->findLayer( id );
|
||||
if ( nodeLayer )
|
||||
{
|
||||
nodeLayer->setVisible(( Qt::CheckState )value.toInt() );
|
||||
nodeLayer->setVisible( static_cast< Qt::CheckState >( value.toInt() ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -230,8 +230,8 @@ void Builder::addArc( const DL_ArcData& data )
|
||||
return;
|
||||
}
|
||||
|
||||
int fromAngle = ( int ) data.angle1 + 1;
|
||||
int toAngle = ( int ) data.angle2 + 1;
|
||||
int fromAngle = static_cast< int >( data.angle1 ) + 1;
|
||||
int toAngle = static_cast< int >( data.angle2 ) + 1;
|
||||
|
||||
QgsDebugMsg( QString( "arc (%1,%2,%3 r=%4 a1=%5 a2=%6)" )
|
||||
.arg( data.cx ).arg( data.cy ).arg( data.cz )
|
||||
@ -276,7 +276,7 @@ void Builder::addArc( const DL_ArcData& data )
|
||||
|
||||
// Finalize
|
||||
|
||||
int dim = ( int ) arcPoints.size();
|
||||
int dim = static_cast< int >( arcPoints.size() );
|
||||
QVector<double> xv( dim );
|
||||
QVector<double> yv( dim );
|
||||
QVector<double> zv( dim );
|
||||
@ -325,7 +325,7 @@ void Builder::addCircle( const DL_CircleData& data )
|
||||
circlePoints.push_back( myPoint );
|
||||
}
|
||||
|
||||
int dim = ( int ) circlePoints.size();
|
||||
int dim = static_cast< int >( circlePoints.size() );
|
||||
QVector<double> xv( dim );
|
||||
QVector<double> yv( dim );
|
||||
QVector<double> zv( dim );
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "dl_global.h"
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#if defined(_MSC_VER) && _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
@ -178,7 +178,7 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface) {
|
||||
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, fp) &&
|
||||
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, fp) ) {
|
||||
|
||||
groupCode = (unsigned int)toInt(groupCodeTmp);
|
||||
groupCode = static_cast<unsigned int>(toInt(groupCodeTmp));
|
||||
|
||||
creationInterface->processCodeValuePair(groupCode, groupValue);
|
||||
line+=2;
|
||||
@ -202,7 +202,7 @@ bool DL_Dxf::readDxfGroups(std::stringstream& stream,
|
||||
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, stream) &&
|
||||
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, stream) ) {
|
||||
|
||||
groupCode = (unsigned int)toInt(groupCodeTmp);
|
||||
groupCode = static_cast<unsigned int>(toInt(groupCodeTmp));
|
||||
|
||||
line+=2;
|
||||
processDXFGroup(creationInterface, groupCode, groupValue);
|
||||
@ -296,7 +296,7 @@ bool DL_Dxf::getStrippedLine(std::string &s, unsigned int size,
|
||||
*/
|
||||
bool DL_Dxf::stripWhiteSpace(char** s) {
|
||||
// last non-NULL char:
|
||||
int lastChar = (int) strlen(*s) - 1;
|
||||
int lastChar = static_cast<int>( strlen(*s) ) - 1;
|
||||
|
||||
// Is last character CR or LF?
|
||||
while ( (lastChar >= 0) &&
|
||||
@ -386,7 +386,7 @@ bool DL_Dxf::processDXFGroup(DL_CreationInterface* creationInterface,
|
||||
width, // width
|
||||
linetype, // linetype
|
||||
handle); // handle
|
||||
attrib.setInPaperSpace((bool)getIntValue(67, 0));
|
||||
attrib.setInPaperSpace( static_cast<bool>(getIntValue(67, 0)));
|
||||
attrib.setLinetypeScale(getRealValue(48, 1.0));
|
||||
creationInterface->setAttributes(attrib);
|
||||
|
||||
@ -2044,7 +2044,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) {
|
||||
hatchEdge.angle2 = toReal(groupValue)/360.0*2*M_PI;
|
||||
return true;
|
||||
case 73:
|
||||
hatchEdge.ccw = (bool)toInt(groupValue);
|
||||
hatchEdge.ccw = static_cast<bool>(toInt(groupValue));
|
||||
hatchEdge.defined = true;
|
||||
return true;
|
||||
}
|
||||
@ -2075,7 +2075,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface) {
|
||||
hatchEdge.angle2 = toReal(groupValue)/360.0*2*M_PI;
|
||||
return true;
|
||||
case 73:
|
||||
hatchEdge.ccw = (bool)toInt(groupValue);
|
||||
hatchEdge.ccw = static_cast<bool>(toInt(groupValue));
|
||||
hatchEdge.defined = true;
|
||||
return true;
|
||||
}
|
||||
@ -2421,7 +2421,7 @@ void DL_Dxf::writePolyline(DL_WriterA& dw,
|
||||
dw.entityAttributes(attrib);
|
||||
dw.dxfString(100, "AcDbEntity");
|
||||
dw.dxfString(100, "AcDbPolyline");
|
||||
dw.dxfInt(90, (int)data.number);
|
||||
dw.dxfInt(90, static_cast<int>(data.number));
|
||||
dw.dxfInt(70, data.flags);
|
||||
} else {
|
||||
dw.entity("POLYLINE");
|
||||
@ -2779,7 +2779,7 @@ void DL_Dxf::writeMText(DL_WriterA& dw,
|
||||
dw.dxfInt(72, data.drawingDirection);
|
||||
|
||||
// Creare text chunks of 250 characters each:
|
||||
int length = (int) data.text.length();
|
||||
int length = static_cast<int>( data.text.length() );
|
||||
char chunk[251];
|
||||
int i;
|
||||
for (i=250; i<length; i+=250) {
|
||||
@ -3407,7 +3407,7 @@ void DL_Dxf::writeHatch1(DL_WriterA& dw,
|
||||
} else {
|
||||
dw.dxfString(2, "SOLID");
|
||||
}
|
||||
dw.dxfInt(70, (int)data.solid);
|
||||
dw.dxfInt(70, static_cast<int>(data.solid));
|
||||
dw.dxfInt(71, 0); // non-associative
|
||||
dw.dxfInt(91, data.numLoops);
|
||||
}
|
||||
@ -3516,7 +3516,7 @@ void DL_Dxf::writeHatchEdge(DL_WriterA& dw,
|
||||
dw.dxfReal(40, data.radius);
|
||||
dw.dxfReal(50, data.angle1/(2*M_PI)*360.0);
|
||||
dw.dxfReal(51, data.angle2/(2*M_PI)*360.0);
|
||||
dw.dxfInt(73, (int)(data.ccw));
|
||||
dw.dxfInt(73, static_cast<int>(data.ccw));
|
||||
break;
|
||||
|
||||
// ellipse arc:
|
||||
@ -3528,7 +3528,7 @@ void DL_Dxf::writeHatchEdge(DL_WriterA& dw,
|
||||
dw.dxfReal(40, data.ratio);
|
||||
dw.dxfReal(50, data.angle1/(2*M_PI)*360.0);
|
||||
dw.dxfReal(51, data.angle2/(2*M_PI)*360.0);
|
||||
dw.dxfInt(73, (int)(data.ccw));
|
||||
dw.dxfInt(73, static_cast<int>(data.ccw));
|
||||
break;
|
||||
|
||||
// spline:
|
||||
|
@ -415,7 +415,7 @@ public:
|
||||
|
||||
bool toBool(const std::string& str) {
|
||||
char* p;
|
||||
return (bool)strtol(str.c_str(), &p, 10);
|
||||
return static_cast<bool>( strtol(str.c_str(), &p, 10) );
|
||||
}
|
||||
|
||||
std::string getStringValue(int code, const std::string& def) {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define DL_ENTITIES_H
|
||||
|
||||
#include "dl_global.h"
|
||||
#include "qgis.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -159,9 +160,9 @@ struct DXFLIB_EXPORT DL_StyleData {
|
||||
// ignore lastHeightUsed:
|
||||
return (name==other.name &&
|
||||
flags==other.flags &&
|
||||
fixedTextHeight==other.fixedTextHeight &&
|
||||
widthFactor==other.widthFactor &&
|
||||
obliqueAngle==other.obliqueAngle &&
|
||||
qgsDoubleNear( fixedTextHeight, other.fixedTextHeight ) &&
|
||||
qgsDoubleNear( widthFactor, other.widthFactor ) &&
|
||||
qgsDoubleNear( obliqueAngle, other.obliqueAngle ) &&
|
||||
textGenerationFlags==other.textGenerationFlags &&
|
||||
primaryFontFile==other.primaryFontFile &&
|
||||
bigFontFile==other.bigFontFile);
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#if defined(_MSC_VER)&& _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
@ -607,7 +607,7 @@ public:
|
||||
* @param value The bool value.
|
||||
*/
|
||||
virtual void dxfBool(int gc, bool value) const {
|
||||
dxfInt(gc, (int)value);
|
||||
dxfInt(gc, static_cast<int>(value));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#if defined(_MSC_VER) && _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
@ -76,7 +76,7 @@ void DL_WriterA::dxfReal(int gc, double value) const {
|
||||
end = i+1;
|
||||
}
|
||||
}
|
||||
if (end>0 && end<(int)strlen(str)) {
|
||||
if (end>0 && end<static_cast<int>(strlen(str))) {
|
||||
str[end] = '\0';
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "dl_global.h"
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#if defined(_MSC_VER) && _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
@ -75,9 +75,9 @@ QList<QgsColorRampShader::ColorRampItem> QgsGdalProviderBase::colorTable( GDALDa
|
||||
|
||||
int myEntryCount = GDALGetColorEntryCount( myGdalColorTable );
|
||||
GDALColorInterp myColorInterpretation = GDALGetRasterColorInterpretation( myGdalBand );
|
||||
QgsDebugMsg( "Color Interpretation: " + QString::number(( int )myColorInterpretation ) );
|
||||
QgsDebugMsg( "Color Interpretation: " + QString::number( static_cast< int >( myColorInterpretation ) ) );
|
||||
GDALPaletteInterp myPaletteInterpretation = GDALGetPaletteInterpretation( myGdalColorTable );
|
||||
QgsDebugMsg( "Palette Interpretation: " + QString::number(( int )myPaletteInterpretation ) );
|
||||
QgsDebugMsg( "Palette Interpretation: " + QString::number( static_cast< int >( myPaletteInterpretation ) ) );
|
||||
|
||||
const GDALColorEntry* myColorEntry = nullptr;
|
||||
for ( int myIterator = 0; myIterator < myEntryCount; myIterator++ )
|
||||
@ -99,7 +99,7 @@ QList<QgsColorRampShader::ColorRampItem> QgsGdalProviderBase::colorTable( GDALDa
|
||||
if ( myColorInterpretation == GCI_GrayIndex )
|
||||
{
|
||||
QgsColorRampShader::ColorRampItem myColorRampItem;
|
||||
myColorRampItem.value = ( double )myIterator;
|
||||
myColorRampItem.value = static_cast< double >( myIterator );
|
||||
myColorRampItem.label = label;
|
||||
myColorRampItem.color = QColor::fromRgb( myColorEntry->c1, myColorEntry->c1, myColorEntry->c1, myColorEntry->c4 );
|
||||
ct.append( myColorRampItem );
|
||||
@ -107,7 +107,7 @@ QList<QgsColorRampShader::ColorRampItem> QgsGdalProviderBase::colorTable( GDALDa
|
||||
else if ( myColorInterpretation == GCI_PaletteIndex )
|
||||
{
|
||||
QgsColorRampShader::ColorRampItem myColorRampItem;
|
||||
myColorRampItem.value = ( double )myIterator;
|
||||
myColorRampItem.value = static_cast< double >( myIterator );
|
||||
myColorRampItem.label = label;
|
||||
//Branch on palette interpretation
|
||||
if ( myPaletteInterpretation == GPI_RGB )
|
||||
|
@ -38,7 +38,7 @@ bool QgsWmsSettings::parseUri( const QString& uriString )
|
||||
mParserSettings.invertAxisOrientation = uri.hasParam( "InvertAxisOrientation" ); // must be before parsing!
|
||||
mSmoothPixmapTransform = uri.hasParam( "SmoothPixmapTransform" );
|
||||
|
||||
mDpiMode = uri.hasParam( "dpiMode" ) ? ( QgsWmsDpiMode ) uri.param( "dpiMode" ).toInt() : dpiAll;
|
||||
mDpiMode = uri.hasParam( "dpiMode" ) ? static_cast< QgsWmsDpiMode >( uri.param( "dpiMode" ).toInt() ) : dpiAll;
|
||||
|
||||
mAuth.mUserName = uri.param( "username" );
|
||||
QgsDebugMsg( "set username to " + mAuth.mUserName );
|
||||
|
@ -72,21 +72,21 @@ void TestQgsScaleComboBox::basic()
|
||||
QTest::keyClicks( l, "1:2345" );
|
||||
QTest::keyClick( l, Qt::Key_Return );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 2345 ) ) );
|
||||
QCOMPARE( s->scale(), (( double ) 1.0 / ( double ) 2345.0 ) );
|
||||
QCOMPARE( s->scale(), 1.0 / 2345.0 );
|
||||
|
||||
// Testing conversion from number to "1:x"
|
||||
l->setText( "" );
|
||||
QTest::keyClicks( l, QLocale::system().toString( 0.02 ) );
|
||||
QTest::keyClick( l, Qt::Key_Return );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 50 ) ) );
|
||||
QCOMPARE( s->scale(), ( double ) 0.02 );
|
||||
QCOMPARE( s->scale(), 0.02 );
|
||||
|
||||
// Testing conversion from number to "1:x"
|
||||
l->setText( "" );
|
||||
QTest::keyClicks( l, QLocale::system().toString( 42 ) );
|
||||
QTest::keyClick( l, Qt::Key_Return );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 42 ) ) );
|
||||
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 42.0 );
|
||||
QCOMPARE( s->scale(), 1.0 / 42.0 );
|
||||
|
||||
// Testing conversion from number to "1:x,000"
|
||||
l->setText( "" );
|
||||
@ -94,7 +94,7 @@ void TestQgsScaleComboBox::basic()
|
||||
QTest::keyClicks( l, str );
|
||||
QTest::keyClick( l, Qt::Key_Return );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( str ) );
|
||||
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 1000000.0 );
|
||||
QCOMPARE( s->scale(), 1.0 / 1000000.0 );
|
||||
|
||||
// Testing conversion from number to "1:x,000" with wonky separators
|
||||
//(eg four digits between thousands, which should be fixed automatically)
|
||||
@ -104,7 +104,7 @@ void TestQgsScaleComboBox::basic()
|
||||
QTest::keyClicks( l, str );
|
||||
QTest::keyClick( l, Qt::Key_Return );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( fixedStr ) );
|
||||
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 10000000.0 );
|
||||
QCOMPARE( s->scale(), 1.0 / 10000000.0 );
|
||||
|
||||
// Testing rounding and conversion from illegal
|
||||
|
||||
@ -116,22 +116,22 @@ void TestQgsScaleComboBox::basic()
|
||||
QTest::keyClicks( l, "1:x:2" );
|
||||
QTest::keyClick( l, Qt::Key_Return );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 4 ) ) );
|
||||
QCOMPARE( s->scale(), ( double ) 0.25 );
|
||||
QCOMPARE( s->scale(), 0.25 );
|
||||
|
||||
// Test setting programatically
|
||||
s->setScale(( double ) 0.19 );
|
||||
s->setScale( 0.19 );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 5 ) ) );
|
||||
QCOMPARE( s->scale(), ( double ) 0.2 );
|
||||
QCOMPARE( s->scale(), 0.2 );
|
||||
|
||||
// Test setting programatically
|
||||
s->setScaleString( QString( "1:240" ) );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 240 ) ) );
|
||||
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 240.0 );
|
||||
QCOMPARE( s->scale(), 1.0 / 240.0 );
|
||||
|
||||
// Test setting programatically illegal string
|
||||
s->setScaleString( QString( "1:2" ) + QLocale::system().decimalPoint() + "4" );
|
||||
QCOMPARE( s->scaleString(), QString( "1:%1" ).arg( QLocale::system().toString( 240 ) ) );
|
||||
QCOMPARE( s->scale(), ( double ) 1.0 / ( double ) 240.0 );
|
||||
QCOMPARE( s->scale(), 1.0 / 240.0 );
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user