QGIS API Documentation
3.8.0-Zanzibar (11aff65)
|
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. More... | |
QgsLineSegment2D (double x1, double y1, double x2, double y2) | |
Constructor for a QgsLineSegment2D from the point (x1, y2) to (x2, y2). More... | |
QgsPointXY | end () const |
Returns the segment's end point. More... | |
double | endX () const |
Returns the segment's end x-coordinate. More... | |
double | endY () const |
Returns the segment's end y-coordinate. More... | |
double | length () const |
Returns the length of the segment. More... | |
double | lengthSquared () const |
Returns the squared length of the segment. More... | |
bool | operator!= (const QgsLineSegment2D &other) const |
Inequality operator. More... | |
bool | operator== (const QgsLineSegment2D &other) const |
Equality operator. More... | |
int | pointLeftOfLine (const QgsPointXY &point) const |
Tests if a point is to the left of the line segment. More... | |
void | reverse () |
Reverses the line segment, so that the start and end points are flipped. More... | |
void | setEnd (const QgsPointXY &end) |
Sets the segment's end point. More... | |
void | setEndX (double x) |
Sets the segment's end x coordinate. More... | |
void | setEndY (double y) |
Sets the segment's end y coordinate. More... | |
void | setStart (const QgsPointXY &start) |
Sets the segment's start point. More... | |
void | setStartX (double x) |
Sets the segment's start x coordinate. More... | |
void | setStartY (double y) |
Sets the segment's start y coordinate. More... | |
QgsPointXY | start () const |
Returns the segment's start point. More... | |
double | startX () const |
Returns the segment's start x-coordinate. More... | |
double | startY () const |
Returns the segment's start y-coordinate. More... | |
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 |
Inequality operator.
Definition at line 228 of file qgslinesegment.h.
|
inline |
Equality operator.
Definition at line 222 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.