Skip to content

Commit 22af16a

Browse files
committed
Mark QgsLineStringV2 as a critical class
Now has as close to 100% unit test coverage as possible
1 parent 7eb1133 commit 22af16a

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

src/core/geometry/qgslinestringv2.cpp

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#include <QDomDocument>
2727
#include <QtCore/qmath.h>
2828

29+
30+
/***************************************************************************
31+
* This class is considered CRITICAL and any change MUST be accompanied with
32+
* full unit tests.
33+
* See details in QEP #17
34+
****************************************************************************/
35+
2936
QgsLineStringV2::QgsLineStringV2(): QgsCurveV2()
3037
{
3138
mWkbType = QgsWKBTypes::LineString;
@@ -72,6 +79,12 @@ void QgsLineStringV2::fromWkbPoints( QgsWKBTypes::Type type, const QgsConstWkbPt
7279
importVerticesFromWkb( wkb );
7380
}
7481

82+
/***************************************************************************
83+
* This class is considered CRITICAL and any change MUST be accompanied with
84+
* full unit tests.
85+
* See details in QEP #17
86+
****************************************************************************/
87+
7588
bool QgsLineStringV2::fromWkt( const QString& wkt )
7689
{
7790
clear();
@@ -106,6 +119,12 @@ unsigned char* QgsLineStringV2::asWkb( int& binarySize ) const
106119
return geomPtr;
107120
}
108121

122+
/***************************************************************************
123+
* This class is considered CRITICAL and any change MUST be accompanied with
124+
* full unit tests.
125+
* See details in QEP #17
126+
****************************************************************************/
127+
109128
QString QgsLineStringV2::asWkt( int precision ) const
110129
{
111130
QString wkt = wktTypeStr() + ' ';
@@ -149,6 +168,12 @@ QString QgsLineStringV2::asJSON( int precision ) const
149168
return "{\"type\": \"LineString\", \"coordinates\": " + QgsGeometryUtils::pointsToJSON( pts, precision ) + '}';
150169
}
151170

171+
/***************************************************************************
172+
* This class is considered CRITICAL and any change MUST be accompanied with
173+
* full unit tests.
174+
* See details in QEP #17
175+
****************************************************************************/
176+
152177
double QgsLineStringV2::length() const
153178
{
154179
double length = 0;
@@ -181,6 +206,12 @@ QgsPointV2 QgsLineStringV2::endPoint() const
181206
return pointN( numPoints() - 1 );
182207
}
183208

209+
/***************************************************************************
210+
* This class is considered CRITICAL and any change MUST be accompanied with
211+
* full unit tests.
212+
* See details in QEP #17
213+
****************************************************************************/
214+
184215
QgsLineStringV2* QgsLineStringV2::curveToLine() const
185216
{
186217
return static_cast<QgsLineStringV2*>( clone() );
@@ -234,6 +265,12 @@ QgsPointV2 QgsLineStringV2::pointN( int i ) const
234265
return QgsPointV2( t, x, y, z, m );
235266
}
236267

268+
/***************************************************************************
269+
* This class is considered CRITICAL and any change MUST be accompanied with
270+
* full unit tests.
271+
* See details in QEP #17
272+
****************************************************************************/
273+
237274
double QgsLineStringV2::xAt( int index ) const
238275
{
239276
if ( index >= 0 && index < mX.size() )
@@ -292,6 +329,12 @@ void QgsLineStringV2::setMAt( int index, double m )
292329
mM[ index ] = m;
293330
}
294331

332+
/***************************************************************************
333+
* This class is considered CRITICAL and any change MUST be accompanied with
334+
* full unit tests.
335+
* See details in QEP #17
336+
****************************************************************************/
337+
295338
void QgsLineStringV2::points( QList<QgsPointV2>& pts ) const
296339
{
297340
pts.clear();
@@ -353,6 +396,12 @@ void QgsLineStringV2::setPoints( const QList<QgsPointV2>& points )
353396
}
354397
}
355398

399+
/***************************************************************************
400+
* This class is considered CRITICAL and any change MUST be accompanied with
401+
* full unit tests.
402+
* See details in QEP #17
403+
****************************************************************************/
404+
356405
void QgsLineStringV2::append( const QgsLineStringV2* line )
357406
{
358407
if ( !line )
@@ -407,6 +456,12 @@ QgsLineStringV2* QgsLineStringV2::reversed() const
407456
return copy;
408457
}
409458

