mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:30:05 +00:00
Mouse picking boilerplate
This commit is contained in:
parent
c7487281ad
commit
38b56be7c4
10 changed files with 115 additions and 17 deletions
|
|
@ -126,6 +126,7 @@ public:
|
|||
void RadarProductViewConnect();
|
||||
void RadarProductViewDisconnect();
|
||||
void RemovePlacefileLayer(const std::string& placefileName);
|
||||
void RunMousePicking();
|
||||
void SetRadarSite(const std::string& radarSite);
|
||||
void UpdatePlacefileLayers();
|
||||
bool UpdateStoredMapParameters();
|
||||
|
|
@ -1022,6 +1023,9 @@ void MapWidget::paintGL()
|
|||
size() * pixelRatio());
|
||||
p->map_->render();
|
||||
|
||||
// Perform mouse picking
|
||||
p->RunMousePicking();
|
||||
|
||||
// Render ImGui Frame
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
|
|
@ -1030,6 +1034,25 @@ void MapWidget::paintGL()
|
|||
Q_EMIT WidgetPainted();
|
||||
}
|
||||
|
||||
void MapWidgetImpl::RunMousePicking()
|
||||
{
|
||||
const QMapLibreGL::CustomLayerRenderParameters params =
|
||||
context_->render_parameters();
|
||||
|
||||
// For each layer in reverse
|
||||
// TODO: All Generic Layers, not just Placefile Layers
|
||||
for (auto it = placefileLayers_.rbegin(); it != placefileLayers_.rend();
|
||||
++it)
|
||||
{
|
||||
// Run mouse picking for each layer
|
||||
if ((*it)->RunMousePicking(params))
|
||||
{
|
||||
// If a draw item was picked, don't process additional layers
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MapWidget::mapChanged(QMapLibreGL::Map::MapChange mapChange)
|
||||
{
|
||||
switch (mapChange)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue