Class: QgsCircularString¶
- class qgis.core.QgsCircularString¶
Bases:
QgsCurve
Circular string geometry type
New in version 2.10.
QgsCircularString() Constructs an empty circular string.
QgsCircularString(p1:
QgsPoint
, p2:QgsPoint
, p3:QgsPoint
) Constructs a circular string with a single arc passing throughp1
,p2
andp3
.New in version 3.2.
QgsCircularString(x: Iterable[float], y: Iterable[float], z: Iterable[float] = [], m: Iterable[float] = []) Construct a circular string from arrays of coordinates. If the z or m arrays are non-empty then the resultant circular string will have z and m types accordingly.
This constructor is more efficient then calling
setPoints()
.If the sizes of
x
andy
are non-equal then the resultant circular string will be created using the minimum size of these arrays.Warning
It is the caller’s responsibility to ensure that the supplied arrays are of odd sizes.
New in version 3.20.
QgsCircularString(
QgsCircularString
)Methods
- param mValue:
- param path:
- param zValue:
Appends the contents of another circular
string
to the end of this circular string.- param doc:
- param doc:
- param flags:
- param precision:
- rtype:
QgsRectangle
Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e. curve / point).
Returns pointer to child geometry (for geometries with child geometries - i.e. geom.
Returns point at index (for geometries without child geometries - i.e. curve / point).
Clears any cached parameters associated with the geometry, e.g., bounding boxes
- rtype:
QgsCircularString
- param pt:
- param other:
- rtype:
QgsCircularString
- param startDistance:
- param tolerance:
- param position:
- rtype:
int
- param p:
- param p:
- rtype:
bool
- rtype:
bool
- rtype:
QgsPoint
- param other:
Creates a circular string with a single arc representing the curve from
p1
top2
with the specifiedcenter
.- param wkb:
- param wkt:
- rtype:
str
Returns whether the geometry has any child geometries (
False
for point / curve,True
otherwise)- rtype:
bool
- param point:
- param position:
- param distance:
- rtype:
bool
- param flags:
- rtype:
float
- param position:
- rtype:
int
- param node:
Returns the point at index i within the circular string.
- rtype:
List[QgsPoint]
- param epsilon:
- rtype:
QgsCircularString
- param firstVertexIndex:
- param startVertex:
Sets the circular string's points
Updates the geometry type based on whether sub geometries contain z or m values.
- param hSpacing:
Returns the sort index for the geometry, used in the
compareTo()
method to compare geometries of different types.- rtype:
QgsPoint
- rtype:
float
- param ct:
- param vertex:
- param flags:
- param index:
- param index:
- addMValue(self, mValue: float = 0) bool ¶
- Parameters:
mValue (float = 0) –
- Return type:
bool
- addToPainterPath(self, path: QPainterPath)¶
- Parameters:
path (QPainterPath) –
- addZValue(self, zValue: float = 0) bool ¶
- Parameters:
zValue (float = 0) –
- Return type:
bool
- append(self, string: QgsCircularString)¶
Appends the contents of another circular
string
to the end of this circular string.- Parameters:
string (QgsCircularString) – circular string to append. Ownership is not transferred.
Warning
It is the caller’s responsibility to ensure that the first point in the appended
string
matches the last point in the existing curve, or the result will be undefined.New in version 3.20.
- asGml2(self, doc: QDomDocument, precision: int = 17, ns: str = '', axisOrder: QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) QDomElement ¶
- Parameters:
doc (QDomDocument) –
precision (int = 17) –
ns (str = '') –
axisOrder (QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) –
- Return type:
QDomElement
- asGml3(self, doc: QDomDocument, precision: int = 17, ns: str = '', axisOrder: QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) QDomElement ¶
- Parameters:
doc (QDomDocument) –
precision (int = 17) –
ns (str = '') –
axisOrder (QgsAbstractGeometry.AxisOrder = QgsAbstractGeometry.AxisOrder.XY) –
- Return type:
QDomElement
- asWkb(self, flags: QgsAbstractGeometry.WkbFlags | QgsAbstractGeometry.WkbFlag = QgsAbstractGeometry.WkbFlags()) QByteArray ¶
- Parameters:
flags (Union[QgsAbstractGeometry.WkbFlags) –
- Return type:
QByteArray
- asWkt(self, precision: int = 17) str ¶
- Parameters:
precision (int = 17) –
- Return type:
str
- calculateBoundingBox(self) QgsRectangle ¶
- Return type:
- childCount(self) int ¶
Returns number of child geometries (for geometries with child geometries) or child points (for geometries without child geometries - i.e. curve / point)
Note
used for vertex_iterator implementation
New in version 3.0.
- childGeometry(self, index: int) QgsAbstractGeometry ¶
Returns pointer to child geometry (for geometries with child geometries - i.e. geom. collection / polygon)
Note
used for vertex_iterator implementation
New in version 3.0.
- childPoint(self, index: int) QgsPoint ¶
Returns point at index (for geometries without child geometries - i.e. curve / point)
Note
used for vertex_iterator implementation
New in version 3.0.
- clear(self)¶
- clearCache(self)¶
Clears any cached parameters associated with the geometry, e.g., bounding boxes
- clone(self) QgsCircularString ¶
- Return type:
- closestSegment(self, pt: QgsPoint, epsilon: float = 4 * DBL_EPSILON) Tuple[float, QgsPoint, QgsVertexId, int] ¶
- Parameters:
pt (QgsPoint) –
epsilon (float = 4*DBL_EPSILON) –
- Return type:
Tuple[float,
QgsPoint
,QgsVertexId
, int]
- compareToSameClass(self, other: QgsAbstractGeometry) int ¶
- Parameters:
other (QgsAbstractGeometry) –
- Return type:
int
- createEmptyWithSameType(self) QgsCircularString ¶
- Return type:
- curveSubstring(self, startDistance: float, endDistance: float) QgsCircularString ¶
- Parameters:
startDistance (float) –
endDistance (float) –
- Return type:
- curveToLine(self, tolerance: float = M_PI_2 / 90, toleranceType: QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) QgsLineString ¶
- Parameters:
tolerance (float = M_PI_2/90) –
toleranceType (QgsAbstractGeometry.SegmentationToleranceType = QgsAbstractGeometry.MaximumAngle) –
- Return type:
- deleteVertex(self, position: QgsVertexId) bool ¶
- Parameters:
position (QgsVertexId) –
- Return type:
bool
- dimension(self) int ¶
- Return type:
int
- draw(self, p: QPainter)¶
- Parameters:
p (QPainter) –
- drawAsPolygon(self, p: QPainter)¶
- Parameters:
p (QPainter) –
- dropMValue(self) bool ¶
- Return type:
bool
- dropZValue(self) bool ¶
- Return type:
bool
- fromTwoPointsAndCenter(p1: QgsPoint, p2: QgsPoint, center: QgsPoint, useShortestArc: bool = True) QgsCircularString ¶
Creates a circular string with a single arc representing the curve from
p1
top2
with the specifiedcenter
.If
useShortestArc
isTrue
, then the arc returned will be that corresponding to the shorter arc fromp1
top2
. If it isFalse
, the longer arc fromp1
top2
will be used (i.e. winding the other way around the circle).New in version 3.2.
- Parameters:
- Return type:
- fromWkb(self, wkb: QgsConstWkbPtr) bool ¶
- Parameters:
wkb (QgsConstWkbPtr) –
- Return type:
bool
- fromWkt(self, wkt: str) bool ¶
- Parameters:
wkt (str) –
- Return type:
bool
- geometryType(self) str ¶
- Return type:
str
- hasChildGeometries(self) bool ¶
Returns whether the geometry has any child geometries (
False
for point / curve,True
otherwise)Note
used for vertex_iterator implementation
New in version 3.0.
- hasCurvedSegments(self) bool ¶
- Return type:
bool
- insertVertex(self, position: QgsVertexId, vertex: QgsPoint) bool ¶
- Parameters:
position (QgsVertexId) –
vertex (QgsPoint) –
- Return type:
bool
- isEmpty(self) bool ¶
- Return type:
bool
- isValid(self, flags: Qgis.GeometryValidityFlags | Qgis.GeometryValidityFlag = Qgis.GeometryValidityFlags()) Tuple[bool, str] ¶
- Parameters:
flags (Union[Qgis.GeometryValidityFlags) –
- Return type:
Tuple[bool, str]
- length(self) float ¶
- Return type:
float
- moveVertex(self, position: QgsVertexId, newPos: QgsPoint) bool ¶
- Parameters:
position (QgsVertexId) –
newPos (QgsPoint) –
- Return type:
bool
- numPoints(self) int ¶
- Return type:
int
- pointAt(self, node: int, point: QgsPoint) Tuple[bool, Qgis.VertexType] ¶
- Parameters:
node (int) –
point (QgsPoint) –
- Return type:
Tuple[bool, Qgis.VertexType]
- pointN(self, i: int) QgsPoint ¶
Returns the point at index i within the circular string.
- Parameters:
i (int) –
- Return type:
- removeDuplicateNodes(self, epsilon: float = 4 * DBL_EPSILON, useZValues: bool = False) bool ¶
- Parameters:
epsilon (float = 4*DBL_EPSILON) –
useZValues (bool = False) –
- Return type:
bool
- reversed(self) QgsCircularString ¶
- Return type:
- scroll(self, firstVertexIndex: int)¶
- Parameters:
firstVertexIndex (int) –
- segmentLength(self, startVertex: QgsVertexId) float ¶
- Parameters:
startVertex (QgsVertexId) –
- Return type:
float
- setPoints(self, points: Iterable[QgsPoint])¶
Sets the circular string’s points
- Parameters:
points (Iterable[QgsPoint]) –
- setZMTypeFromSubGeometry(self, subggeom: QgsAbstractGeometry, baseGeomType: QgsWkbTypes.Type)¶
Updates the geometry type based on whether sub geometries contain z or m values.
- snappedToGrid(self, hSpacing: float, vSpacing: float, dSpacing: float = 0, mSpacing: float = 0) QgsCircularString ¶
- Parameters:
hSpacing (float) –
vSpacing (float) –
dSpacing (float = 0) –
mSpacing (float = 0) –
- Return type:
- sortIndex(self) int ¶
Returns the sort index for the geometry, used in the
compareTo()
method to compare geometries of different types.New in version 3.20.
- sumUpArea(self) float ¶
- Return type:
float
- swapXy(self)¶
- transform(self, ct: QgsCoordinateTransform, d: Qgis.TransformDirection = Qgis.TransformDirection.Forward, transformZ: bool = False)¶
- transform(self, t: QTransform, zTranslate: float = 0, zScale: float = 1, mTranslate: float = 0, mScale: float = 1) None
- transform(self, transformer: QgsAbstractGeometryTransformer, feedback: QgsFeedback = None) bool
- Parameters:
ct (QgsCoordinateTransform) –
d (Qgis.TransformDirection = Qgis.TransformDirection.Forward) –
transformZ (bool = False) –
- vertexAngle(self, vertex: QgsVertexId) float ¶
- Parameters:
vertex (QgsVertexId) –
- Return type:
float
- wkbSize(self, flags: QgsAbstractGeometry.WkbFlags | QgsAbstractGeometry.WkbFlag = QgsAbstractGeometry.WkbFlags()) int ¶
- Parameters:
flags (Union[QgsAbstractGeometry.WkbFlags) –
- Return type:
int
- xAt(self, index: int) float ¶
- Parameters:
index (int) –
- Return type:
float
- yAt(self, index: int) float ¶
- Parameters:
index (int) –
- Return type:
float