修正航线有多条连线的bug
This commit is contained in:
@@ -206,10 +206,6 @@ void OPMapWidget::setUAVHeading(int sysid,int compid,float Heading)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WayPointLine *OPMapWidget::WPLineCreate(WayPointItem *from, WayPointItem *to, QColor color, bool dashed, int width)
|
||||
{
|
||||
if (!from | !to) {
|
||||
@@ -231,12 +227,18 @@ WayPointLine *OPMapWidget::WPLineCreate(HomeItem *from, WayPointItem *to, QColor
|
||||
|
||||
void OPMapWidget::WPLineDelete(WayPointItem *from, WayPointItem *to)
|
||||
{
|
||||
WayPointLine *line = WPLineFind(from,to);
|
||||
|
||||
if(line)
|
||||
do
|
||||
{
|
||||
delete line;
|
||||
}
|
||||
WayPointLine *line = WPLineFind(from,to);
|
||||
if(line)
|
||||
{
|
||||
delete line;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}while(1);
|
||||
}
|
||||
|
||||
WayPointLine *OPMapWidget::WPLineFind(WayPointItem *from, WayPointItem *to)
|
||||
@@ -477,19 +479,20 @@ void OPMapWidget::WPInsert(const int &position)
|
||||
|
||||
|
||||
|
||||
|
||||
//删除连线
|
||||
if((item_old1)&&(item_old2))
|
||||
{
|
||||
WPLineDelete(item_old1,item_old2);
|
||||
WPLineDelete(item_old1,item_old2);
|
||||
WPLineDelete(item_old1,item_old2);
|
||||
//WPLineDelete(item_old1,item_old2);
|
||||
//WPLineDelete(item_old1,item_old2);
|
||||
}
|
||||
//删除连线
|
||||
if((item_old1)&&(item_old0))
|
||||
{
|
||||
WPLineDelete(item_old0,item_old1);
|
||||
WPLineDelete(item_old0,item_old1);
|
||||
WPLineDelete(item_old0,item_old1);
|
||||
//WPLineDelete(item_old0,item_old1);
|
||||
//WPLineDelete(item_old0,item_old1);
|
||||
|
||||
internals::PointLatLng latlng1 = item_old0->Coord();
|
||||
internals::PointLatLng latlng2 = item_old1->Coord();
|
||||
@@ -505,6 +508,7 @@ void OPMapWidget::WPInsert(const int &position)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(item_old1)//如果指定的点存在,那么就可以在这之前插入一个点
|
||||
{
|
||||
WayPointItem *item = new WayPointItem(latlng, item_old1->Altitude(), map);
|
||||
@@ -535,6 +539,7 @@ void OPMapWidget::WPInsert(const int &position)
|
||||
|
||||
|
||||
|
||||
|
||||
WayPointItem *w_next = WPFind(item->Number() + 1);
|
||||
if(w_next)
|
||||
{
|
||||
@@ -547,6 +552,7 @@ void OPMapWidget::WPInsert(const int &position)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
WayPointItem *w_last = WPFind(item->Number() - 1);
|
||||
if(w_last)
|
||||
{
|
||||
@@ -559,6 +565,8 @@ void OPMapWidget::WPInsert(const int &position)
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -567,6 +575,9 @@ void OPMapWidget::WPInsert(const int &position)
|
||||
WayPointItem *w = qgraphicsitem_cast<WayPointItem *>(i);
|
||||
if (w) {
|
||||
qDebug() << "all number" << w->Number() << w->snumber;
|
||||
|
||||
|
||||
WPFollowPrevious(w->FollowPrevious(),w);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1275,7 +1286,7 @@ void OPMapWidget::receivedPoint(float param1,float param2,float param3,float par
|
||||
}
|
||||
else
|
||||
{
|
||||
WPLineCreate(WPFind(Item->Number() - 1),Item,Qt::green,false,2);
|
||||
//WPLineCreate(WPFind(Item->Number() - 1),Item,Qt::green,false,2);
|
||||
}
|
||||
|
||||
emit setWPProperty(param1,param2,param3,param4,
|
||||
|
||||
Reference in New Issue
Block a user