Skip to content

Commit

Permalink
replaced std::couts in QgsCoordinateTransform
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5460 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed May 15, 2006
1 parent 156dc45 commit e7a9f4e
Showing 1 changed file with 37 additions and 53 deletions.
90 changes: 37 additions & 53 deletions src/gui/qgscoordinatetransform.cpp
Expand Up @@ -17,6 +17,7 @@
/* $Id$ */
#include <cassert>
#include "qgscoordinatetransform.h"
#include "qgslogger.h"

//qt includes
#include <QDomNode>
Expand Down Expand Up @@ -88,9 +89,7 @@ void QgsCoordinateTransform::setSourceSRS(const QgsSpatialRefSys& theSRS)
}
void QgsCoordinateTransform::setDestSRS(const QgsSpatialRefSys& theSRS)
{
#ifdef QGISDEBUG
std::cout << "QgsCoordinateTransform::setDestSRS called" << std::endl;
#endif
QgsDebugMsg("QgsCoordinateTransform::setDestSRS called");
mDestSRS = theSRS;
initialise();
}
Expand All @@ -99,9 +98,7 @@ void QgsCoordinateTransform::setDestSRS(const QgsSpatialRefSys& theSRS)
void QgsCoordinateTransform::setDestSRSID (long theSRSID)
{
//!todo Add some logic here to determine if the srsid is a system or user one
#ifdef QGISDEBUG
std::cout << "QgsCoordinateTransform::setDestSRSID slot called" << std::endl;
#endif
QgsDebugMsg("QgsCoordinateTransform::setDestSRSID slot called");
mDestSRS.createFromSrsId(theSRSID);
initialise();
}
Expand Down Expand Up @@ -162,25 +159,23 @@ void QgsCoordinateTransform::initialise()
{
mInitialisedFlag = false;
}

#ifdef QGISDEBUG
if (mInitialisedFlag)
{
#ifdef QGISDEBUG
std::cout << "------------------------------------------------------------\n"
<< "QgsCoordinateTransform::initialise()\n"
<< "The OGR Coordinate transformation for this layer was set to\n"
<< "INPUT: \n" << mSourceSRS << '\n'
<< "OUTPUT: \n" << mDestSRS << '\n'
<< "------------------------------------------------------------\n";
QgsDebugMsg("------------------------------------------------------------");
QgsDebugMsg("QgsCoordinateTransform::initialise()");
QgsDebugMsg("The OGR Coordinate transformation for this layer was set to");
QgsLogger::debug<QgsSpatialRefSys>("Input", mSourceSRS, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug<QgsSpatialRefSys>("Output", mDestSRS, __FILE__, __FUNCTION__, __LINE__);
QgsDebugMsg("------------------------------------------------------------");
}
else
{
std::cout<< "------------------------------------------------------------\n"
<< "QgsCoordinateTransform::initialise()\n"
<< "The OGR Coordinate transformation FAILED TO INITIALISE!\n"
<< "------------------------------------------------------------\n";
#endif
QgsDebugMsg("------------------------------------------------------------");
QgsDebugMsg("The OGR Coordinate transformation FAILED TO INITIALISE!");
QgsDebugMsg("------------------------------------------------------------");
}
#endif
}

