1515
1616
1717
18- typedef QVector<QgsPointXY> QgsPolyline;
18+ typedef QVector<QgsPointXY> QgsPolylineXY;
19+
20+ typedef QVector<QgsPoint> QgsPolyline;
1921
2022typedef QVector<QVector<QgsPointXY>> QgsPolygon;
2123
@@ -122,11 +124,35 @@ Creates a new geometry from a QgsPointXY object
122124Creates a new geometry from a QgsMultiPoint object
123125 :rtype: QgsGeometry
124126%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+
125144 static QgsGeometry fromPolyline( const QgsPolyline &polyline );
126145%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
128153 :rtype: QgsGeometry
129154%End
155+
130156 static QgsGeometry fromMultiPolyline( const QgsMultiPolyline &multiline );
131157%Docstring
132158Creates a new geometry from a QgsMultiPolyline object
@@ -1065,11 +1091,11 @@ Returns an extruded version of this geometry.
10651091 :rtype: QgsPointXY
10661092%End
10671093
1068- QgsPolyline asPolyline() const;
1094+ QgsPolylineXY asPolyline() const;
10691095%Docstring
10701096 Returns contents of the geometry as a polyline
10711097 if wkbType is WKBLineString, otherwise an empty list
1072- :rtype: QgsPolyline
1098+ :rtype: QgsPolylineXY
10731099%End
10741100
10751101 QgsPolygon asPolygon() const;
@@ -1349,13 +1375,13 @@ Returns an extruded version of this geometry.
13491375 :rtype: QgsGeometry
13501376%End
13511377
1352- static QgsPolyline createPolylineFromQPolygonF( const QPolygonF &polygon ) /Factory/;
1378+ static QgsPolylineXY createPolylineFromQPolygonF( const QPolygonF &polygon ) /Factory/;
13531379%Docstring
1354- Creates a QgsPolyline from a QPolygonF.
1380+ Creates a QgsPolylineXY from a QPolygonF.
13551381 \param polygon source polygon
1356- :return: QgsPolyline
1382+ :return: QgsPolylineXY
13571383.. seealso:: createPolygonFromQPolygonF
1358- :rtype: QgsPolyline
1384+ :rtype: QgsPolylineXY
13591385%End
13601386
13611387 static QgsPolygon createPolygonFromQPolygonF( const QPolygonF &polygon ) /Factory/;
@@ -1371,7 +1397,7 @@ Returns an extruded version of this geometry.
13711397 static bool compare( PyObject *obj1, PyObject *obj2, double epsilon = 4 * DBL_EPSILON );
13721398%Docstring
13731399 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.
13751401 The 2 types should match.
13761402 \param p1 first geometry object
13771403 \param p2 second geometry object
@@ -1408,10 +1434,10 @@ Returns an extruded version of this geometry.
14081434 sipCanConvertToType( a0, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) &&
14091435 sipCanConvertToType( a1, sipType_QVector_0100QgsPointXY, SIP_NOT_NONE ) )
14101436 {
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 ) );
14151441 if ( sipIsErr )
14161442 {
14171443 sipReleaseType( p0, sipType_QVector_0100QgsPointXY, state0 );
0 commit comments