diff --git a/Valentina.pro b/Valentina.pro
index 5f13ed161..e4cc56687 100644
--- a/Valentina.pro
+++ b/Valentina.pro
@@ -71,7 +71,7 @@ CONFIG(debug, debug|release){
-isystem "/usr/include/qt5/QtXml" -isystem "/usr/include/qt5/QtGui" \
-isystem "/usr/include/qt5/QtCore" -isystem "$${UI_DIR}" -isystem "$${MOC_DIR}" \
-isystem "$${RCC_DIR}" \
- -Og -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
+ -O0 -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
-Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k \
diff --git a/share/resources/cursor.qrc b/share/resources/cursor.qrc
index 4e9cd2b99..d8f3a8ab2 100644
--- a/share/resources/cursor.qrc
+++ b/share/resources/cursor.qrc
@@ -18,5 +18,6 @@
cursor/spline_cut_point_cursor.png
cursor/splinepath_cut_point_cursor.png
cursor/union_cursor.png
+ cursor/arc_cut_cursor.png
diff --git a/share/resources/cursor/arc_cut_cursor.png b/share/resources/cursor/arc_cut_cursor.png
new file mode 100644
index 000000000..62ca8f1cb
Binary files /dev/null and b/share/resources/cursor/arc_cut_cursor.png differ
diff --git a/share/resources/icon.qrc b/share/resources/icon.qrc
index 8ba3c5058..5188b15ad 100644
--- a/share/resources/icon.qrc
+++ b/share/resources/icon.qrc
@@ -40,5 +40,6 @@
icon/32x32/spline_cut_point.png
icon/32x32/splinePath_cut_point.png
icon/32x32/union.png
+ icon/32x32/arc_cut.png
diff --git a/share/resources/icon/32x32/arc_cut.png b/share/resources/icon/32x32/arc_cut.png
new file mode 100644
index 000000000..7b4f876b1
Binary files /dev/null and b/share/resources/icon/32x32/arc_cut.png differ
diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp
index 65d94e1c5..8a34a120b 100644
--- a/src/container/vcontainer.cpp
+++ b/src/container/vcontainer.cpp
@@ -609,13 +609,8 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value)
void VContainer::AddLengthArc(const qint64 &id)
{
const VArc * arc = GeometricObject(id);
- AddLengthArc(arc->name(), toMM(arc->GetLength()));
-}
-
-void VContainer::AddLengthArc(const QString &name, const qreal &value)
-{
- Q_ASSERT(name.isEmpty() == false);
- lengthArcs[name] = value;
+ QString name = QString("%1_%2").arg(arc->name()).arg(id);
+ lengthArcs[name] = toMM(arc->GetLength());
}
void VContainer::AddLineAngle(const QString &name, const qreal &value)
diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h
index 70178976b..a250d2e2c 100644
--- a/src/container/vcontainer.h
+++ b/src/container/vcontainer.h
@@ -185,12 +185,6 @@ public:
* @param id id of arc
*/
void AddLengthArc(const qint64 &id);
- /**
- * @brief AddLengthArc add length of arc
- * @param name name of arc
- * @param value length of arc
- */
- void AddLengthArc(const QString &name, const qreal &value);
/**
* @brief AddLineAngle add angle of line to container
* @param name name of line angle
diff --git a/src/dialogs/dialogcutarc.cpp b/src/dialogs/dialogcutarc.cpp
new file mode 100644
index 000000000..2c663634e
--- /dev/null
+++ b/src/dialogs/dialogcutarc.cpp
@@ -0,0 +1,114 @@
+/************************************************************************
+ **
+ ** @file dialogcutarc.cpp
+ ** @author Roman Telezhinsky
+ ** @date 7 1, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "dialogcutarc.h"
+#include "ui_dialogcutarc.h"
+
+DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) :
+ DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0)
+{
+ ui->setupUi(this);
+ listWidget = ui->listWidget;
+ labelResultCalculation = ui->labelResultCalculation;
+ labelDescription = ui->labelDescription;
+ radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
+ radioButtonStandartTable = ui->radioButtonStandartTable;
+ radioButtonIncrements = ui->radioButtonIncrements;
+ radioButtonLengthLine = ui->radioButtonLengthLine;
+ radioButtonLengthArc = ui->radioButtonLengthArc;
+ radioButtonLengthCurve = ui->radioButtonLengthSpline;
+ lineEditFormula = ui->lineEditFormula;
+ labelEditFormula = ui->labelEditFormula;
+ labelEditNamePoint = ui->labelEditNamePoint;
+ flagFormula = false;
+ bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
+ connect(bOk, &QPushButton::clicked, this, &DialogCutArc::DialogAccepted);
+ flagName = false;
+ CheckState();
+ QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
+ connect(bCansel, &QPushButton::clicked, this, &DialogCutArc::DialogRejected);
+
+ FillComboBoxArcs(ui->comboBoxArc);
+
+ connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere);
+ connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal);
+ connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutArc::ValChenged);
+
+ ShowVariable(data->DataBase());
+ connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutArc::SizeGrowth);
+ connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogCutArc::StandartTable);
+ connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutArc::Increments);
+ connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutArc::LengthLines);
+ connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutArc::LengthArcs);
+ connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutArc::LengthCurves);
+ connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutArc::EvalFormula);
+ connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged);
+ connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged);
+}
+
+DialogCutArc::~DialogCutArc()
+{
+ delete ui;
+}
+
+void DialogCutArc::ChoosedObject(qint64 id, const Scene::Scenes &type)
+{
+ if (type == Scene::Arc)
+ {
+ const VArc *arc = data->GeometricObject(id);
+ ChangeCurrentText(ui->comboBoxArc, arc->name());
+ emit ToolTip("");
+ this->show();
+ }
+}
+
+void DialogCutArc::DialogAccepted()
+{
+ pointName = ui->lineEditNamePoint->text();
+ formula = ui->lineEditFormula->text();
+ arcId = getCurrentObjectId(ui->comboBoxArc);
+ emit DialogClosed(QDialog::Accepted);
+}
+
+void DialogCutArc::setArcId(const qint64 &value, const qint64 &id)
+{
+ setCurrentArcId(ui->comboBoxArc, arcId, value, id, ComboMode::CutArc);
+}
+
+void DialogCutArc::setFormula(const QString &value)
+{
+ formula = value;
+ ui->lineEditFormula->setText(formula);
+}
+
+void DialogCutArc::setPointName(const QString &value)
+{
+ pointName = value;
+ ui->lineEditNamePoint->setText(pointName);
+}
+
diff --git a/src/dialogs/dialogcutarc.h b/src/dialogs/dialogcutarc.h
new file mode 100644
index 000000000..bc5871943
--- /dev/null
+++ b/src/dialogs/dialogcutarc.h
@@ -0,0 +1,69 @@
+/************************************************************************
+ **
+ ** @file dialogcutarc.h
+ ** @author Roman Telezhinsky
+ ** @date 7 1, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef DIALOGCUTARC_H
+#define DIALOGCUTARC_H
+
+#include "dialogtool.h"
+
+namespace Ui {
+class DialogCutArc;
+}
+
+class DialogCutArc : public DialogTool
+{
+ Q_OBJECT
+public:
+ DialogCutArc(const VContainer *data, QWidget *parent = 0);
+ ~DialogCutArc();
+ QString getPointName() const {return pointName;}
+ void setPointName(const QString &value);
+ QString getFormula() const {return formula;}
+ void setFormula(const QString &value);
+ qint64 getArcId() const {return arcId;}
+ void setArcId(const qint64 &value, const qint64 &id);
+public slots:
+ /**
+ * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
+ * @param id id of point or detail
+ * @param type type of object
+ */
+ virtual void ChoosedObject(qint64 id, const Scene::Scenes &type);
+ /**
+ * @brief DialogAccepted save data and emit signal about closed dialog.
+ */
+ virtual void DialogAccepted();
+private:
+ Q_DISABLE_COPY(DialogCutArc)
+ Ui::DialogCutArc *ui;
+ QString pointName;
+ QString formula;
+ qint64 arcId;
+};
+
+#endif // DIALOGCUTARC_H
diff --git a/src/dialogs/dialogcutarc.ui b/src/dialogs/dialogcutarc.ui
new file mode 100644
index 000000000..af7eba9cf
--- /dev/null
+++ b/src/dialogs/dialogcutarc.ui
@@ -0,0 +1,360 @@
+
+
+ DialogCutArc
+
+
+
+ 0
+ 0
+ 507
+ 375
+
+
+
+ Dialog
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 159
+ 158
+ 158
+
+
+
+
+
+
+
+ Length
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Formula for the calculation of the spline
+
+
+
+ -
+
+
+ ...
+
+
+
+ :/icon/24x24/putHere.png:/icon/24x24/putHere.png
+
+
+
+ 24
+ 24
+
+
+
+
+ -
+
+
+ Calculate value
+
+
+ ...
+
+
+
+ :/icon/24x24/equal.png:/icon/24x24/equal.png
+
+
+
+ 24
+ 24
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 87
+ 0
+
+
+
+ Value of length
+
+
+ _
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Arc
+
+
+
+ -
+
+
+ Selected curve
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 159
+ 158
+ 158
+
+
+
+
+
+
+
+ Point label
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ Input data
+
+
+
+ -
+
+
+ Size and height
+
+
+ true
+
+
+
+ -
+
+
+ Standard table
+
+
+
+ -
+
+
+ Increments
+
+
+
+ -
+
+
+ true
+
+
+ Length of lines
+
+
+
+ -
+
+
+ true
+
+
+ Length of arcs
+
+
+
+ -
+
+
+ true
+
+
+ Length of curves
+
+
+
+
+
+
+
+ -
+
+
+ Variables - Click twice to insert into formula
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DialogCutArc
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DialogCutArc
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/dialogs/dialoghistory.cpp b/src/dialogs/dialoghistory.cpp
index 3a8bc2d9c..7182f6625 100644
--- a/src/dialogs/dialoghistory.cpp
+++ b/src/dialogs/dialoghistory.cpp
@@ -34,6 +34,7 @@
#include "../tools/vabstracttool.h"
#include "../tools/drawTools/vtoolcutspline.h"
#include "../tools/drawTools/vtoolcutsplinepath.h"
+#include "../tools/drawTools/vtoolcutarc.h"
#include
#include
@@ -363,6 +364,20 @@ QString DialogHistory::Record(const VToolRecord &tool)
firstPointIdName, secondPointIdName);
break;
}
+ case Tool::CutArcTool:
+ {
+ qint64 arcId = 0;
+ domElement = doc->elementById(QString().setNum(tool.getId()));
+ if (domElement.isElement())
+ {
+ arcId = doc->GetParametrLongLong(domElement, VToolCutArc::AttrArc, "0");
+ }
+ const VArc *arc = data->GeometricObject(arcId);
+ QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name();
+ QString toolIdName = data->GeometricObject(tool.getId())->name();
+ record = QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName);
+ }
+ break;
case Tool::CutSplineTool:
{
qint64 splineId = 0;
diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri
index 3367425c8..291077001 100644
--- a/src/dialogs/dialogs.pri
+++ b/src/dialogs/dialogs.pri
@@ -21,7 +21,8 @@ HEADERS += \
src/dialogs/dialogalongline.h \
src/dialogs/dialogcutspline.h \
src/dialogs/dialogcutsplinepath.h \
- src/dialogs/dialoguniondetails.h
+ src/dialogs/dialoguniondetails.h \
+ src/dialogs/dialogcutarc.h
SOURCES += \
src/dialogs/dialogtriangle.cpp \
@@ -45,7 +46,8 @@ SOURCES += \
src/dialogs/dialogalongline.cpp \
src/dialogs/dialogcutspline.cpp \
src/dialogs/dialogcutsplinepath.cpp \
- src/dialogs/dialoguniondetails.cpp
+ src/dialogs/dialoguniondetails.cpp \
+ src/dialogs/dialogcutarc.cpp
FORMS += \
src/dialogs/dialogtriangle.ui \
@@ -68,4 +70,5 @@ FORMS += \
src/dialogs/dialogalongline.ui \
src/dialogs/dialogcutspline.ui \
src/dialogs/dialogcutsplinepath.ui \
- src/dialogs/dialoguniondetails.ui
+ src/dialogs/dialoguniondetails.ui \
+ src/dialogs/dialogcutarc.ui
diff --git a/src/dialogs/dialogtool.cpp b/src/dialogs/dialogtool.cpp
index 219dc2b29..f8e94c850 100644
--- a/src/dialogs/dialogtool.cpp
+++ b/src/dialogs/dialogtool.cpp
@@ -85,6 +85,43 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
FillList(box, list);
}
+void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutArc cut) const
+{
+ Q_ASSERT(box != 0);
+ const QHash *objs = data->DataGObjects();
+ QHashIterator i(*objs);
+ QMap list;
+ while (i.hasNext())
+ {
+ i.next();
+ if (cut == ComboMode::CutArc)
+ {
+ if (i.key() != id + 1 && i.key() != id + 2)
+ {
+ VGObject *obj = i.value();
+ if (obj->getType() == GObject::Arc && obj->getMode() == Draw::Calculation)
+ {
+ const VArc *arc = data->GeometricObject(i.key());
+ list[arc->name()] = i.key();
+ }
+ }
+ }
+ else
+ {
+ if (i.key() != id)
+ {
+ VGObject *obj = i.value();
+ if (obj->getType() == GObject::Arc && obj->getMode() == Draw::Calculation)
+ {
+ const VArc *arc = data->GeometricObject(i.key());
+ list[arc->name()] = i.key();
+ }
+ }
+ }
+ }
+ FillList(box, list);
+}
+
void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
{
Q_ASSERT(box != 0);
@@ -301,6 +338,15 @@ void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint
ChangeCurrentData(box, value);
}
+void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &value, const qint64 &id,
+ ComboMode::ComboBoxCutArc cut) const
+{
+ Q_ASSERT(box != 0);
+ FillComboBoxArcs(box, id, cut);
+ arcId = value;
+ ChangeCurrentData(box, value);
+}
+
void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value,
const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
{
diff --git a/src/dialogs/dialogtool.h b/src/dialogs/dialogtool.h
index ae8e7ac70..13192dbf3 100644
--- a/src/dialogs/dialogtool.h
+++ b/src/dialogs/dialogtool.h
@@ -44,8 +44,12 @@ namespace ComboMode
*/
enum ComboBoxCutSpline { CutSpline, NoCutSpline };
Q_DECLARE_FLAGS(ComboBoxCutSplines, ComboBoxCutSpline)
+
+ enum ComboBoxCutArc { CutArc, NoCutArc};
+ Q_DECLARE_FLAGS(ComboBoxCutArcs, ComboBoxCutArc)
}
Q_DECLARE_OPERATORS_FOR_FLAGS( ComboMode::ComboBoxCutSplines )
+Q_DECLARE_OPERATORS_FOR_FLAGS( ComboMode::ComboBoxCutArcs )
/**
* @brief The DialogTool class parent for all dialog of tools.
@@ -267,6 +271,8 @@ protected:
* @param id don't show this id in list
*/
void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const;
+ void FillComboBoxArcs(QComboBox *box, const qint64 &id = 0,
+ ComboMode::ComboBoxCutArc cut = ComboMode::NoCutArc)const;
/**
* @brief FillComboBoxSplines fill comboBox list of splines
* @param box comboBox
@@ -353,6 +359,8 @@ protected:
*/
void setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id,
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
+ void setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &value, const qint64 &id,
+ ComboMode::ComboBoxCutArc cut = ComboMode::NoCutArc) const;
/**
* @brief setCurrentSplinePathId set current splinePath id in combobox
* @param box combobox
diff --git a/src/geometry/varc.cpp b/src/geometry/varc.cpp
index 4613c243a..d4264272f 100644
--- a/src/geometry/varc.cpp
+++ b/src/geometry/varc.cpp
@@ -43,7 +43,6 @@ VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QStri
: VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2),
radius(radius), formulaRadius(formulaRadius), center(center)
{
- //TODO Change name of arc in formula. Name now not unique.
_name = QString ("Arc_%1").arg(this->GetCenter().name());
}
@@ -190,3 +189,35 @@ QVector VArc::SplOfArc(qint32 number) const
}
return QVector();
}
+
+QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const
+{
+ //Always need return two arcs, so we must correct wrong length.
+ qreal len = 0;
+ if (length < this->GetLength()*0.02)
+ {
+ len = this->GetLength()*0.02;
+ }
+ else if ( length > this->GetLength()*0.98)
+ {
+ len = this->GetLength()*0.98;
+ }
+ else
+ {
+ len = length;
+ qDebug()< SplOfArc( qint32 number ) const;
virtual QString name() const{return _name;}
+ QPointF CutArc (const qreal &length, VArc &arc1, VArc &arc2) const;
private:
/**
* @brief f1 початковий кут в градусах
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 768f1fc16..defe5b6af 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -58,7 +58,7 @@ MainWindow::MainWindow(QWidget *parent)
dialogTriangle(QSharedPointer()),
dialogPointOfIntersection(QSharedPointer()),
dialogCutSpline(QSharedPointer()), dialogCutSplinePath (QSharedPointer()),
- dialogUnionDetails(QSharedPointer()),
+ dialogUnionDetails(QSharedPointer()), dialogCutArc(QSharedPointer()),
dialogHistory(0), comboBoxDraws(0), fileName(QString()), changeInFile(false),
mode(Draw::Calculation), currentDrawIndex(0)
{
@@ -122,6 +122,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline);
connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath);
connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails);
+ connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc);
pattern = new VContainer();
@@ -522,6 +523,17 @@ void MainWindow::ToolUnionDetails(bool checked)
disconnect(doc, &VDomDocument::FullUpdateFromFile, dialogUnionDetails.data(), &DialogUnionDetails::UpdateList);
}
+void MainWindow::ToolCutArc(bool checked)
+{
+ SetToolButton(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png",
+ tr("Select arc"), dialogCutArc, &MainWindow::ClosedDialogCutArc);
+}
+
+void MainWindow::ClosedDialogCutArc(int result)
+{
+ ClosedDialog(dialogCutArc, result);
+}
+
void MainWindow::ClosedDialogUnionDetails(int result)
{
ClosedDialog(dialogUnionDetails, result);
@@ -824,6 +836,12 @@ void MainWindow::CanselTool()
currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection();
break;
+ case Tool::CutArcTool:
+ dialogCutArc.clear();
+ ui->toolButtonArcCutPoint->setChecked(false);
+ currentScene->setFocus(Qt::OtherFocusReason);
+ currentScene->clearSelection();
+ break;
default:
qWarning()<<"Got wrong tool type. Ignored.";
break;
@@ -877,9 +895,9 @@ void MainWindow::ActionDraw(bool checked)
verScrollBar = view->verticalScrollBar();
verScrollBar->setValue(currentScene->getVerScrollBar());
+ mode = Draw::Calculation;
comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace
- mode = Draw::Calculation;
SetEnableTool(true);
doc->setCurrentData();
ui->toolBox->setCurrentIndex(0);
@@ -1139,6 +1157,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonPointOfIntersection->setEnabled(drawTools);
ui->toolButtonSplineCutPoint->setEnabled(drawTools);
ui->toolButtonSplinePathCutPoint->setEnabled(drawTools);
+ ui->toolButtonArcCutPoint->setEnabled(drawTools);
//Modeling Tools
ui->toolButtonUnionDetails->setEnabled(modelingTools);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index c29236a4d..e02b7d056 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -234,6 +234,7 @@ public slots:
*/
void ToolPointOfIntersection(bool checked);
void ToolUnionDetails(bool checked);
+ void ToolCutArc(bool checked);
/**
* @brief ClosedDialogEndLine
* @param result
@@ -320,6 +321,7 @@ public slots:
* @param result result of working of dialog
*/
void ClosedDialogCutSpline(int result);
+ void ClosedDialogCutArc(int result);
/**
* @brief About
*/
@@ -486,6 +488,7 @@ private:
* @brief dialogUnionDetails
*/
QSharedPointer dialogUnionDetails;
+ QSharedPointer dialogCutArc;
/**
* @brief dialogHistory
*/
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 360f0a388..ee1fb6206 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -40,14 +40,14 @@
- 4
+ 3
0
0
- 144
+ 150
150
@@ -302,7 +302,7 @@
0
0
- 100
+ 150
58
@@ -378,7 +378,7 @@
0
0
- 100
+ 150
104
@@ -549,6 +549,29 @@
+ -
+
+
+ false
+
+
+ ...
+
+
+
+ :/icon/32x32/arc_cut.png:/icon/32x32/arc_cut.png
+
+
+
+ 32
+ 32
+
+
+
+ true
+
+
+
diff --git a/src/options.h b/src/options.h
index 4f1edecdf..c70e4c195 100644
--- a/src/options.h
+++ b/src/options.h
@@ -66,6 +66,7 @@ namespace Tool
LineIntersectTool,
SplineTool,
CutSplineTool,
+ CutArcTool,
ArcTool,
SplinePathTool,
CutSplinePathTool,
diff --git a/src/tools/drawTools/drawtools.h b/src/tools/drawTools/drawtools.h
index d67adda4d..f3dc544bc 100644
--- a/src/tools/drawTools/drawtools.h
+++ b/src/tools/drawTools/drawtools.h
@@ -46,5 +46,6 @@
#include "vtoolpointofintersection.h"
#include "vtoolcutspline.h"
#include "vtoolcutsplinepath.h"
+#include "vtoolcutarc.h"
#endif // DRAWTOOLS_H
diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp
index 33dc27096..9169fd6ad 100644
--- a/src/tools/drawTools/vtoolarc.cpp
+++ b/src/tools/drawTools/vtoolarc.cpp
@@ -111,17 +111,16 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad
if (typeCreation == Tool::FromGui)
{
id = data->AddGObject(arc);
- data->AddLengthArc(arc->name(), toMM(arc->GetLength()));
}
else
{
data->UpdateGObject(id, arc);
- data->AddLengthArc(arc->name(), toMM(arc->GetLength()));
if (parse != Document::FullParse)
{
doc->UpdateToolData(id, data);
}
}
+ data->AddLengthArc(id);
VDrawTool::AddRecord(id, Tool::ArcTool, doc);
if (parse == Document::FullParse)
{
diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp
new file mode 100644
index 000000000..7b3afb47a
--- /dev/null
+++ b/src/tools/drawTools/vtoolcutarc.cpp
@@ -0,0 +1,269 @@
+/************************************************************************
+ **
+ ** @file vtoolcutarc.cpp
+ ** @author Roman Telezhinsky
+ ** @date 7 1, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "vtoolcutarc.h"
+#include "../../container/calculator.h"
+
+const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
+const QString VToolCutArc::AttrArc = QStringLiteral("arc");
+
+VToolCutArc::VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
+ const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id,
+ const Tool::Sources &typeCreation, QGraphicsItem * parent)
+ :VToolPoint(doc, data, id, parent), formula(formula), arcId(arcId),
+ dialogCutArc(QSharedPointer()), firstArc(), secondArc(), arc1id(arc1id), arc2id(arc2id)
+{
+ Q_ASSERT_X(arcId > 0, Q_FUNC_INFO, "arcId <= 0");
+ Q_ASSERT_X(arc1id > 0, Q_FUNC_INFO, "arc1id <= 0");
+ Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0");
+
+ firstArc = new VSimpleArc(arc1id, ¤tColor, &factor);
+ Q_ASSERT(firstArc != 0);
+ RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint);
+ firstArc->setParentItem(this);
+ connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
+
+ secondArc = new VSimpleArc(arc2id, ¤tColor, &factor);
+ Q_ASSERT(secondArc != 0);
+ RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint);
+ secondArc->setParentItem(this);
+ connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed);
+
+ if (typeCreation == Tool::FromGui)
+ {
+ AddToFile();
+ }
+ else
+ {
+ RefreshDataInFile();
+ }
+}
+
+void VToolCutArc::setDialog()
+{
+ Q_ASSERT(dialogCutArc.isNull() == false);
+ const VPointF *point = VAbstractTool::data.GeometricObject(id);
+ dialogCutArc->setFormula(formula);
+ dialogCutArc->setArcId(arcId, id);
+ dialogCutArc->setPointName(point->name());
+}
+
+void VToolCutArc::Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
+ VContainer *data)
+{
+ QString pointName = dialog->getPointName();
+ QString formula = dialog->getFormula();
+ qint64 arcId = dialog->getArcId();
+ Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui);
+}
+
+void VToolCutArc::Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId,
+ const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
+ VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation)
+{
+ const VArc *arc = data->GeometricObject(arcId);
+ Calculator cal(data);
+ QString errorMsg;
+ qreal result = cal.eval(formula, &errorMsg);
+ if (errorMsg.isEmpty())
+ {
+ VArc arc1;
+ VArc arc2;
+ QPointF point = arc->CutArc(toPixel(result), arc1, arc2);
+
+ qint64 id = _id;
+ qint64 arc1id = 0;
+ qint64 arc2id = 0;
+ if (typeCreation == Tool::FromGui)
+ {
+ VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
+ Q_ASSERT(p != 0);
+ id = data->AddGObject(p);
+
+ VArc * ar1 = new VArc(arc1);
+ Q_ASSERT(ar1 != 0);
+ arc1id = data->AddGObject(ar1);
+
+ VArc * ar2 = new VArc(arc2);
+ Q_ASSERT(ar2 != 0);
+ arc2id = data->AddGObject(ar2);
+ }
+ else
+ {
+ VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my);
+ Q_ASSERT(p != 0);
+ data->UpdateGObject(id, p);
+
+ arc1id = id + 1;
+ arc2id = id + 2;
+
+ VArc * ar1 = new VArc(arc1);
+ Q_ASSERT(ar1 != 0);
+ data->UpdateGObject(arc1id, ar1);
+
+ VArc * ar2 = new VArc(arc2);
+ Q_ASSERT(ar2 != 0);
+ data->UpdateGObject(arc2id, ar2);
+
+ if (parse != Document::FullParse)
+ {
+ doc->UpdateToolData(id, data);
+ }
+ }
+ data->AddLengthArc(arc1id);
+ data->AddLengthArc(arc2id);
+
+ VDrawTool::AddRecord(id, Tool::CutArcTool, doc);
+ if (parse == Document::FullParse)
+ {
+ VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, typeCreation);
+ scene->addItem(point);
+ connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
+ connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor);
+ doc->AddTool(id, point);
+ doc->AddTool(arc1id, point);
+ doc->AddTool(arc2id, point);
+ doc->IncrementReferens(arcId);
+ }
+ }
+}
+
+void VToolCutArc::FullUpdateFromFile()
+{
+ QDomElement domElement = doc->elementById(QString().setNum(id));
+ if (domElement.isElement())
+ {
+ formula = domElement.attribute(AttrLength, "");
+ arcId = domElement.attribute(AttrArc, "").toLongLong();
+ }
+ RefreshGeometry();
+}
+
+void VToolCutArc::FullUpdateFromGui(int result)
+{
+ if (result == QDialog::Accepted)
+ {
+ QDomElement domElement = doc->elementById(QString().setNum(id));
+ if (domElement.isElement())
+ {
+ domElement.setAttribute(AttrName, dialogCutArc->getPointName());
+ domElement.setAttribute(AttrLength, dialogCutArc->getFormula());
+ domElement.setAttribute(AttrArc, QString().setNum(dialogCutArc->getArcId()));
+ emit FullUpdateTree();
+ }
+ }
+ dialogCutArc.clear();
+}
+
+void VToolCutArc::ArcChoosed(qint64 id)
+{
+ emit ChoosedTool(id, Scene::Arc);
+}
+
+void VToolCutArc::ChangedActivDraw(const QString &newName)
+{
+ if (nameActivDraw == newName)
+ {
+ currentColor = Qt::black;
+ firstArc->setFlag(QGraphicsItem::ItemIsSelectable, true);
+ firstArc->setAcceptHoverEvents(true);
+ secondArc->setFlag(QGraphicsItem::ItemIsSelectable, true);
+ secondArc->setAcceptHoverEvents(true);
+ }
+ else
+ {
+ currentColor = Qt::gray;
+ firstArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
+ firstArc->setAcceptHoverEvents(false);
+ secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
+ secondArc->setAcceptHoverEvents(false);
+ }
+ firstArc->setPen(QPen(currentColor, widthHairLine/factor));
+ secondArc->setPen(QPen(currentColor, widthHairLine/factor));
+ VToolPoint::ChangedActivDraw(newName);
+}
+
+void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
+{
+ ContextMenu(dialogCutArc, this, event);
+}
+
+void VToolCutArc::AddToFile()
+{
+ const VPointF *point = VAbstractTool::data.GeometricObject(id);
+ QDomElement domElement = doc->createElement(TagName);
+
+ AddAttribute(domElement, AttrId, id);
+ AddAttribute(domElement, AttrType, ToolType);
+ AddAttribute(domElement, AttrName, point->name());
+ AddAttribute(domElement, AttrMx, toMM(point->mx()));
+ AddAttribute(domElement, AttrMy, toMM(point->my()));
+
+ AddAttribute(domElement, AttrLength, formula);
+ AddAttribute(domElement, AttrArc, arcId);
+
+ AddToCalculation(domElement);
+}
+
+void VToolCutArc::RefreshDataInFile()
+{
+ const VPointF *point = VAbstractTool::data.GeometricObject(id);
+ QDomElement domElement = doc->elementById(QString().setNum(id));
+ if (domElement.isElement())
+ {
+ domElement.setAttribute(AttrName, point->name());
+ domElement.setAttribute(AttrMx, toMM(point->mx()));
+ domElement.setAttribute(AttrMy, toMM(point->my()));
+ domElement.setAttribute(AttrLength, formula);
+ domElement.setAttribute(AttrArc, arcId);
+ }
+}
+
+void VToolCutArc::RefreshGeometry()
+{
+ RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint);
+ RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint);
+ VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id));
+}
+
+void VToolCutArc::RefreshArc(VSimpleArc *sArc, qint64 arcid, SimpleArc::Translation tr)
+{
+ const VArc *arc = VAbstractTool::data.GeometricObject(arcid);
+ QPainterPath path;
+ path.addPath(arc->GetPath());
+ path.setFillRule( Qt::WindingFill );
+ if (tr == SimpleArc::FirstPoint)
+ {
+ path.translate(-arc->GetP1().x(), -arc->GetP1().y());
+ }
+ else
+ {
+ path.translate(-arc->GetP2().x(), -arc->GetP2().y());
+ }
+ sArc->setPath(path);
+}
diff --git a/src/tools/drawTools/vtoolcutarc.h b/src/tools/drawTools/vtoolcutarc.h
new file mode 100644
index 000000000..06c98660e
--- /dev/null
+++ b/src/tools/drawTools/vtoolcutarc.h
@@ -0,0 +1,122 @@
+/************************************************************************
+ **
+ ** @file vtoolcutarc.h
+ ** @author Roman Telezhinsky
+ ** @date 7 1, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef VTOOLCUTARC_H
+#define VTOOLCUTARC_H
+
+#include "vtoolpoint.h"
+#include "../../dialogs/dialogcutarc.h"
+#include "../../widgets/vsimplearc.h"
+
+class VToolCutArc : public VToolPoint
+{
+ Q_OBJECT
+public:
+ VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula,
+ const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id,
+ const Tool::Sources &typeCreation, QGraphicsItem * parent = 0);
+ /**
+ * @brief setDialog
+ */
+ virtual void setDialog();
+ static void Create(QSharedPointer &dialog, VMainGraphicsScene *scene, VDomDocument *doc,
+ VContainer *data);
+ static void Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId,
+ const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc,
+ VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation);
+ /**
+ * @brief ToolType
+ */
+ static const QString ToolType;
+ static const QString AttrArc;
+public slots:
+ /**
+ * @brief FullUpdateFromFile
+ */
+ virtual void FullUpdateFromFile();
+ /**
+ * @brief FullUpdateFromGui
+ * @param result
+ */
+ virtual void FullUpdateFromGui(int result);
+ /**
+ * @brief ArcChoosed
+ * @param id
+ */
+ void ArcChoosed(qint64 id);
+ /**
+ * @brief ChangedActivDraw
+ * @param newName
+ */
+ virtual void ChangedActivDraw(const QString &newName);
+protected:
+ /**
+ * @brief contextMenuEvent
+ * @param event
+ */
+ virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
+ /**
+ * @brief AddToFile
+ */
+ virtual void AddToFile();
+ /**
+ * @brief RefreshDataInFile refresh attributes in file. If attributes don't exist create them.
+ */
+ virtual void RefreshDataInFile();
+ /**
+ * @brief RefreshGeometry
+ */
+ void RefreshGeometry();
+private:
+ Q_DISABLE_COPY(VToolCutArc)
+ /**
+ * @brief formula keep formula of length
+ */
+ QString formula;
+ /**
+ * @brief arcId keep id of arc
+ */
+ qint64 arcId;
+ /**
+ * @brief DialogCutSpline pointer to the tool's dialog
+ */
+ QSharedPointer dialogCutArc;
+ /**
+ * @brief firstArc
+ */
+ VSimpleArc *firstArc;
+ /**
+ * @brief secondArc
+ */
+ VSimpleArc *secondArc;
+ const qint64 arc1id;
+ const qint64 arc2id;
+ void RefreshArc(VSimpleArc *sArc, qint64 arcid, SimpleArc::Translation tr);
+};
+
+#endif // VTOOLCUTARC_H
diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp
index 1a2f63f59..509a426d8 100644
--- a/src/tools/nodeDetails/vnodepoint.cpp
+++ b/src/tools/nodeDetails/vnodepoint.cpp
@@ -65,7 +65,7 @@ void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 i
VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
if (parse == Document::FullParse)
{
- //TODO Need create garbage collector and remove all nodes, that we don't use.
+ //TODO Need create garbage collector and remove all nodes, what we don't use.
//Better check garbage before each saving file. Check only modeling tags.
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
Q_ASSERT(point != 0);
diff --git a/src/tools/tools.pri b/src/tools/tools.pri
index 50763e12f..578923b13 100644
--- a/src/tools/tools.pri
+++ b/src/tools/tools.pri
@@ -30,7 +30,8 @@ HEADERS += \
src/tools/nodeDetails/nodedetails.h \
src/tools/drawTools/vtoolcutspline.h \
src/tools/drawTools/vtoolcutsplinepath.h \
- src/tools/vtooluniondetails.h
+ src/tools/vtooluniondetails.h \
+ src/tools/drawTools/vtoolcutarc.h
SOURCES += \
src/tools/vtooldetail.cpp \
@@ -61,4 +62,5 @@ SOURCES += \
src/tools/nodeDetails/vabstractnode.cpp \
src/tools/drawTools/vtoolcutspline.cpp \
src/tools/drawTools/vtoolcutsplinepath.cpp \
- src/tools/vtooluniondetails.cpp
+ src/tools/vtooluniondetails.cpp \
+ src/tools/drawTools/vtoolcutarc.cpp
diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp
index c1962cf85..f94ecbbc8 100644
--- a/src/tools/vtooluniondetails.cpp
+++ b/src/tools/vtooluniondetails.cpp
@@ -318,6 +318,10 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
Q_ASSERT(path != 0);
path->setMode(Draw::Modeling);
const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId());
+ Q_ASSERT(splinePath != 0);
+ qDebug()<Count();
+ qDebug()<Count(); ++i)
{
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
@@ -330,6 +334,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
angle);
++idCount;
data->UpdateGObject(idDetail+idCount, p1);
+ qDebug()<GeometricObject(pRotate)->toQPointF(),
@@ -345,6 +350,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
angle);
++idCount;
data->UpdateGObject(idDetail+idCount, p4);
+ qDebug()<append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle1(),
splinePath->at(i).KAsm1()));
}
+
++idCount;
data->UpdateGObject(idDetail+idCount, path);
+ qDebug()<
+ ** @date 7 1, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#include "vsimplearc.h"
+
+VSimpleArc::VSimpleArc(qint64 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent)
+:QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor)
+{
+ if (factor == 0)
+ {
+ setPen(QPen(Qt::black, widthHairLine));
+ }
+ else
+ {
+ setPen(QPen(Qt::black, widthHairLine/ *factor));
+ }
+ setFlag(QGraphicsItem::ItemIsSelectable, true);
+ setAcceptHoverEvents(true);
+}
+
+void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (event->button() == Qt::LeftButton)
+ {
+ emit Choosed(id);
+ }
+ QGraphicsItem::mouseReleaseEvent(event);
+}
+
+void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event);
+ if (factor == 0)
+ {
+ this->setPen(QPen(*currentColor, widthMainLine));
+ }
+ else
+ {
+ this->setPen(QPen(*currentColor, widthMainLine/ *factor));
+ }
+}
+
+void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
+{
+ Q_UNUSED(event);
+ if (factor == 0)
+ {
+ this->setPen(QPen(*currentColor, widthHairLine));
+ }
+ else
+ {
+ this->setPen(QPen(*currentColor, widthHairLine/ *factor));
+ }
+}
diff --git a/src/widgets/vsimplearc.h b/src/widgets/vsimplearc.h
new file mode 100644
index 000000000..5b84fc102
--- /dev/null
+++ b/src/widgets/vsimplearc.h
@@ -0,0 +1,87 @@
+/************************************************************************
+ **
+ ** @file vsimplearc.h
+ ** @author Roman Telezhinsky
+ ** @date 7 1, 2014
+ **
+ ** @brief
+ ** @copyright
+ ** This source code is part of the Valentine project, a pattern making
+ ** program, whose allow create and modeling patterns of clothing.
+ ** Copyright (C) 2013 Valentina project
+ ** All Rights Reserved.
+ **
+ ** Valentina is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** Valentina is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with Valentina. If not, see .
+ **
+ *************************************************************************/
+
+#ifndef VSIMPLEARC_H
+#define VSIMPLEARC_H
+
+#include
+
+namespace SimpleArc
+{
+ /**
+ * @brief The Translation enum
+ */
+ enum Translation { FirstPoint, ForthPoint };
+ Q_DECLARE_FLAGS(Translations, Translation)
+}
+Q_DECLARE_OPERATORS_FOR_FLAGS( SimpleArc::Translations )
+
+class VSimpleArc : public QObject, public QGraphicsPathItem
+{
+ Q_OBJECT
+public:
+ VSimpleArc(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0);
+signals:
+ /**
+ * @brief Choosed
+ * @param id
+ */
+ void Choosed(qint64 id);
+protected:
+ /**
+ * @brief mouseReleaseEvent
+ * @param event
+ */
+ virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
+ /**
+ * @brief hoverMoveEvent
+ * @param event
+ */
+ virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
+ /**
+ * @brief hoverLeaveEvent
+ * @param event
+ */
+ virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
+private:
+ Q_DISABLE_COPY(VSimpleArc)
+ /**
+ * @brief id
+ */
+ qint64 id;
+ /**
+ * @brief factor
+ */
+ qreal *factor;
+ /**
+ * @brief currentColor
+ */
+ Qt::GlobalColor *currentColor;
+};
+
+#endif // VSIMPLEARC_H
diff --git a/src/widgets/widgets.pri b/src/widgets/widgets.pri
index b4f16cf86..3de616910 100644
--- a/src/widgets/widgets.pri
+++ b/src/widgets/widgets.pri
@@ -8,7 +8,8 @@ HEADERS += \
src/widgets/vapplication.h \
src/widgets/doubledelegate.h \
src/widgets/vsimplespline.h \
- src/widgets/vsimplesplinepath.h
+ src/widgets/vsimplesplinepath.h \
+ src/widgets/vsimplearc.h
SOURCES += \
src/widgets/vtablegraphicsview.cpp \
@@ -20,4 +21,5 @@ SOURCES += \
src/widgets/vapplication.cpp \
src/widgets/doubledelegate.cpp \
src/widgets/vsimplespline.cpp \
- src/widgets/vsimplesplinepath.cpp
+ src/widgets/vsimplesplinepath.cpp \
+ src/widgets/vsimplearc.cpp