-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatternselection.h
More file actions
79 lines (67 loc) · 2.27 KB
/
patternselection.h
File metadata and controls
79 lines (67 loc) · 2.27 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef PATTERNSELECTION_H
#define PATTERNSELECTION_H
#include "global.h"
#include "face.h"
#include "jsonelement.h"
#include <set>
#include <QGraphicsItemGroup>
class Pattern;
class QGraphicsScene;
class QGraphicsLineItem;
class PatternSelectionPolygon;
class PatternSelectionTransformation;
class PatternSelection : public base::json::JsonObject
{
static constexpr int line_alpha_ = 200;
static constexpr int fill_alpha_ = 150;
static constexpr int mask_alpha_ = 200;
Pattern *pattern_;
QGraphicsScene *scene_;
PolygonPoints polygon_pts_;
cv::Point2f polygon_center_;
float orientation_;
bool flipped_;
float scale_;
std::set<base::he::Face*> selected_faces_;
std::set<std::size_t> selected_faces_idxs_;
PatternSelectionPolygon *polygon_item_;
PatternSelectionTransformation *active_transformation_;
static cv::Point2f polygonCenter(const PolygonPoints &polygon_pts);
public:
PatternSelection(QGraphicsScene *scene, Pattern *pattern, const PolygonPoints &polygon_pts);
PatternSelection(Pattern *pattern, const base::json::JsonObject::ptr json_obj);
PatternSelection(const PatternSelection &pattern_selection);
~PatternSelection();
const PolygonPoints polygonPoints() const;
cv::Point2f polygonCenter() const;
float orientation() const;
Pattern *pattern() const;
PatternSelectionPolygon *polygonItem() const;
QGraphicsScene *scene() const;
QPointF origin() const;
bool flipped() const;
const std::set<base::he::Face*> selectedFaces() const;
/**
* @brief Active Transformation
* Returns the active PatternTransformation or nullptr if non exists.
*
* @return active_transformation
*/
PatternSelectionTransformation *activeTransformation() const;
void drawPolygon();
void setScene(QGraphicsScene *scene);
void setRotation(float angle);
void setFlipped(bool flipped);
void setScale(float scale);
void setActiveTransformation(PatternSelectionTransformation *active_tranformation);
void setSelectedFaces(const std::set<base::he::Face*> &selected_faces);
void setActive();
void setInactive();
/**
* @brief Set Selected Faces from Idxs
* Sets the selected_faces points from selected_faces_idxs and the current
* mesh loaded in MainWindow.
*/
void setSelectedFacesFromIdxs();
};
#endif // PATTERNSELECTION_H