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:
parent
d233d65e86
commit
fadb00860a
@ -553,9 +553,11 @@ namespace mapcontrol
|
|||||||
}
|
}
|
||||||
void MapGraphicItem::mapRotate(qreal angle)
|
void MapGraphicItem::mapRotate(qreal angle)
|
||||||
{
|
{
|
||||||
|
if (rotation != angle) {
|
||||||
rotation=angle;
|
rotation=angle;
|
||||||
resize(scene()->sceneRect());
|
resize(scene()->sceneRect());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
QRectF MapGraphicItem::boundingBox(const QRectF &rect, const qreal &angle)
|
QRectF MapGraphicItem::boundingBox(const QRectF &rect, const qreal &angle)
|
||||||
{
|
{
|
||||||
QRectF ret(rect);
|
QRectF ret(rect);
|
||||||
|
@ -276,9 +276,10 @@ 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()
|
||||||
{
|
{
|
||||||
new MapRipper(core,map->SelectedArea());
|
new MapRipper(core,map->SelectedArea());
|
||||||
|
@ -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 {
|
||||||
|
if (this->rotation() != value)
|
||||||
this->setRotation(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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user