Skip to content
Permalink
Browse files
Add a few more geometry docs
  • Loading branch information
nyalldawson committed Jun 2, 2015
1 parent 560f161 commit 5a477095e0d3fd9fc8143398947ef33bf2e7b223
Showing with 21 additions and 10 deletions.
  1. +21 −10 src/core/geometry/qgsgeometryutils.h
@@ -44,37 +44,42 @@ class CORE_EXPORT QgsGeometryUtils
*/
static double sqrDistToLine( double ptX, double ptY, double x1, double y1, double x2, double y2, double& minDistX, double& minDistY, double epsilon );

/**Returns < 0 if point(x/y) is left of the line x1,y1 -> x2,y2*/
/** Returns < 0 if point(x/y) is left of the line x1,y1 -> x2,y2*/
static double leftOfLine( double x, double y, double x1, double y1, double x2, double y2 );

/** Returns a point a specified distance toward a second point.
*/
static QgsPointV2 pointOnLineWithDistance( const QgsPointV2& startPoint, const QgsPointV2& directionPoint, double distance );

/**Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 and dy = 0*/
/** Returns the counter clockwise angle between a line with components dx, dy and the line with dx > 0 and dy = 0*/
static double ccwAngle( double dy, double dx );

/**Returns radius and center of the circle through pt1, pt2, pt3*/
/** Returns radius and center of the circle through pt1, pt2, pt3*/
static void circleCenterRadius( const QgsPointV2& pt1, const QgsPointV2& pt2, const QgsPointV2& pt3, double& radius,
double& centerX, double& centerY );

/**Returns true if circle is ordered clockwise*/
/** Returns true if circle is ordered clockwise*/
static bool circleClockwise( double angle1, double angle2, double angle3 );

/**Returns true if, in a circle, angle is between angle1 and angle2*/
/** Returns true if, in a circle, angle is between angle1 and angle2*/
static bool circleAngleBetween( double angle, double angle1, double angle2, bool clockwise );

/** Returns true if an angle is between angle1 and angle3 on a circle described by
* angle1, angle2 and angle3.
*/
static bool angleOnCircle( double angle, double angle1, double angle2, double angle3 );

/**Length of a circular string segment defined by pt1, pt2, pt3*/
/** Length of a circular string segment defined by pt1, pt2, pt3*/
static double circleLength( double x1, double y1, double x2, double y2, double x3, double y3 );

/**Calculates angle of a circular string part defined by pt1, pt2, pt3*/
/** Calculates angle of a circular string part defined by pt1, pt2, pt3*/
static double sweepAngle( double centerX, double centerY, double x1, double y1, double x2, double y2, double x3, double y3 );

/**calculates midpoint on circle passing through p1 and p2, closest to given coordinate*/
/** Calculates midpoint on circle passing through p1 and p2, closest to given coordinate*/
static bool segmentMidPoint( const QgsPointV2& p1, const QgsPointV2& p2, QgsPointV2& result, double radius, const QgsPointV2& mousePos );

/** Returns a list of points contained in a WKT string.
*/
static QList<QgsPointV2> pointsFromWKT( const QString& wktCoordinateList, bool is3D, bool isMeasure );
/** Returns a LinearRing { uint32 numPoints; Point points[numPoints]; } */
static void pointsToWKB( QgsWkbPtr &wkb, const QList<QgsPointV2>& points, bool is3D, bool isMeasure );
@@ -87,9 +92,15 @@ class CORE_EXPORT QgsGeometryUtils
/** Returns a geoJSON coordinates string */
static QString pointsToJSON( const QList<QgsPointV2>& points, int precision );

// "TYPE (contents)" -> Pair(wkbType, "contents")
/** Parses a WKT block of the format "TYPE( contents )" and returns a pair of geometry type to contents ("Pair(wkbType, "contents")")
*/
static QPair<QgsWKBTypes::Type, QString> wktReadBlock( const QString& wkt );
// "TYPE1 (contents1), TYPE2 (TYPE3 (contents3), TYPE4 (contents4))" -> List("TYPE1 (contents1)", "TYPE2 (TYPE3 (contents3), TYPE4 (contents4))")

/** Parses a WKT string and returns of list of blocks contained in the WKT.
* @param wkt WKT string in the format "TYPE1 (contents1), TYPE2 (TYPE3 (contents3), TYPE4 (contents4))"
* @param defaultTYpe
* @returns list of WKT child block strings, eg List("TYPE1 (contents1)", "TYPE2 (TYPE3 (contents3), TYPE4 (contents4))")
*/
static QStringList wktGetChildBlocks( const QString& wkt , const QString &defaultType = "" );

enum componentType

0 comments on commit 5a47709

Please sign in to comment.