围栏可以从文件导入
This commit is contained in:
@@ -42,6 +42,15 @@ CommandUI::CommandUI(QWidget *parent) :
|
||||
connect(DoubleClickTimer,SIGNAL(timeout()),
|
||||
this,SLOT(DoubleClickTimeout()));
|
||||
|
||||
|
||||
ui->comboBox_group->addItem(tr("Group 1"),3);
|
||||
ui->comboBox_group->addItem(tr("Group 2"),4);
|
||||
ui->comboBox_group->addItem(tr("Group 3"),5);
|
||||
ui->comboBox_group->addItem(tr("Group 4"),6);
|
||||
ui->comboBox_group->setCurrentIndex(0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
CommandUI::~CommandUI()
|
||||
@@ -689,16 +698,24 @@ void CommandUI::commandAccepted(bool flag,uint16_t command,uint8_t result)
|
||||
|
||||
void CommandUI::setCurrent(QVariant value)
|
||||
{
|
||||
/*
|
||||
if(value.toBool() == true)
|
||||
{
|
||||
emit showMessage(tr("设置航点 %1").arg(m_currentSeq));
|
||||
|
||||
emit SetCurrentPoint(m_currentSeq);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void CommandUI::missionConfirm(int seq)
|
||||
{
|
||||
if(isCofirmShow == true)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentSeq = seq;
|
||||
|
||||
//根据这个comfirm 确定要输入的参数
|
||||
@@ -708,10 +725,22 @@ void CommandUI::missionConfirm(int seq)
|
||||
//设置警告界面
|
||||
confirmor->setNotice(tr("click confirm to set Point %1 as current point").arg(seq));
|
||||
|
||||
connect(confirmor,SIGNAL(confirmValue(QVariant)),
|
||||
this,SLOT(setCurrent(QVariant)));
|
||||
connect(confirmor,&Confirm::confirmValue,[=](QVariant value){
|
||||
if(value.toBool() == true)
|
||||
{
|
||||
emit showMessage(tr("设置航点 %1").arg(m_currentSeq));
|
||||
emit SetCurrentPoint(m_currentSeq);
|
||||
}
|
||||
isCofirmShow = false;
|
||||
});
|
||||
|
||||
connect(confirmor,&Confirm::destroyed,[=](){
|
||||
isCofirmShow = false;
|
||||
});
|
||||
|
||||
confirmor->show();
|
||||
isCofirmShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -747,7 +776,7 @@ void CommandUI::setPointCount(QList<int> nums)
|
||||
|
||||
foreach (int i, nums)
|
||||
{
|
||||
ui->comboBox_seq->addItem(QString::number(i),i);
|
||||
ui->comboBox_seq->addItem(tr("point:") + QString::number(i),i);
|
||||
}
|
||||
ui->comboBox_seq->setCurrentIndex(0);
|
||||
|
||||
@@ -805,3 +834,8 @@ void CommandUI::on_pushButton_setUAV_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CommandUI::on_comboBox_group_currentIndexChanged(int index)
|
||||
{
|
||||
emit getAllPoint(ui->comboBox_group->currentData().toInt());
|
||||
}
|
||||
|
||||
@@ -104,6 +104,8 @@ signals:
|
||||
void searchallUav(void);
|
||||
*/
|
||||
|
||||
void getAllPoint(int);
|
||||
|
||||
private slots:
|
||||
void updateUI(void);
|
||||
|
||||
@@ -123,6 +125,8 @@ private slots:
|
||||
|
||||
void on_pushButton_setUAV_clicked();
|
||||
|
||||
void on_comboBox_group_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
|
||||
const char* _spacingJsonKey = "spacing";
|
||||
@@ -194,6 +198,10 @@ private:
|
||||
int m_currentSys = 1;
|
||||
int m_currentComp = 1;
|
||||
|
||||
bool isCofirmShow = false;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // COMMANDUI_H
|
||||
|
||||
+10
-29
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<width>457</width>
|
||||
<height>348</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -31,21 +31,10 @@
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>无人机</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_uav"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_setUAV">
|
||||
<property name="text">
|
||||
<string>切换无人机</string>
|
||||
@@ -56,27 +45,19 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>航点</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_seq"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton_setSeq">
|
||||
<property name="text">
|
||||
<string>切换航点</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBox_group"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_seq"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
|
||||
Binary file not shown.
+63
-51
@@ -499,15 +499,10 @@
|
||||
<translation>请不要操作过快,上一个指令未发送完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CommandUI/CommandUI.cpp" line="694"/>
|
||||
<location filename="CommandUI/CommandUI.cpp" line="727"/>
|
||||
<source>设置航点 %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CommandUI/CommandUI.cpp" line="799"/>
|
||||
<source>click confirm to set uav %1 as current</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 accepted and executed</source>
|
||||
<translation type="vanished">%1 执行成功</translation>
|
||||
@@ -533,7 +528,7 @@
|
||||
<translation type="vanished">%1 正在执行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="CommandUI/CommandUI.cpp" line="709"/>
|
||||
<location filename="CommandUI/CommandUI.cpp" line="717"/>
|
||||
<source>click confirm to set Point %1 as current point</source>
|
||||
<translation>点击设置航点%1为当前航点</translation>
|
||||
</message>
|
||||
@@ -2746,68 +2741,68 @@
|
||||
<translation>界面</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="45"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="30"/>
|
||||
<source>save</source>
|
||||
<translation>保存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="52"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="33"/>
|
||||
<source>insert</source>
|
||||
<translation>插入</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="59"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="31"/>
|
||||
<source>upload</source>
|
||||
<translation>上传</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="66"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="36"/>
|
||||
<source>add</source>
|
||||
<translation>增加</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="73"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="32"/>
|
||||
<source>download</source>
|
||||
<oldsource>downlload</oldsource>
|
||||
<translation>下载</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="80"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="29"/>
|
||||
<source>load</source>
|
||||
<translation>打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="87"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="34"/>
|
||||
<source>delete</source>
|
||||
<translation>删除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="98"/>
|
||||
<location filename="MissionUI/MissionUI.ui" line="27"/>
|
||||
<source>Rectangle</source>
|
||||
<translation>围栏</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="234"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="35"/>
|
||||
<source>clean</source>
|
||||
<translation>清空</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="124"/>
|
||||
<location filename="MissionUI/MissionUI.ui" line="53"/>
|
||||
<source>Mission 1</source>
|
||||
<translation>航线1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="153"/>
|
||||
<location filename="MissionUI/MissionUI.ui" line="82"/>
|
||||
<source>Mssion 2</source>
|
||||
<translation>航线2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="179"/>
|
||||
<location filename="MissionUI/MissionUI.ui" line="108"/>
|
||||
<source>Mssion 3</source>
|
||||
<translation>航线3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.ui" line="205"/>
|
||||
<location filename="MissionUI/MissionUI.ui" line="134"/>
|
||||
<source>Mission 4</source>
|
||||
<translation>航线4</translation>
|
||||
</message>
|
||||
@@ -2837,113 +2832,130 @@
|
||||
<translation type="vanished">起飞</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>number</source>
|
||||
<translation>航点</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>command</source>
|
||||
<translation>类型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>par1</source>
|
||||
<translation>参数1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>par2</source>
|
||||
<translation>参数2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>par3</source>
|
||||
<translation>参数3</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>par4</source>
|
||||
<translation>参数4</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="264"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>lat</source>
|
||||
<translation>纬度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="264"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>lng</source>
|
||||
<translation>经度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="63"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="264"/>
|
||||
<source>group</source>
|
||||
<translation>组别</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="264"/>
|
||||
<source>inclusion</source>
|
||||
<translation>包含</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="264"/>
|
||||
<source>par</source>
|
||||
<translation>参数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="307"/>
|
||||
<source>alt</source>
|
||||
<translation>海拔</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="141"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="583"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="380"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="653"/>
|
||||
<source>航点</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="144"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="584"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="383"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="654"/>
|
||||
<source>返航</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="147"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="585"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="386"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="655"/>
|
||||
<source>降落</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="150"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="586"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="389"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="656"/>
|
||||
<source>起飞</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="163"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="608"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="402"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="678"/>
|
||||
<source>保持</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="166"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="609"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="405"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="679"/>
|
||||
<source>表速</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="169"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="610"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="408"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="680"/>
|
||||
<source>快升</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="172"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="611"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="411"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="681"/>
|
||||
<source>开加力</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="175"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="612"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="414"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="682"/>
|
||||
<source>关加力</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="313"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="326"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="62"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="73"/>
|
||||
<source>Selete Way Point File...</source>
|
||||
<translation>选择载入文件...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="315"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="328"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="64"/>
|
||||
<location filename="MissionUI/MissionUI.cpp" line="75"/>
|
||||
<source>plan file (*.plan)</source>
|
||||
<translation>任务文件 (*.plan)</translation>
|
||||
</message>
|
||||
|
||||
@@ -243,7 +243,42 @@ MissionUI::MissionUI(QWidget *parent) :
|
||||
{
|
||||
if(tablelist.key(table) == 1)//围栏
|
||||
{
|
||||
continue;
|
||||
table->setColumnCount(5); //设置列数为7
|
||||
table->setGeometry(QRect(10,455,740,95)); //设置tableWidget的大小
|
||||
table->setSelectionBehavior(QAbstractItemView::SelectRows);//设置选中模式为选中行
|
||||
table->setSelectionMode ( QAbstractItemView::SingleSelection); //设置选择模式,选择单行
|
||||
table->setAlternatingRowColors(true);
|
||||
table->setEditTriggers(QAbstractItemView::NoEditTriggers);//不能编辑
|
||||
table->setMouseTracking(true);
|
||||
table->setFocus();
|
||||
table->setFocusPolicy(Qt::StrongFocus);
|
||||
table->setStyleSheet("QTableWidget::item:selected { background-color: rgb(85, 255, 127); color: rgb(255, 255, 255); } ");
|
||||
|
||||
table->setColumnWidth(0,200); //设置第1列的列宽(group)
|
||||
table->setColumnWidth(1,200); //设置第2列的列宽(par1)
|
||||
table->setColumnWidth(2,150); //设置第3列的列宽(par2)
|
||||
table->setColumnWidth(3,150); //设置第4列的列宽(lat)
|
||||
table->setColumnWidth(4,150); //设置第5列的列宽(lng)
|
||||
|
||||
|
||||
table->setHorizontalHeaderLabels(QStringList() <<tr("group")<<tr("inclusion")<<tr("par")<<tr("lat")<<tr("lng"));
|
||||
QHeaderView* V_headerView = table->verticalHeader();
|
||||
V_headerView->setHidden(true); //行名隐藏
|
||||
|
||||
QHeaderView* H_headerView = table->horizontalHeader();
|
||||
H_headerView->setDefaultAlignment(Qt::AlignLeft); //表头信息显示居中靠左
|
||||
H_headerView->setHighlightSections(false); //不高亮选中内容的所在列标题
|
||||
H_headerView->setStretchLastSection(true);
|
||||
|
||||
|
||||
connect(table,&QTableWidget::itemSelectionChanged,
|
||||
this,&MissionUI::itemSelectionChanged);
|
||||
|
||||
connect(table,&QTableWidget::itemDoubleClicked,
|
||||
this,&MissionUI::itemDoubleClicked);
|
||||
|
||||
connect(table,&QTableWidget::itemClicked,
|
||||
this,&MissionUI::itemClicked);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+2
-1
@@ -463,7 +463,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(commandUI,SIGNAL(SetCurrentPoint(int)),
|
||||
dlink->mavlinknode->Mission,SLOT(SetCurrentPoint(int)),Qt::DirectConnection);
|
||||
|
||||
|
||||
connect(commandUI,SIGNAL(getAllPoint(int)),
|
||||
map,SLOT(find_PointNumber(int)));
|
||||
|
||||
|
||||
connect(dlink->mavlinknode->Mission,SIGNAL(currentPoint(int)),
|
||||
|
||||
+31
-18
@@ -83,17 +83,27 @@ Please first select the area of the map to rip with <CTRL>+Left mouse clic
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2147"/>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2170"/>
|
||||
<source>开始上传航点,总数%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2337"/>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2385"/>
|
||||
<source>上传失败%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2361"/>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2411"/>
|
||||
<source>polygons</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2414"/>
|
||||
<source>circles</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2422"/>
|
||||
<source>recieve way point group:%1 seq:%2</source>
|
||||
<translation>收到航点:第%1组,第%2点</translation>
|
||||
</message>
|
||||
@@ -119,86 +129,89 @@ Please first select the area of the map to rip with <CTRL>+Left mouse clic
|
||||
<context>
|
||||
<name>mapcontrol::WayPointItem</name>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="373"/>
|
||||
<source>waypoint </source>
|
||||
<translation>航点 </translation>
|
||||
<translation type="vanished">航点 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="376"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="389"/>
|
||||
<source>return </source>
|
||||
<translation>返航 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="379"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="392"/>
|
||||
<source>landing </source>
|
||||
<translation>降落 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="382"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="395"/>
|
||||
<source>takeoff </source>
|
||||
<translation>起飞 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="385"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="398"/>
|
||||
<source>unknow </source>
|
||||
<translation>未知类型 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="393"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="406"/>
|
||||
<source>hold
|
||||
</source>
|
||||
<translation>保持
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="396"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="410"/>
|
||||
<source>cas
|
||||
</source>
|
||||
<translation>表速
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="399"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="414"/>
|
||||
<source>Vz
|
||||
</source>
|
||||
<translation>快升
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="402"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="418"/>
|
||||
<source>onAB
|
||||
</source>
|
||||
<translation>开加力
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="405"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="422"/>
|
||||
<source>offAB
|
||||
</source>
|
||||
<translation>关加力
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="408"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="426"/>
|
||||
<source>unknow
|
||||
</source>
|
||||
<translation>未知指令
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="414"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="433"/>
|
||||
<source>
|
||||
</source>
|
||||
<translation>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="417"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="411"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="415"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="419"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="423"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="427"/>
|
||||
<source>Speed: %1m/s</source>
|
||||
<translation>速度:%1m/s</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="418"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="436"/>
|
||||
<source>Height: %1m
|
||||
%2</source>
|
||||
<translation>高度:%1m
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#include "geoFencecircle.h"
|
||||
#include <QDateTime>
|
||||
namespace mapcontrol {
|
||||
geoFencecircle::geoFencecircle(int g, int count, int index, bool inclusion, geoFenceitem *center, double radius, QBrush color, MapGraphicItem *map, bool dashed, int width) :
|
||||
QGraphicsEllipseItem(map),m_center(center), coord(center->coord), m_brush(color), m_map(map),dashed(dashed),lineWidth(width)
|
||||
{
|
||||
|
||||
this->setZValue(3);
|
||||
|
||||
m_inclusion = inclusion;
|
||||
m_radius = radius;
|
||||
m_group = g; //2
|
||||
m_latitude = coord.Lat();//5
|
||||
m_longitide = coord.Lng();//6
|
||||
|
||||
|
||||
connect(center, SIGNAL(localPositionChanged(QPointF, geoFenceitem *)), this, SLOT(refreshLocations()));
|
||||
connect(center, SIGNAL(aboutToBeDeleted(geoFenceitem *)), this, SLOT(waypointdeleted()));
|
||||
refreshLocations();
|
||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||
}
|
||||
|
||||
|
||||
int geoFencecircle::type() const
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
|
||||
void geoFencecircle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
|
||||
painter->setOpacity(0.4);
|
||||
|
||||
QPointF p1;
|
||||
QPointF p2;
|
||||
p1 = QPointF(line.p1().x(), line.p1().y() + line.length());
|
||||
p2 = QPointF(line.p1().x(), line.p1().y() - line.length());
|
||||
QPen myPen = painter->pen();
|
||||
myPen.setWidth(lineWidth);
|
||||
myPen.setColor(m_brush.color());
|
||||
painter->setPen(myPen);
|
||||
|
||||
|
||||
if (dashed) {
|
||||
QVector<qreal> dashes;
|
||||
dashes << 4 << 8;
|
||||
myPen.setDashPattern(dashes);
|
||||
}
|
||||
|
||||
|
||||
painter->translate(-line.length(), -line.length());
|
||||
|
||||
|
||||
if(m_inclusion)
|
||||
{
|
||||
painter->setBrush(m_brush);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
}
|
||||
|
||||
|
||||
painter->drawEllipse(this->rect());
|
||||
}
|
||||
|
||||
void geoFencecircle::refreshLocations()
|
||||
{
|
||||
|
||||
//qDebug() << my_center->pos();
|
||||
|
||||
internals::PointLatLng C;
|
||||
C = m_map->FromLocalToLatLng(m_center->x(),m_center->y());
|
||||
C.SetLat(C.Lat() + m_radius/111133.3333f);
|
||||
|
||||
|
||||
|
||||
line = QLineF(m_center->pos().x(),m_center->pos().y(),m_center->pos().x(),m_map->FromLatLngToLocal(C).Y());
|
||||
this->setRect(m_center->pos().x(), m_center->pos().y(), 2 * line.length(), 2 * line.length());
|
||||
this->update();
|
||||
}
|
||||
|
||||
void geoFencecircle::waypointdeleted()
|
||||
{
|
||||
this->deleteLater();
|
||||
}
|
||||
|
||||
void geoFencecircle::setOpacitySlot(qreal opacity)
|
||||
{
|
||||
setOpacity(opacity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef GEOFENCECIRCLE_H
|
||||
#define GEOFENCECIRCLE_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QPainter>
|
||||
#include <QLabel>
|
||||
#include "pointlatlng.h"
|
||||
#include <QObject>
|
||||
#include "mapgraphicitem.h"
|
||||
#include "geoFenceitem.h"
|
||||
|
||||
namespace mapcontrol {
|
||||
|
||||
#ifdef QtopmapWidget
|
||||
#include <mapwidgetglobal.h>
|
||||
class OPMAPWIDGETSHARED_EXPORT geoFencecircle : public QObject, public QGraphicsEllipseItem {
|
||||
#else
|
||||
class geoFencecircle : public QObject, public QGraphicsEllipseItem {
|
||||
#endif
|
||||
|
||||
Q_OBJECT Q_INTERFACES(QGraphicsItem)
|
||||
public:
|
||||
enum { Type = UserType + 11 };
|
||||
geoFencecircle(int g, int count, int index, bool inclusion, geoFenceitem *center, double radius, QBrush color, MapGraphicItem *map, bool dashed = false, int width = 3);
|
||||
|
||||
int type() const;
|
||||
internals::PointLatLng coord;
|
||||
int number;
|
||||
private:
|
||||
QBrush m_brush;
|
||||
MapGraphicItem *m_map;
|
||||
|
||||
bool m_inclusion = true;
|
||||
qreal m_radius = 0;//1
|
||||
int m_group = 0; //2
|
||||
qreal m_latitude = 0;//5
|
||||
qreal m_longitide = 0;//6
|
||||
|
||||
QLineF line;
|
||||
|
||||
geoFenceitem *m_center;
|
||||
|
||||
|
||||
bool dashed;
|
||||
int lineWidth;
|
||||
|
||||
protected:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
public slots:
|
||||
void refreshLocations();
|
||||
void waypointdeleted();
|
||||
void setOpacitySlot(qreal opacity);
|
||||
|
||||
};
|
||||
}
|
||||
#endif // GEOFENCECIRCLE_H
|
||||
@@ -1,15 +1,20 @@
|
||||
#include "geoFenceitem.h"
|
||||
#include <QDateTime>
|
||||
namespace mapcontrol {
|
||||
geoFenceitem::geoFenceitem(int index, internals::PointLatLng const & coord, int const & altitude, QBrush color, MapGraphicItem *map) : QGraphicsItem(map), number(index) , coord(coord), m_brush(color), m_map(map)
|
||||
geoFenceitem::geoFenceitem(int g, int count, int index, bool inclusion, internals::PointLatLng const & coord, QBrush color, MapGraphicItem *map, bool dashed, int width) :
|
||||
QGraphicsPolygonItem(map), number(index) , coord(coord), m_brush(color), m_map(map), dashed(dashed), lineWidth(width)
|
||||
{
|
||||
//qDebug() << "geoFenceitem:" << index << coord.Lat() << coord.Lng();
|
||||
|
||||
this->setZValue(3);
|
||||
|
||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||
|
||||
//qDebug() << this->pos();
|
||||
|
||||
m_inclusion = inclusion;
|
||||
m_Vertex = count;//1
|
||||
m_group = g; //2
|
||||
m_latitude = coord.Lat();//5
|
||||
m_longitide = coord.Lng();//6
|
||||
|
||||
|
||||
RefreshPos();
|
||||
}
|
||||
|
||||
@@ -18,12 +23,50 @@ void geoFenceitem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
|
||||
painter->setOpacity(0.4);
|
||||
|
||||
QPen myPen = painter->pen();
|
||||
myPen.setWidth(lineWidth);
|
||||
myPen.setColor(m_brush.color());
|
||||
painter->setPen(myPen);
|
||||
|
||||
|
||||
if (dashed) {
|
||||
QVector<qreal> dashes;
|
||||
dashes << 4 << 8;
|
||||
myPen.setDashPattern(dashes);
|
||||
}
|
||||
|
||||
if(m_inclusion)
|
||||
{
|
||||
painter->setBrush(m_brush);
|
||||
painter->drawPoint(0,0);
|
||||
}
|
||||
QRectF geoFenceitem::boundingRect() const
|
||||
{
|
||||
return QRectF(-2, -2, 4, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
}
|
||||
|
||||
painter->drawPoint(0, 0);
|
||||
|
||||
/*
|
||||
QPolygonF polygon;
|
||||
for(internals::PointLatLng p:points)
|
||||
{
|
||||
QPointF pf;
|
||||
pf.setX(m_map->FromLatLngToLocal(p).X());
|
||||
pf.setY(m_map->FromLatLngToLocal(p).Y());
|
||||
polygon.push_back(pf);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
painter->drawPolygon(polygon());
|
||||
|
||||
|
||||
qDebug() << polygon();
|
||||
|
||||
|
||||
}
|
||||
|
||||
int geoFenceitem::type() const
|
||||
@@ -35,6 +78,19 @@ void geoFenceitem::setPosSLOT()
|
||||
{
|
||||
//qDebug() << "virtual set pos";
|
||||
|
||||
QPolygonF polygon;
|
||||
for(internals::PointLatLng LatLng:points)
|
||||
{
|
||||
QPointF pf;
|
||||
pf.setX(m_map->FromLatLngToLocal(LatLng).X() - m_map->FromLatLngToLocal(this->coord).X());
|
||||
pf.setY(m_map->FromLatLngToLocal(LatLng).Y() - m_map->FromLatLngToLocal(this->coord).Y());
|
||||
|
||||
polygon.append(pf);
|
||||
}
|
||||
setPolygon(polygon);
|
||||
|
||||
|
||||
|
||||
setPos(m_map->FromLatLngToLocal(this->coord).X(), m_map->FromLatLngToLocal(this->coord).Y());
|
||||
emit localPositionChanged(this->pos(),this);
|
||||
}
|
||||
@@ -44,6 +100,29 @@ void geoFenceitem::RefreshPos()
|
||||
setPosSLOT();
|
||||
}
|
||||
|
||||
void geoFenceitem::setPoints(QList<internals::PointLatLng> p)
|
||||
{
|
||||
points = p;
|
||||
|
||||
//QPolygonF polygon;
|
||||
/*
|
||||
m_polygon.clear();
|
||||
for(internals::PointLatLng LatLng:points)
|
||||
{
|
||||
QPointF pf;
|
||||
pf.setX(m_map->FromLatLngToLocal(LatLng).X());
|
||||
pf.setY(m_map->FromLatLngToLocal(LatLng).Y());
|
||||
|
||||
m_polygon.append(pf);
|
||||
}
|
||||
setPolygon(m_polygon);
|
||||
|
||||
qDebug() << m_polygon;
|
||||
*/
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,24 +12,41 @@ namespace mapcontrol {
|
||||
|
||||
#ifdef QtopmapWidget
|
||||
#include <mapwidgetglobal.h>
|
||||
class OPMAPWIDGETSHARED_EXPORT geoFenceitem : public QObject, public QGraphicsItem {
|
||||
class OPMAPWIDGETSHARED_EXPORT geoFenceitem : public QObject, public QGraphicsPolygonItem {
|
||||
#else
|
||||
class geoFenceitem : public QObject, public QGraphicsItem {
|
||||
class geoFenceitem : public QObject, public QGraphicsPolygonItem {
|
||||
#endif
|
||||
|
||||
Q_OBJECT Q_INTERFACES(QGraphicsItem)
|
||||
public:
|
||||
enum { Type = UserType + 11 };
|
||||
geoFenceitem(int index,internals::PointLatLng const & coord, int const & altitude, QBrush color, MapGraphicItem *map);
|
||||
enum { Type = UserType + 5 };
|
||||
geoFenceitem(int g,int count,int index, bool inclusion,internals::PointLatLng const & coord, QBrush color, MapGraphicItem *map, bool dashed = false, int width = 3);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget);
|
||||
QRectF boundingRect() const;
|
||||
int type() const;
|
||||
internals::PointLatLng coord;
|
||||
int number;
|
||||
|
||||
|
||||
QList<internals::PointLatLng> points;
|
||||
|
||||
void setPoints(QList<internals::PointLatLng> p);
|
||||
|
||||
private:
|
||||
QBrush m_brush;
|
||||
MapGraphicItem *m_map;
|
||||
|
||||
|
||||
bool m_inclusion = true;
|
||||
qreal m_Vertex = 0;//1
|
||||
int m_group = 0; //2
|
||||
qreal m_latitude = 0;//5
|
||||
qreal m_longitide = 0;//6
|
||||
|
||||
bool dashed;
|
||||
int lineWidth;
|
||||
|
||||
QPolygonF m_polygon;
|
||||
|
||||
public slots:
|
||||
void setPosSLOT();
|
||||
|
||||
|
||||
@@ -15,12 +15,6 @@ geoFenceitemline::geoFenceitemline(geoFenceitem *from, geoFenceitem *to, MapGrap
|
||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||
|
||||
isEdit = true;
|
||||
|
||||
//qDebug() << "virtual line create";
|
||||
|
||||
//qDebug() << this->pos();
|
||||
|
||||
lineWidth = 5;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,47 +35,22 @@ void geoFenceitemline::paint(QPainter *painter, const QStyleOptionGraphicsItem *
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
|
||||
//qDebug() << "virtual line update";
|
||||
|
||||
QPen myPen = pen();
|
||||
|
||||
|
||||
myPen.setColor(myColor);
|
||||
|
||||
|
||||
|
||||
//qreal arrowSize = 10;
|
||||
painter->setPen(myPen);
|
||||
|
||||
/*
|
||||
if(isEdit == false)
|
||||
{
|
||||
painter->setBrush(myColor);
|
||||
}
|
||||
*/
|
||||
|
||||
double angle = ::acos(line().dx() / line().length());
|
||||
if (line().dy() >= 0) {
|
||||
angle = (M_PI * 2) - angle;
|
||||
}
|
||||
|
||||
/*
|
||||
QPointF arrowP1 = line().pointAt(0.5) + QPointF(sin(angle + M_PI / 3) * arrowSize,
|
||||
cos(angle + M_PI / 3) * arrowSize);
|
||||
QPointF arrowP2 = line().pointAt(0.5) + QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize,
|
||||
cos(angle + M_PI - M_PI / 3) * arrowSize);
|
||||
arrowHead.clear();
|
||||
arrowHead << line().pointAt(0.5) << arrowP1 << arrowP2;
|
||||
painter->drawPolygon(arrowHead);
|
||||
*/
|
||||
|
||||
if (dashed) {
|
||||
QVector<qreal> dashes;
|
||||
dashes << 4 << 8;
|
||||
myPen.setDashPattern(dashes);
|
||||
}
|
||||
|
||||
|
||||
myPen.setWidth(lineWidth);
|
||||
|
||||
painter->setPen(myPen);
|
||||
|
||||
@@ -26,7 +26,7 @@ class geoFenceitemline : public QObject, public QGraphicsLineItem {
|
||||
Q_OBJECT Q_INTERFACES(QGraphicsItem)
|
||||
public:
|
||||
enum { Type = UserType + 12 };
|
||||
geoFenceitemline(geoFenceitem *from, geoFenceitem *to, MapGraphicItem *map, QColor color = Qt::green, bool dashed = false, int width = 2);
|
||||
geoFenceitemline(geoFenceitem *from, geoFenceitem *to, MapGraphicItem *map, QColor color = Qt::green, bool dashed = false, int width = 3);
|
||||
int type() const;
|
||||
QPainterPath shape() const;
|
||||
void setColor(const QColor &color)
|
||||
|
||||
@@ -51,6 +51,7 @@ SOURCES += $$PWD/mapgraphicitem.cpp \
|
||||
$$PWD/AltitudeItem.cpp \
|
||||
$$PWD/waypointbutton.cpp \
|
||||
$$PWD/waypointsetting.cpp \
|
||||
geoFencecircle.cpp \
|
||||
geoFenceitem.cpp \
|
||||
geoFenceitemline.cpp \
|
||||
measureline.cpp
|
||||
@@ -74,6 +75,7 @@ HEADERS += $$PWD/mapgraphicitem.h \
|
||||
$$PWD/AltitudeItem.h \
|
||||
$$PWD/waypointbutton.h \
|
||||
$$PWD/waypointsetting.h \
|
||||
geoFencecircle.h \
|
||||
geoFenceitem.h \
|
||||
geoFenceitemline.h \
|
||||
measureline.h
|
||||
|
||||
+259
-46
@@ -242,6 +242,177 @@ void OPMapWidget::table_clicked(void)
|
||||
}
|
||||
*/
|
||||
}
|
||||
/*
|
||||
void OPMapWidget::AddgeoPolygon(int type,int index,double lat,double lng,double alt,QColor color)
|
||||
{
|
||||
qDebug() << "AddVirtualMargin" << type << index;
|
||||
|
||||
internals::PointLatLng LatLng;
|
||||
LatLng.SetLat(lat);
|
||||
LatLng.SetLng(lng);
|
||||
|
||||
QMap<int,VirtualMargin *> virtualmarginmap = VirtualMarginPoints.value(type);
|
||||
QMap<int,VirtualMarginLine *> virtualmarginlinemap = VirtualMarginlinemapLines.value(type);
|
||||
|
||||
|
||||
VirtualMargin *vm = new VirtualMargin(index,LatLng,alt,color,map);
|
||||
virtualmarginmap.insert(index,vm);
|
||||
|
||||
foreach (VirtualMarginLine *l, virtualmarginlinemap) {
|
||||
if(l){
|
||||
disconnect(l,nullptr,nullptr,nullptr);
|
||||
delete l;
|
||||
}
|
||||
}
|
||||
|
||||
virtualmarginlinemap.clear();
|
||||
|
||||
|
||||
for(QMap<int,VirtualMargin *>::iterator i = virtualmarginmap.begin();i != virtualmarginmap.end();++i)
|
||||
{
|
||||
VirtualMargin *v = i.value();
|
||||
if(v)
|
||||
{
|
||||
if(v->number > 0)
|
||||
{
|
||||
VirtualMarginLine *l = new VirtualMarginLine(virtualmarginmap.value(v->number - 1),v,map,color);
|
||||
l->setOpacity(overlayOpacity);
|
||||
l->show();
|
||||
|
||||
virtualmarginlinemap.insert(virtualmarginlinemap.size(),l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(virtualmarginmap.size() >= 2)
|
||||
{
|
||||
VirtualMargin *vm_first = virtualmarginmap.first();
|
||||
VirtualMargin *vm_last = virtualmarginmap.last();
|
||||
|
||||
if((vm_first)&&(vm_last))
|
||||
{
|
||||
VirtualMarginLine *l = new VirtualMarginLine(vm_first,vm_last,map,color);
|
||||
l->setOpacity(overlayOpacity);
|
||||
l->show();
|
||||
|
||||
virtualmarginlinemap.insert(virtualmarginlinemap.size(),l);
|
||||
}
|
||||
}
|
||||
|
||||
VirtualMarginPoints.insert(type,virtualmarginmap);
|
||||
VirtualMarginlinemapLines.insert(type,virtualmarginlinemap);
|
||||
|
||||
//FlushVirtualMargin(type);
|
||||
|
||||
|
||||
foreach (VirtualMargin *v, virtualmarginmap) {
|
||||
qDebug() << "create a virtual point" << v->number;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::ClosegeoPolygon(int type)
|
||||
{
|
||||
if(type == 0)
|
||||
{
|
||||
if(virtualmarginmap_red.size() >= 2)
|
||||
{
|
||||
VirtualMargin *vm_first = virtualmarginmap_red.first();
|
||||
VirtualMargin *vm_last = virtualmarginmap_red.last();
|
||||
|
||||
if((vm_first)&&(vm_last))
|
||||
{
|
||||
VirtualMarginLine *l = new VirtualMarginLine(vm_first,vm_last,map,WarningColor);
|
||||
l->setOpacity(overlayOpacity);
|
||||
l->show();
|
||||
|
||||
virtualmarginlinemap_red.insert(virtualmarginlinemap_red.size(),l);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
if(virtualmarginmap_orange.size() >= 2)
|
||||
{
|
||||
VirtualMargin *vm_first = virtualmarginmap_orange.first();
|
||||
VirtualMargin *vm_last = virtualmarginmap_orange.last();
|
||||
|
||||
if((vm_first)&&(vm_last))
|
||||
{
|
||||
VirtualMarginLine *l = new VirtualMarginLine(vm_first,vm_last,map,NoticeColor);
|
||||
l->setOpacity(overlayOpacity);
|
||||
l->show();
|
||||
|
||||
virtualmarginlinemap_orange.insert(virtualmarginlinemap_orange.size(),l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::RemovegeoPolygon(int type)
|
||||
{
|
||||
|
||||
QMap<int,VirtualMargin*> virtualmarginmap = VirtualMarginPoints.value(type);
|
||||
QMap<int,VirtualMarginLine *> virtualmarginlinemap = VirtualMarginlinemapLines.value(type);
|
||||
|
||||
//移除虚拟边界
|
||||
foreach (VirtualMargin *vm, virtualmarginmap) {
|
||||
if(vm)
|
||||
{
|
||||
qDebug() << "del vm" << vm->number << vm->coord.Lat() << vm->coord.Lng();
|
||||
disconnect(vm,nullptr,nullptr,nullptr);
|
||||
delete vm;
|
||||
}
|
||||
}
|
||||
//从列表删除所有
|
||||
virtualmarginmap.clear();
|
||||
|
||||
//移除虚拟边界
|
||||
foreach (VirtualMarginLine *l, virtualmarginlinemap) {
|
||||
if(l)
|
||||
{
|
||||
disconnect(l,nullptr,nullptr,nullptr);
|
||||
delete l;
|
||||
}
|
||||
}
|
||||
//从列表删除所有
|
||||
virtualmarginlinemap.clear();
|
||||
|
||||
VirtualMarginPoints.remove(type);
|
||||
VirtualMarginlinemapLines.remove(type);
|
||||
|
||||
}
|
||||
|
||||
void OPMapWidget::FlushgeoPolygon(int type)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
for(QMap<int,VirtualMargin *>::iterator i = virtualmarginmap_red.begin();i != virtualmarginmap_red.end();++i)
|
||||
{
|
||||
VirtualMargin *vm = i.value();
|
||||
if(vm)
|
||||
{
|
||||
qDebug() << "vm" << vm->number << vm->coord.Lat() << vm->coord.Lng();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(type == 1)
|
||||
{
|
||||
for(QMap<int,VirtualMargin *>::iterator i = virtualmarginmap_orange.begin();i != virtualmarginmap_orange.end();++i)
|
||||
{
|
||||
VirtualMargin *vm = i.value();
|
||||
if(vm)
|
||||
{
|
||||
qDebug() << "vm" << vm->number << vm->coord.Lat() << vm->coord.Lng();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -819,6 +990,10 @@ void OPMapWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
emit MouseDoubleClickEvent(event);
|
||||
@@ -1337,9 +1512,11 @@ void OPMapWidget::ConnectWP(WayPointItem *item)
|
||||
item, SLOT(setWPProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),Qt::DirectConnection);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
connect(item, SIGNAL(WPProperty(float,float,float,float,int32_t,int32_t,float,uint16_t,uint16_t,uint16_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)),
|
||||
this, SLOT(find_PointNumber()),Qt::DirectConnection);
|
||||
this, SLOT(find_PointNumber(int)),Qt::DirectConnection);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
connect(item, SIGNAL(WPFollowPrevious(bool,WayPointItem*)),
|
||||
@@ -1877,46 +2054,13 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数
|
||||
|
||||
QJsonObject json = doc.object();
|
||||
|
||||
|
||||
/*
|
||||
"circles": [
|
||||
{
|
||||
"circle": {
|
||||
"center": [
|
||||
32.04290131170435,
|
||||
118.81779757301473
|
||||
],
|
||||
"radius": 104.72920614551222
|
||||
},
|
||||
"inclusion": true,
|
||||
"version": 1
|
||||
},
|
||||
{
|
||||
"circle": {
|
||||
"center": [
|
||||
32.04275580264579,
|
||||
118.8194498137916
|
||||
],
|
||||
"radius": 91.2720266761384
|
||||
},
|
||||
"inclusion": true,
|
||||
"version": 1
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//安全区解码
|
||||
//栅栏解码
|
||||
QJsonArray circlesArray = json.value("geoFence").toObject().value("circles").toArray();
|
||||
for(QJsonValue item: circlesArray) {
|
||||
|
||||
bool inclusion = item.toObject().value("inclusion").toBool();
|
||||
QJsonObject circle = item.toObject().value("circle").toObject();
|
||||
int version = item.toObject().value("version").toInt();
|
||||
|
||||
QJsonArray center = circle.value("center").toArray();
|
||||
|
||||
@@ -1924,26 +2068,94 @@ void OPMapWidget::WPLoad(QString path)//带文件目录参数
|
||||
qreal lng = center.at(1).toDouble();
|
||||
qreal radius = circle.value("radius").toDouble();
|
||||
|
||||
int version = item.toObject().value("version").toInt();
|
||||
|
||||
qDebug() << "circle" << inclusion << lat << lng << radius << version;
|
||||
//生成一个⚪
|
||||
|
||||
|
||||
geoFenceitem *centeritem = new geoFenceitem(0,1,1, inclusion ,internals::PointLatLng(lat,lng),QColor("#FF8000"),map);
|
||||
|
||||
geoFencecircle *c = new geoFencecircle(0,1,1,inclusion,centeritem,radius,QColor("#FF8000"),map);
|
||||
|
||||
}
|
||||
|
||||
QJsonArray polygonsArray = json.value("geoFence").toObject().value("polygons").toArray();
|
||||
for(QJsonValue item: polygonsArray) {
|
||||
|
||||
//每个item是一个组
|
||||
QList<internals::PointLatLng> points;
|
||||
QList<geoFenceitem *> polyitems;
|
||||
//获得边界
|
||||
bool inclusion = item.toObject().value("inclusion").toBool();
|
||||
QJsonArray polygon = item.toObject().value("polygon").toArray();
|
||||
int version = item.toObject().value("version").toInt();
|
||||
|
||||
qreal lat_sum = 0;
|
||||
qreal lng_sum = 0;
|
||||
|
||||
for (QJsonValue point: polygon) {
|
||||
qreal lat = point.toArray().at(0).toDouble();
|
||||
qreal lng = point.toArray().at(1).toDouble();
|
||||
|
||||
//生成一个多边形
|
||||
points.push_back(internals::PointLatLng(lat,lng));
|
||||
|
||||
qDebug() << "polygon" << inclusion << version << lat << lng;
|
||||
|
||||
|
||||
lat_sum += lat;
|
||||
lng_sum += lng;
|
||||
|
||||
}
|
||||
|
||||
int version = item.toObject().value("version").toInt();
|
||||
internals::PointLatLng center;
|
||||
|
||||
center.SetLat(lat_sum/polygon.size());
|
||||
center.SetLng(lng_sum/polygon.size());
|
||||
|
||||
geoFenceitem *polyitem = new geoFenceitem(0,points.size(),0, inclusion ,center,QColor("#FF8000"),map);
|
||||
|
||||
polyitem->setPoints(points);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
int count = 0;
|
||||
for(internals::PointLatLng p : points)
|
||||
{
|
||||
geoFenceitem *polyitem = new geoFenceitem(0,points.size(),count, inclusion ,p,QColor("#FF8000"),map);
|
||||
count ++;
|
||||
polyitems.push_back(polyitem);
|
||||
|
||||
}
|
||||
|
||||
geoFenceitem *last;
|
||||
|
||||
for(geoFenceitem *p : polyitems)
|
||||
{
|
||||
if(p == polyitems.first())
|
||||
{
|
||||
last = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(p == polyitems.last())
|
||||
{
|
||||
geoFenceitemline *polyline = new geoFenceitemline(last, polyitems.first(),map,QColor("#FF8000"));
|
||||
}
|
||||
else
|
||||
{
|
||||
geoFenceitemline *polyline = new geoFenceitemline(last, p,map,QColor("#FF8000"));
|
||||
last = p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
qDebug() << "polygon" << inclusion << version << item.toObject();
|
||||
|
||||
}
|
||||
|
||||
@@ -2241,9 +2453,6 @@ void OPMapWidget::groupchanged(int value)
|
||||
return;
|
||||
}
|
||||
|
||||
//一下这里判断有问题,有bug
|
||||
|
||||
|
||||
//将不是当前的全部变成灰色,当前的显示
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
@@ -2400,6 +2609,8 @@ void OPMapWidget::WPGroup(int value)
|
||||
|
||||
emit settableGroup(currentGroup);
|
||||
|
||||
find_PointNumber(currentGroup);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -2645,7 +2856,7 @@ void OPMapWidget::updateMessage(void)
|
||||
emit TotalDistanceUpdate(totalDistance);
|
||||
}
|
||||
|
||||
void OPMapWidget::find_PointNumber()
|
||||
void OPMapWidget::find_PointNumber(int group)
|
||||
{
|
||||
QList<int> nums;
|
||||
nums.clear();
|
||||
@@ -2656,7 +2867,8 @@ void OPMapWidget::find_PointNumber()
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w)
|
||||
{
|
||||
|
||||
if(w->MissionType() == group)//如果组别一样,那么就赋值
|
||||
{
|
||||
number = w->Number();
|
||||
|
||||
if(w->Command() < MAV_CMD::MAV_CMD_NAV_LAST)
|
||||
@@ -2665,6 +2877,7 @@ void OPMapWidget::find_PointNumber()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "nums" << nums;
|
||||
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
|
||||
#include "measureline.h"
|
||||
|
||||
#include "geoFencecircle.h"
|
||||
#include "geoFenceitem.h"
|
||||
#include "geoFenceitemline.h"
|
||||
|
||||
|
||||
|
||||
namespace mapcontrol {
|
||||
|
||||
@@ -647,7 +652,7 @@ public slots:
|
||||
void groupchanged(int value);
|
||||
|
||||
|
||||
void find_PointNumber();
|
||||
void find_PointNumber(int group);
|
||||
|
||||
void updateMessage(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user