459+
/***************************************************************************
460+
* This class is considered CRITICAL and any change MUST be accompanied with
461+
* full unit tests.
462+
* See details in QEP #17
463+
****************************************************************************/
464+
410465
void QgsLineStringV2::draw( QPainter& p ) const
411466
{
412467
p.drawPolyline( asQPolygonF() );
@@ -446,6 +501,12 @@ QPolygonF QgsLineStringV2::asQPolygonF() const
446501
return points;
447502
}
448503

504+
/***************************************************************************
505+
* This class is considered CRITICAL and any change MUST be accompanied with
506+
* full unit tests.
507+
* See details in QEP #17
508+
****************************************************************************/
509+
449510
void QgsLineStringV2::transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d )
450511
{
451512
double* zArray = mZ.data();
@@ -480,6 +541,12 @@ void QgsLineStringV2::transform( const QTransform& t )
480541
mBoundingBox = QgsRectangle();
481542
}
482543

544+
/***************************************************************************
545+
* This class is considered CRITICAL and any change MUST be accompanied with
546+
* full unit tests.
547+
* See details in QEP #17
548+
****************************************************************************/
549+
483550
bool QgsLineStringV2::insertVertex( const QgsVertexId& position, const QgsPointV2& vertex )
484551
{
485552
if ( position.vertex < 0 || position.vertex > mX.size() )
@@ -547,6 +614,12 @@ bool QgsLineStringV2::deleteVertex( const QgsVertexId& position )
547614
return true;
548615
}
549616

617+
/***************************************************************************
618+
* This class is considered CRITICAL and any change MUST be accompanied with
619+
* full unit tests.
620+
* See details in QEP #17
621+
****************************************************************************/
622+
550623
void QgsLineStringV2::addVertex( const QgsPointV2& pt )
551624
{
552625
if ( mWkbType == QgsWKBTypes::Unknown || mX.isEmpty() )
@@ -607,6 +680,12 @@ double QgsLineStringV2::closestSegment( const QgsPointV2& pt, QgsPointV2& segmen
607680
return sqrDist;
608681
}
609682

683+
/***************************************************************************
684+
* This class is considered CRITICAL and any change MUST be accompanied with
685+
* full unit tests.
686+
* See details in QEP #17
687+
****************************************************************************/
688+
610689
bool QgsLineStringV2::pointAt( int node, QgsPointV2& point, QgsVertexId::VertexType& type ) const
611690
{
612691
if ( node < 0 || node >= numPoints() )
@@ -656,6 +735,12 @@ QgsPointV2 QgsLineStringV2::centroid() const
656735

657736
}
658737

738+
/***************************************************************************
739+
* This class is considered CRITICAL and any change MUST be accompanied with
740+
* full unit tests.
741+
* See details in QEP #17
742+
****************************************************************************/
743+
659744
void QgsLineStringV2::sumUpArea( double& sum ) const
660745
{
661746
int maxIndex = numPoints() - 1;
@@ -694,6 +779,12 @@ void QgsLineStringV2::importVerticesFromWkb( const QgsConstWkbPtr& wkb )
694779
mBoundingBox = QgsRectangle(); //set bounding box invalid
695780
}
696781

782+
/***************************************************************************
783+
* This class is considered CRITICAL and any change MUST be accompanied with
784+
* full unit tests.
785+
* See details in QEP #17
786+
****************************************************************************/
787+
697788
void QgsLineStringV2::close()
698789
{
699790
if ( numPoints() < 1 || isClosed() )
@@ -746,6 +837,12 @@ double QgsLineStringV2::vertexAngle( const QgsVertexId& vertex ) const
746837
}
747838
}
748839

840+
/***************************************************************************
841+
* This class is considered CRITICAL and any change MUST be accompanied with
842+
* full unit tests.
843+
* See details in QEP #17
844+
****************************************************************************/
845+
749846
bool QgsLineStringV2::addZValue( double zValue )
750847
{
751848
if ( QgsWKBTypes::hasZ( mWkbType ) )

src/core/geometry/qgslinestringv2.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
#include "qgswkbptr.h"
2323
#include <QPolygonF>
2424

25+
/***************************************************************************
26+
* This class is considered CRITICAL and any change MUST be accompanied with
27+
* full unit tests in testqgsgeometry.cpp.
28+
* See details in QEP #17
29+
****************************************************************************/
30+
2531
/** \ingroup core
2632
* \class QgsLineStringV2
2733
* \brief Line string geometry type, with support for z-dimension and m-values.

0 commit comments

Comments
 (0)