Add tool arc

This commit is contained in:
dismine 2013-08-06 10:56:09 +03:00
parent 45856338f9
commit 30ec4ed2f2
27 changed files with 1161 additions and 483 deletions

View File

@ -48,7 +48,9 @@ SOURCES += main.cpp\
geometry/varc.cpp \
widgets/vcontrolpointspline.cpp \
tools/vtoolspline.cpp \
dialogs/dialogspline.cpp
dialogs/dialogspline.cpp \
tools/vtoolarc.cpp \
dialogs/dialogarc.cpp
HEADERS += mainwindow.h \
widgets/vmaingraphicsscene.h \
@ -87,7 +89,9 @@ HEADERS += mainwindow.h \
geometry/varc.h \
widgets/vcontrolpointspline.h \
tools/vtoolspline.h \
dialogs/dialogspline.h
dialogs/dialogspline.h \
tools/vtoolarc.h \
dialogs/dialogarc.h
FORMS += mainwindow.ui \
dialogs/dialogsinglepoint.ui \
@ -99,7 +103,8 @@ FORMS += mainwindow.ui \
dialogs/dialognormal.ui \
dialogs/dialogbisector.ui \
dialogs/dialoglineintersect.ui \
dialogs/dialogspline.ui
dialogs/dialogspline.ui \
dialogs/dialogarc.ui
RESOURCES += \
icon.qrc \

View File

@ -120,6 +120,7 @@ void VContainer::Clear(){
splines.clear();
arcs.clear();
lengthArcs.clear();
lineArcs.clear();
}
void VContainer::ClearIncrementTable(){
@ -138,6 +139,10 @@ void VContainer::ClearLengthArcs(){
lengthArcs.clear();
}
void VContainer::ClearLineArcs(){
lineArcs.clear();
}
void VContainer::SetSize(qint32 size){
base["Сг"] = size;
}
@ -176,6 +181,14 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const{
*ok = true;
return lengthLines.value(name);
}
if(lengthArcs.contains(name)){
*ok = true;
return lengthArcs.value(name);
}
if(lineArcs.contains(name)){
*ok = true;
return lineArcs.value(name);
}
*ok = false;
return 0;
}
@ -237,23 +250,26 @@ QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPo
return QString("Line_%1_%2").arg(first.name(), second.name());
}
QString VContainer::GetNameLineArc(const qint64 &firstPoint, const qint64 &secondPoint) const{
VPointF first = GetPoint(firstPoint);
VPointF second = GetPoint(secondPoint);
return QString("ArcLine_%1_%2").arg(first.name(), second.name());
}
QString VContainer::GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint) const{
VPointF first = GetPoint(firstPoint);
VPointF second = GetPoint(secondPoint);
return QString("Spl_%1_%2").arg(first.name(), second.name());
}
QString VContainer::GetNameArc(const qint64 &firstPoint, const qint64 &centerPoint,
const qint64 &secondPoint) const{
VPointF first = GetPoint(firstPoint);
VPointF center = GetPoint(centerPoint);
VPointF second = GetPoint(secondPoint);
return QString("Arc_%1_%2_%3").arg(first.name(), center.name(), second.name());
QString VContainer::GetNameArc(const qint64 &center, const qint64 &id) const{
VPointF centerPoint = GetPoint(center);
return QString ("Arc(%1)%2").arg(centerPoint.name(), id);
}
void VContainer::AddLengthLine(const QString &name, const qreal &value){
Q_ASSERT(!name.isEmpty());
lengthLines[name] = value/PrintDPI*25.4;
lengthLines[name] = value;
}
void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId){
@ -265,20 +281,21 @@ void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secon
void VContainer::AddLengthSpline(const QString &name, const qreal &value){
Q_ASSERT(!name.isEmpty());
lengthSplines[name] = value/PrintDPI*25.4;
lengthSplines[name] = value;
}
void VContainer::AddLengthArc(const qint64 &firstPointId, const qint64 &centerPoint,
const qint64 &secondPointId){
QString nameLine = GetNameArc(firstPointId, centerPoint, secondPointId);
VPointF firstPoint = GetPoint(firstPointId);
VPointF secondPoint = GetPoint(secondPointId);
AddLengthArc(nameLine, QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()).length());
void VContainer::AddLengthArc(const qint64 &center, const qint64 &id){
AddLengthArc(GetNameArc(center, id), GetArc(id).GetLength());
}
void VContainer::AddLengthArc(const QString &name, const qreal &value){
Q_ASSERT(!name.isEmpty());
lengthArcs[name] = value/PrintDPI*25.4;
lengthArcs[name] = value;
}
void VContainer::AddLineArc(const QString &name, const qint32 &value){
Q_ASSERT(!name.isEmpty());
lineArcs[name] = value;
}
qreal VContainer::GetLine(const QString &name) const{
@ -287,7 +304,18 @@ qreal VContainer::GetLine(const QString &name) const{
return lengthLines.value(name);
} else {
qCritical()<<"Не можу знайти лінію за імям = "<<name<<" в таблиці.";
throw"Не можу знайти лінію таблиці.";
throw"Не можу знайти лінію в таблиці.";
}
return 0;
}
qint32 VContainer::GetLineArc(const QString &name) const{
Q_ASSERT(!name.isEmpty());
if(lineArcs.contains(name)){
return lineArcs.value(name);
} else {
qCritical()<<"Не можу знайти кут за імям = "<<name<<" в таблиці.";
throw"Не можу знайти кут в таблиці.";
}
return 0;
}
@ -316,3 +344,7 @@ VArc VContainer::GetArc(qint64 id) const{
const QMap<QString, qreal> *VContainer::DataLengthArcs() const{
return &lengthArcs;
}
const QMap<QString, qreal> *VContainer::DataLineArcs() const{
return &lineArcs;
}

View File

@ -28,6 +28,7 @@ public:
VStandartTableCell GetStandartTableCell(const QString& name) const;
VIncrementTableRow GetIncrementTableRow(const QString& name) const;
qreal GetLine(const QString &name) const;
qint32 GetLineArc(const QString &name) const;
VSpline GetSpline(qint64 id) const;
VArc GetArc(qint64 id) const;
qint64 getId();
@ -37,15 +38,16 @@ public:
void AddLengthLine(const QString &name, const qreal &value);
void AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId);
void AddLengthSpline(const QString &name, const qreal &value);
void AddLengthArc(const qint64 &firstPointId, const qint64 &centerPoint, const qint64 &secondPointId);
void AddLengthArc(const qint64 &center, const qint64 &id);
void AddLengthArc(const QString &name, const qreal &value);
void AddLineArc(const QString &name, const qint32 &value);
void AddLine(const qint64 &firstPointId, const qint64 &secondPointId);
qint64 AddSpline(const VSpline& spl);
qint64 AddArc(const VArc& arc);
QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const;
QString GetNameLineArc(const qint64 &firstPoint, const qint64 &secondPoint) const;
QString GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint) const;
QString GetNameArc(const qint64 &firstPoint, const qint64 &centerPoint,
const qint64 &secondPoint) const;
QString GetNameArc(const qint64 &center, const qint64 &id) const;
void UpdatePoint(qint64 id, const VPointF& point);
void UpdateSpline(qint64 id, const VSpline& spl);
void UpdateArc(qint64 id, const VArc& arc);
@ -58,6 +60,7 @@ public:
void ClearLengthLines();
void ClearLengthSplines();
void ClearLengthArcs();
void ClearLineArcs();
void SetSize(qint32 size);
void SetGrowth(qint32 growth);
qint32 size() const;
@ -75,6 +78,7 @@ public:
const QMap<QString, qreal> *DataLengthLines() const;
const QMap<QString, qreal> *DataLengthSplines() const;
const QMap<QString, qreal> *DataLengthArcs() const;
const QMap<QString, qreal> *DataLineArcs() const;
private:
qint64 _id;
QMap<QString, qint32> base;
@ -82,6 +86,7 @@ private:
QMap<QString, VStandartTableCell> standartTable;
QMap<QString, VIncrementTableRow> incrementTable;
QMap<QString, qreal> lengthLines;
QMap<QString, qreal> lineArcs;
QMap<qint64, VSpline> splines;
QMap<QString, qreal> lengthSplines;
QMap<qint64, VArc> arcs;

View File

@ -9,5 +9,6 @@
<file>cursor/bisector_cursor.png</file>
<file>cursor/intersect_cursor.png</file>
<file>cursor/spline_cursor.png</file>
<file>cursor/arc_cursor.png</file>
</qresource>
</RCC>

BIN
cursor/arc_cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -29,7 +29,7 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) :
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogAlongLine::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogAlongLine::ValChenged);
ShowBase();
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogAlongLine::SizeGrowth);
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogAlongLine::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogAlongLine::Increments);

189
dialogs/dialogarc.cpp Normal file
View File

@ -0,0 +1,189 @@
#include "dialogarc.h"
#include "ui_dialogarc.h"
#include "../container/calculator.h"
DialogArc::DialogArc(const VContainer *data, QWidget *parent) :
DialogTool(data, parent), ui(new Ui::DialogArc)
{
ui->setupUi(this);
flagRadius = false;
flagF1 = false;
flagF2 = false;
timerRadius = new QTimer(this);
connect(timerRadius, &QTimer::timeout, this, &DialogArc::EvalRadius);
timerF1 = new QTimer(this);
connect(timerF1, &QTimer::timeout, this, &DialogArc::EvalF1);
timerF2 = new QTimer(this);
connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF2);
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogArc::DialogAccepted);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(bCansel, &QPushButton::clicked, this, &DialogArc::DialogRejected);
FillComboBoxPoints(ui->comboBoxBasePoint);
CheckState();
listWidget = ui->listWidget;
labelDescription = ui->labelDescription;
radioButtonSizeGrowth = ui->radioButtonSizeGrowth;
radioButtonStandartTable = ui->radioButtonStandartTable;
radioButtonIncrements = ui->radioButtonIncrements;
radioButtonLengthLine = ui->radioButtonLengthLine;
connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogArc::SizeGrowth);
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogArc::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments);
connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines);
connect(ui->radioButtonLineArcs, &QRadioButton::clicked, this, &DialogArc::LineArcs);
connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius);
connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1);
connect(ui->toolButtonEqualF2, &QPushButton::clicked, this, &DialogArc::EvalF2);
connect(ui->lineEditRadius, &QLineEdit::textChanged, this, &DialogArc::RadiusChanged);
connect(ui->lineEditF1, &QLineEdit::textChanged, this, &DialogArc::F1Changed);
connect(ui->lineEditF2, &QLineEdit::textChanged, this, &DialogArc::F2Changed);
}
qint64 DialogArc::GetCenter() const{
return center;
}
void DialogArc::GetCenter(const qint64 &value){
center = value;
ChangeCurrentData(ui->comboBoxBasePoint, center);
}
QString DialogArc::GetF2() const{
return f2;
}
void DialogArc::GetF2(const QString &value){
f2 = value;
ui->lineEditF2->setText(f2);
}
QString DialogArc::GetF1() const{
return f1;
}
void DialogArc::GetF1(const QString &value){
f1 = value;
ui->lineEditF1->setText(f1);
}
QString DialogArc::GetRadius() const{
return radius;
}
void DialogArc::GetRadius(const QString &value){
radius = value;
ui->lineEditRadius->setText(radius);
}
DialogArc::~DialogArc(){
delete ui;
}
void DialogArc::ChoosedObject(qint64 id, Scene::Type type){
if(type == Scene::Point){
VPointF point = data->GetPoint(id);
ChangeCurrentText(ui->comboBoxBasePoint, point.name());
this->show();
}
}
void DialogArc::DialogAccepted(){
radius = ui->lineEditRadius->text();
f1 = ui->lineEditF1->text();
f2 = ui->lineEditF2->text();
qint32 index = ui->comboBoxBasePoint->currentIndex();
center = qvariant_cast<qint64>(ui->comboBoxBasePoint->itemData(index));
emit DialogClosed(QDialog::Accepted);
}
void DialogArc::ValChenged(int row){
if(ui->listWidget->count() == 0){
return;
}
QListWidgetItem *item = ui->listWidget->item( row );
if(ui->radioButtonLineArcs->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLineArc(item->text()))
.arg("Значення кута лінії.");
ui->labelDescription->setText(desc);
return;
}
DialogTool::ValChenged(row);
}
void DialogArc::PutRadius(){
PutValHere(ui->lineEditRadius, ui->listWidget);
}
void DialogArc::PutF1(){
PutValHere(ui->lineEditF1, ui->listWidget);
}
void DialogArc::PutF2(){
PutValHere(ui->lineEditF2, ui->listWidget);
}
void DialogArc::LineArcs(){
ShowLineArcs();
}
void DialogArc::RadiusChanged(){
ValFormulaChanged(flagRadius, ui->lineEditRadius, timerRadius);
}
void DialogArc::F1Changed(){
ValFormulaChanged(flagF1, ui->lineEditF1, timerF1);
}
void DialogArc::F2Changed(){
ValFormulaChanged(flagF2, ui->lineEditF2, timerF2);
}
void DialogArc::CheckState(){
Q_CHECK_PTR(bOk);
bOk->setEnabled(flagRadius & flagF1 & flagF2);
}
void DialogArc::EvalRadius(){
Eval(ui->lineEditRadius, flagRadius, timerRadius, ui->labelResultRadius);
}
void DialogArc::EvalF1(){
Eval(ui->lineEditF1, flagF1, timerF1, ui->labelResultF1);
}
void DialogArc::EvalF2(){
Eval(ui->lineEditF2, flagF2, timerF2, ui->labelResultF2);
}
void DialogArc::ShowLineArcs(){
disconnect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
ui->listWidget->clear();
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged);
const QMap<QString, qreal> *lineArcsTable = data->DataLineArcs();
QMapIterator<QString, qreal> i(*lineArcsTable);
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());
item->setFont(QFont("Times", 12, QFont::Bold));
ui->listWidget->addItem(item);
}
ui->listWidget->setCurrentRow (0);
}

60
dialogs/dialogarc.h Normal file
View File

@ -0,0 +1,60 @@
#ifndef DIALOGARC_H
#define DIALOGARC_H
#include "dialogtool.h"
#include "../container/vcontainer.h"
namespace Ui {
class DialogArc;
}
class DialogArc : public DialogTool
{
Q_OBJECT
public:
explicit DialogArc(const VContainer *data, QWidget *parent = 0);
~DialogArc();
qint64 GetCenter() const;
void GetCenter(const qint64 &value);
QString GetRadius() const;
void GetRadius(const QString &value);
QString GetF1() const;
void GetF1(const QString &value);
QString GetF2() const;
void GetF2(const QString &value);
public slots:
virtual void ChoosedObject(qint64 id, Scene::Type type);
virtual void DialogAccepted();
virtual void ValChenged(int row);
void PutRadius();
void PutF1();
void PutF2();
void LineArcs();
void RadiusChanged();
void F1Changed();
void F2Changed();
protected:
virtual void CheckState();
private:
Ui::DialogArc *ui;
bool flagRadius;
bool flagF1;
bool flagF2;
QTimer *timerRadius;
QTimer *timerF1;
QTimer *timerF2;
qint64 center;
QString radius;
QString f1;
QString f2;
void EvalRadius();
void EvalF1();
void EvalF2();
void ShowLineArcs();
};
#endif // DIALOGARC_H

419
dialogs/dialogarc.ui Normal file
View File

@ -0,0 +1,419 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogArc</class>
<widget class="QDialog" name="DialogArc">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>501</width>
<height>448</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="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Радіус</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditRadius">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereRadius">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqualRadius">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../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="labelResultRadius">
<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="text">
<string>_</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Перший кут градус</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditF1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF1">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqualF1">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../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="labelResultF1">
<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="text">
<string>_</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Другий кут градус</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditF2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonPutHereF2">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../icon.qrc">
<normaloff>:/icon/24x24/putHereLeft.png</normaloff>:/icon/24x24/putHereLeft.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonEqualF2">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../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="labelResultF2">
<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="text">
<string>_</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Центр</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxBasePoint"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Вхідні данні</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonSizeGrowth">
<property name="text">
<string>Розмір і зріст</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonStandartTable">
<property name="text">
<string>Стандартна таблиця</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonIncrements">
<property name="text">
<string>Прибавки</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthLine">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Довжини ліній</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthArc">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Довжини дуг</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLengthSpline">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Довжини сплайнів</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonLineArcs">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Кути ліній</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QListWidget" name="listWidget"/>
</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="../icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogArc</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>DialogArc</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>

View File

@ -30,7 +30,7 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) :
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogBisector::ValChenged);
ShowBase();
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogBisector::SizeGrowth);
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogBisector::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogBisector::Increments);

View File

@ -49,7 +49,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) :
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged);
ShowBase();
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogEndLine::SizeGrowth);
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogEndLine::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEndLine::Increments);

View File

@ -47,7 +47,7 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) :
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogNormal::ValChenged);
ShowBase();
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogNormal::SizeGrowth);
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogNormal::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogNormal::Increments);

View File

@ -30,7 +30,7 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal);
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogShoulderPoint::ValChenged);
ShowBase();
ShowVariable(data->DataBase());
connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogShoulderPoint::SizeGrowth);
connect(ui->radioButtonStandartTable, &QRadioButton::clicked, this, &DialogShoulderPoint::StandartTable);
connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogShoulderPoint::Increments);

View File

@ -24,8 +24,7 @@ DialogTool::DialogTool(const VContainer *data, QWidget *parent):QDialog(parent){
radioButtonLengthLine = 0;
}
DialogTool::~DialogTool()
{
DialogTool::~DialogTool(){
}
void DialogTool::closeEvent(QCloseEvent *event){
@ -38,12 +37,9 @@ void DialogTool::showEvent(QShowEvent *event){
if( event->spontaneous() ){
return;
}
if(isInitialized){
return;
}
// do your init stuff here
isInitialized = true;//перший показ вікна вже відбувся
}
@ -71,70 +67,6 @@ QString DialogTool::GetTypeLine(const QComboBox *box) const{
}
}
void DialogTool::ShowBase(){
Q_CHECK_PTR(listWidget);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
const QMap<QString, qint32> *base = data->DataBase();
QMapIterator<QString, qint32> i(*base);
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());
item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item);
}
listWidget->setCurrentRow (0);
}
void DialogTool::ShowStandartTable(){
Q_CHECK_PTR(listWidget);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
const QMap<QString, VStandartTableCell> *standartTable = data->DataStandartTable();
QMapIterator<QString, VStandartTableCell> i(*standartTable);
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());
item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item);
}
listWidget->setCurrentRow (0);
}
void DialogTool::ShowIncrementTable(){
Q_CHECK_PTR(listWidget);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
const QMap<QString, VIncrementTableRow> *incrementTable = data->DataIncrementTable();
QMapIterator<QString, VIncrementTableRow> i(*incrementTable);
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());
item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item);
}
listWidget->setCurrentRow (0);
}
void DialogTool::ShowLengthLines(){
Q_CHECK_PTR(listWidget);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
const QMap<QString, qreal> *linesTable = data->DataLengthLines();
QMapIterator<QString, qreal> i(*linesTable);
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());
item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item);
}
listWidget->setCurrentRow (0);
}
void DialogTool::SetupTypeLine(QComboBox *box, const QString &value){
if(value == "hair"){
qint32 index = box->findText("Лінія");
@ -164,6 +96,47 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value){
}
}
void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget){
Q_CHECK_PTR(lineEdit);
Q_CHECK_PTR(listWidget);
QListWidgetItem *item = listWidget->currentItem();
QString val = item->text();
lineEdit->setText(lineEdit->text().append(val));
}
void DialogTool::ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer *timer){
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
if(edit->text().isEmpty()){
flag = false;
CheckState();
return;
}
timer->start(1000);
}
void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label){
Q_CHECK_PTR(edit);
Q_CHECK_PTR(timer);
Q_CHECK_PTR(label);
if(edit->text().isEmpty()){
flag = false;
} else {
Calculator cal(data);
QString errorMsg;
qreal result = cal.eval(edit->text(),&errorMsg);
if(!errorMsg.isEmpty()){
label->setText("Помилка.");
flag = false;
} else {
label->setText(QString().setNum(result));
flag = true;
}
}
CheckState();
timer->stop();
}
void DialogTool::CheckState(){
Q_CHECK_PTR(bOk);
bOk->setEnabled(flagFormula & flagName);
@ -199,12 +172,7 @@ void DialogTool::DialogRejected(){
void DialogTool::FormulaChanged(){
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
if(edit){
if(edit->text().isEmpty()){
flagFormula = false;
CheckState();
return;
}
timerFormula->start(1000);
ValFormulaChanged(flagFormula, edit, timerFormula);
}
}
@ -251,46 +219,27 @@ void DialogTool::ArrowRightDown(){
void DialogTool::EvalFormula(){
Q_CHECK_PTR(lineEditFormula);
Q_CHECK_PTR(labelResultCalculation);
if(lineEditFormula->text().isEmpty()){
flagFormula = false;
} else {
Calculator cal(data);
QString errorMsg;
qreal result = cal.eval(lineEditFormula->text(),&errorMsg);
if(!errorMsg.isEmpty()){
labelResultCalculation->setText("Помилка.");
flagFormula = false;
} else {
labelResultCalculation->setText(QString().setNum(result));
flagFormula = true;
}
}
CheckState();
timerFormula->stop();
Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation);
}
void DialogTool::SizeGrowth(){
ShowBase();
ShowVariable(data->DataBase());
}
void DialogTool::StandartTable(){
ShowStandartTable();
ShowVariable(data->DataStandartTable());
}
void DialogTool::LengthLines(){
ShowLengthLines();
ShowVariable(data->DataLengthLines());
}
void DialogTool::Increments(){
ShowIncrementTable();
ShowVariable(data->DataIncrementTable());
}
void DialogTool::PutHere(){
Q_CHECK_PTR(lineEditFormula);
Q_CHECK_PTR(listWidget);
QListWidgetItem *item = listWidget->currentItem();
QString val = item->text();
lineEditFormula->setText(lineEditFormula->text().append(val));
PutValHere(lineEditFormula, listWidget);
}
void DialogTool::PutVal(QListWidgetItem *item){
@ -305,6 +254,7 @@ void DialogTool::ValChenged(int row){
Q_CHECK_PTR(radioButtonSizeGrowth);
Q_CHECK_PTR(radioButtonStandartTable);
Q_CHECK_PTR(radioButtonIncrements);
Q_CHECK_PTR(radioButtonLengthLine);
if(listWidget->count() == 0){
return;
}
@ -318,23 +268,27 @@ void DialogTool::ValChenged(int row){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg("Розмір");
labelDescription->setText(desc);
}
return;
}
if(radioButtonStandartTable->isChecked()){
VStandartTableCell stable = data->GetStandartTableCell(item->text());
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandartTableCell(item->text()))
.arg(stable.GetDescription());
labelDescription->setText(desc);
return;
}
if(radioButtonIncrements->isChecked()){
VIncrementTableRow itable = data->GetIncrementTableRow(item->text());
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text()))
.arg(itable.getDescription());
labelDescription->setText(desc);
return;
}
if(radioButtonLengthLine->isChecked()){
QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetLine(item->text()))
.arg("Довжина лінії");
labelDescription->setText(desc);
return;
}
}
@ -343,12 +297,28 @@ void DialogTool::UpdateList(){
Q_CHECK_PTR(radioButtonStandartTable);
Q_CHECK_PTR(radioButtonIncrements);
if(radioButtonSizeGrowth->isChecked()){
ShowBase();
ShowVariable(data->DataBase());
}
if(radioButtonStandartTable->isChecked()){
ShowStandartTable();
ShowVariable(data->DataStandartTable());
}
if(radioButtonIncrements->isChecked()){
ShowIncrementTable();
ShowVariable(data->DataIncrementTable());
}
}
export template <class key, class val>
void DialogTool::ShowVariable(const QMap<key, val> *var){
Q_CHECK_PTR(listWidget);
disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
listWidget->clear();
connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged);
QMapIterator<key, val> i(*var);
while (i.hasNext()) {
i.next();
QListWidgetItem *item = new QListWidgetItem(i.key());
item->setFont(QFont("Times", 12, QFont::Bold));
listWidget->addItem(item);
}
listWidget->setCurrentRow (0);
}

View File

@ -42,7 +42,7 @@ public slots:
void Increments();
void PutHere();
void PutVal(QListWidgetItem * item);
void ValChenged(int row);
virtual void ValChenged(int row);
void UpdateList();
protected:
const VContainer *data;
@ -66,13 +66,13 @@ protected:
void FillComboBoxTypeLine(QComboBox *box) const;
virtual void CheckState();
QString GetTypeLine(const QComboBox *box)const;
void ShowBase();
void ShowStandartTable();
void ShowIncrementTable();
void ShowLengthLines();
template <class key, class val> void ShowVariable(const QMap<key, val> *var);
void SetupTypeLine(QComboBox *box, const QString &value);
void ChangeCurrentText(QComboBox *box, const QString &value);
void ChangeCurrentData(QComboBox *box, const qint64 &value);
void PutValHere(QLineEdit *lineEdit, QListWidget *listWidget);
void ValFormulaChanged(bool &flag, QLineEdit *edit, QTimer * timer);
void Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label);
};
#endif // DIALOGTOOL_H

View File

@ -5,36 +5,55 @@
VArc::VArc (){
f1 = 0;
formulaF1 = QString();
f2 = 0;
length = 0;
formulaF2 = QString();
radius = 0;
formulaRadius = QString();
center = 0;
p1 = QPointF( 0, 0 );
p2 = QPointF( 0, 0 );
points = 0;
}
VArc::VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, qreal f1, qreal f2 ){
VArc::VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2, QString formulaF2 ){
this->points = points;
ModifiArc( center, radius, f1, f2 );
this->f1 = f1;
this->formulaF1 = formulaF1;
this->f2 = f2;
this->formulaF2 = formulaF2;
this->radius = radius;
this->formulaRadius = formulaRadius;
this->center = center;
}
qreal VArc::GetF1 () const{
qreal VArc::GetF1() const{
return f1;
}
qreal VArc::GetF2 () const{
QString VArc::GetFormulaF1() const{
return formulaF1;
}
qreal VArc::GetF2() const{
return f2;
}
qreal VArc::GetLength () const{
return length;
QString VArc::GetFormulaF2() const{
return formulaF2;
}
qreal VArc::GetRadius () const{
qreal VArc::GetLength () const{
return M_PI * radius/180 * (f2-f1);
}
qreal VArc::GetRadius() const{
return radius;
}
QString VArc::GetFormulaRadius() const{
return formulaRadius;
}
qint64 VArc::GetCenter() const{
return center;
}
@ -50,245 +69,30 @@ QPointF VArc::GetCenterPoint() const{
}
QPointF VArc::GetP1() const{
return p1;
QPointF p1 ( GetCenterPoint().x () + radius, GetCenterPoint().y () );
QLineF centerP1(GetCenterPoint(), p1);
centerP1.setAngle(f1);
return centerP1.p2();
}
QPointF VArc::GetP2 () const{
return p2;
QPointF p2 ( GetCenterPoint().x () + radius, GetCenterPoint().y () );
QLineF centerP2(GetCenterPoint(), p2);
centerP2.setAngle(f2);
return centerP2.p2();
}
const QMap<qint64, VPointF> *VArc::GetDataPoints() const{
return points;
}
void VArc::ModifiArc (qint64 center, qreal radius, qreal f1, qreal f2 ){
this->f1 = f1;
this->f2 = f2;
this->radius = radius;
this->center = center;
QPointF p1 ( GetCenterPoint().x () + radius, GetCenterPoint().y () );
QLineF centerP1(GetCenterPoint(), p1);
centerP1.setAngle(f1);
p1 = centerP1.p2();
QPointF p2 ( GetCenterPoint().x () + radius, GetCenterPoint().y () );
QLineF centerP2(GetCenterPoint(), p2);
centerP2.setAngle(f2);
p2 = centerP2.p2();
this->p1 = p1;
this->p2 = p2;
// визначимо довжину дуги за формулою.
// МОЖЛИВО НЕ ПРАВИЛЬНО. ПОТРІБНО ПЕРЕВІРИТИ ФОРМУЛУ, ОСКІЛЬКИ КУТ ПОВЕРТАЄТЬСЯ В ГРАДУСАХ!!!!!
//qreal ang = AngleArc ( f1, f2 ) ;
qreal ang = centerP1.angleTo(centerP2);
this->length = ang * radius * M_PI/180;
//qDebug()<<"ang = "<<ang<<"length ="<<length;
}
//void VArc::BiasArc ( qreal mx, qreal my ){
// this->center = QPointF( center.x()+mx, center.y()+my );
// this->p1 = QPointF( p1.x()+mx, p1.y()+my );
// this->p2 = QPointF( p2.x()+mx, p2.y()+my );
//}
//void VArc::RotationArc (QPointF pRotate, qreal angle ){
// QLineF pRotateCenter( pRotate, center );
// pRotateCenter.setAngle( angle );
// center = pRotateCenter.p2();
// QLineF pRotateP1( pRotate, p1 );
// pRotateP1.setAngle( angle );
// p1 = pRotateP1.p2();
// QLineF pRotateP2( pRotate, p2 );
// pRotateP2.setAngle( angle );
// p2 = pRotateP2.p2();
// QLineF centerP1 ( center, p1 );
// QLineF centerP2 ( center, p2 );
// f1 = centerP1.angle();
// f2 = centerP2.angle();
//}
VSpline VArc::SplOfArc ( qint32 number ) const{
qint32 n = NumberSplOfArc ();
if( number > n ){
throw "Дуга не складається з такої кількості сплайнів.";
}
qreal f1 = GetF1 ();
qreal f2 = GetF2 ();
qint32 i;
for ( i = 0; i < n; ++i ){
if ( i == n - 1 ){
f2 = GetF2 ();
} else {
if ( f1 + 90 > 360 ){
f2 = f1 + 90 - 360;
} else {
f2 = f1 + 90;
}
}
qreal anglF1, anglF2;
if ( f1 + 90 > 360 ){
anglF1 = f1 + 90 - 360 ;
} else {
anglF1 = f1 + 90 ;
}
if ( f2 - 90 < 0 ){
anglF2 = 360 + f2 - 90 ;
} else {
anglF2 = f2 - 90 ;
}
if ( i + 1 == number ){
// return VSpline (GetDataPoints(), GetP1 (), GetP2 (), anglF1, anglF2, 1., 1., 1. );
f1 = f2;
}
}
return VSpline();
}
//void VArc::CutArc ( qreal length, VArc &arcFir, VArc &arcSec ) const{
// if ( length > GetLength () ){
// qDebug()<<"Не правильна довжина дуги/n";
// exit(-1);
// }
// qreal angle;
// angle = GetF1 () + (length * 180) / (radius * M_PI);
// arcFir.ModifiArc ( GetCenter (), GetRadius (), GetF1 (), angle );
// arcSec.ModifiArc ( GetCenter (), GetRadius (), angle, GetF2 () );
//}
//void VArc::CutArc ( QPointF point, VArc &arcFir, VArc &arcSec ) const{
// VArc arc = VArc(center,radius, f1, QLineF(center, point).angle());
// if(this->length<arc.GetLength()){
// throw"Не можу розрізати дугу. Не правильна точка.";
// } else {
// CutArc ( arc.GetLength(), arcFir, arcSec );
// }
//}
QLineF::IntersectType VArc::CrossingArcLine ( const QLineF &line, QPointF *intersectionPoint ) const{
qint32 i, n;
QLineF::IntersectType type = QLineF::NoIntersection;
n = NumberSplOfArc ();
for ( i = 0; i < n; ++i ){
VSpline curve = SplOfArc ( i + 1 );
QPointF crosPoint;
type = curve.CrossingSplLine ( line, &crosPoint );
if ( type == QLineF::BoundedIntersection ){
*intersectionPoint = crosPoint;
return type;
} else{
if ( type == QLineF::NoIntersection || type == QLineF::UnboundedIntersection ){
throw "Не можу знайти точку перетину сплайну з лінією.";
}
}
}
}
qint32 VArc::NumberSplOfArc () const{
qint32 angArc = ( qint32 ) AngleArc ( GetF1 (), GetF2 () );
switch( angArc ){
case 0:
throw "Кут дуги не може бути 0 градусів.";
break;
case 90:
return 1;
case 180:
return 2;
case 270:
return 3;
case 360:
return 4;
default :
return ( qint32 ) AngleArc ( GetF1 (), GetF2 () ) / 90 + 1;
}
}
qreal VArc::AngleArc( qreal f1, qreal f2 ) const{
QLineF normal = QLineF( 0, 0, 100, 0 );
normal.setAngle(f1);
QLineF normal2 = QLineF( 0, 0, 100, 0 );
normal2.setAngle(f2);
return normal.angleTo(normal2);
}
QPainterPath VArc::GetPath() const{
QPainterPath Path;
qint32 numberSpl = NumberSplOfArc();
for(qint32 i = 1; i <= numberSpl; ++i){
VSpline spl = SplOfArc ( i );
Path.addPath( spl.GetPath() );
}
QPointF center = GetCenterPoint();
QRectF rect(center.x()-radius, center.y()-radius, radius*2, radius*2);
Path.moveTo(GetP1());
qreal angle = QLineF(center, GetP1()).angleTo(QLineF(center, GetP2()));
Path.arcTo(rect, GetF1(), angle);
return Path;
}
QVector<QPointF> VArc::GetPoints () const{
QVector<QPointF> points;
qint32 numberSpl = NumberSplOfArc();
for(qint32 i = 1; i <= numberSpl; ++i){
VSpline spl = SplOfArc ( i );
points<<spl.GetPoints();
}
return points;
}
QPointF VArc::Tangent(const QPointF P, Tangent_e tan)const{
QLineF CP = QLineF(GetCenterPoint(),P);
CP.setLength(CP.length()/2);
QPointF O = CP.p2();
QLineF CO = QLineF(GetCenterPoint(),O);
qreal d = CO.length();
if ( d > GetRadius() + CO.length() ){
throw"Немає перетину кіл для знаходження дотичних.";
}
if ( d < qAbs(GetRadius() - CO.length()) ){
throw"Не можу знайти дотичну. Одне коло знаходиться в іншому.";
}
qreal a = (pow(GetRadius(),2) - pow(CO.length(),2) + pow(d,2) ) / (2*d);
qreal h = sqrt(pow(GetRadius(),2) - pow(a,2));
qreal x2 = GetCenterPoint().x() + a * (O.x() - GetCenterPoint().x())/d;
qreal y2 = GetCenterPoint().y() + a * (O.y() - GetCenterPoint().y())/d;
if(tan == VArc::FirstTangent){
qreal x3 = x2 - h * ( O.y() - GetCenterPoint().y() ) / d;
qreal y3 = y2 + h * ( O.x() - GetCenterPoint().x() ) / d;
return QPointF(x3,y3);
} else {
qreal x3 = x2 + h * ( O.y() - GetCenterPoint().y() ) / d;
qreal y3 = y2 - h * ( O.x() - GetCenterPoint().x() ) / d;
return QPointF(x3,y3);
}
}
bool VArc::Contains(const QPointF P)const{
QVector<QPointF> points = GetPoints ();
for(qint32 i=0; i< points.size();++i){
if((qint32)points[i].x()==(qint32)P.x() && (qint32)points[i].y()==(qint32)P.y()){
return true;
}
}
return false;
}
QPointF VArc::PutAlongArc(qreal length) const{
if(GetLength()<length){
throw"Довжина дуги менше заданої довжини";
} else {
qreal n = (length*180)/(M_PI*GetRadius());
QLineF CP1 = QLineF(GetCenterPoint(),GetP1());
CP1.setAngle(CP1.angle()+n);
return CP1.p2();
}
}
//void VArc::Mirror(const QPointF Pmirror){
// QPointF Center = center;
// Center = QPointF(Center.x() - Pmirror.x(), Center.y() - Pmirror.y());
// Center = QPointF(Center.x() * -1.0, Center.y() * 1.0);
// Center = QPointF(Center.x() + Pmirror.x(), Center.y() + Pmirror.y());
// QPointF P1 = p1;
// P1 = QPointF(P1.x() - Pmirror.x(), P1.y() - Pmirror.y());
// P1 = QPointF(P1.x() * -1.0, P1.y() * 1.0);
// P1 = QPointF(P1.x() + Pmirror.x(), P1.y() + Pmirror.y());
// QPointF P2 = p2;
// P2 = QPointF(P2.x() - Pmirror.x(), P2.y() - Pmirror.y());
// P2 = QPointF(P2.x() * -1.0, P2.y() * 1.0);
// P2 = QPointF(P2.x() + Pmirror.x(), P2.y() + Pmirror.y());
// this->ModifiArc ( Center, radius, QLineF(Center,P2).angle(), QLineF(Center,P1).angle() );
//}

View File

@ -1,7 +1,6 @@
#ifndef VARC_H
#define VARC_H
#include "vspline.h"
#include <QPainterPath>
#include <QVector>
#include <QMap>
@ -12,7 +11,6 @@
*/
class VArc{
public:
enum Tangent_e { FirstTangent, SecondTangent };
/**
* @brief VArc конструктор по замовчуванню.
*/
@ -24,17 +22,19 @@ public:
* @param f1 початковий кут в градусах.
* @param f2 кінцевий кут в градусах.
*/
VArc ( const QMap<qint64, VPointF> *points, qint64 center, qreal radius, qreal f1,
qreal f2 );
VArc (const QMap<qint64, VPointF> *points, qint64 center, qreal radius, QString formulaRadius,
qreal f1, QString formulaF1, qreal f2 , QString formulaF2);
/**
* @brief GetF1 повертає початковий кут дуги.
* @return повертає кут в градусах.
*/
QString GetFormulaF1 () const;
qreal GetF1 () const;
/**
* @brief GetF2 повертає кінцевий кут дуги.
* @return повертає кут в градусах.
*/
QString GetFormulaF2 () const;\
qreal GetF2 () const;
/**
* @brief GetLength повертає довжину дуги.
@ -45,6 +45,7 @@ public:
* @brief GetRadius повертає радіус дуги.
* @return повертає радіус дуги.
*/
QString GetFormulaRadius () const;
qreal GetRadius () const;
/**
* @brief GetCenter повертає точку центра дуги.
@ -63,130 +64,32 @@ public:
*/
QPointF GetP2 () const;
const QMap<qint64, VPointF> *GetDataPoints() const;
/**
* @brief ModifiArc змінює параметри дуги.
* @param center новий центр дуги.
* @param radius новий радіус дуги.
* @param f1 новий початковий кут в градусах.
* @param f2 новий кінцевий кут в градусах.
*/
void ModifiArc (qint64 center, qreal radius, qreal f1, qreal f2 );
/**
* @brief BiasArc зміщує дугу.
* @param mx зміщення по х координаті.
* @param my зміщення по у координаті.
*/
// void BiasArc ( qreal mx, qreal my );
/**
* @brief RotationArc повертає дугу на кут проти годиникової стрілки відносно точки.
* @param pRotate точка відносно якої повертається.
* @param angle кут в градусах на який повертається в градусах.
*/
// void RotationArc ( QPointF pRotate, qreal angle );
/**
* @brief SplOfArc повертає сплайн дуги за номером.
* @param number номер сплайна в дузі.
* @return сплайн.
*/
VSpline SplOfArc ( qint32 number ) const;
/**
* @brief CutArc розрізає дугу на дві дуги.
* @param length довжина першої дуги.
* @param arcFir перша дуга.
* @param arcSec друга дуга.
*/
// void CutArc ( qreal length, VArc &arcFir, VArc &arcSec ) const;
/**
* @brief CutArc розрізає дугу на дві дуги.
* @param point точка яка ділить дугу.
* @param arcFir перша дуга.
* @param arcSec друга дуга.
*/
// void CutArc ( QPointF point, VArc &arcFir, VArc &arcSec ) const;
/**
* @brief CrossingArcLine перевіряє перетин дуги і лінії.
* @param line лінія з якою шукаємо перетин.
* @param intersectionPoint точка перетину.
* @return результат перевірки на перетин.
*/
QLineF::IntersectType CrossingArcLine(const QLineF &line, QPointF *intersectionPoint) const;
/**
* @brief NumberSplOfArc метод шукає кілкість сплайнів які необхідні для відтворення такої дуги.
* @return кількість сплайнів.
*/
qint32 NumberSplOfArc () const;
/**
* @brief GetPath будує шлях по даній дузі.
* @return повертає шлях.
*/
QPainterPath GetPath() const;
/**
* @brief GetPoints повертає набір точок по яких можна побудувати дугу.
* @return набір точок дуги.
*/
QVector<QPointF>
GetPoints () const;
/**
* @brief Tangent розраховує дотичну до дуги.
* @param P точка через, що не належить дузі, через яку проходить дотична.
* @param tan перша чи друга дотична.
* @return точку дотичної на дузі.
*/
QPointF Tangent(const QPointF P,VArc::Tangent_e tan = VArc::FirstTangent)const;
/**
* @brief Contains перевіряє чи точка належить дузі.
* @param P точка що перевіряється.
* @return true - належить дузі, false - не належить дузі.
*/
bool Contains(const QPointF P)const;
/**
* @brief PutAlongArc розміщує точку на дузі.
* @param length довжина від початку дуги.
* @return точка що лежить на дузі.
*/
QPointF PutAlongArc(qreal length) const;
/**
* @brief Mirror дзеркальне відображення дуги.
* @param Pmirror точка відносно якої відбувається дзеркалення.
*/
// void Mirror(const QPointF Pmirror);
private:
/**
* @brief f1 початковий кут в градусах
*/
qreal f1; // початковий кут нахилу дуги (градуси)
QString formulaF1;
/**
* @brief f2 кінцевий кут в градусах
*/
qreal f2; // кінцевий кут нахилу дуги (градуси)
/**
* @brief length довжина дуги.
*/
qreal length; // довжина дуги
QString formulaF2;
/**
* @brief radius радіус дуги.
*/
qreal radius;
QString formulaRadius;
/**
* @brief center центральна точка дуги.
*/
qint64 center;
/**
* @brief p1 точка початку побудови дуги.
*/
QPointF p1;
/**
* @brief p2 кінцева точка побудови дуги.
*/
QPointF p2;
const QMap<qint64, VPointF> *points;
/**
* @brief AngleArc визначає кут дуги.
* @param f1 початковий кут дуги в градусах.
* @param f2 кінцевий кут в градусах.
* @return повертає кут в градусах.
*/
qreal AngleArc(qreal f1, qreal f2 ) const;
};
#endif // VARC_H

View File

@ -26,5 +26,7 @@
<file>icon/32x32/bisector.png</file>
<file>icon/32x32/intersect.png</file>
<file>icon/32x32/spline.png</file>
<file>icon/32x32/arc.png</file>
<file>icon/24x24/putHereLeft.png</file>
</qresource>
</RCC>

BIN
icon/24x24/putHereLeft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
icon/32x32/arc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

View File

@ -19,6 +19,7 @@
#include "tools/vtoolbisector.h"
#include "tools/vtoollineintersect.h"
#include "tools/vtoolspline.h"
#include "tools/vtoolarc.h"
#include "geometry/vspline.h"
MainWindow::MainWindow(QWidget *parent) :
@ -65,6 +66,8 @@ MainWindow::MainWindow(QWidget *parent) :
&MainWindow::ToolLineIntersect);
connect(ui->toolButtonSpline, &QToolButton::clicked, this,
&MainWindow::ToolSpline);
connect(ui->toolButtonArc, &QToolButton::clicked, this,
&MainWindow::ToolArc);
data = new VContainer;
CreateManTableIGroup ();
@ -530,6 +533,62 @@ void MainWindow::ClosedDialogSpline(int result){
ArrowTool();
}
void MainWindow::ToolArc(bool checked){
if(checked){
CanselTool();
tool = Tools::ArcTool;
QPixmap pixmap(":/cursor/arc_cursor.png");
QCursor cur(pixmap, 2, 3);
ui->graphicsView->setCursor(cur);
helpLabel->setText("Виберіть точку центру.");
dialogArc = new DialogArc(data, this);
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogArc,
&DialogArc::ChoosedObject);
connect(dialogArc, &DialogArc::DialogClosed, this,
&MainWindow::ClosedDialogArc);
} else {
ui->toolButtonSpline->setChecked(true);
}
}
void MainWindow::ClosedDialogArc(int result){
if(result == QDialog::Accepted){
qint64 center = dialogArc->GetCenter();
QString radius = dialogArc->GetRadius();
QString f1 = dialogArc->GetF1();
QString f2 = dialogArc->GetF2();
qreal calcRadius, calcF1, calcF2;
Calculator cal(data);
QString errorMsg;
qreal result = cal.eval(radius, &errorMsg);
if(errorMsg.isEmpty()){
calcRadius = result*PrintDPI/25.4;
}
errorMsg.clear();
result = cal.eval(f1, &errorMsg);
if(errorMsg.isEmpty()){
calcF1 = result;
}
errorMsg.clear();
result = cal.eval(f2, &errorMsg);
if(errorMsg.isEmpty()){
calcF2 = result;
}
VArc arc = VArc(data->DataPoints(), center, calcRadius, radius, calcF1, f1, calcF2, f2 );
qint64 id = data->AddArc(arc);
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
VToolArc *toolArc = new VToolArc(doc, data, id, Tool::FromGui);
scene->addItem(toolArc);
connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
}
ArrowTool();
}
void MainWindow::showEvent( QShowEvent *event ){
QMainWindow::showEvent( event );
if( event->spontaneous() ){
@ -686,6 +745,12 @@ void MainWindow::CanselTool(){
scene->setFocus(Qt::OtherFocusReason);
scene->clearSelection();
break;
case Tools::ArcTool:
delete dialogArc;
ui->toolButtonArc->setChecked(false);
scene->setFocus(Qt::OtherFocusReason);
scene->clearSelection();
break;
}
}
@ -949,6 +1014,7 @@ void MainWindow::SetEnableTool(bool enable){
ui->toolButtonBisector->setEnabled(enable);
ui->toolButtonLineIntersect->setEnabled(enable);
ui->toolButtonSpline->setEnabled(enable);
ui->toolButtonArc->setEnabled(enable);
}
MainWindow::~MainWindow(){

View File

@ -18,6 +18,7 @@
#include "dialogs/dialogbisector.h"
#include "dialogs/dialoglineintersect.h"
#include "dialogs/dialogspline.h"
#include "dialogs/dialogarc.h"
#include "tools/vtoolsinglepoint.h"
#include "xml/vdomdocument.h"
#include "container/vcontainer.h"
@ -38,7 +39,8 @@ namespace Tools{
NormalTool,
BisectorTool,
LineIntersectTool,
SplineTool
SplineTool,
ArcTool
};
}
@ -83,6 +85,8 @@ public slots:
void ClosedDialogLineIntersect(int result);
void ToolSpline(bool checked);
void ClosedDialogSpline(int result);
void ToolArc(bool checked);
void ClosedDialogArc(int result);
protected:
virtual void keyPressEvent ( QKeyEvent * event );
virtual void showEvent( QShowEvent *event );
@ -103,6 +107,7 @@ private:
DialogBisector *dialogBisector;
DialogLineIntersect *dialogLineIntersect;
DialogSpline *dialogSpline;
DialogArc *dialogArc;
VDomDocument *doc;
VContainer *data;
QComboBox *comboBoxDraws;

View File

@ -57,7 +57,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<widget class="QWidget" name="page">
<property name="geometry">
@ -341,7 +341,7 @@
<x>0</x>
<y>0</y>
<width>154</width>
<height>45</height>
<height>58</height>
</rect>
</property>
<property name="sizePolicy">
@ -355,9 +355,25 @@
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_8">
<widget class="QToolButton" name="toolButtonArc">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>PushButton</string>
<string>...</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/arc.png</normaloff>:/icon/32x32/arc.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>

114
tools/vtoolarc.cpp Normal file
View File

@ -0,0 +1,114 @@
#include "vtoolarc.h"
#include <QMenu>
VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation,
QGraphicsItem *parent):VAbstractTool(doc, data, id), QGraphicsPathItem(parent){
VArc arc = data->GetArc(id);
QPainterPath path;
path.addPath(arc.GetPath());
path.setFillRule( Qt::WindingFill );
this->setPath(path);
this->setPen(QPen(Qt::black, widthHairLine));
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setAcceptHoverEvents(true);
if(typeCreation == Tool::FromGui){
AddToFile();
}
}
void VToolArc::FullUpdateFromFile(){
RefreshGeometry();
}
void VToolArc::FullUpdateFromGui(int result){
if(result == QDialog::Accepted){
QDomElement domElement = doc->elementById(QString().setNum(id));
if(domElement.isElement()){
domElement.setAttribute("center", QString().setNum(dialogArc->GetCenter()));
domElement.setAttribute("radius", dialogArc->GetRadius());
domElement.setAttribute("angle1", dialogArc->GetF1());
domElement.setAttribute("angle2", dialogArc->GetF2());
emit FullUpdateTree();
}
}
dialogArc.clear();
}
void VToolArc::ChangedActivDraw(const QString newName){
if(nameActivDraw == newName){
this->setPen(QPen(Qt::black, widthHairLine));
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
this->setAcceptHoverEvents(true);
VAbstractTool::ChangedActivDraw(newName);
} else {
this->setPen(QPen(Qt::gray, widthHairLine));
this->setFlag(QGraphicsItem::ItemIsSelectable, false);
this->setAcceptHoverEvents (false);
VAbstractTool::ChangedActivDraw(newName);
}
}
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
if(!ignoreContextMenuEvent){
QMenu menu;
QAction *actionOption = menu.addAction("Властивості");
QAction *selectedAction = menu.exec(event->screenPos());
if(selectedAction == actionOption){
dialogArc = QSharedPointer<DialogArc>(new DialogArc(VAbstractTool::data));
connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject,
dialogArc.data(), &DialogArc::ChoosedObject);
connect(dialogArc.data(), &DialogArc::DialogClosed, this,
&VToolArc::FullUpdateFromGui);
VArc arc = VAbstractTool::data->GetArc(id);
dialogArc->GetCenter(arc.GetCenter());
dialogArc->GetRadius(arc.GetFormulaRadius());
dialogArc->GetF1(arc.GetFormulaF1());
dialogArc->GetF2(arc.GetFormulaF2());
dialogArc->show();
}
}
}
void VToolArc::AddToFile(){
VArc arc = VAbstractTool::data->GetArc(id);
QDomElement domElement = doc->createElement("arc");
AddAttribute(domElement, "id", id);
AddAttribute(domElement, "type", "simple");
AddAttribute(domElement, "center", arc.GetCenter());
AddAttribute(domElement, "radius", arc.GetFormulaRadius());
AddAttribute(domElement, "angle1", arc.GetFormulaF1());
AddAttribute(domElement, "angle2", arc.GetFormulaF2());
AddToCalculation(domElement);
}
void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event){
if(event->button() == Qt::LeftButton){
emit ChoosedTool(id, Scene::Arc);
}
QGraphicsItem::mouseReleaseEvent(event);
}
void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthMainLine));
}
void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){
Q_UNUSED(event);
this->setPen(QPen(Qt::black, widthHairLine));
}
void VToolArc::RefreshGeometry(){
VArc arc = VAbstractTool::data->GetArc(id);
QPainterPath path;
path.addPath(arc.GetPath());
path.setFillRule( Qt::WindingFill );
this->setPath(path);
}

32
tools/vtoolarc.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef VTOOLARC_H
#define VTOOLARC_H
#include "vabstracttool.h"
#include "../container/vcontainer.h"
#include "../xml/vdomdocument.h"
#include <QGraphicsPathItem>
#include "../dialogs/dialogarc.h"
#include "../widgets/vcontrolpointspline.h"
class VToolArc :public VAbstractTool, public QGraphicsPathItem
{
Q_OBJECT
public:
VToolArc(VDomDocument *doc, VContainer *data, qint64 id, Tool::Enum typeCreation,
QGraphicsItem * parent = 0);
public slots:
virtual void FullUpdateFromFile();
virtual void FullUpdateFromGui(int result);
virtual void ChangedActivDraw(const QString newName);
protected:
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
virtual void AddToFile();
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
private:
QSharedPointer<DialogArc> dialogArc;
void RefreshGeometry();
};
#endif // VTOOLARC_H

View File

@ -10,6 +10,7 @@
#include "../tools/vtoolbisector.h"
#include "../tools/vtoollineintersect.h"
#include "../tools/vtoolspline.h"
#include "../tools/vtoolarc.h"
#include "../options.h"
#include "../container/calculator.h"
@ -228,6 +229,7 @@ void VDomDocument::Parse(Document::Enum parse, VMainGraphicsScene *scene, QCombo
data->ClearLengthLines();
data->ClearLengthArcs();
data->ClearLengthSplines();
data->ClearLineArcs();
}
QDomElement rootElement = this->documentElement();
QDomNode domNode = rootElement.firstChild();
@ -351,6 +353,9 @@ void VDomDocument::ParseCalculationElement(VMainGraphicsScene *scene, const QDom
if(domElement.tagName() == "spline"){
ParseSplineElement(scene, domElement, parse, domElement.attribute("type", ""));
}
if(domElement.tagName() == "arc"){
ParseArcElement(scene, domElement, parse, domElement.attribute("type", ""));
}
}
}
}
@ -673,6 +678,54 @@ void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomEleme
}
}
void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement,
Document::Enum parse, const QString &type){
if(type == "simple"){
if(!domElement.isNull()){
QString radius, f1, f2;
qint64 id, center;
if(!domElement.isNull()){
id = domElement.attribute("id", "").toLongLong();
center = domElement.attribute("center", "").toLongLong();
radius = domElement.attribute("radius", "");
f1 = domElement.attribute("angle1", "");
f2 = domElement.attribute("angle2","");
qreal calcRadius = 0, calcF1 = 0, calcF2 = 0;
Calculator cal(data);
QString errorMsg;
qreal result = cal.eval(radius, &errorMsg);
if(errorMsg.isEmpty()){
calcRadius = result*PrintDPI/25.4;
}
errorMsg.clear();
result = cal.eval(f1, &errorMsg);
if(errorMsg.isEmpty()){
calcF1 = result;
}
errorMsg.clear();
result = cal.eval(f2, &errorMsg);
if(errorMsg.isEmpty()){
calcF2 = result;
}
VArc arc = VArc(data->DataPoints(), center, calcRadius, radius, calcF1, f1, calcF2, f2 );
data->UpdateArc(id, arc);
data->AddLengthArc(data->GetNameArc(center,id), arc.GetLength());
if(parse == Document::FullParse){
VToolArc *toolArc = new VToolArc(this, data, id, Tool::FromFile);
scene->addItem(toolArc);
connect(toolArc, &VToolArc::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
}
}
}
return;
}
}
void VDomDocument::FullUpdateTree(){
VMainGraphicsScene *scene = new VMainGraphicsScene();
QComboBox *comboBoxDraws = new QComboBox();

View File

@ -61,6 +61,8 @@ private:
Document::Enum parse);
void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
Document::Enum parse, const QString& type);
void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement,
Document::Enum parse, const QString& type);
void ParseIncrementsElement(const QDomNode& node);
void AddNewDraw(const QDomElement &node, QComboBox *comboBoxDraws)const;
};