~ubuntu-branches/ubuntu/trusty/qgis/trusty

« back to all changes in this revision

Viewing changes to tests/src/core/testqgsgeometry.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
     testqgsgeometry.cpp
 
3
     --------------------------------------
 
4
    Date                 : 20 Jan 2008
 
5
    Copyright            : (C) 2008 by Tim Sutton
 
6
    Email                : tim @ linfiniti.com
 
7
 ***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
1
15
#include <QtTest>
2
16
#include <QObject>
3
17
#include <QString>
 
18
#include <QStringList>
4
19
#include <QObject>
5
 
//header for class being tested
 
20
#include <QApplication>
 
21
#include <QFileInfo>
 
22
#include <QDir>
 
23
#include <QDesktopServices>
 
24
#include <QVector>
 
25
#include <QPointF>
 
26
#include <QImage>
 
27
#include <QPainter>
 
28
 
 
29
#include <iostream>
 
30
//qgis includes...
 
31
#include <qgsapplication.h>
6
32
#include <qgsgeometry.h>
7
 
 
 
33
#include <qgspoint.h>
 
34
 
 
35
//qgs unit test utility class
 
36
#include "qgsrenderchecker.h"
 
37
 
 
38
/** \ingroup UnitTests
 
39
 * This is a unit test for the different geometry operations on vector features.
 
40
 */
8
41
class TestQgsGeometry: public QObject
9
42
{
10
 
  Q_OBJECT;
 
43
    Q_OBJECT;
11
44
  private slots:
12
 
        void QgsGeometryQgsGeometry()
13
 
{
14
 
 
15
 
};
16
 
    void QgsGeometrysetWkbAndOwnership()
17
 
{
18
 
 
19
 
};
20
 
    void QgsGeometrywkbBuffer()
21
 
{
22
 
 
23
 
};
24
 
    void QgsGeometrywkbSize()
25
 
{
26
 
 
27
 
};
28
 
    void QgsGeometrywkt()
29
 
{
30
 
 
31
 
};
32
 
    void QgsGeometrysetGeos()
33
 
{
34
 
 
35
 
};
36
 
    void QgsGeometryclosestVertex()
37
 
{
38
 
 
39
 
};
40
 
    void QgsGeometryinsertVertexBefore()
41
 
{
42
 
 
43
 
};
44
 
    void QgsGeometrymoveVertexAt()
45
 
{
46
 
 
47
 
};
48
 
    void QgsGeometrydeleteVertexAt()
49
 
{
50
 
 
51
 
};
52
 
    void QgsGeometryvertexAt()
53
 
{
54
 
 
55
 
};
56
 
    void QgsGeometryclosestVertexWithContext()
57
 
{
58
 
 
59
 
};
60
 
    void QgsGeometryclosestSegmentWithContext()
61
 
{
62
 
 
63
 
};
64
 
    void QgsGeometryboundingBox()
65
 
{
66
 
 
67
 
};
68
 
    void QgsGeometryintersects()
69
 
{
70
 
 
71
 
};
72
 
    void QgsGeometryexportToWkt()
73
 
{
74
 
 
75
 
};
76
 
    void QgsGeometrygeosGeometry()
77
 
{
78
 
 
79
 
};
80
 
    void QgsGeometryexportWkbToGeos()
81
 
{
82
 
 
83
 
};
84
 
    void QgsGeometryexportGeosToWkb()
85
 
{
86
 
 
87
 
};
88
 
    void QgsGeometrydistanceSquaredPointToSegment()
89
 
{
90
 
 
91
 
};
92
 
 
93
 
};
94
 
 
95
 
QTEST_MAIN(TestQgsGeometry)
96
 
#include "testqgsgeometry.moc.cpp"
97
 
 
98
 
 
99
 
 
 
45
    void initTestCase();// will be called before the first testfunction is executed.
 
46
    void cleanupTestCase();// will be called after the last testfunction was executed.
 
47
    void init();// will be called before each testfunction is executed.
 
48
    void cleanup();// will be called after every testfunction.
 
49
 
 
50
    void simplifyCheck1();
 
51
    void intersectionCheck1();
 
52
    void intersectionCheck2();
 
53
    void unionCheck1();
 
54
    void unionCheck2();
 
55
    void differenceCheck1();
 
56
    void differenceCheck2();
 
57
    void bufferCheck();
 
58
  private:
 
59
    /** A helper method to do a render check to see if the geometry op is as expected */
 
