QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
18 #ifndef QGSLINESEGMENT_H
19 #define QGSLINESEGMENT_H
21 #include "qgis_core.h"
60 return std::sqrt( ( mStart.x() - mEnd.x() ) * ( mStart.x() - mEnd.x() ) + ( mStart.y() - mEnd.y() ) * ( mStart.y() - mEnd.y() ) );
69 return ( mStart.x() - mEnd.x() ) * ( mStart.x() - mEnd.x() ) + ( mStart.y() - mEnd.y() ) * ( mStart.y() - mEnd.y() );
211 int pointLeftOfLine(
const QgsPointXY &point )
const;
218 std::swap( mStart, mEnd );
224 return mStart == other.mStart && mEnd == other.mEnd;
230 return mStart != other.mStart || mEnd != other.mEnd;
240 #endif // QGSLINESEGMENT_H
double endX() const
Returns the segment's end x-coordinate.
void setStartX(double x)
Sets the segment's start x coordinate.
Line string geometry type, with support for z-dimension and m-values.
bool operator!=(const QgsLineSegment2D &other) const
Inequality operator.
void setStart(const QgsPointXY &start)
Sets the segment's start point.
double startY() const
Returns the segment's start y-coordinate.
QgsPointXY start() const
Returns the segment's start point.
double lengthSquared() const
Returns the squared length of the segment.
QgsLineSegment2D(const QgsPointXY &start, const QgsPointXY &end)
Constructor for a QgsLineSegment2D from the specified start point to the end point.
void setStartY(double y)
Sets the segment's start y coordinate.
void setEndX(double x)
Sets the segment's end x coordinate.
bool operator==(const QgsLineSegment2D &other) const
Equality operator.
void reverse()
Reverses the line segment, so that the start and end points are flipped.
void setEndY(double y)
Sets the segment's end y coordinate.
void setEnd(const QgsPointXY &end)
Sets the segment's end point.
double endY() const
Returns the segment's end y-coordinate.
double startX() const
Returns the segment's start x-coordinate.
QgsPointXY end() const
Returns the segment's end point.
double length() const
Returns the length of the segment.
QgsLineSegment2D(double x1, double y1, double x2, double y2)
Constructor for a QgsLineSegment2D from the point (x1, y2) to (x2, y2).