Merge pull request #321 from AdenKoperczak/location_markers_part2

Location Markers Part 2
This commit is contained in:
Dan Paulat 2025-01-12 01:05:19 -06:00 committed by GitHub
commit 60b4833eb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 1234 additions and 218 deletions

View file

@ -9,10 +9,10 @@
#include <scwx/qt/map/layer_wrapper.hpp>
#include <scwx/qt/map/map_provider.hpp>
#include <scwx/qt/map/map_settings.hpp>
#include <scwx/qt/map/marker_layer.hpp>
#include <scwx/qt/map/overlay_layer.hpp>
#include <scwx/qt/map/overlay_product_layer.hpp>
#include <scwx/qt/map/placefile_layer.hpp>
#include <scwx/qt/map/marker_layer.hpp>
#include <scwx/qt/map/radar_product_layer.hpp>
#include <scwx/qt/map/radar_range_layer.hpp>
#include <scwx/qt/map/radar_site_layer.hpp>
@ -21,6 +21,7 @@
#include <scwx/qt/settings/general_settings.hpp>
#include <scwx/qt/settings/map_settings.hpp>
#include <scwx/qt/settings/palette_settings.hpp>
#include <scwx/qt/ui/edit_marker_dialog.hpp>
#include <scwx/qt/util/file.hpp>
#include <scwx/qt/util/maplibre.hpp>
#include <scwx/qt/util/tooltip.hpp>
@ -127,8 +128,6 @@ public:
ImGui_ImplQt_Init();
InitializeCustomStyles();
ConnectSignals();
}
~MapWidgetImpl()
@ -219,6 +218,8 @@ public:
std::shared_ptr<model::LayerModel> layerModel_ {
model::LayerModel::Instance()};
ui::EditMarkerDialog* editMarkerDialog_ {nullptr};
std::shared_ptr<manager::HotkeyManager> hotkeyManager_ {
manager::HotkeyManager::Instance()};
std::shared_ptr<manager::PlacefileManager> placefileManager_ {
@ -283,6 +284,12 @@ MapWidget::MapWidget(std::size_t id, const QMapLibre::Settings& settings) :
setFocusPolicy(Qt::StrongFocus);
ImGui_ImplQt_RegisterWidget(this);
// Qt parent deals with memory management
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
p->editMarkerDialog_ = new ui::EditMarkerDialog(this);
p->ConnectSignals();
}
MapWidget::~MapWidget()
@ -429,6 +436,16 @@ void MapWidgetImpl::HandleHotkeyPressed(types::Hotkey hotkey, bool isAutoRepeat)
switch (hotkey)
{
case types::Hotkey::AddLocationMarker:
if (hasMouse_)
{
auto coordinate = map_->coordinateForPixel(lastPos_);
editMarkerDialog_->setup(coordinate.first, coordinate.second);
editMarkerDialog_->show();
}
break;
case types::Hotkey::ChangeMapStyle:
if (context_->settings().isActive_)
{