//
Expand All @@ -205,7 +200,7 @@ QgsPoint QgsCoordinateTransform::transform(const QgsPoint thePoint,TransformDire
catch(QgsCsException &cse)
{
// rethrow the exception
std::cout << "Throwing exception " << __FILE__ << __LINE__ << std::endl;
QgsLogger::warning("Throwing exception " + QString(__FILE__) + QString(__LINE__));
throw cse;
}

Expand All @@ -225,7 +220,7 @@ QgsPoint QgsCoordinateTransform::transform(const double theX, const double theY=
catch(QgsCsException &cse)
{
// rethrow the exception
std::cout << "Throwing exception " << __FILE__ << __LINE__ << std::endl;
QgsLogger::warning("Throwing exception " + QString(__FILE__) + QString(__LINE__));
throw cse;
}
}
Expand All @@ -239,9 +234,6 @@ QgsRect QgsCoordinateTransform::transform(const QgsRect theRect,TransformDirecti
double x2 = theRect.xMax();
double y2 = theRect.yMax();

#ifdef QGISDEBUG
std::cout << this;
#endif
// Number of points to reproject------+
// |
// V
Expand All @@ -254,25 +246,20 @@ QgsRect QgsCoordinateTransform::transform(const QgsRect theRect,TransformDirecti
catch(QgsCsException &cse)
{
// rethrow the exception
std::cout << "Throwing exception " << __FILE__ << __LINE__ << std::endl;
QgsLogger::warning("Throwing exception " + QString(__FILE__) + QString(__LINE__));
throw cse;
}

#ifdef QGISDEBUG
std::cout << "Rect projection..."
<< "Xmin : "
<< theRect.xMin()
<< "-->" << x1
<< ", Ymin: "
<< theRect.yMin()
<< " -->" << y1
<< "Xmax : "
<< theRect.xMax()
<< "-->" << x2
<< ", Ymax: "
<< theRect.yMax()
<< " -->" << y2
<< std::endl;
QgsDebugMsg("Rect projection...");
QgsLogger::debug("Xmin : ", theRect.xMin(), 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("-->", x1, 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("Ymin : ", theRect.yMin(), 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("-->", y1, 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("Xmax : ", theRect.xMax(), 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("-->", x2, 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("Ymax : ", theRect.yMax(), 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("-->", y2, 1, __FILE__, __FUNCTION__, __LINE__);
#endif
return QgsRect(x1, y1, x2 , y2);
}
Expand All @@ -292,8 +279,8 @@ void QgsCoordinateTransform::transformInPlace(double& x, double& y, double& z,
}
catch(QgsCsException &cse)
{
// rethrow the exception
std::cout << "Throwing exception " << __FILE__ << __LINE__ << std::endl;
// rethrow the exception
QgsLogger::warning("Throwing exception " + QString(__FILE__) + QString(__LINE__));
throw cse;
}
}
Expand All @@ -319,7 +306,7 @@ void QgsCoordinateTransform::transformInPlace(std::vector<double>& x,
catch(QgsCsException &cse)
{
// rethrow the exception
std::cout << "Throwing exception " << __FILE__ << __LINE__ << std::endl;
QgsLogger::warning("Throwing exception " + QString(__FILE__) + QString(__LINE__));
throw cse;
}
}
Expand All @@ -346,9 +333,7 @@ QgsRect QgsCoordinateTransform::transformBoundingBox(const QgsRect rect, Transfo
double x[numP * numP];
double y[numP * numP];
double z[numP * numP];
#ifdef QGISDEBUG
std::cout << "Entering transformBoundingBox..." << std::endl;
#endif
QgsDebugMsg("Entering transformBoundingBox...");
// Populate the vectors

double dx = rect.width() / (double)(numP - 1);
Expand Down Expand Up @@ -384,7 +369,7 @@ QgsRect QgsCoordinateTransform::transformBoundingBox(const QgsRect rect, Transfo
catch(QgsCsException &cse)
{
// rethrow the exception
std::cout << "Throwing exception " << __FILE__ << __LINE__ << std::endl;
QgsLogger::warning("Throwing exception " + QString(__FILE__) + QString(__LINE__));
throw cse;
}

Expand All @@ -395,8 +380,9 @@ QgsRect QgsCoordinateTransform::transformBoundingBox(const QgsRect rect, Transfo
bb_rect.combineExtentWith(x[i], y[i]);
}
#ifdef QGISDEBUG
std::cout << "Projected extent: " << (bb_rect.stringRep()).toLocal8Bit().data() << std::endl;
QgsDebugMsg("Projected extent: " + QString((bb_rect.stringRep()).toLocal8Bit().data()));
#endif

return bb_rect;
}

Expand Down Expand Up @@ -472,10 +458,10 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d

pjErr << tr("with error: ") << pj_strerrno(projResult) << '\n';
#ifdef QGISDEBUG
std::cout << "Projection failed emitting invalid transform signal: \n" << msg.toLocal8Bit().data() << std::endl;
QgsDebugMsg("Projection failed emitting invalid transform signal: " + QString(msg.toLocal8Bit().data()));
#endif
emit invalidTransformInput();
std::cout << "Throwing exception " << __FILE__ << __LINE__ << std::endl;
emit invalidTransformInput();
QgsLogger::warning("Throwing exception " + QString(__FILE__) + QString(__LINE__));
throw QgsCsException(msg);
}
// if the result is lat/long, convert the results from radians back
Expand All @@ -497,9 +483,7 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d

bool QgsCoordinateTransform::readXML( QDomNode & theNode )
{
#ifdef QGISDEBUG
std::cout << "Reading Coordinate Transform from xml ------------------------!" << std::endl;
#endif
QgsDebugMsg("Reading Coordinate Transform from xml ------------------------!");
QDomNode mySrcNodeParent = theNode.namedItem("sourcesrs");
QDomNode mySrcNode = mySrcNodeParent.namedItem("spatialrefsys");
mSourceSRS.readXML(mySrcNode);
Expand Down

0 comments on commit e7a9f4e

Please sign in to comment.