mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +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:
parent
d233d65e86
commit
fadb00860a
@ -553,8 +553,10 @@ namespace mapcontrol
|
||||
}
|
||||
void MapGraphicItem::mapRotate(qreal angle)
|
||||
{
|
||||
rotation=angle;
|
||||
resize(scene()->sceneRect());
|
||||
if (rotation != angle) {
|
||||
rotation=angle;
|
||||
resize(scene()->sceneRect());
|
||||
}
|
||||
}
|
||||
QRectF MapGraphicItem::boundingBox(const QRectF &rect, const qreal &angle)
|
||||
{
|
||||
|
@ -276,8 +276,9 @@ namespace mapcontrol
|
||||
void OPMapWidget::SetRotate(qreal const& value)
|
||||
{
|
||||
map->mapRotate(value);
|
||||
if(compass)
|
||||
if(compass && (compass->rotation() != value)) {
|
||||
compass->setRotation(value);
|
||||
}
|
||||
}
|
||||
void OPMapWidget::RipMap()
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
if(mapfollowtype==UAVMapFollowType::CenterAndRotateMap)
|
||||
{
|
||||
mapwidget->SetRotate(-value);
|
||||
}
|
||||
else
|
||||
this->setRotation(value);
|
||||
else {
|
||||
if (this->rotation() != value)
|
||||
this->setRotation(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UAVItem::type()const
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
|
||||
|
||||
void UAVItem::RefreshPos()
|
||||
{
|
||||
localposition=map->FromLatLngToLocal(coord);
|
||||
|
Loading…
x
Reference in New Issue
Block a user