FerrariRace

Remove and add GraphicsOverlay to MapView object.

Discussion created by FerrariRace on Sep 1, 2017
Latest reply on Sep 1, 2017 by FerrariRace

Hi everyone my name is George. I'm using ArcGIS 100.0 for qt version 5.9. I want  to remove  graphics overlays from my map, without recreating MapView, Map and other. My application have to receive coordinates, and display them on the map. As reference I've used  Simple Renderer from arcgis examples (It shows how to add and display point on the map). But i want to update position of Objects on my map during my application execution. How can I do that? Is it possible?

 

Simple example of what I've used, and what i want to do.  

---------------------------------------------------------------------------------------------------------------------------------------------------------------

// Create a map using the imagery basemap
  m_map = new Map(Basemap::imagery(this), this);

 

  // create graphics overlay
  m_graphicsOverlay = new GraphicsOverlay();

 

  // create red cross SimpleMarkerSymbol
  SimpleMarkerSymbol* crossSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Cross, QColor("red"), 12, this);

 

  // create renderer and set symbol to crossSymbol
  SimpleRenderer* simpleRenderer = new SimpleRenderer(crossSymbol, this);
  // set the SimpleRenderer to the GraphicsOverlay
  m_graphicsOverlay->setRenderer(simpleRenderer);

 

  // create points to render
  Point oldFaithfulPoint(-110.828140, 44.460458, SpatialReference::wgs84());
  Point cascadeGeyserPoint(-110.829004, 44.462438, SpatialReference::wgs84());
  Point plumeGeyserPoint(-110.829381, 44.462735, SpatialReference::wgs84());

 

  // create graphics using points and add them to GraphicsOverlay
  addPoint(oldFaithfulPoint);
  addPoint(cascadeGeyserPoint);
  addPoint(plumeGeyserPoint);

 

  // Set map to map view
  m_mapView->setMap(m_map);

 

  // set viewpoint using the two farthest points as an envelope with padding
  m_mapView->setViewpointGeometry(Envelope(oldFaithfulPoint, plumeGeyserPoint), 50);

 

  // add GraphicsOverlay to MapView
  m_mapView->graphicsOverlays()->append(m_graphicsOverlay);

------------------------------------------------------------------------------------------------------------------------------------------------------------

 

For simplicity, I want to delete all objects that exist on a map, and reload map with new.

Outcomes