mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 15:50:05 +00:00
parent
5caf0edf95
commit
336eb66321
1 changed files with 30 additions and 7 deletions
|
|
@ -159,6 +159,9 @@ public:
|
|||
void RadarProductViewConnect();
|
||||
void RadarProductViewDisconnect();
|
||||
void RunMousePicking();
|
||||
void SelectNearestRadarSite(double latitude,
|
||||
double longitude,
|
||||
std::optional<std::string> type);
|
||||
void SetRadarSite(const std::string& radarSite);
|
||||
void UpdateLoadedStyle();
|
||||
bool UpdateStoredMapParameters();
|
||||
|
|
@ -1274,21 +1277,29 @@ void MapWidget::mousePressEvent(QMouseEvent* ev)
|
|||
p->lastPos_ = ev->position();
|
||||
p->lastGlobalPos_ = ev->globalPosition();
|
||||
|
||||
if (ev->type() == QEvent::MouseButtonPress)
|
||||
if (ev->type() == QEvent::Type::MouseButtonPress)
|
||||
{
|
||||
if (ev->buttons() == (Qt::LeftButton | Qt::RightButton))
|
||||
if (ev->buttons() ==
|
||||
(Qt::MouseButton::LeftButton | Qt::MouseButton::RightButton))
|
||||
{
|
||||
changeStyle();
|
||||
}
|
||||
else if (ev->buttons() == Qt::MouseButton::MiddleButton)
|
||||
{
|
||||
// Select nearest WSR-88D radar on middle click
|
||||
auto coordinate = p->map_->coordinateForPixel(p->lastPos_);
|
||||
p->SelectNearestRadarSite(
|
||||
coordinate.first, coordinate.second, "wsr88d");
|
||||
}
|
||||
}
|
||||
|
||||
if (ev->type() == QEvent::MouseButtonDblClick)
|
||||
if (ev->type() == QEvent::Type::MouseButtonDblClick)
|
||||
{
|
||||
if (ev->buttons() == Qt::LeftButton)
|
||||
if (ev->buttons() == Qt::MouseButton::LeftButton)
|
||||
{
|
||||
p->map_->scaleBy(2.0, p->lastPos_);
|
||||
}
|
||||
else if (ev->buttons() == Qt::RightButton)
|
||||
else if (ev->buttons() == Qt::MouseButton::RightButton)
|
||||
{
|
||||
p->map_->scaleBy(0.5, p->lastPos_);
|
||||
}
|
||||
|
|
@ -1303,11 +1314,11 @@ void MapWidget::mouseMoveEvent(QMouseEvent* ev)
|
|||
|
||||
if (!delta.isNull())
|
||||
{
|
||||
if (ev->buttons() == Qt::LeftButton)
|
||||
if (ev->buttons() == Qt::MouseButton::LeftButton)
|
||||
{
|
||||
p->map_->moveBy(delta);
|
||||
}
|
||||
else if (ev->buttons() == Qt::RightButton)
|
||||
else if (ev->buttons() == Qt::MouseButton::RightButton)
|
||||
{
|
||||
p->map_->rotateBy(p->lastPos_, ev->position());
|
||||
}
|
||||
|
|
@ -1736,6 +1747,18 @@ void MapWidgetImpl::RadarProductViewDisconnect()
|
|||
}
|
||||
}
|
||||
|
||||
void MapWidgetImpl::SelectNearestRadarSite(double latitude,
|
||||
double longitude,
|
||||
std::optional<std::string> type)
|
||||
{
|
||||
auto radarSite = config::RadarSite::FindNearest(latitude, longitude, type);
|
||||
|
||||
if (radarSite != nullptr)
|
||||
{
|
||||
widget_->SelectRadarSite(radarSite->id(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void MapWidgetImpl::SetRadarSite(const std::string& radarSite)
|
||||
{
|
||||
// Check if radar site has changed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue