17#ifndef QGSBEZIERDATA_H
18#define QGSBEZIERDATA_H
42struct GUI_EXPORT QgsAnchorWithHandles
49 QgsAnchorWithHandles() =
default;
52 explicit QgsAnchorWithHandles(
const QgsPoint &point )
53 : anchor( point ), leftHandle( point ), rightHandle( point ) {}
57 : anchor( point ), leftHandle( left ), rightHandle( right ) {}
73class GUI_EXPORT QgsBezierData
77 QgsBezierData() =
default;
80 static constexpr int INTERPOLATION_POINTS = 32;
87 void addAnchor(
const QgsPoint &point );
95 void moveAnchor(
int index,
const QgsPoint &point );
102 void moveHandle(
int index,
const QgsPoint &point );
109 void insertAnchor(
int segmentIndex,
const QgsPoint &point );
115 void deleteAnchor(
int index );
121 void retractHandle(
int index );
129 void extendHandle(
int index,
const QgsPoint &point );
132 int anchorCount()
const {
return mData.count(); }
135 int handleCount()
const {
return mData.count() * 2; }
138 QgsPoint anchor(
int index )
const;
141 QgsPoint handle(
int index )
const;
144 QVector<QgsPoint> anchors()
const;
147 QVector<QgsPoint> handles()
const;
154 const QgsAnchorWithHandles &anchorWithHandles(
int index )
const;
167 std::unique_ptr<QgsNurbsCurve> asNurbsCurve()
const;
173 bool isEmpty()
const {
return mData.isEmpty(); }
181 int findClosestAnchor(
const QgsPoint &point,
double tolerance )
const;
189 int findClosestHandle(
const QgsPoint &point,
double tolerance )
const;
197 int findClosestSegment(
const QgsPoint &point,
double tolerance )
const;
200 QVector<QgsAnchorWithHandles> mData;
201 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