Skip to content
Permalink
Browse files
Silence some annoyingly debug chatty classes
  • Loading branch information
nyalldawson committed Apr 19, 2017
1 parent 1962c54 commit cbf5e9c9c902f7fc3f896a581bdc904e4d6e1b98
@@ -738,13 +738,13 @@ void QgsProjectProperties::apply()
QgsProject::instance()->setCrs( srs );
if ( srs.isValid() )
{
QgsDebugMsg( QString( "Selected CRS " ) + srs.description() );
QgsDebugMsgLevel( QString( "Selected CRS " ) + srs.description(), 4 );
// write the currently selected projections _proj string_ to project settings
QgsDebugMsg( QString( "SpatialRefSys/ProjectCRSProj4String: %1" ).arg( srs.toProj4() ) );
QgsDebugMsgLevel( QString( "SpatialRefSys/ProjectCRSProj4String: %1" ).arg( srs.toProj4() ), 4 );
}
else
{
QgsDebugMsg( QString( "CRS set to no projection!" ) );
QgsDebugMsgLevel( QString( "CRS set to no projection!" ), 4 );
}

// mark selected projection for push to front
@@ -799,7 +799,7 @@ void QgsProjectProperties::apply()
// If the user fields have changed, use them instead.
if ( leSemiMajor->isModified() || leSemiMinor->isModified() )
{
QgsDebugMsg( "Using parameteric major/minor" );
QgsDebugMsgLevel( "Using parameteric major/minor", 4 );
major = QLocale::system().toDouble( leSemiMajor->text() );
minor = QLocale::system().toDouble( leSemiMinor->text() );
}
@@ -1856,7 +1856,7 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )
// changing ellipsoid, save the modified coordinates
if ( leSemiMajor->isModified() || leSemiMinor->isModified() )
{
QgsDebugMsg( "Saving major/minor" );
QgsDebugMsgLevel( "Saving major/minor", 4 );
mEllipsoidList[ mEllipsoidIndex ].semiMajor = QLocale::system().toDouble( leSemiMajor->text() );
mEllipsoidList[ mEllipsoidIndex ].semiMinor = QLocale::system().toDouble( leSemiMinor->text() );
}
@@ -1891,7 +1891,7 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )

void QgsProjectProperties::projectionSelectorInitialized()
{
QgsDebugMsg( "Setting up ellipsoid" );
QgsDebugMsgLevel( "Setting up ellipsoid", 4 );

// Reading ellipsoid from settings
QStringList mySplitEllipsoid = QgsProject::instance()->ellipsoid().split( ':' );
@@ -575,7 +575,7 @@ void QgsLayerTreeModel::setLayerTreeNodeFont( int nodeType, const QFont &font )
}
else
{
QgsDebugMsg( "invalid node type" );
QgsDebugMsgLevel( "invalid node type", 4 );
}
}

@@ -588,7 +588,7 @@ QFont QgsLayerTreeModel::layerTreeNodeFont( int nodeType ) const
return mFontLayer;
else
{
QgsDebugMsg( "invalid node type" );
QgsDebugMsgLevel( "invalid node type", 4 );
return QFont();
}
}
@@ -1509,8 +1509,6 @@ void QgsLayerTreeModel::legendInvalidateMapBasedData()

void QgsLayerTreeModel::invalidateLegendMapBasedData()
{
QgsDebugCall;

// we have varying icon sizes, and we want icon to be centered and
// text to be left aligned, so we have to compute the max width of icons
//
@@ -74,7 +74,7 @@ void QgsLayerTreeRegistryBridge::layersAdded( const QList<QgsMapLayer *> &layers

void QgsLayerTreeRegistryBridge::layersWillBeRemoved( const QStringList &layerIds )
{
QgsDebugMsg( QString( "%1 layers will be removed, enabled:%2" ).arg( layerIds.count() ).arg( mEnabled ) );
QgsDebugMsgLevel( QString( "%1 layers will be removed, enabled:%2" ).arg( layerIds.count() ).arg( mEnabled ), 4 );

if ( !mEnabled )
return;
@@ -136,7 +136,7 @@ void QgsLayerTreeRegistryBridge::groupRemovedChildren()
toRemove << layerId;
mLayerIdsForRemoval.clear();

QgsDebugMsg( QString( "%1 layers will be removed" ).arg( toRemove.count() ) );
QgsDebugMsgLevel( QString( "%1 layers will be removed" ).arg( toRemove.count() ), 4 );

// delay the removal of layers from the registry. There may be other slots connected to map layer registry's signals
// that might disrupt the execution flow - e.g. a processEvents() call may force update of layer tree view with
@@ -132,14 +132,14 @@ void QgsBrowserModel::addRootItems()
int capabilities = pr->capabilities();
if ( capabilities == QgsDataProvider::NoDataCapabilities )
{
QgsDebugMsg( pr->name() + " does not have any dataCapabilities" );
QgsDebugMsgLevel( pr->name() + " does not have any dataCapabilities", 4 );
continue;
}

QgsDataItem *item = pr->createDataItem( QLatin1String( "" ), nullptr ); // empty path -> top level
if ( item )
{
QgsDebugMsg( "Add new top level item : " + item->name() );
QgsDebugMsgLevel( "Add new top level item : " + item->name(), 4 );
connectItem( item );
providerMap.insertMulti( capabilities, item );
}
@@ -298,7 +298,7 @@ QModelIndex QgsBrowserModel::findPath( QAbstractItemModel *model, const QString
QString itemPath = model->data( idx, PathRole ).toString();
if ( itemPath == path )
{
QgsDebugMsg( "Arrived " + itemPath );
QgsDebugMsgLevel( "Arrived " + itemPath, 4 );
return idx; // we have found the item we have been looking for
}

@@ -315,7 +315,7 @@ QModelIndex QgsBrowserModel::findPath( QAbstractItemModel *model, const QString
if ( matchFlag == Qt::MatchStartsWith )
return index;

QgsDebugMsg( "path not found" );
QgsDebugMsgLevel( "path not found", 4 );
return QModelIndex(); // not found
}

@@ -408,7 +408,7 @@ void QgsBrowserModel::itemStateChanged( QgsDataItem *item, QgsDataItem::State ol
QModelIndex idx = findItem( item );
if ( !idx.isValid() )
return;
QgsDebugMsg( QString( "item %1 state changed %2 -> %3" ).arg( item->path() ).arg( oldState ).arg( item->state() ) );
QgsDebugMsgLevel( QString( "item %1 state changed %2 -> %3" ).arg( item->path() ).arg( oldState ).arg( item->state() ), 4 );
emit stateChanged( idx, oldState );
}
void QgsBrowserModel::connectItem( QgsDataItem *item )
@@ -470,7 +470,7 @@ bool QgsBrowserModel::dropMimeData( const QMimeData *data, Qt::DropAction action
QgsDataItem *destItem = dataItem( parent );
if ( !destItem )
{
QgsDebugMsg( "DROP PROBLEM!" );
QgsDebugMsgLevel( "DROP PROBLEM!", 4 );
return false;
}

@@ -500,7 +500,7 @@ void QgsBrowserModel::fetchMore( const QModelIndex &parent )
if ( !item || item->state() == QgsDataItem::Populating || item->state() == QgsDataItem::Populated )
return;

QgsDebugMsg( "path = " + item->path() );
QgsDebugMsgLevel( "path = " + item->path(), 4 );

item->populate();
}
@@ -519,7 +519,7 @@ void QgsBrowserModel::refresh( const QModelIndex &index )
if ( !item || item->state() == QgsDataItem::Populating )
return;

QgsDebugMsg( "Refresh " + item->path() );
QgsDebugMsgLevel( "Refresh " + item->path(), 4 );

item->refresh();
}
@@ -305,11 +305,11 @@ void QgsCoordinateReferenceSystem::setupESRIWktFix()
if ( strcmp( configNew, CPLGetConfigOption( "GDAL_FIX_ESRI_WKT", "" ) ) != 0 )
QgsLogger::warning( QStringLiteral( "GDAL_FIX_ESRI_WKT could not be set to %1 : %2" )
.arg( configNew, CPLGetConfigOption( "GDAL_FIX_ESRI_WKT", "" ) ) );
QgsDebugMsg( QString( "set GDAL_FIX_ESRI_WKT : %1" ).arg( configNew ) );
QgsDebugMsgLevel( QString( "set GDAL_FIX_ESRI_WKT : %1" ).arg( configNew ), 4 );
}
else
{
QgsDebugMsg( QString( "GDAL_FIX_ESRI_WKT was already set : %1" ).arg( configNew ) );
QgsDebugMsgLevel( QString( "GDAL_FIX_ESRI_WKT was already set : %1" ).arg( configNew ), 4 );
}
}

@@ -537,7 +537,7 @@ bool QgsCoordinateReferenceSystem::loadFromDatabase( const QString &db, const QS
}
else
{
QgsDebugMsg( "failed : " + mySql );
QgsDebugMsgLevel( "failed : " + mySql, 4 );
}
sqlite3_finalize( myPreparedStatement );
sqlite3_close( myDatabase );
@@ -592,7 +592,7 @@ bool QgsCoordinateReferenceSystem::createFromWkt( const QString &wkt )

if ( wkt.isEmpty() )
{
QgsDebugMsg( "theWkt is uninitialized, operation failed" );
QgsDebugMsgLevel( "theWkt is uninitialized, operation failed", 4 );
return d->mIsValid;
}
QByteArray ba = wkt.toLatin1();
@@ -770,7 +770,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
myStart2 = 0;
myStart2 = myLat2RegExp.indexIn( proj4String, myStart2 );
proj4StringModified.replace( myStart2 + LAT_PREFIX_LEN, myLength2 - LAT_PREFIX_LEN, lat1Str );
QgsDebugMsg( "trying proj4string match with swapped lat_1,lat_2" );
QgsDebugMsgLevel( "trying proj4string match with swapped lat_1,lat_2", 4 );
myRecord = getRecord( "select * from tbl_srs where parameters=" + quotedValue( proj4StringModified.trimmed() ) + " order by deprecated" );
}
}
@@ -862,7 +862,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
// if we failed to look up the projection in database, don't worry. we can still use it :)
if ( !d->mIsValid )
{
QgsDebugMsg( "Projection is not found in databases." );
QgsDebugMsgLevel( "Projection is not found in databases.", 4 );
//setProj4String will set mIsValidFlag to true if there is no issue
setProj4String( myProj4String );
}
@@ -916,13 +916,13 @@ QgsCoordinateReferenceSystem::RecordMap QgsCoordinateReferenceSystem::getRecord(
}
if ( sqlite3_step( myPreparedStatement ) != SQLITE_DONE )
{
QgsDebugMsg( "Multiple records found in srs.db" );
QgsDebugMsgLevel( "Multiple records found in srs.db", 4 );
myMap.clear();
}
}
else
{
QgsDebugMsg( "failed : " + sql );
QgsDebugMsgLevel( "failed : " + sql, 4 );
}

if ( myMap.empty() )
@@ -961,13 +961,13 @@ QgsCoordinateReferenceSystem::RecordMap QgsCoordinateReferenceSystem::getRecord(

if ( sqlite3_step( myPreparedStatement ) != SQLITE_DONE )
{
QgsDebugMsg( "Multiple records found in srs.db" );
QgsDebugMsgLevel( "Multiple records found in srs.db", 4 );
myMap.clear();
}
}
else
{
QgsDebugMsg( "failed : " + sql );
QgsDebugMsgLevel( "failed : " + sql, 4 );
}
}
sqlite3_finalize( myPreparedStatement );
@@ -1099,7 +1099,7 @@ void QgsCoordinateReferenceSystem::setProj4String( const QString &proj4String )
projPJ proj = pj_init_plus( proj4String.trimmed().toLatin1().constData() );
if ( !proj )
{
QgsDebugMsg( "proj.4 string rejected by pj_init_plus()" );
QgsDebugMsgLevel( "proj.4 string rejected by pj_init_plus()", 4 );
d->mIsValid = false;
}
else
@@ -1190,9 +1190,9 @@ long QgsCoordinateReferenceSystem::findMatchingProj()
if ( d->mEllipsoidAcronym.isNull() || d->mProjectionAcronym.isNull()
|| !d->mIsValid )
{
QgsDebugMsg( "QgsCoordinateReferenceSystem::findMatchingProj will only "
"work if prj acr ellipsoid acr and proj4string are set"
" and the current projection is valid!" );
QgsDebugMsgLevel( "QgsCoordinateReferenceSystem::findMatchingProj will only "
"work if prj acr ellipsoid acr and proj4string are set"
" and the current projection is valid!", 4 );
return 0;
}

@@ -1593,7 +1593,7 @@ bool QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
{
if ( !d->mIsValid )
{
QgsDebugMsg( "Can't save an invalid CRS!" );
QgsDebugMsgLevel( "Can't save an invalid CRS!", 4 );
return false;
}

@@ -1933,7 +1933,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
QRegExp projRegExp( "\\+proj=(\\S+)" );
if ( projRegExp.indexIn( proj4 ) < 0 )
{
QgsDebugMsg( QString( "EPSG %1: no +proj argument found [%2]" ).arg( it.key() ).arg( proj4 ) );
QgsDebugMsgLevel( QString( "EPSG %1: no +proj argument found [%2]" ).arg( it.key() ).arg( proj4 ), 4 );
continue;
}

@@ -2053,7 +2053,7 @@ int QgsCoordinateReferenceSystem::syncDatabase()
}
else
{
QgsDebugMsg( QString( "could not retrieve proj string for %1 from PROJ" ).arg( input ) );
QgsDebugMsgLevel( QString( "could not retrieve proj string for %1 from PROJ" ).arg( input ), 4 );
}
}
else
@@ -109,7 +109,7 @@ class QgsCoordinateTransformPrivate : public QSharedData
{
// Pass through with no projection since we have no idea what the layer
// coordinates are and projecting them may not be appropriate
QgsDebugMsg( "Source CRS is invalid!" );
QgsDebugMsgLevel( "Source CRS is invalid!", 4 );
return false;
}

