mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:50:05 +00:00
Add geographic coordinates to mouse picking functions
This commit is contained in:
parent
6e04e1fab3
commit
a2f2181f1b
19 changed files with 72 additions and 42 deletions
|
|
@ -57,7 +57,8 @@ bool DrawItem::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& /* mouseGlobalPos */,
|
const QPointF& /* mouseGlobalPos */,
|
||||||
const glm::vec2& /* mouseCoords */)
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
// By default, the draw item is not picked
|
// By default, the draw item is not picked
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/gl/gl.hpp>
|
#include <scwx/qt/gl/gl.hpp>
|
||||||
|
#include <scwx/common/geographic.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
@ -41,14 +42,16 @@ public:
|
||||||
* @param [in] mouseLocalPos Mouse cursor widget position
|
* @param [in] mouseLocalPos Mouse cursor widget position
|
||||||
* @param [in] mouseGlobalPos Mouse cursor screen position
|
* @param [in] mouseGlobalPos Mouse cursor screen position
|
||||||
* @param [in] mouseCoords Mouse cursor location in map screen coordinates
|
* @param [in] mouseCoords Mouse cursor location in map screen coordinates
|
||||||
|
* @param [in] mouseGeoCoords Mouse cursor location in geographic coordinates
|
||||||
*
|
*
|
||||||
* @return true if the draw item was picked, otherwise false
|
* @return true if the draw item was picked, otherwise false
|
||||||
*/
|
*/
|
||||||
virtual bool
|
virtual bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords);
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -794,7 +794,8 @@ bool GeoIcons::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords)
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
std::unique_lock lock {p->iconMutex_};
|
std::unique_lock lock {p->iconMutex_};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,10 @@ public:
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords) override;
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the visibility of the geo icons.
|
* Sets the visibility of the geo icons.
|
||||||
|
|
|
||||||
|
|
@ -688,7 +688,8 @@ bool PlacefileIcons::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords)
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
std::unique_lock lock {p->iconMutex_};
|
std::unique_lock lock {p->iconMutex_};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,10 @@ public:
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords) override;
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets and prepares the draw item for adding a new set of icons.
|
* Resets and prepares the draw item for adding a new set of icons.
|
||||||
|
|
|
||||||
|
|
@ -499,7 +499,8 @@ bool PlacefileLines::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords)
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
std::unique_lock lock {p->lineMutex_};
|
std::unique_lock lock {p->lineMutex_};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,10 @@ public:
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords) override;
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets and prepares the draw item for adding a new set of lines.
|
* Resets and prepares the draw item for adding a new set of lines.
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,8 @@ bool PlacefileText::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& /* mouseCoords */)
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
bool itemPicked = false;
|
bool itemPicked = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,10 @@ public:
|
||||||
void Deinitialize() override;
|
void Deinitialize() override;
|
||||||
|
|
||||||
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords) override;
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets and prepares the draw item for adding a new set of text.
|
* Resets and prepares the draw item for adding a new set of text.
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,8 @@ bool DrawLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords)
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords)
|
||||||
{
|
{
|
||||||
bool itemPicked = false;
|
bool itemPicked = false;
|
||||||
|
|
||||||
|
|
@ -88,8 +89,11 @@ bool DrawLayer::RunMousePicking(
|
||||||
for (auto it = p->drawList_.rbegin(); it != p->drawList_.rend(); ++it)
|
for (auto it = p->drawList_.rbegin(); it != p->drawList_.rend(); ++it)
|
||||||
{
|
{
|
||||||
// Run mouse picking on each draw item
|
// Run mouse picking on each draw item
|
||||||
if ((*it)->RunMousePicking(
|
if ((*it)->RunMousePicking(params,
|
||||||
params, mouseLocalPos, mouseGlobalPos, mouseCoords))
|
mouseLocalPos,
|
||||||
|
mouseGlobalPos,
|
||||||
|
mouseCoords,
|
||||||
|
mouseGeoCoords))
|
||||||
{
|
{
|
||||||
// If a draw item was picked, don't process additional items
|
// If a draw item was picked, don't process additional items
|
||||||
itemPicked = true;
|
itemPicked = true;
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,10 @@ public:
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords) override;
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem);
|
void AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ bool GenericLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& /* mouseGlobalPos */,
|
const QPointF& /* mouseGlobalPos */,
|
||||||
const glm::vec2& /* mousePos */)
|
const glm::vec2& /* mousePos */,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
// By default, the layer has nothing to pick
|
// By default, the layer has nothing to pick
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <scwx/qt/map/map_context.hpp>
|
#include <scwx/qt/map/map_context.hpp>
|
||||||
|
#include <scwx/common/geographic.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
@ -36,14 +37,16 @@ public:
|
||||||
* @param [in] mouseLocalPos Mouse cursor widget position
|
* @param [in] mouseLocalPos Mouse cursor widget position
|
||||||
* @param [in] mouseGlobalPos Mouse cursor screen position
|
* @param [in] mouseGlobalPos Mouse cursor screen position
|
||||||
* @param [in] mouseCoords Mouse cursor location in map screen coordinates
|
* @param [in] mouseCoords Mouse cursor location in map screen coordinates
|
||||||
|
* @param [in] mouseGeoCoords Mouse cursor location in geographic coordinates
|
||||||
*
|
*
|
||||||
* @return true if a draw item was picked, otherwise false
|
* @return true if a draw item was picked, otherwise false
|
||||||
*/
|
*/
|
||||||
virtual bool
|
virtual bool
|
||||||
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseLocalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& mouseCoords);
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void NeedsRendering();
|
void NeedsRendering();
|
||||||
|
|
|
||||||
|
|
@ -1215,8 +1215,11 @@ void MapWidgetImpl::RunMousePicking()
|
||||||
for (auto it = genericLayers_.rbegin(); it != genericLayers_.rend(); ++it)
|
for (auto it = genericLayers_.rbegin(); it != genericLayers_.rend(); ++it)
|
||||||
{
|
{
|
||||||
// Run mouse picking for each layer
|
// Run mouse picking for each layer
|
||||||
if ((*it)->RunMousePicking(
|
if ((*it)->RunMousePicking(params,
|
||||||
params, lastPos_, lastGlobalPos_, mouseScreenCoordinate))
|
lastPos_,
|
||||||
|
lastGlobalPos_,
|
||||||
|
mouseScreenCoordinate,
|
||||||
|
{coordinate.first, coordinate.second}))
|
||||||
{
|
{
|
||||||
// If a draw item was picked, don't process additional layers
|
// If a draw item was picked, don't process additional layers
|
||||||
itemPicked = true;
|
itemPicked = true;
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,8 @@ bool OverlayLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& /* mouseGlobalPos */,
|
const QPointF& /* mouseGlobalPos */,
|
||||||
const glm::vec2& /* mouseCoords */)
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
// If sweep time was picked, don't process additional items
|
// If sweep time was picked, don't process additional items
|
||||||
return p->sweepTimePicked_;
|
return p->sweepTimePicked_;
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,12 @@ public:
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
bool
|
||||||
const QPointF& mouseLocalPos,
|
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const glm::vec2& mouseCoords) override final;
|
const QPointF& mouseGlobalPos,
|
||||||
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords) override final;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void UpdateSweepTimeNextFrame();
|
void UpdateSweepTimeNextFrame();
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,8 @@ bool RadarSiteLayer::RunMousePicking(
|
||||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
||||||
const QPointF& /* mouseLocalPos */,
|
const QPointF& /* mouseLocalPos */,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseGlobalPos,
|
||||||
const glm::vec2& /* mouseCoords */)
|
const glm::vec2& /* mouseCoords */,
|
||||||
|
const common::Coordinate& /* mouseGeoCoords */)
|
||||||
{
|
{
|
||||||
if (!p->hoverText_.empty())
|
if (!p->hoverText_.empty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,12 @@ public:
|
||||||
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
void Render(const QMapLibreGL::CustomLayerRenderParameters&) override final;
|
||||||
void Deinitialize() override final;
|
void Deinitialize() override final;
|
||||||
|
|
||||||
bool RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
bool
|
||||||
const QPointF& mouseLocalPos,
|
RunMousePicking(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||||
const QPointF& mouseGlobalPos,
|
const QPointF& mouseLocalPos,
|
||||||
const glm::vec2& mouseCoords) override final;
|
const QPointF& mouseGlobalPos,
|
||||||
|
const glm::vec2& mouseCoords,
|
||||||
|
const common::Coordinate& mouseGeoCoords) override final;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void RadarSiteSelected(const std::string& id);
|
void RadarSiteSelected(const std::string& id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue