mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
homeitem.cpp fixed to erase the safe area when turning off ShowSafeArea.
This commit is contained in:
parent
375ecfb369
commit
b7298f890f
@ -27,7 +27,8 @@
|
||||
#include "homeitem.h"
|
||||
namespace mapcontrol
|
||||
{
|
||||
HomeItem::HomeItem(MapGraphicItem* map,OPMapWidget* parent):safe(true),map(map),mapwidget(parent),showsafearea(true),safearea(1000),altitude(0),isDragging(false)
|
||||
HomeItem::HomeItem(MapGraphicItem* map,OPMapWidget* parent):safe(true),map(map),mapwidget(parent),
|
||||
showsafearea(true),safearea(1000),altitude(0),isDragging(false),toggleRefresh(true)
|
||||
{
|
||||
pic.load(QString::fromUtf8(":/markers/images/home2.svg"));
|
||||
pic=pic.scaled(30,30,Qt::IgnoreAspectRatio);
|
||||
@ -68,7 +69,7 @@ namespace mapcontrol
|
||||
}
|
||||
QRectF HomeItem::boundingRect()const
|
||||
{
|
||||
if(pic.width()>localsafearea*2)
|
||||
if(pic.width()>localsafearea*2 && !toggleRefresh)
|
||||
return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height());
|
||||
else
|
||||
return QRectF(-localsafearea,-localsafearea,localsafearea*2,localsafearea*2);
|
||||
@ -90,6 +91,9 @@ namespace mapcontrol
|
||||
|
||||
RefreshToolTip();
|
||||
|
||||
this->update();
|
||||
toggleRefresh=false;
|
||||
|
||||
}
|
||||
|
||||
void HomeItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
@ -50,6 +50,7 @@ namespace mapcontrol
|
||||
void RefreshPos();
|
||||
bool ShowSafeArea()const{return showsafearea;}
|
||||
void SetShowSafeArea(bool const& value){showsafearea=value;}
|
||||
void SetToggleRefresh(bool const& value){toggleRefresh=value;}
|
||||
int SafeArea()const{return safearea;}
|
||||
void SetSafeArea(int const& value){safearea=value;}
|
||||
bool safe;
|
||||
@ -66,6 +67,7 @@ namespace mapcontrol
|
||||
core::Point localposition;
|
||||
internals::PointLatLng coord;
|
||||
bool showsafearea;
|
||||
bool toggleRefresh;
|
||||
int safearea;
|
||||
int localsafearea;
|
||||
float altitude;
|
||||
|
@ -104,7 +104,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
m_map_mode = Normal_MapMode;
|
||||
|
||||
m_maxUpdateRate = max_update_rate_list[4]; // 2 seconds
|
||||
m_maxUpdateRate = max_update_rate_list[4]; // 2 seconds //SHOULDN'T THIS BE LOADED FROM THE USER PREFERENCES?
|
||||
|
||||
m_telemetry_connected = false;
|
||||
|
||||
@ -166,8 +166,9 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_map->SetShowHome(true); // display the HOME position on the map
|
||||
m_map->SetShowUAV(true); // display the UAV position on the map
|
||||
|
||||
m_map->Home->SetSafeArea(safe_area_radius_list[0]); // set radius (meters)
|
||||
m_map->Home->SetShowSafeArea(true); // show the safe area
|
||||
m_map->Home->SetSafeArea(safe_area_radius_list[0]); // set radius (meters) //SHOULDN'T THE DEFAULT BE USER DEFINED?
|
||||
m_map->Home->SetShowSafeArea(true); // show the safe area //SHOULDN'T THE DEFAULT BE USER DEFINED?
|
||||
m_map->Home->SetToggleRefresh(true);
|
||||
|
||||
if(m_map->Home)
|
||||
connect(m_map->Home,SIGNAL(homedoubleclick(HomeItem*)),this,SLOT(onHomeDoubleClick(HomeItem*)));
|
||||
@ -540,8 +541,8 @@ void OPMapGadgetWidget::closeEvent(QCloseEvent *event)
|
||||
// timer signals
|
||||
|
||||
/**
|
||||
Updates the UAV position on the map. It is called every 200ms
|
||||
by a timer.
|
||||
Updates the UAV position on the map. It is called at a user-defined frequency,
|
||||
as set inside the map widget.
|
||||
*/
|
||||
void OPMapGadgetWidget::updatePosition()
|
||||
{
|
||||
@ -1875,6 +1876,7 @@ void OPMapGadgetWidget::onShowSafeAreaAct_toggled(bool show)
|
||||
return;
|
||||
|
||||
m_map->Home->SetShowSafeArea(show); // show the safe area
|
||||
m_map->Home->SetToggleRefresh(true);
|
||||
m_map->Home->RefreshPos();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user