Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Expose QgsGeometryUtils to python bindings
Has some handy functions and there's no strong reason anymore why these shouldn't be part of stable API
- Loading branch information
Showing
3 changed files
with
105 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
class QgsGeometryUtils | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsgeometryutils.h> | ||
%End | ||
|
||
public: | ||
|
||
static QList<QgsLineString*> extractLineStrings( const QgsAbstractGeometry* geom ); | ||
|
||
static QgsPointV2 closestVertex( const QgsAbstractGeometry& geom, const QgsPointV2& pt, QgsVertexId& id /Out/ ); | ||
|
||
static double distanceToVertex( const QgsAbstractGeometry& geom, QgsVertexId id ); | ||
|
||
static bool verticesAtDistance( const QgsAbstractGeometry& geometry, | ||
double distance, | ||
QgsVertexId& previousVertex /Out/, | ||
QgsVertexId& nextVertex /Out/ ); | ||
|
||
static void adjacentVertices( const QgsAbstractGeometry& geom, QgsVertexId atVertex, QgsVertexId& beforeVertex /Out/, QgsVertexId& afterVertex /Out/ ); | ||
|
||
static double sqrDistance2D( const QgsPointV2& pt1, const QgsPointV2& pt2 ); | ||
|
||
static double sqrDistToLine( double ptX, double ptY, double x1, double y1, double x2, double y2, double& minDistX /Out/, double& minDistY /Out/, double epsilon ); | ||
|
||
static bool lineIntersection( const QgsPointV2& p1, QgsVector v, const QgsPointV2& q1, QgsVector w, QgsPointV2& inter /Out/ ); | ||
|
||
static bool segmentIntersection( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &q1, const QgsPointV2 &q2, QgsPointV2& inter /Out/, double tolerance ); | ||
|
||
static QgsPointV2 projPointOnSegment( const QgsPointV2& p, const QgsPointV2& s1, const QgsPointV2& s2 ); | ||
|
||
static double leftOfLine( double x, double y, double x1, double y1, double x2, double y2 ); | ||
|
||
static QgsPointV2 pointOnLineWithDistance( const QgsPointV2& startPoint, const QgsPointV2& directionPoint, double distance ); | ||
|
||
static double ccwAngle( double dy, double dx ); | ||
|
||
static void circleCenterRadius( const QgsPointV2& pt1, const QgsPointV2& pt2, const QgsPointV2& pt3, double& radius /Out/, | ||
double& centerX /Out/, double& centerY /Out/ ); | ||
|
||
static bool circleClockwise( double angle1, double angle2, double angle3 ); | ||
|
||
static bool circleAngleBetween( double angle, double angle1, double angle2, bool clockwise ); | ||
|
||
static bool angleOnCircle( double angle, double angle1, double angle2, double angle3 ); | ||
|
||
static double circleLength( double x1, double y1, double x2, double y2, double x3, double y3 ); | ||
|
||
static double sweepAngle( double centerX, double centerY, double x1, double y1, double x2, double y2, double x3, double y3 ); | ||
|
||
static bool segmentMidPoint( const QgsPointV2& p1, const QgsPointV2& p2, QgsPointV2& result /Out/, double radius, const QgsPointV2& mousePos ); | ||
|
||
static double circleTangentDirection( const QgsPointV2& tangentPoint, const QgsPointV2& cp1, const QgsPointV2& cp2, const QgsPointV2& cp3 ); | ||
|
||
static double normalizedAngle( double angle ); | ||
|
||
static double lineAngle( double x1, double y1, double x2, double y2 ); | ||
|
||
static double angleBetweenThreePoints( double x1, double y1, double x2, double y2, | ||
double x3, double y3 ); | ||
|
||
static double linePerpendicularAngle( double x1, double y1, double x2, double y2 ); | ||
|
||
static double averageAngle( double x1, double y1, double x2, double y2, double x3, double y3 ); | ||
|
||
static double averageAngle( double a1, double a2 ); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters