Circle #9
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "dependencies/eigen"]
|
||||||
|
path = dependencies/eigen
|
||||||
|
url = https://gitlab.com/libeigen/eigen.git
|
||||||
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
# PlaneGCS PART
|
# PlaneGCS PART
|
||||||
set(PlaneGCS_project_name "PlaneGCS")
|
set(PlaneGCS_project_name "PlaneGCS")
|
||||||
set(INCLUDE_BOOST_DIR "C:/local/boost_1_89_0")
|
set(INCLUDE_BOOST_DIR "C:/local/boost_1_89_0")
|
||||||
set(INCLUDE_EIGEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/eigen-5.0.0)
|
set(INCLUDE_EIGEN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/eigen)
|
||||||
|
|
||||||
add_library(${PlaneGCS_project_name} STATIC
|
add_library(${PlaneGCS_project_name} STATIC
|
||||||
GCS/GCS.cpp
|
GCS/GCS.cpp
|
||||||
|
|||||||
169
Canvas.cpp
169
Canvas.cpp
@@ -90,20 +90,34 @@ void Canvas::zoomReset()
|
|||||||
// Методы поиска и проверки
|
// Методы поиска и проверки
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
Line* Canvas::findAt(QPointF& pos, qreal tolerance)
|
Curve* Canvas::findAt(QPointF& pos, qreal tolerance)
|
||||||
{
|
{
|
||||||
for (Line* line : lines) {
|
for (Curve* curve : curves) {
|
||||||
|
if (Line* line = dynamic_cast<Line*>(curve)) {
|
||||||
if (line->contains(pos, tolerance)) {
|
if (line->contains(pos, tolerance)) {
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Circle* circle = dynamic_cast<Circle*>(curve)) {
|
||||||
|
QPointF center(*circle->center.x, *circle->center.y);
|
||||||
|
double radius = *circle->rad;
|
||||||
|
|
||||||
|
double distToCenter = dist_P2P(center, pos);
|
||||||
|
// Проверяем, лежит ли точка вблизи окружности (с допуском)
|
||||||
|
if (std::abs(distToCenter - radius) <= tolerance) {
|
||||||
|
return circle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point* Canvas::findPointAt(QPointF pos, qreal tolerance)
|
Point* Canvas::findPointAt(QPointF pos, qreal tolerance)
|
||||||
{
|
{
|
||||||
Point* temp = nullptr;
|
Point* temp = nullptr;
|
||||||
for (Line* line : lines) {
|
|
||||||
|
for (Curve* curve : curves) {
|
||||||
|
if (Line* line = dynamic_cast<Line*>(curve)) {
|
||||||
QPointF p1(*line->p1.x, *line->p1.y);
|
QPointF p1(*line->p1.x, *line->p1.y);
|
||||||
QPointF p2(*line->p2.x, *line->p2.y);
|
QPointF p2(*line->p2.x, *line->p2.y);
|
||||||
|
|
||||||
@@ -112,6 +126,12 @@ Point* Canvas::findPointAt(QPointF pos, qreal tolerance)
|
|||||||
if (dist_P2P(p2, pos) <= tolerance)
|
if (dist_P2P(p2, pos) <= tolerance)
|
||||||
temp = line->end_ref;
|
temp = line->end_ref;
|
||||||
}
|
}
|
||||||
|
else if (Circle* circle = dynamic_cast<Circle*>(curve)) {
|
||||||
|
QPointF center(circle->center.get_X(), circle->center.get_Y());
|
||||||
|
if (dist_P2P(center, pos) <= tolerance)
|
||||||
|
temp = circle->center_ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,9 +248,9 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Line* found = findAt(scene);
|
Line* found = dynamic_cast<Line*>(findAt(scene));
|
||||||
if (found) {
|
if (found) {
|
||||||
draggedLine = found;
|
draggedCurve = found;
|
||||||
QPointF lineCenter(
|
QPointF lineCenter(
|
||||||
(*found->p1.x + *found->p2.x) / 2.0,
|
(*found->p1.x + *found->p2.x) / 2.0,
|
||||||
(*found->p1.y + *found->p2.y) / 2.0
|
(*found->p1.y + *found->p2.y) / 2.0
|
||||||
@@ -238,11 +258,19 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
dragOffset = scene - lineCenter;
|
dragOffset = scene - lineCenter;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Circle* found_circle = dynamic_cast<Circle*>(findAt(scene));
|
||||||
|
if (found_circle) {
|
||||||
|
draggedCurve = found_circle;
|
||||||
|
QPointF center(*found_circle->center.x, *found_circle->center.y);
|
||||||
|
dragOffset = scene - center;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================== Режим Horizontal/Vertical ======================
|
// ====================== Режим Horizontal/Vertical ======================
|
||||||
else if (mode == Mode::Horizontal || mode == Mode::Vertical) {
|
else if (mode == Mode::Horizontal || mode == Mode::Vertical) {
|
||||||
Line* found = findAt(scene);
|
Line* found = dynamic_cast<Line*>(findAt(scene));
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
// Проверка: если линия уже вертикальна, нельзя сделать её горизонтальной
|
// Проверка: если линия уже вертикальна, нельзя сделать её горизонтальной
|
||||||
@@ -349,18 +377,47 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
|
|
||||||
current_line->set_tag(obj_count++);
|
current_line->set_tag(obj_count++);
|
||||||
// Завершаем создание линии
|
// Завершаем создание линии
|
||||||
lines.append(current_line);
|
curves.append(current_line);
|
||||||
current_line = nullptr;
|
current_line = nullptr;
|
||||||
mode = Mode::None;
|
mode = Mode::None;
|
||||||
after_constraint = true;
|
|
||||||
}
|
}
|
||||||
solve_for_canvas();
|
solve_for_canvas();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (mode == Mode::DrawingCircle) {
|
||||||
|
if (!current_circle) {
|
||||||
|
current_circle = new Circle();
|
||||||
|
// Создаем координаты для центра окружности
|
||||||
|
double* x = new double(scene.x());
|
||||||
|
double* y = new double(scene.y());
|
||||||
|
|
||||||
|
points.push_back(new Point(x, y, obj_count++));
|
||||||
|
|
||||||
|
// Добавляем параметры в солвер
|
||||||
|
params.push_back(x);
|
||||||
|
params.push_back(y);
|
||||||
|
|
||||||
|
current_circle->center.x = x;
|
||||||
|
current_circle->center.y = y;
|
||||||
|
current_circle->center_ref = points[points.size() - 1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
double *r = new double(dist_P2P(QPointF(current_circle->center.get_X(), current_circle->center.get_Y()), QPointF(scene.x(), scene.y())));
|
||||||
|
current_circle->rad = r;
|
||||||
|
|
||||||
|
params.push_back(r);
|
||||||
|
curves.append(current_circle);
|
||||||
|
current_circle->set_tag(obj_count++);
|
||||||
|
current_circle = nullptr;
|
||||||
|
mode = Mode::None;
|
||||||
|
}
|
||||||
|
solve_for_canvas();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// ====================== Режим Parallel: задание параллельности ======================
|
// ====================== Режим Parallel: задание параллельности ======================
|
||||||
else if (mode == Mode::Parallel) {
|
else if (mode == Mode::Parallel) {
|
||||||
Line* found = findAt(scene);
|
Line* found = dynamic_cast<Line*>(findAt(scene));
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
current_line = nullptr;
|
current_line = nullptr;
|
||||||
@@ -437,12 +494,15 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
// Находим линии, к которым принадлежат точки
|
// Находим линии, к которым принадлежат точки
|
||||||
Line* l1 = nullptr;
|
Line* l1 = nullptr;
|
||||||
Line* l2 = nullptr;
|
Line* l2 = nullptr;
|
||||||
for (Line* l : lines) {
|
|
||||||
|
for (Curve* curve : curves) {
|
||||||
|
if (Line* l = dynamic_cast<Line*>(curve)) {
|
||||||
if (l->start_ref == firstPoint || l->end_ref == firstPoint)
|
if (l->start_ref == firstPoint || l->end_ref == firstPoint)
|
||||||
l1 = l;
|
l1 = l;
|
||||||
if (l->start_ref == clickedPoint || l->end_ref == clickedPoint)
|
if (l->start_ref == clickedPoint || l->end_ref == clickedPoint)
|
||||||
l2 = l;
|
l2 = l;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Проверка на невозможность ограничения
|
// Проверка на невозможность ограничения
|
||||||
if ((l1 == l2 && l1 && l2) || areCoincident(firstPoint, clickedPoint)) {
|
if ((l1 == l2 && l1 && l2) || areCoincident(firstPoint, clickedPoint)) {
|
||||||
@@ -467,7 +527,7 @@ void Canvas::mousePressEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (mode == Mode::Perpendicular) {
|
else if (mode == Mode::Perpendicular) {
|
||||||
Line* found = findAt(scene);
|
Line* found = dynamic_cast<Line*>(findAt(scene));
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
current_line = nullptr;
|
current_line = nullptr;
|
||||||
@@ -534,12 +594,11 @@ void Canvas::mouseMoveEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
solve_for_canvas();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====================== Перемещение линии ======================
|
// ====================== Перемещение линии ======================
|
||||||
else if (draggedLine) {
|
else if (draggedCurve) {
|
||||||
|
if (Line* draggedLine = dynamic_cast<Line*>(draggedCurve)) {
|
||||||
QPointF newCenter = UCS_POSITION - dragOffset;
|
QPointF newCenter = UCS_POSITION - dragOffset;
|
||||||
QPointF oldCenter(
|
QPointF oldCenter(
|
||||||
(*draggedLine->p1.x + *draggedLine->p2.x) / 2.0,
|
(*draggedLine->p1.x + *draggedLine->p2.x) / 2.0,
|
||||||
@@ -567,12 +626,28 @@ void Canvas::mouseMoveEvent(QMouseEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
solve_for_canvas();
|
}
|
||||||
|
else if (Circle* circle = dynamic_cast<Circle*>(draggedCurve)) {
|
||||||
|
QPointF newCenter = UCS_POSITION - dragOffset;
|
||||||
|
*circle->center.x = newCenter.x();
|
||||||
|
*circle->center.y = newCenter.y();
|
||||||
|
*circle->center_ref->x = newCenter.x();
|
||||||
|
*circle->center_ref->y = newCenter.y();
|
||||||
|
|
||||||
|
// Также обновляем все совпадающие точки (если центр совпадает с другими точками через P2P)
|
||||||
|
for (Point* other : points) {
|
||||||
|
if (other != circle->center_ref && areCoincident(circle->center_ref, other)) {
|
||||||
|
*other->x = newCenter.x();
|
||||||
|
*other->y = newCenter.y();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
else
|
else
|
||||||
showObjectTag(WIDGET_POSITION);
|
showObjectTag(WIDGET_POSITION);
|
||||||
#endif
|
#endif
|
||||||
|
solve_for_canvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Canvas::mouseReleaseEvent(QMouseEvent* event)
|
void Canvas::mouseReleaseEvent(QMouseEvent* event)
|
||||||
@@ -584,8 +659,8 @@ void Canvas::mouseReleaseEvent(QMouseEvent* event)
|
|||||||
solve_for_canvas();
|
solve_for_canvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draggedLine) {
|
if (draggedCurve) {
|
||||||
draggedLine = nullptr;
|
draggedCurve = nullptr;
|
||||||
solve_for_canvas();
|
solve_for_canvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,7 +685,9 @@ void Canvas::paintEvent(QPaintEvent* event)
|
|||||||
p.drawLine(0, -5, 0, 5);
|
p.drawLine(0, -5, 0, 5);
|
||||||
|
|
||||||
// ====================== Отрисовка линий ======================
|
// ====================== Отрисовка линий ======================
|
||||||
for (Line* line : lines) {
|
|
||||||
|
for (Curve* curve : curves) {
|
||||||
|
if (Line* line = dynamic_cast<Line*>(curve)) {
|
||||||
bool isSelected = (mode == Mode::Parallel && line == current_line);
|
bool isSelected = (mode == Mode::Parallel && line == current_line);
|
||||||
|
|
||||||
// Настройка пера для линии
|
// Настройка пера для линии
|
||||||
@@ -631,6 +708,19 @@ void Canvas::paintEvent(QPaintEvent* event)
|
|||||||
p.drawEllipse(QPointF(*line->p1.x, *line->p1.y), 5, 5);
|
p.drawEllipse(QPointF(*line->p1.x, *line->p1.y), 5, 5);
|
||||||
p.drawEllipse(QPointF(*line->p2.x, *line->p2.y), 5, 5);
|
p.drawEllipse(QPointF(*line->p2.x, *line->p2.y), 5, 5);
|
||||||
}
|
}
|
||||||
|
else if (Circle* circle = dynamic_cast<Circle*>(curve)) {
|
||||||
|
p.setPen(QPen(Qt::black, 2));
|
||||||
|
p.setBrush(Qt::NoBrush);
|
||||||
|
|
||||||
|
p.drawEllipse(QPointF(*circle->center.x, *circle->center.y),
|
||||||
|
*circle->rad, *circle->rad);
|
||||||
|
|
||||||
|
p.setBrush(QBrush(Qt::darkBlue));
|
||||||
|
p.setPen(Qt::NoPen);
|
||||||
|
p.drawEllipse(QPointF(*circle->center.x, *circle->center.y), 5, 5);
|
||||||
|
p.setBrush(Qt::NoBrush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ====================== Подсветка выбранной точки (режим Coincedent) ======================
|
// ====================== Подсветка выбранной точки (режим Coincedent) ======================
|
||||||
if (mode == Mode::Coincedent && firstPoint) {
|
if (mode == Mode::Coincedent && firstPoint) {
|
||||||
@@ -743,19 +833,19 @@ void Canvas::leaveEvent(QEvent* event)
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void Canvas::showObjectTag(QPointF pos)
|
void Canvas::showObjectTag(QPointF pos)
|
||||||
{
|
{
|
||||||
QPointF l = screenToLogical(pos);
|
//QPointF l = screenToLogical(pos);
|
||||||
Line* lineUnderCursor = findAt(l, 1.0);
|
//Line* lineUnderCursor = findAt(l, 1.0);
|
||||||
if (lineUnderCursor && lineUnderCursor != draggedLine) {
|
//if (lineUnderCursor && lineUnderCursor != draggedLine) {
|
||||||
QPointF p1(*lineUnderCursor->p1.x, *lineUnderCursor->p1.y);
|
// QPointF p1(*lineUnderCursor->p1.x, *lineUnderCursor->p1.y);
|
||||||
QPointF p2(*lineUnderCursor->p2.x, *lineUnderCursor->p2.y);
|
// QPointF p2(*lineUnderCursor->p2.x, *lineUnderCursor->p2.y);
|
||||||
QLineF info_line(p1, p2);
|
// QLineF info_line(p1, p2);
|
||||||
QString Text = QString("Line %1\nLength = %2mm")
|
// QString Text = QString("Line %1\nLength = %2mm")
|
||||||
.arg(lineUnderCursor->get_tag() + 1)
|
// .arg(lineUnderCursor->get_tag() + 1)
|
||||||
.arg(info_line.length());
|
// .arg(info_line.length());
|
||||||
QToolTip::showText(mapToGlobal(pos.toPoint()), Text, this);
|
// QToolTip::showText(mapToGlobal(pos.toPoint()), Text, this);
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
QToolTip::hideText();
|
// QToolTip::hideText();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -803,7 +893,8 @@ void Canvas::solve_for_canvas()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sys.applySolution();
|
sys.applySolution();
|
||||||
for (Line* line : lines) {
|
for (Curve* curve : curves) {
|
||||||
|
if (Line* line = dynamic_cast<Line*>(curve)) {
|
||||||
if (abs(*line->p1.x - *line->p2.x) < EPS && abs(*line->p1.y - *line->p2.y) < EPS && after_constraint) {
|
if (abs(*line->p1.x - *line->p2.x) < EPS && abs(*line->p1.y - *line->p2.y) < EPS && after_constraint) {
|
||||||
sys.undoSolution();
|
sys.undoSolution();
|
||||||
flag = true;
|
flag = true;
|
||||||
@@ -811,13 +902,16 @@ void Canvas::solve_for_canvas()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (flag) {
|
if (flag && after_constraint) {
|
||||||
QMessageBox::warning(this, QString("Error!"), QString("Last constraint is unavailable!"));
|
QMessageBox::warning(this, QString("Error!"), QString("Last constraint is unavailable!"));
|
||||||
remove_constraint(constraints_count - 1);
|
remove_constraint(constraints_count - 1);
|
||||||
C_Info.erase(constraints_count - 1);
|
C_Info.erase(constraints_count - 1);
|
||||||
constraints_count--;
|
constraints_count--;
|
||||||
}
|
}
|
||||||
|
else if (flag) {
|
||||||
|
sys.undoSolution();
|
||||||
|
}
|
||||||
after_constraint = false;
|
after_constraint = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -840,14 +934,15 @@ void Canvas::clearCanvas()
|
|||||||
delete pt;
|
delete pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Line* line : lines) {
|
for (Curve* curve : curves){
|
||||||
delete line;
|
delete curve;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Очистка контейнеров
|
// Очистка контейнеров
|
||||||
params.clear();
|
params.clear();
|
||||||
points.clear();
|
points.clear();
|
||||||
lines.clear();
|
curves.clear();
|
||||||
|
|
||||||
// Очистка контейнеров ограничений
|
// Очистка контейнеров ограничений
|
||||||
parallelPairs.clear();
|
parallelPairs.clear();
|
||||||
|
|||||||
9
Canvas.h
9
Canvas.h
@@ -34,7 +34,8 @@ enum class Mode : int
|
|||||||
Coincedent = 3, ///< Режим задания совпадения точек
|
Coincedent = 3, ///< Режим задания совпадения точек
|
||||||
Horizontal = 4, ///< Режим задания горизонтальности
|
Horizontal = 4, ///< Режим задания горизонтальности
|
||||||
Vertical = 5, ///< Режим задания вертикальности
|
Vertical = 5, ///< Режим задания вертикальности
|
||||||
Perpendicular = 6 ///< Режим задания перпендикулярности
|
Perpendicular = 6, ///< Режим задания перпендикулярности
|
||||||
|
DrawingCircle = 7 ///< Режим рисования окружности
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Удобный тип для хранения пары параллельных линий (порядок не важен)
|
/// Удобный тип для хранения пары параллельных линий (порядок не важен)
|
||||||
@@ -168,7 +169,7 @@ private:
|
|||||||
* @param tolerance Допуск поиска
|
* @param tolerance Допуск поиска
|
||||||
* @return Найденная линия или nullptr
|
* @return Найденная линия или nullptr
|
||||||
*/
|
*/
|
||||||
Line* findAt(QPointF& pos, qreal tolerance = 5.0);
|
Curve* findAt(QPointF& pos, qreal tolerance = 5.0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Найти точку в указанной позиции
|
* @brief Найти точку в указанной позиции
|
||||||
@@ -250,11 +251,12 @@ private:
|
|||||||
// ====================== Данные для перемещения объектов ======================
|
// ====================== Данные для перемещения объектов ======================
|
||||||
Point* draggedPoint{ nullptr }; ///< Точка, которую перемещают
|
Point* draggedPoint{ nullptr }; ///< Точка, которую перемещают
|
||||||
Line* draggedLine{ nullptr }; ///< Линия, которую перемещают
|
Line* draggedLine{ nullptr }; ///< Линия, которую перемещают
|
||||||
|
Curve* draggedCurve { nullptr };
|
||||||
QPointF dragOffset; ///< Смещение при начале перемещения
|
QPointF dragOffset; ///< Смещение при начале перемещения
|
||||||
|
|
||||||
// ====================== Данные геометрической системы ======================
|
// ====================== Данные геометрической системы ======================
|
||||||
System sys; ///< Геометрический солвер
|
System sys; ///< Геометрический солвер
|
||||||
QVector<Line*> lines; ///< Завершённые линии
|
QVector<Curve*> curves; ///< Геометрические кривые
|
||||||
QVector<Point*> points; ///< Все точки сцены
|
QVector<Point*> points; ///< Все точки сцены
|
||||||
std::vector<double*> params; ///< Все параметры, передаваемые в солвер
|
std::vector<double*> params; ///< Все параметры, передаваемые в солвер
|
||||||
|
|
||||||
@@ -267,6 +269,7 @@ private:
|
|||||||
|
|
||||||
// ====================== Временные данные для режимов ======================
|
// ====================== Временные данные для режимов ======================
|
||||||
Line* current_line{ nullptr }; ///< Текущая линия в режимах рисования/параллельности
|
Line* current_line{ nullptr }; ///< Текущая линия в режимах рисования/параллельности
|
||||||
|
Circle* current_circle{ nullptr };
|
||||||
Point* firstPoint{ nullptr }; ///< Первая точка в режиме совпадения
|
Point* firstPoint{ nullptr }; ///< Первая точка в режиме совпадения
|
||||||
Mode mode{ Mode::None }; ///< Текущий режим работы
|
Mode mode{ Mode::None }; ///< Текущий режим работы
|
||||||
|
|
||||||
|
|||||||
@@ -43,3 +43,9 @@ void DRAWer_2_0::on_Perpendicular_Button_clicked()
|
|||||||
ui.widget->changeMode(Mode::Perpendicular);
|
ui.widget->changeMode(Mode::Perpendicular);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DRAWer_2_0::on_Circle_Button_clicked()
|
||||||
|
{
|
||||||
|
ui.widget->changeMode(Mode::DrawingCircle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ private slots:
|
|||||||
|
|
||||||
void on_Perpendicular_Button_clicked();
|
void on_Perpendicular_Button_clicked();
|
||||||
|
|
||||||
|
void on_Circle_Button_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DRAWer_2_0Class ui;
|
Ui::DRAWer_2_0Class ui;
|
||||||
};
|
};
|
||||||
|
|||||||
105
DRAWer_2_0.ui
105
DRAWer_2_0.ui
@@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>691</width>
|
<width>776</width>
|
||||||
<height>615</height>
|
<height>701</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>1080</width>
|
<width>1080</width>
|
||||||
<height>1080</height>
|
<height>1060</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -27,6 +27,25 @@
|
|||||||
<number>23</number>
|
<number>23</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Primitives</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="Line_Button">
|
<widget class="QPushButton" name="Line_Button">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -39,27 +58,30 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
<widget class="QPushButton" name="Parallel_Button">
|
<widget class="QPushButton" name="Circle_Button">
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>75</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Parallel</string>
|
<string>Circle</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
</layout>
|
||||||
<widget class="QPushButton" name="Perpendicular_Button">
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Perpendicular</string>
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Constraints</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="P2P_Button">
|
<widget class="QPushButton" name="P2P_Button">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -72,19 +94,43 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="Perpendicular_Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Perpendicular</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="Horizontal_Button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Horizontal</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="Parallel_Button">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Parallel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
<widget class="QPushButton" name="Vertical_Button">
|
<widget class="QPushButton" name="Vertical_Button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Vertical</string>
|
<string>Vertical</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
</layout>
|
||||||
<widget class="QPushButton" name="Horizontal_Button">
|
</item>
|
||||||
<property name="text">
|
</layout>
|
||||||
<string>Horizontal</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -108,6 +154,9 @@
|
|||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>CrossCursor</cursorShape>
|
||||||
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string>Canvas</string>
|
<string>Canvas</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -120,8 +169,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>691</width>
|
<width>776</width>
|
||||||
<height>21</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void Line::set_tag(int _tag) {
|
|||||||
p2.set_tag(_tag);
|
p2.set_tag(_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Line::get_tag()
|
int Curve::get_tag()
|
||||||
{
|
{
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
@@ -275,6 +275,11 @@ Circle* Circle::Copy()
|
|||||||
return crv;
|
return crv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Circle::set_tag(int _tag) {
|
||||||
|
tag = _tag;
|
||||||
|
center.set_tag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
//------------arc
|
//------------arc
|
||||||
int Arc::PushOwnParams(VEC_pD& pvec)
|
int Arc::PushOwnParams(VEC_pD& pvec)
|
||||||
{
|
{
|
||||||
|
|||||||
10
GCS/Geo.h
10
GCS/Geo.h
@@ -173,6 +173,8 @@ public:
|
|||||||
/// A base class for all curve-based objects (line, circle/arc, ellipse/arc).
|
/// A base class for all curve-based objects (line, circle/arc, ellipse/arc).
|
||||||
class Curve
|
class Curve
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
int tag;
|
||||||
public:
|
public:
|
||||||
virtual ~Curve()
|
virtual ~Curve()
|
||||||
{}
|
{}
|
||||||
@@ -212,12 +214,13 @@ public:
|
|||||||
// DeepSOIC: I haven't found a way to simply copy a curve object provided pointer to a curve
|
// DeepSOIC: I haven't found a way to simply copy a curve object provided pointer to a curve
|
||||||
// object.
|
// object.
|
||||||
virtual Curve* Copy() = 0;
|
virtual Curve* Copy() = 0;
|
||||||
|
|
||||||
|
void set_tag(int);
|
||||||
|
int get_tag();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Line: public Curve
|
class Line: public Curve
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
int tag;
|
|
||||||
public:
|
public:
|
||||||
Line()
|
Line()
|
||||||
{}
|
{}
|
||||||
@@ -238,7 +241,6 @@ public:
|
|||||||
Line* Copy() override;
|
Line* Copy() override;
|
||||||
|
|
||||||
void set_tag(int);
|
void set_tag(int);
|
||||||
int get_tag();
|
|
||||||
bool contains(QPointF, qreal tol) const;
|
bool contains(QPointF, qreal tol) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -253,12 +255,14 @@ public:
|
|||||||
~Circle() override
|
~Circle() override
|
||||||
{}
|
{}
|
||||||
Point center;
|
Point center;
|
||||||
|
Point* center_ref;
|
||||||
double* rad;
|
double* rad;
|
||||||
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;
|
||||||
void ReconstructOnNewPvec(VEC_pD& pvec, int& cnt) override;
|
void ReconstructOnNewPvec(VEC_pD& pvec, int& cnt) override;
|
||||||
Circle* Copy() override;
|
Circle* Copy() override;
|
||||||
|
void set_tag(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Arc: public Circle
|
class Arc: public Circle
|
||||||
|
|||||||
1
dependencies/eigen
vendored
Submodule
1
dependencies/eigen
vendored
Submodule
Submodule dependencies/eigen added at 9164d3f16a
Reference in New Issue
Block a user