forked from zsnjuts/PaintWorks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPolygonControl.h
42 lines (33 loc) · 1.1 KB
/
PolygonControl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef POLYGONCONTROL_H
#define POLYGONCONTROL_H
#include "Polygon.h"
#include "LineControl.h"
#include "FigureControl.h"
#include <vector>
using namespace std;
class PolygonControl:public FigureControl
{
public:
PolygonControl();
PolygonControl(std::vector<Figure*> *figures);
PolygonControl(int width, int height);
bool setFocus(Figure *fg);
void onMousePressEvent(QMouseEvent *event);
void onMouseMoveEvent(QMouseEvent *event);
void onMousePassiveMoveEvent(QMouseEvent *event);
void onKeyPressEvent(QKeyEvent *event);
void onDraw();
void onMarkDraw();
void onFill();
void onCut(const Point &leftDown, int width, int height); //对当前多边形进行裁剪
void onScale(double s);
void onDelete();
void onClear();
private:
int setPV; //当前正在更改的顶点索引,默认为-1表示正在绘制直线,-2表示正在选中中心点进行平移,-3表示正在拖动handle旋转
int curIdx; //当前图形的索引
vector<Line*> curLines; //当前聚焦的折线
vector<MyPolygon*> polygons;
void deletePolygon(int idx); //删除特定索引的Polygon
};
#endif // !POLYGONCONTROL_H