Skip to content

Commit

Permalink
Remove redundant interpolation classes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 3, 2017
1 parent bee2a1a commit e94733f
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 506 deletions.
75 changes: 0 additions & 75 deletions python/analysis/interpolation/Line3D.sip

This file was deleted.

52 changes: 0 additions & 52 deletions python/analysis/interpolation/Node.sip

This file was deleted.

4 changes: 0 additions & 4 deletions src/analysis/CMakeLists.txt
Expand Up @@ -10,11 +10,9 @@ SET(QGIS_ANALYSIS_SRCS
interpolation/CloughTocherInterpolator.cpp
interpolation/DualEdgeTriangulation.cpp
interpolation/HalfEdge.cpp
interpolation/Line3D.cpp
interpolation/LinTriangleInterpolator.cpp
interpolation/MathUtils.cpp
interpolation/NormVecDecorator.cpp
interpolation/Node.cpp
interpolation/ParametricLine.cpp
interpolation/TriangleInterpolator.cpp
interpolation/Triangulation.cpp
Expand Down Expand Up @@ -217,13 +215,11 @@ SET(QGIS_ANALYSIS_HDRS
interpolation/Vector3D.h
interpolation/DualEdgeTriangulation.h
interpolation/MathUtils.h
interpolation/Node.h
interpolation/TriDecorator.h
interpolation/Triangulation.h
interpolation/HalfEdge.h
interpolation/LinTriangleInterpolator.h
interpolation/NormVecDecorator.h
interpolation/Line3D.h

network/qgsgraph.h
network/qgsgraphbuilderinterface.h
Expand Down
50 changes: 19 additions & 31 deletions src/analysis/interpolation/DualEdgeTriangulation.cpp
Expand Up @@ -17,7 +17,6 @@

#include "DualEdgeTriangulation.h"
#include <map>
#include "Line3D.h"
#include "MathUtils.h"
#include "qgsgeometry.h"
#include "qgslogger.h"
Expand Down Expand Up @@ -67,47 +66,36 @@ void DualEdgeTriangulation::performConsistencyTest()
QgsDebugMsg( "consistency test finished" );
}

void DualEdgeTriangulation::addLine( Line3D *line, QgsInterpolator::SourceType lineType )
void DualEdgeTriangulation::addLine( const QVector<QgsPoint> &points, QgsInterpolator::SourceType lineType )
{
int actpoint = -10;//number of the last point, which has been inserted from the line
int currentpoint = -10;//number of the point, which is currently inserted from the line
if ( line )
{
//first, find the first point
unsigned int i;
line->goToBegin();

for ( i = 0; i < line->getSize(); i++ )
int i = 0;
for ( const QgsPoint &point : points )
{
actpoint = mDecorator->addPoint( point );
i++;
if ( actpoint != -100 )
{
line->goToNext();
// Use copy ctor since line can be deleted as well as its
// associated Node and QgsPoint
actpoint = mDecorator->addPoint( QgsPoint( *line->getPoint() ) );
if ( actpoint != -100 )
{
i++;
break;
}
break;
}
}

if ( actpoint == -100 )//no point of the line could be inserted
{
delete line;
return;
}
if ( actpoint == -100 )//no point of the line could be inserted
{
return;
}

for ( ; i < line->getSize(); i++ )
for ( ; i < points.size(); ++i )
{
currentpoint = mDecorator->addPoint( points.at( i ) );
if ( currentpoint != -100 && actpoint != -100 && currentpoint != actpoint )//-100 is the return value if the point could not be not inserted
{
line->goToNext();
currentpoint = mDecorator->addPoint( QgsPoint( *line->getPoint() ) );
if ( currentpoint != -100 && actpoint != -100 && currentpoint != actpoint )//-100 is the return value if the point could not be not inserted
{
insertForcedSegment( actpoint, currentpoint, lineType );
}
actpoint = currentpoint;
insertForcedSegment( actpoint, currentpoint, lineType );
}
actpoint = currentpoint;
}
delete line;
}

int DualEdgeTriangulation::addPoint( const QgsPoint &p )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/DualEdgeTriangulation.h
Expand Up @@ -47,7 +47,7 @@ class ANALYSIS_EXPORT DualEdgeTriangulation: public Triangulation
DualEdgeTriangulation( int nop, Triangulation *decorator );
virtual ~DualEdgeTriangulation();
void setDecorator( Triangulation *d ) {mDecorator = d;}
void addLine( Line3D *line SIP_TRANSFER, QgsInterpolator::SourceType lineType ) override;
void addLine( const QVector< QgsPoint > &points, QgsInterpolator::SourceType lineType ) override;
int addPoint( const QgsPoint &p ) override;
//! Performs a consistency check, remove this later
virtual void performConsistencyTest() override;
Expand Down
89 changes: 0 additions & 89 deletions src/analysis/interpolation/Line3D.cpp

This file was deleted.

0 comments on commit e94733f

Please sign in to comment.