From 7ed89fdd5d4c5ea3a80902fa42299f311019acb7 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Thu, 28 Nov 2024 11:17:31 -0500 Subject: [PATCH] added marker_types code for dealing with new marker icons --- scwx-qt/scwx-qt.cmake | 3 +- scwx-qt/source/scwx/qt/types/marker_types.cpp | 34 +++++++++++++++++++ scwx-qt/source/scwx/qt/types/marker_types.hpp | 25 ++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 scwx-qt/source/scwx/qt/types/marker_types.cpp diff --git a/scwx-qt/scwx-qt.cmake b/scwx-qt/scwx-qt.cmake index 54703605..7aca4dff 100644 --- a/scwx-qt/scwx-qt.cmake +++ b/scwx-qt/scwx-qt.cmake @@ -222,8 +222,8 @@ set(HDR_TYPES source/scwx/qt/types/alert_types.hpp source/scwx/qt/types/layer_types.hpp source/scwx/qt/types/location_types.hpp source/scwx/qt/types/map_types.hpp - source/scwx/qt/types/media_types.hpp source/scwx/qt/types/marker_types.hpp + source/scwx/qt/types/media_types.hpp source/scwx/qt/types/qt_types.hpp source/scwx/qt/types/radar_product_record.hpp source/scwx/qt/types/text_event_key.hpp @@ -239,6 +239,7 @@ set(SRC_TYPES source/scwx/qt/types/alert_types.cpp source/scwx/qt/types/layer_types.cpp source/scwx/qt/types/location_types.cpp source/scwx/qt/types/map_types.cpp + source/scwx/qt/types/marker_types.cpp source/scwx/qt/types/media_types.cpp source/scwx/qt/types/qt_types.cpp source/scwx/qt/types/radar_product_record.cpp diff --git a/scwx-qt/source/scwx/qt/types/marker_types.cpp b/scwx-qt/source/scwx/qt/types/marker_types.cpp new file mode 100644 index 00000000..ce63490a --- /dev/null +++ b/scwx-qt/source/scwx/qt/types/marker_types.cpp @@ -0,0 +1,34 @@ +#include + +namespace scwx +{ +namespace qt +{ +namespace types +{ + +const std::vector& getMarkerIcons() +{ + static std::vector markerIcons = {}; + if (markerIcons.size() == 0) + { + markerIcons = { + MarkerIconInfo(types::ImageTexture::LocationMarker, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationPin, 6, 16), + MarkerIconInfo(types::ImageTexture::LocationCrosshair, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationStar, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationBriefcase, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationBuildingColumns, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationBuilding, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationCaravan, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationHouse, -1, -1), + MarkerIconInfo(types::ImageTexture::LocationTent, -1, -1), + }; + } + + return markerIcons; +} + +} // namespace types +} // namespace qt +} // namespace scwx diff --git a/scwx-qt/source/scwx/qt/types/marker_types.hpp b/scwx-qt/source/scwx/qt/types/marker_types.hpp index e3d28e26..80f7430f 100644 --- a/scwx-qt/source/scwx/qt/types/marker_types.hpp +++ b/scwx-qt/source/scwx/qt/types/marker_types.hpp @@ -1,8 +1,12 @@ #pragma once +#include + #include #include +#include + namespace scwx { namespace qt @@ -24,6 +28,27 @@ struct MarkerInfo double longitude; }; +struct MarkerIconInfo { + explicit MarkerIconInfo(types::ImageTexture texture, + std::int32_t hotX, + std::int32_t hotY) : + name{types::GetTextureName(texture)}, + path{types::GetTexturePath(texture)}, + hotX{hotX}, + hotY{hotY}, + qIcon{QIcon(QString::fromStdString(path))} + { + } + + std::string name; + std::string path; + std::int32_t hotX; + std::int32_t hotY; + QIcon qIcon; +}; + +const std::vector& getMarkerIcons(); + } // namespace types } // namespace qt } // namespace scwx