<?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 Keep a list of Polybuilder addPoints for use in another method? in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/keep-a-list-of-polybuilder-addpoints-for-use-in/m-p/1255183#M4850</link>
    <description>&lt;P&gt;Good afternoon, I got the following code which starts at constructor &lt;STRONG&gt;AppEditor()&lt;/STRONG&gt; and I'm handling mouse clicks to place markerGraphics at the clicked position. All works well so far except the method &lt;STRONG&gt;stopPlacingMarkers()&lt;/STRONG&gt;, which is called from a button on the UI, display an empty &lt;STRONG&gt;polyBuilder-ToGeometry()&lt;/STRONG&gt;. Shouldn't the &lt;STRONG&gt;markerPosition X and Y addPoint&lt;/STRONG&gt; be in there?&lt;/P&gt;&lt;P&gt;How would I go about appending all mouse click &lt;STRONG&gt;markerGraphics&lt;/STRONG&gt; so that it is available in the last method qDebug()?&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;void AppEditor::AppEditor()
{
	Esri::ArcGISRuntime::PolylineBuilder* polyBuilder = new PolylineBuilder(SpatialReference::wgs84(), this);
	Esri::ArcGISRuntime::SimpleMarkerSymbol* markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Square, QColor(Qt::black), 2.0, this);
}

void AppEditor::createdMarkerOnMap(Point markerPosition)
{
	polyBuilder-&amp;gt;addPoint(markerPosition.x(), markerPosition.y());
	// create a graphic from clicked marker position
    Esri::ArcGISRuntime::Graphic* markerGraphic = new Graphic(polyBuilder-&amp;gt;toGeometry(), markerSymbol, this);
	// add to graphics overlay and display on map
	graphicsOverlay-&amp;gt;graphics()-&amp;gt;append(markerGraphic);
}

void AppEditor::stopPlacingMarkers()
{
	// output polyBuilder point(s)
	qDebug() &amp;lt;&amp;lt; polyBuilder-&amp;gt;toGeometry();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any tips / help.&lt;/P&gt;</description>
    <pubDate>Sun, 05 Feb 2023 18:31:47 GMT</pubDate>
    <dc:creator>NothernCoder</dc:creator>
    <dc:date>2023-02-05T18:31:47Z</dc:date>
    <item>
      <title>Keep a list of Polybuilder addPoints for use in another method?</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/keep-a-list-of-polybuilder-addpoints-for-use-in/m-p/1255183#M4850</link>
      <description>&lt;P&gt;Good afternoon, I got the following code which starts at constructor &lt;STRONG&gt;AppEditor()&lt;/STRONG&gt; and I'm handling mouse clicks to place markerGraphics at the clicked position. All works well so far except the method &lt;STRONG&gt;stopPlacingMarkers()&lt;/STRONG&gt;, which is called from a button on the UI, display an empty &lt;STRONG&gt;polyBuilder-ToGeometry()&lt;/STRONG&gt;. Shouldn't the &lt;STRONG&gt;markerPosition X and Y addPoint&lt;/STRONG&gt; be in there?&lt;/P&gt;&lt;P&gt;How would I go about appending all mouse click &lt;STRONG&gt;markerGraphics&lt;/STRONG&gt; so that it is available in the last method qDebug()?&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;void AppEditor::AppEditor()
{
	Esri::ArcGISRuntime::PolylineBuilder* polyBuilder = new PolylineBuilder(SpatialReference::wgs84(), this);
	Esri::ArcGISRuntime::SimpleMarkerSymbol* markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle::Square, QColor(Qt::black), 2.0, this);
}

void AppEditor::createdMarkerOnMap(Point markerPosition)
{
	polyBuilder-&amp;gt;addPoint(markerPosition.x(), markerPosition.y());
	// create a graphic from clicked marker position
    Esri::ArcGISRuntime::Graphic* markerGraphic = new Graphic(polyBuilder-&amp;gt;toGeometry(), markerSymbol, this);
	// add to graphics overlay and display on map
	graphicsOverlay-&amp;gt;graphics()-&amp;gt;append(markerGraphic);
}

void AppEditor::stopPlacingMarkers()
{
	// output polyBuilder point(s)
	qDebug() &amp;lt;&amp;lt; polyBuilder-&amp;gt;toGeometry();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any tips / help.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 18:31:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/keep-a-list-of-polybuilder-addpoints-for-use-in/m-p/1255183#M4850</guid>
      <dc:creator>NothernCoder</dc:creator>
      <dc:date>2023-02-05T18:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Keep a list of Polybuilder addPoints for use in another method?</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/keep-a-list-of-polybuilder-addpoints-for-use-in/m-p/1255385#M4853</link>
      <description>&lt;P&gt;A quick way to see the x/y values of a polyBuilder would be to convert the geometry to JSON:&lt;/P&gt;&lt;P&gt;qDebug() &amp;lt;&amp;lt; PolyBuilder-&amp;gt;toGeometry().toJson();&lt;/P&gt;&lt;P&gt;This will give you something like:&lt;/P&gt;&lt;P&gt;"{\"hasZ\":true,\"paths\":[[[-160,34,0],[-175,40,25],[-182,36,0]]],\"spatialReference\":{\"wkid\":4326}}"&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 16:23:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/keep-a-list-of-polybuilder-addpoints-for-use-in/m-p/1255385#M4853</guid>
      <dc:creator>PaulSturm</dc:creator>
      <dc:date>2023-02-06T16:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Keep a list of Polybuilder addPoints for use in another method?</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/keep-a-list-of-polybuilder-addpoints-for-use-in/m-p/1255386#M4854</link>
      <description>&lt;P&gt;Good catch, never noticed that &lt;STRONG&gt;.toJson()&lt;/STRONG&gt; method.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 16:25:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/keep-a-list-of-polybuilder-addpoints-for-use-in/m-p/1255386#M4854</guid>
      <dc:creator>NothernCoder</dc:creator>
      <dc:date>2023-02-06T16:25:58Z</dc:date>
    </item>
  </channel>
</rss>

