Skip to content

Commit c562efa

Browse files
author
jef
committed
fix warnings in interpolation plugin
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9130 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 2851a85 commit c562efa

16 files changed

+104
-117
lines changed

src/plugins/interpolation/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ADD_LIBRARY (interpolationplugin MODULE ${INTERPOLATION_SRCS} ${INTERPOLATION_MO
4747

4848
INCLUDE_DIRECTORIES(
4949
${CMAKE_CURRENT_BINARY_DIR}
50+
${GEOS_INCLUDE_DIR}
5051
../../core ../../core/raster ../../core/renderer ../../core/symbology
5152
../../gui
5253
..
@@ -64,4 +65,4 @@ TARGET_LINK_LIBRARIES(interpolationplugin
6465

6566
INSTALL(TARGETS interpolationplugin
6667
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
67-
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
68+
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})

src/plugins/interpolation/DualEdgeTriangulation.cc

Lines changed: 65 additions & 66 deletions
Large diffs are not rendered by default.

src/plugins/interpolation/DualEdgeTriangulation.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef DUALEDGETRIANGULATION_H
1818
#define DUALEDGETRIANGULATION_H
1919

20-
using namespace std;
21-
2220
#include "Triangulation.h"
2321
#include "HalfEdge.h"
2422
#include <QVector>

src/plugins/interpolation/HalfEdge.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef HALFEDGE_H
1818
#define HALFEDGE_H
1919

20-
using namespace std;
21-
2220
class HalfEdge
2321
{
2422
protected:

src/plugins/interpolation/LinTriangleInterpolator.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bool LinTriangleInterpolator::calcFirstDerX(double x, double y, Vector3D* vec)
3939

4040
else
4141
{
42-
cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerX" << endl << flush;
42+
std::cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerX" << std::endl << std::flush;
4343
return false;
4444
}
4545
}
@@ -65,7 +65,7 @@ bool LinTriangleInterpolator::calcFirstDerY(double x, double y, Vector3D* vec)
6565

6666
else
6767
{
68-
cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << endl << flush;
68+
std::cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << std::endl << std::flush;
6969
return false;
7070
}
7171
}
@@ -91,7 +91,7 @@ bool LinTriangleInterpolator::calcNormVec(double x, double y, Vector3D* vec)
9191

9292
else
9393
{
94-
cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << endl << flush;
94+
std::cout << "warning, null pointer in LinTriangleInterpolator::calcFirstDerY" << std::endl << std::flush;
9595
return false;
9696
}
9797

@@ -122,7 +122,7 @@ bool LinTriangleInterpolator::calcPoint(double x, double y, Point3D* point)
122122
}
123123
else
124124
{
125-
cout << "warning, null pointer in LinTriangleInterpolator::calcPoint" << endl << flush;
125+
std::cout << "warning, null pointer in LinTriangleInterpolator::calcPoint" << std::endl << std::flush;
126126
return false;
127127
}
128128

src/plugins/interpolation/LinTriangleInterpolator.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef LINTRIANGLEINTERPOLATOR_H
1818
#define LINTRIANGLEINTERPOLATOR_H
1919

20-
using namespace std;
21-
2220
#include "TriangleInterpolator.h"
2321
#include "DualEdgeTriangulation.h"
2422

src/plugins/interpolation/Line3D.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef LINE3D_H
1818
#define LINE3D_H
1919

20-
using namespace std;
21-
2220
#include "Point3D.h"
2321
#include "Node.h"
2422

src/plugins/interpolation/MathUtils.cc

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ bool MathUtils::calcBarycentricCoordinates(double x, double y, Point3D* p1, Poin
2525
double area=triArea(p1,p2,p3);
2626
if(area==0)//p1, p2, p3 are in a line
2727
{
28-
cout << "warning, triangle area should not be 0 in MathUtils::calcBarycentricCoordinates" << endl << flush;
28+
std::cout << "warning, triangle area should not be 0 in MathUtils::calcBarycentricCoordinates" << std::endl << std::flush;
2929
return false;
3030
}
3131
double area1=triArea(&p,p2,p3);
@@ -41,7 +41,7 @@ bool MathUtils::calcBarycentricCoordinates(double x, double y, Point3D* p1, Poin
4141
}
4242
else//null pointer
4343
{
44-
cout << "warning, null pointer in MathUtils::calcBarycentricCoordinates" << endl << flush;
44+
std::cout << "warning, null pointer in MathUtils::calcBarycentricCoordinates" << std::endl << std::flush;
4545
return false;
4646
}
4747
}
@@ -55,7 +55,7 @@ bool MathUtils::BarycentricToXY(double u, double v, double w, Point3D* p1, Point
5555

5656
if(area==0)
5757
{
58-
cout << "warning, p1, p2 and p3 are in a line in MathUtils::BarycentricToXY" << endl << flush;
58+
std::cout << "warning, p1, p2 and p3 are in a line in MathUtils::BarycentricToXY" << std::endl << std::flush;
5959
return false;
6060
}
6161

@@ -90,7 +90,7 @@ bool MathUtils::BarycentricToXY(double u, double v, double w, Point3D* p1, Point
9090
}
9191
else//null pointer
9292
{
93-
cout << "warning, null pointer in MathUtils::BarycentricToXY" << endl << flush;
93+
std::cout << "warning, null pointer in MathUtils::BarycentricToXY" << std::endl << std::flush;
9494
return false;
9595
}
9696
}
@@ -127,14 +127,15 @@ bool MathUtils::circumcenter(Point3D* p1, Point3D* p2, Point3D* p3, Point3D* res
127127
//if one of the denominator is zero we will have problems
128128
if(denominator==0)
129129
{
130-
cout << "error in MathUtils::circumcenter, the three points are in a line" << endl << flush;
130+
std::cout << "error in MathUtils::circumcenter, the three points are in a line" << std::endl << std::flush;
131131
return false;
132132
}
133133
else
134134
{
135135
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);
136136
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);
137137

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

148150
return true;
149151
}
150152
}
151153
else
152154
{
153-
cout << "null pointer in method MathUtils::circumcenter" << endl << flush;
155+
std::cout << "null pointer in method MathUtils::circumcenter" << std::endl << std::flush;
154156
return false;
155157
}
156158
}
@@ -206,7 +208,7 @@ double MathUtils::distPointFromLine(Point3D* thepoint, Point3D* p1, Point3D* p2)
206208
}
207209
else
208210
{
209-
cout << "null pointer in method MathUtils::distPointFromLine" << endl << flush;
211+
std::cout << "null pointer in method MathUtils::distPointFromLine" << std::endl << std::flush;
210212
return 0;
211213
}
212214
}
@@ -215,7 +217,7 @@ int MathUtils::faculty(int n)
215217
{
216218
if(n<0)//Is faculty also defined for negative integers?
217219
{
218-
cout << "Error, faculty of a negativ integer requested!" << endl;
220+
std::cout << "Error, faculty of a negativ integer requested!" << std::endl;
219221
return 0;
220222
}
221223
int i;
@@ -279,7 +281,7 @@ bool MathUtils::inCircle(Point3D* testp, Point3D* p1, Point3D* p2, Point3D* p3)
279281
}
280282
else
281283
{
282-
cout << "null pointer in MathUtils::inCircle" << endl << flush;
284+
std::cout << "null pointer in MathUtils::inCircle" << std::endl << std::flush;
283285
return false;
284286
}
285287
}
@@ -322,7 +324,7 @@ double MathUtils::leftOf(Point3D* thepoint, Point3D* p1, Point3D* p2)
322324
}
323325
else
324326
{
325-
cout << "Null pointer in MathUtils::leftOf" << endl << flush;
327+
std::cout << "Null pointer in MathUtils::leftOf" << std::endl << std::flush;
326328
return 0;
327329
}
328330
}
@@ -365,7 +367,7 @@ bool MathUtils::lineIntersection(Point3D* p1, Point3D* p2, Point3D* p3, Point3D*
365367

366368
else
367369
{
368-
cout << "null pointer in MathUtils::lineIntersection" << endl << flush;
370+
std::cout << "null pointer in MathUtils::lineIntersection" << std::endl << std::flush;
369371
return false;
370372
}
371373
}
@@ -418,7 +420,7 @@ bool MathUtils::lineIntersection(Point3D* p1, Point3D* p2, Point3D* p3, Point3D*
418420

419421
else
420422
{
421-
cout << "null pointer in MathUtils::lineIntersection" << endl << flush;
423+
std::cout << "null pointer in MathUtils::lineIntersection" << std::endl << std::flush;
422424
return false;
423425
}
424426
}
@@ -497,7 +499,7 @@ double MathUtils::triArea(Point3D* pa, Point3D* pb, Point3D* pc)
497499
}
498500
else//null pointer
499501
{
500-
cout << "Null pointer in MathUtils::triArea" << endl << flush;
502+
std::cout << "Null pointer in MathUtils::triArea" << std::endl << std::flush;
501503
return 0;
502504
}
503505
}
@@ -506,7 +508,7 @@ double MathUtils::calcCubicHermitePoly(int n, int i, double t)
506508
{
507509
if(n!=3||i>n)
508510
{
509-
cout << "error, can't calculate hermite polynom" << endl;
511+
std::cout << "error, can't calculate hermite polynom" << std::endl;
510512
}
511513

512514
if(n==3&&i==0)
@@ -530,7 +532,7 @@ double MathUtils::calcCubicHermitePoly(int n, int i, double t)
530532
}
531533
else//somthing went wrong
532534
{
533-
cout << "Error in MathUtils::calcCubicHermitePoly" << endl << flush;
535+
std::cout << "Error in MathUtils::calcCubicHermitePoly" << std::endl << std::flush;
534536
return 0;
535537
}
536538
}
@@ -539,7 +541,7 @@ double MathUtils::cFDerCubicHermitePoly(int n, int i, double t)
539541
{
540542
if(n!=3||i>n)
541543
{
542-
cout << "error, can't calculate hermite polynom" << endl;
544+
std::cout << "error, can't calculate hermite polynom" << std::endl;
543545
}
544546

545547
if(n==3&&i==0)
@@ -569,7 +571,7 @@ double MathUtils::cFDerCubicHermitePoly(int n, int i, double t)
569571
}
570572
else
571573
{
572-
cout << "Error in MathUtils::cFDerCubicHermitePoly" << endl << flush;
574+
std::cout << "Error in MathUtils::cFDerCubicHermitePoly" << std::endl << std::flush;
573575
return 0;
574576
}
575577
}
@@ -617,7 +619,7 @@ bool MathUtils::normalLeft(Vector3D* v1, Vector3D* result, double length)
617619

