mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:10:05 +00:00
Stub for selecting radar product on successful file load
This commit is contained in:
parent
2000f3acb1
commit
7c44bafeb5
8 changed files with 68 additions and 43 deletions
|
|
@ -207,6 +207,8 @@ void MainWindow::on_actionOpen_triggered()
|
|||
dialog->setNameFilter(tr(nexradFilter.c_str()));
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
map::MapWidget* currentMap = p->activeMap_;
|
||||
|
||||
// Make sure the parent window properly repaints on close
|
||||
connect(
|
||||
dialog,
|
||||
|
|
@ -234,22 +236,13 @@ void MainWindow::on_actionOpen_triggered()
|
|||
{
|
||||
std::shared_ptr<types::RadarProductRecord> record =
|
||||
request->radar_product_record();
|
||||
std::shared_ptr<wsr88d::Ar2vFile> level2File = nullptr;
|
||||
std::shared_ptr<wsr88d::Level3File> level3File = nullptr;
|
||||
|
||||
if (record != nullptr)
|
||||
{
|
||||
level2File = record->level2_file();
|
||||
level3File = record->level3_file();
|
||||
}
|
||||
|
||||
if (level2File != nullptr)
|
||||
{
|
||||
// TODO: Handle
|
||||
}
|
||||
else if (level3File != nullptr)
|
||||
{
|
||||
// TODO: Handle
|
||||
currentMap->SelectRadarProduct(record->radar_id(),
|
||||
record->radar_product_group(),
|
||||
record->radar_product(),
|
||||
record->time());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <scwx/qt/map/radar_product_layer.hpp>
|
||||
#include <scwx/qt/map/radar_range_layer.hpp>
|
||||
#include <scwx/qt/view/radar_product_view_factory.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
|
|
@ -246,6 +247,17 @@ void MapWidget::SelectRadarProduct(common::Level2Product product)
|
|||
}
|
||||
}
|
||||
|
||||
void MapWidget::SelectRadarProduct(const std::string& radarId,
|
||||
common::RadarProductGroup group,
|
||||
const std::string& product,
|
||||
std::chrono::system_clock::time_point time)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug)
|
||||
<< logPrefix_ << "SelectRadarProduct(" << radarId << ", "
|
||||
<< common::GetRadarProductGroupName(group) << ", " << product << ", "
|
||||
<< util::TimeString(time) << ")";
|
||||
}
|
||||
|
||||
void MapWidget::SetActive(bool isActive)
|
||||
{
|
||||
p->context_->settings_.isActive_ = isActive;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <scwx/common/products.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
#include <QMapboxGL>
|
||||
|
|
@ -39,6 +40,10 @@ public:
|
|||
|
||||
void SelectElevation(float elevation);
|
||||
void SelectRadarProduct(common::Level2Product product);
|
||||
void SelectRadarProduct(const std::string& radarId,
|
||||
common::RadarProductGroup group,
|
||||
const std::string& product,
|
||||
std::chrono::system_clock::time_point time);
|
||||
void SetActive(bool isActive);
|
||||
void SetMapParameters(double latitude,
|
||||
double longitude,
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
// Enable chrono formatters
|
||||
#ifndef __cpp_lib_format
|
||||
# define __cpp_lib_format 202110L
|
||||
#endif
|
||||
|
||||
#include <scwx/qt/map/overlay_layer.hpp>
|
||||
#include <scwx/qt/gl/draw/rectangle.hpp>
|
||||
#include <scwx/qt/gl/shader_program.hpp>
|
||||
#include <scwx/qt/gl/text_shader.hpp>
|
||||
#include <scwx/qt/util/font.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <execution>
|
||||
|
|
@ -105,18 +101,9 @@ void OverlayLayer::Render(const QMapbox::CustomLayerRenderParameters& params)
|
|||
|
||||
if (p->sweepTimeNeedsUpdate_ && context()->radarProductView_ != nullptr)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto sweepTime =
|
||||
time_point_cast<seconds>(context()->radarProductView_->sweep_time());
|
||||
|
||||
if (sweepTime.time_since_epoch().count() != 0)
|
||||
{
|
||||
zoned_time zt = {current_zone(), sweepTime};
|
||||
std::ostringstream os;
|
||||
os << zt;
|
||||
p->sweepTimeString_ = os.str();
|
||||
}
|
||||
|
||||
p->sweepTimeString_ =
|
||||
scwx::util::TimeString(context()->radarProductView_->sweep_time(),
|
||||
std::chrono::current_zone());
|
||||
p->sweepTimeNeedsUpdate_ = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue