Skip to content
Permalink
Browse files

made QgsLogger less verbose, replaced some std::couts in QgsRasterLayer

git-svn-id: http://svn.osgeo.org/qgis/trunk@5180 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Apr 5, 2006
1 parent 8bccd65 commit 10952a7f145ef3232c281ce067549e7970c809a7
Showing with 226 additions and 316 deletions.
  1. +11 −11 src/core/qgslogger.cpp
  2. +2 −4 src/core/qgslogger.h
  3. +15 −31 src/gui/qgsmaplayer.cpp
  4. +198 −270 src/raster/qgsrasterlayer.cpp
@@ -38,15 +38,15 @@ void QgsLogger::debug(const QString& msg, int debuglevel, const char* file, cons
}
else if(function == NULL)
{
qDebug("File: %s, Message: %s", file, msg.toLocal8Bit().data());
qDebug("%s: %s", file, msg.toLocal8Bit().data());
}
else if(line == -1)
{
qDebug("File: %s, Function: %s, Message: %s", file, function, msg.toLocal8Bit().data());
qDebug("%s: (%s) %s", file, function, msg.toLocal8Bit().data());
}
else
{
qDebug("File: %s, Function: %s, Line: %d, Message: %s", file, function, line, msg.toLocal8Bit().data());
qDebug("%s: %d: (%s) %s", file, line, function, msg.toLocal8Bit().data());
}
}
}
@@ -67,19 +67,19 @@ void QgsLogger::debug(const QString& var, int val, int debuglevel, const char* f
{
if(file == NULL)
{
qDebug("Variable: %s, Value: %d", var.toLocal8Bit().data(), val);
qDebug("%s: %d", var.toLocal8Bit().data(), val);
}
else if(function == NULL)
{
qDebug("File: %s, Variable: %s, Value: %d", file, var.toLocal8Bit().data(), val);
qDebug("%s: %s: %d", file, var.toLocal8Bit().data(), val);
}
else if(line == -1)
{
qDebug("File: %s, Function: %s, Variable: %s, Value: %d", file, function, var.toLocal8Bit().data(), val);
qDebug("%s: (%s): %s: %d", file, function, var.toLocal8Bit().data(), val);
}
else
{
qDebug("File: %s, Function: %s, Line: %d, Variable: %s, Value: %d", file, function, line, var.toLocal8Bit().data(), val);
qDebug("%s: %d: (%s), %s: %d", file, line, function, var.toLocal8Bit().data(), val);
}
}
}
@@ -100,19 +100,19 @@ void QgsLogger::debug(const QString& var, double val, int debuglevel, const char
{
if(file == NULL)
{
qDebug("Variable: %s, Value: %f", var.toLocal8Bit().data(), val);
qDebug("%s: %f", var.toLocal8Bit().data(), val);
}
else if(function == NULL)
{
qDebug("File: %s, Variable: %s, Value: %f", file, var.toLocal8Bit().data(), val);
qDebug("%s: %s: %f", file, var.toLocal8Bit().data(), val);
}
else if(line == -1)
{
qDebug("File: %s, Function: %s, Variable: %s, Value: %f", file, function, var.toLocal8Bit().data(), val);
qDebug("%s: (%s): %s: %f", file, function, var.toLocal8Bit().data(), val);
}
else
{
qDebug("File: %s, Function: %s, Line: %d, Variable: %s, Value: %f", file, function, line, var.toLocal8Bit().data(), val);
qDebug("%s: %d: (%s), %s: %d", file, line, function, var.toLocal8Bit().data(), val);
}
}
}
@@ -72,13 +72,11 @@ class QgsLogger
os << var.toLocal8Bit().data() << " = " << val;
if(line == -1)
{
qDebug("File: %s\nFunction: %s\nMessage: %s",
file, function, os.str().c_str());
qDebug("%s: (%s) %s", file, function, os.str().c_str());
}
else
{
qDebug("File: %s\nFunction: %s\nLine: %s\nMessage: %s", file, function, \
QString::number(line).toLocal8Bit().data(), os.str().c_str());
qDebug("%s: %d: (%s) %s", file, line, function, os.str().c_str());
}
}

@@ -31,6 +31,7 @@
#include <QMenu>

