26#include <QPainterPath>
122 Returns the number of
points in the curve.
125 sipRes = sipCpp->numPoints();
129 int __bool__()
const;
173 QString
asKml(
int precision = 17 ) const override;
182 int vertexCount(
int part = 0,
int ring = 0 ) const override;
183 int ringCount(
int part = 0 ) const override;
190 bool isValid( QString &error
SIP_OUT,
Qgis::GeometryValidityFlags flags =
Qgis::GeometryValidityFlags() ) const override;
197 virtual
double xAt(
int index ) const = 0;
204 virtual
double yAt(
int index ) const = 0;
212 virtual
double zAt(
int index ) const = 0;
220 virtual
double mAt(
int index ) const = 0;
294 virtual
void scroll(
int firstVertexIndex ) = 0;
330 return static_cast<const QgsCurve *
>( geom );
351 return static_cast<QgsCurve *
>( geom );
366 virtual std::tuple< std::unique_ptr< QgsCurve >, std::unique_ptr< QgsCurve > >
splitCurveAtVertex(
int index )
const = 0;
383 bool snapToGridPrivate(
double hSpacing,
double vSpacing,
double dSpacing,
double mSpacing,
384 const QVector<double> &srcX,
const QVector<double> &srcY,
const QVector<double> &srcZ,
const QVector<double> &srcM,
385 QVector<double> &outX, QVector<double> &outY, QVector<double> &outZ, QVector<double> &outM,
386 bool removeRedundantPoints )
const;
399 mutable bool mHasCachedValidity =
false;
400 mutable QString mValidityFailureReason;
Provides global constants and enumerations for use throughout the application.
VertexType
Types of vertex.
WkbType
The WKB type describes the number of dimensions a geometry has.
virtual QgsPoint childPoint(int index) const
Returns point at index (for geometries without child geometries - i.e.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
@ MaximumAngle
Maximum angle between generating radii (lines from arc center to output vertices).
virtual int vertexNumberFromVertexId(QgsVertexId id) const =0
Returns the vertex number corresponding to a vertex id.
virtual QgsAbstractGeometry * boundary() const =0
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
virtual int childCount() const
Returns number of child geometries (for geometries with child geometries) or child points (for geomet...
virtual void adjacentVertices(QgsVertexId vertex, QgsVertexId &previousVertex, QgsVertexId &nextVertex) const =0
Returns the vertices adjacent to a specified vertex within a geometry.
virtual void clearCache() const
Clears any cached parameters associated with the geometry, e.g., bounding boxes.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
virtual bool operator!=(const QgsAbstractGeometry &other) const =0
virtual QgsCoordinateSequence coordinateSequence() const =0
Retrieves the sequence of geometries, rings and nodes.
virtual bool operator==(const QgsAbstractGeometry &other) const =0
QgsAbstractGeometry()=default
virtual bool nextVertex(QgsVertexId &id, QgsPoint &vertex) const =0
Returns next vertex id and coordinates.
A 3-dimensional box composed of x, y, z coordinates.
virtual bool equals(const QgsCurve &other) const =0
Checks whether this curve exactly equals another curve.
Qgis::AngularDirection orientation() const
Returns the curve's orientation, e.g.
virtual int numPoints() const =0
Returns the number of points in the curve.
double sinuosity() const
Returns the curve sinuosity, which is the ratio of the curve length() to curve straightDistance2d().
bool mHasCachedSummedUpArea
void normalize() final
Reorganizes the geometry into a normalized form (or "canonical" form).
QPainterPath asQPainterPath() const override
Returns the geometry represented as a QPainterPath.
virtual void scroll(int firstVertexIndex)=0
Scrolls the curve vertices so that they start with the vertex at the given index.
int partCount() const override
Returns count of parts contained in the geometry.
QgsCurve * segmentize(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const override
Returns a geometry without curves.
virtual bool isRing() const
Returns true if the curve is a ring.
virtual bool pointAt(int node, QgsPoint &point, Qgis::VertexType &type) const =0
Returns the point and vertex id of a point within the curve.
QgsBox3D boundingBox3D() const override
Returns the 3D bounding box for the geometry.
virtual QgsCurve * curveSubstring(double startDistance, double endDistance) const =0
Returns a new curve representing a substring of this curve.
virtual bool isClosed() const
Returns true if the curve is closed.
static const QgsCurve * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsCurve.
bool isValid(QString &error, Qgis::GeometryValidityFlags flags=Qgis::GeometryValidityFlags()) const override
Checks validity of the geometry, and returns true if the geometry is valid.
virtual bool isClosed2D() const
Returns true if the curve is closed.
int vertexCount(int part=0, int ring=0) const override
Returns the number of vertices of which this geometry is built.
QgsPoint vertexAt(QgsVertexId id) const override
Returns the point corresponding to a specified vertex id.
virtual QPolygonF asQPolygonF() const
Returns a QPolygonF representing the points.
virtual void addToPainterPath(QPainterPath &path) const =0
Adds a curve to a painter path.
virtual int indexOf(const QgsPoint &point) const =0
Returns the index of the first vertex matching the given point, or -1 if a matching vertex is not fou...
friend class TestQgsGeometry
QgsCurve * toCurveType() const override
Returns the geometry converted to the more generic curve type.
virtual void sumUpArea(double &sum) const =0
Sums up the area of the curve by iterating over the vertices (shoelace formula).
bool snapToGridPrivate(double hSpacing, double vSpacing, double dSpacing, double mSpacing, const QVector< double > &srcX, const QVector< double > &srcY, const QVector< double > &srcZ, const QVector< double > &srcM, QVector< double > &outX, QVector< double > &outY, QVector< double > &outZ, QVector< double > &outM, bool removeRedundantPoints) const
Helper function for QgsCurve subclasses to snap to grids.
QString asKml(int precision=17) const override
Returns a KML representation of the geometry.
QgsBox3D mBoundingBox
Cached bounding box.
virtual QgsPoint * interpolatePoint(double distance) const =0
Returns an interpolated point on the curve at the specified distance.
QgsCurve * clone() const override=0
Clones the geometry by performing a deep copy.
virtual double distanceBetweenVertices(QgsVertexId fromVertex, QgsVertexId toVertex) const =0
Returns the distance along the curve between two vertices.
virtual double xAt(int index) const =0
Returns the x-coordinate of the specified node in the line string.
int ringCount(int part=0) const override
Returns the number of rings of which this geometry is built.
virtual QgsPoint startPoint() const =0
Returns the starting point of the curve.
static QgsCurve * cast(QgsAbstractGeometry *geom)
Cast the geom to a QgsCurve.
double straightDistance2d() const
Returns the straight distance of the curve, i.e.
virtual std::tuple< std::unique_ptr< QgsCurve >, std::unique_ptr< QgsCurve > > splitCurveAtVertex(int index) const =0
Splits the curve at the specified vertex index, returning two curves which represent the portion of t...
bool nextVertex(QgsVertexId &id, QgsPoint &vertex) const override
Returns next vertex id and coordinates.
virtual double zAt(int index) const =0
Returns the z-coordinate of the specified node in the line string.
virtual QgsCurve * reversed() const =0
Returns a reversed copy of the curve, where the direction of the curve has been flipped.
virtual void drawAsPolygon(QPainter &p) const =0
Draws the curve as a polygon on the specified QPainter.
virtual double mAt(int index) const =0
Returns the m-coordinate of the specified node in the line string.
virtual QgsPoint endPoint() const =0
Returns the end point of the curve.
virtual double yAt(int index) const =0
Returns the y-coordinate of the specified node in the line string.
virtual void points(QgsPointSequence &pt) const =0
Returns a list of points within the curve.
virtual QgsLineString * curveToLine(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const =0
Returns a new line string geometry corresponding to a segmentized approximation of the curve.
Line string geometry type, with support for z-dimension and m-values.
Point geometry type, with support for z-dimension and m-values.
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
static Q_INVOKABLE bool isSingleType(Qgis::WkbType type)
Returns true if the WKB type is a single type.
QVector< QgsRingSequence > QgsCoordinateSequence
QVector< QgsPoint > QgsPointSequence
Utility class for identifying a unique vertex within a geometry.