Skip to content

Commit

Permalink
fix warnings in interpolation plugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9130 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Aug 23, 2008
1 parent 42b4a21 commit 3f5e5c2
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 117 deletions.
3 changes: 2 additions & 1 deletion src/plugins/interpolation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ADD_LIBRARY (interpolationplugin MODULE ${INTERPOLATION_SRCS} ${INTERPOLATION_MO

INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${GEOS_INCLUDE_DIR}
../../core ../../core/raster ../../core/renderer ../../core/symbology
../../gui
..
Expand All @@ -64,4 +65,4 @@ TARGET_LINK_LIBRARIES(interpolationplugin

INSTALL(TARGETS interpolationplugin
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
131 changes: 65 additions & 66 deletions src/plugins/interpolation/DualEdgeTriangulation.cc

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/plugins/interpolation/DualEdgeTriangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef DUALEDGETRIANGULATION_H
#define DUALEDGETRIANGULATION_H

using namespace std;

#include "Triangulation.h"
#include "HalfEdge.h"
#include <QVector>
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/interpolation/HalfEdge.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef HALFEDGE_H
#define HALFEDGE_H

using namespace std;

class HalfEdge
{
protected:
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/interpolation/LinTriangleInterpolator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool LinTriangleInterpolator::calcFirstDerX(double x, double y, Vector3D* vec)

else
{
cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerX" << endl << flush;
std::cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerX" << std::endl << std::flush;
return false;
}
}
Expand All @@ -65,7 +65,7 @@ bool LinTriangleInterpolator::calcFirstDerY(double x, double y, Vector3D* vec)

else
{
cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << endl << flush;
std::cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << std::endl << std::flush;
return false;
}
}
Expand All @@ -91,7 +91,7 @@ bool LinTriangleInterpolator::calcNormVec(double x, double y, Vector3D* vec)

else
{
cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << endl << flush;
std::cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << std::endl << std::flush;
return false;
}

Expand Down Expand Up @@ -122,7 +122,7 @@ bool LinTriangleInterpolator::calcPoint(double x, double y, Point3D* point)
}
else
{
cout << "warning, null pointer in LinTriangleInterpolator::calcPoint" << endl << flush;
std::cout << "warning, null pointer in LinTriangleInterpolator::calcPoint" << std::endl << std::flush;
return false;
}

Expand Down
2 changes: 0 additions & 2 deletions src/plugins/interpolation/LinTriangleInterpolator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef LINTRIANGLEINTERPOLATOR_H
#define LINTRIANGLEINTERPOLATOR_H

using namespace std;

#include "TriangleInterpolator.h"
#include "DualEdgeTriangulation.h"

Expand Down
2 changes: 0 additions & 2 deletions src/plugins/interpolation/Line3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef LINE3D_H
#define LINE3D_H

using namespace std;

#include "Point3D.h"
#include "Node.h"

Expand Down
56 changes: 29 additions & 27 deletions src/plugins/interpolation/MathUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ bool MathUtils::calcBarycentricCoordinates(double x, double y, Point3D* p1, Poin
double area=triArea(p1,p2,p3);
if(area==0)//p1, p2, p3 are in a line
{
cout << "warning, triangle area should not be 0 in MathUtils::calcBarycentricCoordinates" << endl << flush;
std::cout << "warning, triangle area should not be 0 in MathUtils::calcBarycentricCoordinates" << std::endl << std::flush;
return false;
}
double area1=triArea(&p,p2,p3);
Expand All @@ -41,7 +41,7 @@ bool MathUtils::calcBarycentricCoordinates(double x, double y, Point3D* p1, Poin
}
else//null pointer
{
cout << "warning, null pointer in MathUtils::calcBarycentricCoordinates" << endl << flush;
std::cout << "warning, null pointer in MathUtils::calcBarycentricCoordinates" << std::endl << std::flush;
return false;
}
}
Expand All @@ -55,7 +55,7 @@ bool MathUtils::BarycentricToXY(double u, double v, double w, Point3D* p1, Point

if(area==0)
{
cout << "warning, p1, p2 and p3 are in a line in MathUtils::BarycentricToXY" << endl << flush;
std::cout << "warning, p1, p2 and p3 are in a line in MathUtils::BarycentricToXY" << std::endl << std::flush;
return false;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ bool MathUtils::BarycentricToXY(double u, double v, double w, Point3D* p1, Point
}
else//null pointer
{
cout << "warning, null pointer in MathUtils::BarycentricToXY" << endl << flush;
std::cout << "warning, null pointer in MathUtils::BarycentricToXY" << std::endl << std::flush;
return false;
}
}
Expand Down Expand Up @@ -127,14 +127,15 @@ bool MathUtils::circumcenter(Point3D* p1, Point3D* p2, Point3D* p3, Point3D* res
//if one of the denominator is zero we will have problems
if(denominator==0)
{
cout << "error in MathUtils::circumcenter, the three points are in a line" << endl << flush;
std::cout << "error in MathUtils::circumcenter, the three points are in a line" << std::endl << std::flush;
return false;
}
else
{
result->setX(0.5*(p1->getX()*p1->getX()*p2->getY()-p1->getX()*p1->getX()*p3->getY()-p3->getX()*p3->getX()*p2->getY()-p1->getY()*p2->getX()*p2->getX()-p1->getY()*p1->getY()*p3->getY()-p3->getY()*p3->getY()*p2->getY()+p1->getY()*p1->getY()*p2->getY()+p3->getY()*p2->getX()*p2->getX()-p1->getY()*p2->getY()*p2->getY()+p1->getY()*p3->getY()*p3->getY()+p1->getY()*p3->getX()*p3->getX()+p3->getY()*p2->getY()*p2->getY())/denominator);
result->setY(-0.5*(p3->getX()*p2->getX()*p2->getX()+p2->getX()*p1->getY()*p1->getY()+p3->getX()*p2->getY()*p2->getY()-p3->getX()*p1->getX()*p1->getX()+p1->getX()*p3->getY()*p3->getY()-p3->getX()*p1->getY()*p1->getY()-p1->getX()*p2->getX()*p2->getX()-p2->getX()*p3->getY()*p3->getY()-p1->getX()*p2->getY()*p2->getY()-p2->getX()*p3->getX()*p3->getX()+p1->getX()*p3->getX()*p3->getX()+p2->getX()*p1->getX()*p1->getX())/denominator);

#if 0
//debugging: test, if the distances from p1, p2, p3 to result are equal
double dist1=sqrt((p1->getX()-result->getX())*(p1->getX()-result->getX())+(p1->getY()-result->getY())*(p1->getY()-result->getY()));
double dist2=sqrt((p2->getX()-result->getX())*(p2->getX()-result->getX())+(p2->getY()-result->getY())*(p2->getY()-result->getY()));
Expand All @@ -144,13 +145,14 @@ bool MathUtils::circumcenter(Point3D* p1, Point3D* p2, Point3D* p3, Point3D* res
{
bool debug=true;
}
#endif

return true;
}
}
else
{
cout << "null pointer in method MathUtils::circumcenter" << endl << flush;
std::cout << "null pointer in method MathUtils::circumcenter" << std::endl << std::flush;
return false;
}
}
Expand Down Expand Up @@ -206,7 +208,7 @@ double MathUtils::distPointFromLine(Point3D* thepoint, Point3D* p1, Point3D* p2)
}
else
{
cout << "null pointer in method MathUtils::distPointFromLine" << endl << flush;
std::cout << "null pointer in method MathUtils::distPointFromLine" << std::endl << std::flush;
return 0;
}
}
Expand All @@ -215,7 +217,7 @@ int MathUtils::faculty(int n)
{
if(n<0)//Is faculty also defined for negative integers?
{
cout << "Error, faculty of a negativ integer requested!" << endl;
std::cout << "Error, faculty of a negativ integer requested!" << std::endl;
return 0;
}
int i;
Expand Down Expand Up @@ -279,7 +281,7 @@ bool MathUtils::inCircle(Point3D* testp, Point3D* p1, Point3D* p2, Point3D* p3)
}
else
{
cout << "null pointer in MathUtils::inCircle" << endl << flush;
std::cout << "null pointer in MathUtils::inCircle" << std::endl << std::flush;
return false;
}
}
Expand Down Expand Up @@ -322,7 +324,7 @@ double MathUtils::leftOf(Point3D* thepoint, Point3D* p1, Point3D* p2)
}
else
{
cout << "Null pointer in MathUtils::leftOf" << endl << flush;
std::cout << "Null pointer in MathUtils::leftOf" << std::endl << std::flush;
return 0;
}
}
Expand Down Expand Up @@ -365,7 +367,7 @@ bool MathUtils::lineIntersection(Point3D* p1, Point3D* p2, Point3D* p3, Point3D*

else
{
cout << "null pointer in MathUtils::lineIntersection" << endl << flush;
std::cout << "null pointer in MathUtils::lineIntersection" << std::endl << std::flush;
return false;
}
}
Expand Down Expand Up @@ -418,7 +420,7 @@ bool MathUtils::lineIntersection(Point3D* p1, Point3D* p2, Point3D* p3, Point3D*

else
{
cout << "null pointer in MathUtils::lineIntersection" << endl << flush;
std::cout << "null pointer in MathUtils::lineIntersection" << std::endl << std::flush;
return false;
}
}
Expand Down Expand Up @@ -497,7 +499,7 @@ double MathUtils::triArea(Point3D* pa, Point3D* pb, Point3D* pc)
}
else//null pointer
{
cout << "Null pointer in MathUtils::triArea" << endl << flush;
std::cout << "Null pointer in MathUtils::triArea" << std::endl << std::flush;
return 0;
}
}
Expand All @@ -506,7 +508,7 @@ double MathUtils::calcCubicHermitePoly(int n, int i, double t)
{
if(n!=3||i>n)
{
cout << "error, can't calculate hermite polynom" << endl;
std::cout << "error, can't calculate hermite polynom" << std::endl;
}

if(n==3&&i==0)
Expand All @@ -530,7 +532,7 @@ double MathUtils::calcCubicHermitePoly(int n, int i, double t)
}
else//somthing went wrong
{
cout << "Error in MathUtils::calcCubicHermitePoly" << endl << flush;
std::cout << "Error in MathUtils::calcCubicHermitePoly" << std::endl << std::flush;
return 0;
}
}
Expand All @@ -539,7 +541,7 @@ double MathUtils::cFDerCubicHermitePoly(int n, int i, double t)
{
if(n!=3||i>n)
{
cout << "error, can't calculate hermite polynom" << endl;
std::cout << "error, can't calculate hermite polynom" << std::endl;
}

if(n==3&&i==0)
Expand Down Expand Up @@ -569,7 +571,7 @@ double MathUtils::cFDerCubicHermitePoly(int n, int i, double t)
}
else
{
cout << "Error in MathUtils::cFDerCubicHermitePoly" << endl << flush;
std::cout << "Error in MathUtils::cFDerCubicHermitePoly" << std::endl << std::flush;
return 0;
}
}
Expand Down Expand Up @@ -617,7 +619,7 @@ bool MathUtils::normalLeft(Vector3D* v1, Vector3D* result, double length)

