QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
18 #ifndef QGSCIRCULARSTRING_H
19 #define QGSCIRCULARSTRING_H
23 #include "qgis_core.h"
66 bool useShortestArc =
true );
73 void clear()
override;
76 bool fromWkt(
const QString &wkt )
override;
78 int wkbSize( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() )
const override;
79 QByteArray
asWkb( QgsAbstractGeometry::WkbFlags flags = QgsAbstractGeometry::WkbFlags() )
const override;
99 double length()
const override;
104 bool removeDuplicateNodes(
double epsilon = 4 * std::numeric_limits<double>::epsilon(),
bool useZValues =
false )
override;
106 void draw( QPainter &p )
const override;
108 void transform(
const QTransform &t,
double zTranslate = 0.0,
double zScale = 1.0,
double mTranslate = 0.0,
double mScale = 1.0 )
override;
123 bool addZValue(
double zValue = 0 )
override;
124 bool addMValue(
double mValue = 0 )
override;
153 SIP_PYOBJECT __repr__();
155 QString wkt = sipCpp->asWkt();
156 if ( wkt.length() > 1000 )
157 wkt = wkt.left( 1000 ) + QStringLiteral(
"..." );
158 QString str = QStringLiteral(
"<QgsCircularString: %1>" ).arg( wkt );
159 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
174 static void arcTo( QPainterPath &path, QPointF pt1, QPointF pt2, QPointF pt3 );
178 static QgsPointSequence compassPointsOnSegment(
double p1Angle,
double p2Angle,
double p3Angle,
double centerX,
double centerY,
double radius );
179 static double closestPointOnArc(
double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
181 void insertVertexBetween(
int after,
int before,
int pointOnCircle );
188 #endif // QGSCIRCULARSTRING_H
Abstract base class for curved geometry type.
const QgsCircularString * cast(const QgsAbstractGeometry *geom) const
Cast the geom to a QgsCircularString.
virtual bool pointAt(int node, QgsPoint &point, QgsVertexId::VertexType &type) const =0
Returns the point and vertex id of a point within the curve.
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 bool dropMValue()=0
Drops any measure values which exist in the geometry.
virtual bool fromWkt(const QString &wkt)=0
Sets the geometry from a WKT string.
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry.
virtual void drawAsPolygon(QPainter &p) const =0
Draws the curve as a polygon on the specified QPainter.
virtual QgsPoint startPoint() const =0
Returns the starting point of the curve.
virtual QgsPoint * interpolatePoint(double distance) const =0
Returns an interpolated point on the curve at the specified distance.
virtual QByteArray asWkb(WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const =0
Returns a WKB representation of the geometry.
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
Point geometry type, with support for z-dimension and m-values.
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 bool moveVertex(QgsVertexId position, const QgsPoint &newPos)=0
Moves a vertex within the geometry.
virtual int wkbSize(QgsAbstractGeometry::WkbFlags flags=QgsAbstractGeometry::WkbFlags()) const =0
Returns the length of the QByteArray returned by asWkb()
virtual QgsCurve * reversed() const =0
Returns a reversed copy of the curve, where the direction of the curve has been flipped.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
static Type flatType(Type type) SIP_HOLDGIL
Returns the flat type for a WKB type.
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 QString asWkt(int precision=17) const =0
Returns a WKT representation of the geometry.
virtual double length() const
Returns the planar, 2-dimensional length of the geometry.
SegmentationToleranceType
Segmentation tolerance as maximum angle or maximum difference between approximation and circle.
Line string geometry type, with support for z-dimension and m-values.
virtual void sumUpArea(double &sum) const =0
Sums up the area of the curve by iterating over the vertices (shoelace formula).
A rectangle specified with double values.
double ANALYSIS_EXPORT leftOf(const QgsPoint &thepoint, const QgsPoint *p1, const QgsPoint *p2)
Returns whether 'thepoint' is left or right of the line from 'p1' to 'p2'. Negative values mean left ...
virtual double vertexAngle(QgsVertexId vertex) const =0
Returns approximate angle at a vertex.
virtual int dimension() const =0
Returns the inherent dimension of the geometry.
Custom exception class for Coordinate Reference System related exceptions.
Circular string geometry type.
virtual void addToPainterPath(QPainterPath &path) const =0
Adds a curve to a painter path.
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns the WKB type of the geometry.
virtual bool insertVertex(QgsVertexId position, const QgsPoint &vertex)=0
Inserts a vertex into the geometry.
virtual QgsPoint endPoint() const =0
Returns the end point of the curve.
AxisOrder
Axis order for GML generation.
virtual json asJsonObject(int precision=17) const
Returns a json object representation of the geometry.
virtual void swapXy()=0
Swaps the x and y coordinates from the geometry.
virtual bool equals(const QgsCurve &other) const =0
Checks whether this curve exactly equals another curve.
virtual QgsCurve * curveSubstring(double startDistance, double endDistance) const =0
Returns a new curve representing a substring of this curve.
virtual bool deleteVertex(QgsVertexId position)=0
Deletes a vertex within the geometry.
virtual double yAt(int index) const =0
Returns the y-coordinate of the specified node in the line string.
virtual double closestSegment(const QgsPoint &pt, QgsPoint &segmentPt, QgsVertexId &vertexAfter, int *leftOf=nullptr, double epsilon=4 *std::numeric_limits< double >::epsilon()) const =0
Searches for the closest segment of the geometry to a given point.
virtual bool hasCurvedSegments() const
Returns true if the geometry contains curved segments.
virtual void clear()=0
Clears the geometry, ie reset it to a null geometry.
virtual bool isEmpty() const
Returns true if the geometry is empty.
virtual bool fromWkb(QgsConstWkbPtr &wkb)=0
Sets the geometry from a WKB string.
Abstract base class for all geometries.
virtual double xAt(int index) const =0
Returns the x-coordinate of the specified node in the line string.
virtual QString geometryType() const =0
Returns a unique string representing the geometry type.
QgsCurve * clone() const override=0
Clones the geometry by performing a deep copy.
virtual QgsAbstractGeometry * createEmptyWithSameType() const =0
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
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.
QVector< QgsPoint > QgsPointSequence
virtual void draw(QPainter &p) const =0
Draws the geometry using the specified QPainter.
virtual double segmentLength(QgsVertexId startVertex) const =0
Returns the length of the segment of the geometry which begins at startVertex.
Utility class for identifying a unique vertex within a geometry.
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.
VertexType
Type of vertex.
virtual void points(QgsPointSequence &pt) const =0
Returns a list of points within the curve.
virtual int numPoints() const =0
Returns the number of points in the curve.
virtual void transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)=0
Transforms the geometry using a coordinate transform.
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.
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.
virtual QgsRectangle calculateBoundingBox() const
Default calculator for the minimal bounding box for the geometry.