18#ifndef QGSCOMPOUNDCURVE_H
19#define QGSCOMPOUNDCURVE_H
44 void clear()
override;
47 bool fromWkt(
const QString &wkt )
override;
49 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() )
const override;
50 QByteArray
asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() )
const override;
63 bool isValid( QString &error
SIP_OUT, Qgis::GeometryValidityFlags flags = Qgis::GeometryValidityFlags() )
const override;
75 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<double>::epsilon(),
bool useZValues =
false )
override;
104 void removeCurve(
int i );
109 void addVertex(
const QgsPoint &pt );
117 void condenseCurves();
127 bool toggleCircularAtVertex(
QgsVertexId position );
129 void draw( QPainter &p )
const override;
131 void transform( const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 ) override;
132 void addToPainterPath( QPainterPath &path ) const override;
133 void drawAsPolygon( QPainter &p ) const override;
136 bool deleteVertex(
QgsVertexId position ) override;
138 bool pointAt(
int node,
QgsPoint &point,
Qgis::VertexType &type ) const override;
139 void sumUpArea(
double &sum
SIP_OUT ) const override;
144 bool hasCurvedSegments() const override;
145 double vertexAngle(
QgsVertexId vertex ) const override;
146 double segmentLength(
QgsVertexId startVertex ) const override;
151 bool addZValue(
double zValue = 0 ) override;
152 bool addMValue(
double mValue = 0 ) override;
154 bool dropZValue() override;
155 bool dropMValue() override;
156 void swapXy() override;
158 double xAt(
int index ) const override
SIP_HOLDGIL;
159 double yAt(
int index ) const override
SIP_HOLDGIL;
160 double zAt(
int index ) const override
SIP_HOLDGIL;
161 double mAt(
int index ) const override
SIP_HOLDGIL;
164 void scroll(
int firstVertexIndex ) final;
169 std::tuple< std::unique_ptr< QgsCurve >, std::unique_ptr< QgsCurve > >
splitCurveAtVertex(
int index )
const final;
189 SIP_PYOBJECT __repr__();
191 QString wkt = sipCpp->asWkt();
192 if ( wkt.length() > 1000 )
193 wkt = wkt.left( 1000 ) + QStringLiteral(
"..." );
194 QString
str = QStringLiteral(
"<QgsCompoundCurve: %1>" ).arg( wkt );
195 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
205 QVector< QgsCurve * > mCurves;
211 QVector< QPair<int, QgsVertexId> > curveVertexId(
QgsVertexId id )
const;
The Qgis class provides global constants for use throughout the application.
@ CompoundCurve
CompoundCurve.
TransformDirection
Flags for raster layer temporal capabilities.
@ Forward
Forward transform (from source to destination)
Abstract base class for all geometries.
virtual bool fromWkb(QgsConstWkbPtr &wkb)=0
Sets the geometry from a WKB string.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
virtual QgsBox3D calculateBoundingBox3D() const
Calculates the minimal 3D bounding box for the geometry.
virtual void draw(QPainter &p) const =0
Draws the geometry using the specified QPainter.
virtual const QgsAbstractGeometry * simplifiedTypeRef() const
Returns a reference to the simplest lossless representation of this geometry, e.g.
virtual void transformVertices(const std::function< QgsPoint(const QgsPoint &) > &transform)
Transforms the vertices from the geometry in place, applying the transform function to every vertex.
AxisOrder
Axis order for GML generation.
@ XY
X comes before Y (or lon before lat)
virtual QString geometryType() const =0
Returns a unique string representing the geometry type.
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
virtual QByteArray asWkb(WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const =0
Returns a WKB representation of the geometry.
virtual QDomElement asGml2(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML2 representation of the geometry.
QgsAbstractGeometry & operator=(const QgsAbstractGeometry &geom)
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
virtual QgsAbstractGeometry * snappedToGrid(double hSpacing, double vSpacing, double dSpacing=0, double mSpacing=0) const =0
Makes a new geometry with all the points or vertices snapped to the closest point of the grid.
virtual double length() const
Returns the planar, 2-dimensional length of the geometry.
virtual QString asWkt(int precision=17) const =0
Returns a WKT representation of the geometry.
virtual bool isEmpty() const
Returns true if the geometry is empty.
virtual json asJsonObject(int precision=17) const
Returns a json object representation of the geometry.
virtual QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML3 representation of the geometry.
virtual bool fromWkt(const QString &wkt)=0
Sets the geometry from a WKT string.
virtual void transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection d=Qgis::TransformDirection::Forward, bool transformZ=false)=0
Transforms the geometry using a coordinate transform.
virtual bool boundingBoxIntersects(const QgsRectangle &rectangle) const
Returns true if the bounding box of this geometry intersects with a rectangle.
virtual void clear()=0
Clears the geometry, ie reset it to a null geometry.
virtual void filterVertices(const std::function< bool(const QgsPoint &) > &filter)
Filters the vertices from the geometry in place, removing any which do not return true for the filter...
virtual int dimension() const =0
Returns the inherent dimension of the geometry.
virtual bool removeDuplicateNodes(double epsilon=4 *std::numeric_limits< double >::epsilon(), bool useZValues=false)=0
Removes duplicate nodes from the geometry, wherever removing the nodes does not result in a degenerat...
virtual int wkbSize(QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const =0
Returns the length of the QByteArray returned by asWkb()
virtual int compareToSameClass(const QgsAbstractGeometry *other) const =0
Compares to an other geometry of the same class, and returns a integer for sorting of the two geometr...
A 3-dimensional box composed of x, y, z coordinates.
Compound curve geometry type.
int nCurves() const
Returns the number of curves in the geometry.
static const QgsCompoundCurve * cast(const QgsAbstractGeometry *geom)
Cast the geom to a QgsCompoundCurve.
Custom exception class for Coordinate Reference System related exceptions.
Abstract base class for curved geometry type.
virtual bool equals(const QgsCurve &other) const =0
Checks whether this curve exactly equals another curve.
virtual int numPoints() const =0
Returns the number of points in the curve.
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 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...
QgsCurve * clone() const override=0
Clones the geometry by performing a deep copy.
virtual QgsPoint startPoint() const =0
Returns the starting point of the curve.
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...
virtual QgsPoint endPoint() const =0
Returns the end point of the curve.
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.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
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::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define SIP_THROW(name,...)
QVector< QgsPoint > QgsPointSequence
double closestSegment(const QgsPolylineXY &pl, const QgsPointXY &pt, int &vertexAfter, double epsilon)
Utility class for identifying a unique vertex within a geometry.