60
    bool renderCheck( QString theTestName, QString theComment = "" );
 
61
    /** A helper method to return wkb geometry type as a string */
 
62
    QString wkbTypeAsString( QGis::WkbType theType );
 
63
    /** A helper method to dump to qdebug the geometry of a multipolygon */
 
64
    void dumpMultiPolygon( QgsMultiPolygon &theMultiPolygon );
 
65
    /** A helper method to dump to qdebug the geometry of a polygon */
 
66
    void dumpPolygon( QgsPolygon &thePolygon );
 
67
    /** A helper method to dump to qdebug the geometry of a polyline */
 
68
    void dumpPolyline( QgsPolyline &thePolyline );
 
69
    QgsPoint mPoint1;
 
70
    QgsPoint mPoint2;
 
71
    QgsPoint mPoint3;
 
72
    QgsPoint mPoint4;
 
73
    QgsPoint mPointA;
 
74
    QgsPoint mPointB;
 
75
    QgsPoint mPointC;
 
76
    QgsPoint mPointD;
 
77
    QgsPoint mPointW;
 
78
    QgsPoint mPointX;
 
79
    QgsPoint mPointY;
 
80
    QgsPoint mPointZ;
 
81
    QgsPolyline mPolylineA;
 
82
    QgsPolyline mPolylineB;
 
83
    QgsPolyline mPolylineC;
 
84
    QgsGeometry * mpPolylineGeometryD;
 
85
    QgsPolygon mPolygonA;
 
86
    QgsPolygon mPolygonB;
 
87
    QgsPolygon mPolygonC;
 
88
    QgsGeometry * mpPolygonGeometryA;
 
89
    QgsGeometry * mpPolygonGeometryB;
 
90
    QgsGeometry * mpPolygonGeometryC;
 
91
    QString mWktLine;
 
92
    QString mTestDataDir;
 
93
    QImage mImage;
 
94
    QPainter * mpPainter;
 
95
    QPen mPen1;
 
96
    QPen mPen2;
 
97
    QString mReport;
 
98
};
 
99
 
 
100
 
 
101
void TestQgsGeometry::init()
 
