|
27 | 27 |
|
28 | 28 | //qgis includes...
|
29 | 29 | #include <qgsapplication.h>
|
| 30 | +#include "qgscompoundcurve.h" |
30 | 31 | #include <qgsgeometry.h>
|
31 | 32 | #include "qgsgeometryutils.h"
|
32 | 33 | #include <qgspoint.h>
|
@@ -69,6 +70,7 @@ class TestQgsGeometry : public QObject
|
69 | 70 | void point(); //test QgsPointV2
|
70 | 71 | void lineString(); //test QgsLineString
|
71 | 72 | void polygon(); //test QgsPolygonV2
|
| 73 | + void compoundCurve(); //test QgsCompoundCurve |
72 | 74 | void multiPoint();
|
73 | 75 | void multiLineString();
|
74 | 76 | void multiPolygon();
|
@@ -3092,6 +3094,31 @@ void TestQgsGeometry::polygon()
|
3092 | 3094 |
|
3093 | 3095 | }
|
3094 | 3096 |
|
| 3097 | +void TestQgsGeometry::compoundCurve() |
| 3098 | +{ |
| 3099 | + //test that area of a compound curve ring is equal to a closed linestring with the same vertices |
| 3100 | + QgsCompoundCurve cc; |
| 3101 | + QgsLineString* l1 = new QgsLineString(); |
| 3102 | + l1->setPoints( QgsPointSequence() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) ); |
| 3103 | + cc.addCurve( l1 ); |
| 3104 | + QgsLineString* l2 = new QgsLineString(); |
| 3105 | + l2->setPoints( QgsPointSequence() << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 ) ); |
| 3106 | + cc.addCurve( l2 ); |
| 3107 | + QgsLineString* l3 = new QgsLineString(); |
| 3108 | + l3->setPoints( QgsPointSequence() << QgsPointV2( 0, -1 ) << QgsPointV2( 1, 1 ) ); |
| 3109 | + cc.addCurve( l3 ); |
| 3110 | + |
| 3111 | + double ccArea = 0.0; |
| 3112 | + cc.sumUpArea( ccArea ); |
| 3113 | + |
| 3114 | + QgsLineString ls; |
| 3115 | + ls.setPoints( QgsPointSequence() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 ) |
| 3116 | + << QgsPointV2( 1, 1 ) ); |
| 3117 | + double lsArea = 0.0; |
| 3118 | + ls.sumUpArea( lsArea ); |
| 3119 | + QVERIFY( qgsDoubleNear( ccArea, lsArea ) ); |
| 3120 | +} |
| 3121 | + |
3095 | 3122 | void TestQgsGeometry::multiPoint()
|
3096 | 3123 | {
|
3097 | 3124 | //boundary
|
|
0 commit comments