测量,表格移动到地图里面显示

This commit is contained in:
hm
2022-05-09 12:10:07 +08:00
parent 88a06f464e
commit a9a4c0f975
11 changed files with 478 additions and 403 deletions
Binary file not shown.
+44 -30
View File
@@ -78,22 +78,22 @@ Please first select the area of the map to rip with <CTRL>+Left mouse clic
<context>
<name>mapcontrol::OPMapWidget</name>
<message>
<location filename="mapwidget/opmapwidget.cpp" line="174"/>
<location filename="mapwidget/opmapwidget.cpp" line="172"/>
<source>.plan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mapwidget/opmapwidget.cpp" line="2106"/>
<location filename="mapwidget/opmapwidget.cpp" line="2132"/>
<source>%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mapwidget/opmapwidget.cpp" line="2282"/>
<location filename="mapwidget/opmapwidget.cpp" line="2322"/>
<source>%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mapwidget/opmapwidget.cpp" line="2306"/>
<location filename="mapwidget/opmapwidget.cpp" line="2346"/>
<source>recieve way point group:%1 seq:%2</source>
<translation type="unfinished"></translation>
</message>
@@ -119,66 +119,80 @@ Please first select the area of the map to rip with &lt;CTRL&gt;+Left mouse clic
<context>
<name>mapcontrol::WayPointSetting</name>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="28"/>
<source>Load</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="36"/>
<source>Save</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="45"/>
<source>Upload</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="52"/>
<source>Download</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="60"/>
<source>insert</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="67"/>
<source>delete</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="76"/>
<source>last</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="83"/>
<source>next</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="92"/>
<source>ruler</source>
<translation type="vanished"></translation>
</message>
<message>
<source>table</source>
<translation type="vanished">线</translation>
</message>
<message>
<source>Group</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="128"/>
<location filename="mapwidget/waypointsetting.cpp" line="131"/>
<location filename="mapwidget/waypointsetting.cpp" line="137"/>
<source>Tip</source>
<translation></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="133"/>
<source>ShowTip</source>
<translation></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="144"/>
<location filename="mapwidget/waypointsetting.cpp" line="275"/>
<source>Measure</source>
<translation></translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="99"/>
<source>table</source>
<location filename="mapwidget/waypointsetting.cpp" line="155"/>
<source>Table</source>
<translation>线</translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="210"/>
<location filename="mapwidget/waypointsetting.cpp" line="223"/>
<source>Selete Way Point File...</source>
<translation type="unfinished"></translation>
<translation type="vanished">线...</translation>
</message>
<message>
<location filename="mapwidget/waypointsetting.cpp" line="212"/>
<location filename="mapwidget/waypointsetting.cpp" line="225"/>
<source>plan file (*.plan)</source>
<translation type="unfinished"></translation>
<location filename="mapwidget/waypointsetting.cpp" line="271"/>
<source>Measuring</source>
<translation></translation>
</message>
</context>
</TS>
+41 -17
View File
@@ -106,7 +106,7 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
/*
connect(waypointsetting,SIGNAL(WPDelete()),
this,SLOT(WPDelete()));
@@ -127,6 +127,7 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
connect(waypointsetting,SIGNAL(searchall()),
this,SLOT(WPsearchall()));
*/
connect(waypointsetting,SIGNAL(WPRuler()),
this,SLOT(ruler_clicked()));
@@ -134,6 +135,8 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
connect(waypointsetting,SIGNAL(WPTable()),
this,SLOT(table_clicked()));
connect(this,SIGNAL(measureState(bool)),
waypointsetting,SLOT(measureState(bool)));
//missiontable = new MissionDialog();
@@ -219,6 +222,8 @@ void OPMapWidget::ruler_clicked(void)
void OPMapWidget::table_clicked(void)
{
emit settableClicked();
/*
if(missiontable)
{
@@ -591,16 +596,19 @@ void OPMapWidget::mouseMoveEvent(QMouseEvent *event)
}
//一个区域内禁止生成
/*
if(waypointsetting)
{
if((event->pos().x() > waypointsetting->x())&&(event->pos().x() < (waypointsetting->boundingRect().width() + waypointsetting->x())) &&
(event->pos().y() > waypointsetting->y())&&(event->pos().y() < (waypointsetting->boundingRect().height() + waypointsetting->y())))//在按键区域禁止生成航点
if(waypointsetting->isVisible())
{
return;
if((event->pos().x() > waypointsetting->x())&&(event->pos().x() < (waypointsetting->boundingRect().width() + waypointsetting->x())) &&
(event->pos().y() > waypointsetting->y())&&(event->pos().y() < (waypointsetting->boundingRect().height() + waypointsetting->y())))//在按键区域禁止生成航点
{
return;
}
}
}
*/
QPointF p = event->pos();
@@ -656,16 +664,19 @@ void OPMapWidget::mousePressEvent(QMouseEvent *event)
}
//一个区域内禁止生成
/*
if(waypointsetting)
{
if((event->pos().x() > waypointsetting->x())&&(event->pos().x() < (waypointsetting->boundingRect().width() + waypointsetting->x())) &&
(event->pos().y() > waypointsetting->y())&&(event->pos().y() < (waypointsetting->boundingRect().height() + waypointsetting->y())))//在按键区域禁止生成航点
if(waypointsetting->isVisible())
{
return;
if((event->pos().x() > waypointsetting->x())&&(event->pos().x() < (waypointsetting->boundingRect().width() + waypointsetting->x())) &&
(event->pos().y() > waypointsetting->y())&&(event->pos().y() < (waypointsetting->boundingRect().height() + waypointsetting->y())))//在按键区域禁止生成航点
{
return;
}
}
}
*/
if(event->button() == Qt::LeftButton)
{
@@ -760,16 +771,19 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
}
//一个区域内禁止生成
/*
if(waypointsetting)
{
if((event->pos().x() > waypointsetting->x())&&(event->pos().x() < (waypointsetting->boundingRect().width() + waypointsetting->x())) &&
(event->pos().y() > waypointsetting->y())&&(event->pos().y() < (waypointsetting->boundingRect().height() + waypointsetting->y())))//在按键区域禁止生成航点
if(waypointsetting->isVisible())
{
return;
if((event->pos().x() > waypointsetting->x())&&(event->pos().x() < (waypointsetting->boundingRect().width() + waypointsetting->x())) &&
(event->pos().y() > waypointsetting->y())&&(event->pos().y() < (waypointsetting->boundingRect().height() + waypointsetting->y())))//在按键区域禁止生成航点
{
return;
}
}
}
*/
@@ -1643,7 +1657,7 @@ void OPMapWidget::setWPCreate(bool const & value)
{
if(value)
{
//waypointsetting->show();
waypointsetting->show();
}
else
{
@@ -2149,6 +2163,15 @@ void OPMapWidget::groupchanged(int value)
else//飞行界面
{
qDebug() << "show current group" << currentMissionType;
if(currentMissionType > 6)
{
return;
}
//一下这里判断有问题,有bug
/*
//将不是当前的全部变成灰色,当前的显示
foreach(QGraphicsItem * i, map->childItems()) {
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
@@ -2204,6 +2227,7 @@ void OPMapWidget::groupchanged(int value)
}
}
}
*/
}
+3
View File
@@ -527,6 +527,9 @@ protected:
// private slots:
signals:
void settableClicked(void);
void showMessage(const QString &message,int TimeOut = 0);
//map property
+96 -91
View File
@@ -21,90 +21,150 @@ WayPointSetting::WayPointSetting(MapGraphicItem *map, QColor background) : myMap
this->setZValue(7);
/*
btn_load = new WayPointButton(map);
btn_load->setParentItem(this);
btn_load->setGeometry(10,10,80,80);
btn_load->setText(tr("Load"));
connect(btn_load,&WayPointButton::clicked,
this,&WayPointSetting::load_clicked);
connect(btn_load,&WayPointButton::clicked,[=]()
{
QFileDialog *dlg = new QFileDialog();
QString fileName = dlg->getOpenFileName(nullptr, tr("Selete Way Point File..."),
"./plan/",
tr("plan file (*.plan)"));
if(!fileName.isEmpty())
{
emit WPLoad(fileName);
}
});
btn_save = new WayPointButton(map);
btn_save->setParentItem(this);
btn_save->setGeometry(110,10,80,80);
btn_save->setText(tr("Save"));
connect(btn_save,&WayPointButton::clicked,
this,&WayPointSetting::save_clicked);
connect(btn_save,&WayPointButton::clicked,[=]()
{
QFileDialog *dlg = new QFileDialog();
QString fileName = dlg->getSaveFileName(nullptr, tr("Selete Way Point File..."),
"./plan/",
tr("plan file (*.plan)"));
if(!fileName.isEmpty())
{
emit WPSave(fileName);
}
});
btn_upload = new WayPointButton(map);
btn_upload->setParentItem(this);
btn_upload->setGeometry(10,100,80,80);
btn_upload->setText(tr("Upload"));
connect(btn_upload,&WayPointButton::clicked,
this,&WayPointSetting::upload_clicked);
connect(btn_upload,&WayPointButton::clicked,[=]()
{
emit WPUpload();
});
btn_download = new WayPointButton(map);
btn_download->setParentItem(this);
btn_download->setGeometry(110,100,80,80);
btn_download->setText(tr("Download"));
connect(btn_download,&WayPointButton::clicked,
this,&WayPointSetting::download_clicked);
connect(btn_download,&WayPointButton::clicked,[=]()
{
emit WPDownload();
});
btn_insert = new WayPointButton(map);
btn_insert->setParentItem(this);
btn_insert->setGeometry(10,190,80,80);
btn_insert->setText(tr("insert"));
connect(btn_insert,&WayPointButton::clicked,
this,&WayPointSetting::insert_clicked);
connect(btn_insert,&WayPointButton::clicked,[=]()
{
emit WPInsert();
});
btn_delete = new WayPointButton(map);
btn_delete->setParentItem(this);
btn_delete->setGeometry(110,190,80,80);
btn_delete->setText(tr("delete"));
connect(btn_delete,&WayPointButton::clicked,
this,&WayPointSetting::delete_clicked);
connect(btn_delete,&WayPointButton::clicked,[=]()
{
emit WPDelete();
});
btn_last = new WayPointButton(map);
btn_last->setParentItem(this);
btn_last->setGeometry(10,280,80,80);
btn_last->setText(tr("last"));
connect(btn_last,&WayPointButton::clicked,
this,&WayPointSetting::last_clicked);
connect(btn_last,&WayPointButton::clicked,[=]()
{
emit WPnearPoint(-1);
});
btn_next = new WayPointButton(map);
btn_next->setParentItem(this);
btn_next->setGeometry(110,280,80,80);
btn_next->setText(tr("next"));
connect(btn_next,&WayPointButton::clicked,
this,&WayPointSetting::next_clicked);
connect(btn_next,&WayPointButton::clicked,[=]()
{
emit WPnearPoint(+1);
});
btn_group = new WayPointButton(map);
btn_group->setParentItem(this);
btn_group->setGeometry(10,10,80,80);
btn_group->setText(tr("Group"));
connect(btn_group,&WayPointButton::clicked,[=]()
{
});
*/
btn_tip = new WayPointButton(map);
btn_tip->setParentItem(this);
btn_tip->setGeometry(10,10,80,80);
btn_tip->setText(tr("Tip"));
connect(btn_tip,&WayPointButton::clicked,[=]()
{
if(btn_tip->Text() == tr("Tip"))
{
btn_tip->setText(tr("ShowTip"));
}
else
{
btn_tip->setText(tr("Tip"));
}
});
btn_ruler = new WayPointButton(map);
btn_ruler->setParentItem(this);
btn_ruler->setGeometry(10,370,80,80);
btn_ruler->setText(tr("ruler"));
connect(btn_ruler,&WayPointButton::clicked,
this,&WayPointSetting::ruler_clicked);
btn_ruler->setGeometry(10,100,80,80);
btn_ruler->setText(tr("Measure"));
connect(btn_ruler,&WayPointButton::clicked,[=](){
btn_ruler->setHighLight((btn_ruler->HighLight())?(false):(true));
emit WPRuler();
});
btn_table = new WayPointButton(map);
btn_table->setParentItem(this);
btn_table->setGeometry(110,370,80,80);
btn_table->setText(tr("table"));
connect(btn_table,&WayPointButton::clicked,
this,&WayPointSetting::table_clicked);
btn_table->setGeometry(10,190,80,80);
btn_table->setText(tr("Table"));
connect(btn_table,&WayPointButton::clicked,[=](){
btn_table->setHighLight((btn_table->HighLight())?(false):(true));
emit WPTable();
});
}
QRectF WayPointSetting::boundingRect() const //鼠标可以操作的大小
{
return QRectF(0,0,200,460);
return QRectF(0,0,100,280);
}
void WayPointSetting::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
@@ -204,73 +264,18 @@ void WayPointSetting::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Q_UNUSED(event)
}
void WayPointSetting::load_clicked(void)
void WayPointSetting::measureState(bool flag)
{
QFileDialog *dlg = new QFileDialog();
QString fileName = dlg->getOpenFileName(nullptr, tr("Selete Way Point File..."),
"./plan/",
tr("plan file (*.plan)"));
if(!fileName.isEmpty())
if(flag == true)
{
emit WPLoad(fileName);
btn_ruler->setText(tr("Measuring"));
}
else
{
btn_ruler->setText(tr("Measure"));
}
}
void WayPointSetting::save_clicked(void)
{
QFileDialog *dlg = new QFileDialog();
QString fileName = dlg->getSaveFileName(nullptr, tr("Selete Way Point File..."),
"./plan/",
tr("plan file (*.plan)"));
if(!fileName.isEmpty())
{
emit WPSave(fileName);
}
}
void WayPointSetting::upload_clicked(void)
{
emit WPUpload();
}
void WayPointSetting::download_clicked(void)
{
emit WPDownload();
}
void WayPointSetting::insert_clicked(void)
{
emit WPInsert();
}
void WayPointSetting::delete_clicked(void)
{
emit WPDelete();
}
void WayPointSetting::last_clicked(void)
{
emit WPnearPoint(-1);//选中减一
}
void WayPointSetting::next_clicked(void)
{
emit WPnearPoint(+1);//选中点加一
}
void WayPointSetting::ruler_clicked(void)
{
btn_ruler->setHighLight((btn_ruler->HighLight())?(false):(true));
emit WPRuler();
}
void WayPointSetting::table_clicked(void)
{
btn_table->setHighLight((btn_table->HighLight())?(false):(true));
emit WPTable();
}
}
+8 -2
View File
@@ -145,6 +145,11 @@ private:
WayPointButton *btn_last;
WayPointButton *btn_next;
WayPointButton *btn_group;
WayPointButton *btn_tip;
WayPointButton *btn_ruler;
WayPointButton *btn_table;
@@ -190,6 +195,7 @@ protected:
public slots:
/*
void load_clicked(void);
void save_clicked(void);
void upload_clicked(void);
@@ -198,12 +204,12 @@ public slots:
void delete_clicked(void);
void last_clicked(void);
void next_clicked(void);
void ruler_clicked(void);
void table_clicked(void);
*/
void RefreshPos();
void setOpacitySlot(qreal opacity);
void measureState(bool flag);
};