102
{
 
103
  //
 
104
  // Reset / reinitialise the geometries before each test is run
 
105
  //
 
106
  mPoint1 = QgsPoint( 20.0, 20.0 );
 
107
  mPoint2 = QgsPoint( 80.0, 20.0 );
 
108
  mPoint3 = QgsPoint( 80.0, 80.0 );
 
109
  mPoint4 = QgsPoint( 20.0, 80.0 );
 
110
  mPointA = QgsPoint( 40.0, 40.0 );
 
111
  mPointB = QgsPoint( 100.0, 40.0 );
 
112
  mPointC = QgsPoint( 100.0, 100.0 );
 
113
  mPointD = QgsPoint( 40.0, 100.0 );
 
114
  mPointW = QgsPoint( 200.0, 200.0 );
 
115
  mPointX = QgsPoint( 240.0, 200.0 );
 
116
  mPointY = QgsPoint( 240.0, 240.0 );
 
117
  mPointZ = QgsPoint( 200.0, 240.0 );
 
118
 
 
119
  mWktLine = QString( "LINESTRING(117.623198 35.198654, 117.581274 35.198654, 117.078178 35.324427, 116.868555 35.534051, 116.617007 35.869448, 116.491233 35.953297, 116.155836 36.288694, 116.071987 36.372544, 115.443117 36.749865, 114.814247 37.043338, 114.311152 37.169112, 113.388810 37.378735, 113.095337 37.378735, 112.592241 37.378735, 111.753748 37.294886, 111.502201 37.252961, 111.082954 37.127187, 110.747557 37.127187, 110.160612 36.917564, 110.034838 36.833715, 109.741366 36.749865, 109.573667 36.666016, 109.238270 36.498317, 109.070571 36.414468, 108.819023 36.288694, 108.693250 36.246770, 108.483626 36.162920, 107.645134 35.911372, 106.597017 35.869448, 106.051997 35.701749, 105.800449 35.617900, 105.590826 35.575975, 105.297354 35.575975, 104.961956 35.575975, 104.710409 35.534051, 104.458861 35.492126, 103.871916 35.492126, 103.788066 35.492126, 103.326895 35.408277, 102.949574 35.408277, 102.488402 35.450201, 102.069156 35.450201, 101.482211 35.450201, 100.937191 35.659825, 100.308321 35.869448, 100.056773 36.037146, 99.050582 36.079071, 97.667069 35.743674, 97.163973 35.617900, 96.115857 35.534051, 95.612761 35.534051, 94.396947 35.911372, 93.684228 36.288694, 92.929584 36.833715, 92.258790 37.169112, 91.629920 37.504509, 90.414105 37.881831, 90.414105 37.881831, 90.246407 37.923755, 89.491763 37.839906, 89.156366 37.672207, 88.485572 37.504509, 87.814778 37.252961, 87.563230 37.169112, 87.143983 37.043338, 85.970093 36.875639, 85.802395 36.875639, 84.083484 36.959489, 84.041560 37.043338, 82.951519 37.546433, 82.699971 37.630283)" );
 
120
 
 
121
  mPolygonA.clear();
 
122
  mPolygonB.clear();
 
123
  mPolygonC.clear();
 
124
  mPolylineA.clear();
 
125
  mPolylineB.clear();
 
126
  mPolylineC.clear();
 
127
  mPolylineA << mPoint1 << mPoint2 << mPoint3 << mPoint4 << mPoint1;
 
128
  mPolygonA << mPolylineA;
 
129
  //Polygon B intersects Polygon A
 
130
  mPolylineB << mPointA << mPointB << mPointC << mPointD << mPointA;
 
131
  mPolygonB << mPolylineB;
 
132
  // Polygon C should intersect no other polys
 
133
  mPolylineC << mPointW << mPointX << mPointY << mPointZ << mPointW;
 
134
  mPolygonC << mPolylineC;
 
135
 
 
136
  mpPolylineGeometryD = QgsGeometry::fromWkt( mWktLine );
 
137
 
 
138
  //polygon: first item of the list is outer ring,
 
139
  // inner rings (if any) start from second item
 
140
  mpPolygonGeometryA = QgsGeometry::fromPolygon( mPolygonA );
 
141
  mpPolygonGeometryB = QgsGeometry::fromPolygon( mPolygonB );
 
142
  mpPolygonGeometryC = QgsGeometry::fromPolygon( mPolygonC );
 
143
 
 
144
  mImage = QImage( 250, 250, QImage::Format_RGB32 );
 
145
  mImage.fill( qRgb( 152, 219, 249 ) );
 
146
  mpPainter = new QPainter( &mImage );
 
147
 
 
148
  // Draw the test shapes first
 
149
  mPen1 = QPen();
 
150
  mPen1.setWidth( 5 );
 
151
  mPen1.setBrush( Qt::green );
 
152
  mpPainter->setPen( mPen1 );
 
153
  dumpPolygon( mPolygonA );
 
154
  mPen1.setBrush( Qt::red );
 
155
  mpPainter->setPen( mPen1 );
 
156
  dumpPolygon( mPolygonB );
 
157
  mPen1.setBrush( Qt::blue );
 
158
  mpPainter->setPen( mPen1 );
 
159
  dumpPolygon( mPolygonC );
 
160
 
 
161
  mPen2 = QPen();
 
162
  mPen2.setWidth( 1 );
 
163
  mPen2.setBrush( Qt::black );
 
164
  QBrush myBrush( Qt::DiagCrossPattern );
 
165
 
 
166
 
 
167
  //set the pen to a different color -
 
168
  //any test outs will be drawn in pen2
 
169
  mpPainter->setPen( mPen2 );
 
170
  mpPainter->setBrush( myBrush );
 
171
}
 
172
 
 
173
void TestQgsGeometry::cleanup()
 
174
{
 
175
  // will be called after every testfunction.
 
176
  delete mpPolygonGeometryA;
 
177
  delete mpPolygonGeometryB;
 
178
  delete mpPolygonGeometryC;
 
179
  delete mpPainter;
 
180
}
 
181
 
 
182
void TestQgsGeometry::initTestCase()
 
183
{
 
184
  //
 
185
  // Runs once before any tests are run
 
186
  //
 
187
  // init QGIS's paths - true means that all path will be inited from prefix
 
188
  QString qgisPath = QCoreApplication::applicationDirPath();
 
189
  QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
 
190
  QgsApplication::showSettings();
 
191
  mReport += "<h1>Geometry Tests</h1>\n";
 
192
  mReport += "<p><font color=\"green\">Green = polygonA</font></p>\n";
 
193
  mReport += "<p><font color=\"red\">Red = polygonB</font></p>\n";
 
194
  mReport += "<p><font color=\"blue\">Blue = polygonC</font></p>\n";
 
195
}
 
