Clang tidy/format fixes for color_palette_fallback_warning

This commit is contained in:
AdenKoperczak 2025-02-28 15:49:56 -05:00
parent 8be9cc72de
commit dc3258d149

View file

@ -1865,56 +1865,49 @@ void MapWidgetImpl::RadarProductManagerDisconnect()
void MapWidgetImpl::InitializeNewRadarProductView( void MapWidgetImpl::InitializeNewRadarProductView(
const std::string& colorPalette) const std::string& colorPalette)
{ {
boost::asio::post(threadPool_, boost::asio::post(
[colorPalette, this]() threadPool_,
{ [colorPalette, this]()
try {
{ try
auto radarProductView = {
context_->radar_product_view(); auto radarProductView = context_->radar_product_view();
auto& paletteSetting = auto& paletteSetting =
settings::PaletteSettings::Instance().palette( settings::PaletteSettings::Instance().palette(colorPalette);
colorPalette);
std::string colorTableFile = std::string colorTableFile = paletteSetting.GetValue();
paletteSetting.GetValue(); if (colorTableFile.empty())
if (colorTableFile.empty()) {
{ colorTableFile = paletteSetting.GetDefault();
colorTableFile = paletteSetting.GetDefault(); }
}
std::unique_ptr<std::istream> colorTableStream = std::unique_ptr<std::istream> colorTableStream =
util::OpenFile(colorTableFile); util::OpenFile(colorTableFile);
if (colorTableStream->fail()) if (colorTableStream->fail())
{ {
logger_->warn("Could not open color table {}", logger_->warn("Could not open color table {}", colorTableFile);
colorTableFile); colorTableStream = util::OpenFile(paletteSetting.GetDefault());
colorTableStream = }
util::OpenFile(paletteSetting.GetDefault());
}
std::shared_ptr<common::ColorTable> colorTable = std::shared_ptr<common::ColorTable> colorTable =
common::ColorTable::Load(*colorTableStream); common::ColorTable::Load(*colorTableStream);
if (!colorTable->IsValid()) if (!colorTable->IsValid())
{ {
logger_->warn("Could not load color table {}", logger_->warn("Could not load color table {}", colorTableFile);
colorTableFile); colorTableStream = util::OpenFile(paletteSetting.GetDefault());
colorTableStream = colorTable = common::ColorTable::Load(*colorTableStream);
util::OpenFile(paletteSetting.GetDefault()); }
colorTable =
common::ColorTable::Load(*colorTableStream);
}
radarProductView->LoadColorTable(colorTable); radarProductView->LoadColorTable(colorTable);
radarProductView->Initialize(); radarProductView->Initialize();
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
logger_->error(ex.what()); logger_->error(ex.what());
} }
}); });
if (map_ != nullptr) if (map_ != nullptr)
{ {