Add icon visibility method to geo icons, update only dirty icons

This commit is contained in:
Dan Paulat 2024-04-20 00:34:50 -05:00
parent fcf6ef800b
commit 9cb29c6b9a
4 changed files with 328 additions and 155 deletions

View file

@ -14,6 +14,7 @@ layout (location = 3) in vec4 aModulate;
layout (location = 4) in float aAngleDeg; layout (location = 4) in float aAngleDeg;
layout (location = 5) in int aThreshold; layout (location = 5) in int aThreshold;
layout (location = 6) in ivec2 aTimeRange; layout (location = 6) in ivec2 aTimeRange;
layout (location = 7) in int aDisplayed;
uniform mat4 uMVPMatrix; uniform mat4 uMVPMatrix;
uniform mat4 uMapMatrix; uniform mat4 uMapMatrix;

View file

@ -8,6 +8,7 @@
#include <execution> #include <execution>
#include <boost/unordered/unordered_flat_map.hpp> #include <boost/unordered/unordered_flat_map.hpp>
#include <boost/unordered/unordered_flat_set.hpp>
namespace scwx namespace scwx
{ {
@ -32,8 +33,10 @@ static constexpr std::size_t kIconBufferLength =
static constexpr std::size_t kTextureBufferLength = static constexpr std::size_t kTextureBufferLength =
kNumTriangles * kVerticesPerTriangle * kPointsPerTexCoord; kNumTriangles * kVerticesPerTriangle * kPointsPerTexCoord;
// Threshold, start time, end time // Threshold, start time, end time, displayed
static constexpr std::size_t kIntegersPerVertex_ = 3; static constexpr std::size_t kIntegersPerVertex_ = 4;
static constexpr std::size_t kIntegerBufferLength_ =
kNumTriangles * kVerticesPerTriangle * kIntegersPerVertex_;
struct GeoIconDrawItem struct GeoIconDrawItem
{ {
@ -42,6 +45,7 @@ struct GeoIconDrawItem
std::chrono::sys_time<std::chrono::seconds> endTime_ {}; std::chrono::sys_time<std::chrono::seconds> endTime_ {};
boost::gil::rgba32f_pixel_t modulate_ {1.0f, 1.0f, 1.0f, 1.0f}; boost::gil::rgba32f_pixel_t modulate_ {1.0f, 1.0f, 1.0f, 1.0f};
bool visible_ {true};
double latitude_ {}; double latitude_ {};
double longitude_ {}; double longitude_ {};
double x_ {}; double x_ {};
@ -50,6 +54,8 @@ struct GeoIconDrawItem
std::string iconSheet_ {}; std::string iconSheet_ {};
std::size_t iconIndex_ {}; std::size_t iconIndex_ {};
std::string hoverText_ {}; std::string hoverText_ {};
std::shared_ptr<types::IconInfo> iconInfo_ {};
}; };
class GeoIcons::Impl class GeoIcons::Impl
@ -83,7 +89,13 @@ public:
~Impl() {} ~Impl() {}
void UpdateBuffers(); void UpdateBuffers();
static void UpdateSingleBuffer(const std::shared_ptr<GeoIconDrawItem>& di,
std::size_t iconIndex,
std::vector<float>& iconBuffer,
std::vector<GLint>& integerBuffer,
std::vector<IconHoverEntry>& hoverIcons);
void UpdateTextureBuffer(); void UpdateTextureBuffer();
void UpdateModifiedIconBuffers();
void Update(bool textureAtlasChanged); void Update(bool textureAtlasChanged);
std::shared_ptr<GlContext> context_; std::shared_ptr<GlContext> context_;
@ -93,13 +105,16 @@ public:
bool thresholded_ {false}; bool thresholded_ {false};
bool lastTextureAtlasChanged_ {false}; bool lastTextureAtlasChanged_ {false};
boost::unordered_flat_set<std::shared_ptr<GeoIconDrawItem>> dirtyIcons_ {};
std::chrono::system_clock::time_point selectedTime_ {}; std::chrono::system_clock::time_point selectedTime_ {};
std::mutex iconMutex_; std::mutex iconMutex_;
boost::unordered_flat_map<std::string, types::IconInfo> boost::unordered_flat_map<std::string, std::shared_ptr<types::IconInfo>>
currentIconSheets_ {}; currentIconSheets_ {};
boost::unordered_flat_map<std::string, types::IconInfo> newIconSheets_ {}; boost::unordered_flat_map<std::string, std::shared_ptr<types::IconInfo>>
newIconSheets_ {};
std::vector<std::shared_ptr<GeoIconDrawItem>> currentIconList_ {}; std::vector<std::shared_ptr<GeoIconDrawItem>> currentIconList_ {};
std::vector<std::shared_ptr<GeoIconDrawItem>> newIconList_ {}; std::vector<std::shared_ptr<GeoIconDrawItem>> newIconList_ {};
@ -240,6 +255,15 @@ void GeoIcons::Initialize()
reinterpret_cast<void*>(1 * sizeof(GLint))); reinterpret_cast<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed
gl.glVertexAttribPointer(7,
1,
GL_INT,
GL_FALSE,
kIntegersPerVertex_ * sizeof(GLint),
reinterpret_cast<void*>(3 * sizeof(float)));
gl.glEnableVertexAttribArray(7);
p->dirty_ = true; p->dirty_ = true;
} }
@ -338,10 +362,11 @@ void GeoIcons::AddIconSheet(const std::string& name,
std::int32_t hotY) std::int32_t hotY)
{ {
// Populate icon sheet map // Populate icon sheet map
p->newIconSheets_.emplace(std::piecewise_construct, p->newIconSheets_.emplace(
std::piecewise_construct,
std::tuple {name}, std::tuple {name},
std::forward_as_tuple(types::IconInfo { std::forward_as_tuple(std::make_shared<types::IconInfo>(
name, iconWidth, iconHeight, hotX, hotY})); name, iconWidth, iconHeight, hotX, hotY)));
} }
void GeoIcons::FinishIconSheets() void GeoIcons::FinishIconSheets()
@ -349,7 +374,7 @@ void GeoIcons::FinishIconSheets()
// Update icon sheets // Update icon sheets
for (auto& iconSheet : p->newIconSheets_) for (auto& iconSheet : p->newIconSheets_)
{ {
iconSheet.second.UpdateTextureInfo(); iconSheet.second->UpdateTextureInfo();
} }
std::unique_lock lock {p->iconMutex_}; std::unique_lock lock {p->iconMutex_};
@ -379,12 +404,26 @@ std::shared_ptr<GeoIconDrawItem> GeoIcons::AddIcon()
return p->newIconList_.emplace_back(std::make_shared<GeoIconDrawItem>()); return p->newIconList_.emplace_back(std::make_shared<GeoIconDrawItem>());
} }
void GeoIcons::SetIconVisible(const std::shared_ptr<GeoIconDrawItem>& di,
bool visible)
{
if (di->visible_ != visible)
{
di->visible_ = visible;
p->dirtyIcons_.insert(di);
}
}
void GeoIcons::SetIconTexture(const std::shared_ptr<GeoIconDrawItem>& di, void GeoIcons::SetIconTexture(const std::shared_ptr<GeoIconDrawItem>& di,
const std::string& iconSheet, const std::string& iconSheet,
std::size_t iconIndex) std::size_t iconIndex)
{ {
if (di->iconSheet_ != iconSheet || di->iconIndex_ != iconIndex)
{
di->iconSheet_ = iconSheet; di->iconSheet_ = iconSheet;
di->iconIndex_ = iconIndex; di->iconIndex_ = iconIndex;
p->dirtyIcons_.insert(di);
}
} }
void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di,
@ -393,10 +432,16 @@ void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di,
double xOffset, double xOffset,
double yOffset) double yOffset)
{ {
if (di->latitude_ != latitude.value() ||
di->longitude_ != longitude.value() || di->x_ != xOffset ||
di->y_ != yOffset)
{
di->latitude_ = latitude.value(); di->latitude_ = latitude.value();
di->longitude_ = longitude.value(); di->longitude_ = longitude.value();
di->x_ = xOffset; di->x_ = xOffset;
di->y_ = yOffset; di->y_ = yOffset;
p->dirtyIcons_.insert(di);
}
} }
void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di,
@ -405,37 +450,63 @@ void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di,
double xOffset, double xOffset,
double yOffset) double yOffset)
{ {
if (di->latitude_ != latitude || di->longitude_ != longitude ||
di->x_ != xOffset || di->y_ != yOffset)
{
di->latitude_ = latitude; di->latitude_ = latitude;
di->longitude_ = longitude; di->longitude_ = longitude;
di->x_ = xOffset; di->x_ = xOffset;
di->y_ = yOffset; di->y_ = yOffset;
p->dirtyIcons_.insert(di);
}
} }
void GeoIcons::SetIconAngle(const std::shared_ptr<GeoIconDrawItem>& di, void GeoIcons::SetIconAngle(const std::shared_ptr<GeoIconDrawItem>& di,
units::angle::degrees<double> angle) units::angle::degrees<double> angle)
{ {
if (di->angle_ != angle)
{
di->angle_ = angle; di->angle_ = angle;
p->dirtyIcons_.insert(di);
}
} }
void GeoIcons::SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di, void GeoIcons::SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di,
boost::gil::rgba8_pixel_t modulate) boost::gil::rgba8_pixel_t modulate)
{ {
boost::gil::rgba32f_pixel_t newModulate = {modulate[0] / 255.0f,
modulate[1] / 255.0f,
modulate[2] / 255.0f,
modulate[3] / 255.0f};
if (di->modulate_ != newModulate)
{
di->modulate_ = {modulate[0] / 255.0f, di->modulate_ = {modulate[0] / 255.0f,
modulate[1] / 255.0f, modulate[1] / 255.0f,
modulate[2] / 255.0f, modulate[2] / 255.0f,
modulate[3] / 255.0f}; modulate[3] / 255.0f};
p->dirtyIcons_.insert(di);
}
} }
void GeoIcons::SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di, void GeoIcons::SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di,
boost::gil::rgba32f_pixel_t modulate) boost::gil::rgba32f_pixel_t modulate)
{ {
if (di->modulate_ != modulate)
{
di->modulate_ = modulate; di->modulate_ = modulate;
p->dirtyIcons_.insert(di);
}
} }
void GeoIcons::SetIconHoverText(const std::shared_ptr<GeoIconDrawItem>& di, void GeoIcons::SetIconHoverText(const std::shared_ptr<GeoIconDrawItem>& di,
const std::string& text) const std::string& text)
{ {
if (di->hoverText_ != text)
{
di->hoverText_ = text; di->hoverText_ = text;
p->dirtyIcons_.insert(di);
}
} }
void GeoIcons::FinishIcons() void GeoIcons::FinishIcons()
@ -483,9 +554,10 @@ void GeoIcons::Impl::UpdateBuffers()
} }
auto& icon = it->second; auto& icon = it->second;
di->iconInfo_ = icon;
// Validate icon // Validate icon
if (di->iconIndex_ >= icon.numIcons_) if (di->iconIndex_ >= icon->numIcons_)
{ {
// No icon found // No icon found
logger_->warn("Invalid icon index: {}", di->iconIndex_); logger_->warn("Invalid icon index: {}", di->iconIndex_);
@ -495,6 +567,27 @@ void GeoIcons::Impl::UpdateBuffers()
// Icon is valid, add to valid icon list // Icon is valid, add to valid icon list
newValidIconList_.push_back(di); newValidIconList_.push_back(di);
// Update icon buffer
UpdateSingleBuffer(di,
newValidIconList_.size() - 1,
newIconBuffer_,
newIntegerBuffer_,
newHoverIcons_);
}
// All icons have been updated
dirtyIcons_.clear();
}
void GeoIcons::Impl::UpdateSingleBuffer(
const std::shared_ptr<GeoIconDrawItem>& di,
std::size_t iconIndex,
std::vector<float>& iconBuffer,
std::vector<GLint>& integerBuffer,
std::vector<IconHoverEntry>& hoverIcons)
{
auto& icon = di->iconInfo_;
// Threshold value // Threshold value
units::length::nautical_miles<double> threshold = di->threshold_; units::length::nautical_miles<double> threshold = di->threshold_;
GLint thresholdValue = static_cast<GLint>(std::round(threshold.value())); GLint thresholdValue = static_cast<GLint>(std::round(threshold.value()));
@ -518,12 +611,12 @@ void GeoIcons::Impl::UpdateBuffers()
const float y = static_cast<float>(di->y_); const float y = static_cast<float>(di->y_);
// Icon size // Icon size
const float iw = static_cast<float>(icon.iconWidth_); const float iw = static_cast<float>(icon->iconWidth_);
const float ih = static_cast<float>(icon.iconHeight_); const float ih = static_cast<float>(icon->iconHeight_);
// Hot X/Y (zero-based icon center) // Hot X/Y (zero-based icon center)
const float hx = static_cast<float>(icon.hotX_); const float hx = static_cast<float>(icon->hotX_);
const float hy = static_cast<float>(icon.hotY_); const float hy = static_cast<float>(icon->hotY_);
// Final X/Y offsets in pixels // Final X/Y offsets in pixels
const float lx = std::roundf(x - hx); const float lx = std::roundf(x - hx);
@ -541,8 +634,11 @@ void GeoIcons::Impl::UpdateBuffers()
const float mc2 = di->modulate_[2]; const float mc2 = di->modulate_[2];
const float mc3 = di->modulate_[3]; const float mc3 = di->modulate_[3];
newIconBuffer_.insert(newIconBuffer_.end(), // Visibility
{ const GLint v = static_cast<GLint>(di->visible_);
// Icon initialize list data
const auto iconData = {
// Icon // Icon
lat, lon, lx, by, mc0, mc1, mc2, mc3, a, // BL lat, lon, lx, by, mc0, mc1, mc2, mc3, a, // BL
lat, lon, lx, ty, mc0, mc1, mc2, mc3, a, // TL lat, lon, lx, ty, mc0, mc1, mc2, mc3, a, // TL
@ -550,28 +646,53 @@ void GeoIcons::Impl::UpdateBuffers()
lat, lon, rx, by, mc0, mc1, mc2, mc3, a, // BR lat, lon, rx, by, mc0, mc1, mc2, mc3, a, // BR
lat, lon, rx, ty, mc0, mc1, mc2, mc3, a, // TR lat, lon, rx, ty, mc0, mc1, mc2, mc3, a, // TR
lat, lon, lx, ty, mc0, mc1, mc2, mc3, a // TL lat, lon, lx, ty, mc0, mc1, mc2, mc3, a // TL
}); };
newIntegerBuffer_.insert(newIntegerBuffer_.end(), const auto integerData = {thresholdValue, startTime, endTime, v,
{thresholdValue, thresholdValue, startTime, endTime, v,
startTime, thresholdValue, startTime, endTime, v,
endTime, thresholdValue, startTime, endTime, v,
thresholdValue, thresholdValue, startTime, endTime, v,
startTime, thresholdValue, startTime, endTime, v};
endTime,
thresholdValue,
startTime,
endTime,
thresholdValue,
startTime,
endTime,
thresholdValue,
startTime,
endTime,
thresholdValue,
startTime,
endTime});
if (!di->hoverText_.empty()) // Buffer position data
auto iconBufferPosition = iconBuffer.end();
auto iconBufferOffset = iconIndex * kIconBufferLength;
auto integerBufferPosition = integerBuffer.end();
auto integerBufferOffset = iconIndex * kIntegerBufferLength_;
if (iconBufferOffset < iconBuffer.size())
{
iconBufferPosition = iconBuffer.begin() + iconBufferOffset;
}
if (integerBufferOffset < integerBuffer.size())
{
integerBufferPosition = integerBuffer.begin() + integerBufferOffset;
}
if (iconBufferPosition == iconBuffer.cend())
{
iconBuffer.insert(iconBufferPosition, iconData);
}
else
{
std::copy(iconData.begin(), iconData.end(), iconBufferPosition);
}
if (integerBufferPosition == integerBuffer.cend())
{
integerBuffer.insert(integerBufferPosition, integerData);
}
else
{
std::copy(integerData.begin(), integerData.end(), integerBufferPosition);
}
auto hoverIt = std::find_if(hoverIcons.begin(),
hoverIcons.end(),
[&di](auto& entry) { return entry.di_ == di; });
if (di->visible_ && !di->hoverText_.empty())
{ {
const units::angle::radians<double> radians = angle; const units::angle::radians<double> radians = angle;
@ -587,9 +708,21 @@ void GeoIcons::Impl::UpdateBuffers()
const glm::vec2 obl = rotate * glm::vec2 {lx, by}; const glm::vec2 obl = rotate * glm::vec2 {lx, by};
const glm::vec2 obr = rotate * glm::vec2 {rx, by}; const glm::vec2 obr = rotate * glm::vec2 {rx, by};
newHoverIcons_.emplace_back( if (hoverIt == hoverIcons.end())
IconHoverEntry {di, sc, otl, otr, obl, obr}); {
hoverIcons.emplace_back(IconHoverEntry {di, sc, otl, otr, obl, obr});
} }
else
{
hoverIt->otl_ = otl;
hoverIt->otr_ = otr;
hoverIt->obl_ = obl;
hoverIt->obr_ = obr;
}
}
else if (hoverIt != hoverIcons.end())
{
hoverIcons.erase(hoverIt);
} }
} }
@ -627,7 +760,7 @@ void GeoIcons::Impl::UpdateTextureBuffer()
auto& icon = it->second; auto& icon = it->second;
// Validate icon // Validate icon
if (di->iconIndex_ >= icon.numIcons_) if (di->iconIndex_ >= icon->numIcons_)
{ {
// No icon found // No icon found
logger_->error("Invalid icon index: {}", di->iconIndex_); logger_->error("Invalid icon index: {}", di->iconIndex_);
@ -653,17 +786,17 @@ void GeoIcons::Impl::UpdateTextureBuffer()
} }
// Texture coordinates // Texture coordinates
const std::size_t iconRow = (di->iconIndex_) / icon.columns_; const std::size_t iconRow = (di->iconIndex_) / icon->columns_;
const std::size_t iconColumn = (di->iconIndex_) % icon.columns_; const std::size_t iconColumn = (di->iconIndex_) % icon->columns_;
const float iconX = iconColumn * icon.scaledWidth_; const float iconX = iconColumn * icon->scaledWidth_;
const float iconY = iconRow * icon.scaledHeight_; const float iconY = iconRow * icon->scaledHeight_;
const float ls = icon.texture_.sLeft_ + iconX; const float ls = icon->texture_.sLeft_ + iconX;
const float rs = ls + icon.scaledWidth_; const float rs = ls + icon->scaledWidth_;
const float tt = icon.texture_.tTop_ + iconY; const float tt = icon->texture_.tTop_ + iconY;
const float bt = tt + icon.scaledHeight_; const float bt = tt + icon->scaledHeight_;
const float r = static_cast<float>(icon.texture_.layerId_); const float r = static_cast<float>(icon->texture_.layerId_);
// clang-format off // clang-format off
textureBuffer_.insert( textureBuffer_.insert(
@ -681,17 +814,51 @@ void GeoIcons::Impl::UpdateTextureBuffer()
} }
} }
void GeoIcons::Impl::UpdateModifiedIconBuffers()
{
// Update buffers for modified icons
for (auto& di : dirtyIcons_)
{
// Find modified icon in the current list
auto it =
std::find(currentIconList_.cbegin(), currentIconList_.cend(), di);
// Ignore invalid icons
if (it == currentIconList_.cend())
{
continue;
}
auto iconIndex = std::distance(currentIconList_.cbegin(), it);
UpdateSingleBuffer(di,
iconIndex,
currentIconBuffer_,
currentIntegerBuffer_,
currentHoverIcons_);
}
// Clear list of modified icons
if (!dirtyIcons_.empty())
{
dirtyIcons_.clear();
dirty_ = true;
}
}
void GeoIcons::Impl::Update(bool textureAtlasChanged) void GeoIcons::Impl::Update(bool textureAtlasChanged)
{ {
gl::OpenGLFunctions& gl = context_->gl(); gl::OpenGLFunctions& gl = context_->gl();
UpdateModifiedIconBuffers();
// If the texture atlas has changed // If the texture atlas has changed
if (dirty_ || textureAtlasChanged || lastTextureAtlasChanged_) if (dirty_ || textureAtlasChanged || lastTextureAtlasChanged_)
{ {
// Update texture coordinates // Update texture coordinates
for (auto& iconSheet : currentIconSheets_) for (auto& iconSheet : currentIconSheets_)
{ {
iconSheet.second.UpdateTextureInfo(); iconSheet.second->UpdateTextureInfo();
} }
// Update OpenGL texture buffer data // Update OpenGL texture buffer data

View file

@ -94,6 +94,13 @@ public:
*/ */
std::shared_ptr<GeoIconDrawItem> AddIcon(); std::shared_ptr<GeoIconDrawItem> AddIcon();
/**
* @param [in] di Geo icon draw item
* @param [in] visible Visibility of the icon
*/
void SetIconVisible(const std::shared_ptr<GeoIconDrawItem>& di,
bool visible);
/** /**
* Sets the texture of a geo icon. * Sets the texture of a geo icon.
* *
@ -101,7 +108,7 @@ public:
* @param [in] iconSheet The name of the icon sheet in the texture atlas * @param [in] iconSheet The name of the icon sheet in the texture atlas
* @param [in] iconIndex The zero-based index of the icon in the icon sheet * @param [in] iconIndex The zero-based index of the icon in the icon sheet
*/ */
static void SetIconTexture(const std::shared_ptr<GeoIconDrawItem>& di, void SetIconTexture(const std::shared_ptr<GeoIconDrawItem>& di,
const std::string& iconSheet, const std::string& iconSheet,
std::size_t iconIndex); std::size_t iconIndex);
@ -114,7 +121,7 @@ public:
* @param [in] xOffset The x-offset of the geo icon in pixels. Default is 0. * @param [in] xOffset The x-offset of the geo icon in pixels. Default is 0.
* @param [in] yOffset The y-offset of the geo icon in pixels. Default is 0. * @param [in] yOffset The y-offset of the geo icon in pixels. Default is 0.
*/ */
static void SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, void SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di,
units::angle::degrees<double> latitude, units::angle::degrees<double> latitude,
units::angle::degrees<double> longitude, units::angle::degrees<double> longitude,
double xOffset = 0.0, double xOffset = 0.0,
@ -129,7 +136,7 @@ public:
* @param [in] xOffset The x-offset of the geo icon in pixels. Default is 0. * @param [in] xOffset The x-offset of the geo icon in pixels. Default is 0.
* @param [in] yOffset The y-offset of the geo icon in pixels. Default is 0. * @param [in] yOffset The y-offset of the geo icon in pixels. Default is 0.
*/ */
static void SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, void SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di,
double latitude, double latitude,
double longitude, double longitude,
double xOffset = 0.0, double xOffset = 0.0,
@ -141,7 +148,7 @@ public:
* @param [in] di Geo icon draw item * @param [in] di Geo icon draw item
* @param [in] angle Angle in degrees * @param [in] angle Angle in degrees
*/ */
static void SetIconAngle(const std::shared_ptr<GeoIconDrawItem>& di, void SetIconAngle(const std::shared_ptr<GeoIconDrawItem>& di,
units::angle::degrees<double> angle); units::angle::degrees<double> angle);
/** /**
@ -150,7 +157,7 @@ public:
* @param [in] di Geo icon draw item * @param [in] di Geo icon draw item
* @param [in] modulate Modulate color * @param [in] modulate Modulate color
*/ */
static void SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di, void SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di,
boost::gil::rgba8_pixel_t modulate); boost::gil::rgba8_pixel_t modulate);
/** /**
@ -159,7 +166,7 @@ public:
* @param [in] di Geo icon draw item * @param [in] di Geo icon draw item
* @param [in] modulate Modulate color * @param [in] modulate Modulate color
*/ */
static void SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di, void SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di,
boost::gil::rgba32f_pixel_t modulate); boost::gil::rgba32f_pixel_t modulate);
/** /**
@ -168,7 +175,7 @@ public:
* @param [in] di Geo icon draw item * @param [in] di Geo icon draw item
* @param [in] text Hover text * @param [in] text Hover text
*/ */
static void SetIconHoverText(const std::shared_ptr<GeoIconDrawItem>& di, void SetIconHoverText(const std::shared_ptr<GeoIconDrawItem>& di,
const std::string& text); const std::string& text);
/** /**

View file

@ -182,11 +182,10 @@ void OverlayLayer::Initialize()
p->geoIcons_->StartIcons(); p->geoIcons_->StartIcons();
p->locationIcon_ = p->geoIcons_->AddIcon(); p->locationIcon_ = p->geoIcons_->AddIcon();
gl::draw::GeoIcons::SetIconTexture( p->geoIcons_->SetIconTexture(p->locationIcon_, p->locationIconName_, 0);
p->locationIcon_, p->locationIconName_, 0); p->geoIcons_->SetIconAngle(p->locationIcon_,
gl::draw::GeoIcons::SetIconAngle(p->locationIcon_,
units::angle::degrees<double> {45.0}); units::angle::degrees<double> {45.0});
gl::draw::GeoIcons::SetIconLocation( p->geoIcons_->SetIconLocation(
p->locationIcon_, coordinate.latitude(), coordinate.longitude()); p->locationIcon_, coordinate.latitude(), coordinate.longitude());
p->geoIcons_->FinishIcons(); p->geoIcons_->FinishIcons();
@ -272,10 +271,9 @@ void OverlayLayer::Initialize()
if (position.isValid() && if (position.isValid() &&
p->currentPosition_.coordinate() != coordinate) p->currentPosition_.coordinate() != coordinate)
{ {
gl::draw::GeoIcons::SetIconLocation(p->locationIcon_, p->geoIcons_->SetIconLocation(p->locationIcon_,
coordinate.latitude(), coordinate.latitude(),
coordinate.longitude()); coordinate.longitude());
p->geoIcons_->FinishIcons();
Q_EMIT NeedsRendering(); Q_EMIT NeedsRendering();
} }
p->currentPosition_ = position; p->currentPosition_ = position;