Skip to content
Permalink
Browse files

Expose segmentization parameters to QgsGeometry::convertToStraightSeg…

…ment
  • Loading branch information
nyalldawson committed Mar 4, 2018
1 parent 871132e commit 6bd7600aa3c9d83bbae95f54b76d37ce5e55dd84
@@ -1423,10 +1423,13 @@ An empty geometry will be returned in the case of errors.
.. versionadded:: 3.0
%End

void convertToStraightSegment();
void convertToStraightSegment( double tolerance = M_PI / 180., QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle );
%Docstring
Converts the geometry to straight line segments, if it is a curved geometry type.

:param tolerance: segmentation tolerance
:param toleranceType: maximum segmentation angle or maximum difference between approximation and curve

.. versionadded:: 2.10

.. seealso:: :py:func:`requiresConversionToStraightSegments`
@@ -2312,14 +2312,14 @@ QgsGeometry QgsGeometry::polygonize( const QVector<QgsGeometry> &geometryList )
return result;
}

void QgsGeometry::convertToStraightSegment()
void QgsGeometry::convertToStraightSegment( double tolerance, QgsAbstractGeometry::SegmentationToleranceType toleranceType )
{
if ( !d->geometry || !requiresConversionToStraightSegments() )
{
return;
}

std::unique_ptr< QgsAbstractGeometry > straightGeom( d->geometry->segmentize() );
std::unique_ptr< QgsAbstractGeometry > straightGeom( d->geometry->segmentize( tolerance, toleranceType ) );
reset( std::move( straightGeom ) );
}

@@ -1413,10 +1413,12 @@ class CORE_EXPORT QgsGeometry

/**
* Converts the geometry to straight line segments, if it is a curved geometry type.
* \param tolerance segmentation tolerance
* \param toleranceType maximum segmentation angle or maximum difference between approximation and curve
* \since QGIS 2.10
* \see requiresConversionToStraightSegments
*/
void convertToStraightSegment();
void convertToStraightSegment( double tolerance = M_PI / 180., QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle );

/**
* Returns true if the geometry is a curved geometry type which requires conversion to

0 comments on commit 6bd7600

Please sign in to comment.
You can’t perform that action at this time.