Подготовка к созданию Arc-объектов
This commit is contained in:
14
Canvas.cpp
14
Canvas.cpp
@@ -34,9 +34,9 @@ Point* Canvas::findPointAt(QPointF pos, qreal tolerance)
|
|||||||
QPointF p2(*line->p2.x, *line->p2.y);
|
QPointF p2(*line->p2.x, *line->p2.y);
|
||||||
|
|
||||||
if (dist_P2P(p1, pos) <= tolerance)
|
if (dist_P2P(p1, pos) <= tolerance)
|
||||||
temp = line->p1_ref;
|
temp = line->start_ref;
|
||||||
if (dist_P2P(p2, pos) <= tolerance)
|
if (dist_P2P(p2, pos) <= tolerance)
|
||||||
temp = line->p2_ref;
|
temp = line->end_ref;
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
@@ -104,8 +104,8 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
current_line->p1.y = y1;
|
current_line->p1.y = y1;
|
||||||
current_line->p2.x = x2;
|
current_line->p2.x = x2;
|
||||||
current_line->p2.y = y2;
|
current_line->p2.y = y2;
|
||||||
current_line->p1_ref = points[points.size() - 2];
|
current_line->start_ref = points[points.size() - 2];
|
||||||
current_line->p2_ref = points[points.size() - 1];
|
current_line->end_ref = points[points.size() - 1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*current_line->p2.x = scene.x();
|
*current_line->p2.x = scene.x();
|
||||||
@@ -214,11 +214,11 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
|
|
||||||
Line *l1 = nullptr, *l2 = nullptr;
|
Line *l1 = nullptr, *l2 = nullptr;
|
||||||
for (Line* l : lines) {
|
for (Line* l : lines) {
|
||||||
if (l->p1_ref == firstPoint || l->p2_ref == firstPoint) l1 = l;
|
if (l->start_ref == firstPoint || l->end_ref == firstPoint) l1 = l;
|
||||||
if (l->p1_ref == clickedPoint || l->p2_ref == clickedPoint) l2 = l;
|
if (l->start_ref == clickedPoint || l->end_ref == clickedPoint) l2 = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l1 == l2 ||
|
if (l1 == l2 && l1 && l2 ||
|
||||||
(areCoincident(firstPoint, clickedPoint, true)))
|
(areCoincident(firstPoint, clickedPoint, true)))
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, QString("NO!"), QString("P2P failed"));
|
QMessageBox::warning(this, QString("NO!"), QString("P2P failed"));
|
||||||
|
|||||||
@@ -174,6 +174,10 @@ public:
|
|||||||
class Curve
|
class Curve
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// start in Arc
|
||||||
|
Point* start_ref;
|
||||||
|
// end in Arc
|
||||||
|
Point* end_ref;
|
||||||
virtual ~Curve()
|
virtual ~Curve()
|
||||||
{}
|
{}
|
||||||
// returns normal vector. The vector should point to the left when one
|
// returns normal vector. The vector should point to the left when one
|
||||||
@@ -228,8 +232,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
Point p1;
|
Point p1;
|
||||||
Point p2;
|
Point p2;
|
||||||
Point* p1_ref;
|
|
||||||
Point* p2_ref;
|
|
||||||
DeriVector2 CalculateNormal(const Point& p, const double* derivparam = nullptr) const override;
|
DeriVector2 CalculateNormal(const Point& p, const double* derivparam = nullptr) const override;
|
||||||
DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
|
DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
|
||||||
int PushOwnParams(VEC_pD& pvec) override;
|
int PushOwnParams(VEC_pD& pvec) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user