618620
if(d<0)//no solution in R
619621
{
620-
cout << "Determinant Error in MathUtils::normalLeft" << endl;
622+
std::cout << "Determinant Error in MathUtils::normalLeft" << std::endl;
621623
return false;
622624
}
623625

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

675677
if(d<0)//no solution in R
676678
{
677-
cout << "Determinant Error in MathUtils::normalLeft" << endl;
679+
std::cout << "Determinant Error in MathUtils::normalLeft" << std::endl;
678680
return false;
679681
}
680682

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

744746

745747
else//null pointer
746748
{
747-
cout << "warning in MathUtils::crossVec(...): null pointer" << endl << flush;
749+
std::cout << "warning in MathUtils::crossVec(...): null pointer" << std::endl << std::flush;
748750
return 0;
749751
}
750752
}
@@ -786,7 +788,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*
786788
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);
787789
if(xgalpha1<0)
788790
{
789-
cout << "warning, only complex solution of xg in MathUtils::normalMinDistance" << endl << flush;
791+
std::cout << "warning, only complex solution of xg in MathUtils::normalMinDistance" << std::endl << std::flush;
790792
return false;
791793
}
792794
xg1=sqrt(xgalpha1)*(-yt*yw*xt+yt*yt*xw+xw*zt*zt-zt*xt*zw);
@@ -796,7 +798,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*
796798
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);
797799
if(ygalpha1<0)
798800
{
799-
cout << "warning, only complex solution of yg in MathUtils::normalMinDistance" << endl << flush;
801+
std::cout << "warning, only complex solution of yg in MathUtils::normalMinDistance" << std::endl << std::flush;
800802
return false;
801803
}
802804
yg1=-sqrt(ygalpha1)*(-yw*xt*xt-zt*zt*yw+zt*yt*zw+yt*xw*xt);
@@ -806,7 +808,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*
806808
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);
807809
if(zgalpha1<0)
808810
{
809-
cout << "warning, only complex solution of zg in MathUtils::normalMinDistance" << endl << flush;
811+
std::cout << "warning, only complex solution of zg in MathUtils::normalMinDistance" << std::endl << std::flush;
810812
return false;
811813
}
812814
zg1=-sqrt(zgalpha1)*(yt*yw*zt-yt*yt*zw+xw*zt*xt-xt*xt*zw);
@@ -832,7 +834,7 @@ bool MathUtils::normalMinDistance(Vector3D* tangent, Vector3D* target, Vector3D*
832834

833835
else
834836
{
835-
cout << "warning, null pointer in MathUtils::normalMinDistance" << endl << flush;
837+
std::cout << "warning, null pointer in MathUtils::normalMinDistance" << std::endl << std::flush;
836838
return false;
837839
}
838840
}
@@ -850,7 +852,7 @@ double MathUtils::planeTest(Point3D* test, Point3D* pt1, Point3D* pt2, Point3D*
850852
}
851853
else
852854
{
853-
cout << "warning, null pointer in MathUtils::planeTest" << endl << flush;
855+
std::cout << "warning, null pointer in MathUtils::planeTest" << std::endl << std::flush;
854856
return 0;
855857
}
856858
}
@@ -866,7 +868,7 @@ double MathUtils::angle(Point3D* p1, Point3D* p2, Point3D* p3, Point3D* p4)
866868
}
867869
else
868870
{
869-
cout << "warning, null pointer in MathUtils::angle" << endl << flush;
871+
std::cout << "warning, null pointer in MathUtils::angle" << std::endl << std::flush;
870872
return 0;
871873
}
872874
}

