Skip to content

Commit bb425e4

Browse files
committed
Cleaner signature for QgsAbstractGeometry::closestSegment
1 parent 1f40f62 commit bb425e4

16 files changed

+43
-44
lines changed

python/core/geometry/qgsabstractgeometry.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class QgsAbstractGeometry
275275

276276
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/,
277277
QgsVertexId &vertexAfter /Out/,
278-
bool *leftOf /Out/, double epsilon ) const = 0;
278+
bool *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const = 0;
279279
%Docstring
280280
Searches for the closest segment of the geometry to a given point.
281281
\param pt specifies the point to find closest segment to

python/core/geometry/qgscircularstring.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class QgsCircularString: QgsCurve
9999

100100
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/,
101101
QgsVertexId &vertexAfter /Out/,
102-
bool *leftOf /Out/, double epsilon ) const;
102+
bool *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
103103

104104
virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const;
105105

python/core/geometry/qgscompoundcurve.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class QgsCompoundCurve: QgsCurve
107107
virtual bool deleteVertex( QgsVertexId position );
108108

109109
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/,
110-
QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/,
111-
double epsilon ) const;
110+
QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/ = 0,
111+
double epsilon = 4 * DBL_EPSILON ) const;
112112

113113
virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const;
114114

python/core/geometry/qgscurvepolygon.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Adds an interior ring to the geometry (takes ownership)
136136

137137
virtual bool isEmpty() const;
138138

139-
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const;
139+
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
140140

141141

142142
virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;

python/core/geometry/qgsgeometrycollection.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Adds a geometry and takes ownership. Returns true in case of success.
107107
virtual int nCoordinates() const;
108108

109109

110-
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const;
110+
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
111111

112112
virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;
113113

python/core/geometry/qgslinestring.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Closes the line string by appending the first point to the end of the line, if i
238238
virtual QgsLineString *reversed() const /Factory/;
239239

240240

241-
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const;
241+
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
242242

243243
virtual bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const;
244244

python/core/geometry/qgspoint.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class QgsPoint: QgsAbstractGeometry
367367

368368
virtual bool deleteVertex( QgsVertexId position );
369369

370-
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/, double epsilon ) const;
370+
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt /Out/, QgsVertexId &vertexAfter /Out/, bool *leftOf /Out/ = 0, double epsilon = 4 * DBL_EPSILON ) const;
371371

372372
virtual bool nextVertex( QgsVertexId &id, QgsPoint &vertex /Out/ ) const;
373373

src/core/geometry/qgsabstractgeometry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ class CORE_EXPORT QgsAbstractGeometry
278278
*/
279279
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT,
280280
QgsVertexId &vertexAfter SIP_OUT,
281-
bool *leftOf SIP_OUT, double epsilon ) const = 0;
281+
bool *leftOf SIP_OUT = nullptr, double epsilon = 4 * DBL_EPSILON ) const = 0;
282282

283283
//low-level editing
284284

src/core/geometry/qgscircularstring.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ void QgsCircularString::deleteVertex( int i )
701701

702702
double QgsCircularString::closestSegment( const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, bool *leftOf, double epsilon ) const
703703
{
704-
Q_UNUSED( epsilon );
705704
double minDist = std::numeric_limits<double>::max();
706705
QgsPoint minDistSegmentPoint;
707706
QgsVertexId minDistVertexAfter;
@@ -925,10 +924,6 @@ double QgsCircularString::vertexAngle( QgsVertexId vId ) const
925924
}
926925
if ( vId.vertex >= numPoints() - 1 )
927926
{
928-
if ( numPoints() < 3 )
929-
{
930-
return 0.0;
931-
}
932927
int a = numPoints() - 3;
933928
int b = numPoints() - 2;
934929
int c = numPoints() - 1;

src/core/geometry/qgscircularstring.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class CORE_EXPORT QgsCircularString: public QgsCurve
9393

9494
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT,
9595
QgsVertexId &vertexAfter SIP_OUT,
96-
bool *leftOf SIP_OUT, double epsilon ) const override;
96+
bool *leftOf SIP_OUT = nullptr, double epsilon = 4 * DBL_EPSILON ) const override;
9797