#include "qgisapp.h"
#include "qgslogger.h"
#include "qgsmaptopixel.h"
#include "qgsrect.h"
#include "qgsproject.h"
@@ -58,16 +59,11 @@ QgsMapLayer::QgsMapLayer(int type,
m_visible(true)

{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::QgsMapLayer - lyrname is '" << lyrname.toLocal8Bit().data() << "'."<< std::endl;
#endif
QgsDebugMsg("QgsMapLayer::QgsMapLayer - lyrname is '" + lyrname);

// Set the display name = internal name
layerName = internalName;

#ifdef QGISDEBUG
std::cout << "QgsMapLayer::QgsMapLayer - layerName is '" << layerName.toLocal8Bit().data() << "'."<< std::endl;
#endif
QgsDebugMsg("QgsMapLayer::QgsMapLayer - layerName is '" + layerName);

// Generate the unique ID of this layer
QDateTime dt = QDateTime::currentDateTime();
@@ -84,9 +80,6 @@ QgsMapLayer::QgsMapLayer(int type,
mMinScale = 0;
mMaxScale = 100000000;
mScaleBasedVisibility = false;



}


@@ -110,19 +103,15 @@ QString const & QgsMapLayer::getLayerID() const
/** Write property of QString layerName. */
void QgsMapLayer::setLayerName(const QString & _newVal)
{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::setLayerName: new name is '" << _newVal.toLocal8Bit().data() << "'."<< std::endl;
#endif
layerName = _newVal;
QgsDebugMsg("QgsMapLayer::setLayerName: new name is '" + _newVal);
layerName = _newVal;
}

/** Read property of QString layerName. */
QString const & QgsMapLayer::name() const
{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::name: returning name '" << layerName.toLocal8Bit().data() << "'."<< std::endl;
#endif
return layerName;
QgsDebugMsg("QgsMapLayer::name: returning name '" + layerName);
return layerName;
}

QString const & QgsMapLayer::source() const
@@ -464,9 +453,7 @@ void QgsMapLayer::updateItemPixmap()

void QgsMapLayer::invalidTransformInput()
{
#ifdef QGISDEBUG
std::cout << " QgsMapLayer::invalidTransformInput() called" << std::endl;
#endif
QgsLogger::warning("QgsMapLayer::invalidTransformInput() called");
if (mLegendLayerFile) // XXX should we know about our legend?
{
QPixmap pix=mLegendLayerFile->getOriginalPixmap();
@@ -518,9 +505,7 @@ QString QgsMapLayer::errorString()

void QgsMapLayer::connectNotify( const char * signal )
{
#ifdef QGISDEBUG
std::cerr << "QgsMapLayer connected to " << signal << "\n";
#endif
QgsDebugMsg("QgsMapLayer connected to " + QString(signal));
} // QgsMapLayer::connectNotify


@@ -561,14 +546,14 @@ void QgsMapLayer::keyPressed ( QKeyEvent * e )
QgsCoordinateTransform * QgsMapLayer::coordinateTransform()
{
#ifdef QGISDEBUG
std::cout << "Maplayer asked for coordinateTransform which is...." ;
QgsDebugMsg("Maplayer asked for coordinateTransform which is....");
if (!mCoordinateTransform)
{
std::cout << "*NOT* valid" << std::endl;
QgsDebugMsg("*NOT* valid");
}
else
{
std::cout << "valid" << std::endl;
QgsDebugMsg("valid");
}

#endif
@@ -597,8 +582,8 @@ bool QgsMapLayer::projectExtent(QgsRect& extent, QgsRect& r2)
try
{
#ifdef QGISDEBUG
std::cerr << "Getting extent of canvas in layers CS. Canvas is "
<< extent << '\n';
QgsLogger::debug<QgsRect>("Getting extent of canvas in layers CS. Canvas is ", extent, __FILE__,\
__FUNCTION__, __LINE__);
#endif
// Split the extent into two if the source SRS is
// geographic and the extent crosses the split in
@@ -633,8 +618,7 @@ bool QgsMapLayer::projectExtent(QgsRect& extent, QgsRect& r2)
}
catch (QgsCsException &cse)
{
qDebug( "Transform error caught in %s line %d:\n%s",
__FILE__, __LINE__, cse.what());
QgsLogger::warning("Transform error caught in " + QString(__FILE__) + ", line " + QString::number(__LINE__));
extent = QgsRect(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX);
r2 = QgsRect(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX);
}

0 comments on commit 10952a7

Please sign in to comment.
You can’t perform that action at this time.