17#ifndef QGSBEZIERDATA_H
18#define QGSBEZIERDATA_H
43struct GUI_EXPORT QgsAnchorWithHandles
50 QgsAnchorWithHandles() =
default;
53 explicit QgsAnchorWithHandles(
const QgsPoint &point )
54 : anchor( point ), leftHandle( point ), rightHandle( point ) {}
57 QgsAnchorWithHandles(
const QgsPoint &point,
const QgsPoint &left,
const QgsPoint &right )
58 : anchor( point ), leftHandle( left ), rightHandle( right ) {}
74class GUI_EXPORT QgsBezierData
78 QgsBezierData() =
default;
81 static constexpr int INTERPOLATION_POINTS = 32;
88 void addAnchor(
const QgsPoint &point );
96 void moveAnchor(
int index,
const QgsPoint &point );
103 void moveHandle(
int index,
const QgsPoint &point );
110 void insertAnchor(
int segmentIndex,
const QgsPoint &point );
116 void deleteAnchor(
int index );
122 void retractHandle(
int index );
130 void extendHandle(
int index,
const QgsPoint &point );
133 int anchorCount()
const {
return mData.count(); }
136 int handleCount()
const {
return mData.count() * 2; }
139 QgsPoint anchor(
int index )
const;
142 QgsPoint handle(
int index )
const;
145 QVector<QgsPoint> anchors()
const;
148 QVector<QgsPoint> handles()
const;
155 const QgsAnchorWithHandles &anchorWithHandles(
int index )
const;
168 std::unique_ptr<QgsNurbsCurve> asNurbsCurve()
const;
174 bool isEmpty()
const {
return mData.isEmpty(); }
182 int findClosestAnchor(
const QgsPoint &point,
double tolerance )
const;
190 int findClosestHandle(
const QgsPoint &point,
double tolerance )
const;
198 int findClosestSegment(
const QgsPoint &point,
double tolerance )
const;
201 QVector<QgsAnchorWithHandles> mData;
202 static const QgsAnchorWithHandles sInvalidAnchor;
Represents a NURBS (Non-Uniform Rational B-Spline) curve geometry in 2D/3D.
Point geometry type, with support for z-dimension and m-values.
QVector< QgsPoint > QgsPointSequence