9898
bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override;
9999
void sumUpArea( double &sum SIP_OUT ) const override;

src/core/geometry/qgscompoundcurve.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve
9999
virtual bool deleteVertex( QgsVertexId position ) override;
100100

101101
virtual double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT,
102-
QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT,
103-
double epsilon ) const override;
102+
QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT = nullptr,
103+
double epsilon = 4 * DBL_EPSILON ) const override;
104104

105105
bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override;
106106

src/core/geometry/qgscurvepolygon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface
111111
QgsCoordinateSequence coordinateSequence() const override;
112112
int nCoordinates() const override;
113113
bool isEmpty() const override;
114-
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override;
114+
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT = nullptr, double epsilon = 4 * DBL_EPSILON ) const override;
115115

116116
bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override;
117117

src/core/geometry/qgsgeometrycollection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry
9696
QgsCoordinateSequence coordinateSequence() const override;
9797
int nCoordinates() const override;
9898

99-
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override;
99+
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT = nullptr, double epsilon = 4 * DBL_EPSILON ) const override;
100100
bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override;
101101

102102
//low-level editing

src/core/geometry/qgslinestring.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve
207207

208208
QgsLineString *reversed() const override SIP_FACTORY;
209209

210-
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override;
210+
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT = nullptr, double epsilon = 4 * DBL_EPSILON ) const override;
211211
bool pointAt( int node, QgsPoint &point, QgsVertexId::VertexType &type ) const override;
212212

213213
QgsPoint centroid() const override;

src/core/geometry/qgspoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class CORE_EXPORT QgsPoint: public QgsAbstractGeometry
395395
bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
396396
bool deleteVertex( QgsVertexId position ) override { Q_UNUSED( position ); return false; }
397397

398-
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT, double epsilon ) const override;
398+
double closestSegment( const QgsPoint &pt, QgsPoint &segmentPt SIP_OUT, QgsVertexId &vertexAfter SIP_OUT, bool *leftOf SIP_OUT = nullptr, double epsilon = 4 * DBL_EPSILON ) const override;
399399
bool nextVertex( QgsVertexId &id, QgsPoint &vertex SIP_OUT ) const override;
400400