if(d<0)//no solution in R
{
cout << "Determinant Error in MathUtils::normalLeft" << endl;
std::cout << "Determinant Error in MathUtils::normalLeft" << std::endl;
return false;
}

Expand Down Expand Up @@ -674,7 +676,7 @@ bool MathUtils::normalRight(Vector3D* v1, Vector3D* result, double length)

if(d<0)//no solution in R
{
cout << "Determinant Error in MathUtils::normalLeft" << endl;
std::cout << "Determinant Error in MathUtils::normalLeft" << std::endl;
return false;
}

Expand Down Expand Up @@ -736,15 +738,15 @@ double MathUtils::crossVec(Point3D* first, Vector3D* vec1, Point3D* second, Vect
}
else//if a division through zero would occur
{
cout << "warning in MathUtils::crossVec(...): vectors parallel to each other" << endl << flush;
std::cout << "warning in MathUtils::crossVec(...): vectors parallel to each other" << std::endl << std::flush;
return 0;
}
}


else//null pointer
{
cout << "warning in MathUtils::crossVec(...): null pointer" << endl << flush;
std::cout << "warning in MathUtils::crossVec(...): null pointer" << std::endl << std::flush;
return 0;
}
}
Expand Down Expand Up @@ -786,7 +788,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*
double xgalpha1=1/(2*xt*xt*yw*yw*zt*zt-2*zt*zt*zt*xt*zw*xw+yt*yt*yt*yt*zw*zw+yt*yt*zw*zw*zt*zt+xt*xt*yt*yt*xw*xw+xt*xt*yw*yw*yt*yt-2*xt*xt*xt*zt*zw*xw+yt*yt*yt*yt*xw*xw+yt*yt*yw*yw*zt*zt+2*xt*xt*yt*yt*zw*zw-2*yt*yt*yt*yw*zt*zw+zt*zt*xt*xt*zw*zw+zt*zt*zt*zt*xw*xw+xt*xt*zt*zt*xw*xw+2*zt*zt*xw*xw*yt*yt-2*xt*xt*yw*zt*yt*zw-2*xt*yt*yt*yt*xw*yw-2*xt*xt*xt*yw*yt*xw-2*xt*zt*zt*xw*yt*yw-2*xt*zt*xw*yt*yt*zw-2*yw*zt*zt*zt*yt*zw+xt*xt*xt*xt*yw*yw+yw*yw*zt*zt*zt*zt+xt*xt*xt*xt*zw*zw);
if(xgalpha1<0)
{
cout << "warning, only complex solution of xg in MathUtils::normalMinDistance" << endl << flush;
std::cout << "warning, only complex solution of xg in MathUtils::normalMinDistance" << std::endl << std::flush;
return false;
}
xg1=sqrt(xgalpha1)*(-yt*yw*xt+yt*yt*xw+xw*zt*zt-zt*xt*zw);
Expand All @@ -796,7 +798,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*
double ygalpha1=1/(2*xt*xt*yw*yw*zt*zt-2*zt*zt*zt*xt*zw*xw+yt*yt*yt*yt*zw*zw+yt*yt*zw*zw*zt*zt+xt*xt*yt*yt*xw*xw+xt*xt*yw*yw*yt*yt-2*xt*xt*xt*zt*zw*xw+yt*yt*yt*yt*xw*xw+yt*yt*yw*yw*zt*zt+2*xt*xt*yt*yt*zw*zw-2*yt*yt*yt*yw*zt*zw+zt*zt*xt*xt*zw*zw+zt*zt*zt*zt*xw*xw+xt*xt*zt*zt*xw*xw+2*zt*zt*xw*xw*yt*yt-2*xt*xt*yw*zt*yt*zw-2*xt*yt*yt*yt*xw*yw-2*xt*xt*xt*yw*yt*xw-2*xt*zt*zt*xw*yt*yw-2*xt*zt*xw*yt*yt*zw-2*yw*zt*zt*zt*yt*zw+xt*xt*xt*xt*yw*yw+yw*yw*zt*zt*zt*zt+xt*xt*xt*xt*zw*zw);
if(ygalpha1<0)
{
cout << "warning, only complex solution of yg in MathUtils::normalMinDistance" << endl << flush;
std::cout << "warning, only complex solution of yg in MathUtils::normalMinDistance" << std::endl << std::flush;
return false;
}
yg1=-sqrt(ygalpha1)*(-yw*xt*xt-zt*zt*yw+zt*yt*zw+yt*xw*xt);
Expand All @@ -806,7 +808,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*
double zgalpha1=1/(2*xt*xt*yw*yw*zt*zt-2*zt*zt*zt*xt*zw*xw+yt*yt*yt*yt*zw*zw+yt*yt*zw*zw*zt*zt+xt*xt*yt*yt*xw*xw+xt*xt*yw*yw*yt*yt-2*xt*xt*xt*zt*zw*xw+yt*yt*yt*yt*xw*xw+yt*yt*yw*yw*zt*zt+2*xt*xt*yt*yt*zw*zw-2*yt*yt*yt*yw*zt*zw+zt*zt*xt*xt*zw*zw+zt*zt*zt*zt*xw*xw+xt*xt*zt*zt*xw*xw+2*zt*zt*xw*xw*yt*yt-2*xt*xt*yw*zt*yt*zw-2*xt*yt*yt*yt*xw*yw-2*xt*xt*xt*yw*yt*xw-2*xt*zt*zt*xw*yt*yw-2*xt*zt*xw*yt*yt*zw-2*yw*zt*zt*zt*yt*zw+xt*xt*xt*xt*yw*yw+yw*yw*zt*zt*zt*zt+xt*xt*xt*xt*zw*zw);
if(zgalpha1<0)
{
cout << "warning, only complex solution of zg in MathUtils::normalMinDistance" << endl << flush;
std::cout << "warning, only complex solution of zg in MathUtils::normalMinDistance" << std::endl << std::flush;
return false;
}
zg1=-sqrt(zgalpha1)*(yt*yw*zt-yt*yt*zw+xw*zt*xt-xt*xt*zw);
Expand All @@ -832,7 +834,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*

