mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
GCS - OPMap - test functions
This commit is contained in:
parent
09a67af3e1
commit
5216835e18
@ -22,7 +22,8 @@ HEADERS += opmapplugin.h \
|
||||
modelmapproxy.h \
|
||||
widgetdelegates.h \
|
||||
pathplanner.h \
|
||||
modeluavoproxy.h
|
||||
modeluavoproxy.h \
|
||||
homeeditor.h
|
||||
|
||||
SOURCES += opmapplugin.cpp \
|
||||
opmapgadgetwidget.cpp \
|
||||
@ -37,7 +38,8 @@ SOURCES += opmapplugin.cpp \
|
||||
modelmapproxy.cpp \
|
||||
widgetdelegates.cpp \
|
||||
pathplanner.cpp \
|
||||
modeluavoproxy.cpp
|
||||
modeluavoproxy.cpp \
|
||||
homeeditor.cpp
|
||||
|
||||
OTHER_FILES += OPMapGadget.pluginspec
|
||||
|
||||
@ -47,6 +49,7 @@ FORMS += opmapgadgetoptionspage.ui \
|
||||
opmap_zoom_slider_widget.ui \
|
||||
opmap_statusbar_widget.ui \
|
||||
opmap_overlay_widget.ui \
|
||||
pathplanner.ui
|
||||
pathplanner.ui \
|
||||
homeeditor.ui
|
||||
|
||||
RESOURCES += opmap.qrc
|
||||
|
@ -840,7 +840,7 @@ void OPMapGadgetWidget::onTelemetryConnect()
|
||||
if (obum->getHomeLocation(set, LLA) < 0)
|
||||
return; // error
|
||||
|
||||
setHome(internals::PointLatLng(LLA[0], LLA[1]));
|
||||
setHome(internals::PointLatLng(LLA[0], LLA[1]),LLA[2]);
|
||||
|
||||
if (m_map)
|
||||
m_map->SetCurrentPosition(m_home_position.coord); // set the map position
|
||||
@ -856,12 +856,14 @@ void OPMapGadgetWidget::onTelemetryDisconnect()
|
||||
// Updates the Home position icon whenever the HomePosition object is updated
|
||||
void OPMapGadgetWidget::homePositionUpdated(UAVObject *hp)
|
||||
{
|
||||
if (!hp)
|
||||
return;
|
||||
Q_UNUSED(hp);
|
||||
if (!obum) return;
|
||||
bool set;
|
||||
double LLA[3];
|
||||
if (obum->getHomeLocation(set, LLA) < 0)
|
||||
return; // error
|
||||
setHome(internals::PointLatLng(LLA[0], LLA[1]),LLA[2]);
|
||||
|
||||
double lat = hp->getField("Latitude")->getDouble() * 1e-7;
|
||||
double lon = hp->getField("Longitude")->getDouble() * 1e-7;
|
||||
setHome(internals::PointLatLng(lat, lon));
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
@ -888,13 +890,13 @@ void OPMapGadgetWidget::setHome(QPointF pos)
|
||||
else
|
||||
if (longitude < -180) longitude = -180;
|
||||
|
||||
setHome(internals::PointLatLng(latitude, longitude));
|
||||
setHome(internals::PointLatLng(latitude, longitude),0);
|
||||
}
|
||||
|
||||
/**
|
||||
Sets the home position on the map widget
|
||||
*/
|
||||
void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon)
|
||||
void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon,double altitude)
|
||||
{
|
||||
if (!m_widget || !m_map)
|
||||
return;
|
||||
@ -916,12 +918,14 @@ void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon)
|
||||
if (longitude > 180) longitude = 180;
|
||||
else
|
||||
if (longitude < -180) longitude = -180;
|
||||
else if(altitude != altitude) altitude=0;
|
||||
|
||||
// *********
|
||||
|
||||
m_home_position.coord = internals::PointLatLng(latitude, longitude);
|
||||
|
||||
m_map->Home->SetCoord(m_home_position.coord);
|
||||
m_map->Home->SetAltitude(altitude);
|
||||
m_map->Home->RefreshPos();
|
||||
|
||||
// move the magic waypoint to keep it within the safe area boundry
|
||||
@ -1602,7 +1606,7 @@ void OPMapGadgetWidget::onSetHomeAct_triggered()
|
||||
if (!m_widget || !m_map)
|
||||
return;
|
||||
|
||||
setHome(m_context_menu_lat_lon);
|
||||
setHome(m_context_menu_lat_lon,0);
|
||||
|
||||
setHomeLocationObject(); // update the HomeLocation UAVObject
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
* @param
|
||||
*/
|
||||
void setHome(QPointF pos);
|
||||
void setHome(internals::PointLatLng pos_lat_lon);
|
||||
void setHome(internals::PointLatLng pos_lat_lon, double altitude);
|
||||
void goHome();
|
||||
void setZoom(int zoom);
|
||||
void setPosition(QPointF pos);
|
||||
|
@ -81,7 +81,10 @@ HEADERS += $$UAVOBJECT_SYNTHETICS/accessorydesired.h \
|
||||
$$UAVOBJECT_SYNTHETICS/cameradesired.h \
|
||||
$$UAVOBJECT_SYNTHETICS/faultsettings.h \
|
||||
$$UAVOBJECT_SYNTHETICS/pipxsettings.h \
|
||||
$$UAVOBJECT_SYNTHETICS/pipxstatus.h
|
||||
$$UAVOBJECT_SYNTHETICS/pipxstatus.h \
|
||||
$$UAVOBJECT_SYNTHETICS/waypoint.h \
|
||||
$$UAVOBJECT_SYNTHETICS/waypointactive.h \
|
||||
$$UAVOBJECT_SYNTHETICS/pathaction.h
|
||||
|
||||
SOURCES += $$UAVOBJECT_SYNTHETICS/accessorydesired.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/baroaltitude.cpp \
|
||||
@ -142,4 +145,7 @@ SOURCES += $$UAVOBJECT_SYNTHETICS/accessorydesired.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/cameradesired.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/faultsettings.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/pipxsettings.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/pipxstatus.cpp
|
||||
$$UAVOBJECT_SYNTHETICS/pipxstatus.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/waypoint.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/waypointactive.cpp \
|
||||
$$UAVOBJECT_SYNTHETICS/pathaction.cpp
|
||||
|
Loading…
x
Reference in New Issue
Block a user