mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Fix indentation in the map gadget widget before starting work on waypoints
This commit is contained in:
parent
74d96d0073
commit
fa20b0de63
@ -180,13 +180,13 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
m_map->UAV->SetTrailDistance(uav_trail_distance_list[1]); // meters
|
||||
|
||||
m_map->UAV->SetTrailType(UAVTrailType::ByTimeElapsed);
|
||||
// m_map->UAV->SetTrailType(UAVTrailType::ByDistance);
|
||||
// m_map->UAV->SetTrailType(UAVTrailType::ByDistance);
|
||||
|
||||
m_map->GPS->SetTrailTime(uav_trail_time_list[0]); // seconds
|
||||
m_map->GPS->SetTrailDistance(uav_trail_distance_list[1]); // meters
|
||||
|
||||
m_map->GPS->SetTrailType(UAVTrailType::ByTimeElapsed);
|
||||
// m_map->GPS->SetTrailType(UAVTrailType::ByDistance);
|
||||
// m_map->GPS->SetTrailType(UAVTrailType::ByDistance);
|
||||
|
||||
// **************
|
||||
|
||||
@ -241,7 +241,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
m_widget->progressBarMap->setMaximum(1);
|
||||
|
||||
/*
|
||||
/*
|
||||
#if defined(Q_OS_MAC)
|
||||
#elif defined(Q_OS_WIN)
|
||||
m_widget->comboBoxFindPlace->clear();
|
||||
@ -313,7 +313,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
m_statusUpdateTimer = new QTimer();
|
||||
m_statusUpdateTimer->setInterval(200);
|
||||
// m_statusUpdateTimer->setInterval(m_maxUpdateRate);
|
||||
// m_statusUpdateTimer->setInterval(m_maxUpdateRate);
|
||||
connect(m_statusUpdateTimer, SIGNAL(timeout()), this, SLOT(updateMousePos()));
|
||||
m_statusUpdateTimer->start();
|
||||
|
||||
@ -335,11 +335,11 @@ OPMapGadgetWidget::~OPMapGadgetWidget()
|
||||
|
||||
// this destructor doesn't appear to be called at shutdown???
|
||||
|
||||
// #if defined(Q_OS_MAC)
|
||||
// #elif defined(Q_OS_WIN)
|
||||
// saveComboBoxLines(m_widget->comboBoxFindPlace, QCoreApplication::applicationDirPath() + "/opmap_find_place_history.txt");
|
||||
// #else
|
||||
// #endif
|
||||
// #if defined(Q_OS_MAC)
|
||||
// #elif defined(Q_OS_WIN)
|
||||
// saveComboBoxLines(m_widget->comboBoxFindPlace, QCoreApplication::applicationDirPath() + "/opmap_find_place_history.txt");
|
||||
// #else
|
||||
// #endif
|
||||
|
||||
m_waypoint_list_mutex.lock();
|
||||
foreach (t_waypoint *wp, m_waypoint_list)
|
||||
@ -382,7 +382,7 @@ void OPMapGadgetWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
if (event->buttons() & Qt::LeftButton)
|
||||
{
|
||||
// QPoint pos = event->pos();
|
||||
// QPoint pos = event->pos();
|
||||
}
|
||||
|
||||
QWidget::mouseMoveEvent(event);
|
||||
@ -402,7 +402,7 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
// current mouse position
|
||||
QPoint p = m_map->mapFromGlobal(event->globalPos());
|
||||
m_context_menu_lat_lon = m_map->GetFromLocalToLatLng(p);
|
||||
// m_context_menu_lat_lon = m_map->currentMousePosition();
|
||||
// m_context_menu_lat_lon = m_map->currentMousePosition();
|
||||
|
||||
if (!m_map->contentsRect().contains(p))
|
||||
return; // the mouse click was not on the map
|
||||
@ -653,8 +653,8 @@ void OPMapGadgetWidget::updatePosition()
|
||||
return;
|
||||
|
||||
QMutexLocker locker(&m_map_mutex);
|
||||
// Pip I'm sorry, I know this was here with a purpose vvv
|
||||
// from Pip: let you off :)
|
||||
// Pip I'm sorry, I know this was here with a purpose vvv
|
||||
// from Pip: let you off :)
|
||||
//if (!telemetry_connected)
|
||||
// return;
|
||||
|
||||
@ -678,7 +678,7 @@ void OPMapGadgetWidget::updatePosition()
|
||||
return;
|
||||
|
||||
// get current GPS heading
|
||||
// gps_heading = getGPS_Heading();
|
||||
// gps_heading = getGPS_Heading();
|
||||
gps_heading = 0;
|
||||
|
||||
gps_pos = internals::PointLatLng(gps_latitude, gps_longitude);
|
||||
@ -691,14 +691,14 @@ void OPMapGadgetWidget::updatePosition()
|
||||
" lon: " + QString::number(uav_pos.Lng(), 'f', 7) +
|
||||
" " + QString::number(uav_yaw, 'f', 1) + "deg" +
|
||||
" " + QString::number(uav_altitude, 'f', 1) + "m";
|
||||
// " " + QString::number(uav_ground_speed_meters_per_second, 'f', 1) + "m/s";
|
||||
// " " + QString::number(uav_ground_speed_meters_per_second, 'f', 1) + "m/s";
|
||||
m_widget->labelUAVPos->setText(str);
|
||||
|
||||
// *************
|
||||
// set the UAV icon position on the map
|
||||
|
||||
m_map->UAV->SetUAVPos(uav_pos, uav_altitude); // set the maps UAV position
|
||||
// qDebug()<<"UAVPOSITION"<<uav_pos.ToString();
|
||||
// qDebug()<<"UAVPOSITION"<<uav_pos.ToString();
|
||||
m_map->UAV->SetUAVHeading(uav_yaw); // set the maps UAV heading
|
||||
|
||||
// *************
|
||||
@ -727,7 +727,7 @@ void OPMapGadgetWidget::updateMousePos()
|
||||
if (!m_map->contentsRect().contains(p))
|
||||
return; // the mouse is not on the map
|
||||
|
||||
// internals::PointLatLng lat_lon = m_map->currentMousePosition(); // fetch the current lat/lon mouse position
|
||||
// internals::PointLatLng lat_lon = m_map->currentMousePosition(); // fetch the current lat/lon mouse position
|
||||
|
||||
QGraphicsItem *item = m_map->itemAt(p);
|
||||
|
||||
@ -779,10 +779,10 @@ void OPMapGadgetWidget::updateMousePos()
|
||||
{
|
||||
internals::PointLatLng uav_pos = internals::PointLatLng(latitude, longitude);
|
||||
|
||||
// double dist = distance(home_lat_lon, uav_pos);
|
||||
// double bear = bearing(home_lat_lon, uav_pos);
|
||||
// s += " " + QString::number(dist * 1000, 'f', 1) + "m";
|
||||
// s += " " + QString::number(bear, 'f', 1) + "deg";
|
||||
// double dist = distance(home_lat_lon, uav_pos);
|
||||
// double bear = bearing(home_lat_lon, uav_pos);
|
||||
// s += " " + QString::number(dist * 1000, 'f', 1) + "m";
|
||||
// s += " " + QString::number(bear, 'f', 1) + "deg";
|
||||
}
|
||||
}
|
||||
m_widget->labelMousePos->setText(s);
|
||||
@ -838,15 +838,15 @@ void OPMapGadgetWidget::OnTilesStillToLoad(int number)
|
||||
if (!m_widget || !m_map)
|
||||
return;
|
||||
|
||||
// if (prev_tile_number < number || m_widget->progressBarMap->maximum() < number)
|
||||
// m_widget->progressBarMap->setMaximum(number);
|
||||
// if (prev_tile_number < number || m_widget->progressBarMap->maximum() < number)
|
||||
// m_widget->progressBarMap->setMaximum(number);
|
||||
|
||||
if (m_widget->progressBarMap->maximum() < number)
|
||||
m_widget->progressBarMap->setMaximum(number);
|
||||
|
||||
m_widget->progressBarMap->setValue(m_widget->progressBarMap->maximum() - number); // update the progress bar
|
||||
|
||||
// m_widget->labelNumTilesToLoad->setText(QString::number(number));
|
||||
// m_widget->labelNumTilesToLoad->setText(QString::number(number));
|
||||
|
||||
m_prev_tile_number = number;
|
||||
}
|
||||
@ -900,7 +900,7 @@ void OPMapGadgetWidget::WPNumberChanged(int const &oldnumber, int const &newnumb
|
||||
|
||||
void OPMapGadgetWidget::WPValuesChanged(WayPointItem *waypoint)
|
||||
{
|
||||
// qDebug("opmap: WPValuesChanged");
|
||||
// qDebug("opmap: WPValuesChanged");
|
||||
|
||||
switch (m_map_mode)
|
||||
{
|
||||
@ -1189,8 +1189,8 @@ void OPMapGadgetWidget::setMaxUpdateRate(int update_rate)
|
||||
if (m_updateTimer)
|
||||
m_updateTimer->setInterval(m_maxUpdateRate);
|
||||
|
||||
// if (m_statusUpdateTimer)
|
||||
// m_statusUpdateTimer->setInterval(m_maxUpdateRate);
|
||||
// if (m_statusUpdateTimer)
|
||||
// m_statusUpdateTimer->setInterval(m_maxUpdateRate);
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::setZoom(int zoom)
|
||||
@ -1281,20 +1281,20 @@ void OPMapGadgetWidget::setCacheLocation(QString cacheLocation)
|
||||
|
||||
if (cacheLocation.isEmpty()) return;
|
||||
|
||||
// #if defined(Q_WS_WIN)
|
||||
// if (!cacheLocation.endsWith('\\')) cacheLocation += '\\';
|
||||
// #elif defined(Q_WS_X11)
|
||||
// #if defined(Q_WS_WIN)
|
||||
// if (!cacheLocation.endsWith('\\')) cacheLocation += '\\';
|
||||
// #elif defined(Q_WS_X11)
|
||||
if (!cacheLocation.endsWith(QDir::separator())) cacheLocation += QDir::separator();
|
||||
// #elif defined(Q_WS_MAC)
|
||||
// if (!cacheLocation.endsWith(QDir::separator())) cacheLocation += QDir::separator();
|
||||
// #endif
|
||||
// #elif defined(Q_WS_MAC)
|
||||
// if (!cacheLocation.endsWith(QDir::separator())) cacheLocation += QDir::separator();
|
||||
// #endif
|
||||
|
||||
QDir dir;
|
||||
if (!dir.exists(cacheLocation))
|
||||
if (!dir.mkpath(cacheLocation))
|
||||
return;
|
||||
|
||||
// qDebug() << "opmap: map cache dir: " << cacheLocation;
|
||||
// qDebug() << "opmap: map cache dir: " << cacheLocation;
|
||||
|
||||
m_map->configuration->SetCacheLocation(cacheLocation);
|
||||
}
|
||||
@ -1482,9 +1482,9 @@ void OPMapGadgetWidget::createActions()
|
||||
|
||||
setHomeAct = new QAction(tr("Set the home location"), this);
|
||||
setHomeAct->setStatusTip(tr("Set the home location to where you clicked"));
|
||||
#if !defined(allow_manual_home_location_move)
|
||||
#if !defined(allow_manual_home_location_move)
|
||||
setHomeAct->setEnabled(false);
|
||||
#endif
|
||||
#endif
|
||||
connect(setHomeAct, SIGNAL(triggered()), this, SLOT(onSetHomeAct_triggered()));
|
||||
|
||||
goHomeAct = new QAction(tr("Go to &Home location"), this);
|
||||
@ -2150,8 +2150,8 @@ void OPMapGadgetWidget::moveToMagicWaypointPosition()
|
||||
if (m_map_mode != MagicWaypoint_MapMode)
|
||||
return;
|
||||
|
||||
// internals::PointLatLng coord = magic_waypoint.coord;
|
||||
// double altitude = magic_waypoint.altitude;
|
||||
// internals::PointLatLng coord = magic_waypoint.coord;
|
||||
// double altitude = magic_waypoint.altitude;
|
||||
|
||||
|
||||
// ToDo:
|
||||
@ -2220,11 +2220,11 @@ void OPMapGadgetWidget::showMagicWaypointControls()
|
||||
m_widget->lineWaypoint->setVisible(true);
|
||||
m_widget->toolButtonHomeWaypoint->setVisible(true);
|
||||
|
||||
#if defined(allow_manual_home_location_move)
|
||||
#if defined(allow_manual_home_location_move)
|
||||
m_widget->toolButtonMoveToWP->setVisible(true);
|
||||
#else
|
||||
#else
|
||||
m_widget->toolButtonMoveToWP->setVisible(false);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
@ -2240,8 +2240,8 @@ void OPMapGadgetWidget::keepMagicWaypointWithInSafeArea()
|
||||
// get the maximum safe distance - in kilometers
|
||||
double boundry_dist = (double)m_map->Home->SafeArea() / 1000;
|
||||
|
||||
// if (dist <= boundry_dist)
|
||||
// return; // the magic waypoint is still within the safe area, don't move it
|
||||
// if (dist <= boundry_dist)
|
||||
// return; // the magic waypoint is still within the safe area, don't move it
|
||||
|
||||
if (dist > boundry_dist) dist = boundry_dist;
|
||||
|
||||
@ -2269,7 +2269,7 @@ double OPMapGadgetWidget::distance(internals::PointLatLng from, internals::Point
|
||||
|
||||
// ***********************
|
||||
// Haversine formula
|
||||
/*
|
||||
/*
|
||||
double delta_lat = lat2 - lat1;
|
||||
double delta_lon = lon2 - lon1;
|
||||
|
||||
@ -2299,7 +2299,7 @@ double OPMapGadgetWidget::bearing(internals::PointLatLng from, internals::PointL
|
||||
double lat2 = to.Lat() * deg_to_rad;
|
||||
double lon2 = to.Lng() * deg_to_rad;
|
||||
|
||||
// double delta_lat = lat2 - lat1;
|
||||
// double delta_lat = lat2 - lat1;
|
||||
double delta_lon = lon2 - lon1;
|
||||
|
||||
double y = sin(delta_lon) * cos(lat2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user