401401
/** Angle undefined. Always returns 0.0

tests/src/core/testqgsgeometry.cpp

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ void TestQgsGeometry::point()
579579
std::unique_ptr< QgsPoint >clone( p10.clone() );
580580
QVERIFY( p10 == *clone );
581581

582+
//toCurveType
583+
clone.reset( p10.toCurveType() );
584+
QVERIFY( p10 == *clone );
585+
582586
//assignment
583587
QgsPoint original( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 );
584588
QgsPoint assigned( 6.0, 7.0 );
@@ -742,7 +746,7 @@ void TestQgsGeometry::point()
742746
QgsPoint closest;
743747
QgsVertexId after;
744748
// return error - points have no segments
745-
QVERIFY( p20.closestSegment( QgsPoint( 4.0, 6.0 ), closest, after, 0, 0 ) < 0 );
749+
QVERIFY( p20.closestSegment( QgsPoint( 4.0, 6.0 ), closest, after ) < 0 );
746750

747751
//nextVertex
748752
QgsPoint p21( 3.0, 4.0 );
@@ -2002,68 +2006,68 @@ void TestQgsGeometry::circularString()
20022006
QgsCircularString l35;
20032007
bool leftOf = false;
20042008
p = QgsPoint(); // reset all coords to zero
2005-
( void )l35.closestSegment( QgsPoint( 1, 2 ), p, v, 0, 0 ); //empty line, just want no crash
2009+
( void )l35.closestSegment( QgsPoint( 1, 2 ), p, v ); //empty line, just want no crash
20062010
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) );
2007-
QVERIFY( l35.closestSegment( QgsPoint( 5, 10 ), p, v, 0, 0 ) < 0 );
2011+
QVERIFY( l35.closestSegment( QgsPoint( 5, 10 ), p, v ) < 0 );
20082012
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 7, 12 ) << QgsPoint( 5, 15 ) );
2009-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf, 0 ), 2.0, 0.0001 );
2013+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf ), 2.0, 0.0001 );
20102014
QCOMPARE( p, QgsPoint( 5, 10 ) );
20112015
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
20122016
QCOMPARE( leftOf, true );
2013-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf, 0 ), 1.583512, 0.0001 );
2017+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf ), 1.583512, 0.0001 );
20142018
QGSCOMPARENEAR( p.x(), 6.84, 0.01 );
20152019
QGSCOMPARENEAR( p.y(), 11.49, 0.01 );
20162020
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
20172021
QCOMPARE( leftOf, false );
2018-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 11.5 ), p, v, &leftOf, 0 ), 1.288897, 0.0001 );
2022+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 11.5 ), p, v, &leftOf ), 1.288897, 0.0001 );
20192023
QGSCOMPARENEAR( p.x(), 6.302776, 0.01 );
20202024
QGSCOMPARENEAR( p.y(), 10.7, 0.01 );
20212025
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
20222026
QCOMPARE( leftOf, true );
2023-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 7, 16 ), p, v, &leftOf, 0 ), 3.068288, 0.0001 );
2027+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 7, 16 ), p, v, &leftOf ), 3.068288, 0.0001 );
20242028
QGSCOMPARENEAR( p.x(), 5.981872, 0.01 );
20252029
QGSCOMPARENEAR( p.y(), 14.574621, 0.01 );
20262030
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
20272031
QCOMPARE( leftOf, false );
2028-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 13.5 ), p, v, &leftOf, 0 ), 1.288897, 0.0001 );
2032+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 13.5 ), p, v, &leftOf ), 1.288897, 0.0001 );
20292033
QGSCOMPARENEAR( p.x(), 6.302776, 0.01 );
20302034
QGSCOMPARENEAR( p.y(), 14.3, 0.01 );
20312035
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
20322036
QCOMPARE( leftOf, true );
20332037
// point directly on segment
2034-
QCOMPARE( l35.closestSegment( QgsPoint( 5, 15 ), p, v, &leftOf, 0 ), 0.0 );
2038+
QCOMPARE( l35.closestSegment( QgsPoint( 5, 15 ), p, v, &leftOf ), 0.0 );
20352039
QCOMPARE( p, QgsPoint( 5, 15 ) );
20362040
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
20372041

20382042
//clockwise string
20392043
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 15 ) << QgsPoint( 7, 12 ) << QgsPoint( 5, 10 ) );
2040-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf, 0 ), 2, 0.0001 );
2044+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf ), 2, 0.0001 );
20412045
QGSCOMPARENEAR( p.x(), 5, 0.01 );
20422046
QGSCOMPARENEAR( p.y(), 10, 0.01 );
20432047
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
20442048
QCOMPARE( leftOf, false );
2045-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf, 0 ), 1.583512, 0.0001 );
2049+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf ), 1.583512, 0.0001 );
20462050
QGSCOMPARENEAR( p.x(), 6.84, 0.01 );
20472051
QGSCOMPARENEAR( p.y(), 11.49, 0.01 );
20482052
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
20492053
QCOMPARE( leftOf, true );
2050-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 11.5 ), p, v, &leftOf, 0 ), 1.288897, 0.0001 );
2054+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 11.5 ), p, v, &leftOf ), 1.288897, 0.0001 );
20512055
QGSCOMPARENEAR( p.x(), 6.302776, 0.01 );
20522056
QGSCOMPARENEAR( p.y(), 10.7, 0.01 );
20532057
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
20542058
QCOMPARE( leftOf, false );
2055-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 7, 16 ), p, v, &leftOf, 0 ), 3.068288, 0.0001 );
2059+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 7, 16 ), p, v, &leftOf ), 3.068288, 0.0001 );
20562060
QGSCOMPARENEAR( p.x(), 5.981872, 0.01 );
20572061
QGSCOMPARENEAR( p.y(), 14.574621, 0.01 );
20582062
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
20592063
QCOMPARE( leftOf, true );
2060-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 13.5 ), p, v, &leftOf, 0 ), 1.288897, 0.0001 );
2064+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 5.5, 13.5 ), p, v, &leftOf ), 1.288897, 0.0001 );
20612065
QGSCOMPARENEAR( p.x(), 6.302776, 0.01 );
20622066
QGSCOMPARENEAR( p.y(), 14.3, 0.01 );
20632067
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
20642068
QCOMPARE( leftOf, false );
20652069
// point directly on segment
2066-
QCOMPARE( l35.closestSegment( QgsPoint( 5, 15 ), p, v, &leftOf, 0 ), 0.0 );
2070+
QCOMPARE( l35.closestSegment( QgsPoint( 5, 15 ), p, v, &leftOf ), 0.0 );
20672071
QCOMPARE( p, QgsPoint( 5, 15 ) );
20682072
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
20692073

@@ -3670,30 +3674,30 @@ void TestQgsGeometry::lineString()
36703674
QgsLineString l35;
36713675
bool leftOf = false;
36723676
p = QgsPoint(); // reset all coords to zero
3673-
( void )l35.closestSegment( QgsPoint( 1, 2 ), p, v, 0, 0 ); //empty line, just want no crash
3677+
( void )l35.closestSegment( QgsPoint( 1, 2 ), p, v ); //empty line, just want no crash
36743678
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) );
3675-
QVERIFY( l35.closestSegment( QgsPoint( 5, 10 ), p, v, 0, 0 ) < 0 );
3679+
QVERIFY( l35.closestSegment( QgsPoint( 5, 10 ), p, v ) < 0 );
36763680
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 10 ) );
3677-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf, 0 ), 2.0, 4 * DBL_EPSILON );
3681+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf ), 2.0, 4 * DBL_EPSILON );
36783682
QCOMPARE( p, QgsPoint( 5, 10 ) );
36793683
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
36803684
QCOMPARE( leftOf, true );
3681-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf, 0 ), 1.0, 4 * DBL_EPSILON );
3685+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
36823686
QCOMPARE( p, QgsPoint( 8, 10 ) );
36833687
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
36843688
QCOMPARE( leftOf, true );
3685-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 9 ), p, v, &leftOf, 0 ), 1.0, 4 * DBL_EPSILON );
3689+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 9 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
36863690
QCOMPARE( p, QgsPoint( 8, 10 ) );
36873691
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
36883692
QCOMPARE( leftOf, false );
3689-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 9 ), p, v, &leftOf, 0 ), 2.0, 4 * DBL_EPSILON );
3693+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 9 ), p, v, &leftOf ), 2.0, 4 * DBL_EPSILON );
36903694
QCOMPARE( p, QgsPoint( 10, 10 ) );
36913695
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
36923696
QCOMPARE( leftOf, false );
36933697
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 )
36943698
<< QgsPoint( 10, 10 )
36953699
<< QgsPoint( 10, 15 ) );
3696-
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 12 ), p, v, &leftOf, 0 ), 1.0, 4 * DBL_EPSILON );
3700+
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 12 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
36973701
QCOMPARE( p, QgsPoint( 10, 12 ) );
36983702
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
36993703
QCOMPARE( leftOf, false );
@@ -6829,7 +6833,7 @@ void TestQgsGeometry::multiPoint()
68296833
QgsPoint closest;
68306834
QgsVertexId after;
68316835
// return error - points have no segments
6832-
QVERIFY( boundaryMP.closestSegment( QgsPoint( 0.5, 0.5 ), closest, after, 0, 0 ) < 0 );
6836+
QVERIFY( boundaryMP.closestSegment( QgsPoint( 0.5, 0.5 ), closest, after ) < 0 );
68336837
}
68346838

68356839
void TestQgsGeometry::multiLineString()

0 commit comments

Comments
 (0)