146 lines
3.2 KiB
C++
146 lines
3.2 KiB
C++
|
#include "vvodsectotvet.h"
|
|||
|
#include "ui_vvodsectotvet.h"
|
|||
|
|
|||
|
vvodSectOtvet::vvodSectOtvet(QWidget *parent) :
|
|||
|
QDialog(parent),
|
|||
|
ui(new Ui::vvodSectOtvet)
|
|||
|
{
|
|||
|
ui->setupUi(this);
|
|||
|
setAttribute(Qt::WA_DeleteOnClose);
|
|||
|
Widget *w = (Widget*)parent;
|
|||
|
|
|||
|
hide();
|
|||
|
|
|||
|
n_Ab = 0;
|
|||
|
vvodnomera vv(parent);
|
|||
|
vv.setAbMax(6);
|
|||
|
vv.setAbMin(1);
|
|||
|
vv.exec();
|
|||
|
|
|||
|
n_Ab = vv.result();
|
|||
|
|
|||
|
if (n_Ab<1)
|
|||
|
{
|
|||
|
|
|||
|
vv.close();
|
|||
|
this->close();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
w->changeOpenWidget(this, 1);
|
|||
|
ui->lineEdit->setText(QString::number(n_Ab));
|
|||
|
ui->lineEdit->setEnabled(0);
|
|||
|
obj = ((Widget*)parent)->grObj.at(n_Ab);
|
|||
|
|
|||
|
if (obj->priznakSektor)
|
|||
|
{
|
|||
|
ui->lineEdit_2->setText(QString::number(obj->angle1));
|
|||
|
ui->lineEdit_3->setText(QString::number(obj->angle2));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
ui->comboBox->setCurrentIndex(obj->alt_n);
|
|||
|
if (obj->alt_n==3) {
|
|||
|
ui->lineEdit_4->setEnabled(true);
|
|||
|
ui->lineEdit_5->setEnabled(true);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
vvodSectOtvet::~vvodSectOtvet()
|
|||
|
{
|
|||
|
delete ui;
|
|||
|
}
|
|||
|
|
|||
|
void vvodSectOtvet::closeEvent(QCloseEvent *event)
|
|||
|
{
|
|||
|
((Widget*)parent())->clearOpenWidget();
|
|||
|
event->accept();
|
|||
|
}
|
|||
|
|
|||
|
void vvodSectOtvet::on_pushButton_2_clicked()
|
|||
|
{
|
|||
|
close();
|
|||
|
}
|
|||
|
|
|||
|
void vvodSectOtvet::on_pushButton_clicked()
|
|||
|
{
|
|||
|
|
|||
|
if (ui->checkBox_2->isChecked())
|
|||
|
{
|
|||
|
obj->setPriznakSektor(false);
|
|||
|
((Widget*)parent())->addLogText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD> > %1 ZZ 99 '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ").arg(n_Ab));
|
|||
|
// ((Widget*)parent())->sendCU(n_Ab, 99);
|
|||
|
((Widget*)parent())->sendKRU(n_Ab,0); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (ui->checkBox->isChecked())
|
|||
|
{
|
|||
|
|
|||
|
if (ui->comboBox->currentIndex())
|
|||
|
((Widget*)parent())->addLogText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD> > %1 ZZ 66 '<27><><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>) <20><><EFBFBD>. <20><> <20>' ").arg(n_Ab));
|
|||
|
else
|
|||
|
((Widget*)parent())->addLogText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD> > %1 ZZ 77 '<27><><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD> <20><><EFBFBD>. <20><> <20>' ").arg(n_Ab));
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
obj->setSektor(ui->lineEdit_2->text().toDouble(), ui->lineEdit_3->text().toDouble());
|
|||
|
|
|||
|
obj->setOgrH( ui->comboBox->currentIndex(), ui->lineEdit_4->text().toDouble(), ui->lineEdit_5->text().toDouble());
|
|||
|
|
|||
|
obj->setPriznakSektor();
|
|||
|
|
|||
|
if (ui->comboBox->currentIndex())
|
|||
|
((Widget*)parent())->sendCU(n_Ab, 66);
|
|||
|
else
|
|||
|
((Widget*)parent())->sendCU(n_Ab, 77);
|
|||
|
|
|||
|
|
|||
|
((Widget*)parent())->sendKRU(n_Ab,1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
((Widget*)parent())->writeGroundOpt();
|
|||
|
|
|||
|
close();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void vvodSectOtvet::on_comboBox_activated(int index)
|
|||
|
{
|
|||
|
if (ui->comboBox->currentIndex() == 3)
|
|||
|
{
|
|||
|
ui->lineEdit_4->setEnabled(true);
|
|||
|
ui->lineEdit_5->setEnabled(true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ui->lineEdit_4->setEnabled(false);
|
|||
|
ui->lineEdit_5->setEnabled(false);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void vvodSectOtvet::setAngles(QPointF pf)
|
|||
|
{
|
|||
|
static bool curCounter = false;
|
|||
|
|
|||
|
QPointF p0 = obj->getPos();
|
|||
|
QLineF lf = QLineF(p0,pf);
|
|||
|
qreal an = 90-lf.angle();
|
|||
|
if (an<0) an+=360;
|
|||
|
|
|||
|
if (curCounter)
|
|||
|
ui->lineEdit_3->setText(QString::number(int(an)));
|
|||
|
else
|
|||
|
ui->lineEdit_2->setText(QString::number(int(an)));
|
|||
|
|
|||
|
|
|||
|
|
|||
|
curCounter = !curCounter;
|
|||
|
}
|