修正地图中的类型错误
This commit is contained in:
Binary file not shown.
+79
-5
@@ -83,17 +83,17 @@ 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="2136"/>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2147"/>
|
||||
<source>开始上传航点,总数%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2326"/>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2337"/>
|
||||
<source>上传失败%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2350"/>
|
||||
<location filename="mapwidget/opmapwidget.cpp" line="2361"/>
|
||||
<source>recieve way point group:%1 seq:%2</source>
|
||||
<translation>收到航点:第%1组,第%2点</translation>
|
||||
</message>
|
||||
@@ -119,12 +119,86 @@ 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="367"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="373"/>
|
||||
<source>waypoint </source>
|
||||
<translation>航点 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="376"/>
|
||||
<source>return </source>
|
||||
<translation>返航 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="379"/>
|
||||
<source>landing </source>
|
||||
<translation>降落 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="382"/>
|
||||
<source>takeoff </source>
|
||||
<translation>起飞 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="385"/>
|
||||
<source>unknow </source>
|
||||
<translation>未知类型 </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="393"/>
|
||||
<source>hold
|
||||
</source>
|
||||
<translation>保持
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="396"/>
|
||||
<source>cas
|
||||
</source>
|
||||
<translation>表速
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="399"/>
|
||||
<source>Vz
|
||||
</source>
|
||||
<translation>快升
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="402"/>
|
||||
<source>onAB
|
||||
</source>
|
||||
<translation>开加力
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="405"/>
|
||||
<source>offAB
|
||||
</source>
|
||||
<translation>关加力
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="408"/>
|
||||
<source>unknow
|
||||
</source>
|
||||
<translation>未知指令
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="414"/>
|
||||
<source>
|
||||
</source>
|
||||
<translation>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="417"/>
|
||||
<source>Speed: %1m/s</source>
|
||||
<translation>速度:%1m/s</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="368"/>
|
||||
<location filename="mapwidget/waypointitem.cpp" line="418"/>
|
||||
<source>Height: %1m
|
||||
%2</source>
|
||||
<translation>高度:%1m
|
||||
|
||||
@@ -42,7 +42,7 @@ MeasureLine::MeasureLine(internals::PointLatLng from, internals::PointLatLng to,
|
||||
//connect(to, SIGNAL(aboutToBeDeleted(WayPointItem *)), this, SLOT(waypointdeleted()));
|
||||
|
||||
|
||||
this->setZValue(5);
|
||||
this->setZValue(7);
|
||||
|
||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class MeasureLine : public QObject, public QGraphicsLineItem {
|
||||
|
||||
Q_OBJECT Q_INTERFACES(QGraphicsItem)
|
||||
public:
|
||||
enum { Type = UserType + 8 };
|
||||
enum { Type = UserType + 10 };
|
||||
MeasureLine(internals::PointLatLng from, internals::PointLatLng to, MapGraphicItem *map, QColor color = Qt::green, bool dashed = false, int width = -1);
|
||||
int type() const;
|
||||
QPainterPath shape() const;
|
||||
|
||||
@@ -842,6 +842,7 @@ WayPointItem *OPMapWidget::WPCreate()
|
||||
emit WPCreated(position, item);
|
||||
setSelectedWP(item);
|
||||
item->emitWPProperty();
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
WayPointItem *OPMapWidget::magicWPCreate()
|
||||
@@ -856,6 +857,7 @@ WayPointItem *OPMapWidget::magicWPCreate()
|
||||
item->SetMissionType(currentGroup);
|
||||
setSelectedWP(item);
|
||||
item->emitWPProperty();
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
void OPMapWidget::WPCreate(WayPointItem *item)
|
||||
@@ -868,6 +870,7 @@ void OPMapWidget::WPCreate(WayPointItem *item)
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
setSelectedWP(item);
|
||||
item->emitWPProperty();
|
||||
item->setisShowTip(isShowTip);
|
||||
}
|
||||
WayPointItem *OPMapWidget::WPCreate(internals::PointLatLng const & coord, int const & altitude)
|
||||
{
|
||||
@@ -884,6 +887,7 @@ WayPointItem *OPMapWidget::WPCreate(internals::PointLatLng const & coord, int co
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
setSelectedWP(item);
|
||||
item->emitWPProperty();
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
WayPointItem *OPMapWidget::WPCreate(internals::PointLatLng const & coord, int const & altitude, QString const & description)
|
||||
@@ -901,6 +905,7 @@ WayPointItem *OPMapWidget::WPCreate(internals::PointLatLng const & coord, int co
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
setSelectedWP(item);
|
||||
item->emitWPProperty();
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
WayPointItem *OPMapWidget::WPCreate(const distBearingAltitude &relativeCoord, const QString &description)
|
||||
@@ -918,6 +923,7 @@ WayPointItem *OPMapWidget::WPCreate(const distBearingAltitude &relativeCoord, co
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
setSelectedWP(item);
|
||||
item->emitWPProperty();
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -1009,6 +1015,7 @@ void OPMapWidget::WPInsert()
|
||||
|
||||
setSelectedWP(item);
|
||||
item->emitWPProperty();//这个没有执行
|
||||
item->setisShowTip(isShowTip);
|
||||
|
||||
//调整编号
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
@@ -1060,6 +1067,7 @@ void OPMapWidget::WPInsert(WayPointItem *item, const int &position)
|
||||
item->SetMissionType(currentGroup);
|
||||
emit WPInserted(position, item);
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
item->setisShowTip(isShowTip);
|
||||
}
|
||||
WayPointItem *OPMapWidget::WPInsert(internals::PointLatLng const & coord, int const & altitude, const int &position)
|
||||
{
|
||||
@@ -1071,6 +1079,7 @@ WayPointItem *OPMapWidget::WPInsert(internals::PointLatLng const & coord, int co
|
||||
item->SetMissionType(currentGroup);
|
||||
emit WPInserted(position, item);
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
WayPointItem *OPMapWidget::WPInsert(internals::PointLatLng const & coord, int const & altitude, QString const & description, const int &position)
|
||||
@@ -1094,6 +1103,7 @@ WayPointItem *OPMapWidget::WPInsert(internals::PointLatLng const & coord, int co
|
||||
emit WPValuesChanged(item);
|
||||
}
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
WayPointItem *OPMapWidget::WPInsert(distBearingAltitude const & relative, QString const & description, const int &position)
|
||||
@@ -1106,6 +1116,7 @@ WayPointItem *OPMapWidget::WPInsert(distBearingAltitude const & relative, QStrin
|
||||
item->SetMissionType(currentGroup);
|
||||
emit WPInserted(position, item);
|
||||
setOverlayOpacity(overlayOpacity);
|
||||
item->setisShowTip(isShowTip);
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -2175,12 +2186,11 @@ void OPMapWidget::groupchanged(int value)
|
||||
|
||||
//一下这里判断有问题,有bug
|
||||
|
||||
/*
|
||||
|
||||
//将不是当前的全部变成灰色,当前的显示
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {
|
||||
qDebug() << "missiontype" << w->MissionType();
|
||||
if(w->MissionType() == currentMissionType)
|
||||
{
|
||||
w->setisActive(true);
|
||||
@@ -2197,8 +2207,22 @@ void OPMapWidget::groupchanged(int value)
|
||||
WayPointLine *l = qgraphicsitem_cast<WayPointLine *>(i);
|
||||
if (l) {
|
||||
|
||||
WayPointItem *from = qgraphicsitem_cast<WayPointItem *>(l->WPLineFrom());
|
||||
WayPointItem *to = qgraphicsitem_cast<WayPointItem *>(l->WPLineTo());
|
||||
WayPointItem *from = nullptr;
|
||||
WayPointItem *to = nullptr;
|
||||
|
||||
QGraphicsItem *_f = l->WPLineFrom();
|
||||
QGraphicsItem *_t = l->WPLineTo();
|
||||
|
||||
if(_f)
|
||||
{
|
||||
from = qgraphicsitem_cast<WayPointItem *>(_f);
|
||||
}
|
||||
|
||||
if(_t)
|
||||
{
|
||||
to = qgraphicsitem_cast<WayPointItem *>(_t);
|
||||
}
|
||||
|
||||
|
||||
if((from)||(to))
|
||||
{
|
||||
@@ -2215,7 +2239,7 @@ void OPMapWidget::groupchanged(int value)
|
||||
}
|
||||
else if(to)
|
||||
{
|
||||
if(from->MissionType() == currentMissionType)
|
||||
if(to->MissionType() == currentMissionType)
|
||||
{
|
||||
l->setisActive(true);
|
||||
}
|
||||
@@ -2226,12 +2250,12 @@ void OPMapWidget::groupchanged(int value)
|
||||
}
|
||||
else//不知道这句对不对
|
||||
{
|
||||
l->setisActive(false);
|
||||
//l->setisActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2253,7 +2277,6 @@ void OPMapWidget::WPGroup(int value)
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {
|
||||
qDebug() << "missiontype" << w->MissionType();
|
||||
if(w->MissionType() == currentGroup)
|
||||
{
|
||||
w->setisActive(true);
|
||||
@@ -2270,8 +2293,21 @@ void OPMapWidget::WPGroup(int value)
|
||||
WayPointLine *l = qgraphicsitem_cast<WayPointLine *>(i);
|
||||
if (l) {
|
||||
|
||||
WayPointItem *from = qgraphicsitem_cast<WayPointItem *>(l->WPLineFrom());
|
||||
WayPointItem *to = qgraphicsitem_cast<WayPointItem *>(l->WPLineTo());
|
||||
WayPointItem *from = nullptr;
|
||||
WayPointItem *to = nullptr;
|
||||
|
||||
QGraphicsItem *_f = l->WPLineFrom();
|
||||
QGraphicsItem *_t = l->WPLineTo();
|
||||
|
||||
if(_f)
|
||||
{
|
||||
from = qgraphicsitem_cast<WayPointItem *>(_f);
|
||||
}
|
||||
|
||||
if(_t)
|
||||
{
|
||||
to = qgraphicsitem_cast<WayPointItem *>(_t);
|
||||
}
|
||||
|
||||
if((from)||(to))
|
||||
{
|
||||
@@ -2288,7 +2324,7 @@ void OPMapWidget::WPGroup(int value)
|
||||
}
|
||||
else if(to)
|
||||
{
|
||||
if(from->MissionType() == currentGroup)
|
||||
if(to->MissionType() == currentGroup)
|
||||
{
|
||||
l->setisActive(true);
|
||||
}
|
||||
@@ -2299,7 +2335,7 @@ void OPMapWidget::WPGroup(int value)
|
||||
}
|
||||
else//不知道这句对不对
|
||||
{
|
||||
l->setisActive(false);
|
||||
//l->setisActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2429,6 +2465,7 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
|
||||
|
||||
Item->emitWPProperty();
|
||||
Item->setisShowTip(isShowTip);
|
||||
|
||||
qDebug() << "waypoint not exist:" << Item->Number() << seq+1 <<currentGroup << mission_type;
|
||||
|
||||
@@ -2591,6 +2628,8 @@ void OPMapWidget::getAllPoints(int group)
|
||||
|
||||
void OPMapWidget::WPShowTip(bool flag)
|
||||
{
|
||||
isShowTip = flag;
|
||||
|
||||
foreach(QGraphicsItem * i, map->childItems()) {
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w)
|
||||
@@ -2598,6 +2637,8 @@ void OPMapWidget::WPShowTip(bool flag)
|
||||
w->setisShowTip(flag);
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -506,6 +506,8 @@ private:
|
||||
|
||||
int measurenumber = 1;
|
||||
|
||||
bool isShowTip = false;
|
||||
|
||||
|
||||
private slots:
|
||||
void diagRefresh();
|
||||
|
||||
@@ -33,6 +33,8 @@ TrailItem::TrailItem(internals::PointLatLng const & coord, int const & altitude,
|
||||
QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6);
|
||||
|
||||
setToolTip(QString(tr("Position:") + "%1\n" + tr("Altitude:") + "%2\n" + tr("Time:") + "%3").arg(coord_str).arg(QString::number(altitude)).arg(time.toString()));
|
||||
this->setZValue(3);
|
||||
|
||||
}
|
||||
|
||||
void TrailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
|
||||
@@ -35,7 +35,7 @@ TrailLineItem::TrailLineItem(internals::PointLatLng const & coord1, internals::P
|
||||
pen.setWidth(2);
|
||||
this->setPen(pen);
|
||||
|
||||
|
||||
this->setZValue(3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
|
||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||
|
||||
this->setZValue(3);
|
||||
this->setZValue(5);
|
||||
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ WayPointItem::WayPointItem(int seq,int missiontype, MapGraphicItem *map, bool ma
|
||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||
|
||||
this->setZValue(3);
|
||||
this->setZValue(5);
|
||||
}
|
||||
WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & altitude,int seq, int missiontype, const QString &description, MapGraphicItem *map, wptype type) : coord(coord), reached(false), description(description), shownumber(true), isDragging(false), altitude(altitude), map(map), myType(type)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ WayPointItem::WayPointItem(const internals::PointLatLng &coord, int const & alti
|
||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||
|
||||
this->setZValue(3);
|
||||
this->setZValue(5);
|
||||
}
|
||||
|
||||
WayPointItem::WayPointItem(const distBearingAltitude &relativeCoordenate,int seq,int missiontype, const QString &description, MapGraphicItem *map) : relativeCoord(relativeCoordenate), reached(false), description(description), shownumber(true), isDragging(false), map(map)
|
||||
@@ -193,7 +193,7 @@ WayPointItem::WayPointItem(const distBearingAltitude &relativeCoordenate,int seq
|
||||
connect(map, SIGNAL(childRefreshPosition()), this, SLOT(RefreshPos()));
|
||||
connect(map, SIGNAL(childSetOpacity(qreal)), this, SLOT(setOpacitySlot(qreal)));
|
||||
|
||||
this->setZValue(3);
|
||||
this->setZValue(5);
|
||||
}
|
||||
|
||||
void WayPointItem::setWPType(wptype type)
|
||||
@@ -220,21 +220,21 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
if(isEdit == true)
|
||||
{
|
||||
if (this->isSelected()) {
|
||||
this->setZValue(4);
|
||||
this->setZValue(6);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setZValue(3);
|
||||
this->setZValue(5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Command() < MAV_CMD::MAV_CMD_NAV_LAST) {
|
||||
this->setZValue(4);
|
||||
this->setZValue(6);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setZValue(3);
|
||||
this->setZValue(5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
|
||||
if(isShowTip)
|
||||
{
|
||||
QRectF rect = QRectF(-50,-60,100,40);
|
||||
QRectF rect = QRectF(-50,-70,100,50);
|
||||
|
||||
//画一块底色#58ACFA
|
||||
painter->setBrush(QColor("#A9F5F2"));
|
||||
@@ -353,7 +353,7 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
ePen.setColor(QColor("#58ACFA"));
|
||||
ePen.setWidth(2);
|
||||
painter->setPen(ePen);
|
||||
painter->drawRect(rect);
|
||||
painter->drawRoundedRect(rect,5,5);
|
||||
|
||||
//画字
|
||||
QFont font;
|
||||
@@ -365,10 +365,57 @@ void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
ePen.setColor(QColor("#000000"));
|
||||
painter->setPen(ePen);
|
||||
|
||||
QString _v = tr("Speed: %1m/s").arg(QString::number(property.param4,'f',0));
|
||||
QString _h = tr("Height: %1m\n%2").arg(QString::number(property.z,'f',0)).arg(_v);
|
||||
QString _h;
|
||||
QString _v;
|
||||
|
||||
switch (property.command) {
|
||||
case 16:
|
||||
_h = tr("");
|
||||
break;
|
||||
case 20:
|
||||
_h = tr("return ");
|
||||
break;
|
||||
case 21:
|
||||
_h = tr("landing ");
|
||||
break;
|
||||
case 22:
|
||||
_h = tr("takeoff ");
|
||||
break;
|
||||
default:
|
||||
_h = tr("unknow ");
|
||||
break;
|
||||
}
|
||||
|
||||
if(property.command == 16)
|
||||
{
|
||||
switch ((int32_t)property.param1) {
|
||||
case 0:
|
||||
_h.append(tr("hold\n"));
|
||||
break;
|
||||
case -1:
|
||||
_h.append(tr("cas\n"));
|
||||
break;
|
||||
case -2:
|
||||
_h.append(tr("Vz\n"));
|
||||
break;
|
||||
case -3:
|
||||
_h.append(tr("onAB\n"));
|
||||
break;
|
||||
case -4:
|
||||
_h.append(tr("offAB\n"));
|
||||
break;
|
||||
default:
|
||||
_h.append(tr("unknow\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_h.append(tr("\n"));
|
||||
}
|
||||
|
||||
_v = tr("Speed: %1m/s").arg(QString::number(property.param4,'f',0));
|
||||
_h.append(tr("Height: %1m\n%2").arg(QString::number(property.z,'f',0)).arg(_v));
|
||||
painter->drawText(QRectF(rect.x() + 2,rect.y()+2,rect.width() - 4,rect.height() - 4),Qt::AlignLeft | Qt::AlignVCenter,_h);
|
||||
}
|
||||
}
|
||||
@@ -649,12 +696,16 @@ void WayPointItem::WPRenumbered(const int &oldnumber, const int &newnumber, WayP
|
||||
qDebug() << "set property.seq" << property.seq;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int WayPointItem::type() const
|
||||
{
|
||||
// Enable the use of qgraphicsitem_cast with this item.
|
||||
return Type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WayPointItem::~WayPointItem()
|
||||
{
|
||||
emit aboutToBeDeleted(this);
|
||||
|
||||
Reference in New Issue
Block a user