26
26
#include < QDomDocument>
27
27
#include < QtCore/qmath.h>
28
28
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
+
29
36
QgsLineStringV2::QgsLineStringV2 (): QgsCurveV2()
30
37
{
31
38
mWkbType = QgsWKBTypes::LineString;
@@ -72,6 +79,12 @@ void QgsLineStringV2::fromWkbPoints( QgsWKBTypes::Type type, const QgsConstWkbPt
72
79
importVerticesFromWkb ( wkb );
73
80
}
74
81
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
+
Collapse comment Comment on line R87
why is this repeated, repeated, repeated?
Just wanted to make it easier for new contributors/devs unaware of QEP 17 that this class requires unit tests. If it's just a single note at the top of the file, it's likely to be overlooked.
Code has comments. Press enter to view. 75
88
bool QgsLineStringV2::fromWkt ( const QString& wkt )
76
89
{
77
90
clear ();
@@ -106,6 +119,12 @@ unsigned char* QgsLineStringV2::asWkb( int& binarySize ) const
106
119
return geomPtr;
107
120
}
108
121
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
+
109
128
QString QgsLineStringV2::asWkt ( int precision ) const
110
129
{
111
130
QString wkt = wktTypeStr () + ' ' ;
@@ -149,6 +168,12 @@ QString QgsLineStringV2::asJSON( int precision ) const
149
168
return " {\" type\" : \" LineString\" , \" coordinates\" : " + QgsGeometryUtils::pointsToJSON ( pts, precision ) + ' }' ;
150
169
}
151
170
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
+
152
177
double QgsLineStringV2::length () const
153
178
{
154
179
double length = 0 ;
@@ -181,6 +206,12 @@ QgsPointV2 QgsLineStringV2::endPoint() const
181
206
return pointN ( numPoints () - 1 );
182
207
}
183
208
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
+
184
215
QgsLineStringV2* QgsLineStringV2::curveToLine () const
185
216
{
186
217
return static_cast <QgsLineStringV2*>( clone () );
@@ -234,6 +265,12 @@ QgsPointV2 QgsLineStringV2::pointN( int i ) const
234
265
return QgsPointV2 ( t, x, y, z, m );
235
266
}
236
267
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
+
237
274
double QgsLineStringV2::xAt ( int index ) const
238
275
{
239
276
if ( index >= 0 && index < mX .size () )
@@ -292,6 +329,12 @@ void QgsLineStringV2::setMAt( int index, double m )
292
329
mM [ index ] = m;
293
330
}
294
331
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
+
295
338
void QgsLineStringV2::points ( QList<QgsPointV2>& pts ) const
296
339
{
297
340
pts.clear ();
@@ -353,6 +396,12 @@ void QgsLineStringV2::setPoints( const QList<QgsPointV2>& points )
353
396
}
354
397
}
355
398
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
+
356
405
void QgsLineStringV2::append ( const QgsLineStringV2* line )
357
406
{
358
407
if ( !line )
@@ -407,6 +456,12 @@ QgsLineStringV2* QgsLineStringV2::reversed() const
407
456
return copy;
408
457
}
409
458
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
+
410
465
void QgsLineStringV2::draw ( QPainter& p ) const
411
466
{
412
467
p.drawPolyline ( asQPolygonF () );
@@ -446,6 +501,12 @@ QPolygonF QgsLineStringV2::asQPolygonF() const
446
501
return points;
447
502
}
448
503
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
+
449
510
void QgsLineStringV2::transform ( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d )
450
511
{
451
512
double * zArray = mZ .data ();
@@ -480,6 +541,12 @@ void QgsLineStringV2::transform( const QTransform& t )
480
541
mBoundingBox = QgsRectangle ();
481
542
}
482
543
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
+
483
550
bool QgsLineStringV2::insertVertex ( const QgsVertexId& position, const QgsPointV2& vertex )
484
551
{
485
552
if ( position.vertex < 0 || position.vertex > mX .size () )
@@ -547,6 +614,12 @@ bool QgsLineStringV2::deleteVertex( const QgsVertexId& position )
547
614
return true ;
548
615
}
549
616
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
+
550
623
void QgsLineStringV2::addVertex ( const QgsPointV2& pt )
551
624
{
552
625
if ( mWkbType == QgsWKBTypes::Unknown || mX .isEmpty () )
@@ -607,6 +680,12 @@ double QgsLineStringV2::closestSegment( const QgsPointV2& pt, QgsPointV2& segmen
607
680
return sqrDist;
608
681
}
609
682
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
+
610
689
bool QgsLineStringV2::pointAt ( int node, QgsPointV2& point, QgsVertexId::VertexType& type ) const
611
690
{
612
691
if ( node < 0 || node >= numPoints () )
@@ -656,6 +735,12 @@ QgsPointV2 QgsLineStringV2::centroid() const
656
735
657
736
}
658
737
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
+
659
744
void QgsLineStringV2::sumUpArea ( double & sum ) const
660
745
{
661
746
int maxIndex = numPoints () - 1 ;
@@ -694,6 +779,12 @@ void QgsLineStringV2::importVerticesFromWkb( const QgsConstWkbPtr& wkb )
694
779
mBoundingBox = QgsRectangle (); // set bounding box invalid
695
780
}
696
781
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
+
697
788
void QgsLineStringV2::close ()
698
789
{
699
790
if ( numPoints () < 1 || isClosed () )
@@ -746,6 +837,12 @@ double QgsLineStringV2::vertexAngle( const QgsVertexId& vertex ) const
746
837
}
747
838
}
748
839
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
+
749
846
bool QgsLineStringV2::addZValue ( double zValue )
750
847
{
751
848
if ( QgsWKBTypes::hasZ ( mWkbType ) )
0 commit comments