|
17 | 17 |
|
18 | 18 | #include "DualEdgeTriangulation.h"
|
19 | 19 | #include <map>
|
20 |
| -#include "Line3D.h" |
21 | 20 | #include "MathUtils.h"
|
22 | 21 | #include "qgsgeometry.h"
|
23 | 22 | #include "qgslogger.h"
|
@@ -67,47 +66,36 @@ void DualEdgeTriangulation::performConsistencyTest()
|
67 | 66 | QgsDebugMsg( "consistency test finished" );
|
68 | 67 | }
|
69 | 68 |
|
70 |
| -void DualEdgeTriangulation::addLine( Line3D *line, QgsInterpolator::SourceType lineType ) |
| 69 | +void DualEdgeTriangulation::addLine( const QVector<QgsPoint> &points, QgsInterpolator::SourceType lineType ) |
71 | 70 | {
|
72 | 71 | int actpoint = -10;//number of the last point, which has been inserted from the line
|
73 | 72 | 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(); |
79 | 73 |
|
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 ) |
81 | 80 | {
|
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; |
91 | 82 | }
|
| 83 | + } |
92 | 84 |
|
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 | + } |
98 | 89 |
|
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 |
100 | 94 | {
|
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 ); |
108 | 96 | }
|
| 97 | + actpoint = currentpoint; |
109 | 98 | }
|
110 |
| - delete line; |
111 | 99 | }
|
112 | 100 |
|
113 | 101 | int DualEdgeTriangulation::addPoint( const QgsPoint &p )
|
|
0 commit comments