Skip to content
Permalink
Browse files

Add "convert to curves" algorithm followup

  • Loading branch information
olivierdalang committed May 11, 2020
1 parent 9939142 commit ab423ca2a4d91e09633fe7e60bcce9092ec3c6ef
@@ -1229,6 +1229,21 @@ Curved geometry types are automatically segmentized by this routine.
.. seealso:: :py:func:`densifyByCount`

.. versionadded:: 3.0
%End

QgsGeometry convertToCurves( double distanceTolerance = 1e-8, double angleTolerance = 1e-8 ) const;
%Docstring
Attempts to convert a non-curved geometry into a curved geometry type (e.g.
LineString to CompoundCurve, Polygon to CurvePolygon).

The ``distanceTolerance`` specifies the maximum deviation allowed between the original location
of vertices and where they would fall on the candidate curved geometry.

This method only consider a segments as suitable for replacing with an arc if the points are all
regularly spaced on the candidate arc. The ``pointSpacingAngleTolerance`` parameter specifies the maximum
angular deviation (in radians) allowed when testing for regular point spacing.

.. versionadded:: 3.14
%End

QgsGeometry centroid() const;
@@ -242,7 +242,7 @@ Project the point on a segment

static int leftOfLine( const double x, const double y, const double x1, const double y1, const double x2, const double y2 );
%Docstring
Returns a value < 0 if the point (``x``, ``y``) is left of the line from (``x1``, ``y1``) -> ( ``x2``, ``y2``).
Returns a value < 0 if the point (``x``, ``y``) is left of the line from (``x1``, ``y1``) -> (``x2``, ``y2``).
A positive return value indicates the point is to the right of the line.

If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly
@@ -352,6 +352,22 @@ Calculates the direction angle of a circle tangent (clockwise from north in radi
Convert circular arc defined by p1, p2, p3 (p1/p3 being start resp. end point, p2 lies on the arc) into a sequence of points.

.. versionadded:: 3.0
%End

static bool pointContinuesArc( const QgsPoint &a1, const QgsPoint &a2, const QgsPoint &a3, const QgsPoint &b, double distanceTolerance,
double pointSpacingAngleTolerance );
%Docstring
Returns true if point ``b`` is on the arc formed by points ``a1``, ``a2``, and ``a3``, but not within
that arc portion already described by ``a1``, ``a2`` and ``a3``.

The ``distanceTolerance`` specifies the maximum deviation allowed between the original location
of point \b and where it would fall on the candidate arc.

This method only consider a segments as continuing an arc if the points are all regularly spaced
on the candidate arc. The ``pointSpacingAngleTolerance`` parameter specifies the maximum
angular deviation (in radians) allowed when testing for regular point spacing.

.. versionadded:: 3.14
%End

static int segmentSide( const QgsPoint &pt1, const QgsPoint &pt3, const QgsPoint &pt2 );
@@ -15,8 +15,8 @@
* *
***************************************************************************/

#ifndef QGSALGORITHMSEGMENTIZE_H
#define QGSALGORITHMSEGMENTIZE_H
#ifndef QGSALGORITHMCONVERTTOCURVES_H
#define QGSALGORITHMCONVERTTOCURVES_H

#define SIP_NO_FILE

@@ -65,6 +65,6 @@ class QgsConvertToCurvesAlgorithm : public QgsProcessingFeatureBasedAlgorithm

///@endcond PRIVATE

#endif // QGSALGORITHMSEGMENTIZE_H
#endif // QGSALGORITHMCONVERTTOCURVES_H


@@ -1254,7 +1254,7 @@ class CORE_EXPORT QgsGeometry
* regularly spaced on the candidate arc. The \a pointSpacingAngleTolerance parameter specifies the maximum
* angular deviation (in radians) allowed when testing for regular point spacing.
*
* \since QGIS 3.2
* \since QGIS 3.14
*/
QgsGeometry convertToCurves( double distanceTolerance = 1e-8, double angleTolerance = 1e-8 ) const;

@@ -383,7 +383,7 @@ class CORE_EXPORT QgsGeometryUtils
* on the candidate arc. The \a pointSpacingAngleTolerance parameter specifies the maximum
* angular deviation (in radians) allowed when testing for regular point spacing.
*
* \since QGIS 3.2
* \since QGIS 3.14
*/
static bool pointContinuesArc( const QgsPoint &a1, const QgsPoint &a2, const QgsPoint &a3, const QgsPoint &b, double distanceTolerance,
double pointSpacingAngleTolerance );
@@ -177,7 +177,7 @@ class QgsInternalGeometryEngine
* regularly spaced on the candidate arc. The \a pointSpacingAngleTolerance parameter specifies the maximum
* angular deviation (in radians) allowed when testing for regular point spacing.
*
* \since QGIS 3.2
* \since QGIS 3.14
*/
QgsGeometry convertToCurves( double distanceTolerance, double angleTolerance ) const;

0 comments on commit ab423ca

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