else
{
cout << "warning, null pointer in MathUtils::normalMinDistance" << endl << flush;
std::cout << "warning, null pointer in MathUtils::normalMinDistance" << std::endl << std::flush;
return false;
}
}
Expand All @@ -850,7 +852,7 @@ double MathUtils::planeTest(Point3D* test, Point3D* pt1, Point3D* pt2, Point3D*
}
else
{
cout << "warning, null pointer in MathUtils::planeTest" << endl << flush;
std::cout << "warning, null pointer in MathUtils::planeTest" << std::endl << std::flush;
return 0;
}
}
Expand All @@ -866,7 +868,7 @@ double MathUtils::angle(Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4)
}
else
{
cout << "warning, null pointer in MathUtils::angle" << endl << flush;
std::cout << "warning, null pointer in MathUtils::angle" << std::endl << std::flush;
return 0;
}
}
2 changes: 0 additions & 2 deletions src/plugins/interpolation/MathUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef MATHUTILS_H
#define MATHUTILS_H

using namespace std;

#include <cmath>
#include "Vector3D.h"
#include "Point3D.h"
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/interpolation/Node.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef NODE_H
#define NODE_H

using namespace std;

#include "Point3D.h"
#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/interpolation/Point3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ double Point3D::dist3D(Point3D* p) const
}
else
{
cout << "warning, null pointer in Point3D::dist3D" << endl << flush;
std::cout << "warning, null pointer in Point3D::dist3D" << std::endl << std::flush;
return 0;
}
}
2 changes: 0 additions & 2 deletions src/plugins/interpolation/Point3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef POINT3D_H
#define POINT3D_H

using namespace std;

#include <cmath>
#include <iostream>

Expand Down
2 changes: 0 additions & 2 deletions src/plugins/interpolation/Vector3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef VECTOR3D_H
#define VECTOR3D_H

using namespace std;

#include <cmath>

class Vector3D
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/interpolation/mIconInterpolation.xpm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* XPM */
static char *mIconInterpolation[]={
static const char *mIconInterpolation[]={
"32 28 2 1",
". c None",
"# c #000000",
Expand Down
Loading

0 comments on commit 3f5e5c2

Please sign in to comment.