<?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 Re: Draw circle with centre point and clear circle when user change radius in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475760#M3269</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In example it shows the conversion from touch event to map location, that is working fine and we have no question on that. The problem which we are facing in&amp;nbsp; below method&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public static &lt;/SPAN&gt;Point convertToMapPoint(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;longitude, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;latitude,
                                      SpatialReference mapReference) {
    Point wgsPoint = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Point(longitude, latitude);
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;(Point) GeometryEngine.&lt;SPAN&gt;project&lt;/SPAN&gt;(wgsPoint,mapReference);
}
For example if we have location value "-102.29872652008582, 21.879840237531294" then with help of above method I need to convert location to mapView point which is near to [-1.1387842145016305E7, 2497104.718795404] as value.&lt;/PRE&gt;&lt;P&gt;Could you please suggest what we can do in that case&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:02:34 GMT</pubDate>
    <dc:creator>KalpitMistry</dc:creator>
    <dc:date>2021-12-11T21:02:34Z</dc:date>
    <item>
      <title>Draw circle with centre point and clear circle when user change radius</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475758#M3267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We had developer an application in past which had integrated old Arc gis&amp;nbsp; core Android library. Now we have migrated from 10x to 100.9.0 Runtime library. And we have observed many functionality is not working due to method changed. Most of the functionality we had fixed but we are stuck at 2 functionality which is like draw circle with user centre location.&lt;/P&gt;&lt;P&gt;Please see my below code which I have used to draw circle.&lt;/P&gt;&lt;P&gt;Actually we are able to get the circle on map but it is not with the centre point which I have used. I have passed my location as param you can see in below method, the first one param.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;private &lt;/SPAN&gt;Graphic getCircleForMapReference(LatLng position, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;radius, SpatialReference mapReference, MapView mapView) {
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;pointCount = &lt;SPAN style="color: #0000ff;"&gt;360&lt;/SPAN&gt;;

    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(radius &amp;gt; &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;)
    {
        Application application = ApplicationUtil.&lt;SPAN&gt;getInstance&lt;/SPAN&gt;().getApplicationInstance();
        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;color = application.getResources().getColor(com.cityshob.responder.R.color.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;investigationCircleOrange&lt;/SPAN&gt;);
        Point center = LocationUtils.&lt;SPAN&gt;convertToMapPoint&lt;/SPAN&gt;(position, mapReference);
        SimpleLineSymbol lineSymbol = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;SimpleLineSymbol(SimpleLineSymbol.Style.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;SOLID&lt;/SPAN&gt;,color, &lt;SPAN style="color: #0000ff;"&gt;7&lt;/SPAN&gt;);
        PointCollection pointCollection = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;PointCollection(SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;());


        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;for &lt;/SPAN&gt;(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;i = &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;; i &amp;lt;= pointCount; i++)
        {
            &lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;rad = &lt;SPAN style="color: #0000ff;"&gt;2 &lt;/SPAN&gt;* Math.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;PI &lt;/SPAN&gt;/ pointCount * i;
            &lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;x = Math.&lt;SPAN&gt;cos&lt;/SPAN&gt;(rad) * radius + center.getX();
            &lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;y = Math.&lt;SPAN&gt;sin&lt;/SPAN&gt;(rad) * radius + center.getY();

            android.graphics.Point screenPoint = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;android.graphics.Point((&lt;SPAN style="color: #000080; font-weight: bold;"&gt;int&lt;/SPAN&gt;) Math.&lt;SPAN&gt;round&lt;/SPAN&gt;(x),(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;int&lt;/SPAN&gt;) Math.&lt;SPAN&gt;round&lt;/SPAN&gt;(y));
            Point mapPoint = mapView.screenToLocation(screenPoint);
            Point wgs84Point = (Point) GeometryEngine.&lt;SPAN&gt;project&lt;/SPAN&gt;(mapPoint, SpatialReferences.&lt;SPAN&gt;getWgs84&lt;/SPAN&gt;());
            pointCollection.add(wgs84Point.getX(),wgs84Point.getY());
        }
        Polyline lineGeometry = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Polyline(pointCollection);
        Graphic lineGraphic = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Graphic(lineGeometry, lineSymbol);
        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;lineGraphic;
    }

    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return null&lt;/SPAN&gt;;
}

