diff --git a/ground/src/plugins/opmap/images/combobox_down_arrow.png b/ground/src/plugins/opmap/images/combobox_down_arrow.png index ca83d016c..5c42554cf 100644 Binary files a/ground/src/plugins/opmap/images/combobox_down_arrow.png and b/ground/src/plugins/opmap/images/combobox_down_arrow.png differ diff --git a/ground/src/plugins/opmap/opmap.qrc b/ground/src/plugins/opmap/opmap.qrc index 7eaef4624..88f3f26fd 100644 --- a/ground/src/plugins/opmap/opmap.qrc +++ b/ground/src/plugins/opmap/opmap.qrc @@ -10,11 +10,11 @@ images/left_but.png images/next_waypoint.png images/prev_waypoint.png - images/combobox_down_arrow.png images/plus2.png images/minus2.png images/home.png images/hold.png images/go.png + images/combobox_down_arrow.png diff --git a/ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui index dfcc87e60..d73031162 100644 --- a/ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui +++ b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui @@ -37,6 +37,20 @@ + + QSplitter::handle { +/* image: url(images/splitter.png); */ + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(255, 255, 255, 80), stop:1 rgba(0, 0, 0, 80)); +} + +QSplitter::handle:horizontal { + height: 5px; +} + +QSplitter::handle:vertical { + width: 5px; +} + QFrame::NoFrame @@ -46,6 +60,9 @@ true + + 5 + false diff --git a/ground/src/plugins/opmap/opmap_widget.ui b/ground/src/plugins/opmap/opmap_widget.ui index a0dbdf163..58e41e01a 100644 --- a/ground/src/plugins/opmap/opmap_widget.ui +++ b/ground/src/plugins/opmap/opmap_widget.ui @@ -7,7 +7,7 @@ 0 0 704 - 327 + 422 @@ -534,6 +534,9 @@ p, li { white-space: pre-wrap; } 16777215 + + OpenHandCursor + Zoom level @@ -655,8 +658,18 @@ color: rgb(255, 255, 255); - background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255)); - + QSplitter::handle { +/* image: url(images/splitter.png); */ + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 255, 255, 48), stop:1 rgba(0, 0, 0, 48)); +} + +QSplitter::handle:horizontal { + height: 5px; +} + +QSplitter::handle:vertical { + width: 5px; +} QFrame::NoFrame @@ -670,8 +683,11 @@ color: rgb(255, 255, 255); Qt::Horizontal + + true + - 7 + 5 false @@ -844,13 +860,13 @@ border-radius: 2px; - 48 + 60 50 - 70 + 60 16777215 @@ -870,11 +886,11 @@ color: rgb(255, 255, 255); border: 0px; } QToolButton:hover { -background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(128, 128, 128, 255), stop:1 rgba(64, 64, 64, 255)); +background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(48, 48, 48, 255)); color: rgb(255, 255, 255); } QToolButton:pressed { -background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255)); +background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(180, 180, 180, 255)); color: rgb(255, 255, 255); } @@ -898,6 +914,44 @@ border-radius: 3px; 0 + + + + + 0 + 0 + + + + + 48 + 0 + + + + UAV hold position + + + + + + + + + + :/opmap/images/hold.png:/opmap/images/hold.png + + + + 60 + 60 + + + + false + + + @@ -933,8 +987,8 @@ border-radius: 3px; - 70 - 70 + 60 + 60 @@ -974,8 +1028,8 @@ border-radius: 3px; - 70 - 70 + 60 + 60 @@ -1012,46 +1066,8 @@ border-radius: 3px; - 70 - 70 - - - - false - - - - - - - - 0 - 0 - - - - - 48 - 0 - - - - UAV hold position - - - - - - - - - - :/opmap/images/hold.png:/opmap/images/hold.png - - - - 70 - 70 + 60 + 60 @@ -1088,8 +1104,8 @@ border-radius: 3px; - 70 - 70 + 60 + 60 @@ -1135,7 +1151,7 @@ color: rgba(255, 255, 255, 70); QLabel { /* all label types */ /* background-color: rgba(255, 255, 255, 0); */ -background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(64, 64, 64, 128), stop:1 rgba(128, 128, 128, 128)); +background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 128), stop:1 rgba(128, 128, 128, 128)); color: rgb(255, 255, 255); /*border: 1px solid black;*/ border: none; diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/src/plugins/opmap/opmapgadgetwidget.cpp index 56c1d5a87..a24fed6b5 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/src/plugins/opmap/opmapgadgetwidget.cpp @@ -72,6 +72,8 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_map->setFrameStyle(QFrame::NoFrame); m_map->configuration->DragButton = Qt::LeftButton; // use the left mouse button for map dragging + + m_map->setStyleSheet(" QToolTip { background-color: white; color: black; border: 1px solid black; padding: 5px; border-radius: 2px; /* opacity: 170; */ } "); } // ************** @@ -154,6 +156,10 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) connect(m_map, SIGNAL(OnMapTypeChanged(MapType::Types)), this, SLOT(OnMapTypeChanged(MapType::Types))); // map type changed connect(m_map, SIGNAL(OnEmptyTileError(int, core::Point)), this, SLOT(OnEmptyTileError(int, core::Point))); // tile error connect(m_map, SIGNAL(OnTilesStillToLoad(int)), this, SLOT(OnTilesStillToLoad(int))); // tile loading signals + connect(m_map, SIGNAL(WPNumberChanged(int const&,int const&,WayPointItem*)), this, SLOT(WPNumberChanged(int const&,int const&,WayPointItem*))); + connect(m_map, SIGNAL(WPValuesChanged(WayPointItem*)), this, SLOT(WPValuesChanged(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&))); m_map->SetMaxZoom(19); // increase the maximum zoom level m_map->SetMouseWheelZoomType(internals::MouseWheelZoomType::MousePositionWithoutCenter); // set how the mouse wheel zoom functions @@ -252,6 +258,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) OPMapGadgetWidget::~OPMapGadgetWidget() { + clearWayPoints(); if (m_map_overlay_widget) delete m_map_overlay_widget; if (wayPoint_treeView_model) delete wayPoint_treeView_model; if (waypoint_editor) delete waypoint_editor; @@ -538,14 +545,37 @@ void OPMapGadgetWidget::OnTileLoadComplete() void OPMapGadgetWidget::OnMapZoomChanged() { + // to do } void OPMapGadgetWidget::OnMapTypeChanged(MapType::Types type) { + // to do } void OPMapGadgetWidget::OnEmptyTileError(int zoom, core::Point pos) { + // to do +} + +void OPMapGadgetWidget::WPNumberChanged(int const& oldnumber, int const& newnumber, WayPointItem* waypoint) +{ + // to do +} + +void OPMapGadgetWidget::WPValuesChanged(WayPointItem* waypoint) +{ + // to do +} + +void OPMapGadgetWidget::WPInserted(int const& number, WayPointItem* waypoint) +{ + // to do +} + +void OPMapGadgetWidget::WPDeleted(int const& number) +{ + // to do } // ************************************************************************************* @@ -643,14 +673,33 @@ void OPMapGadgetWidget::on_horizontalSliderZoom_sliderMoved(int position) void OPMapGadgetWidget::on_toolButtonHome_clicked() { + // to do +} + + +void OPMapGadgetWidget::on_toolButtonPrevWaypoint_clicked() +{ + // to do +} + +void OPMapGadgetWidget::on_toolButtonNextWaypoint_clicked() +{ + // to do } void OPMapGadgetWidget::on_toolButtonHoldPosition_clicked() { + // to do } void OPMapGadgetWidget::on_toolButtonGo_clicked() { + // to do +} + +void OPMapGadgetWidget::on_toolButtonAddWaypoint_clicked() +{ + addWayPoint(); } void OPMapGadgetWidget::on_toolButtonWaypointEditor_clicked() @@ -1009,6 +1058,22 @@ void OPMapGadgetWidget::openWayPointEditor() void OPMapGadgetWidget::addWayPoint() { + if (m_map) + { + m_waypoint_list_mutex.lock(); + + // create a waypoint + t_waypoint waypoint; + waypoint.item = m_map->WPCreate(); + waypoint.time_seconds = 0; + waypoint.hold_time_seconds = 0; + + // and remember it + m_waypoint_list.append(waypoint); + + m_waypoint_list_mutex.unlock(); + } + // to do } @@ -1019,7 +1084,10 @@ void OPMapGadgetWidget::deleteWayPoint() void OPMapGadgetWidget::clearWayPoints() { - // to do + m_waypoint_list_mutex.lock(); + if (m_map) m_map->WPDeleteAll(); + m_waypoint_list.clear(); + m_waypoint_list_mutex.unlock(); } void OPMapGadgetWidget::gridLines() diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.h b/ground/src/plugins/opmap/opmapgadgetwidget.h index ce50ba66d..56024e071 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.h +++ b/ground/src/plugins/opmap/opmapgadgetwidget.h @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include "uavobjects/uavobjectmanager.h" #include "uavobjects/positionactual.h" @@ -48,6 +50,18 @@ namespace Ui using namespace mapcontrol; +// ****************************************************** + +// waypoint structure +typedef struct t_waypoint +{ + mapcontrol::WayPointItem *item; + int time_seconds; + int hold_time_seconds; +} t_waypoint; + +// ****************************************************** + class OPMapGadgetWidget : public QWidget { Q_OBJECT @@ -79,7 +93,11 @@ private slots: void zoomIn(); void zoomOut(); - // user control signals + /** + * @brief signals received from the various map plug-in widget user controls + * + * @param + */ void on_toolButtonReload_clicked(); void on_comboBoxFindPlace_returnPressed(); void on_toolButtonFindPlace_clicked(); @@ -90,15 +108,20 @@ private slots: void on_toolButtonMapHome_clicked(); void on_toolButtonMapUAV_clicked(); void on_horizontalSliderZoom_sliderMoved(int position); + void on_toolButtonAddWaypoint_clicked(); void on_toolButtonWaypointEditor_clicked(); - void on_treeViewWaypoints_clicked(QModelIndex index); - void on_toolButtonHome_clicked(); + void on_toolButtonNextWaypoint_clicked(); + void on_toolButtonPrevWaypoint_clicked(); void on_toolButtonHoldPosition_clicked(); void on_toolButtonGo_clicked(); - // map signals + /** + * @brief signals received from the map object + * + * @param + */ void zoomChanged(double zoom); void OnCurrentPositionChanged(internals::PointLatLng point); void OnTileLoadComplete(); @@ -108,8 +131,16 @@ private slots: void OnMapTypeChanged(MapType::Types type); void OnEmptyTileError(int zoom, core::Point pos); void OnTilesStillToLoad(int number); + void WPNumberChanged(int const& oldnumber,int const& newnumber, WayPointItem* waypoint); + void WPValuesChanged(WayPointItem* waypoint); + void WPInserted(int const& number, WayPointItem* waypoint); + void WPDeleted(int const& number); - // context menu signals + /** + * @brief mouse right click context menu signals + * + * @param + */ void reload(); void findPlace(); void goZoomIn(); @@ -171,6 +202,9 @@ private: QStandardItemModel *wayPoint_treeView_model; + QList m_waypoint_list; + QMutex m_waypoint_list_mutex; + void createActions(); QAction *closeAct;