@@ -118,7 +118,7 @@ class QgsCoordinateTransformPrivate : public QSharedData
//No destination projection is set so we set the default output projection to
//be the same as input proj.
mDestCRS = mSourceCRS;
QgsDebugMsg( "Destination CRS is invalid!" );
QgsDebugMsgLevel( "Destination CRS is invalid!", 4 );
return false;
}

@@ -768,10 +768,10 @@ double QgsDistanceArea::convertLengthMeasurement( double length, QgsUnitTypes::D
double factorUnits = QgsUnitTypes::fromUnitToUnitFactor( measureUnits, toUnits );

double result = length * factorUnits;
QgsDebugMsg( QString( "Converted length of %1 %2 to %3 %4" ).arg( length )
.arg( QgsUnitTypes::toString( measureUnits ) )
.arg( result )
.arg( QgsUnitTypes::toString( toUnits ) ) );
QgsDebugMsgLevel( QString( "Converted length of %1 %2 to %3 %4" ).arg( length )
.arg( QgsUnitTypes::toString( measureUnits ) )
.arg( result )
.arg( QgsUnitTypes::toString( toUnits ) ), 3 );
return result;
}

@@ -782,9 +782,9 @@ double QgsDistanceArea::convertAreaMeasurement( double area, QgsUnitTypes::AreaU
double factorUnits = QgsUnitTypes::fromUnitToUnitFactor( measureUnits, toUnits );

double result = area * factorUnits;
QgsDebugMsg( QString( "Converted area of %1 %2 to %3 %4" ).arg( area )
.arg( QgsUnitTypes::toString( measureUnits ) )
.arg( result )
.arg( QgsUnitTypes::toString( toUnits ) ) );
QgsDebugMsgLevel( QString( "Converted area of %1 %2 to %3 %4" ).arg( area )
.arg( QgsUnitTypes::toString( measureUnits ) )
.arg( result )
.arg( QgsUnitTypes::toString( toUnits ) ), 3 );
return result;
}
@@ -151,7 +151,7 @@ QgsEllipsoidUtils::EllipsoidParameters QgsEllipsoidUtils::ellipsoidParameters( c
return params;
}

QgsDebugMsg( QString( "setEllipsoid: a=%1, b=%2, 1/f=%3" ).arg( params.semiMajor ).arg( params.semiMinor ).arg( params.inverseFlattening ) );
QgsDebugMsgLevel( QString( "setEllipsoid: a=%1, b=%2, 1/f=%3" ).arg( params.semiMajor ).arg( params.semiMinor ).arg( params.inverseFlattening ), 4 );


// get spatial ref system for ellipsoid
@@ -679,7 +679,7 @@ bool QgsProject::_getMapLayers( const QDomDocument &doc, QList<QDomNode> &broken
bool QgsProject::addLayer( const QDomElement &layerElem, QList<QDomNode> &brokenNodes )
{
QString type = layerElem.attribute( QStringLiteral( "type" ) );
QgsDebugMsg( "Layer type is " + type );
QgsDebugMsgLevel( "Layer type is " + type, 4 );
QgsMapLayer *mapLayer = nullptr;

if ( type == QLatin1String( "vector" ) )
@@ -83,7 +83,7 @@ double QgsScaleCalculator::calculate( const QgsRectangle &mapExtent, int canvasW
return 0;
}
double scale = ( delta * conversionFactor ) / ( static_cast< double >( canvasWidth ) / mDpi );
QgsDebugMsg( QString( "scale = %1 conversionFactor = %2" ).arg( scale ).arg( conversionFactor ) );
QgsDebugMsgLevel( QString( "scale = %1 conversionFactor = %2" ).arg( scale ).arg( conversionFactor ), 4 );
return scale;
}

@@ -126,7 +126,7 @@ double QgsScaleCalculator::calculateGeographicDistance( const QgsRectangle &mapE
pow( 1.0 - E * E * sin( lat * RADS ) * sin( lat * RADS ), 1.5 );
double meters = ( mapExtent.xMaximum() - mapExtent.xMinimum() ) / 180.0 * radius * c;

QgsDebugMsg( "Distance across map extent (m): " + QString::number( meters ) );
QgsDebugMsgLevel( "Distance across map extent (m): " + QString::number( meters ), 4 );

return meters;
}
Loading

0 comments on commit cbf5e9c

Please sign in to comment.