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() );
218 std::swap( mStart, mEnd );
226 return mStart == other.mStart && mEnd == other.mEnd;
232 return mStart != other.mStart || mEnd != other.mEnd;
Represents a single 2D line segment, consisting of a 2D start and end vertex only.
QgsPointXY end() const SIP_HOLDGIL
Returns the segment's end point.
void setStart(const QgsPointXY &start) SIP_HOLDGIL
Sets the segment's start point.
double endX() const SIP_HOLDGIL
Returns the segment's end x-coordinate.
QgsLineSegment2D(double x1, double y1, double x2, double y2) SIP_HOLDGIL
Constructor for a QgsLineSegment2D from the point (x1, y2) to (x2, y2).
void setStartX(double x) SIP_HOLDGIL
Sets the segment's start x coordinate.
double lengthSquared() const SIP_HOLDGIL
Returns the squared length of the segment.
double endY() const SIP_HOLDGIL
Returns the segment's end y-coordinate.
double startX() const SIP_HOLDGIL
Returns the segment's start x-coordinate.
void setEndY(double y) SIP_HOLDGIL
Sets the segment's end y coordinate.
QgsLineSegment2D(const QgsPointXY &start, const QgsPointXY &end) SIP_HOLDGIL
Constructor for a QgsLineSegment2D from the specified start point to the end point.
QgsPointXY start() const SIP_HOLDGIL
Returns the segment's start point.
void reverse() SIP_HOLDGIL
Reverses the line segment, so that the start and end points are flipped.
double length() const SIP_HOLDGIL
Returns the length of the segment.
bool operator==(const QgsLineSegment2D &other) const SIP_HOLDGIL
Equality operator.
void setEndX(double x) SIP_HOLDGIL
Sets the segment's end x coordinate.
void setEnd(const QgsPointXY &end) SIP_HOLDGIL
Sets the segment's end point.
void setStartY(double y) SIP_HOLDGIL
Sets the segment's start y coordinate.
double startY() const SIP_HOLDGIL
Returns the segment's start y-coordinate.
bool operator!=(const QgsLineSegment2D &other) const SIP_HOLDGIL
Inequality operator.
Line string geometry type, with support for z-dimension and m-values.
A class to represent a 2D point.