Skip to content

Commit e94733f

Browse files
committed
Remove redundant interpolation classes
1 parent bee2a1a commit e94733f

13 files changed

+30
-506
lines changed

python/analysis/interpolation/Line3D.sip

-75
This file was deleted.

python/analysis/interpolation/Node.sip

-52
This file was deleted.

src/analysis/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ SET(QGIS_ANALYSIS_SRCS
1010
interpolation/CloughTocherInterpolator.cpp
1111
interpolation/DualEdgeTriangulation.cpp
1212
interpolation/HalfEdge.cpp
13-
interpolation/Line3D.cpp
1413
interpolation/LinTriangleInterpolator.cpp
1514
interpolation/MathUtils.cpp
1615
interpolation/NormVecDecorator.cpp
17-
interpolation/Node.cpp
1816
interpolation/ParametricLine.cpp
1917
interpolation/TriangleInterpolator.cpp
2018
interpolation/Triangulation.cpp
@@ -217,13 +215,11 @@ SET(QGIS_ANALYSIS_HDRS
217215
interpolation/Vector3D.h
218216
interpolation/DualEdgeTriangulation.h
219217
interpolation/MathUtils.h
220-
interpolation/Node.h
221218
interpolation/TriDecorator.h
222219
interpolation/Triangulation.h
223220
interpolation/HalfEdge.h
224221
interpolation/LinTriangleInterpolator.h
225222
interpolation/NormVecDecorator.h
226-
interpolation/Line3D.h
227223

228224
network/qgsgraph.h
229225
network/qgsgraphbuilderinterface.h

src/analysis/interpolation/DualEdgeTriangulation.cpp

+19-31
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include "DualEdgeTriangulation.h"
1919
#include <map>
20-
#include "Line3D.h"
2120
#include "MathUtils.h"
2221
#include "qgsgeometry.h"
2322
#include "qgslogger.h"
@@ -67,47 +66,36 @@ void DualEdgeTriangulation::performConsistencyTest()
6766
QgsDebugMsg( "consistency test finished" );
6867
}
6968

70-
void DualEdgeTriangulation::addLine( Line3D *line, QgsInterpolator::SourceType lineType )
69+
void DualEdgeTriangulation::addLine( const QVector<QgsPoint> &points, QgsInterpolator::SourceType lineType )
7170
{
7271
int actpoint = -10;//number of the last point, which has been inserted from the line
7372
int currentpoint = -10;//number of the point, which is currently inserted from the line
74-
if ( line )
75-
{
76-
//first, find the first point
77-
unsigned int i;
78-
line->goToBegin();
7973

80-
for ( i = 0; i < line->getSize(); i++ )
74+
int i = 0;
75+
for ( const QgsPoint &point : points )
76+
{
77+
actpoint = mDecorator->addPoint( point );
78+
i++;
79+
if ( actpoint != -100 )
8180
{
82-
line->goToNext();
83-
// Use copy ctor since line can be deleted as well as its
84-
// associated Node and QgsPoint
85-
actpoint = mDecorator->addPoint( QgsPoint( *line->getPoint() ) );
86-
if ( actpoint != -100 )
87-
{
88-
i++;
89-
break;
90-
}
81+
break;
9182
}
83+
}
9284

93-
if ( actpoint == -100 )//no point of the line could be inserted
94-
{
95-
delete line;
96-
return;
97-
}
85+
if ( actpoint == -100 )//no point of the line could be inserted
86+
{
87+
return;
88+
}
9889

99-
for ( ; i < line->getSize(); i++ )
90+
for ( ; i < points.size(); ++i )
91+
{
92+
currentpoint = mDecorator->addPoint( points.at( i ) );
93+
if ( currentpoint != -100 && actpoint != -100 && currentpoint != actpoint )//-100 is the return value if the point could not be not inserted
10094
{
101-
line->goToNext();
102-
currentpoint = mDecorator->addPoint( QgsPoint( *line->getPoint() ) );
103-
if ( currentpoint != -100 && actpoint != -100 && currentpoint != actpoint )//-100 is the return value if the point could not be not inserted
104-
{
105-
insertForcedSegment( actpoint, currentpoint, lineType );
106-
}
107-
actpoint = currentpoint;
95+
insertForcedSegment( actpoint, currentpoint, lineType );
10896
}
97+
actpoint = currentpoint;
10998
}
110-
delete line;
11199
}
112100

113101
int DualEdgeTriangulation::addPoint( const QgsPoint &p )

src/analysis/interpolation/DualEdgeTriangulation.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ANALYSIS_EXPORT DualEdgeTriangulation: public Triangulation
4747
DualEdgeTriangulation( int nop, Triangulation *decorator );
4848
virtual ~DualEdgeTriangulation();
4949
void setDecorator( Triangulation *d ) {mDecorator = d;}
50-
void addLine( Line3D *line SIP_TRANSFER, QgsInterpolator::SourceType lineType ) override;
50+
void addLine( const QVector< QgsPoint > &points, QgsInterpolator::SourceType lineType ) override;
5151
int addPoint( const QgsPoint &p ) override;
5252
//! Performs a consistency check, remove this later
5353
virtual void performConsistencyTest() override;

src/analysis/interpolation/Line3D.cpp

-89
This file was deleted.

0 commit comments

Comments
 (0)