mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-03 11:24:10 +01:00
Fixed map mode UI opmap button states.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1983 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
da84b1fc76
commit
1f3d45defd
@ -358,7 +358,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
connect(m_map, SIGNAL(WPInserted(int const&, WayPointItem*)), this, SLOT(WPInserted(int const&, WayPointItem*)));
|
connect(m_map, SIGNAL(WPInserted(int const&, WayPointItem*)), this, SLOT(WPInserted(int const&, WayPointItem*)));
|
||||||
connect(m_map, SIGNAL(WPDeleted(int const&)), this, SLOT(WPDeleted(int const&)));
|
connect(m_map, SIGNAL(WPDeleted(int const&)), this, SLOT(WPDeleted(int const&)));
|
||||||
|
|
||||||
m_map->SetCurrentPosition(home_position.coord); // set the map position
|
// m_map->SetCurrentPosition(home_position.coord); // set the map position
|
||||||
m_map->Home->SetCoord(home_position.coord); // set the HOME position
|
m_map->Home->SetCoord(home_position.coord); // set the HOME position
|
||||||
m_map->UAV->SetUAVPos(home_position.coord, 0.0); // set the UAV position
|
m_map->UAV->SetUAVPos(home_position.coord, 0.0); // set the UAV position
|
||||||
|
|
||||||
@ -1151,6 +1151,7 @@ void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon)
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if defined(allow_manual_home_location_move)
|
||||||
home_position.coord = pos_lat_lon;
|
home_position.coord = pos_lat_lon;
|
||||||
|
|
||||||
m_map->Home->SetCoord(home_position.coord);
|
m_map->Home->SetCoord(home_position.coord);
|
||||||
@ -1158,6 +1159,7 @@ void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon)
|
|||||||
|
|
||||||
// move the magic waypoint to keep it within the safe area boundry
|
// move the magic waypoint to keep it within the safe area boundry
|
||||||
keepMagicWaypointWithInSafeArea();
|
keepMagicWaypointWithInSafeArea();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::goHome()
|
void OPMapGadgetWidget::goHome()
|
||||||
@ -1301,7 +1303,20 @@ void OPMapGadgetWidget::setMapMode(opMapModeType mode)
|
|||||||
mode = Normal_MapMode; // fix error
|
mode = Normal_MapMode; // fix error
|
||||||
|
|
||||||
if (m_map_mode == mode)
|
if (m_map_mode == mode)
|
||||||
return; // no change in map mode
|
{ // no change in map mode
|
||||||
|
switch (mode)
|
||||||
|
{ // make sure the UI buttons are set correctly
|
||||||
|
case Normal_MapMode:
|
||||||
|
m_widget->toolButtonMagicWaypointMapMode->setChecked(false);
|
||||||
|
m_widget->toolButtonNormalMapMode->setChecked(true);
|
||||||
|
break;
|
||||||
|
case MagicWaypoint_MapMode:
|
||||||
|
m_widget->toolButtonNormalMapMode->setChecked(false);
|
||||||
|
m_widget->toolButtonMagicWaypointMapMode->setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
@ -1448,6 +1463,9 @@ void OPMapGadgetWidget::createActions()
|
|||||||
|
|
||||||
setHomeAct = new QAction(tr("Set the home location"), this);
|
setHomeAct = new QAction(tr("Set the home location"), this);
|
||||||
setHomeAct->setStatusTip(tr("Set the home location to where you clicked"));
|
setHomeAct->setStatusTip(tr("Set the home location to where you clicked"));
|
||||||
|
#if !defined(allow_manual_home_location_move)
|
||||||
|
setHomeAct->setEnabled(false);
|
||||||
|
#endif
|
||||||
connect(setHomeAct, SIGNAL(triggered()), this, SLOT(onSetHomeAct_triggered()));
|
connect(setHomeAct, SIGNAL(triggered()), this, SLOT(onSetHomeAct_triggered()));
|
||||||
|
|
||||||
goHomeAct = new QAction(tr("Go to &Home location"), this);
|
goHomeAct = new QAction(tr("Go to &Home location"), this);
|
||||||
@ -1508,9 +1526,6 @@ void OPMapGadgetWidget::createActions()
|
|||||||
|
|
||||||
homeMagicWaypointAct = new QAction(tr("Home magic waypoint"), this);
|
homeMagicWaypointAct = new QAction(tr("Home magic waypoint"), this);
|
||||||
homeMagicWaypointAct->setStatusTip(tr("Move the magic waypoint to the home position"));
|
homeMagicWaypointAct->setStatusTip(tr("Move the magic waypoint to the home position"));
|
||||||
#if !defined(allow_manual_home_location_move)
|
|
||||||
homeMagicWaypointAct->setEnabled(false);
|
|
||||||
#endif
|
|
||||||
connect(homeMagicWaypointAct, SIGNAL(triggered()), this, SLOT(onHomeMagicWaypointAct_triggered()));
|
connect(homeMagicWaypointAct, SIGNAL(triggered()), this, SLOT(onHomeMagicWaypointAct_triggered()));
|
||||||
|
|
||||||
mapModeActGroup = new QActionGroup(this);
|
mapModeActGroup = new QActionGroup(this);
|
||||||
@ -2029,12 +2044,10 @@ void OPMapGadgetWidget::homeMagicWaypoint()
|
|||||||
if (m_map_mode != MagicWaypoint_MapMode)
|
if (m_map_mode != MagicWaypoint_MapMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(allow_manual_home_location_move)
|
|
||||||
magic_waypoint.coord = home_position.coord;
|
magic_waypoint.coord = home_position.coord;
|
||||||
|
|
||||||
if (magic_waypoint.map_wp_item)
|
if (magic_waypoint.map_wp_item)
|
||||||
magic_waypoint.map_wp_item->SetCoord(magic_waypoint.coord);
|
magic_waypoint.map_wp_item->SetCoord(magic_waypoint.coord);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *************************************************************************************
|
// *************************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user