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 :
DeleteMarker doesn't do its job, the old markers are still there after refreshing the map.
The solution I found, is to recreate a new vtkMapMarkerSet :