1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-05 21:52:10 +01:00

Update to map library to avoid unnecessary redraws of the map and UAV icon when updating the UAV position & rotation which caused high CPU usage on the GCS.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2139 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2010-11-23 16:41:42 +00:00 committed by edouard
parent d233d65e86
commit fadb00860a
3 changed files with 19 additions and 5 deletions

View File

@ -553,8 +553,10 @@ namespace mapcontrol
} }
void MapGraphicItem::mapRotate(qreal angle) void MapGraphicItem::mapRotate(qreal angle)
{ {
rotation=angle; if (rotation != angle) {
resize(scene()->sceneRect()); rotation=angle;
resize(scene()->sceneRect());
}
} }
QRectF MapGraphicItem::boundingBox(const QRectF &rect, const qreal &angle) QRectF MapGraphicItem::boundingBox(const QRectF &rect, const qreal &angle)
{ {

View File

@ -276,8 +276,9 @@ namespace mapcontrol
void OPMapWidget::SetRotate(qreal const& value) void OPMapWidget::SetRotate(qreal const& value)
{ {
map->mapRotate(value); map->mapRotate(value);
if(compass) if(compass && (compass->rotation() != value)) {
compass->setRotation(value); compass->setRotation(value);
}
} }
void OPMapWidget::RipMap() void OPMapWidget::RipMap()
{ {

View File

@ -137,19 +137,30 @@ namespace mapcontrol
} }
} }
} }
/**
* Rotate the UAV Icon on the map, or rotate the map
* depending on the display mode
*/
void UAVItem::SetUAVHeading(const qreal &value) void UAVItem::SetUAVHeading(const qreal &value)
{ {
if(mapfollowtype==UAVMapFollowType::CenterAndRotateMap) if(mapfollowtype==UAVMapFollowType::CenterAndRotateMap)
{ {
mapwidget->SetRotate(-value); mapwidget->SetRotate(-value);
} }
else else {
this->setRotation(value); if (this->rotation() != value)
this->setRotation(value);
}
} }
int UAVItem::type()const int UAVItem::type()const
{ {
return Type; return Type;
} }
void UAVItem::RefreshPos() void UAVItem::RefreshPos()
{ {
localposition=map->FromLatLngToLocal(coord); localposition=map->FromLatLngToLocal(coord);