196
 
 
197
 
 
198
void TestQgsGeometry::cleanupTestCase()
 
199
{
 
200
  //
 
201
  // Runs once after all tests are run
 
202
  //
 
203
  QString myReportFile = QDir::tempPath() + QDir::separator() + "geometrytest.html";
 
204
  QFile myFile( myReportFile );
 
205
  if ( myFile.open( QIODevice::WriteOnly ) )
 
206
  {
 
207
    QTextStream myQTextStream( &myFile );
 
208
    myQTextStream << mReport;
 
209
    myFile.close();
 
210
    QDesktopServices::openUrl( "file://" + myReportFile );
 
211
  }
 
212
 
 
213
}
 
214
 
 
215
void TestQgsGeometry::simplifyCheck1()
 
216
{
 
217
  QVERIFY( mpPolylineGeometryD->simplify( 0.5 ) );
 
218
  // should be a single polygon as A intersect B
 
219
  QgsGeometry * mypSimplifyGeometry  =  mpPolylineGeometryD->simplify( 0.5 );
 
220
  qDebug( "Geometry Type: %s", wkbTypeAsString( mypSimplifyGeometry->wkbType() ).toLocal8Bit().constData() );
 
221
  QVERIFY( mypSimplifyGeometry->wkbType() == QGis::WKBLineString );
 
222
  QgsPolyline myLine = mypSimplifyGeometry->asPolyline();
 
223
  QVERIFY( myLine.size() > 0 ); //check that the union created a feature
 
224
  dumpPolyline( myLine );
 
225
  delete mypSimplifyGeometry;
 
226
  QVERIFY( renderCheck( "geometry_simplifyCheck1", "Checking simplify of line" ) );
 
227
}
 
228
void TestQgsGeometry::intersectionCheck1()
 
229
{
 
230
  QVERIFY( mpPolygonGeometryA->intersects( mpPolygonGeometryB ) );
 
231
  // should be a single polygon as A intersect B
 
232
  QgsGeometry * mypIntersectionGeometry  =  mpPolygonGeometryA->intersection( mpPolygonGeometryB );
 
233
  qDebug( "Geometry Type: %s", wkbTypeAsString( mypIntersectionGeometry->wkbType() ).toLocal8Bit().constData() );
 
234
  QVERIFY( mypIntersectionGeometry->wkbType() == QGis::WKBPolygon );
 
235
  QgsPolygon myPolygon = mypIntersectionGeometry->asPolygon();
 
236
  QVERIFY( myPolygon.size() > 0 ); //check that the union created a feature
 
237
  dumpPolygon( myPolygon );
 
238
  delete mypIntersectionGeometry;
 
239
  QVERIFY( renderCheck( "geometry_intersectionCheck1", "Checking if A intersects B" ) );
 
240
}
 
241
void TestQgsGeometry::intersectionCheck2()
 
242
{
 
243
  QVERIFY( !mpPolygonGeometryA->intersects( mpPolygonGeometryC ) );
 
244
}
 
245
 
 
246
void TestQgsGeometry::unionCheck1()
 
247
{
 
248
  // should be a multipolygon with 2 parts as A does not intersect C
 
249
  QgsGeometry * mypUnionGeometry  =  mpPolygonGeometryA->combine( mpPolygonGeometryC );
 
250
  qDebug( "Geometry Type: %s", wkbTypeAsString( mypUnionGeometry->wkbType() ).toLocal8Bit().constData() );
 
251
  QVERIFY( mypUnionGeometry->wkbType() == QGis::WKBMultiPolygon );
 
252
  QgsMultiPolygon myMultiPolygon = mypUnionGeometry->asMultiPolygon();
 
253
  QVERIFY( myMultiPolygon.size() > 0 ); //check that the union did not fail
 
254
  dumpMultiPolygon( myMultiPolygon );
 
255
  delete mypUnionGeometry;
 
256
  QVERIFY( renderCheck( "geometry_unionCheck1", "Checking A union C produces 2 polys" ) );
 
257
}
 
258
 
 
259
void TestQgsGeometry::unionCheck2()
 
260
{
 
261
  // should be a single polygon as A intersect B
 
262
  QgsGeometry * mypUnionGeometry  =  mpPolygonGeometryA->combine( mpPolygonGeometryB );
 
263
  qDebug( "Geometry Type: %s", wkbTypeAsString( mypUnionGeometry->wkbType() ).toLocal8Bit().constData() );
 
264
  QVERIFY( mypUnionGeometry->wkbType() == QGis::WKBPolygon );
 
265
  QgsPolygon myPolygon = mypUnionGeometry->asPolygon();
 
266
  QVERIFY( myPolygon.size() > 0 ); //check that the union created a feature
 
267
  dumpPolygon( myPolygon );
 
268
  delete mypUnionGeometry;
 
269
  QVERIFY( renderCheck( "geometry_unionCheck2", "Checking A union B produces single union poly" ) );
 
270
}
 
271
 
 
272
void TestQgsGeometry::differenceCheck1()
 
273
{
 
274
  // should be same as A since A does not intersect C so diff is 100% of A
 
275
  QgsGeometry * mypDifferenceGeometry  =  mpPolygonGeometryA->difference( mpPolygonGeometryC );
 
276
  qDebug( "Geometry Type: %s", wkbTypeAsString( mypDifferenceGeometry->wkbType() ).toLocal8Bit().constData() );
 
277
  QVERIFY( mypDifferenceGeometry->wkbType() == QGis::WKBPolygon );
 
278
  QgsPolygon myPolygon = mypDifferenceGeometry->asPolygon();
 
279
  QVERIFY( myPolygon.size() > 0 ); //check that the union did not fail
 
280
  dumpPolygon( myPolygon );
 
281
  delete mypDifferenceGeometry;
 
282
  QVERIFY( renderCheck( "geometry_differenceCheck1", "Checking (A - C) = A" ) );
 
283
}
 
284
 
 
285
void TestQgsGeometry::differenceCheck2()
 
286
{
 
287
  // should be a single polygon as (A - B) = subset of A
 
288
  QgsGeometry * mypDifferenceGeometry  =  mpPolygonGeometryA->difference( mpPolygonGeometryB );
 
289
  qDebug( "Geometry Type: %s", wkbTypeAsString( mypDifferenceGeometry->wkbType() ).toLocal8Bit().constData() );
 
290
  QVERIFY( mypDifferenceGeometry->wkbType() == QGis::WKBPolygon );
 
291
  QgsPolygon myPolygon = mypDifferenceGeometry->asPolygon();
 
292
  QVERIFY( myPolygon.size() > 0 ); //check that the union created a feature
 
293
  dumpPolygon( myPolygon );
 
294
  delete mypDifferenceGeometry;
 
295
  QVERIFY( renderCheck( "geometry_differenceCheck2", "Checking (A - B) = subset of A" ) );
 
296
}
 
297
void TestQgsGeometry::bufferCheck()
 
298
{
 
299
  // should be a single polygon
 
300
  QgsGeometry * mypBufferGeometry  =  mpPolygonGeometryB->buffer( 10, 10 );
 
301
  qDebug( "Geometry Type: %s", wkbTypeAsString( mypBufferGeometry->wkbType() ).toLocal8Bit().constData() );
 
302
  QVERIFY( mypBufferGeometry->wkbType() == QGis::WKBPolygon );
 
303
  QgsPolygon myPolygon = mypBufferGeometry->asPolygon();
 
304
  QVERIFY( myPolygon.size() > 0 ); //check that the buffer created a feature
 
305
  dumpPolygon( myPolygon );
 
306
  delete mypBufferGeometry;
 
307
  QVERIFY( renderCheck( "geometry_bufferCheck", "Checking buffer(10,10) of B" ) );
 
308
}
 
309
bool TestQgsGeometry::renderCheck( QString theTestName, QString theComment )
 
310
{
 
311
  mReport += "<h2>" + theTestName + "</h2>\n";
 
312
  mReport += "<h3>" + theComment + "</h3>\n";
 
313
  QString myTmpDir = QDir::tempPath() + QDir::separator() ;
 
314
  QString myFileName = myTmpDir + theTestName + ".png";
 
315
  QString myDataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt
 
316
  QString myTestDataDir = myDataDir + QDir::separator();
 
317
  mImage.save( myFileName, "PNG" );
 
318
  QgsRenderChecker myChecker;
 
319
  myChecker.setExpectedImage( myTestDataDir + "expected_" + theTestName + ".png" );
 
320
  myChecker.setRenderedImage( myFileName );
 
321
  bool myResultFlag = myChecker.compareImages( theTestName );
 
322
  mReport += myChecker.report();
 
323
  return myResultFlag;
 
324
}
 
325
 
 
326
void TestQgsGeometry::dumpMultiPolygon( QgsMultiPolygon &theMultiPolygon )
 
327
{
 
328
  qDebug( "Multipolygon Geometry Dump" );
 
329
  for ( int i = 0; i < theMultiPolygon.size(); i++ )
 
330
  {
 
331
    QgsPolygon myPolygon = theMultiPolygon.at( i );
 
332
    qDebug( "\tPolygon in multipolygon: %d", i );
 
333
    dumpPolygon( myPolygon );
 
334
  }
 
335
}
 
336
 
 
337
void TestQgsGeometry::dumpPolygon( QgsPolygon &thePolygon )
 
338
{
 
339
  QVector<QPointF> myPoints;
 
340
  for ( int j = 0; j < thePolygon.size(); j++ )
 
341
  {
 
342
    QgsPolyline myPolyline = thePolygon.at( j ); //rings of polygon
 
343
    qDebug( "\t\tRing in polygon: %d", j );
 
344
 
 
345
    for ( int k = 0; k < myPolyline.size(); k++ )
 
346
    {
 
347
      QgsPoint myPoint = myPolyline.at( k );
 
348
      qDebug( "\t\t\tPoint in ring %d : %s", k, myPoint.toString().toLocal8Bit().constData() );
 
349
      myPoints << QPointF( myPoint.x(), myPoint.y() );
 
350
    }
 
351
  }
 
352
  mpPainter->drawPolygon( myPoints );
 
353
}
 
354
 
 
355
void TestQgsGeometry::dumpPolyline( QgsPolyline &thePolyline )
 
356
{
 
357
  QVector<QPointF> myPoints;
 
358
//  QgsPolyline myPolyline = thePolyline.at( j ); //rings of polygon
 
359
  for ( int j = 0; j < thePolyline.size(); j++ )
 
360
  {
 
361
    QgsPoint myPoint = thePolyline.at( j );
 
362
//    QgsPolyline myPolyline = thePolygon.at( j ); //rings of polygon
 
363
    myPoints << QPointF( myPoint.x(), myPoint.y() );
 
364
    qDebug( "\t\tPoint in line: %d", j );
 
365
 
 
366
//    for ( int k = 0; k < myPolyline.size(); k++ )
 
367
//    {
 
368
//      QgsPoint myPoint = myPolyline.at( k );
 
369
//      qDebug( "\t\t\tPoint in ring %d : %s", k, myPoint.toString().toLocal8Bit().constData() );
 
370
//      myPoints << QPointF( myPoint.x(), myPoint.y() );
 
371
//    }
 
372
  }
 
373
  mpPainter->drawPolyline( myPoints );
 
374
}
 
375
 
 
376
QString TestQgsGeometry::wkbTypeAsString( QGis::WkbType theType )
 
377
{
 
378
  switch ( theType )
 
379
  {
 
380
    case QGis::WKBPoint:
 
381
      return "WKBPoint";
 
382
    case QGis::WKBLineString:
 
383
      return "WKBLineString";
 
384
    case QGis::WKBPolygon:
 
385
      return "WKBPolygon";
 
386
    case QGis::WKBMultiPoint:
 
387
      return "WKBMultiPoint";
 
388
    case QGis::WKBMultiLineString:
 
389
      return "WKBMultiLineString";
 
390
    case QGis::WKBMultiPolygon:
 
391
      return "WKBMultiPolygon";
 
392
    case QGis::WKBUnknown:
 
393
      return "WKBUnknown";
 
394
    case QGis::WKBPoint25D:
 
395
      return "WKBPoint25D";
 
396
    case QGis::WKBLineString25D:
 
397
      return "WKBLineString25D";
 
398
    case QGis::WKBPolygon25D:
 
399
      return "WKBPolygon25D";
 
400
    case QGis::WKBMultiPoint25D:
 
401
      return "WKBMultiPoint25D";
 
402
    case QGis::WKBMultiLineString25D:
 
403
      return "WKBMultiLineString25D";
 
404
    case QGis::WKBMultiPolygon25D:
 
405
      return "WKBMultiPolygon25D";
 
406
    default:
 
407
      return "Unknown type";
 
408
  }
 
409
}
 
410
 
 
411
QTEST_MAIN( TestQgsGeometry )
 
412
#include "moc_testqgsgeometry.cxx"
100
413