mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:00:08 +00:00
Use layer names in ImGui Context names
This commit is contained in:
parent
ec296d98eb
commit
2be140d291
9 changed files with 38 additions and 25 deletions
|
|
@ -229,7 +229,10 @@ public:
|
|||
|
||||
AlertLayer::AlertLayer(std::shared_ptr<MapContext> context,
|
||||
awips::Phenomenon phenomenon) :
|
||||
DrawLayer(context), p(std::make_unique<Impl>(this, context, phenomenon))
|
||||
DrawLayer(
|
||||
context,
|
||||
fmt::format("AlertLayer {}", awips::GetPhenomenonText(phenomenon))),
|
||||
p(std::make_unique<Impl>(this, context, phenomenon))
|
||||
{
|
||||
for (auto alertActive : {false, true})
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,11 +20,13 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class DrawLayerImpl
|
||||
{
|
||||
public:
|
||||
explicit DrawLayerImpl(std::shared_ptr<MapContext> context) :
|
||||
explicit DrawLayerImpl(std::shared_ptr<MapContext> context,
|
||||
const std::string& imGuiContextName) :
|
||||
context_ {std::move(context)}, drawList_ {}
|
||||
{
|
||||
static size_t currentMapId_ {0u};
|
||||
imGuiContextName_ = fmt::format("Layer {}", ++currentMapId_);
|
||||
static size_t currentLayerId_ {0u};
|
||||
imGuiContextName_ =
|
||||
fmt::format("{} {}", imGuiContextName, ++currentLayerId_);
|
||||
// This must be initialized after the last line
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
|
||||
imGuiContext_ =
|
||||
|
|
@ -65,8 +67,10 @@ public:
|
|||
bool imGuiRendererInitialized_ {};
|
||||
};
|
||||
|
||||
DrawLayer::DrawLayer(const std::shared_ptr<MapContext>& context) :
|
||||
GenericLayer(context), p(std::make_unique<DrawLayerImpl>(context))
|
||||
DrawLayer::DrawLayer(const std::shared_ptr<MapContext>& context,
|
||||
const std::string& imGuiContextName) :
|
||||
GenericLayer(context),
|
||||
p(std::make_unique<DrawLayerImpl>(context, imGuiContextName))
|
||||
{
|
||||
}
|
||||
DrawLayer::~DrawLayer() = default;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ class DrawLayerImpl;
|
|||
class DrawLayer : public GenericLayer
|
||||
{
|
||||
public:
|
||||
explicit DrawLayer(const std::shared_ptr<MapContext>& context);
|
||||
explicit DrawLayer(const std::shared_ptr<MapContext>& context,
|
||||
const std::string& imGuiContextName);
|
||||
virtual ~DrawLayer();
|
||||
|
||||
virtual void Initialize() override;
|
||||
|
|
|
|||
|
|
@ -38,19 +38,21 @@ public:
|
|||
MapContext(MapContext&&) noexcept;
|
||||
MapContext& operator=(MapContext&&) noexcept;
|
||||
|
||||
std::weak_ptr<QMapLibre::Map> map() const;
|
||||
std::string map_copyrights() const;
|
||||
MapProvider map_provider() const;
|
||||
MapSettings& settings();
|
||||
QMargins color_table_margins() const;
|
||||
float pixel_ratio() const;
|
||||
common::Coordinate mouse_coordinate() const;
|
||||
std::shared_ptr<view::OverlayProductView> overlay_product_view() const;
|
||||
std::shared_ptr<view::RadarProductView> radar_product_view() const;
|
||||
common::RadarProductGroup radar_product_group() const;
|
||||
std::string radar_product() const;
|
||||
int16_t radar_product_code() const;
|
||||
[[nodiscard]] QWidget* widget() const;
|
||||
[[nodiscard]] std::weak_ptr<QMapLibre::Map> map() const;
|
||||
[[nodiscard]] std::string map_copyrights() const;
|
||||
[[nodiscard]] MapProvider map_provider() const;
|
||||
[[nodiscard]] MapSettings& settings();
|
||||
[[nodiscard]] QMargins color_table_margins() const;
|
||||
[[nodiscard]] float pixel_ratio() const;
|
||||
[[nodiscard]] common::Coordinate mouse_coordinate() const;
|
||||
[[nodiscard]] std::shared_ptr<view::OverlayProductView>
|
||||
overlay_product_view() const;
|
||||
[[nodiscard]] std::shared_ptr<view::RadarProductView>
|
||||
radar_product_view() const;
|
||||
[[nodiscard]] common::RadarProductGroup radar_product_group() const;
|
||||
[[nodiscard]] std::string radar_product() const;
|
||||
[[nodiscard]] int16_t radar_product_code() const;
|
||||
[[nodiscard]] QWidget* widget() const;
|
||||
|
||||
void set_map(const std::shared_ptr<QMapLibre::Map>& map);
|
||||
void set_map_copyrights(const std::string& copyrights);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,8 @@ void MarkerLayer::Impl::ReloadMarkers()
|
|||
}
|
||||
|
||||
MarkerLayer::MarkerLayer(const std::shared_ptr<MapContext>& context) :
|
||||
DrawLayer(context), p(std::make_unique<MarkerLayer::Impl>(this, context))
|
||||
DrawLayer(context, "MarkerLayer"),
|
||||
p(std::make_unique<MarkerLayer::Impl>(this, context))
|
||||
{
|
||||
AddDrawItem(p->geoIcons_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,8 @@ public:
|
|||
};
|
||||
|
||||
OverlayLayer::OverlayLayer(std::shared_ptr<MapContext> context) :
|
||||
DrawLayer(context), p(std::make_unique<OverlayLayerImpl>(this, context))
|
||||
DrawLayer(context, "OverlayLayer"),
|
||||
p(std::make_unique<OverlayLayerImpl>(this, context))
|
||||
{
|
||||
AddDrawItem(p->activeBoxOuter_);
|
||||
AddDrawItem(p->activeBoxInner_);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ public:
|
|||
};
|
||||
|
||||
OverlayProductLayer::OverlayProductLayer(std::shared_ptr<MapContext> context) :
|
||||
DrawLayer(context), p(std::make_unique<Impl>(this, context))
|
||||
DrawLayer(context, "OverlayProductLayer"),
|
||||
p(std::make_unique<Impl>(this, context))
|
||||
{
|
||||
auto overlayProductView = context->overlay_product_view();
|
||||
connect(overlayProductView.get(),
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
PlacefileLayer::PlacefileLayer(const std::shared_ptr<MapContext>& context,
|
||||
const std::string& placefileName) :
|
||||
DrawLayer(context),
|
||||
DrawLayer(context, fmt::format("PlacefileLayer {}", placefileName)),
|
||||
p(std::make_unique<PlacefileLayer::Impl>(this, context, placefileName))
|
||||
{
|
||||
AddDrawItem(p->placefileImages_);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
};
|
||||
|
||||
RadarSiteLayer::RadarSiteLayer(std::shared_ptr<MapContext> context) :
|
||||
DrawLayer(context), p(std::make_unique<Impl>(this))
|
||||
DrawLayer(context, "RadarSiteLayer"), p(std::make_unique<Impl>(this))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue