Add tool LineIntersect
This commit is contained in:
parent
f25d3e7f7f
commit
066432c980
|
@ -40,7 +40,10 @@ SOURCES += main.cpp\
|
||||||
tools/vtoolnormal.cpp \
|
tools/vtoolnormal.cpp \
|
||||||
dialogs/dialognormal.cpp \
|
dialogs/dialognormal.cpp \
|
||||||
tools/vtoolbisector.cpp \
|
tools/vtoolbisector.cpp \
|
||||||
dialogs/dialogbisector.cpp
|
dialogs/dialogbisector.cpp \
|
||||||
|
tools/vtoollinepoint.cpp \
|
||||||
|
tools/vtoollineintersect.cpp \
|
||||||
|
dialogs/dialoglineintersect.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
widgets/vmaingraphicsscene.h \
|
widgets/vmaingraphicsscene.h \
|
||||||
|
@ -71,7 +74,10 @@ HEADERS += mainwindow.h \
|
||||||
tools/vtoolnormal.h \
|
tools/vtoolnormal.h \
|
||||||
dialogs/dialognormal.h \
|
dialogs/dialognormal.h \
|
||||||
tools/vtoolbisector.h \
|
tools/vtoolbisector.h \
|
||||||
dialogs/dialogbisector.h
|
dialogs/dialogbisector.h \
|
||||||
|
tools/vtoollinepoint.h \
|
||||||
|
tools/vtoollineintersect.h \
|
||||||
|
dialogs/dialoglineintersect.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
dialogs/dialogsinglepoint.ui \
|
dialogs/dialogsinglepoint.ui \
|
||||||
|
@ -81,7 +87,8 @@ FORMS += mainwindow.ui \
|
||||||
dialogs/dialogalongline.ui \
|
dialogs/dialogalongline.ui \
|
||||||
dialogs/dialogshoulderpoint.ui \
|
dialogs/dialogshoulderpoint.ui \
|
||||||
dialogs/dialognormal.ui \
|
dialogs/dialognormal.ui \
|
||||||
dialogs/dialogbisector.ui
|
dialogs/dialogbisector.ui \
|
||||||
|
dialogs/dialoglineintersect.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
icon.qrc \
|
icon.qrc \
|
||||||
|
|
|
@ -7,5 +7,6 @@
|
||||||
<file>cursor/shoulder_cursor.png</file>
|
<file>cursor/shoulder_cursor.png</file>
|
||||||
<file>cursor/normal_cursor.png</file>
|
<file>cursor/normal_cursor.png</file>
|
||||||
<file>cursor/bisector_cursor.png</file>
|
<file>cursor/bisector_cursor.png</file>
|
||||||
|
<file>cursor/intersect_cursor.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
cursor/intersect_cursor.png
Normal file
BIN
cursor/intersect_cursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
188
dialogs/dialoglineintersect.cpp
Normal file
188
dialogs/dialoglineintersect.cpp
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
#include "dialoglineintersect.h"
|
||||||
|
#include "ui_dialoglineintersect.h"
|
||||||
|
|
||||||
|
DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent) :
|
||||||
|
DialogTool(data, parent), ui(new Ui::DialogLineIntersect)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
number = 0;
|
||||||
|
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted);
|
||||||
|
flagName = false;
|
||||||
|
flagPoint = true;
|
||||||
|
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||||
|
connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected);
|
||||||
|
FillComboBoxPoints(ui->comboBoxP1Line1);
|
||||||
|
FillComboBoxPoints(ui->comboBoxP2Line1);
|
||||||
|
FillComboBoxPoints(ui->comboBoxP1Line2);
|
||||||
|
FillComboBoxPoints(ui->comboBoxP2Line2);
|
||||||
|
|
||||||
|
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogLineIntersect::NamePointChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogLineIntersect::~DialogLineIntersect()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::ChoosedPoint(qint64 id, Scene::Type type){
|
||||||
|
if(type == Scene::Point){
|
||||||
|
VPointF point = data->GetPoint(id);
|
||||||
|
if(number == 0){
|
||||||
|
qint32 index = ui->comboBoxP1Line1->findText(point.name());
|
||||||
|
if ( index != -1 ) { // -1 for not found
|
||||||
|
ui->comboBoxP1Line1->setCurrentIndex(index);
|
||||||
|
p1Line1 = id;
|
||||||
|
number++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(number == 1){
|
||||||
|
qint32 index = ui->comboBoxP2Line1->findText(point.name());
|
||||||
|
if ( index != -1 ) { // -1 for not found
|
||||||
|
ui->comboBoxP2Line1->setCurrentIndex(index);
|
||||||
|
p2Line1 = id;
|
||||||
|
number++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(number == 2){
|
||||||
|
qint32 index = ui->comboBoxP1Line2->findText(point.name());
|
||||||
|
if ( index != -1 ) { // -1 for not found
|
||||||
|
ui->comboBoxP1Line2->setCurrentIndex(index);
|
||||||
|
p1Line2 = id;
|
||||||
|
number++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(number == 3){
|
||||||
|
qint32 index = ui->comboBoxP2Line2->findText(point.name());
|
||||||
|
if ( index != -1 ) { // -1 for not found
|
||||||
|
ui->comboBoxP2Line2->setCurrentIndex(index);
|
||||||
|
p2Line2 = id;
|
||||||
|
number = 0;
|
||||||
|
}
|
||||||
|
if(!isInitialized){
|
||||||
|
flagPoint = CheckIntersecion();
|
||||||
|
CheckState();
|
||||||
|
this->show();
|
||||||
|
connect(ui->comboBoxP1Line1,
|
||||||
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&DialogLineIntersect::P1Line1Changed);
|
||||||
|
connect(ui->comboBoxP2Line1,
|
||||||
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&DialogLineIntersect::P2Line1Changed);
|
||||||
|
connect(ui->comboBoxP1Line2,
|
||||||
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&DialogLineIntersect::P1Line2Changed);
|
||||||
|
connect(ui->comboBoxP2Line2,
|
||||||
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&DialogLineIntersect::P2Line2Changed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::DialogAccepted(){
|
||||||
|
pointName = ui->lineEditNamePoint->text();
|
||||||
|
qint32 index = ui->comboBoxP1Line1->currentIndex();
|
||||||
|
p1Line1 = qvariant_cast<qint64>(ui->comboBoxP1Line1->itemData(index));
|
||||||
|
index = ui->comboBoxP2Line1->currentIndex();
|
||||||
|
p2Line1 = qvariant_cast<qint64>(ui->comboBoxP2Line1->itemData(index));
|
||||||
|
index = ui->comboBoxP1Line2->currentIndex();
|
||||||
|
p1Line2 = qvariant_cast<qint64>(ui->comboBoxP1Line2->itemData(index));
|
||||||
|
index = ui->comboBoxP2Line2->currentIndex();
|
||||||
|
p2Line2 = qvariant_cast<qint64>(ui->comboBoxP2Line2->itemData(index));
|
||||||
|
emit DialogClosed(QDialog::Accepted);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::P1Line1Changed( int index){
|
||||||
|
p1Line1 = qvariant_cast<qint64>(ui->comboBoxP1Line1->itemData(index));
|
||||||
|
flagPoint = CheckIntersecion();
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::P2Line1Changed(int index){
|
||||||
|
p2Line1 = qvariant_cast<qint64>(ui->comboBoxP2Line1->itemData(index));
|
||||||
|
flagPoint = CheckIntersecion();
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::P1Line2Changed(int index){
|
||||||
|
p1Line2 = qvariant_cast<qint64>(ui->comboBoxP1Line2->itemData(index));
|
||||||
|
flagPoint = CheckIntersecion();
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::P2Line2Changed(int index){
|
||||||
|
p2Line2 = qvariant_cast<qint64>(ui->comboBoxP2Line2->itemData(index));
|
||||||
|
flagPoint = CheckIntersecion();
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::CheckState(){
|
||||||
|
Q_CHECK_PTR(bOk);
|
||||||
|
bOk->setEnabled(flagName & flagPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DialogLineIntersect::CheckIntersecion(){
|
||||||
|
VPointF p1L1 = data->GetPoint(p1Line1);
|
||||||
|
VPointF p2L1 = data->GetPoint(p2Line1);
|
||||||
|
VPointF p1L2 = data->GetPoint(p1Line2);
|
||||||
|
VPointF p2L2 = data->GetPoint(p2Line2);
|
||||||
|
|
||||||
|
QLineF line1(p1L1, p2L1);
|
||||||
|
QLineF line2(p1L2, p2L2);
|
||||||
|
QPointF fPoint;
|
||||||
|
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
||||||
|
if(intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 DialogLineIntersect::getP2Line2() const{
|
||||||
|
return p2Line2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::setP2Line2(const qint64 &value){
|
||||||
|
p2Line2 = value;
|
||||||
|
ChangeCurrentData(ui->comboBoxP2Line2, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 DialogLineIntersect::getP1Line2() const{
|
||||||
|
return p1Line2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::setP1Line2(const qint64 &value){
|
||||||
|
p1Line2 = value;
|
||||||
|
ChangeCurrentData(ui->comboBoxP1Line2, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 DialogLineIntersect::getP2Line1() const{
|
||||||
|
return p2Line1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::setP2Line1(const qint64 &value){
|
||||||
|
p2Line1 = value;
|
||||||
|
ChangeCurrentData(ui->comboBoxP2Line1, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 DialogLineIntersect::getP1Line1() const{
|
||||||
|
return p1Line1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::setP1Line1(const qint64 &value){
|
||||||
|
p1Line1 = value;
|
||||||
|
ChangeCurrentData(ui->comboBoxP1Line1, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DialogLineIntersect::getPointName() const{
|
||||||
|
return pointName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogLineIntersect::setPointName(const QString &value){
|
||||||
|
pointName = value;
|
||||||
|
ui->lineEditNamePoint->setText(pointName);
|
||||||
|
}
|
46
dialogs/dialoglineintersect.h
Normal file
46
dialogs/dialoglineintersect.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef DIALOGLINEINTERSECT_H
|
||||||
|
#define DIALOGLINEINTERSECT_H
|
||||||
|
|
||||||
|
#include "dialogtool.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DialogLineIntersect;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogLineIntersect : public DialogTool
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DialogLineIntersect(const VContainer *data, QWidget *parent = 0);
|
||||||
|
~DialogLineIntersect();
|
||||||
|
qint64 getP1Line1() const;
|
||||||
|
void setP1Line1(const qint64 &value);
|
||||||
|
qint64 getP2Line1() const;
|
||||||
|
void setP2Line1(const qint64 &value);
|
||||||
|
qint64 getP1Line2() const;
|
||||||
|
void setP1Line2(const qint64 &value);
|
||||||
|
qint64 getP2Line2() const;
|
||||||
|
void setP2Line2(const qint64 &value);
|
||||||
|
QString getPointName() const;
|
||||||
|
void setPointName(const QString &value);
|
||||||
|
public slots:
|
||||||
|
virtual void ChoosedPoint(qint64 id, Scene::Type type);
|
||||||
|
virtual void DialogAccepted();
|
||||||
|
void P1Line1Changed( int index);
|
||||||
|
void P2Line1Changed( int index);
|
||||||
|
void P1Line2Changed( int index);
|
||||||
|
void P2Line2Changed( int index);
|
||||||
|
private:
|
||||||
|
Ui::DialogLineIntersect *ui;
|
||||||
|
qint32 number;
|
||||||
|
QString pointName;
|
||||||
|
qint64 p1Line1;
|
||||||
|
qint64 p2Line1;
|
||||||
|
qint64 p1Line2;
|
||||||
|
qint64 p2Line2;
|
||||||
|
bool flagPoint;
|
||||||
|
virtual void CheckState();
|
||||||
|
bool CheckIntersecion();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGLINEINTERSECT_H
|
158
dialogs/dialoglineintersect.ui
Normal file
158
dialogs/dialoglineintersect.ui
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogLineIntersect</class>
|
||||||
|
<widget class="QDialog" name="DialogLineIntersect">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>366</width>
|
||||||
|
<height>196</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<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="QLineEdit" name="lineEditNamePoint"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Перша лінія</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<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>Перша точка</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxP1Line1"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Друга точка</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxP2Line1"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Друга лінія</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<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="comboBoxP1Line2"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Друга точка</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxP2Line2"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</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/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>DialogLineIntersect</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>DialogLineIntersect</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>
|
|
@ -64,7 +64,7 @@ protected:
|
||||||
void showEvent( QShowEvent *event );
|
void showEvent( QShowEvent *event );
|
||||||
void FillComboBoxPoints(QComboBox *box)const;
|
void FillComboBoxPoints(QComboBox *box)const;
|
||||||
void FillComboBoxTypeLine(QComboBox *box) const;
|
void FillComboBoxTypeLine(QComboBox *box) const;
|
||||||
void CheckState();
|
virtual void CheckState();
|
||||||
QString GetTypeLine(const QComboBox *box)const;
|
QString GetTypeLine(const QComboBox *box)const;
|
||||||
void ShowBase();
|
void ShowBase();
|
||||||
void ShowStandartTable();
|
void ShowStandartTable();
|
||||||
|
|
1
icon.qrc
1
icon.qrc
|
@ -24,5 +24,6 @@
|
||||||
<file>icon/32x32/shoulder.png</file>
|
<file>icon/32x32/shoulder.png</file>
|
||||||
<file>icon/32x32/normal.png</file>
|
<file>icon/32x32/normal.png</file>
|
||||||
<file>icon/32x32/bisector.png</file>
|
<file>icon/32x32/bisector.png</file>
|
||||||
|
<file>icon/32x32/intersect.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
icon/32x32/intersect.png
Normal file
BIN
icon/32x32/intersect.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 603 B |
|
@ -17,6 +17,7 @@
|
||||||
#include "tools/vtoolshoulderpoint.h"
|
#include "tools/vtoolshoulderpoint.h"
|
||||||
#include "tools/vtoolnormal.h"
|
#include "tools/vtoolnormal.h"
|
||||||
#include "tools/vtoolbisector.h"
|
#include "tools/vtoolbisector.h"
|
||||||
|
#include "tools/vtoollineintersect.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent), ui(new Ui::MainWindow)
|
QMainWindow(parent), ui(new Ui::MainWindow)
|
||||||
|
@ -58,6 +59,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
&MainWindow::ToolNormal);
|
&MainWindow::ToolNormal);
|
||||||
connect(ui->toolButtonBisector, &QToolButton::clicked, this,
|
connect(ui->toolButtonBisector, &QToolButton::clicked, this,
|
||||||
&MainWindow::ToolBisector);
|
&MainWindow::ToolBisector);
|
||||||
|
connect(ui->toolButtonLineIntersect, &QToolButton::clicked, this,
|
||||||
|
&MainWindow::ToolLineIntersect);
|
||||||
|
|
||||||
data = new VContainer;
|
data = new VContainer;
|
||||||
CreateManTableIGroup ();
|
CreateManTableIGroup ();
|
||||||
|
@ -434,6 +437,57 @@ void MainWindow::ClosedDialogBisector(int result){
|
||||||
ArrowTool();
|
ArrowTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::ToolLineIntersect(bool checked){
|
||||||
|
if(checked){
|
||||||
|
CanselTool();
|
||||||
|
tool = Tools::LineIntersectTool;
|
||||||
|
QPixmap pixmap(":/cursor/intersect_cursor.png");
|
||||||
|
QCursor cur(pixmap, 2, 3);
|
||||||
|
ui->graphicsView->setCursor(cur);
|
||||||
|
helpLabel->setText("Виберіть точки.");
|
||||||
|
dialogLineIntersect = new DialogLineIntersect(data, this);
|
||||||
|
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogLineIntersect,
|
||||||
|
&DialogLineIntersect::ChoosedPoint);
|
||||||
|
connect(dialogLineIntersect, &DialogLineIntersect::DialogClosed, this,
|
||||||
|
&MainWindow::ClosedDialogLineIntersect);
|
||||||
|
} else {
|
||||||
|
ui->toolButtonLineIntersect->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ClosedDialogLineIntersect(int result){
|
||||||
|
if(result == QDialog::Accepted){
|
||||||
|
qint64 p1Line1Id = dialogLineIntersect->getP1Line1();
|
||||||
|
qint64 p2Line1Id = dialogLineIntersect->getP2Line1();
|
||||||
|
qint64 p1Line2Id = dialogLineIntersect->getP1Line2();
|
||||||
|
qint64 p2Line2Id = dialogLineIntersect->getP2Line2();
|
||||||
|
QString pointName = dialogLineIntersect->getPointName();
|
||||||
|
|
||||||
|
VPointF p1Line1 = data->GetPoint(p1Line1Id);
|
||||||
|
VPointF p2Line1 = data->GetPoint(p2Line1Id);
|
||||||
|
VPointF p1Line2 = data->GetPoint(p1Line2Id);
|
||||||
|
VPointF p2Line2 = data->GetPoint(p2Line2Id);
|
||||||
|
|
||||||
|
QLineF line1(p1Line1, p2Line1);
|
||||||
|
QLineF line2(p1Line2, p2Line2);
|
||||||
|
QPointF fPoint;
|
||||||
|
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
||||||
|
if(intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection){
|
||||||
|
qint64 id = data->AddPoint(VPointF(fPoint.x(), fPoint.y(), pointName, 5, 10));
|
||||||
|
data->AddLine(p1Line1Id, id);
|
||||||
|
data->AddLine(id, p2Line1Id);
|
||||||
|
data->AddLine(p1Line2Id, id);
|
||||||
|
data->AddLine(id, p2Line2Id);
|
||||||
|
VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id,
|
||||||
|
p2Line1Id, p1Line2Id,
|
||||||
|
p2Line2Id, Tool::FromFile);
|
||||||
|
scene->addItem(point);
|
||||||
|
connect(point, &VToolLineIntersect::ChoosedPoint, scene, &VMainGraphicsScene::ChoosedItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ArrowTool();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showEvent( QShowEvent *event ){
|
void MainWindow::showEvent( QShowEvent *event ){
|
||||||
QMainWindow::showEvent( event );
|
QMainWindow::showEvent( event );
|
||||||
if( event->spontaneous() ){
|
if( event->spontaneous() ){
|
||||||
|
@ -578,6 +632,12 @@ void MainWindow::CanselTool(){
|
||||||
scene->setFocus(Qt::OtherFocusReason);
|
scene->setFocus(Qt::OtherFocusReason);
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
break;
|
break;
|
||||||
|
case Tools::LineIntersectTool:
|
||||||
|
delete dialogLineIntersect;
|
||||||
|
ui->toolButtonLineIntersect->setChecked(false);
|
||||||
|
scene->setFocus(Qt::OtherFocusReason);
|
||||||
|
scene->clearSelection();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,6 +899,7 @@ void MainWindow::SetEnableTool(bool enable){
|
||||||
ui->toolButtonShoulderPoint->setEnabled(enable);
|
ui->toolButtonShoulderPoint->setEnabled(enable);
|
||||||
ui->toolButtonNormal->setEnabled(enable);
|
ui->toolButtonNormal->setEnabled(enable);
|
||||||
ui->toolButtonBisector->setEnabled(enable);
|
ui->toolButtonBisector->setEnabled(enable);
|
||||||
|
ui->toolButtonLineIntersect->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow(){
|
MainWindow::~MainWindow(){
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "dialogs/dialogendline.h"
|
#include "dialogs/dialogendline.h"
|
||||||
#include "dialogs/dialognormal.h"
|
#include "dialogs/dialognormal.h"
|
||||||
#include "dialogs/dialogbisector.h"
|
#include "dialogs/dialogbisector.h"
|
||||||
|
#include "dialogs/dialoglineintersect.h"
|
||||||
#include "tools/vtoolsimplepoint.h"
|
#include "tools/vtoolsimplepoint.h"
|
||||||
#include "xml/vdomdocument.h"
|
#include "xml/vdomdocument.h"
|
||||||
#include "container/vcontainer.h"
|
#include "container/vcontainer.h"
|
||||||
|
@ -34,7 +35,8 @@ namespace Tools{
|
||||||
AlongLineTool,
|
AlongLineTool,
|
||||||
ShoulderPointTool,
|
ShoulderPointTool,
|
||||||
NormalTool,
|
NormalTool,
|
||||||
BisectorTool
|
BisectorTool,
|
||||||
|
LineIntersectTool
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +77,8 @@ public slots:
|
||||||
void ClosedDialogNormal(int result);
|
void ClosedDialogNormal(int result);
|
||||||
void ToolBisector(bool checked);
|
void ToolBisector(bool checked);
|
||||||
void ClosedDialogBisector(int result);
|
void ClosedDialogBisector(int result);
|
||||||
|
void ToolLineIntersect(bool checked);
|
||||||
|
void ClosedDialogLineIntersect(int result);
|
||||||
protected:
|
protected:
|
||||||
virtual void keyPressEvent ( QKeyEvent * event );
|
virtual void keyPressEvent ( QKeyEvent * event );
|
||||||
virtual void showEvent( QShowEvent *event );
|
virtual void showEvent( QShowEvent *event );
|
||||||
|
@ -93,6 +97,7 @@ private:
|
||||||
DialogShoulderPoint *dialogShoulderPoint;
|
DialogShoulderPoint *dialogShoulderPoint;
|
||||||
DialogNormal *dialogNormal;
|
DialogNormal *dialogNormal;
|
||||||
DialogBisector *dialogBisector;
|
DialogBisector *dialogBisector;
|
||||||
|
DialogLineIntersect *dialogLineIntersect;
|
||||||
VDomDocument *doc;
|
VDomDocument *doc;
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
QComboBox *comboBoxDraws;
|
QComboBox *comboBoxDraws;
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>154</width>
|
<width>154</width>
|
||||||
<height>50</height>
|
<height>58</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -257,8 +257,31 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>24</width>
|
<width>32</width>
|
||||||
<height>24</height>
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QToolButton" name="toolButtonLineIntersect">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/intersect.png</normaloff>:/icon/32x32/intersect.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
|
|
|
@ -7,68 +7,24 @@
|
||||||
VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
|
VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula,
|
||||||
const qint64 &firstPointId, const qint64 &secondPointId,
|
const qint64 &firstPointId, const qint64 &secondPointId,
|
||||||
const QString &typeLine, Tool::Enum typeCreation,
|
const QString &typeLine, Tool::Enum typeCreation,
|
||||||
QGraphicsItem *parent):VToolPoint(doc, data, id, parent){
|
QGraphicsItem *parent):
|
||||||
this->typeLine = typeLine;
|
VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent){
|
||||||
this->formula = formula;
|
|
||||||
this->firstPointId = firstPointId;
|
|
||||||
this->secondPointId = secondPointId;
|
this->secondPointId = secondPointId;
|
||||||
|
|
||||||
//Лінія, якщо потрібно.
|
|
||||||
VPointF firstPoint = data->GetPoint(firstPointId);
|
|
||||||
VPointF secondPoint = data->GetPoint(secondPointId);
|
|
||||||
QLineF line = QLineF(firstPoint.toQPointF(), secondPoint.toQPointF());
|
|
||||||
Calculator cal(data);
|
|
||||||
QString errorMsg;
|
|
||||||
qreal result = cal.eval(formula, &errorMsg);
|
|
||||||
if(errorMsg.isEmpty()){
|
|
||||||
line.setLength(result*PrintDPI/25.4);
|
|
||||||
mainLine = new QGraphicsLineItem(line, this);
|
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
AddToFile();
|
AddToFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void VToolAlongLine::FullUpdateFromFile(){
|
void VToolAlongLine::FullUpdateFromFile(){
|
||||||
QString name;
|
|
||||||
qreal mx, my;
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if(domElement.isElement()){
|
if(domElement.isElement()){
|
||||||
name = domElement.attribute("name", "");
|
|
||||||
mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4;
|
|
||||||
my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4;
|
|
||||||
typeLine = domElement.attribute("typeLine", "");
|
typeLine = domElement.attribute("typeLine", "");
|
||||||
formula = domElement.attribute("length", "");
|
formula = domElement.attribute("length", "");
|
||||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||||
}
|
}
|
||||||
VPointF point = VAbstractTool::data->GetPoint(id);
|
RefreshGeometry();
|
||||||
RefreshGeometry(name, point.x(), point.y(), mx, my);
|
|
||||||
VPointF firstPoint = VAbstractTool::data->GetPoint(firstPointId);
|
|
||||||
VPointF secondPoint = VAbstractTool::data->GetPoint(secondPointId);
|
|
||||||
mainLine->setLine(QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()));
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolAlongLine::ChangedActivDraw(const QString newName){
|
|
||||||
if(nameActivDraw == newName){
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
} else {
|
|
||||||
mainLine->setPen(QPen(Qt::gray, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolAlongLine::FullUpdateFromGui(int result){
|
void VToolAlongLine::FullUpdateFromGui(int result){
|
||||||
|
@ -106,7 +62,7 @@ void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
|
|
||||||
dialogAlongLine->setTypeLine(typeLine);
|
dialogAlongLine->setTypeLine(typeLine);
|
||||||
dialogAlongLine->setFormula(formula);
|
dialogAlongLine->setFormula(formula);
|
||||||
dialogAlongLine->setFirstPointId(firstPointId);
|
dialogAlongLine->setFirstPointId(basePointId);
|
||||||
dialogAlongLine->setSecondPointId(secondPointId);
|
dialogAlongLine->setSecondPointId(secondPointId);
|
||||||
dialogAlongLine->setPointName(p.name());
|
dialogAlongLine->setPointName(p.name());
|
||||||
|
|
||||||
|
@ -127,7 +83,7 @@ void VToolAlongLine::AddToFile(){
|
||||||
|
|
||||||
AddAttribute(domElement, "typeLine", typeLine);
|
AddAttribute(domElement, "typeLine", typeLine);
|
||||||
AddAttribute(domElement, "length", formula);
|
AddAttribute(domElement, "length", formula);
|
||||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
AddAttribute(domElement, "firstPoint", basePointId);
|
||||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef VTOOLALONGLINE_H
|
#ifndef VTOOLALONGLINE_H
|
||||||
#define VTOOLALONGLINE_H
|
#define VTOOLALONGLINE_H
|
||||||
|
|
||||||
#include "vtoolpoint.h"
|
#include "vtoollinepoint.h"
|
||||||
#include "../dialogs/dialogalongline.h"
|
#include "../dialogs/dialogalongline.h"
|
||||||
|
|
||||||
class VToolAlongLine : public VToolPoint
|
class VToolAlongLine : public VToolLinePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -13,17 +13,12 @@ public:
|
||||||
Tool::Enum typeCreation, QGraphicsItem * parent = 0);
|
Tool::Enum typeCreation, QGraphicsItem * parent = 0);
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile();
|
virtual void FullUpdateFromFile();
|
||||||
virtual void ChangedActivDraw(const QString newName);
|
|
||||||
virtual void FullUpdateFromGui(int result);
|
virtual void FullUpdateFromGui(int result);
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
private:
|
private:
|
||||||
QString typeLine;
|
|
||||||
QString formula;
|
|
||||||
qint64 firstPointId;
|
|
||||||
qint64 secondPointId;
|
qint64 secondPointId;
|
||||||
QGraphicsLineItem *mainLine;
|
|
||||||
QSharedPointer<DialogAlongLine> dialogAlongLine;
|
QSharedPointer<DialogAlongLine> dialogAlongLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,25 +4,10 @@
|
||||||
VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||||
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
|
const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId,
|
||||||
const qint64 &thirdPointId, Tool::Enum typeCreation, QGraphicsItem *parent):
|
const qint64 &thirdPointId, Tool::Enum typeCreation, QGraphicsItem *parent):
|
||||||
VToolPoint(doc, data, id, parent){
|
VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent){
|
||||||
this->typeLine = typeLine;
|
|
||||||
this->formula = formula;
|
|
||||||
this->firstPointId = firstPointId;
|
this->firstPointId = firstPointId;
|
||||||
this->secondPointId = secondPointId;
|
|
||||||
this->thirdPointId = thirdPointId;
|
this->thirdPointId = thirdPointId;
|
||||||
|
|
||||||
//Лінія, що з'єднує дві точки
|
|
||||||
VPointF basePoint = data->GetPoint(secondPointId);
|
|
||||||
VPointF point = data->GetPoint(id);
|
|
||||||
mainLine = new QGraphicsLineItem(QLineF(basePoint.toQPointF(), point.toQPointF()), this);
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
AddToFile();
|
AddToFile();
|
||||||
}
|
}
|
||||||
|
@ -42,28 +27,15 @@ QPointF VToolBisector::FindPoint(const QPointF &firstPoint, const QPointF &secon
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolBisector::FullUpdateFromFile(){
|
void VToolBisector::FullUpdateFromFile(){
|
||||||
QString name;
|
|
||||||
qreal mx, my;
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if(domElement.isElement()){
|
if(domElement.isElement()){
|
||||||
name = domElement.attribute("name", "");
|
|
||||||
mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4;
|
|
||||||
my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4;
|
|
||||||
typeLine = domElement.attribute("typeLine", "");
|
typeLine = domElement.attribute("typeLine", "");
|
||||||
formula = domElement.attribute("length", "");
|
formula = domElement.attribute("length", "");
|
||||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
basePointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||||
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
|
thirdPointId = domElement.attribute("thirdPoint", "").toLongLong();
|
||||||
}
|
}
|
||||||
VPointF point = VAbstractTool::data->GetPoint(id);
|
RefreshGeometry();
|
||||||
RefreshGeometry(name, point.x(), point.y(), mx, my);
|
|
||||||
VPointF basePoint = VAbstractTool::data->GetPoint(secondPointId);
|
|
||||||
mainLine->setLine(QLineF(basePoint.toQPointF(), point.toQPointF()));
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolBisector::FullUpdateFromGui(int result){
|
void VToolBisector::FullUpdateFromGui(int result){
|
||||||
|
@ -82,16 +54,6 @@ void VToolBisector::FullUpdateFromGui(int result){
|
||||||
dialogBisector.clear();
|
dialogBisector.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolBisector::ChangedActivDraw(const QString newName){
|
|
||||||
if(nameActivDraw == newName){
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
} else {
|
|
||||||
mainLine->setPen(QPen(Qt::gray, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
if(!ignoreContextMenuEvent){
|
if(!ignoreContextMenuEvent){
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
@ -112,7 +74,7 @@ void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
dialogBisector->setTypeLine(typeLine);
|
dialogBisector->setTypeLine(typeLine);
|
||||||
dialogBisector->setFormula(formula);
|
dialogBisector->setFormula(formula);
|
||||||
dialogBisector->setFirstPointId(firstPointId);
|
dialogBisector->setFirstPointId(firstPointId);
|
||||||
dialogBisector->setSecondPointId(secondPointId);
|
dialogBisector->setSecondPointId(basePointId);
|
||||||
dialogBisector->setThirdPointId(thirdPointId);
|
dialogBisector->setThirdPointId(thirdPointId);
|
||||||
dialogBisector->setPointName(p.name());
|
dialogBisector->setPointName(p.name());
|
||||||
|
|
||||||
|
@ -134,7 +96,7 @@ void VToolBisector::AddToFile(){
|
||||||
AddAttribute(domElement, "typeLine", typeLine);
|
AddAttribute(domElement, "typeLine", typeLine);
|
||||||
AddAttribute(domElement, "length", formula);
|
AddAttribute(domElement, "length", formula);
|
||||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
AddAttribute(domElement, "firstPoint", firstPointId);
|
||||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
AddAttribute(domElement, "secondPoint", basePointId);
|
||||||
AddAttribute(domElement, "thirdPoint", thirdPointId);
|
AddAttribute(domElement, "thirdPoint", thirdPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
#include "vtoolpoint.h"
|
#include "vtoollinepoint.h"
|
||||||
#include "../dialogs/dialogbisector.h"
|
#include "../dialogs/dialogbisector.h"
|
||||||
|
|
||||||
class VToolBisector : public VToolPoint
|
class VToolBisector : public VToolLinePoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||||
|
@ -17,17 +17,12 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile();
|
virtual void FullUpdateFromFile();
|
||||||
virtual void FullUpdateFromGui(int result);
|
virtual void FullUpdateFromGui(int result);
|
||||||
virtual void ChangedActivDraw(const QString newName);
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
private:
|
private:
|
||||||
QString typeLine;
|
|
||||||
QString formula;
|
|
||||||
qint64 firstPointId;
|
qint64 firstPointId;
|
||||||
qint64 secondPointId;
|
|
||||||
qint64 thirdPointId;
|
qint64 thirdPointId;
|
||||||
QGraphicsLineItem *mainLine;
|
|
||||||
QSharedPointer<DialogBisector> dialogBisector;
|
QSharedPointer<DialogBisector> dialogBisector;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,26 +4,10 @@
|
||||||
|
|
||||||
#include "../widgets/vmaingraphicsscene.h"
|
#include "../widgets/vmaingraphicsscene.h"
|
||||||
|
|
||||||
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id,
|
VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||||
const QString &typeLine, const QString &formula, const qint32 &angle,
|
const QString &formula, const qint32 &angle, const qint64 &basePointId,
|
||||||
const qint64 &basePointId, Tool::Enum typeCreation,
|
Tool::Enum typeCreation, QGraphicsItem *parent):
|
||||||
QGraphicsItem *parent):VToolPoint(doc, data, id, parent){
|
VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent){
|
||||||
this->typeLine = typeLine;
|
|
||||||
this->formula = formula;
|
|
||||||
this->angle = angle;
|
|
||||||
this->basePointId = basePointId;
|
|
||||||
|
|
||||||
//Лінія, що з'єднує дві точки
|
|
||||||
VPointF basePoint = data->GetPoint(basePointId);
|
|
||||||
VPointF point = data->GetPoint(id);
|
|
||||||
mainLine = new QGraphicsLineItem(QLineF(basePoint.toQPointF(), point.toQPointF()), this);
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
AddToFile();
|
AddToFile();
|
||||||
|
@ -31,27 +15,14 @@ VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolEndLine::FullUpdateFromFile(){
|
void VToolEndLine::FullUpdateFromFile(){
|
||||||
QString name;
|
|
||||||
qreal mx, my;
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if(domElement.isElement()){
|
if(domElement.isElement()){
|
||||||
name = domElement.attribute("name", "");
|
|
||||||
mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4;
|
|
||||||
my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4;
|
|
||||||
typeLine = domElement.attribute("typeLine", "");
|
typeLine = domElement.attribute("typeLine", "");
|
||||||
formula = domElement.attribute("length", "");
|
formula = domElement.attribute("length", "");
|
||||||
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
basePointId = domElement.attribute("basePoint", "").toLongLong();
|
||||||
angle = domElement.attribute("angle", "").toInt();
|
angle = domElement.attribute("angle", "").toInt();
|
||||||
}
|
}
|
||||||
VPointF point = VAbstractTool::data->GetPoint(id);
|
RefreshGeometry();
|
||||||
RefreshGeometry(name, point.x(), point.y(), mx, my);
|
|
||||||
VPointF basePoint = VAbstractTool::data->GetPoint(basePointId);
|
|
||||||
mainLine->setLine(QLineF(basePoint.toQPointF(), point.toQPointF()));
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
|
@ -96,16 +67,6 @@ void VToolEndLine::FullUpdateFromGui(int result){
|
||||||
dialogEndLine.clear();
|
dialogEndLine.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolEndLine::ChangedActivDraw(const QString newName){
|
|
||||||
if(nameActivDraw == newName){
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
} else {
|
|
||||||
mainLine->setPen(QPen(Qt::gray, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolEndLine::AddToFile(){
|
void VToolEndLine::AddToFile(){
|
||||||
VPointF point = VAbstractTool::data->GetPoint(id);
|
VPointF point = VAbstractTool::data->GetPoint(id);
|
||||||
QDomElement domElement = doc->createElement("point");
|
QDomElement domElement = doc->createElement("point");
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
#include "vtoolpoint.h"
|
#include "vtoollinepoint.h"
|
||||||
#include "../dialogs/dialogendline.h"
|
#include "../dialogs/dialogendline.h"
|
||||||
|
|
||||||
class VToolEndLine : public VToolPoint
|
class VToolEndLine : public VToolLinePoint
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -17,16 +17,10 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile();
|
virtual void FullUpdateFromFile();
|
||||||
virtual void FullUpdateFromGui(int result);
|
virtual void FullUpdateFromGui(int result);
|
||||||
virtual void ChangedActivDraw(const QString newName);
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
private:
|
private:
|
||||||
QString typeLine;
|
|
||||||
QString formula;
|
|
||||||
qint32 angle;
|
|
||||||
qint64 basePointId;
|
|
||||||
QGraphicsLineItem *mainLine;
|
|
||||||
QSharedPointer<DialogEndLine> dialogEndLine;
|
QSharedPointer<DialogEndLine> dialogEndLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
85
tools/vtoollineintersect.cpp
Normal file
85
tools/vtoollineintersect.cpp
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
#include "vtoollineintersect.h"
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
|
VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
|
const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2,
|
||||||
|
const qint64 &p2Line2, Tool::Enum typeCreation, QGraphicsItem *parent):
|
||||||
|
VToolPoint(doc, data, id, parent){
|
||||||
|
this->p1Line1 = p1Line1;
|
||||||
|
this->p2Line1 = p2Line1;
|
||||||
|
this->p1Line2 = p1Line2;
|
||||||
|
this->p2Line2 = p2Line2;
|
||||||
|
if(typeCreation == Tool::FromGui){
|
||||||
|
AddToFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolLineIntersect::FullUpdateFromFile(){
|
||||||
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if(domElement.isElement()){
|
||||||
|
p1Line1 = domElement.attribute("p1Line1", "").toLongLong();
|
||||||
|
p2Line1 = domElement.attribute("p2Line1", "").toLongLong();
|
||||||
|
p1Line2 = domElement.attribute("p1Line2", "").toLongLong();
|
||||||
|
p2Line2 = domElement.attribute("p2Line2", "").toLongLong();
|
||||||
|
}
|
||||||
|
RefreshGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolLineIntersect::FullUpdateFromGui(int result){
|
||||||
|
if(result == QDialog::Accepted){
|
||||||
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
|
if(domElement.isElement()){
|
||||||
|
domElement.setAttribute("name", dialogLineIntersect->getPointName());
|
||||||
|
domElement.setAttribute("p1Line1", QString().setNum(dialogLineIntersect->getP1Line1()));
|
||||||
|
domElement.setAttribute("p2Line1", QString().setNum(dialogLineIntersect->getP2Line1()));
|
||||||
|
domElement.setAttribute("p1Line2", QString().setNum(dialogLineIntersect->getP1Line2()));
|
||||||
|
domElement.setAttribute("p2Line2", QString().setNum(dialogLineIntersect->getP2Line2()));
|
||||||
|
emit FullUpdateTree();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogLineIntersect.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
|
if(!ignoreContextMenuEvent){
|
||||||
|
QMenu menu;
|
||||||
|
QAction *actionOption = menu.addAction("Властивості");
|
||||||
|
QAction *selectedAction = menu.exec(event->screenPos());
|
||||||
|
if(selectedAction == actionOption){
|
||||||
|
dialogLineIntersect = QSharedPointer<DialogLineIntersect>(new DialogLineIntersect(VAbstractTool::data));
|
||||||
|
|
||||||
|
connect(qobject_cast< VMainGraphicsScene * >(this->scene()), &VMainGraphicsScene::ChoosedObject,
|
||||||
|
dialogLineIntersect.data(), &DialogLineIntersect::ChoosedPoint);
|
||||||
|
connect(dialogLineIntersect.data(), &DialogLineIntersect::DialogClosed, this,
|
||||||
|
&VToolLineIntersect::FullUpdateFromGui);
|
||||||
|
|
||||||
|
VPointF p = VAbstractTool::data->GetPoint(id);
|
||||||
|
|
||||||
|
dialogLineIntersect->setP1Line1(p1Line1);
|
||||||
|
dialogLineIntersect->setP2Line1(p2Line1);
|
||||||
|
dialogLineIntersect->setP1Line2(p1Line2);
|
||||||
|
dialogLineIntersect->setP2Line2(p2Line2);
|
||||||
|
dialogLineIntersect->setPointName(p.name());
|
||||||
|
|
||||||
|
dialogLineIntersect->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VToolLineIntersect::AddToFile(){
|
||||||
|
VPointF point = VAbstractTool::data->GetPoint(id);
|
||||||
|
QDomElement domElement = doc->createElement("point");
|
||||||
|
|
||||||
|
AddAttribute(domElement, "id", id);
|
||||||
|
AddAttribute(domElement, "type", "lineIntersect");
|
||||||
|
AddAttribute(domElement, "name", point.name());
|
||||||
|
AddAttribute(domElement, "mx", point.mx()/PrintDPI*25.4);
|
||||||
|
AddAttribute(domElement, "my", point.my()/PrintDPI*25.4);
|
||||||
|
|
||||||
|
AddAttribute(domElement, "p1Line1", p1Line1);
|
||||||
|
AddAttribute(domElement, "p2Line1", p2Line1);
|
||||||
|
AddAttribute(domElement, "p1Line2", p1Line2);
|
||||||
|
AddAttribute(domElement, "p2Line2", p2Line2);
|
||||||
|
|
||||||
|
AddToCalculation(domElement);
|
||||||
|
}
|
29
tools/vtoollineintersect.h
Normal file
29
tools/vtoollineintersect.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef VTOOLLINEINTERSECT_H
|
||||||
|
#define VTOOLLINEINTERSECT_H
|
||||||
|
|
||||||
|
#include "vtoolpoint.h"
|
||||||
|
#include "../dialogs/dialoglineintersect.h"
|
||||||
|
|
||||||
|
class VToolLineIntersect:public VToolPoint
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VToolLineIntersect(VDomDocument *doc, VContainer *data,
|
||||||
|
const qint64 &id, const qint64 &p1Line1,
|
||||||
|
const qint64 &p2Line1, const qint64 &p1Line2,
|
||||||
|
const qint64 &p2Line2, Tool::Enum typeCreation,
|
||||||
|
QGraphicsItem * parent = 0);
|
||||||
|
public slots:
|
||||||
|
virtual void FullUpdateFromFile();
|
||||||
|
virtual void FullUpdateFromGui(int result);
|
||||||
|
protected:
|
||||||
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
|
virtual void AddToFile();
|
||||||
|
private:
|
||||||
|
qint64 p1Line1;
|
||||||
|
qint64 p2Line1;
|
||||||
|
qint64 p1Line2;
|
||||||
|
qint64 p2Line2;
|
||||||
|
QSharedPointer<DialogLineIntersect> dialogLineIntersect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VTOOLLINEINTERSECT_H
|
|
@ -1,16 +1,17 @@
|
||||||
#include "vtoollinepoint.h"
|
#include "vtoollinepoint.h"
|
||||||
|
|
||||||
VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||||
const QString &formula, const qint64 &pointId, const qint32 &angle,
|
const QString &formula, const qint64 &basePointId, const qint32 &angle,
|
||||||
QGraphicsItem *parent):VToolPoint(doc, data, id, parent){
|
QGraphicsItem *parent):VToolPoint(doc, data, id, parent){
|
||||||
this->typeLine = typeLine;
|
this->typeLine = typeLine;
|
||||||
this->formula = formula;
|
this->formula = formula;
|
||||||
this->angle = angle;
|
this->angle = angle;
|
||||||
|
this->basePointId = basePointId;
|
||||||
|
|
||||||
//Лінія, що з'єднує дві точки
|
//Лінія, що з'єднує дві точки
|
||||||
VPointF firstPoint = data->GetPoint(pointId);
|
VPointF point1 = data->GetPoint(basePointId);
|
||||||
VPointF point = data->GetPoint(id);
|
VPointF point2 = data->GetPoint(id);
|
||||||
mainLine = new QGraphicsLineItem(QLineF(firstPoint.toQPointF(), point.toQPointF()), this);
|
mainLine = new QGraphicsLineItem(QLineF(point1.toQPointF(), point2.toQPointF()), this);
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||||
if(typeLine == "none"){
|
if(typeLine == "none"){
|
||||||
|
@ -29,3 +30,15 @@ void VToolLinePoint::ChangedActivDraw(const QString newName){
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
VToolPoint::ChangedActivDraw(newName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VToolLinePoint::RefreshGeometry(){
|
||||||
|
VToolPoint::RefreshGeometry();
|
||||||
|
VPointF point = VAbstractTool::data->GetPoint(id);
|
||||||
|
VPointF basePoint = VAbstractTool::data->GetPoint(basePointId);
|
||||||
|
mainLine->setLine(QLineF(basePoint.toQPointF(), point.toQPointF()));
|
||||||
|
if(typeLine == "none"){
|
||||||
|
mainLine->setVisible(false);
|
||||||
|
} else {
|
||||||
|
mainLine->setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,13 +8,15 @@ class VToolLinePoint : public VToolPoint
|
||||||
public:
|
public:
|
||||||
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
const QString &typeLine, const QString &formula,
|
const QString &typeLine, const QString &formula,
|
||||||
const qint64 &pointId, const qint32 &angle, QGraphicsItem * parent = 0);
|
const qint64 &basePointId, const qint32 &angle, QGraphicsItem * parent = 0);
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChangedActivDraw(const QString newName);
|
virtual void ChangedActivDraw(const QString newName);
|
||||||
|
virtual void RefreshGeometry();
|
||||||
protected:
|
protected:
|
||||||
QString typeLine;
|
QString typeLine;
|
||||||
QString formula;
|
QString formula;
|
||||||
qint32 angle;
|
qint32 angle;
|
||||||
|
qint64 basePointId;
|
||||||
QGraphicsLineItem *mainLine;
|
QGraphicsLineItem *mainLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,25 +4,9 @@
|
||||||
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine,
|
||||||
const QString &formula, const qint32 &angle, const qint64 &firstPointId,
|
const QString &formula, const qint32 &angle, const qint64 &firstPointId,
|
||||||
const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem *parent):
|
const qint64 &secondPointId, Tool::Enum typeCreation, QGraphicsItem *parent):
|
||||||
VToolPoint(doc, data, id, parent){
|
VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent){
|
||||||
this->typeLine = typeLine;
|
|
||||||
this->formula = formula;
|
|
||||||
this->angle = angle;
|
|
||||||
this->firstPointId = firstPointId;
|
|
||||||
this->secondPointId = secondPointId;
|
this->secondPointId = secondPointId;
|
||||||
|
|
||||||
//Лінія, що з'єднує дві точки
|
|
||||||
VPointF firstPoint = data->GetPoint(firstPointId);
|
|
||||||
VPointF point = data->GetPoint(id);
|
|
||||||
mainLine = new QGraphicsLineItem(QLineF(firstPoint.toQPointF(), point.toQPointF()), this);
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
AddToFile();
|
AddToFile();
|
||||||
}
|
}
|
||||||
|
@ -39,28 +23,15 @@ QPointF VToolNormal::FindPoint(const QPointF &firstPoint, const QPointF &secondP
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolNormal::FullUpdateFromFile(){
|
void VToolNormal::FullUpdateFromFile(){
|
||||||
QString name;
|
|
||||||
qreal mx, my;
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if(domElement.isElement()){
|
if(domElement.isElement()){
|
||||||
name = domElement.attribute("name", "");
|
|
||||||
mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4;
|
|
||||||
my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4;
|
|
||||||
typeLine = domElement.attribute("typeLine", "");
|
typeLine = domElement.attribute("typeLine", "");
|
||||||
formula = domElement.attribute("length", "");
|
formula = domElement.attribute("length", "");
|
||||||
firstPointId = domElement.attribute("firstPoint", "").toLongLong();
|
basePointId = domElement.attribute("firstPoint", "").toLongLong();
|
||||||
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
secondPointId = domElement.attribute("secondPoint", "").toLongLong();
|
||||||
angle = domElement.attribute("angle", "").toInt();
|
angle = domElement.attribute("angle", "").toInt();
|
||||||
}
|
}
|
||||||
VPointF point = VAbstractTool::data->GetPoint(id);
|
RefreshGeometry();
|
||||||
RefreshGeometry(name, point.x(), point.y(), mx, my);
|
|
||||||
VPointF firstPoint = VAbstractTool::data->GetPoint(firstPointId);
|
|
||||||
mainLine->setLine(QLineF(firstPoint.toQPointF(), point.toQPointF()));
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolNormal::FullUpdateFromGui(int result){
|
void VToolNormal::FullUpdateFromGui(int result){
|
||||||
|
@ -79,16 +50,6 @@ void VToolNormal::FullUpdateFromGui(int result){
|
||||||
dialogNormal.clear();
|
dialogNormal.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolNormal::ChangedActivDraw(const QString newName){
|
|
||||||
if(nameActivDraw == newName){
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
} else {
|
|
||||||
mainLine->setPen(QPen(Qt::gray, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
if(!ignoreContextMenuEvent){
|
if(!ignoreContextMenuEvent){
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
@ -108,7 +69,7 @@ void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
dialogNormal->setTypeLine(typeLine);
|
dialogNormal->setTypeLine(typeLine);
|
||||||
dialogNormal->setFormula(formula);
|
dialogNormal->setFormula(formula);
|
||||||
dialogNormal->setAngle(angle);
|
dialogNormal->setAngle(angle);
|
||||||
dialogNormal->setFirstPointId(firstPointId);
|
dialogNormal->setFirstPointId(basePointId);
|
||||||
dialogNormal->setSecondPointId(secondPointId);
|
dialogNormal->setSecondPointId(secondPointId);
|
||||||
dialogNormal->setPointName(p.name());
|
dialogNormal->setPointName(p.name());
|
||||||
|
|
||||||
|
@ -130,7 +91,7 @@ void VToolNormal::AddToFile(){
|
||||||
AddAttribute(domElement, "typeLine", typeLine);
|
AddAttribute(domElement, "typeLine", typeLine);
|
||||||
AddAttribute(domElement, "length", formula);
|
AddAttribute(domElement, "length", formula);
|
||||||
AddAttribute(domElement, "angle", angle);
|
AddAttribute(domElement, "angle", angle);
|
||||||
AddAttribute(domElement, "firstPoint", firstPointId);
|
AddAttribute(domElement, "firstPoint", basePointId);
|
||||||
AddAttribute(domElement, "secondPoint", secondPointId);
|
AddAttribute(domElement, "secondPoint", secondPointId);
|
||||||
|
|
||||||
AddToCalculation(domElement);
|
AddToCalculation(domElement);
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
#include "vtoolpoint.h"
|
#include "vtoollinepoint.h"
|
||||||
#include "../dialogs/dialognormal.h"
|
#include "../dialogs/dialognormal.h"
|
||||||
|
|
||||||
class VToolNormal : public VToolPoint
|
class VToolNormal : public VToolLinePoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
|
VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
|
@ -19,17 +19,11 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile();
|
virtual void FullUpdateFromFile();
|
||||||
virtual void FullUpdateFromGui(int result);
|
virtual void FullUpdateFromGui(int result);
|
||||||
virtual void ChangedActivDraw(const QString newName);
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
private:
|
private:
|
||||||
QString typeLine;
|
|
||||||
QString formula;
|
|
||||||
qint32 angle;
|
|
||||||
qint64 firstPointId;
|
|
||||||
qint64 secondPointId;
|
qint64 secondPointId;
|
||||||
QGraphicsLineItem *mainLine;
|
|
||||||
QSharedPointer<DialogNormal> dialogNormal;
|
QSharedPointer<DialogNormal> dialogNormal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -192,15 +192,15 @@ void VToolPoint::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ){
|
||||||
QGraphicsItem::mouseReleaseEvent(event);
|
QGraphicsItem::mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolPoint::RefreshGeometry(const QString &name, const qreal &x, const qreal &y, const qreal &mx,
|
void VToolPoint::RefreshGeometry(){
|
||||||
const qreal &my){
|
VPointF point = VAbstractTool::data->GetPoint(id);
|
||||||
QRectF rec = QRectF(x, y, radius*2, radius*2);
|
QRectF rec = QRectF(point.x(), point.y(), radius*2, radius*2);
|
||||||
rec.translate(x-rec.center().x(), y-rec.center().y());
|
rec.translate(point.x()-rec.center().x(), point.y()-rec.center().y());
|
||||||
this->setRect(rec);
|
this->setRect(rec);
|
||||||
|
|
||||||
rec = this->rect();
|
rec = this->rect();
|
||||||
namePoint->setText(name);
|
namePoint->setText(point.name());
|
||||||
namePoint->setPos(QPointF(rec.center().x()+mx, rec.center().y()+my));
|
namePoint->setPos(QPointF(rec.center().x()+point.mx(), rec.center().y()+point.my()));
|
||||||
|
|
||||||
RefreshLine();
|
RefreshLine();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,7 @@ protected:
|
||||||
VGraphicsSimpleTextItem *namePoint;
|
VGraphicsSimpleTextItem *namePoint;
|
||||||
QGraphicsLineItem *lineName;
|
QGraphicsLineItem *lineName;
|
||||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
||||||
void RefreshGeometry(const QString &name, const qreal &x, const qreal &y,
|
virtual void RefreshGeometry();
|
||||||
const qreal &mx, const qreal &my);
|
|
||||||
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -5,24 +5,11 @@
|
||||||
VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
const QString &typeLine, const QString &formula, const qint64 &p1Line,
|
const QString &typeLine, const QString &formula, const qint64 &p1Line,
|
||||||
const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation,
|
const qint64 &p2Line, const qint64 &pShoulder, Tool::Enum typeCreation,
|
||||||
QGraphicsItem * parent):VToolPoint(doc, data, id, parent){
|
QGraphicsItem * parent):
|
||||||
this->typeLine = typeLine;
|
VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent){
|
||||||
this->formula = formula;
|
|
||||||
this->p1Line = p1Line;
|
|
||||||
this->p2Line = p2Line;
|
this->p2Line = p2Line;
|
||||||
this->pShoulder = pShoulder;
|
this->pShoulder = pShoulder;
|
||||||
|
|
||||||
//Лінія, що з'єднує дві точки
|
|
||||||
VPointF p1L = data->GetPoint(p1Line);
|
|
||||||
VPointF point = data->GetPoint(id);
|
|
||||||
mainLine = new QGraphicsLineItem(QLineF(p1L.toQPointF(), point.toQPointF()), this);
|
|
||||||
mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeCreation == Tool::FromGui){
|
if(typeCreation == Tool::FromGui){
|
||||||
AddToFile();
|
AddToFile();
|
||||||
}
|
}
|
||||||
|
@ -51,28 +38,15 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolShoulderPoint::FullUpdateFromFile(){
|
void VToolShoulderPoint::FullUpdateFromFile(){
|
||||||
QString name;
|
|
||||||
qreal mx, my;
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
QDomElement domElement = doc->elementById(QString().setNum(id));
|
||||||
if(domElement.isElement()){
|
if(domElement.isElement()){
|
||||||
name = domElement.attribute("name", "");
|
|
||||||
mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4;
|
|
||||||
my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4;
|
|
||||||
typeLine = domElement.attribute("typeLine", "");
|
typeLine = domElement.attribute("typeLine", "");
|
||||||
formula = domElement.attribute("length", "");
|
formula = domElement.attribute("length", "");
|
||||||
p1Line = domElement.attribute("p1Line", "").toLongLong();
|
basePointId = domElement.attribute("p1Line", "").toLongLong();
|
||||||
p2Line = domElement.attribute("p2Line", "").toLongLong();
|
p2Line = domElement.attribute("p2Line", "").toLongLong();
|
||||||
pShoulder = domElement.attribute("pShoulder", "").toLongLong();
|
pShoulder = domElement.attribute("pShoulder", "").toLongLong();
|
||||||
}
|
}
|
||||||
VPointF point = VAbstractTool::data->GetPoint(id);
|
RefreshGeometry();
|
||||||
RefreshGeometry(name, point.x(), point.y(), mx, my);
|
|
||||||
VPointF p1L = VAbstractTool::data->GetPoint(p1Line);
|
|
||||||
mainLine->setLine(QLineF(p1L.toQPointF(), point.toQPointF()));
|
|
||||||
if(typeLine == "none"){
|
|
||||||
mainLine->setVisible(false);
|
|
||||||
} else {
|
|
||||||
mainLine->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolShoulderPoint::FullUpdateFromGui(int result){
|
void VToolShoulderPoint::FullUpdateFromGui(int result){
|
||||||
|
@ -91,16 +65,6 @@ void VToolShoulderPoint::FullUpdateFromGui(int result){
|
||||||
dialogShoulderPoint.clear();
|
dialogShoulderPoint.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolShoulderPoint::ChangedActivDraw(const QString newName){
|
|
||||||
if(nameActivDraw == newName){
|
|
||||||
mainLine->setPen(QPen(Qt::black, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
} else {
|
|
||||||
mainLine->setPen(QPen(Qt::gray, widthHairLine));
|
|
||||||
VToolPoint::ChangedActivDraw(newName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event){
|
||||||
if(!ignoreContextMenuEvent){
|
if(!ignoreContextMenuEvent){
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
@ -114,13 +78,14 @@ void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
dialogShoulderPoint.data(), &DialogShoulderPoint::ChoosedPoint);
|
dialogShoulderPoint.data(), &DialogShoulderPoint::ChoosedPoint);
|
||||||
connect(dialogShoulderPoint.data(), &DialogShoulderPoint::DialogClosed, this,
|
connect(dialogShoulderPoint.data(), &DialogShoulderPoint::DialogClosed, this,
|
||||||
&VToolShoulderPoint::FullUpdateFromGui);
|
&VToolShoulderPoint::FullUpdateFromGui);
|
||||||
connect(doc, &VDomDocument::FullUpdateFromFile, dialogShoulderPoint.data(), &DialogShoulderPoint::UpdateList);
|
connect(doc, &VDomDocument::FullUpdateFromFile, dialogShoulderPoint.data(),
|
||||||
|
&DialogShoulderPoint::UpdateList);
|
||||||
|
|
||||||
VPointF p = VAbstractTool::data->GetPoint(id);
|
VPointF p = VAbstractTool::data->GetPoint(id);
|
||||||
|
|
||||||
dialogShoulderPoint->setTypeLine(typeLine);
|
dialogShoulderPoint->setTypeLine(typeLine);
|
||||||
dialogShoulderPoint->setFormula(formula);
|
dialogShoulderPoint->setFormula(formula);
|
||||||
dialogShoulderPoint->setP1Line(p1Line);
|
dialogShoulderPoint->setP1Line(basePointId);
|
||||||
dialogShoulderPoint->setP2Line(p2Line);
|
dialogShoulderPoint->setP2Line(p2Line);
|
||||||
dialogShoulderPoint->setPShoulder(pShoulder);
|
dialogShoulderPoint->setPShoulder(pShoulder);
|
||||||
dialogShoulderPoint->setPointName(p.name());
|
dialogShoulderPoint->setPointName(p.name());
|
||||||
|
@ -142,7 +107,7 @@ void VToolShoulderPoint::AddToFile(){
|
||||||
|
|
||||||
AddAttribute(domElement, "typeLine", typeLine);
|
AddAttribute(domElement, "typeLine", typeLine);
|
||||||
AddAttribute(domElement, "length", formula);
|
AddAttribute(domElement, "length", formula);
|
||||||
AddAttribute(domElement, "p1Line", p1Line);
|
AddAttribute(domElement, "p1Line", basePointId);
|
||||||
AddAttribute(domElement, "p2Line", p2Line);
|
AddAttribute(domElement, "p2Line", p2Line);
|
||||||
AddAttribute(domElement, "pShoulder", pShoulder);
|
AddAttribute(domElement, "pShoulder", pShoulder);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef VTOOLSHOULDERPOINT_H
|
#ifndef VTOOLSHOULDERPOINT_H
|
||||||
#define VTOOLSHOULDERPOINT_H
|
#define VTOOLSHOULDERPOINT_H
|
||||||
|
|
||||||
#include "vtoolpoint.h"
|
#include "vtoollinepoint.h"
|
||||||
#include "../dialogs/dialogshoulderpoint.h"
|
#include "../dialogs/dialogshoulderpoint.h"
|
||||||
|
|
||||||
class VToolShoulderPoint : public VToolPoint
|
class VToolShoulderPoint : public VToolLinePoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id,
|
||||||
|
@ -16,17 +16,12 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile();
|
virtual void FullUpdateFromFile();
|
||||||
virtual void FullUpdateFromGui(int result);
|
virtual void FullUpdateFromGui(int result);
|
||||||
virtual void ChangedActivDraw(const QString newName);
|
|
||||||
protected:
|
protected:
|
||||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||||
virtual void AddToFile();
|
virtual void AddToFile();
|
||||||
private:
|
private:
|
||||||
QString typeLine;
|
|
||||||
QString formula;
|
|
||||||
qint64 p1Line;
|
|
||||||
qint64 p2Line;
|
qint64 p2Line;
|
||||||
qint64 pShoulder;
|
qint64 pShoulder;
|
||||||
QGraphicsLineItem *mainLine;
|
|
||||||
QSharedPointer<DialogShoulderPoint> dialogShoulderPoint;
|
QSharedPointer<DialogShoulderPoint> dialogShoulderPoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -63,15 +63,5 @@ void VToolSimplePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event
|
||||||
}
|
}
|
||||||
|
|
||||||
void VToolSimplePoint::FullUpdateFromFile(){
|
void VToolSimplePoint::FullUpdateFromFile(){
|
||||||
QString name;
|
RefreshGeometry();
|
||||||
qreal x, y, mx, my;
|
|
||||||
QDomElement domElement = doc->elementById(QString().setNum(id));
|
|
||||||
if(domElement.isElement()){
|
|
||||||
name = domElement.attribute("name", "");
|
|
||||||
x = domElement.attribute("x", "").toDouble()*PrintDPI/25.4;
|
|
||||||
y = domElement.attribute("y", "").toDouble()*PrintDPI/25.4;
|
|
||||||
mx = domElement.attribute("mx", "").toDouble()*PrintDPI/25.4;
|
|
||||||
my = domElement.attribute("my", "").toDouble()*PrintDPI/25.4;
|
|
||||||
}
|
|
||||||
RefreshGeometry(name, x, y, mx, my);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "../tools/vtoolshoulderpoint.h"
|
#include "../tools/vtoolshoulderpoint.h"
|
||||||
#include "../tools/vtoolnormal.h"
|
#include "../tools/vtoolnormal.h"
|
||||||
#include "../tools/vtoolbisector.h"
|
#include "../tools/vtoolbisector.h"
|
||||||
|
#include "../tools/vtoollineintersect.h"
|
||||||
#include "../options.h"
|
#include "../options.h"
|
||||||
#include "../container/calculator.h"
|
#include "../container/calculator.h"
|
||||||
|
|
||||||
|
@ -571,6 +572,50 @@ void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElemen
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(type == "lineIntersect"){
|
||||||
|
if(!domElement.isNull()){
|
||||||
|
QString name;
|
||||||
|
qreal mx=5, my=10;
|
||||||
|
qint64 id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id;
|
||||||
|
if(!domElement.isNull()){
|
||||||
|
id = domElement.attribute("id", "").toLongLong();
|
||||||
|
name = domElement.attribute("name", "");
|
||||||
|
mx = domElement.attribute("mx","").toDouble()*PrintDPI/25.4;
|
||||||
|
my = domElement.attribute("my","").toDouble()*PrintDPI/25.4;
|
||||||
|
|
||||||
|
p1Line1Id = domElement.attribute("p1Line1", "").toLongLong();
|
||||||
|
p2Line1Id = domElement.attribute("p2Line1", "").toLongLong();
|
||||||
|
p1Line2Id = domElement.attribute("p1Line2", "").toLongLong();
|
||||||
|
p2Line2Id = domElement.attribute("p2Line2", "").toLongLong();
|
||||||
|
|
||||||
|
VPointF p1Line1 = data->GetPoint(p1Line1Id);
|
||||||
|
VPointF p2Line1 = data->GetPoint(p2Line1Id);
|
||||||
|
VPointF p1Line2 = data->GetPoint(p1Line2Id);
|
||||||
|
VPointF p2Line2 = data->GetPoint(p2Line2Id);
|
||||||
|
|
||||||
|
QLineF line1(p1Line1, p2Line1);
|
||||||
|
QLineF line2(p1Line2, p2Line2);
|
||||||
|
QPointF fPoint;
|
||||||
|
QLineF::IntersectType intersect = line1.intersect(line2, &fPoint);
|
||||||
|
if(intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection){
|
||||||
|
data->UpdatePoint(id, VPointF(fPoint.x(), fPoint.y(), name, mx, my));
|
||||||
|
data->AddLine(p1Line1Id, id);
|
||||||
|
data->AddLine(id, p2Line1Id);
|
||||||
|
data->AddLine(p1Line2Id, id);
|
||||||
|
data->AddLine(id, p2Line2Id);
|
||||||
|
if(parse == Document::FullParse){
|
||||||
|
VToolLineIntersect *point = new VToolLineIntersect(this, data, id, p1Line1Id,
|
||||||
|
p2Line1Id, p1Line2Id,
|
||||||
|
p2Line2Id, Tool::FromGui);
|
||||||
|
scene->addItem(point);
|
||||||
|
connect(point, &VToolLineIntersect::ChoosedPoint, scene,
|
||||||
|
&VMainGraphicsScene::ChoosedItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user