mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:10:04 +00:00
MapContext has a GlContext instead of MapContext is a GlContext
This commit is contained in:
parent
58f2609fe7
commit
2d4ad2737e
31 changed files with 147 additions and 307 deletions
|
|
@ -135,9 +135,9 @@ public:
|
|||
std::size_t lineWidth_ {};
|
||||
};
|
||||
|
||||
explicit Impl(AlertLayer* self,
|
||||
std::shared_ptr<MapContext> context,
|
||||
awips::Phenomenon phenomenon) :
|
||||
explicit Impl(AlertLayer* self,
|
||||
std::shared_ptr<gl::GlContext> context,
|
||||
awips::Phenomenon phenomenon) :
|
||||
self_ {self},
|
||||
phenomenon_ {phenomenon},
|
||||
ibw_ {awips::ibw::GetImpactBasedWarningInfo(phenomenon)},
|
||||
|
|
@ -250,7 +250,7 @@ AlertLayer::AlertLayer(const std::shared_ptr<MapContext>& context,
|
|||
DrawLayer(
|
||||
context,
|
||||
fmt::format("AlertLayer {}", awips::GetPhenomenonText(phenomenon))),
|
||||
p(std::make_unique<Impl>(this, context, phenomenon))
|
||||
p(std::make_unique<Impl>(this, context->gl_context(), phenomenon))
|
||||
{
|
||||
for (auto alertActive : {false, true})
|
||||
{
|
||||
|
|
@ -298,7 +298,7 @@ void AlertLayer::Initialize()
|
|||
|
||||
void AlertLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
for (auto alertActive : {false, true})
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,14 +6,8 @@
|
|||
#include <scwx/qt/types/text_event_key.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class AlertLayer : public DrawLayer
|
||||
|
|
@ -40,6 +34,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -14,11 +14,7 @@
|
|||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::color_table_layer";
|
||||
|
|
@ -51,7 +47,7 @@ public:
|
|||
bool colorTableNeedsUpdate_;
|
||||
};
|
||||
|
||||
ColorTableLayer::ColorTableLayer(std::shared_ptr<MapContext> context) :
|
||||
ColorTableLayer::ColorTableLayer(const std::shared_ptr<MapContext>& context) :
|
||||
GenericLayer(context), p(std::make_unique<ColorTableLayerImpl>())
|
||||
{
|
||||
}
|
||||
|
|
@ -61,11 +57,13 @@ void ColorTableLayer::Initialize()
|
|||
{
|
||||
logger_->debug("Initialize()");
|
||||
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
auto glContext = context()->gl_context();
|
||||
|
||||
gl::OpenGLFunctions& gl = glContext->gl();
|
||||
|
||||
// Load and configure overlay shader
|
||||
p->shaderProgram_ =
|
||||
context()->GetShaderProgram(":/gl/texture1d.vert", ":/gl/texture1d.frag");
|
||||
glContext->GetShaderProgram(":/gl/texture1d.vert", ":/gl/texture1d.frag");
|
||||
|
||||
p->uMVPMatrixLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uMVPMatrix");
|
||||
|
|
@ -118,7 +116,7 @@ void ColorTableLayer::Initialize()
|
|||
void ColorTableLayer::Render(
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
auto radarProductView = context()->radar_product_view();
|
||||
|
||||
if (context()->radar_product_view() == nullptr ||
|
||||
|
|
@ -196,7 +194,7 @@ void ColorTableLayer::Deinitialize()
|
|||
{
|
||||
logger_->debug("Deinitialize()");
|
||||
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
gl.glDeleteVertexArrays(1, &p->vao_);
|
||||
gl.glDeleteBuffers(2, p->vbo_.data());
|
||||
|
|
@ -210,6 +208,4 @@ void ColorTableLayer::Deinitialize()
|
|||
context()->set_color_table_margins(QMargins {});
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <scwx/qt/map/generic_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class ColorTableLayerImpl;
|
||||
|
|
@ -14,7 +10,7 @@ class ColorTableLayerImpl;
|
|||
class ColorTableLayer : public GenericLayer
|
||||
{
|
||||
public:
|
||||
explicit ColorTableLayer(std::shared_ptr<MapContext> context);
|
||||
explicit ColorTableLayer(const std::shared_ptr<MapContext>& context);
|
||||
~ColorTableLayer();
|
||||
|
||||
void Initialize() override final;
|
||||
|
|
@ -25,6 +21,4 @@ private:
|
|||
std::unique_ptr<ColorTableLayerImpl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ DrawLayer::~DrawLayer() = default;
|
|||
|
||||
void DrawLayer::Initialize()
|
||||
{
|
||||
p->textureAtlas_ = p->context_->GetTextureAtlas();
|
||||
p->textureAtlas_ = p->context_->gl_context()->GetTextureAtlas();
|
||||
|
||||
for (auto& item : p->drawList_)
|
||||
{
|
||||
|
|
@ -123,13 +123,14 @@ void DrawLayer::ImGuiInitialize()
|
|||
void DrawLayer::RenderWithoutImGui(
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = p->context_->gl();
|
||||
p->textureAtlas_ = p->context_->GetTextureAtlas();
|
||||
auto glContext = p->context_->gl_context();
|
||||
|
||||
gl::OpenGLFunctions& gl = glContext->gl();
|
||||
p->textureAtlas_ = glContext->GetTextureAtlas();
|
||||
|
||||
// Determine if the texture atlas changed since last render
|
||||
std::uint64_t newTextureAtlasBuildCount =
|
||||
p->context_->texture_buffer_count();
|
||||
bool textureAtlasChanged =
|
||||
std::uint64_t newTextureAtlasBuildCount = glContext->texture_buffer_count();
|
||||
bool textureAtlasChanged =
|
||||
newTextureAtlasBuildCount != p->textureAtlasBuildCount_;
|
||||
|
||||
// Set OpenGL blend mode for transparency
|
||||
|
|
|
|||
|
|
@ -3,11 +3,7 @@
|
|||
#include <scwx/qt/gl/draw/draw_item.hpp>
|
||||
#include <scwx/qt/map/generic_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class DrawLayerImpl;
|
||||
|
|
@ -44,6 +40,4 @@ private:
|
|||
std::unique_ptr<DrawLayerImpl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
#include <scwx/qt/map/generic_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class GenericLayerImpl
|
||||
{
|
||||
public:
|
||||
explicit GenericLayerImpl(std::shared_ptr<MapContext> context) :
|
||||
context_ {context}
|
||||
context_ {std::move(context)}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +16,7 @@ public:
|
|||
std::shared_ptr<MapContext> context_;
|
||||
};
|
||||
|
||||
GenericLayer::GenericLayer(std::shared_ptr<MapContext> context) :
|
||||
GenericLayer::GenericLayer(const std::shared_ptr<MapContext>& context) :
|
||||
p(std::make_unique<GenericLayerImpl>(context))
|
||||
{
|
||||
}
|
||||
|
|
@ -43,6 +39,4 @@ std::shared_ptr<MapContext> GenericLayer::context() const
|
|||
return p->context_;
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -10,11 +10,7 @@
|
|||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <qmaplibre.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class GenericLayerImpl;
|
||||
|
|
@ -24,7 +20,7 @@ class GenericLayer : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GenericLayer(std::shared_ptr<MapContext> context);
|
||||
explicit GenericLayer(const std::shared_ptr<MapContext>& context);
|
||||
virtual ~GenericLayer();
|
||||
|
||||
virtual void Initialize() = 0;
|
||||
|
|
@ -61,6 +57,4 @@ private:
|
|||
std::unique_ptr<GenericLayerImpl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
#include <scwx/qt/map/layer_wrapper.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class LayerWrapperImpl
|
||||
{
|
||||
public:
|
||||
explicit LayerWrapperImpl(std::shared_ptr<GenericLayer> layer) :
|
||||
layer_ {layer}
|
||||
layer_ {std::move(layer)}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +16,7 @@ public:
|
|||
std::shared_ptr<GenericLayer> layer_;
|
||||
};
|
||||
|
||||
LayerWrapper::LayerWrapper(std::shared_ptr<GenericLayer> layer) :
|
||||
LayerWrapper::LayerWrapper(const std::shared_ptr<GenericLayer>& layer) :
|
||||
p(std::make_unique<LayerWrapperImpl>(layer))
|
||||
{
|
||||
}
|
||||
|
|
@ -58,6 +54,4 @@ void LayerWrapper::deinitialize()
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <scwx/qt/map/generic_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class LayerWrapperImpl;
|
||||
|
|
@ -14,7 +10,7 @@ class LayerWrapperImpl;
|
|||
class LayerWrapper : public QMapLibre::CustomLayerHostInterface
|
||||
{
|
||||
public:
|
||||
explicit LayerWrapper(std::shared_ptr<GenericLayer> layer);
|
||||
explicit LayerWrapper(const std::shared_ptr<GenericLayer>& layer);
|
||||
~LayerWrapper();
|
||||
|
||||
LayerWrapper(const LayerWrapper&) = delete;
|
||||
|
|
@ -31,6 +27,4 @@ private:
|
|||
std::unique_ptr<LayerWrapperImpl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -3,11 +3,7 @@
|
|||
#include <scwx/qt/view/overlay_product_view.hpp>
|
||||
#include <scwx/qt/view/radar_product_view.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class MapContext::Impl
|
||||
|
|
@ -20,14 +16,17 @@ public:
|
|||
|
||||
~Impl() {}
|
||||
|
||||
std::shared_ptr<gl::GlContext> glContext_ {
|
||||
std::make_shared<gl::GlContext>()};
|
||||
|
||||
std::weak_ptr<QMapLibre::Map> map_ {};
|
||||
MapSettings settings_ {};
|
||||
float pixelRatio_ {1.0f};
|
||||
common::RadarProductGroup radarProductGroup_ {
|
||||
common::RadarProductGroup::Unknown};
|
||||
std::string radarProduct_ {"???"};
|
||||
int16_t radarProductCode_ {0};
|
||||
std::shared_ptr<config::RadarSite> radarSite_ {nullptr};
|
||||
std::string radarProduct_ {"???"};
|
||||
int16_t radarProductCode_ {0};
|
||||
std::shared_ptr<config::RadarSite> radarSite_ {nullptr};
|
||||
|
||||
MapProvider mapProvider_ {MapProvider::Unknown};
|
||||
std::string mapCopyrights_ {};
|
||||
|
|
@ -51,6 +50,11 @@ MapContext::~MapContext() = default;
|
|||
MapContext::MapContext(MapContext&&) noexcept = default;
|
||||
MapContext& MapContext::operator=(MapContext&&) noexcept = default;
|
||||
|
||||
std::shared_ptr<gl::GlContext> MapContext::gl_context() const
|
||||
{
|
||||
return p->glContext_;
|
||||
}
|
||||
|
||||
std::weak_ptr<QMapLibre::Map> MapContext::map() const
|
||||
{
|
||||
return p->map_;
|
||||
|
|
@ -190,6 +194,4 @@ void MapContext::set_widget(QWidget* widget)
|
|||
p->widget_ = widget;
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -9,27 +9,25 @@
|
|||
#include <qmaplibre.hpp>
|
||||
#include <QMargins>
|
||||
|
||||
namespace scwx::qt
|
||||
{
|
||||
namespace view
|
||||
namespace scwx::qt::view
|
||||
{
|
||||
|
||||
class OverlayProductView;
|
||||
class RadarProductView;
|
||||
|
||||
} // namespace view
|
||||
} // namespace scwx::qt::view
|
||||
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
struct MapSettings;
|
||||
|
||||
class MapContext : public gl::GlContext
|
||||
class MapContext
|
||||
{
|
||||
public:
|
||||
explicit MapContext(
|
||||
std::shared_ptr<view::RadarProductView> radarProductView = nullptr);
|
||||
~MapContext() override;
|
||||
~MapContext();
|
||||
|
||||
MapContext(const MapContext&) = delete;
|
||||
MapContext& operator=(const MapContext&) = delete;
|
||||
|
|
@ -37,6 +35,8 @@ public:
|
|||
MapContext(MapContext&&) noexcept;
|
||||
MapContext& operator=(MapContext&&) noexcept;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<gl::GlContext> gl_context() const;
|
||||
|
||||
[[nodiscard]] std::weak_ptr<QMapLibre::Map> map() const;
|
||||
[[nodiscard]] std::string map_copyrights() const;
|
||||
[[nodiscard]] MapProvider map_provider() const;
|
||||
|
|
@ -76,5 +76,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace scwx::qt
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -5,11 +5,7 @@
|
|||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::unordered_map<MapProvider, std::string> mapProviderName_ {
|
||||
|
|
@ -243,6 +239,4 @@ const MapProviderInfo& GetMapProviderInfo(MapProvider mapProvider)
|
|||
return mapProviderInfo_.at(mapProvider);
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@
|
|||
|
||||
#include <QMapLibre/Settings>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
enum class MapProvider
|
||||
|
|
@ -19,9 +15,8 @@ enum class MapProvider
|
|||
MapTiler,
|
||||
Unknown
|
||||
};
|
||||
typedef scwx::util::
|
||||
Iterator<MapProvider, MapProvider::Mapbox, MapProvider::MapTiler>
|
||||
MapProviderIterator;
|
||||
using MapProviderIterator = scwx::util::
|
||||
Iterator<MapProvider, MapProvider::Mapbox, MapProvider::MapTiler>;
|
||||
|
||||
struct MapStyle
|
||||
{
|
||||
|
|
@ -29,7 +24,7 @@ struct MapStyle
|
|||
std::string url_;
|
||||
std::vector<std::string> drawBelow_;
|
||||
|
||||
bool IsValid() const;
|
||||
[[nodiscard]] bool IsValid() const;
|
||||
};
|
||||
|
||||
struct MapProviderInfo
|
||||
|
|
@ -45,6 +40,4 @@ std::string GetMapProviderName(MapProvider mapProvider);
|
|||
std::string GetMapProviderApiKey(MapProvider mapProvider);
|
||||
const MapProviderInfo& GetMapProviderInfo(MapProvider mapProvider);
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
struct MapSettings
|
||||
|
|
@ -22,6 +18,4 @@ struct MapSettings
|
|||
bool radarWireframeEnabled_ {false};
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#include <ranges>
|
||||
#include <scwx/qt/map/map_widget.hpp>
|
||||
#include <scwx/qt/gl/gl.hpp>
|
||||
#include <scwx/qt/manager/font_manager.hpp>
|
||||
|
|
@ -32,6 +31,7 @@
|
|||
#include <scwx/util/time.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <ranges>
|
||||
#include <set>
|
||||
|
||||
#include <backends/imgui_impl_opengl3.h>
|
||||
|
|
@ -57,11 +57,7 @@
|
|||
#include <QString>
|
||||
#include <QTextDocument>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::map_widget";
|
||||
|
|
@ -1545,7 +1541,8 @@ void MapWidget::initializeGL()
|
|||
logger_->debug("initializeGL()");
|
||||
|
||||
makeCurrent();
|
||||
p->context_->Initialize();
|
||||
|
||||
p->context_->gl_context()->Initialize();
|
||||
|
||||
// Lock ImGui font atlas prior to new ImGui frame
|
||||
std::shared_lock imguiFontAtlasLock {
|
||||
|
|
@ -1599,7 +1596,7 @@ void MapWidget::paintGL()
|
|||
|
||||
p->frameDraws_++;
|
||||
|
||||
p->context_->StartFrame();
|
||||
p->context_->gl_context()->StartFrame();
|
||||
|
||||
// Handle hotkey updates
|
||||
p->HandleHotkeyUpdates();
|
||||
|
|
@ -2251,8 +2248,6 @@ void MapWidgetImpl::CheckLevel3Availability()
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
||||
#include "map_widget.moc"
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ class QKeyEvent;
|
|||
class QMouseEvent;
|
||||
class QWheelEvent;
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class MapWidgetImpl;
|
||||
|
|
@ -188,6 +184,4 @@ signals:
|
|||
void IncomingLevel2ElevationChanged(std::optional<float> incomingElevation);
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -10,11 +10,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::marker_layer";
|
||||
|
|
@ -23,7 +19,7 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class MarkerLayer::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(MarkerLayer* self, std::shared_ptr<MapContext> context) :
|
||||
explicit Impl(MarkerLayer* self, std::shared_ptr<gl::GlContext> context) :
|
||||
self_ {self},
|
||||
geoIcons_ {std::make_shared<gl::draw::GeoIcons>(context)},
|
||||
editMarkerDialog_ {std::make_shared<ui::EditMarkerDialog>()}
|
||||
|
|
@ -42,7 +38,7 @@ public:
|
|||
|
||||
MarkerLayer* self_;
|
||||
|
||||
std::shared_ptr<gl::draw::GeoIcons> geoIcons_;
|
||||
std::shared_ptr<gl::draw::GeoIcons> geoIcons_;
|
||||
std::shared_ptr<ui::EditMarkerDialog> editMarkerDialog_;
|
||||
};
|
||||
|
||||
|
|
@ -130,7 +126,7 @@ void MarkerLayer::Impl::ReloadMarkers()
|
|||
|
||||
MarkerLayer::MarkerLayer(const std::shared_ptr<MapContext>& context) :
|
||||
DrawLayer(context, "MarkerLayer"),
|
||||
p(std::make_unique<MarkerLayer::Impl>(this, context))
|
||||
p(std::make_unique<MarkerLayer::Impl>(this, context->gl_context()))
|
||||
{
|
||||
AddDrawItem(p->geoIcons_);
|
||||
}
|
||||
|
|
@ -162,7 +158,7 @@ void MarkerLayer::Impl::set_icon_sheets()
|
|||
|
||||
void MarkerLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
DrawLayer::Render(params);
|
||||
|
||||
|
|
@ -176,6 +172,4 @@ void MarkerLayer::Deinitialize()
|
|||
DrawLayer::Deinitialize();
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,13 +2,7 @@
|
|||
|
||||
#include <scwx/qt/map/draw_layer.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class MarkerLayer : public DrawLayer
|
||||
|
|
@ -28,6 +22,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -26,11 +26,7 @@
|
|||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::overlay_layer";
|
||||
|
|
@ -39,8 +35,8 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class OverlayLayerImpl
|
||||
{
|
||||
public:
|
||||
explicit OverlayLayerImpl(OverlayLayer* self,
|
||||
std::shared_ptr<MapContext> context) :
|
||||
explicit OverlayLayerImpl(OverlayLayer* self,
|
||||
std::shared_ptr<gl::GlContext> context) :
|
||||
self_ {self},
|
||||
activeBoxOuter_ {std::make_shared<gl::draw::Rectangle>(context)},
|
||||
activeBoxInner_ {std::make_shared<gl::draw::Rectangle>(context)},
|
||||
|
|
@ -155,9 +151,9 @@ public:
|
|||
bool sweepTimePicked_ {false};
|
||||
};
|
||||
|
||||
OverlayLayer::OverlayLayer(std::shared_ptr<MapContext> context) :
|
||||
OverlayLayer::OverlayLayer(const std::shared_ptr<MapContext>& context) :
|
||||
DrawLayer(context, "OverlayLayer"),
|
||||
p(std::make_unique<OverlayLayerImpl>(this, context))
|
||||
p(std::make_unique<OverlayLayerImpl>(this, context->gl_context()))
|
||||
{
|
||||
AddDrawItem(p->activeBoxOuter_);
|
||||
AddDrawItem(p->activeBoxInner_);
|
||||
|
|
@ -336,7 +332,7 @@ void OverlayLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
|||
{
|
||||
const std::unique_lock lock {p->renderMutex_};
|
||||
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
auto radarProductView = context()->radar_product_view();
|
||||
auto& settings = context()->settings();
|
||||
const float pixelRatio = context()->pixel_ratio();
|
||||
|
|
@ -616,6 +612,4 @@ void OverlayLayer::UpdateSweepTimeNextFrame()
|
|||
p->sweepTimeNeedsUpdate_ = true;
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <scwx/qt/map/draw_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class OverlayLayerImpl;
|
||||
|
|
@ -16,7 +12,7 @@ class OverlayLayer : public DrawLayer
|
|||
Q_DISABLE_COPY_MOVE(OverlayLayer)
|
||||
|
||||
public:
|
||||
explicit OverlayLayer(std::shared_ptr<MapContext> context);
|
||||
explicit OverlayLayer(const std::shared_ptr<MapContext>& context);
|
||||
~OverlayLayer();
|
||||
|
||||
void Initialize() override final;
|
||||
|
|
@ -38,6 +34,4 @@ private:
|
|||
std::unique_ptr<OverlayLayerImpl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -11,11 +11,7 @@
|
|||
#include <scwx/util/logger.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::overlay_product_layer";
|
||||
|
|
@ -24,8 +20,8 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class OverlayProductLayer::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(OverlayProductLayer* self,
|
||||
const std::shared_ptr<MapContext>& context) :
|
||||
explicit Impl(OverlayProductLayer* self,
|
||||
std::shared_ptr<gl::GlContext> context) :
|
||||
self_ {self},
|
||||
linkedVectors_ {std::make_shared<gl::draw::LinkedVectors>(context)}
|
||||
{
|
||||
|
|
@ -108,9 +104,10 @@ public:
|
|||
std::shared_ptr<gl::draw::LinkedVectors> linkedVectors_;
|
||||
};
|
||||
|
||||
OverlayProductLayer::OverlayProductLayer(std::shared_ptr<MapContext> context) :
|
||||
OverlayProductLayer::OverlayProductLayer(
|
||||
const std::shared_ptr<MapContext>& context) :
|
||||
DrawLayer(context, "OverlayProductLayer"),
|
||||
p(std::make_unique<Impl>(this, context))
|
||||
p(std::make_unique<Impl>(this, context->gl_context()))
|
||||
{
|
||||
auto overlayProductView = context->overlay_product_view();
|
||||
connect(overlayProductView.get(),
|
||||
|
|
@ -142,7 +139,7 @@ void OverlayProductLayer::Initialize()
|
|||
void OverlayProductLayer::Render(
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
if (p->stiNeedsUpdate_)
|
||||
{
|
||||
|
|
@ -449,6 +446,4 @@ bool OverlayProductLayer::RunMousePicking(
|
|||
eventHandler);
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,17 +2,13 @@
|
|||
|
||||
#include <scwx/qt/map/draw_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class OverlayProductLayer : public DrawLayer
|
||||
{
|
||||
public:
|
||||
explicit OverlayProductLayer(std::shared_ptr<MapContext> context);
|
||||
explicit OverlayProductLayer(const std::shared_ptr<MapContext>& context);
|
||||
~OverlayProductLayer();
|
||||
|
||||
void Initialize() override final;
|
||||
|
|
@ -32,6 +28,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -12,11 +12,7 @@
|
|||
#include <boost/asio/post.hpp>
|
||||
#include <boost/asio/thread_pool.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::placefile_layer";
|
||||
|
|
@ -25,9 +21,9 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class PlacefileLayer::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(PlacefileLayer* self,
|
||||
const std::shared_ptr<MapContext>& context,
|
||||
const std::string& placefileName) :
|
||||
explicit Impl(PlacefileLayer* self,
|
||||
std::shared_ptr<gl::GlContext> context,
|
||||
const std::string& placefileName) :
|
||||
self_ {self},
|
||||
placefileName_ {placefileName},
|
||||
placefileIcons_ {std::make_shared<gl::draw::PlacefileIcons>(context)},
|
||||
|
|
@ -67,7 +63,8 @@ public:
|
|||
PlacefileLayer::PlacefileLayer(const std::shared_ptr<MapContext>& context,
|
||||
const std::string& placefileName) :
|
||||
DrawLayer(context, fmt::format("PlacefileLayer {}", placefileName)),
|
||||
p(std::make_unique<PlacefileLayer::Impl>(this, context, placefileName))
|
||||
p(std::make_unique<PlacefileLayer::Impl>(
|
||||
this, context->gl_context(), placefileName))
|
||||
{
|
||||
AddDrawItem(p->placefileImages_);
|
||||
AddDrawItem(p->placefilePolygons_);
|
||||
|
|
@ -129,7 +126,7 @@ void PlacefileLayer::Initialize()
|
|||
void PlacefileLayer::Render(
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
std::shared_ptr<manager::PlacefileManager> placefileManager =
|
||||
manager::PlacefileManager::Instance();
|
||||
|
|
@ -261,6 +258,4 @@ void PlacefileLayer::Impl::ReloadDataSync()
|
|||
Q_EMIT self_->DataReloaded();
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class PlacefileLayer : public DrawLayer
|
||||
|
|
@ -38,6 +34,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -26,11 +26,7 @@
|
|||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::radar_product_layer";
|
||||
|
|
@ -76,7 +72,8 @@ public:
|
|||
bool sweepNeedsUpdate_;
|
||||
};
|
||||
|
||||
RadarProductLayer::RadarProductLayer(std::shared_ptr<MapContext> context) :
|
||||
RadarProductLayer::RadarProductLayer(
|
||||
const std::shared_ptr<MapContext>& context) :
|
||||
GenericLayer(context), p(std::make_unique<RadarProductLayerImpl>())
|
||||
{
|
||||
auto radarProductView = context->radar_product_view();
|
||||
|
|
@ -95,11 +92,13 @@ void RadarProductLayer::Initialize()
|
|||
{
|
||||
logger_->debug("Initialize()");
|
||||
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
auto glContext = context()->gl_context();
|
||||
|
||||
gl::OpenGLFunctions& gl = glContext->gl();
|
||||
|
||||
// Load and configure radar shader
|
||||
p->shaderProgram_ =
|
||||
context()->GetShaderProgram(":/gl/radar.vert", ":/gl/radar.frag");
|
||||
glContext->GetShaderProgram(":/gl/radar.vert", ":/gl/radar.frag");
|
||||
|
||||
p->uMVPMatrixLocation_ =
|
||||
gl.glGetUniformLocation(p->shaderProgram_->id(), "uMVPMatrix");
|
||||
|
|
@ -159,7 +158,7 @@ void RadarProductLayer::Initialize()
|
|||
|
||||
void RadarProductLayer::UpdateSweep()
|
||||
{
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
boost::timer::cpu_timer timer;
|
||||
|
||||
|
|
@ -261,7 +260,7 @@ void RadarProductLayer::UpdateSweep()
|
|||
void RadarProductLayer::Render(
|
||||
const QMapLibre::CustomLayerRenderParameters& params)
|
||||
{
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
p->shaderProgram_->Use();
|
||||
|
||||
|
|
@ -324,7 +323,7 @@ void RadarProductLayer::Deinitialize()
|
|||
{
|
||||
logger_->debug("Deinitialize()");
|
||||
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
gl.glDeleteVertexArrays(1, &p->vao_);
|
||||
gl.glDeleteBuffers(3, p->vbo_.data());
|
||||
|
|
@ -536,7 +535,7 @@ void RadarProductLayer::UpdateColorTable()
|
|||
|
||||
p->colorTableNeedsUpdate_ = false;
|
||||
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
std::shared_ptr<view::RadarProductView> radarProductView =
|
||||
context()->radar_product_view();
|
||||
|
||||
|
|
@ -563,6 +562,4 @@ void RadarProductLayer::UpdateColorTable()
|
|||
gl.glUniform1f(p->uDataMomentScaleLocation_, scale);
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <scwx/qt/map/generic_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class RadarProductLayerImpl;
|
||||
|
|
@ -14,7 +10,7 @@ class RadarProductLayerImpl;
|
|||
class RadarProductLayer : public GenericLayer
|
||||
{
|
||||
public:
|
||||
explicit RadarProductLayer(std::shared_ptr<MapContext> context);
|
||||
explicit RadarProductLayer(const std::shared_ptr<MapContext>& context);
|
||||
~RadarProductLayer();
|
||||
|
||||
void Initialize() override final;
|
||||
|
|
@ -37,6 +33,4 @@ private:
|
|||
std::unique_ptr<RadarProductLayerImpl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -5,11 +5,7 @@
|
|||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::radar_range_layer";
|
||||
|
|
@ -98,6 +94,4 @@ GetRangeCircle(float range, QMapLibre::Coordinate center)
|
|||
return rangeCircle;
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,13 +2,7 @@
|
|||
|
||||
#include <qmaplibre.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
{
|
||||
namespace RadarRangeLayer
|
||||
namespace scwx::qt::map::RadarRangeLayer
|
||||
{
|
||||
|
||||
void Add(std::shared_ptr<QMapLibre::Map> map,
|
||||
|
|
@ -19,7 +13,4 @@ void Update(std::shared_ptr<QMapLibre::Map> map,
|
|||
float range,
|
||||
QMapLibre::Coordinate center);
|
||||
|
||||
} // namespace RadarRangeLayer
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map::RadarRangeLayer
|
||||
|
|
|
|||
|
|
@ -13,11 +13,7 @@
|
|||
|
||||
#include <QGuiApplication>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::map::radar_site_layer";
|
||||
|
|
@ -26,7 +22,7 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class RadarSiteLayer::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(RadarSiteLayer* self, std::shared_ptr<MapContext>& context) :
|
||||
explicit Impl(RadarSiteLayer* self, std::shared_ptr<gl::GlContext> context) :
|
||||
self_ {self}, geoLines_ {std::make_shared<gl::draw::GeoLines>(context)}
|
||||
{
|
||||
}
|
||||
|
|
@ -54,9 +50,9 @@ public:
|
|||
nullptr, nullptr};
|
||||
};
|
||||
|
||||
RadarSiteLayer::RadarSiteLayer(std::shared_ptr<MapContext> context) :
|
||||
RadarSiteLayer::RadarSiteLayer(const std::shared_ptr<MapContext>& context) :
|
||||
DrawLayer(context, "RadarSiteLayer"),
|
||||
p(std::make_unique<Impl>(this, context))
|
||||
p(std::make_unique<Impl>(this, context->gl_context()))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +99,7 @@ void RadarSiteLayer::Render(
|
|||
return;
|
||||
}
|
||||
|
||||
gl::OpenGLFunctions& gl = context()->gl();
|
||||
gl::OpenGLFunctions& gl = context()->gl_context()->gl();
|
||||
|
||||
// Update map screen coordinate and scale information
|
||||
p->mapScreenCoordLocation_ = util::maplibre::LatLongToScreenCoordinate(
|
||||
|
|
@ -251,6 +247,4 @@ bool RadarSiteLayer::RunMousePicking(
|
|||
return false;
|
||||
}
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
|
||||
#include <scwx/qt/map/draw_layer.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace map
|
||||
namespace scwx::qt::map
|
||||
{
|
||||
|
||||
class RadarSiteLayer : public DrawLayer
|
||||
|
|
@ -15,7 +11,7 @@ class RadarSiteLayer : public DrawLayer
|
|||
Q_DISABLE_COPY_MOVE(RadarSiteLayer)
|
||||
|
||||
public:
|
||||
explicit RadarSiteLayer(std::shared_ptr<MapContext> context);
|
||||
explicit RadarSiteLayer(const std::shared_ptr<MapContext>& context);
|
||||
~RadarSiteLayer();
|
||||
|
||||
void Initialize() override final;
|
||||
|
|
@ -38,6 +34,4 @@ private:
|
|||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace map
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
} // namespace scwx::qt::map
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue