Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Optimise QgsCurve::asQPolygonF for linestring geometries
- Loading branch information
|
@@ -177,7 +177,7 @@ Returns the y-coordinate of the specified node in the line string. |
|
|
:return: y-coordinate of node, or 0.0 if index is out of bounds |
|
|
%End |
|
|
|
|
|
QPolygonF asQPolygonF() const; |
|
|
virtual QPolygonF asQPolygonF() const; |
|
|
%Docstring |
|
|
Returns a QPolygonF representing the points. |
|
|
%End |
|
|
|
@@ -216,6 +216,7 @@ segment in the line. |
|
|
|
|
|
virtual bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false ); |
|
|
|
|
|
virtual QPolygonF asQPolygonF() const; |
|
|
|
|
|
virtual bool fromWkb( QgsConstWkbPtr &wkb ); |
|
|
|
|
|
|
@@ -164,7 +164,7 @@ class CORE_EXPORT QgsCurve: public QgsAbstractGeometry |
|
|
/** |
|
|
* Returns a QPolygonF representing the points. |
|
|
*/ |
|
|
QPolygonF asQPolygonF() const; |
|
|
virtual QPolygonF asQPolygonF() const; |
|
|
|
|
|
/** |
|
|
* Returns the straight distance of the curve, i.e. the direct/euclidean distance |
|
|
|
@@ -274,6 +274,21 @@ bool QgsLineString::removeDuplicateNodes( double epsilon, bool useZValues ) |
|
|
return result; |
|
|
} |
|
|
|
|
|
QPolygonF QgsLineString::asQPolygonF() const |
|
|
{ |
|
|
const int nb = mX.size(); |
|
|
QPolygonF points( nb ); |
|
|
|
|
|
const double *x = mX.constData(); |
|
|
const double *y = mY.constData(); |
|
|
QPointF *dest = points.data(); |
|
|
for ( int i = 0; i < nb; ++i ) |
|
|
{ |
|
|
*dest++ = QPointF( *x++, *y++ ); |
|
|
} |
|
|
return points; |
|
|
} |
|
|
|
|
|
bool QgsLineString::fromWkb( QgsConstWkbPtr &wkbPtr ) |
|
|
{ |
|
|
if ( !wkbPtr ) |
|
|
|
@@ -210,6 +210,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve |
|
|
bool isEmpty() const override; |
|
|
QgsLineString *snappedToGrid( double hSpacing, double vSpacing, double dSpacing = 0, double mSpacing = 0 ) const override SIP_FACTORY; |
|
|
bool removeDuplicateNodes( double epsilon = 4 * DBL_EPSILON, bool useZValues = false ) override; |
|
|
virtual QPolygonF asQPolygonF() const override; |
|
|
|
|
|
bool fromWkb( QgsConstWkbPtr &wkb ) override; |
|
|
bool fromWkt( const QString &wkt ) override; |
|
|