Add color table margins to map context

This commit is contained in:
Dan Paulat 2024-03-02 23:41:02 -06:00
parent 5c7c7e6a19
commit b09abc0ac1
3 changed files with 23 additions and 0 deletions

View file

@ -181,6 +181,12 @@ void ColorTableLayer::Render(
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]); gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
gl.glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); gl.glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices);
gl.glDrawArrays(GL_TRIANGLES, 0, 6); gl.glDrawArrays(GL_TRIANGLES, 0, 6);
context()->set_color_table_margins(QMargins {0, 0, 0, 10});
}
else
{
context()->set_color_table_margins(QMargins {});
} }
SCWX_GL_CHECK_ERROR(); SCWX_GL_CHECK_ERROR();
@ -200,6 +206,8 @@ void ColorTableLayer::Deinitialize()
p->vao_ = GL_INVALID_INDEX; p->vao_ = GL_INVALID_INDEX;
p->vbo_ = {GL_INVALID_INDEX}; p->vbo_ = {GL_INVALID_INDEX};
p->texture_ = GL_INVALID_INDEX; p->texture_ = GL_INVALID_INDEX;
context()->set_color_table_margins(QMargins {});
} }
} // namespace map } // namespace map

View file

@ -32,6 +32,8 @@ public:
MapProvider mapProvider_ {MapProvider::Unknown}; MapProvider mapProvider_ {MapProvider::Unknown};
std::string mapCopyrights_ {}; std::string mapCopyrights_ {};
QMargins colorTableMargins_ {};
std::shared_ptr<view::OverlayProductView> overlayProductView_ {nullptr}; std::shared_ptr<view::OverlayProductView> overlayProductView_ {nullptr};
std::shared_ptr<view::RadarProductView> radarProductView_; std::shared_ptr<view::RadarProductView> radarProductView_;
}; };
@ -66,6 +68,11 @@ MapSettings& MapContext::settings()
return p->settings_; return p->settings_;
} }
QMargins MapContext::color_table_margins() const
{
return p->colorTableMargins_;
}
float MapContext::pixel_ratio() const float MapContext::pixel_ratio() const
{ {
return p->pixelRatio_; return p->pixelRatio_;
@ -117,6 +124,11 @@ void MapContext::set_map_provider(MapProvider provider)
p->mapProvider_ = provider; p->mapProvider_ = provider;
} }
void MapContext::set_color_table_margins(const QMargins& margins)
{
p->colorTableMargins_ = margins;
}
void MapContext::set_overlay_product_view( void MapContext::set_overlay_product_view(
const std::shared_ptr<view::OverlayProductView>& overlayProductView) const std::shared_ptr<view::OverlayProductView>& overlayProductView)
{ {

View file

@ -5,6 +5,7 @@
#include <scwx/common/products.hpp> #include <scwx/common/products.hpp>
#include <qmaplibre.hpp> #include <qmaplibre.hpp>
#include <QMargins>
namespace scwx namespace scwx
{ {
@ -40,6 +41,7 @@ public:
std::string map_copyrights() const; std::string map_copyrights() const;
MapProvider map_provider() const; MapProvider map_provider() const;
MapSettings& settings(); MapSettings& settings();
QMargins color_table_margins() const;
float pixel_ratio() const; float pixel_ratio() const;
std::shared_ptr<view::OverlayProductView> overlay_product_view() const; std::shared_ptr<view::OverlayProductView> overlay_product_view() const;
std::shared_ptr<view::RadarProductView> radar_product_view() const; std::shared_ptr<view::RadarProductView> radar_product_view() const;
@ -51,6 +53,7 @@ public:
void set_map(const std::shared_ptr<QMapLibre::Map>& map); void set_map(const std::shared_ptr<QMapLibre::Map>& map);
void set_map_copyrights(const std::string& copyrights); void set_map_copyrights(const std::string& copyrights);
void set_map_provider(MapProvider provider); void set_map_provider(MapProvider provider);
void set_color_table_margins(const QMargins& margins);
void set_overlay_product_view( void set_overlay_product_view(
const std::shared_ptr<view::OverlayProductView>& overlayProductView); const std::shared_ptr<view::OverlayProductView>& overlayProductView);
void set_pixel_ratio(float pixelRatio); void set_pixel_ratio(float pixelRatio);