QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
Represents a single 2D line segment, consisting of a 2D start and end vertex only. More...
#include <qgslinesegment.h>
Public Member Functions | |
QgsLineSegment2D (const QgsPointXY &start, const QgsPointXY &end) | |
Constructor for a QgsLineSegment2D from the specified start point to the end point. | |
QgsLineSegment2D (double x1, double y1, double x2, double y2) | |
Constructor for a QgsLineSegment2D from the point (x1, y2) to (x2, y2). | |
QgsPointXY | end () const |
Returns the segment's end point. | |
double | endX () const |
Returns the segment's end x-coordinate. | |
double | endY () const |
Returns the segment's end y-coordinate. | |
double | length () const |
Returns the length of the segment. | |
double | lengthSquared () const |
Returns the squared length of the segment. | |
bool | operator!= (const QgsLineSegment2D &other) const |
bool | operator== (const QgsLineSegment2D &other) const |
int | pointLeftOfLine (const QgsPointXY &point) const |
Tests if a point is to the left of the line segment. | |
void | reverse () |
Reverses the line segment, so that the start and end points are flipped. | |
void | setEnd (const QgsPointXY &end) |
Sets the segment's end point. | |
void | setEndX (double x) |
Sets the segment's end x coordinate. | |
void | setEndY (double y) |
Sets the segment's end y coordinate. | |
void | setStart (const QgsPointXY &start) |
Sets the segment's start point. | |
void | setStartX (double x) |
Sets the segment's start x coordinate. | |
void | setStartY (double y) |
Sets the segment's start y coordinate. | |
QgsPointXY | start () const |
Returns the segment's start point. | |
double | startX () const |
Returns the segment's start x-coordinate. | |
double | startY () const |
Returns the segment's start y-coordinate. | |
Represents a single 2D line segment, consisting of a 2D start and end vertex only.
Definition at line 31 of file qgslinesegment.h.
|
inline |
Constructor for a QgsLineSegment2D from the specified start point to the end point.
Definition at line 40 of file qgslinesegment.h.
|
inline |
Constructor for a QgsLineSegment2D from the point (x1, y2) to (x2, y2).
Definition at line 49 of file qgslinesegment.h.
|
inline |
Returns the segment's end point.
Definition at line 129 of file qgslinesegment.h.
|
inline |
Returns the segment's end x-coordinate.
Definition at line 97 of file qgslinesegment.h.
|
inline |
Returns the segment's end y-coordinate.
Definition at line 107 of file qgslinesegment.h.
|
inline |
Returns the length of the segment.
Definition at line 58 of file qgslinesegment.h.
|
inline |
Returns the squared length of the segment.
Definition at line 67 of file qgslinesegment.h.
|
inline |
Definition at line 228 of file qgslinesegment.h.
|
inline |
Definition at line 223 of file qgslinesegment.h.
int QgsLineSegment2D::pointLeftOfLine | ( | const QgsPointXY & | point | ) | const |
Tests if a point is to the left of the line segment.
Returns -1 if the point falls to the left of the line, or +1 if the point is to the right.
If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly on the line, or exactly in line with the segment) and the result is undefined.
Definition at line 21 of file qgslinesegment.cpp.
|
inline |
Reverses the line segment, so that the start and end points are flipped.
Definition at line 216 of file qgslinesegment.h.
|
inline |
Sets the segment's end point.
Definition at line 195 of file qgslinesegment.h.
|
inline |
Sets the segment's end x coordinate.
Definition at line 162 of file qgslinesegment.h.
|
inline |
Sets the segment's end y coordinate.
Definition at line 173 of file qgslinesegment.h.
|
inline |
Sets the segment's start point.
Definition at line 184 of file qgslinesegment.h.
|
inline |
Sets the segment's start x coordinate.
Definition at line 140 of file qgslinesegment.h.
|
inline |
Sets the segment's start y coordinate.
Definition at line 151 of file qgslinesegment.h.
|
inline |
Returns the segment's start point.
Definition at line 118 of file qgslinesegment.h.
|
inline |
Returns the segment's start x-coordinate.
Definition at line 77 of file qgslinesegment.h.
|
inline |
Returns the segment's start y-coordinate.
Definition at line 87 of file qgslinesegment.h.