可以添加多条测量线
This commit is contained in:
@@ -281,20 +281,20 @@ propertyui::propertyui(QWidget *parent) :
|
|||||||
|
|
||||||
void propertyui::closeMissionDialog(bool flag)
|
void propertyui::closeMissionDialog(bool flag)
|
||||||
{
|
{
|
||||||
if(flag == true)
|
// if(flag == true)
|
||||||
{
|
// {
|
||||||
if(table)
|
// if(table)
|
||||||
{
|
// {
|
||||||
table->hide();
|
// table->hide();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(ruler)
|
// if(ruler)
|
||||||
{
|
// {
|
||||||
emit exitRuler();
|
// emit exitRuler();
|
||||||
ruler->deleteLater();
|
// ruler->deleteLater();
|
||||||
ruler = nullptr;
|
// ruler = nullptr;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void propertyui::clearLayout(QLayout *layout)
|
void propertyui::clearLayout(QLayout *layout)
|
||||||
@@ -1121,10 +1121,10 @@ propertyui::~propertyui()
|
|||||||
table->deleteLater();
|
table->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ruler)
|
// if(ruler)
|
||||||
{
|
// {
|
||||||
ruler->deleteLater();
|
// ruler->deleteLater();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
@@ -2308,6 +2308,7 @@ void propertyui::measureState(bool flag)
|
|||||||
|
|
||||||
void propertyui::on_pushButton_Ruler_clicked()
|
void propertyui::on_pushButton_Ruler_clicked()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if(ruler)
|
if(ruler)
|
||||||
{
|
{
|
||||||
ruler->deleteLater();
|
ruler->deleteLater();
|
||||||
@@ -2340,7 +2341,7 @@ void propertyui::on_pushButton_Ruler_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void propertyui::on_pushButton_Table_clicked()
|
void propertyui::on_pushButton_Table_clicked()
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ private:
|
|||||||
Ui::propertyui *ui;
|
Ui::propertyui *ui;
|
||||||
|
|
||||||
MissionUI *table = nullptr;
|
MissionUI *table = nullptr;
|
||||||
RuleDialog *ruler = nullptr;
|
// RuleDialog *ruler = nullptr;
|
||||||
|
|
||||||
|
|
||||||
QByteArray allBytes;
|
QByteArray allBytes;
|
||||||
|
|||||||
@@ -166,13 +166,13 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
|
|||||||
point_end.SetLat(1);
|
point_end.SetLat(1);
|
||||||
point_end.SetLng(1);
|
point_end.SetLng(1);
|
||||||
|
|
||||||
measureline = new MeasureLine(point_begin, point_end, map, QColor("#FFFF00"));
|
// measureline = new MeasureLine(point_begin, point_end, map, QColor("#FFFF00"));
|
||||||
mscene.addItem(measureline);
|
// mscene.addItem(measureline);
|
||||||
measureline->hide();
|
// measureline->hide();
|
||||||
|
|
||||||
|
|
||||||
connect(measureline,SIGNAL(Lineinfo(qreal,qreal)),
|
// connect(measureline,SIGNAL(Lineinfo(qreal,qreal)),
|
||||||
this,SIGNAL(Lineinfo(qreal,qreal)));
|
// this,SIGNAL(Lineinfo(qreal,qreal)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -219,6 +219,16 @@ void OPMapWidget::dropEvent(QDropEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapWidget::cleanMeasureLineList()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < measureline_list.size(); ++i)
|
||||||
|
{
|
||||||
|
measureline_list[i]->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
measureline_list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void OPMapWidget::cancelSaveMap()
|
void OPMapWidget::cancelSaveMap()
|
||||||
{
|
{
|
||||||
if(!mapGrades.empty() )
|
if(!mapGrades.empty() )
|
||||||
@@ -262,12 +272,13 @@ void OPMapWidget::ruler_clicked(void)
|
|||||||
if(isMeasure)
|
if(isMeasure)
|
||||||
{
|
{
|
||||||
isMeasure = false;
|
isMeasure = false;
|
||||||
|
cleanMeasureLineList(); //清除测量线
|
||||||
//this->setCursor(Qt::ArrowCursor);
|
//this->setCursor(Qt::ArrowCursor);
|
||||||
if(measureline)
|
// if(measureline)
|
||||||
{
|
// {
|
||||||
measureline->hide();
|
// measureline->hide();
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(map)
|
if(map)
|
||||||
{
|
{
|
||||||
@@ -287,10 +298,10 @@ void OPMapWidget::ruler_clicked(void)
|
|||||||
isMeasure = true;
|
isMeasure = true;
|
||||||
measurenumber = 1;//开始记录
|
measurenumber = 1;//开始记录
|
||||||
|
|
||||||
if(measureline)
|
// if(measureline)
|
||||||
{
|
// {
|
||||||
measureline->show();
|
// measureline->show();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(map)
|
if(map)
|
||||||
{
|
{
|
||||||
@@ -409,6 +420,30 @@ void OPMapWidget::NOPTimeout()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapWidget::keyReleaseEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if(event->key() == Qt::Key_Control)
|
||||||
|
{
|
||||||
|
is_press_ctrl = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPMapWidget::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if(event->key() == Qt::Key_Control)
|
||||||
|
{
|
||||||
|
is_press_ctrl = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event->key() == Qt::Key_M)
|
||||||
|
{
|
||||||
|
if(is_press_ctrl)
|
||||||
|
{
|
||||||
|
ruler_clicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPMapWidget::SetCurrentPosition()
|
void OPMapWidget::SetCurrentPosition()
|
||||||
{
|
{
|
||||||
@@ -668,6 +703,8 @@ OPMapWidget::~OPMapWidget()
|
|||||||
rippers[i]->deleteLater();
|
rippers[i]->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanMeasureLineList(); //清除测量线
|
||||||
}
|
}
|
||||||
void OPMapWidget::closeEvent(QCloseEvent *event)
|
void OPMapWidget::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
@@ -737,12 +774,13 @@ void OPMapWidget::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
emit mousePosition(point_end.Lat(),point_end.Lng());
|
emit mousePosition(point_end.Lat(),point_end.Lng());
|
||||||
|
|
||||||
if(measureline)
|
if(measureline_list.size() )
|
||||||
{
|
{
|
||||||
if(measurenumber == 2)//取了第一个点后
|
if(measurenumber == 2)//取了第一个点后
|
||||||
{
|
{
|
||||||
emit MeasurePosition(measurenumber,point_end.Lat(),point_end.Lng());
|
// emit MeasurePosition(measurenumber,point_end.Lat(),point_end.Lng());
|
||||||
measureline->setTo(point_end);
|
// measureline->setTo(point_end);
|
||||||
|
measureline_list[measureline_list.size() - 1]->setTo(point_end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -799,13 +837,16 @@ void OPMapWidget::mousePressEvent(QMouseEvent *event)
|
|||||||
point_begin = map->FromLocalToLatLng(p.x(), p.y());
|
point_begin = map->FromLocalToLatLng(p.x(), p.y());
|
||||||
|
|
||||||
|
|
||||||
emit MeasurePosition(measurenumber,point_begin.Lat(),point_begin.Lng());
|
// emit MeasurePosition(measurenumber,point_begin.Lat(),point_begin.Lng());
|
||||||
measurenumber ++;
|
measurenumber ++;
|
||||||
|
|
||||||
if(measureline)
|
MeasureLine *_measureline = new MeasureLine(point_begin, point_end, map, QColor("#FFFF00"));
|
||||||
{
|
measureline_list.push_back(_measureline);
|
||||||
measureline->setFrom(point_begin);
|
|
||||||
}
|
// if(measureline)
|
||||||
|
// {
|
||||||
|
// measureline->setFrom(point_begin);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -814,13 +855,14 @@ void OPMapWidget::mousePressEvent(QMouseEvent *event)
|
|||||||
point_end = map->FromLocalToLatLng(p.x(), p.y());
|
point_end = map->FromLocalToLatLng(p.x(), p.y());
|
||||||
|
|
||||||
|
|
||||||
emit MeasurePosition(measurenumber,point_end.Lat(),point_end.Lng());
|
// emit MeasurePosition(measurenumber,point_end.Lat(),point_end.Lng());
|
||||||
measurenumber = 1;
|
measurenumber = 1;
|
||||||
|
measureline_list[measureline_list.size() - 1]->setTo(point_end);
|
||||||
|
|
||||||
if(measureline)
|
// if(measureline)
|
||||||
{
|
// {
|
||||||
measureline->setTo(point_end);
|
// measureline->setTo(point_end);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ public:
|
|||||||
AltitudeItem *altitudeitem;
|
AltitudeItem *altitudeitem;
|
||||||
|
|
||||||
WayPointSetting *waypointsetting;
|
WayPointSetting *waypointsetting;
|
||||||
|
QList<MeasureLine*> measureline_list;
|
||||||
MeasureLine *measureline = nullptr;
|
MeasureLine *measureline = nullptr;
|
||||||
|
|
||||||
int currentGroup = 3;//编辑情况
|
int currentGroup = 3;//编辑情况
|
||||||
@@ -471,6 +471,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool is_press_ctrl = false; //是否按下ctrl键
|
||||||
//当前正在运行的地图缓存线程
|
//当前正在运行的地图缓存线程
|
||||||
QList<MapRipper *> rippers;
|
QList<MapRipper *> rippers;
|
||||||
//当前正在运行的地图缓存线程
|
//当前正在运行的地图缓存线程
|
||||||
@@ -538,6 +539,8 @@ private slots:
|
|||||||
void NOPTimeout();
|
void NOPTimeout();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyReleaseEvent(QKeyEvent *event) override;
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
void showEvent(QShowEvent *event);
|
void showEvent(QShowEvent *event);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
@@ -739,6 +742,10 @@ signals:
|
|||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
/**
|
||||||
|
* @brief 清除测量线
|
||||||
|
*/
|
||||||
|
void cleanMeasureLineList();
|
||||||
/**
|
/**
|
||||||
* @brief 取消缓存地图
|
* @brief 取消缓存地图
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user