#ifndef SIGNPENSTRUCTS_H #define SIGNPENSTRUCTS_H #include #include #include #include "SWPosPointcut.h" typedef QPointF CGPointMake ; typedef QPointF CGPoint; struct SWRealPoint { CGPoint realPoint; // 原始点 int pointType;//0 moved 1 press 2 releas double force; double maxForce; qint64 timestamp;//当前点的时间戳 float radius; float finalRadius; CGPoint pLeftTopPoint; CGPoint pLeftBottomPoint; CGPoint PLeftIntersectPoint; CGPoint pRightTopPoint; CGPoint pRightBottomPoint; CGPoint PRightIntersectPoint; // SWCirclePoint *circlePoints; QList circlePoints; int circleCount; SWRealPoint() { timestamp = -1; circleCount = 0; pointType = 2; force = 10; maxForce = 10; radius = 3; } }; enum ElementType { StartFigure, MoveToElement, LineToElement, CurveToElement, QuadToElement }; class Element { public: Element(ElementType type){ this->type = type; point = QPointF(0,0); control = QPointF(0,0);//CurveToElement时的控制点 point为结束点 control2 = QPointF(0,0);} ~Element(){} ElementType GetElementType(){return type;} void AddEndPoint(QPointF point){ this->point = point; x = point.x(); y = point.y(); } //二阶贝塞尔控制点,三阶贝塞尔控制点1, 非CurveToElement和QuadToElement时,此点为空 void AddControlPoint(QPointF point){control = point;} //三阶贝塞尔控制点2,非QuadToElement时,此点为空 void AddControlPoint2(QPointF point){control2 = point;} QPointF GetEndPoint(){return point;} QPointF GetControlPoint(){return (type == CurveToElement || type == QuadToElement) ? control : QPointF(0,0);} QPointF GetControlPoint2(){return (type == CurveToElement) ? control2 : QPointF(0,0);} bool IsMoveTo() const { return type == MoveToElement; } bool IsLineTo() const { return type == LineToElement; } bool IsCurveTo() const { return type == CurveToElement; } bool IsQuadTo() const { return type == QuadToElement; } operator QPointF () const { return point; } bool operator==(const Element &e) const { return qFuzzyCompare(x, e.x) && qFuzzyCompare(y, e.y) && type == e.type; } inline bool operator!=(const Element &e) const { return !operator==(e); } ElementType type; QPointF point; QPointF control;//CurveToElement时的控制点 point为结束点 QPointF control2; private: qreal x; qreal y; // ElementType type; // QPointF point; // QPointF control;//CurveToElement时的控制点 point为结束点 // QPointF control2; }; // 一笔的Path数据(抬笔前) struct SWAnnotPath { QList points; QList realPoints; QList bezierPaths; //绘制的Path QList > currentPathsList; QList bezierEles; //绘制 bool isShake; //是否防抖 int pageIndex; bool isEnd; bool isPainted;//是否已经缓冲绘制 QRect paintRect;//手写时的区域 SWAnnotPath() { isShake = false; isEnd = false; isPainted = false; } }; #endif // SIGNPENSTRUCTS_H