src/plugins/interpolation/MathUtils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef MATHUTILS_H
1818
#define MATHUTILS_H
1919

20-
using namespace std;
21-
2220
#include <cmath>
2321
#include "Vector3D.h"
2422
#include "Point3D.h"

src/plugins/interpolation/Node.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef NODE_H
1818
#define NODE_H
1919

20-
using namespace std;
21-
2220
#include "Point3D.h"
2321
#include <iostream>
2422

src/plugins/interpolation/Point3D.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ double Point3D::dist3D(Point3D* p) const
4646
}
4747
else
4848
{
49-
cout << "warning, null pointer in Point3D::dist3D" << endl << flush;
49+
std::cout << "warning, null pointer in Point3D::dist3D" << std::endl << std::flush;
5050
return 0;
5151
}
5252
}

src/plugins/interpolation/Point3D.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef POINT3D_H
1818
#define POINT3D_H
1919

20-
using namespace std;
21-
2220
#include <cmath>
2321
#include <iostream>
2422

src/plugins/interpolation/Vector3D.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#ifndef VECTOR3D_H
1818
#define VECTOR3D_H
1919

20-
using namespace std;
21-
2220
#include <cmath>
2321

2422
class Vector3D

src/plugins/interpolation/mIconInterpolation.xpm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* XPM */
2-
static char *mIconInterpolation[]={
2+
static const char *mIconInterpolation[]={
33
"32 28 2 1",
44
". c None",
55
"# c #000000",

0 commit comments

Comments
 (0)