跟航点有互动,但是还存在缺陷
This commit is contained in:
@@ -555,6 +555,13 @@ void OPMapWidget::ConnectWP(WayPointItem *item)
|
||||
connect(this, SIGNAL(WPNumberChanged(int, int, WayPointItem *)), item, SLOT(WPRenumbered(int, int, WayPointItem *)), Qt::DirectConnection);
|
||||
connect(this, SIGNAL(WPDeleted(int, WayPointItem *)), item, SLOT(WPDeleted(int, WayPointItem *)), Qt::DirectConnection);
|
||||
connect(item,SIGNAL(WPChanged(int,double,double)),this,SIGNAL(WPChanged(int,double,double)));
|
||||
|
||||
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)),
|
||||
p_ui, SLOT(setWayPointProperty(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)));
|
||||
|
||||
connect(p_ui, SIGNAL(WayPointPropertyChanged(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)),
|
||||
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)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -252,7 +252,9 @@ void propertyui::rebuildUI(QString CMD)
|
||||
}
|
||||
|
||||
//重新载入UI
|
||||
ui->label_Seq->setText(QString::number(m_seq));
|
||||
ui->label_Descript->setText(description());
|
||||
|
||||
//根据showDetails设置显示
|
||||
if(isShowDetails == true)
|
||||
{
|
||||
@@ -268,7 +270,6 @@ void propertyui::rebuildUI(QString CMD)
|
||||
//一个一个设置
|
||||
//清除所有
|
||||
clearLayout(ui->frame_Param->layout());
|
||||
|
||||
for(QMap<int, MissionCmdParamInfo*>::const_iterator item = _paramInfoMap.begin();item != _paramInfoMap.end();item++)
|
||||
{
|
||||
MissionCmdParamInfo* i = item.value();
|
||||
@@ -297,8 +298,6 @@ void propertyui::rebuildUI(QString CMD)
|
||||
ui->frame_Param->layout()->addWidget(param);
|
||||
connect(param,SIGNAL(textChanged(QString)),
|
||||
this,SLOT(WayPointPropertyUpdate()));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -413,23 +412,12 @@ void propertyui::WayPointPropertyUpdate(void)
|
||||
}
|
||||
}
|
||||
|
||||
emit WayPointPropertyChanged(m_param1,m_param2,m_param3,m_param4,
|
||||
m_x,m_y,m_z,
|
||||
m_seq,m_group,m_command,
|
||||
m_target_system,m_target_component,
|
||||
m_frame,m_current,m_autocontinue,m_mission_type);
|
||||
|
||||
qDebug() << m_param1
|
||||
<< m_param2
|
||||
<< m_param3
|
||||
<< m_param4
|
||||
<< m_x
|
||||
<< m_y
|
||||
<< m_z
|
||||
<< m_seq
|
||||
<< m_group
|
||||
<< m_command
|
||||
<< m_target_system
|
||||
<< m_target_component
|
||||
<< m_frame
|
||||
<< m_current
|
||||
<< m_autocontinue
|
||||
<< m_mission_type ;
|
||||
}
|
||||
|
||||
|
||||
@@ -468,6 +456,37 @@ void propertyui::setWayPointProperty(float param1,float param2,float param3,floa
|
||||
m_current = current;
|
||||
m_autocontinue = autocontinue;
|
||||
m_mission_type = mission_type;
|
||||
|
||||
for(QJsonValue info: MAV_CMD_infoArray) {
|
||||
if (!info.isObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(info.toObject().value(_idJsonKey).toInt() == m_command)
|
||||
{
|
||||
ui->comboBox_friendlyName->setCurrentText(info.toObject().value(_friendlyNameJsonKey).toString());
|
||||
rebuildUI(info.toObject().value(_friendlyNameJsonKey).toString());
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << m_param1
|
||||
<< m_param2
|
||||
<< m_param3
|
||||
<< m_param4
|
||||
<< m_x
|
||||
<< m_y
|
||||
<< m_z
|
||||
<< m_seq
|
||||
<< m_group
|
||||
<< m_command
|
||||
<< m_target_system
|
||||
<< m_target_component
|
||||
<< m_frame
|
||||
<< m_current
|
||||
<< m_autocontinue
|
||||
<< m_mission_type ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -194,6 +194,12 @@ public:
|
||||
void _loadMavCmdInfoJson(const QString& jsonFilename, bool baseCommandList);
|
||||
bool loadJsonInfo(const QJsonObject& jsonObject, bool requireFullObject, QString& errorString);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void setWayPointProperty(float param1,float param2,float param3,float param4,
|
||||
int32_t x,int32_t y,float z,
|
||||
uint16_t seq,
|
||||
@@ -206,12 +212,6 @@ public:
|
||||
uint8_t autocontinue,
|
||||
uint8_t mission_type);
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
//void editProperty(QString pro);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
|
||||
|
||||
@@ -239,7 +239,17 @@ void WayPointItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
emit WPChanged(this->Number(),Coord().Lat(),Coord().Lng());
|
||||
|
||||
//发送航点的属性
|
||||
|
||||
emit WPProperty(property.param1,property.param2,property.param3,property.param4,
|
||||
property.x,property.y,property.z,
|
||||
property.seq,
|
||||
property.group,
|
||||
property.command,
|
||||
property.target_system,
|
||||
property.target_component,
|
||||
property.frame,
|
||||
property.current,
|
||||
property.autocontinue,
|
||||
property.mission_type);
|
||||
}
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
@@ -457,6 +467,38 @@ void WayPointItem::setFlag(QGraphicsItem::GraphicsItemFlag flag, bool enabled)
|
||||
|
||||
//=============属性设置=================
|
||||
|
||||
void WayPointItem::setWPProperty(float param1,float param2,float param3,float param4,
|
||||
int32_t x,int32_t y,float z,
|
||||
uint16_t seq,
|
||||
uint16_t group,
|
||||
uint16_t command,
|
||||
uint8_t target_system,
|
||||
uint8_t target_component,
|
||||
uint8_t frame,
|
||||
uint8_t current,
|
||||
uint8_t autocontinue,
|
||||
uint8_t mission_type)
|
||||
{
|
||||
if(seq == (number - 1))
|
||||
{
|
||||
property.param1 = param1;
|
||||
property.param2 = param2;
|
||||
property.param3 = param3;
|
||||
property.param4 = param4;
|
||||
property.x = x;
|
||||
property.y = y;
|
||||
property.z = z;
|
||||
property.seq = seq;
|
||||
property.group = group;
|
||||
property.command = command;
|
||||
property.frame = frame;
|
||||
property.current = current;
|
||||
property.autocontinue = autocontinue;
|
||||
property.mission_type = mission_type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WayPointItem::SetDefault(double lat,double lng,float alt,uint16_t seq)
|
||||
{
|
||||
property.param1 = 100;
|
||||
@@ -537,14 +579,3 @@ int WayPointItem::snumber = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -291,8 +291,32 @@ public slots:
|
||||
void onHomePositionChanged(internals::PointLatLng, float altitude);
|
||||
void RefreshPos();
|
||||
void setOpacitySlot(qreal opacity);
|
||||
signals:
|
||||
|
||||
void setWPProperty(float param1,float param2,float param3,float param4,
|
||||
int32_t x,int32_t y,float z,
|
||||
uint16_t seq,
|
||||
uint16_t group,
|
||||
uint16_t command,
|
||||
uint8_t target_system,
|
||||
uint8_t target_component,
|
||||
uint8_t frame,
|
||||
uint8_t current,
|
||||
uint8_t autocontinue,
|
||||
uint8_t mission_type);
|
||||
|
||||
|
||||
signals:
|
||||
void WPProperty(float param1,float param2,float param3,float param4,
|
||||
int32_t x,int32_t y,float z,
|
||||
uint16_t seq,
|
||||
uint16_t group,
|
||||
uint16_t command,
|
||||
uint8_t target_system,
|
||||
uint8_t target_component,
|
||||
uint8_t frame,
|
||||
uint8_t current,
|
||||
uint8_t autocontinue,
|
||||
uint8_t mission_type);
|
||||
void WPChanged(int Number,double Lat,double Lng);
|
||||
void WPNumberChanged(int const & oldnumber, int const & newnumber, WayPointItem *waypoint);
|
||||
void WPValuesChanged(WayPointItem *waypoint);
|
||||
|
||||
Reference in New Issue
Block a user