From 15e701ff4f283b43da10231f9894eef625ff0aaf Mon Sep 17 00:00:00 2001 From: ParkSuMin Date: Tue, 9 Dec 2025 21:22:18 +0300 Subject: [PATCH 1/2] Improve line choice --- GCS/Geo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GCS/Geo.h b/GCS/Geo.h index faf6efa..bbaceb8 100644 --- a/GCS/Geo.h +++ b/GCS/Geo.h @@ -238,7 +238,7 @@ public: void set_tag(int); int get_tag(); - bool contains(QPointF, qreal tol = 10.0) const; + bool contains(QPointF, qreal tol = 5.0) const; }; -- 2.49.1 From d9f40e90a51e8b3a1ee5226f71d5b68023f5ba72 Mon Sep 17 00:00:00 2001 From: ParkSuMin Date: Tue, 9 Dec 2025 22:08:57 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=82=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=BE=D0=B5=20=D0=B8=20=D0=B3=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=B7=D0=BE=D0=BD=D1=82=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=B2=D1=8B=D1=80=D0=B0=D0=B2=D0=BD=D0=B8=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Canvas.cpp | 18 ++++++++++++++++-- Canvas.h | 4 +++- DRAWer_2_0.cpp | 9 +++++++-- DRAWer_2_0.h | 4 +++- DRAWer_2_0.ui | 13 ++++++++++--- 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Canvas.cpp b/Canvas.cpp index fe7af21..0629d37 100644 --- a/Canvas.cpp +++ b/Canvas.cpp @@ -75,15 +75,29 @@ void Canvas::mousePressEvent(QMouseEvent* event) #ifdef _DEBUG qDebug() << "Scene point in" << scene.x() << scene.y(); #endif - + if (mode == Mode::None){ Point* p = findPointAt(scene); if (p) { draggedPoint = p; dragOffset = scene - QPointF(*p->x, *p->y); - return; } } + + else if (mode == Mode::Horizontal || mode == Mode::Vertical) { + Line* found = findAt(scene); + + if (found) { + if (mode == Mode::Horizontal) + sys.addConstraintHorizontal(*found, constraints_count++); + else + sys.addConstraintVertical(*found, constraints_count++); + update(); + } + mode = Mode::None; + after_constraint = true; + } + else if (mode == Mode::DrawingLine) { if (!current_line) { current_line = new Line(); diff --git a/Canvas.h b/Canvas.h index 567652c..0f498ac 100644 --- a/Canvas.h +++ b/Canvas.h @@ -19,7 +19,9 @@ enum class Mode : int None = 0, DrawingLine = 1, Parallel = 2, - Coincedent = 3 + Coincedent = 3, + Horizontal = 4, + Vertical = 5 }; // Удобный тип для хранения пары параллельных линий (порядок не важен) diff --git a/DRAWer_2_0.cpp b/DRAWer_2_0.cpp index 7c2f683..4458cb3 100644 --- a/DRAWer_2_0.cpp +++ b/DRAWer_2_0.cpp @@ -30,8 +30,13 @@ void DRAWer_2_0::on_P2P_Button_clicked() } -void DRAWer_2_0::on_FIX_Button_clicked() +void DRAWer_2_0::on_Horizontal_Button_clicked() { - + ui.widget->changeMode(Mode::Horizontal); +} + +void DRAWer_2_0::on_Vertical_Button_clicked() +{ + ui.widget->changeMode(Mode::Vertical); } diff --git a/DRAWer_2_0.h b/DRAWer_2_0.h index 3adf8ef..9d40eca 100644 --- a/DRAWer_2_0.h +++ b/DRAWer_2_0.h @@ -18,7 +18,9 @@ private slots: void on_P2P_Button_clicked(); - void on_FIX_Button_clicked(); + void on_Horizontal_Button_clicked(); + + void on_Vertical_Button_clicked(); private: Ui::DRAWer_2_0Class ui; diff --git a/DRAWer_2_0.ui b/DRAWer_2_0.ui index 5221b23..fe011c0 100644 --- a/DRAWer_2_0.ui +++ b/DRAWer_2_0.ui @@ -66,9 +66,16 @@ - + - Fix Point + Vertical + + + + + + + Horizontal @@ -117,7 +124,7 @@ 0 0 700 - 22 + 21 -- 2.49.1