Second issue which I am facing is to clear that circle. I used below line of code to clear but it is not working.
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;mGraphicsLayer&lt;/SPAN&gt;.getGraphics().remove(circle)
where 
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;mGraphicsLayer is the object of GraphicOverlay
circle is the index where I have added object.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/PRE&gt;we are stuck on above 2 points, Please help us as soon as possible. Please let us know what we had implemented wrong.&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:02:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475758#M3267</guid>
      <dc:creator>KalpitMistry</dc:creator>
      <dc:date>2021-12-11T21:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Draw circle with centre point and clear circle when user change radius</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475759#M3268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello! Adding a planar buffer as a graphic sounds like it'll do exactly what you're looking for. See this sample:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/buffer" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/buffer"&gt;arcgis-runtime-samples-android/java/buffer at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To your second point, `&lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 16px;"&gt;mGraphicsLayer&lt;/SPAN&gt;.getGraphics()` returns a list, so you should be correct in calling remove() on it. Are you sure the index isn't out by one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the circle is the only graphic in the graphicsOverlay you can call graphicsOverlay.getGraphics().clear() like here:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-samples-android/blob/master/java/buffer/src/main/java/com/esri/arcgisruntime/sample/buffer/MainActivity.java#L141" title="https://github.com/Esri/arcgis-runtime-samples-android/blob/master/java/buffer/src/main/java/com/esri/arcgisruntime/sample/buffer/MainActivity.java#L141"&gt;arcgis-runtime-samples-android/MainActivity.java at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Trevor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Sep 2020 13:18:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475759#M3268</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-09-08T13:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Draw circle with centre point and clear circle when user change radius</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475760#M3269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In example it shows the conversion from touch event to map location, that is working fine and we have no question on that. The problem which we are facing in&amp;nbsp; below method&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public static &lt;/SPAN&gt;Point convertToMapPoint(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;longitude, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;latitude,
                                      SpatialReference mapReference) {
    Point wgsPoint = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Point(longitude, latitude);
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;(Point) GeometryEngine.&lt;SPAN&gt;project&lt;/SPAN&gt;(wgsPoint,mapReference);
}
For example if we have location value "-102.29872652008582, 21.879840237531294" then with help of above method I need to convert location to mapView point which is near to [-1.1387842145016305E7, 2497104.718795404] as value.&lt;/PRE&gt;&lt;P&gt;Could you please suggest what we can do in that case&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:02:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475760#M3269</guid>
      <dc:creator>KalpitMistry</dc:creator>
      <dc:date>2021-12-11T21:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Draw circle with centre point and clear circle when user change radius</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475761#M3270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thanks for the reply.&lt;BR /&gt;Can you please help me to draw circle with dynamic radius. I have my current lat/long which is centre point and through that centre point i need to draw circle for that I need to calculate x and y coordinates.&amp;nbsp; I have used below equation to calculate x and y&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;rad = &lt;SPAN style="color: #0000ff;"&gt;2 &lt;/SPAN&gt;* Math.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;PI &lt;/SPAN&gt;/ pointCount * i;
&lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;x = Math.&lt;SPAN&gt;cos&lt;/SPAN&gt;(rad) * radius + center.getX();
&lt;SPAN style="color: #000080; font-weight: bold;"&gt;double &lt;/SPAN&gt;y = Math.&lt;SPAN&gt;sin&lt;/SPAN&gt;(rad) * radius + center.getY();&lt;/PRE&gt;&lt;P&gt;after that convert x,y to the map location using mapToLocation method, it will return me object of Point which I am adding into PointCollection object.&lt;/P&gt;&lt;P&gt;Please suggest me what I did wrong.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:02:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/draw-circle-with-centre-point-and-clear-circle/m-p/475761#M3270</guid>
      <dc:creator>KalpitMistry</dc:creator>
      <dc:date>2021-12-11T21:02:36Z</dc:date>
    </item>
  </channel>
</rss>

