<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Remove and add GraphicsOverlay to MapView object. in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/remove-and-add-graphicsoverlay-to-mapview-object/m-p/359019#M1800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone my name is George. I'm using ArcGIS 100.0 for qt version 5.9. I want&amp;nbsp; to remove&amp;nbsp; 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&amp;nbsp; 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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simple example of what I've used, and what i want to do. &amp;nbsp;&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;// Create a map using the imagery basemap&lt;BR /&gt;&amp;nbsp; m_map = new Map(Basemap::imagery(this), this);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create graphics overlay&lt;BR /&gt;&amp;nbsp; m_graphicsOverlay = new GraphicsOverlay();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create red cross SimpleMarkerSymbol&lt;BR /&gt;&amp;nbsp; SimpleMarkerSymbol* crossSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Cross, QColor("red"), 12, this);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create renderer and set symbol to crossSymbol&lt;BR /&gt;&amp;nbsp; SimpleRenderer* simpleRenderer = new SimpleRenderer(crossSymbol, this);&lt;BR /&gt;&amp;nbsp; // set the SimpleRenderer to the GraphicsOverlay&lt;BR /&gt;&amp;nbsp; m_graphicsOverlay-&amp;gt;setRenderer(simpleRenderer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create points to render&lt;BR /&gt;&amp;nbsp; Point oldFaithfulPoint(-110.828140, 44.460458, SpatialReference::wgs84());&lt;BR /&gt;&amp;nbsp; Point cascadeGeyserPoint(-110.829004, 44.462438, SpatialReference::wgs84());&lt;BR /&gt;&amp;nbsp; Point plumeGeyserPoint(-110.829381, 44.462735, SpatialReference::wgs84());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create graphics using points and add them to GraphicsOverlay&lt;BR /&gt;&amp;nbsp; addPoint(oldFaithfulPoint);&lt;BR /&gt;&amp;nbsp; addPoint(cascadeGeyserPoint);&lt;BR /&gt;&amp;nbsp; addPoint(plumeGeyserPoint);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Set map to map view&lt;BR /&gt;&amp;nbsp; m_mapView-&amp;gt;setMap(m_map);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // set viewpoint using the two farthest points as an envelope with padding&lt;BR /&gt;&amp;nbsp; m_mapView-&amp;gt;setViewpointGeometry(Envelope(oldFaithfulPoint, plumeGeyserPoint), 50);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // add GraphicsOverlay to MapView&lt;BR /&gt;&amp;nbsp; m_mapView-&amp;gt;graphicsOverlays()-&amp;gt;append(m_graphicsOverlay);&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For simplicity, I want to delete all objects that exist on a map, and reload map with new.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Sep 2017 09:51:12 GMT</pubDate>
    <dc:creator>GeorgeArnaut</dc:creator>
    <dc:date>2017-09-01T09:51:12Z</dc:date>
    <item>
      <title>Remove and add GraphicsOverlay to MapView object.</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/remove-and-add-graphicsoverlay-to-mapview-object/m-p/359019#M1800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone my name is George. I'm using ArcGIS 100.0 for qt version 5.9. I want&amp;nbsp; to remove&amp;nbsp; 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&amp;nbsp; 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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simple example of what I've used, and what i want to do. &amp;nbsp;&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;// Create a map using the imagery basemap&lt;BR /&gt;&amp;nbsp; m_map = new Map(Basemap::imagery(this), this);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create graphics overlay&lt;BR /&gt;&amp;nbsp; m_graphicsOverlay = new GraphicsOverlay();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create red cross SimpleMarkerSymbol&lt;BR /&gt;&amp;nbsp; SimpleMarkerSymbol* crossSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Cross, QColor("red"), 12, this);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create renderer and set symbol to crossSymbol&lt;BR /&gt;&amp;nbsp; SimpleRenderer* simpleRenderer = new SimpleRenderer(crossSymbol, this);&lt;BR /&gt;&amp;nbsp; // set the SimpleRenderer to the GraphicsOverlay&lt;BR /&gt;&amp;nbsp; m_graphicsOverlay-&amp;gt;setRenderer(simpleRenderer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create points to render&lt;BR /&gt;&amp;nbsp; Point oldFaithfulPoint(-110.828140, 44.460458, SpatialReference::wgs84());&lt;BR /&gt;&amp;nbsp; Point cascadeGeyserPoint(-110.829004, 44.462438, SpatialReference::wgs84());&lt;BR /&gt;&amp;nbsp; Point plumeGeyserPoint(-110.829381, 44.462735, SpatialReference::wgs84());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // create graphics using points and add them to GraphicsOverlay&lt;BR /&gt;&amp;nbsp; addPoint(oldFaithfulPoint);&lt;BR /&gt;&amp;nbsp; addPoint(cascadeGeyserPoint);&lt;BR /&gt;&amp;nbsp; addPoint(plumeGeyserPoint);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Set map to map view&lt;BR /&gt;&amp;nbsp; m_mapView-&amp;gt;setMap(m_map);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // set viewpoint using the two farthest points as an envelope with padding&lt;BR /&gt;&amp;nbsp; m_mapView-&amp;gt;setViewpointGeometry(Envelope(oldFaithfulPoint, plumeGeyserPoint), 50);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // add GraphicsOverlay to MapView&lt;BR /&gt;&amp;nbsp; m_mapView-&amp;gt;graphicsOverlays()-&amp;gt;append(m_graphicsOverlay);&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For simplicity, I want to delete all objects that exist on a map, and reload map with new.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 09:51:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/remove-and-add-graphicsoverlay-to-mapview-object/m-p/359019#M1800</guid>
      <dc:creator>GeorgeArnaut</dc:creator>
      <dc:date>2017-09-01T09:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Remove and add GraphicsOverlay to MapView object.</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/remove-and-add-graphicsoverlay-to-mapview-object/m-p/359020#M1801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi George, thanks for trying out the API (I'd recommend you check out version 100.1 when you have time as well).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the SimpleRenderer sample the addPoint code looks something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;// create graphic&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;Graphic* graphic = new Graphic(point, this);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;// add graphic to Graphic Overlay&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;m_graphicsOverlay-&amp;gt;graphics()-&amp;gt;append(graphic);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, the Graphic* object is added to a GraphicListModel* by calling the append function. I think you have 2 options to update the positions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 - keep track of the Graphics that you added and call setGeometry (&lt;A class="link-titled" href="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-graphic.html#setGeometry" title="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-graphic.html#setGeometry"&gt;Graphic Class | ArcGIS for Developers&lt;/A&gt;)&amp;nbsp;with your new Point as the geometry that you pass in. One way of doing this might be to keep a separate structure which maps your points names to the Graphic - e.g. QMap&amp;lt;QString,Graphic*&amp;gt; where the key&amp;nbsp;would be "oldFaithfulPoint" etc. and the value would be the Graphic* object you appended to the model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 - remove all of the graphics from the list model and re-add them for your new positions. You can call clear (&lt;A class="link-titled" href="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-graphiclistmodel.html#clear" title="https://developers.arcgis.com/qt/latest/cpp/api-reference/esri-arcgisruntime-graphiclistmodel.html#clear"&gt;GraphicListModel Class | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;) on the list model to remove the graphics. Since these Graphic* objects were created with "this" as their parent QObject (presumably your app) you will also need to delete these pointers in some way to free the memory. An alternative is to give them a parent QObject* which you delete and then recreate whenever you clear the model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Luke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 10:23:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/remove-and-add-graphicsoverlay-to-mapview-object/m-p/359020#M1801</guid>
      <dc:creator>LukeSmallwood</dc:creator>
      <dc:date>2017-09-01T10:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Remove and add GraphicsOverlay to MapView object.</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/remove-and-add-graphicsoverlay-to-mapview-object/m-p/359021#M1802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Luke, it was very useful advice! I've use some of your recommendations. &lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;I have already made some steps in this direction.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 16:30:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/remove-and-add-graphicsoverlay-to-mapview-object/m-p/359021#M1802</guid>
      <dc:creator>GeorgeArnaut</dc:creator>
      <dc:date>2017-09-01T16:30:17Z</dc:date>
    </item>
  </channel>
</rss>

