15
15
16
16
17
17
18
- typedef QVector<QgsPointXY> QgsPolyline;
18
+ typedef QVector<QgsPointXY> QgsPolylineXY;
19
+
20
+ typedef QVector<QgsPoint> QgsPolyline;
19
21
20
22
typedef QVector<QVector<QgsPointXY>> QgsPolygon;
21
23
@@ -122,11 +124,35 @@ Creates a new geometry from a QgsPointXY object
122
124
Creates a new geometry from a QgsMultiPoint object
123
125
:rtype: QgsGeometry
124
126
%End
127
+
128
+ static QgsGeometry fromPolylineXY( const QgsPolylineXY &polyline );
129
+ %Docstring
130
+ Creates a new LineString geometry from a list of QgsPointXY points.
131
+
132
+ Using fromPolyline() is preferred, as fromPolyline() is more efficient
133
+ and will respect any Z or M dimensions present in the input points.
134
+
135
+ .. note::
136
+
137
+ In QGIS 2.x this method was available as fromPolyline().
138
+
139
+ .. versionadded:: 3.0
140
+ .. seealso:: fromPolyline()
141
+ :rtype: QgsGeometry
142
+ %End
143
+
125
144
static QgsGeometry fromPolyline( const QgsPolyline &polyline );
126
145
%Docstring
127
- Creates a new geometry from a QgsPolyline object
146
+ Creates a new LineString geometry from a list of QgsPoint points.
147
+
148
+ This method will respect any Z or M dimensions present in the input points.
149
+ E.g. if input points are PointZ type, the resultant linestring will be
150
+ a LineStringZ type.
151
+
152
+ .. versionadded:: 3.0
128
153
:rtype: QgsGeometry
129
154
%End
155
+
130
156
static QgsGeometry fromMultiPolyline( const QgsMultiPolyline &multiline );
131
157
%Docstring
132
158
Creates a new geometry from a QgsMultiPolyline object
@@ -1065,11 +1091,11 @@ Returns an extruded version of this geometry.
1065
1091
:rtype: QgsPointXY
1066
1092
%End
1067
1093
1068
- QgsPolyline asPolyline() const;
1094
+ QgsPolylineXY asPolyline() const;
1069
1095
%Docstring
1070
1096
Returns contents of the geometry as a polyline
1071
1097
if wkbType is WKBLineString, otherwise an empty list
1072
- :rtype: QgsPolyline
1098
+ :rtype: QgsPolylineXY
1073
1099
%End
1074
1100
1075
1101
QgsPolygon asPolygon() const;
@@ -1349,13 +1375,13 @@ Returns an extruded version of this geometry.
1349
1375
:rtype: QgsGeometry
1350
1376
%End
1351
1377
1352
- static QgsPolyline createPolylineFromQPolygonF( const QPolygonF &polygon ) /Factory/;
1378
+ static QgsPolylineXY createPolylineFromQPolygonF( const QPolygonF &polygon ) /Factory/;
1353
1379
%Docstring
1354
- Creates a QgsPolyline from a QPolygonF.
1380
+ Creates a QgsPolylineXY from a QPolygonF.
1355
1381
\param polygon source polygon
1356
- :return: QgsPolyline
1382
+ :return: QgsPolylineXY
1357
1383
.. seealso:: createPolygonFromQPolygonF
1358
- :rtype: QgsPolyline
1384
+ :rtype: QgsPolylineXY
1359
1385
%End
1360
1386
1361
1387
static QgsPolygon createPolygonFromQPolygonF( const QPolygonF &polygon ) /Factory/;
@@ -1371,7 +1397,7 @@ Returns an extruded version of this geometry.
1371
1397
static bool compare( PyObject *obj1, PyObject *obj2, double epsilon = 4 * DBL_EPSILON );
1372
1398
%Docstring
1373
1399
Compares two geometry objects for equality within a specified tolerance.
1374
- The objects can be of type QgsPolyline , QgsPolygon or QgsMultiPolygon.
1400
+ The objects can be of type QgsPolylineXY , QgsPolygon or QgsMultiPolygon.
1375
1401
The 2 types should match.
1376
1402
\param p1 first geometry object
1377
1403
\param p2 second geometry object
@@ -1408,10 +1434,10 @@ Returns an extruded version of this geometry.
1408
1434
sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
1409
1435
sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
1410
1436
{
1411
- QgsPolyline *p0;
1412
- QgsPolyline *p1;
1413
- p0 = reinterpret_cast<QgsPolyline *>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1414
- p1 = reinterpret_cast<QgsPolyline *>( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1437
+ QgsPolylineXY *p0;
1438
+ QgsPolylineXY *p1;
1439
+ p0 = reinterpret_cast<QgsPolylineXY *>( sipConvertToType( a0, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state0, &sipIsErr ) );
1440
+ p1 = reinterpret_cast<QgsPolylineXY *>( sipConvertToType( a1, sipType_QVector_0100QgsPointXY, 0, SIP_NOT_NONE, &state1, &sipIsErr ) );
1415
1441
if ( sipIsErr )
1416
1442
{
1417
1443
sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 );
0 commit comments