Class: QgsLineSegment2D¶
-
class
qgis.core.
QgsLineSegment2D
(start: QgsPointXY, end: QgsPointXY)¶ Bases:
sip.wrapper
Constructor for a QgsLineSegment2D from the specified
start
point to theend
point.QgsLineSegment2D(x1: float, y1: float, x2: float, y2: float) Constructor for a QgsLineSegment2D from the point (
x1
,y2
) to (x2
,y2
).QgsLineSegment2D(QgsLineSegment2D)
Represents a single 2D line segment, consisting of a 2D start and end vertex only.
New in version 3.2: Enums
Methods
Returns the segment’s end point.
Returns the segment’s end x-coordinate.
Returns the segment’s end y-coordinate.
Returns the length of the segment.
Returns the squared length of the segment.
Tests if a
point
is to the left of the line segment.Reverses the line segment, so that the start and end points are flipped.
Sets the segment’s
end
point.Sets the segment’s end
x
coordinate.Sets the segment’s end
y
coordinate.Sets the segment’s
start
point.Sets the segment’s start
x
coordinate.Sets the segment’s start
y
coordinate.Returns the segment’s start point.
Returns the segment’s start x-coordinate.
Returns the segment’s start y-coordinate.
Signals
Attributes
-
end
(self) → QgsPointXY¶ Returns the segment’s end point.
See also
See also
See also
-
length
(self) → float¶ Returns the length of the segment.
See also
-
pointLeftOfLine
(self, point: QgsPointXY) → int¶ 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.
See also
-
reverse
(self)¶ Reverses the line segment, so that the start and end points are flipped.
-
setEnd
(self, end: QgsPointXY)¶ Sets the segment’s
end
point.See also
See also
See also
-
setEndX
(self, x: float)¶ Sets the segment’s end
x
coordinate.See also
See also
See also
-
setEndY
(self, y: float)¶ Sets the segment’s end
y
coordinate.See also
See also
See also
-
setStart
(self, start: QgsPointXY)¶ Sets the segment’s
start
point.See also
See also
See also
-
setStartX
(self, x: float)¶ Sets the segment’s start
x
coordinate.See also
See also
See also
-
setStartY
(self, y: float)¶ Sets the segment’s start
y
coordinate.See also
See also
See also
-
start
(self) → QgsPointXY¶ Returns the segment’s start point.
See also
See also
See also
-