Skip to content

vtkMapMarkerSet::DeleteMarker doesn't delete a marker #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
embeddedmz opened this issue Mar 28, 2019 · 2 comments
Closed

vtkMapMarkerSet::DeleteMarker doesn't delete a marker #114

embeddedmz opened this issue Mar 28, 2019 · 2 comments

Comments

@embeddedmz
Copy link

embeddedmz commented Mar 28, 2019

vtkWeakPointer<vtkFeatureLayer> m_layer;
vtkSmartPointer<vtkMapMarkerSet> m_orangeMarkerSet;
std::vector<vtkIdType> m_orangeMarkers; // used to store markers ID in order to delete them later
...
double orange[4] = {1, 0.647059, 0, 1};
// Setup the colors of markers
m_orangeMarkerSet->SetColor(orange);
m_orangeMarkerSet->SetClustering(true);
...
m_layer->AddFeature(m_orangeMarkerSet.GetPointer());

// adding a marker at a particular lat/long
const vtkIdType markerId = m_orangeMarkerSet->AddMarker(latitude, longitude);
m_orangeMarkers.push_back(markerId); // saving its ID to remove it later

DeleteMarker doesn't do its job, the old markers are still there after refreshing the map.

   for (const auto id : m_orangeMarkers)
    {
        m_orangeMarkerSet->DeleteMarker(id);
    }
    m_orangeMarkers.clear();
    m_orangeMarkerSet->Update();
//....
// refreshing vtkMap... the map is showing old and new markers !

The solution I found, is to recreate a new vtkMapMarkerSet :

m_layer->RemoveFeature(m_orangeMarkerSet.GetPointer());
m_orangeMarkerSet = vtkSmartPointer<vtkMapMarkerSet>::New();
m_layer->AddFeature(m_orangeMarkerSet.GetPointer());
@embeddedmz
Copy link
Author

Fixed here : #116

1 similar comment
@embeddedmz
Copy link
Author

Fixed here : #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant