77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
#ifndef RENDERAREA_H
|
|
#define RENDERAREA_H
|
|
|
|
#include <QWidget>
|
|
#include <QPen>
|
|
|
|
class RenderArea : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit RenderArea(QWidget *parent = nullptr);
|
|
|
|
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
|
QSize sizeHint() const Q_DECL_OVERRIDE;
|
|
|
|
enum ShapesType{
|
|
Astroid,
|
|
Cycloid,
|
|
HuygensCycloid,
|
|
HypoCycloid,
|
|
Line,
|
|
Circle,
|
|
Ellipse,
|
|
Fancy,
|
|
Starfish,
|
|
Cloud1,
|
|
Cloud2
|
|
};
|
|
|
|
void setBackgroundColor(QColor color) { mBackgroundColour = color; }
|
|
QColor backgroundColor() const { return mBackgroundColour; }
|
|
|
|
void setShapeColor(QColor color) { mPen.setColor(color); }
|
|
QColor shapeColor() const { return mPen.color(); }
|
|
|
|
void setShape(ShapesType shape) { mShape = shape; OnShapeChanged(); }
|
|
ShapesType shape() const { return mShape; }
|
|
|
|
void setInternalLenght(double l){mIntervalLenght=l;repaint();}
|
|
double intervalLenght() const {return mIntervalLenght;}
|
|
|
|
void setScale(double s){mScale=s;repaint();}
|
|
double scale() const {return mScale;}
|
|
|
|
void setStepCount(int s){mStepCount=s;repaint();}
|
|
int stepCount() const {return mStepCount;}
|
|
|
|
signals:
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
|
|
|
|
public slots:
|
|
|
|
private:
|
|
void OnShapeChanged();
|
|
QPointF Compute(double t);
|
|
QPointF ComputeAstroid(double t);
|
|
QPointF ComputeCycloid(double t);
|
|
QPointF ComputeHuygens(double t);
|
|
QPointF ComputeHypo(double t);
|
|
QPointF ComputeLine(double t);
|
|
QPointF ComputeCircle(double t);
|
|
QPointF ComputeEllipse(double t);
|
|
QPointF ComputeFancy(double t);
|
|
QPointF ComputeStarfish(double t);
|
|
QPointF ComputeCloud1(double t);
|
|
QPointF ComputeCloud2(double t);
|
|
QPointF ComputeCloudWithSign(double t,double sign);
|
|
QColor mBackgroundColour;
|
|
ShapesType mShape;
|
|
QPen mPen;
|
|
double mScale,mIntervalLenght;
|
|
int mStepCount;
|
|
};
|
|
#endif // RENDERAREA_H
|