forked from chili-epfl/Carpenter-App-RoofDesigner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstrainedpoint.cpp
More file actions
60 lines (46 loc) · 1.25 KB
/
constrainedpoint.cpp
File metadata and controls
60 lines (46 loc) · 1.25 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
#include "constrainedpoint.h"
#include <QVector2D>
#include <QDebug>
ConstrainedPoint::ConstrainedPoint(double x, double y, QObject* point)
{
this->relatedPoint = point;
this->_x = QSharedPointer<Parameter>(new Parameter(x));
this->_y = QSharedPointer<Parameter>(new Parameter(y));
this->_fixedX = false;
this->_fixedY = false;
}
void ConstrainedPoint::setX(QSharedPointer<Parameter> x) {
if(this->_fixedX) {
// already fixed, need to replace argument x's pointer
(*(x)).setValue((*(this->_x)).address());
}
else {
this->_fixedX = true;
}
this->_x = x;
}
void ConstrainedPoint::setY(QSharedPointer<Parameter> y) {
if(this->_fixedY) {
// already fixed, need to replace argument y's pointer
(*(y)).setValue((*(this->_y)).address());
}
else {
this->_fixedY = true;
}
this->_y = y;
}
QString ConstrainedPoint::identifier() {
return this->relatedPoint->property("identifier").toString();
}
QSharedPointer<Parameter> ConstrainedPoint::x() {
return this->_x;
}
QSharedPointer<Parameter> ConstrainedPoint::y() {
return this->_y;
}
bool ConstrainedPoint::fixedX() {
return this->_fixedX;
}
bool ConstrainedPoint::fixedY() {
return this->_fixedY;
}