Merge with feature
--HG-- branch : develop
This commit is contained in:
commit
36cb8b293d
|
@ -71,7 +71,7 @@ CONFIG(debug, debug|release){
|
||||||
-isystem "/usr/include/qt5/QtXml" -isystem "/usr/include/qt5/QtGui" \
|
-isystem "/usr/include/qt5/QtXml" -isystem "/usr/include/qt5/QtGui" \
|
||||||
-isystem "/usr/include/qt5/QtCore" -isystem "$${UI_DIR}" -isystem "$${MOC_DIR}" \
|
-isystem "/usr/include/qt5/QtCore" -isystem "$${UI_DIR}" -isystem "$${MOC_DIR}" \
|
||||||
-isystem "$${RCC_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 \
|
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \
|
||||||
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
|
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
|
||||||
-Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k \
|
-Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k \
|
||||||
|
|
|
@ -18,5 +18,6 @@
|
||||||
<file>cursor/spline_cut_point_cursor.png</file>
|
<file>cursor/spline_cut_point_cursor.png</file>
|
||||||
<file>cursor/splinepath_cut_point_cursor.png</file>
|
<file>cursor/splinepath_cut_point_cursor.png</file>
|
||||||
<file>cursor/union_cursor.png</file>
|
<file>cursor/union_cursor.png</file>
|
||||||
|
<file>cursor/arc_cut_cursor.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
share/resources/cursor/arc_cut_cursor.png
Normal file
BIN
share/resources/cursor/arc_cut_cursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -40,5 +40,6 @@
|
||||||
<file>icon/32x32/spline_cut_point.png</file>
|
<file>icon/32x32/spline_cut_point.png</file>
|
||||||
<file>icon/32x32/splinePath_cut_point.png</file>
|
<file>icon/32x32/splinePath_cut_point.png</file>
|
||||||
<file>icon/32x32/union.png</file>
|
<file>icon/32x32/union.png</file>
|
||||||
|
<file>icon/32x32/arc_cut.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
share/resources/icon/32x32/arc_cut.png
Normal file
BIN
share/resources/icon/32x32/arc_cut.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 513 B |
|
@ -609,13 +609,8 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value)
|
||||||
void VContainer::AddLengthArc(const qint64 &id)
|
void VContainer::AddLengthArc(const qint64 &id)
|
||||||
{
|
{
|
||||||
const VArc * arc = GeometricObject<const VArc *>(id);
|
const VArc * arc = GeometricObject<const VArc *>(id);
|
||||||
AddLengthArc(arc->name(), toMM(arc->GetLength()));
|
QString name = QString("%1_%2").arg(arc->name()).arg(id);
|
||||||
}
|
lengthArcs[name] = toMM(arc->GetLength());
|
||||||
|
|
||||||
void VContainer::AddLengthArc(const QString &name, const qreal &value)
|
|
||||||
{
|
|
||||||
Q_ASSERT(name.isEmpty() == false);
|
|
||||||
lengthArcs[name] = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VContainer::AddLineAngle(const QString &name, const qreal &value)
|
void VContainer::AddLineAngle(const QString &name, const qreal &value)
|
||||||
|
|
|
@ -185,12 +185,6 @@ public:
|
||||||
* @param id id of arc
|
* @param id id of arc
|
||||||
*/
|
*/
|
||||||
void AddLengthArc(const qint64 &id);
|
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
|
* @brief AddLineAngle add angle of line to container
|
||||||
* @param name name of line angle
|
* @param name name of line angle
|
||||||
|
|
114
src/dialogs/dialogcutarc.cpp
Normal file
114
src/dialogs/dialogcutarc.cpp
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogcutarc.cpp
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @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
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#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<const VArc *>(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);
|
||||||
|
}
|
||||||
|
|
69
src/dialogs/dialogcutarc.h
Normal file
69
src/dialogs/dialogcutarc.h
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialogcutarc.h
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @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
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#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
|
360
src/dialogs/dialogcutarc.ui
Normal file
360
src/dialogs/dialogcutarc.ui
Normal file
|
@ -0,0 +1,360 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogCutArc</class>
|
||||||
|
<widget class="QDialog" name="DialogCutArc">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>507</width>
|
||||||
|
<height>375</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditFormula">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditFormula">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Formula for the calculation of the spline</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonPutHere">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/putHere.png</normaloff>:/icon/24x24/putHere.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonEqual">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Calculate value</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/24x24/equal.png</normaloff>:/icon/24x24/equal.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelResultCalculation">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>87</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Value of length</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Arc</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxArc">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Selected curve</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditNamePoint">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>255</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="WindowText">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>159</red>
|
||||||
|
<green>158</green>
|
||||||
|
<blue>158</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Point label</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Input data</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonSizeGrowth">
|
||||||
|
<property name="text">
|
||||||
|
<string>Size and height</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonStandartTable">
|
||||||
|
<property name="text">
|
||||||
|
<string>Standard table</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonIncrements">
|
||||||
|
<property name="text">
|
||||||
|
<string>Increments</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthLine">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of lines</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthArc">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of arcs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonLengthSpline">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Length of curves</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Variables - Click twice to insert into formula</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelDescription">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>DialogCutArc</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>DialogCutArc</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -154,6 +154,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Detail</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "../tools/vabstracttool.h"
|
#include "../tools/vabstracttool.h"
|
||||||
#include "../tools/drawTools/vtoolcutspline.h"
|
#include "../tools/drawTools/vtoolcutspline.h"
|
||||||
#include "../tools/drawTools/vtoolcutsplinepath.h"
|
#include "../tools/drawTools/vtoolcutsplinepath.h"
|
||||||
|
#include "../tools/drawTools/vtoolcutarc.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
@ -363,6 +364,20 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
||||||
firstPointIdName, secondPointIdName);
|
firstPointIdName, secondPointIdName);
|
||||||
break;
|
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<const VArc *>(arcId);
|
||||||
|
QString arcCenterName = data->GeometricObject<const VArc *>(arc->GetCenter().id())->name();
|
||||||
|
QString toolIdName = data->GeometricObject<const VPointF *>(tool.getId())->name();
|
||||||
|
record = QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Tool::CutSplineTool:
|
case Tool::CutSplineTool:
|
||||||
{
|
{
|
||||||
qint64 splineId = 0;
|
qint64 splineId = 0;
|
||||||
|
|
|
@ -21,7 +21,8 @@ HEADERS += \
|
||||||
src/dialogs/dialogalongline.h \
|
src/dialogs/dialogalongline.h \
|
||||||
src/dialogs/dialogcutspline.h \
|
src/dialogs/dialogcutspline.h \
|
||||||
src/dialogs/dialogcutsplinepath.h \
|
src/dialogs/dialogcutsplinepath.h \
|
||||||
src/dialogs/dialoguniondetails.h
|
src/dialogs/dialoguniondetails.h \
|
||||||
|
src/dialogs/dialogcutarc.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/dialogs/dialogtriangle.cpp \
|
src/dialogs/dialogtriangle.cpp \
|
||||||
|
@ -45,7 +46,8 @@ SOURCES += \
|
||||||
src/dialogs/dialogalongline.cpp \
|
src/dialogs/dialogalongline.cpp \
|
||||||
src/dialogs/dialogcutspline.cpp \
|
src/dialogs/dialogcutspline.cpp \
|
||||||
src/dialogs/dialogcutsplinepath.cpp \
|
src/dialogs/dialogcutsplinepath.cpp \
|
||||||
src/dialogs/dialoguniondetails.cpp
|
src/dialogs/dialoguniondetails.cpp \
|
||||||
|
src/dialogs/dialogcutarc.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
src/dialogs/dialogtriangle.ui \
|
src/dialogs/dialogtriangle.ui \
|
||||||
|
@ -68,4 +70,5 @@ FORMS += \
|
||||||
src/dialogs/dialogalongline.ui \
|
src/dialogs/dialogalongline.ui \
|
||||||
src/dialogs/dialogcutspline.ui \
|
src/dialogs/dialogcutspline.ui \
|
||||||
src/dialogs/dialogcutsplinepath.ui \
|
src/dialogs/dialogcutsplinepath.ui \
|
||||||
src/dialogs/dialoguniondetails.ui
|
src/dialogs/dialoguniondetails.ui \
|
||||||
|
src/dialogs/dialogcutarc.ui
|
||||||
|
|
|
@ -85,6 +85,43 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const
|
||||||
FillList(box, list);
|
FillList(box, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutArc cut) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(box != 0);
|
||||||
|
const QHash<qint64, VGObject *> *objs = data->DataGObjects();
|
||||||
|
QHashIterator<qint64, VGObject*> i(*objs);
|
||||||
|
QMap<QString, qint64> 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<const VArc *>(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<const VArc *>(i.key());
|
||||||
|
list[arc->name()] = i.key();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FillList(box, list);
|
||||||
|
}
|
||||||
|
|
||||||
void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(box != 0);
|
Q_ASSERT(box != 0);
|
||||||
|
@ -301,6 +338,15 @@ void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint
|
||||||
ChangeCurrentData(box, value);
|
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,
|
void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value,
|
||||||
const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
const qint64 &id, ComboMode::ComboBoxCutSpline cut) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,8 +44,12 @@ namespace ComboMode
|
||||||
*/
|
*/
|
||||||
enum ComboBoxCutSpline { CutSpline, NoCutSpline };
|
enum ComboBoxCutSpline { CutSpline, NoCutSpline };
|
||||||
Q_DECLARE_FLAGS(ComboBoxCutSplines, ComboBoxCutSpline)
|
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::ComboBoxCutSplines )
|
||||||
|
Q_DECLARE_OPERATORS_FOR_FLAGS( ComboMode::ComboBoxCutArcs )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The DialogTool class parent for all dialog of tools.
|
* @brief The DialogTool class parent for all dialog of tools.
|
||||||
|
@ -267,6 +271,8 @@ protected:
|
||||||
* @param id don't show this id in list
|
* @param id don't show this id in list
|
||||||
*/
|
*/
|
||||||
void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const;
|
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
|
* @brief FillComboBoxSplines fill comboBox list of splines
|
||||||
* @param box comboBox
|
* @param box comboBox
|
||||||
|
@ -353,6 +359,8 @@ protected:
|
||||||
*/
|
*/
|
||||||
void setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id,
|
void setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id,
|
||||||
ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const;
|
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
|
* @brief setCurrentSplinePathId set current splinePath id in combobox
|
||||||
* @param box combobox
|
* @param box combobox
|
||||||
|
|
|
@ -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),
|
: VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2),
|
||||||
radius(radius), formulaRadius(formulaRadius), center(center)
|
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());
|
_name = QString ("Arc_%1").arg(this->GetCenter().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,3 +189,35 @@ QVector<QPointF> VArc::SplOfArc(qint32 number) const
|
||||||
}
|
}
|
||||||
return QVector<QPointF>();
|
return QVector<QPointF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()<<len;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal n = (len*180)/(M_PI*radius);
|
||||||
|
qDebug()<<n;
|
||||||
|
QLineF line(GetCenter().toQPointF(), GetP1());
|
||||||
|
line.setAngle(line.angle()+n);
|
||||||
|
QPointF point = line.p2();
|
||||||
|
|
||||||
|
arc1 = VArc (center, radius, formulaRadius, f1, formulaF1, line.angle(), QString().setNum(line.angle()),
|
||||||
|
idObject, mode);
|
||||||
|
|
||||||
|
arc2 = VArc (center, radius, formulaRadius, line.angle(), QString().setNum(line.angle()), f2, formulaF2,
|
||||||
|
idObject, mode);
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
|
@ -145,6 +145,7 @@ public:
|
||||||
*/
|
*/
|
||||||
QVector<QPointF> SplOfArc( qint32 number ) const;
|
QVector<QPointF> SplOfArc( qint32 number ) const;
|
||||||
virtual QString name() const{return _name;}
|
virtual QString name() const{return _name;}
|
||||||
|
QPointF CutArc (const qreal &length, VArc &arc1, VArc &arc2) const;
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief f1 початковий кут в градусах
|
* @brief f1 початковий кут в градусах
|
||||||
|
|
|
@ -30,12 +30,13 @@
|
||||||
#include "../exception/vexception.h"
|
#include "../exception/vexception.h"
|
||||||
|
|
||||||
VSplinePath::VSplinePath(qreal kCurve, qint64 idObject, Draw::Draws mode)
|
VSplinePath::VSplinePath(qreal kCurve, qint64 idObject, Draw::Draws mode)
|
||||||
: VGObject(GObject::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve)
|
: VGObject(GObject::SplinePath, idObject, mode), path(QVector<VSplinePoint>()), kCurve(kCurve), maxCountPoints(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
VSplinePath::VSplinePath(const VSplinePath &splPath)
|
VSplinePath::VSplinePath(const VSplinePath &splPath)
|
||||||
: VGObject(splPath), path(*splPath.GetPoint()), kCurve(splPath.getKCurve())
|
: VGObject(splPath), path(*splPath.GetPoint()), kCurve(splPath.getKCurve()),
|
||||||
|
maxCountPoints(splPath.getMaxCountPoints())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +159,7 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path)
|
||||||
VGObject::operator=(path);
|
VGObject::operator=(path);
|
||||||
this->path = path.GetSplinePath();
|
this->path = path.GetSplinePath();
|
||||||
this->kCurve = path.getKCurve();
|
this->kCurve = path.getKCurve();
|
||||||
|
this->maxCountPoints = path.getMaxCountPoints();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,3 +207,13 @@ QPointF VSplinePath::CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF
|
||||||
}
|
}
|
||||||
return QPointF();
|
return QPointF();
|
||||||
}
|
}
|
||||||
|
qint32 VSplinePath::getMaxCountPoints() const
|
||||||
|
{
|
||||||
|
return maxCountPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VSplinePath::setMaxCountPoints(const qint32 &value)
|
||||||
|
{
|
||||||
|
maxCountPoints = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,9 @@ public:
|
||||||
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2,
|
QPointF CutSplinePath(qreal length, qint32 &p1, qint32 &p2, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2,
|
||||||
QPointF &spl2p3) const;
|
QPointF &spl2p3) const;
|
||||||
virtual QString name() const{return _name;}
|
virtual QString name() const{return _name;}
|
||||||
|
qint32 getMaxCountPoints() const;
|
||||||
|
void setMaxCountPoints(const qint32 &value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief path вектор з точок сплайна.
|
* @brief path вектор з точок сплайна.
|
||||||
|
@ -170,6 +173,7 @@ protected:
|
||||||
* @brief kCurve
|
* @brief kCurve
|
||||||
*/
|
*/
|
||||||
qreal kCurve;
|
qreal kCurve;
|
||||||
|
qint32 maxCountPoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VSPLINEPATH_H
|
#endif // VSPLINEPATH_H
|
||||||
|
|
|
@ -58,9 +58,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
dialogTriangle(QSharedPointer<DialogTriangle>()),
|
dialogTriangle(QSharedPointer<DialogTriangle>()),
|
||||||
dialogPointOfIntersection(QSharedPointer<DialogPointOfIntersection>()),
|
dialogPointOfIntersection(QSharedPointer<DialogPointOfIntersection>()),
|
||||||
dialogCutSpline(QSharedPointer<DialogCutSpline>()), dialogCutSplinePath (QSharedPointer<DialogCutSplinePath>()),
|
dialogCutSpline(QSharedPointer<DialogCutSpline>()), dialogCutSplinePath (QSharedPointer<DialogCutSplinePath>()),
|
||||||
dialogUnionDetails(QSharedPointer<DialogUnionDetails>()),
|
dialogUnionDetails(QSharedPointer<DialogUnionDetails>()), dialogCutArc(QSharedPointer<DialogCutArc>()),
|
||||||
dialogHistory(0), comboBoxDraws(0), fileName(QString()), changeInFile(false),
|
dialogHistory(0), comboBoxDraws(0), fileName(QString()), changeInFile(false),
|
||||||
mode(Draw::Calculation), currentDrawIndex(0)
|
mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
||||||
|
@ -122,6 +122,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline);
|
connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline);
|
||||||
connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath);
|
connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath);
|
||||||
connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails);
|
connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails);
|
||||||
|
connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc);
|
||||||
|
|
||||||
pattern = new VContainer();
|
pattern = new VContainer();
|
||||||
|
|
||||||
|
@ -522,6 +523,17 @@ void MainWindow::ToolUnionDetails(bool checked)
|
||||||
disconnect(doc, &VDomDocument::FullUpdateFromFile, dialogUnionDetails.data(), &DialogUnionDetails::UpdateList);
|
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<VToolCutArc>(dialogCutArc, result);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::ClosedDialogUnionDetails(int result)
|
void MainWindow::ClosedDialogUnionDetails(int result)
|
||||||
{
|
{
|
||||||
ClosedDialog<VToolUnionDetails>(dialogUnionDetails, result);
|
ClosedDialog<VToolUnionDetails>(dialogUnionDetails, result);
|
||||||
|
@ -824,6 +836,12 @@ void MainWindow::CanselTool()
|
||||||
currentScene->setFocus(Qt::OtherFocusReason);
|
currentScene->setFocus(Qt::OtherFocusReason);
|
||||||
currentScene->clearSelection();
|
currentScene->clearSelection();
|
||||||
break;
|
break;
|
||||||
|
case Tool::CutArcTool:
|
||||||
|
dialogCutArc.clear();
|
||||||
|
ui->toolButtonArcCutPoint->setChecked(false);
|
||||||
|
currentScene->setFocus(Qt::OtherFocusReason);
|
||||||
|
currentScene->clearSelection();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Got wrong tool type. Ignored.";
|
qWarning()<<"Got wrong tool type. Ignored.";
|
||||||
break;
|
break;
|
||||||
|
@ -877,12 +895,12 @@ void MainWindow::ActionDraw(bool checked)
|
||||||
verScrollBar = view->verticalScrollBar();
|
verScrollBar = view->verticalScrollBar();
|
||||||
verScrollBar->setValue(currentScene->getVerScrollBar());
|
verScrollBar->setValue(currentScene->getVerScrollBar());
|
||||||
|
|
||||||
|
mode = Draw::Calculation;
|
||||||
comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace
|
comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace
|
||||||
|
|
||||||
mode = Draw::Calculation;
|
|
||||||
SetEnableTool(true);
|
SetEnableTool(true);
|
||||||
doc->setCurrentData();
|
doc->setCurrentData();
|
||||||
ui->toolBox->setCurrentIndex(0);
|
ui->toolBox->setCurrentIndex(currentToolBoxIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -914,6 +932,7 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
|
|
||||||
mode = Draw::Modeling;
|
mode = Draw::Modeling;
|
||||||
SetEnableTool(true);
|
SetEnableTool(true);
|
||||||
|
currentToolBoxIndex = ui->toolBox->currentIndex();
|
||||||
ui->toolBox->setCurrentIndex(4);
|
ui->toolBox->setCurrentIndex(4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1139,6 +1158,7 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
ui->toolButtonPointOfIntersection->setEnabled(drawTools);
|
ui->toolButtonPointOfIntersection->setEnabled(drawTools);
|
||||||
ui->toolButtonSplineCutPoint->setEnabled(drawTools);
|
ui->toolButtonSplineCutPoint->setEnabled(drawTools);
|
||||||
ui->toolButtonSplinePathCutPoint->setEnabled(drawTools);
|
ui->toolButtonSplinePathCutPoint->setEnabled(drawTools);
|
||||||
|
ui->toolButtonArcCutPoint->setEnabled(drawTools);
|
||||||
|
|
||||||
//Modeling Tools
|
//Modeling Tools
|
||||||
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
||||||
|
|
|
@ -234,6 +234,7 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void ToolPointOfIntersection(bool checked);
|
void ToolPointOfIntersection(bool checked);
|
||||||
void ToolUnionDetails(bool checked);
|
void ToolUnionDetails(bool checked);
|
||||||
|
void ToolCutArc(bool checked);
|
||||||
/**
|
/**
|
||||||
* @brief ClosedDialogEndLine
|
* @brief ClosedDialogEndLine
|
||||||
* @param result
|
* @param result
|
||||||
|
@ -320,6 +321,7 @@ public slots:
|
||||||
* @param result result of working of dialog
|
* @param result result of working of dialog
|
||||||
*/
|
*/
|
||||||
void ClosedDialogCutSpline(int result);
|
void ClosedDialogCutSpline(int result);
|
||||||
|
void ClosedDialogCutArc(int result);
|
||||||
/**
|
/**
|
||||||
* @brief About
|
* @brief About
|
||||||
*/
|
*/
|
||||||
|
@ -486,6 +488,7 @@ private:
|
||||||
* @brief dialogUnionDetails
|
* @brief dialogUnionDetails
|
||||||
*/
|
*/
|
||||||
QSharedPointer<DialogUnionDetails> dialogUnionDetails;
|
QSharedPointer<DialogUnionDetails> dialogUnionDetails;
|
||||||
|
QSharedPointer<DialogCutArc> dialogCutArc;
|
||||||
/**
|
/**
|
||||||
* @brief dialogHistory
|
* @brief dialogHistory
|
||||||
*/
|
*/
|
||||||
|
@ -507,6 +510,7 @@ private:
|
||||||
*/
|
*/
|
||||||
Draw::Draws mode;
|
Draw::Draws mode;
|
||||||
qint32 currentDrawIndex;
|
qint32 currentDrawIndex;
|
||||||
|
qint32 currentToolBoxIndex;
|
||||||
/**
|
/**
|
||||||
* @brief ToolBarOption
|
* @brief ToolBarOption
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,14 +40,14 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>144</width>
|
<width>150</width>
|
||||||
<height>150</height>
|
<height>150</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -302,7 +302,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>150</width>
|
||||||
<height>58</height>
|
<height>58</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>150</width>
|
||||||
<height>104</height>
|
<height>104</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -549,6 +549,29 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QToolButton" name="toolButtonArcCutPoint">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/arc_cut.png</normaloff>:/icon/32x32/arc_cut.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="page_5">
|
<widget class="QWidget" name="page_5">
|
||||||
|
|
|
@ -66,6 +66,7 @@ namespace Tool
|
||||||
LineIntersectTool,
|
LineIntersectTool,
|
||||||
SplineTool,
|
SplineTool,
|
||||||
CutSplineTool,
|
CutSplineTool,
|
||||||
|
CutArcTool,
|
||||||
ArcTool,
|
ArcTool,
|
||||||
SplinePathTool,
|
SplinePathTool,
|
||||||
CutSplinePathTool,
|
CutSplinePathTool,
|
||||||
|
|
|
@ -46,5 +46,6 @@
|
||||||
#include "vtoolpointofintersection.h"
|
#include "vtoolpointofintersection.h"
|
||||||
#include "vtoolcutspline.h"
|
#include "vtoolcutspline.h"
|
||||||
#include "vtoolcutsplinepath.h"
|
#include "vtoolcutsplinepath.h"
|
||||||
|
#include "vtoolcutarc.h"
|
||||||
|
|
||||||
#endif // DRAWTOOLS_H
|
#endif // DRAWTOOLS_H
|
||||||
|
|
|
@ -111,17 +111,16 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad
|
||||||
if (typeCreation == Tool::FromGui)
|
if (typeCreation == Tool::FromGui)
|
||||||
{
|
{
|
||||||
id = data->AddGObject(arc);
|
id = data->AddGObject(arc);
|
||||||
data->AddLengthArc(arc->name(), toMM(arc->GetLength()));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data->UpdateGObject(id, arc);
|
data->UpdateGObject(id, arc);
|
||||||
data->AddLengthArc(arc->name(), toMM(arc->GetLength()));
|
|
||||||
if (parse != Document::FullParse)
|
if (parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
doc->UpdateToolData(id, data);
|
doc->UpdateToolData(id, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data->AddLengthArc(id);
|
||||||
VDrawTool::AddRecord(id, Tool::ArcTool, doc);
|
VDrawTool::AddRecord(id, Tool::ArcTool, doc);
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
|
|
269
src/tools/drawTools/vtoolcutarc.cpp
Normal file
269
src/tools/drawTools/vtoolcutarc.cpp
Normal file
|
@ -0,0 +1,269 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vtoolcutarc.cpp
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @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
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#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<DialogCutArc>()), 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<const VPointF *>(id);
|
||||||
|
dialogCutArc->setFormula(formula);
|
||||||
|
dialogCutArc->setArcId(arcId, id);
|
||||||
|
dialogCutArc->setPointName(point->name());
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutArc::Create(QSharedPointer<DialogCutArc> &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<const VArc *>(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<const VPointF *>(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<const VPointF *>(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<const VPointF *>(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolCutArc::RefreshArc(VSimpleArc *sArc, qint64 arcid, SimpleArc::Translation tr)
|
||||||
|
{
|
||||||
|
const VArc *arc = VAbstractTool::data.GeometricObject<const VArc *>(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);
|
||||||
|
}
|
122
src/tools/drawTools/vtoolcutarc.h
Normal file
122
src/tools/drawTools/vtoolcutarc.h
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vtoolcutarc.h
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @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
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#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<DialogCutArc> &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> 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
|
|
@ -252,6 +252,11 @@ void VToolCutSpline::RefreshGeometry()
|
||||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VToolCutSpline::RemoveReferens()
|
||||||
|
{
|
||||||
|
doc->DecrementReferens(splineId);
|
||||||
|
}
|
||||||
|
|
||||||
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr)
|
void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr)
|
||||||
{
|
{
|
||||||
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid);
|
const VSpline *spl = VAbstractTool::data.GeometricObject<const VSpline *>(splid);
|
||||||
|
|
|
@ -126,7 +126,8 @@ protected:
|
||||||
/**
|
/**
|
||||||
* @brief RefreshGeometry
|
* @brief RefreshGeometry
|
||||||
*/
|
*/
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
|
virtual void RemoveReferens();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSpline)
|
Q_DISABLE_COPY(VToolCutSpline)
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -147,6 +147,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splPath1->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
splPath2->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
|
||||||
splPath1id = data->AddGObject(splPath1);
|
splPath1id = data->AddGObject(splPath1);
|
||||||
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
||||||
|
|
||||||
|
@ -198,6 +201,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splPath1->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
splPath2->setMaxCountPoints(splPath->CountPoint());
|
||||||
|
|
||||||
data->UpdateGObject(splPath1id, splPath1);
|
data->UpdateGObject(splPath1id, splPath1);
|
||||||
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength()));
|
||||||
|
|
||||||
|
@ -323,6 +329,11 @@ void VToolCutSplinePath::RefreshGeometry()
|
||||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<const VPointF *>(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VToolCutSplinePath::RemoveReferens()
|
||||||
|
{
|
||||||
|
doc->DecrementReferens(splinePathId);
|
||||||
|
}
|
||||||
|
|
||||||
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr)
|
void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr)
|
||||||
{
|
{
|
||||||
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid);
|
const VSplinePath *splPath = VAbstractTool::data.GeometricObject<const VSplinePath *>(splPathid);
|
||||||
|
|
|
@ -116,7 +116,8 @@ protected:
|
||||||
/**
|
/**
|
||||||
* @brief RefreshGeometry
|
* @brief RefreshGeometry
|
||||||
*/
|
*/
|
||||||
void RefreshGeometry();
|
void RefreshGeometry();
|
||||||
|
virtual void RemoveReferens();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCutSplinePath)
|
Q_DISABLE_COPY(VToolCutSplinePath)
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,7 +65,7 @@ void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 i
|
||||||
VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
|
VAbstractTool::AddRecord(id, Tool::NodePoint, doc);
|
||||||
if (parse == Document::FullParse)
|
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.
|
//Better check garbage before each saving file. Check only modeling tags.
|
||||||
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent);
|
||||||
Q_ASSERT(point != 0);
|
Q_ASSERT(point != 0);
|
||||||
|
|
|
@ -30,7 +30,8 @@ HEADERS += \
|
||||||
src/tools/nodeDetails/nodedetails.h \
|
src/tools/nodeDetails/nodedetails.h \
|
||||||
src/tools/drawTools/vtoolcutspline.h \
|
src/tools/drawTools/vtoolcutspline.h \
|
||||||
src/tools/drawTools/vtoolcutsplinepath.h \
|
src/tools/drawTools/vtoolcutsplinepath.h \
|
||||||
src/tools/vtooluniondetails.h
|
src/tools/vtooluniondetails.h \
|
||||||
|
src/tools/drawTools/vtoolcutarc.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/tools/vtooldetail.cpp \
|
src/tools/vtooldetail.cpp \
|
||||||
|
@ -61,4 +62,5 @@ SOURCES += \
|
||||||
src/tools/nodeDetails/vabstractnode.cpp \
|
src/tools/nodeDetails/vabstractnode.cpp \
|
||||||
src/tools/drawTools/vtoolcutspline.cpp \
|
src/tools/drawTools/vtoolcutspline.cpp \
|
||||||
src/tools/drawTools/vtoolcutsplinepath.cpp \
|
src/tools/drawTools/vtoolcutsplinepath.cpp \
|
||||||
src/tools/vtooluniondetails.cpp
|
src/tools/vtooluniondetails.cpp \
|
||||||
|
src/tools/drawTools/vtoolcutarc.cpp
|
||||||
|
|
|
@ -174,6 +174,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
Q_ASSERT(path != 0);
|
Q_ASSERT(path != 0);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
|
qint32 k = splinePath->getMaxCountPoints();
|
||||||
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
||||||
|
@ -185,6 +186,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p1, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
qint64 idP1 = data->AddGObject(p1);
|
qint64 idP1 = data->AddGObject(p1);
|
||||||
|
--k;
|
||||||
|
|
||||||
VPointF p2 = VPointF(spline.GetP2());
|
VPointF p2 = VPointF(spline.GetP2());
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
|
@ -199,6 +201,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(p4, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
angle);
|
angle);
|
||||||
qint64 idP4 = data->AddGObject(p4);
|
qint64 idP4 = data->AddGObject(p4);
|
||||||
|
--k;
|
||||||
|
|
||||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
||||||
if (i==1)
|
if (i==1)
|
||||||
|
@ -209,6 +212,11 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VDomDocument *doc, VContai
|
||||||
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle1(),
|
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle1(),
|
||||||
splinePath->at(i).KAsm1()));
|
splinePath->at(i).KAsm1()));
|
||||||
}
|
}
|
||||||
|
while(k>=0)
|
||||||
|
{
|
||||||
|
data->getNextId();
|
||||||
|
--k;
|
||||||
|
}
|
||||||
idObject = data->AddGObject(path);
|
idObject = data->AddGObject(path);
|
||||||
|
|
||||||
VSplinePath *path1 = new VSplinePath(*path);
|
VSplinePath *path1 = new VSplinePath(*path);
|
||||||
|
@ -318,6 +326,8 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
Q_ASSERT(path != 0);
|
Q_ASSERT(path != 0);
|
||||||
path->setMode(Draw::Modeling);
|
path->setMode(Draw::Modeling);
|
||||||
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
const VSplinePath *splinePath = data->GeometricObject<const VSplinePath *>(det.at(i).getId());
|
||||||
|
Q_ASSERT(splinePath != 0);
|
||||||
|
qint32 k = splinePath->getMaxCountPoints();
|
||||||
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
for (qint32 i = 1; i <= splinePath->Count(); ++i)
|
||||||
{
|
{
|
||||||
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
VSpline spline(splinePath->at(i-1).P(), splinePath->at(i).P(),
|
||||||
|
@ -330,6 +340,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p1);
|
data->UpdateGObject(idDetail+idCount, p1);
|
||||||
|
--k;
|
||||||
|
|
||||||
VPointF p2 = VPointF(spline.GetP2());
|
VPointF p2 = VPointF(spline.GetP2());
|
||||||
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
BiasRotatePoint(&p2, dx, dy, data->GeometricObject<const VPointF *>(pRotate)->toQPointF(),
|
||||||
|
@ -345,6 +356,7 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
angle);
|
angle);
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, p4);
|
data->UpdateGObject(idDetail+idCount, p4);
|
||||||
|
--k;
|
||||||
|
|
||||||
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve());
|
||||||
if (i==1)
|
if (i==1)
|
||||||
|
@ -355,6 +367,14 @@ void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, c
|
||||||
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle1(),
|
path->append(VSplinePoint(*p4, splinePath->at(i).KAsm1(), spl.GetAngle1(),
|
||||||
splinePath->at(i).KAsm1()));
|
splinePath->at(i).KAsm1()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while(k>=0)
|
||||||
|
{
|
||||||
|
data->getNextId();
|
||||||
|
--k;
|
||||||
|
++idCount;
|
||||||
|
}
|
||||||
|
|
||||||
++idCount;
|
++idCount;
|
||||||
data->UpdateGObject(idDetail+idCount, path);
|
data->UpdateGObject(idDetail+idCount, path);
|
||||||
|
|
||||||
|
|
79
src/widgets/vsimplearc.cpp
Normal file
79
src/widgets/vsimplearc.cpp
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vsimplearc.cpp
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @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
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#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));
|
||||||
|
}
|
||||||
|
}
|
87
src/widgets/vsimplearc.h
Normal file
87
src/widgets/vsimplearc.h
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vsimplearc.h
|
||||||
|
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||||
|
** @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
|
||||||
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef VSIMPLEARC_H
|
||||||
|
#define VSIMPLEARC_H
|
||||||
|
|
||||||
|
#include <QGraphicsPathItem>
|
||||||
|
|
||||||
|
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
|
|
@ -8,7 +8,8 @@ HEADERS += \
|
||||||
src/widgets/vapplication.h \
|
src/widgets/vapplication.h \
|
||||||
src/widgets/doubledelegate.h \
|
src/widgets/doubledelegate.h \
|
||||||
src/widgets/vsimplespline.h \
|
src/widgets/vsimplespline.h \
|
||||||
src/widgets/vsimplesplinepath.h
|
src/widgets/vsimplesplinepath.h \
|
||||||
|
src/widgets/vsimplearc.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/widgets/vtablegraphicsview.cpp \
|
src/widgets/vtablegraphicsview.cpp \
|
||||||
|
@ -20,4 +21,5 @@ SOURCES += \
|
||||||
src/widgets/vapplication.cpp \
|
src/widgets/vapplication.cpp \
|
||||||
src/widgets/doubledelegate.cpp \
|
src/widgets/doubledelegate.cpp \
|
||||||
src/widgets/vsimplespline.cpp \
|
src/widgets/vsimplespline.cpp \
|
||||||
src/widgets/vsimplesplinepath.cpp
|
src/widgets/vsimplesplinepath.cpp \
|
||||||
|
src/widgets/vsimplearc.cpp
|
||||||
|
|
|
@ -1037,6 +1037,27 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
throw excep;
|
throw excep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type == VToolCutArc::ToolType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
qint64 id = GetParametrId(domElement);
|
||||||
|
QString name = GetParametrString(domElement, VAbstractTool::AttrName, "");
|
||||||
|
qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0"));
|
||||||
|
qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0"));
|
||||||
|
QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0");
|
||||||
|
qint64 arcId = GetParametrLongLong(domElement, VToolCutArc::AttrArc, "0");
|
||||||
|
|
||||||
|
VToolCutArc::Create(id, name, formula, arcId, mx, my, scene, this, data, parse, Tool::FromFile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
VExceptionObjectError excep(tr("Error creating or updating cut arc point"), domElement);
|
||||||
|
excep.AddMoreInformation(e.ErrorMessage());
|
||||||
|
throw excep;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user