Skip to content

Commit

Permalink
Jare8800/fix clusters (#1698)
Browse files Browse the repository at this point in the history
* no message

* redundant clear

* forgot comment when moved.
  • Loading branch information
jared-2016 authored Mar 29, 2024
1 parent b892382 commit 1d3af1f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,29 @@ void ConfigureClusters::mouseClicked(QMouseEvent& mouseEvent)
if (!m_layer)
return;

// clear the list of popup content
m_popupContent.clear();

// clear cluster selection
if (m_aggregateGeoElement)
m_aggregateGeoElement->setSelected(false);

// Clean up any children objects associated with this parent
m_resultParent.reset(new QObject(this));
m_aggregateGeoElement = nullptr;

// Identify the tapped observation.
m_mapView->identifyLayerAsync(m_layer, mouseEvent.position(), 3.0, true).then(this, [this](IdentifyLayerResult* result)
m_mapView->identifyLayerAsync(m_layer, mouseEvent.position(), 3.0, true, m_resultParent.get()).then(this, [this](IdentifyLayerResult* result)
{
// clear the list of popup content
m_popupContent.clear();

// clear cluster selection
if (m_aggregateGeoElement.get())
if (m_aggregateGeoElement)
m_aggregateGeoElement->setSelected(false);

for (Popup* popup: result->popups())
{
// if the identified object is a cluster, select it
m_aggregateGeoElement.reset(dynamic_cast<AggregateGeoElement*>(popup->geoElement()));
if (m_aggregateGeoElement.get())
m_aggregateGeoElement = dynamic_cast<AggregateGeoElement*>(popup->geoElement());
if (m_aggregateGeoElement)
m_aggregateGeoElement->setSelected(true);

const auto attributes = popup->geoElement()->attributes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ class ConfigureClusters : public QObject
Esri::ArcGISRuntime::MapQuickView* m_mapView = nullptr;
Esri::ArcGISRuntime::FeatureLayer* m_layer = nullptr;
Esri::ArcGISRuntime::ClusteringFeatureReduction* m_clusteringFeatureReduction = nullptr;
QScopedPointer<Esri::ArcGISRuntime::AggregateGeoElement> m_aggregateGeoElement;
QString m_popupContent;

QScopedPointer<QObject> m_resultParent;
Esri::ArcGISRuntime::AggregateGeoElement* m_aggregateGeoElement = nullptr;
};

#endif // ConfigureClusters_H

0 comments on commit 1d3af1f

Please sign in to comment.