Skip to content

Commit

Permalink
Add a few more geometry docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 2, 2015
1 parent 560f161 commit 5a47709
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/core/geometry/qgsgeometryutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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
Expand Down

0 comments on commit 5a47709

Please sign in to comment.