mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Merge branch 'pt/MapEnhancements' of ssh://git.openpilot.org/OpenPilot into pt/MapEnhancements
This commit is contained in:
commit
e3a60b7677
@ -44,6 +44,8 @@ namespace mapcontrol
|
||||
connect(core,SIGNAL(OnNeedInvalidation()),this,SLOT(Core_OnNeedInvalidation()));
|
||||
connect(core,SIGNAL(OnMapDrag()),this,SLOT(ChildPosRefresh()));
|
||||
connect(core,SIGNAL(OnMapZoomChanged()),this,SLOT(ChildPosRefresh()));
|
||||
setCacheMode(QGraphicsItem::ItemCoordinateCache);
|
||||
|
||||
//resize();
|
||||
setCacheMode(QGraphicsItem::ItemCoordinateCache);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace mapcontrol
|
||||
double UAVItem::groundspeed_mps_filt = 0;
|
||||
|
||||
UAVItem::UAVItem(MapGraphicItem* map,OPMapWidget* parent,QString uavPic):map(map),mapwidget(parent),showtrail(true),showtrailline(true),trailtime(5),traildistance(50),autosetreached(true)
|
||||
,autosetdistance(100),altitude(0),showUAVInfo(false)
|
||||
,autosetdistance(100),altitude(0),showUAVInfo(false),showJustChanged(false)
|
||||
{
|
||||
pic.load(uavPic);
|
||||
this->setFlag(QGraphicsItem::ItemIsMovable,true);
|
||||
@ -65,8 +65,10 @@ namespace mapcontrol
|
||||
painter->drawPixmap(-pic.width()/2,-pic.height()/2,pic);
|
||||
|
||||
//Return if context menu switch for UAV info is off
|
||||
if(!showUAVInfo)
|
||||
if(!showUAVInfo){
|
||||
showJustChanged=false;
|
||||
return;
|
||||
}
|
||||
|
||||
QPen myPen;
|
||||
|
||||
@ -81,9 +83,6 @@ namespace mapcontrol
|
||||
myPen.setColor(myColor);
|
||||
painter->setPen(myPen);
|
||||
|
||||
//Set brush attributes
|
||||
// painter->setBrush(myColor);
|
||||
|
||||
//Create line from (0,0), to (1,1). Later, we'll scale and rotate it
|
||||
QLineF line(0,0,1.0,1.0);
|
||||
|
||||
@ -232,11 +231,25 @@ namespace mapcontrol
|
||||
painter->setPen(myPen);
|
||||
painter->drawPath(path);
|
||||
|
||||
|
||||
//Last thing to do: set bound rectangle as function of largest object
|
||||
boundingRectSize=groundspeed_mps_filt*ringTime*4*meters2pixels+20; //Largest object is currently the biggest ring + a little bit of margin for the text
|
||||
}
|
||||
|
||||
QRectF UAVItem::boundingRect()const
|
||||
{
|
||||
return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height());
|
||||
if(showUAVInfo || showJustChanged){
|
||||
if (boundingRectSize < 220){
|
||||
//In case the bounding rectangle isn't big enough to get the whole of the UAV Info graphic
|
||||
return QRectF(-boundingRectSize,-80,boundingRectSize+220,180);
|
||||
}
|
||||
else{
|
||||
return QRectF(-boundingRectSize,-boundingRectSize,2*boundingRectSize,2*boundingRectSize);
|
||||
}
|
||||
}
|
||||
else{
|
||||
return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height());
|
||||
}
|
||||
}
|
||||
|
||||
void UAVItem::SetNED(double NED[3]){
|
||||
@ -425,6 +438,8 @@ namespace mapcontrol
|
||||
void UAVItem::SetShowUAVInfo(bool const& value)
|
||||
{
|
||||
showUAVInfo=value;
|
||||
showJustChanged=true;
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -249,6 +249,8 @@ namespace mapcontrol
|
||||
double autosetdistance;
|
||||
bool showUAVInfo;
|
||||
static double groundspeed_mps_filt;
|
||||
float boundingRectSize;
|
||||
bool showJustChanged;
|
||||
|
||||
public slots:
|
||||
|
||||
|
@ -1555,7 +1555,6 @@ void OPMapGadgetWidget::onShowUAVInfo_toggled(bool show)
|
||||
return;
|
||||
|
||||
m_map->UAV->SetShowUAVInfo(show);
|
||||
update();
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::onShowHomeAct_toggled(bool show)
|
||||
|
Loading…
Reference in New Issue
Block a user