1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Improved bounding rect dimensioning.

This commit is contained in:
Laura Sebesta 2012-08-17 10:11:45 +02:00
parent 7e55b31ca1
commit e52d141e3e

View File

@ -50,6 +50,7 @@ namespace mapcontrol
mapfollowtype=UAVMapFollowType::None; mapfollowtype=UAVMapFollowType::None;
trailtype=UAVTrailType::ByDistance; trailtype=UAVTrailType::ByDistance;
timer.start(); timer.start();
// setCacheMode(QGraphicsItem::ItemCoordinateCache);
} }
UAVItem::~UAVItem() UAVItem::~UAVItem()
{ {
@ -233,15 +234,23 @@ namespace mapcontrol
//Last thing to do: set bound rectangle as function of largest object //Last thing to do: set bound rectangle as function of largest object
boundingRectSize=groundspeed_mps_filt*ringTime*4*meters2pixels+10; //Largest object is currently the biggest ring + a little bit of margin for the text 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 QRectF UAVItem::boundingRect()const
{ {
if(showUAVInfo || showJustChanged) if(showUAVInfo || showJustChanged){
return QRectF(-boundingRectSize,-boundingRectSize,2*boundingRectSize,2*boundingRectSize); if (boundingRectSize < 220){
else //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()); return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height());
}
} }
void UAVItem::SetNED(double NED[3]){ void UAVItem::SetNED(double NED[3]){